This commit is contained in:
zbatte committed 2026-07-02 15:54:39 -06:00
commit 9883323161
17470 files changed
+4470592

No files matched your search

@@ -0,0 +1,65 @@
<?php
use Gravity_Forms\Gravity_Forms\Config\GF_Config_Service_Provider;
use Gravity_Forms\Gravity_Forms\GF_Service_Container;
use Gravity_Forms\Gravity_Forms\GF_Service_Provider;
/**
* Class System_Report_Service_Provider
*
* Service provider for the system report.
*
* @package Gravity_Forms\Gravity_Forms\System_Report;
*/
class GF_System_Report_Service_Provider extends GF_Service_Provider {
const SYSTEM_REPORT = 'system_report';
/**
* Register services to the container.
*
* @since 2.7.1
*
* @param GF_Service_Container $container
*/
public function register( GF_Service_Container $container ) {
require_once( plugin_dir_path( __FILE__ ) . '/class-gf-system-report.php' );
$this->system_report( $container );
}
/**
* Initialize any actions or hooks.
*
* @since 2.7.1
*
* @param GF_Service_Container $container
*
* @return void
*/
public function init( GF_Service_Container $container ) {
add_action( 'admin_init', function () use ( $container ) {
if ( GFForms::get_page_query_arg() == 'gf_system_status' ) {
$container->get( self::SYSTEM_REPORT )->remove_emoji_script();
}
} );
}
/**
* Register System Report services.
*
* @since 2.7.1
*
* @param GF_Service_Container $container
*
* @return void
*/
private function system_report( GF_Service_Container $container ) {
$container->add( self::SYSTEM_REPORT, function () use ( $container ) {
return new GF_System_Report();
} );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,130 @@
<?php
if ( ! class_exists( 'GFForms' ) ) {
die();
}
/**
* Class GF_System_Status
*
* Handles the system status page.
*
* @since 2.2
*/
class GF_System_Status {
/**
* Determines which system status page to display.
*
* @since 2.2
* @access public
*/
public static function system_status_page() {
$subview = rgget( 'subview' ) ? rgget( 'subview' ) : 'report';
switch ( $subview ) {
case 'report':
GF_System_Report::system_report();
break;
case 'updates':
GF_Update::updates();
break;
default:
/**
* Fires when the settings page view is determined
*
* Used to add additional pages to the form settings
*
* @since Unknown
*
* @param string $subview Used to complete the action name, allowing an additional subview to be detected
*/
do_action( "gform_system_status_page_{$subview}" );
}
}
/**
* Get System Status page subviews.
*
* @since 2.2
* @access public
*
* @return array
*/
public static function get_subviews() {
// Define default subview.
$subviews = array(
10 => array(
'name' => 'report',
'label' => __( 'System Report', 'gravityforms' ),
),
);
// Add Update subview if user has capabilities.
if ( current_user_can( 'install_plugins' ) ) {
$subviews[20] = array(
'name' => 'updates',
'label' => __( 'Updates', 'gravityforms' ),
);
}
/**
* Modify menu items which will appear in the System Status menu.
*
* @since 2.2
* @param array $subviews An array of menu items to be displayed on the System Status page.
*/
$subviews = apply_filters( 'gform_system_status_menu', $subviews );
ksort( $subviews, SORT_NUMERIC );
return $subviews;
}
/**
* Get current System Status subview.
*
* @since 2.2
* @access public
*
* @return string
*/
public static function get_current_subview() {
return rgempty( 'subview', $_GET ) ? 'report' : rgget( 'subview' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
}
/**
* Render System Status page header.
*
* @since 2.2
* @access public
*
* @param string $title Page title.
*
* @uses GFCommon::display_dismissible_message()
* @uses GFCommon::get_base_url()
* @uses GFCommon::get_browser_class()
* @uses GFCommon::get_remote_message()
* @uses GFSystemStatus::get_current_subview()
* @uses GFSystemStatus::get_subviews()
*/
public static function page_header( $title = '' ) {
GFForms::admin_header( self::get_subviews(), false );
}
/**
* Render System Status page footer.
*
* @since 2.2
* @access public
*/
public static function page_footer() {
GFForms::admin_footer();
}
}
@@ -0,0 +1,225 @@
<?php
if ( ! class_exists( 'GFForms' ) ) {
die();
}
/**
* Class GF_Update
*
* Handles the Updates subview on the System Status page.
*/
class GF_Update {
/**
* Display updates page.
*
* @since 2.2
* @access public
*
* @uses GFSystemReport::get_system_report()
* @uses GFSystemReport::maybe_process_action()
* @uses GFSystemReport::prepare_item_value()
* @uses GFSystemStatus::page_footer()
* @uses GFSystemStatus::page_header()
*/
public static function updates() {
// If user does not have access to this page, die.
if ( ! GFCommon::current_user_can_any( 'gravityforms_view_updates' ) ) {
wp_die( esc_html__( "You don't have permissions to view this page", 'gravityforms' ) );
}
// Get available updates.
$updates = self::available_updates();
// Display page header.
GF_System_Status::page_header();
wp_print_styles( array( 'thickbox' ) );
?>
<div class="gform-settings__content">
<table cellspacing="0" cellpadding="0" class="wp-list-table plugins">
<thead>
<tr id="updates">
<th scope="col"
class="manage-column column-name column-primary"><?php esc_html_e( 'Updates', 'gravityforms' ) ?></th>
</tr>
<tr>
<th scope="col" id="name"
class="manage-column column-name column-primary"><?php esc_html_e( 'Plugin', 'gravityforms' ); ?></th>
<th scope="col" id="description"
class="manage-column column-description"><?php esc_html_e( 'Description', 'gravityforms' ); ?></th>
</tr>
</thead>
<tbody id="the-list">
<?php
$plugins = get_plugins();
// Loop through updates.
foreach ( $updates as $update ) {
$installed_version = rgar( $update, 'installed_version' );
$latest_version = rgar( $update, 'latest_version' );
$name = rgar( $update, 'name' );
$slug = rgar( $update, 'slug' );
$plugin_path = rgar( $update, 'path' );
$update_available = ! empty( $latest_version ) && version_compare( $installed_version, $latest_version, '<' );
$update_class = $update_available ? ' update' : '';
$settings_link = $slug == 'gravityforms' ? admin_url( 'admin.php?page=gf_settings' ) : admin_url( 'admin.php?page=gf_settings&subview=' . $slug );
$plugin = rgar( $plugins, $update['path'] );
$description = rgar( $plugin, 'Description' );
$installed_version = rgar( $update, 'installed_version' );
?>
<tr class="inactive<?php echo esc_attr( $update_class ) ?>" data-slug="admin-bar-form-search"
data-plugin="gw-admin-bar-form-manager.php">
<td class="plugin-title column-primary"><strong><?php echo esc_html( $name ) ?></strong>
<div class="row-actions visible">
<span class="deactivate"><a
href="<?php echo esc_url( $settings_link ); ?>"><?php esc_html_e( 'Settings', 'gravityforms' ) ?></a></span>
</div>
</td>
<td class="column-description desc">
<div class="plugin-description">
<p><?php echo esc_html( $description ); ?></p>
</div>
<div class="active second plugin-version-author-uri">
Version <?php echo esc_html( $installed_version ); ?> |
<a href="<?php echo esc_url( rgar( $plugin, 'PluginURI' ) ); ?>"><?php esc_html_e( 'Visit plugin page', 'gravityforms' ); ?></a>
</div>
<?php
$messages = GFForms::get_status_messages( $plugin_path, $plugin, $slug, $installed_version );
if ( ! empty( $messages) ) {
echo self::get_markup_for_status_messages( $messages ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
// Display page footer.
GF_System_Status::page_footer();
}
/**
* Get available Gravity Forms updates.
*
* @since 2.2
* @access public
*
* @uses GFCommon::get_version_info()
*
* @return array
*/
public static function available_updates() {
// Initialize updates array.
$updates = array();
// Get Gravity Forms version info.
$version_info = GFCommon::get_version_info( false );
// Define Gravity Forms plugin path.
$plugin_path = plugin_basename( GFCommon::get_base_path() . '/gravityforms.php' );
// Get upgrade URL.
$upgrade_url = wp_nonce_url( 'update.php?action=upgrade-plugin&amp;plugin=' . urlencode( $plugin_path ), 'upgrade-plugin_' . $plugin_path );
$version_message = array();
// Prepare version message and icon.
if ( empty( $version_info['version'] ) || version_compare( GFForms::$version, $version_info['version'], '>=' ) ) {
$version_icon = 'dashicons-yes';
$version_message[] = esc_html__( 'Your version of Gravity Forms is up to date.', 'gravityforms' );
} else {
if ( rgar( $version_info, 'is_valid_key' ) && rgar( $version_info, 'is_available' ) ) {
$version_icon = 'dashicons-no';
$version_message[] = sprintf(
'%s<p>%s</p>',
esc_html__( 'There is a new version of Gravity Forms available.', 'gravityforms' ),
esc_html__( 'You can update to the latest version automatically or download the update and install it manually.', 'gravityforms' )
);
} else {
$version_icon = 'dashicons-no';
$version_message[] = sprintf(
'%s<p>%s</p>',
esc_html__( 'There is a new version of Gravity Forms available.', 'gravityforms' ),
sprintf(
esc_html__( '%sRegister%s your copy of Gravity Forms to receive access to automatic updates and support. Need a license key? %sPurchase one now%s.', 'gravityforms' ),
'<a href="admin.php?page=gf_settings">',
'</a>',
'<a href="https://www.gravityforms.com">',
'</a>'
)
);
}
}
// Add Gravity Forms core to updates array.
$updates[] = array(
'is_valid_key' => rgar( $version_info, 'is_valid_key' ),
'name' => esc_html__( 'Gravity Forms', 'gravityforms' ),
'path' => $plugin_path,
'slug' => 'gravityforms',
'latest_version' => rgar( $version_info, 'version' ),
'installed_version' => GFCommon::$version,
'upgrade_url' => $upgrade_url,
'download_url' => rgar( $version_info, 'url' ),
'version_icon' => $version_icon,
'version_message' => $version_message,
);
/**
* Modify plugins displayed on the Updates page.
*
* @since 2.2
*
* @param array $updates An array of plugins displayed on the Updates page.
*/
$updates = apply_filters( 'gform_updates_list', $updates );
return $updates;
}
/**
* Generates the markup for displaying the status messages.
*
* @since: 2.9
*
* @param array $messages An array of status messages.
*
* @return string The html markup for the status messages.
*/
public static function get_markup_for_status_messages( $messages ) {
$markup = '';
if ( ! empty( $messages ) ) {
$markup .= '<div class="update-message notice inline notice-warning notice-alt">';
$markup .= '<p>';
$markup .= implode( ' ', $messages );
$markup .= '</p>';
$markup .= '</div>';
}
return $markup;
}
}
@@ -0,0 +1,7 @@
/*!
* clipboard.js v1.5.16
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Clipboard=e()}}(function(){var e,t,n;return function e(t,n,i){function o(a,c){if(!n[a]){if(!t[a]){var l="function"==typeof require&&require;if(!c&&l)return l(a,!0);if(r)return r(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var u=n[a]={exports:{}};t[a][0].call(u.exports,function(e){var n=t[a][1][e];return o(n?n:e)},u,u.exports,e,t,n,i)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;a<i.length;a++)o(i[a]);return o}({1:[function(e,t,n){function i(e,t){for(;e&&e.nodeType!==o;){if(e.matches(t))return e;e=e.parentNode}}var o=9;if(Element&&!Element.prototype.matches){var r=Element.prototype;r.matches=r.matchesSelector||r.mozMatchesSelector||r.msMatchesSelector||r.oMatchesSelector||r.webkitMatchesSelector}t.exports=i},{}],2:[function(e,t,n){function i(e,t,n,i,r){var a=o.apply(this,arguments);return e.addEventListener(n,a,r),{destroy:function(){e.removeEventListener(n,a,r)}}}function o(e,t,n,i){return function(n){n.delegateTarget=r(n.target,t),n.delegateTarget&&i.call(e,n)}}var r=e("./closest");t.exports=i},{"./closest":1}],3:[function(e,t,n){n.node=function(e){return void 0!==e&&e instanceof HTMLElement&&1===e.nodeType},n.nodeList=function(e){var t=Object.prototype.toString.call(e);return void 0!==e&&("[object NodeList]"===t||"[object HTMLCollection]"===t)&&"length"in e&&(0===e.length||n.node(e[0]))},n.string=function(e){return"string"==typeof e||e instanceof String},n.fn=function(e){var t=Object.prototype.toString.call(e);return"[object Function]"===t}},{}],4:[function(e,t,n){function i(e,t,n){if(!e&&!t&&!n)throw new Error("Missing required arguments");if(!c.string(t))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(e))return o(e,t,n);if(c.nodeList(e))return r(e,t,n);if(c.string(e))return a(e,t,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function o(e,t,n){return e.addEventListener(t,n),{destroy:function(){e.removeEventListener(t,n)}}}function r(e,t,n){return Array.prototype.forEach.call(e,function(e){e.addEventListener(t,n)}),{destroy:function(){Array.prototype.forEach.call(e,function(e){e.removeEventListener(t,n)})}}}function a(e,t,n){return l(document.body,e,t,n)}var c=e("./is"),l=e("delegate");t.exports=i},{"./is":3,delegate:2}],5:[function(e,t,n){function i(e){var t;if("SELECT"===e.nodeName)e.focus(),t=e.value;else if("INPUT"===e.nodeName||"TEXTAREA"===e.nodeName)e.focus(),e.setSelectionRange(0,e.value.length),t=e.value;else{e.hasAttribute("contenteditable")&&e.focus();var n=window.getSelection(),i=document.createRange();i.selectNodeContents(e),n.removeAllRanges(),n.addRange(i),t=n.toString()}return t}t.exports=i},{}],6:[function(e,t,n){function i(){}i.prototype={on:function(e,t,n){var i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){function i(){o.off(e,i),t.apply(n,arguments)}var o=this;return i._=t,this.on(e,i,n)},emit:function(e){var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),i=0,o=n.length;for(i;i<o;i++)n[i].fn.apply(n[i].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),i=n[e],o=[];if(i&&t)for(var r=0,a=i.length;r<a;r++)i[r].fn!==t&&i[r].fn._!==t&&o.push(i[r]);return o.length?n[e]=o:delete n[e],this}},t.exports=i},{}],7:[function(t,n,i){!function(o,r){if("function"==typeof e&&e.amd)e(["module","select"],r);else if("undefined"!=typeof i)r(n,t("select"));else{var a={exports:{}};r(a,o.select),o.clipboardAction=a.exports}}(this,function(e,t){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(t),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=function(){function e(t){i(this,e),this.resolveOptions(t),this.initSelection()}return a(e,[{key:"resolveOptions",value:function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function e(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function e(){var t=this,n="rtl"==document.documentElement.getAttribute("Line truncated