@@ -325,9 +325,9 @@ |
||
| 325 | 325 | foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
| 326 | 326 | if (isset(self::$installedByVendor[$vendorDir])) { |
| 327 | 327 | $installed[] = self::$installedByVendor[$vendorDir]; |
| 328 | - } elseif (is_file($vendorDir.'/composer/installed.php')) { |
|
| 329 | - $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
|
| 330 | - if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 328 | + } elseif (is_file($vendorDir . '/composer/installed.php')) { |
|
| 329 | + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir . '/composer/installed.php'; |
|
| 330 | + if (null === self::$installed && strtr($vendorDir . '/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { |
|
| 331 | 331 | self::$installed = $installed[count($installed) - 1]; |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -6,9 +6,9 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | class ComposerStaticInitc56aa391ac498061f8d648878e0e6144 |
| 8 | 8 | { |
| 9 | - public static $prefixLengthsPsr4 = array ( |
|
| 9 | + public static $prefixLengthsPsr4 = array( |
|
| 10 | 10 | 'K' => |
| 11 | - array ( |
|
| 11 | + array( |
|
| 12 | 12 | 'Kirki\\Util\\' => 11, |
| 13 | 13 | 'Kirki\\Settings\\' => 15, |
| 14 | 14 | 'Kirki\\Module\\' => 13, |
@@ -19,27 +19,27 @@ discard block |
||
| 19 | 19 | 'Kirki\\' => 6, |
| 20 | 20 | ), |
| 21 | 21 | 'D' => |
| 22 | - array ( |
|
| 22 | + array( |
|
| 23 | 23 | 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => 55, |
| 24 | 24 | ), |
| 25 | 25 | 'C' => |
| 26 | - array ( |
|
| 26 | + array( |
|
| 27 | 27 | 'Composer\\Installers\\' => 20, |
| 28 | 28 | ), |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | - public static $prefixDirsPsr4 = array ( |
|
| 31 | + public static $prefixDirsPsr4 = array( |
|
| 32 | 32 | 'Kirki\\Util\\' => |
| 33 | - array ( |
|
| 33 | + array( |
|
| 34 | 34 | 0 => __DIR__ . '/..' . '/kirki-framework/control-dashicons/src/Util', |
| 35 | 35 | 1 => __DIR__ . '/..' . '/kirki-framework/util/src', |
| 36 | 36 | ), |
| 37 | 37 | 'Kirki\\Settings\\' => |
| 38 | - array ( |
|
| 38 | + array( |
|
| 39 | 39 | 0 => __DIR__ . '/..' . '/kirki-framework/control-repeater/src/Settings', |
| 40 | 40 | ), |
| 41 | 41 | 'Kirki\\Module\\' => |
| 42 | - array ( |
|
| 42 | + array( |
|
| 43 | 43 | 0 => __DIR__ . '/..' . '/kirki-framework/module-css/src', |
| 44 | 44 | 1 => __DIR__ . '/..' . '/kirki-framework/module-editor-styles/src', |
| 45 | 45 | 2 => __DIR__ . '/..' . '/kirki-framework/module-field-dependencies/src', |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 8 => __DIR__ . '/..' . '/kirki-framework/module-webfonts/src', |
| 52 | 52 | ), |
| 53 | 53 | 'Kirki\\Field\\' => |
| 54 | - array ( |
|
| 54 | + array( |
|
| 55 | 55 | 0 => __DIR__ . '/..' . '/kirki-framework/control-checkbox/src/Field', |
| 56 | 56 | 1 => __DIR__ . '/..' . '/kirki-framework/control-code/src/Field', |
| 57 | 57 | 2 => __DIR__ . '/..' . '/kirki-framework/control-color/src/Field', |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | 25 => __DIR__ . '/..' . '/kirki-framework/field-typography/src/Field', |
| 81 | 81 | ), |
| 82 | 82 | 'Kirki\\Data\\' => |
| 83 | - array ( |
|
| 83 | + array( |
|
| 84 | 84 | 0 => __DIR__ . '/..' . '/kirki-framework/data-option/src', |
| 85 | 85 | ), |
| 86 | 86 | 'Kirki\\Control\\' => |
| 87 | - array ( |
|
| 87 | + array( |
|
| 88 | 88 | 0 => __DIR__ . '/..' . '/kirki-framework/control-base/src/Control', |
| 89 | 89 | 1 => __DIR__ . '/..' . '/kirki-framework/control-checkbox/src/Control', |
| 90 | 90 | 2 => __DIR__ . '/..' . '/kirki-framework/control-code/src/Control', |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | 24 => __DIR__ . '/..' . '/kirki-framework/field-typography/src/Control', |
| 113 | 113 | ), |
| 114 | 114 | 'Kirki\\Compatibility\\' => |
| 115 | - array ( |
|
| 115 | + array( |
|
| 116 | 116 | 0 => __DIR__ . '/..' . '/kirki-framework/compatibility/src', |
| 117 | 117 | ), |
| 118 | 118 | 'Kirki\\' => |
| 119 | - array ( |
|
| 119 | + array( |
|
| 120 | 120 | 0 => __DIR__ . '/..' . '/kirki-framework/field/src', |
| 121 | 121 | 1 => __DIR__ . '/..' . '/kirki-framework/googlefonts/src', |
| 122 | 122 | 2 => __DIR__ . '/..' . '/kirki-framework/l10n/src', |
@@ -125,22 +125,22 @@ discard block |
||
| 125 | 125 | 5 => __DIR__ . '/..' . '/kirki-framework/url-getter/src', |
| 126 | 126 | ), |
| 127 | 127 | 'Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\' => |
| 128 | - array ( |
|
| 128 | + array( |
|
| 129 | 129 | 0 => __DIR__ . '/..' . '/dealerdirect/phpcodesniffer-composer-installer/src', |
| 130 | 130 | ), |
| 131 | 131 | 'Composer\\Installers\\' => |
| 132 | - array ( |
|
| 132 | + array( |
|
| 133 | 133 | 0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers', |
| 134 | 134 | ), |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - public static $classMap = array ( |
|
| 137 | + public static $classMap = array( |
|
| 138 | 138 | 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | public static function getInitializer(ClassLoader $loader) |
| 142 | 142 | { |
| 143 | - return \Closure::bind(function () use ($loader) { |
|
| 143 | + return \Closure::bind(function() use ($loader) { |
|
| 144 | 144 | $loader->prefixLengthsPsr4 = ComposerStaticInitc56aa391ac498061f8d648878e0e6144::$prefixLengthsPsr4; |
| 145 | 145 | $loader->prefixDirsPsr4 = ComposerStaticInitc56aa391ac498061f8d648878e0e6144::$prefixDirsPsr4; |
| 146 | 146 | $loader->classMap = ComposerStaticInitc56aa391ac498061f8d648878e0e6144::$classMap; |
@@ -24,17 +24,17 @@ discard block |
||
| 24 | 24 | use Kirki\Compatibility\Kirki; |
| 25 | 25 | |
| 26 | 26 | // Exit if accessed directly. |
| 27 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 27 | +if (!defined('ABSPATH')) { |
|
| 28 | 28 | exit; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | // No need to proceed if Kirki already exists. |
| 32 | -if ( class_exists( 'Kirki' ) ) { |
|
| 32 | +if (class_exists('Kirki')) { |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | -if ( ! defined( 'KIRKI_PLUGIN_FILE' ) ) { |
|
| 37 | - define( 'KIRKI_PLUGIN_FILE', __FILE__ ); |
|
| 36 | +if (!defined('KIRKI_PLUGIN_FILE')) { |
|
| 37 | + define('KIRKI_PLUGIN_FILE', __FILE__); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | require_once __DIR__ . '/lib/class-aricolor.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | require_once __DIR__ . '/inc/bootstrap.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 44 | 44 | |
| 45 | 45 | // Define the KIRKI_VERSION constant. |
| 46 | -if ( ! defined( 'KIRKI_VERSION' ) ) { |
|
| 47 | - define( 'KIRKI_VERSION', '4.0.24' ); |
|
| 46 | +if (!defined('KIRKI_VERSION')) { |
|
| 47 | + define('KIRKI_VERSION', '4.0.24'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | -if ( ! function_exists( 'Kirki' ) ) { |
|
| 50 | +if (!function_exists('Kirki')) { |
|
| 51 | 51 | /** |
| 52 | 52 | * Returns an instance of the Kirki object. |
| 53 | 53 | */ |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | // Instantiate classes. |
| 68 | 68 | new Kirki(); |
| 69 | -new L10n( 'kirki', __DIR__ . '/languages' ); |
|
| 69 | +new L10n('kirki', __DIR__ . '/languages'); |
|
| 70 | 70 | |
| 71 | 71 | // ? Bagus: Do we really need to-reinclude this file? It was included above. |
| 72 | 72 | // Include the ariColor library. |
| 73 | -require_once wp_normalize_path( dirname( __FILE__ ) . '/lib/class-aricolor.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 73 | +require_once wp_normalize_path(dirname(__FILE__) . '/lib/class-aricolor.php'); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 74 | 74 | |
| 75 | 75 | // Add an empty config for global fields. |
| 76 | -Kirki::add_config( '' ); // ? Bagus: what is this for? Adding empty config. |
|
| 76 | +Kirki::add_config(''); // ? Bagus: what is this for? Adding empty config. |
|
| 77 | 77 | |
| 78 | 78 | // ? Bagus: Do we really need this line? custom-config.php here is supposed to inside this plugin. Or is this just in case we need it in the future? |
| 79 | -$custom_config_path = dirname( __FILE__ ) . '/custom-config.php'; |
|
| 80 | -$custom_config_path = wp_normalize_path( $custom_config_path ); |
|
| 81 | -if ( file_exists( $custom_config_path ) ) { |
|
| 79 | +$custom_config_path = dirname(__FILE__) . '/custom-config.php'; |
|
| 80 | +$custom_config_path = wp_normalize_path($custom_config_path); |
|
| 81 | +if (file_exists($custom_config_path)) { |
|
| 82 | 82 | require_once $custom_config_path; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Add upgrade notifications. |
| 86 | -require_once wp_normalize_path( dirname( __FILE__ ) . '/upgrade-notifications.php' ); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 86 | +require_once wp_normalize_path(dirname(__FILE__) . '/upgrade-notifications.php'); // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | 89 | * To enable tests, add this line to your wp-config.php file (or anywhere alse): |
@@ -92,6 +92,6 @@ discard block |
||
| 92 | 92 | * Please note that the example.php file is not included in the wordpress.org distribution |
| 93 | 93 | * and will only be included in dev versions of the plugin in the github repository. |
| 94 | 94 | */ |
| 95 | -if ( defined( 'KIRKI_TEST' ) && true === KIRKI_TEST && file_exists( dirname( __FILE__ ) . '/example.php' ) ) { |
|
| 96 | - include_once dirname( __FILE__ ) . '/example.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 95 | +if (defined('KIRKI_TEST') && true === KIRKI_TEST && file_exists(dirname(__FILE__) . '/example.php')) { |
|
| 96 | + include_once dirname(__FILE__) . '/example.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude |
|
| 97 | 97 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 33 | 33 | */ |
| 34 | 34 | |
| 35 | -if ( ! class_exists( 'TGM_Plugin_Activation' ) ) { |
|
| 35 | +if (!class_exists('TGM_Plugin_Activation')) { |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Automatic plugin installation and activation library. |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $this->wp_version = $GLOBALS['wp_version']; |
| 258 | 258 | |
| 259 | 259 | // Announce that the class is ready, and pass the object (for advanced use). |
| 260 | - do_action_ref_array( 'tgmpa_init', array( $this ) ); |
|
| 260 | + do_action_ref_array('tgmpa_init', array($this)); |
|
| 261 | 261 | |
| 262 | 262 | /* |
| 263 | 263 | * Load our text domain and allow for overloading the fall-back file. |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | * {@internal IMPORTANT! If this code changes, review the regex in the custom TGMPA |
| 266 | 266 | * generator on the website.}} |
| 267 | 267 | */ |
| 268 | - add_action( 'init', array( $this, 'load_textdomain' ), 5 ); |
|
| 269 | - add_filter( 'load_textdomain_mofile', array( $this, 'overload_textdomain_mofile' ), 10, 2 ); |
|
| 268 | + add_action('init', array($this, 'load_textdomain'), 5); |
|
| 269 | + add_filter('load_textdomain_mofile', array($this, 'overload_textdomain_mofile'), 10, 2); |
|
| 270 | 270 | |
| 271 | 271 | // When the rest of WP has loaded, kick-start the rest of the class. |
| 272 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 272 | + add_action('init', array($this, 'init')); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | * @return void Silently fail to set the property when this is tried from outside of this class context. |
| 289 | 289 | * (Inside this class context, the __set() method if not used as there is direct access.) |
| 290 | 290 | */ |
| 291 | - public function __set( $name, $value ) { |
|
| 291 | + public function __set($name, $value) { |
|
| 292 | 292 | return; |
| 293 | 293 | } |
| 294 | 294 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param string $name Name of an inaccessible property. |
| 301 | 301 | * @return mixed The property value. |
| 302 | 302 | */ |
| 303 | - public function __get( $name ) { |
|
| 303 | + public function __get($name) { |
|
| 304 | 304 | return $this->{$name}; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -325,19 +325,19 @@ discard block |
||
| 325 | 325 | * @param bool $load Whether or not TGMPA should load. |
| 326 | 326 | * Defaults to the return of `is_admin() && ! defined( 'DOING_AJAX' )`. |
| 327 | 327 | */ |
| 328 | - if ( true !== apply_filters( 'tgmpa_load', ( is_admin() && ! defined( 'DOING_AJAX' ) ) ) ) { |
|
| 328 | + if (true !== apply_filters('tgmpa_load', (is_admin() && !defined('DOING_AJAX')))) { |
|
| 329 | 329 | return; |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Load class strings. |
| 333 | 333 | $this->strings = array( |
| 334 | - 'page_title' => __( 'Install Required Plugins', 'tgmpa' ), |
|
| 335 | - 'menu_title' => __( 'Install Plugins', 'tgmpa' ), |
|
| 334 | + 'page_title' => __('Install Required Plugins', 'tgmpa'), |
|
| 335 | + 'menu_title' => __('Install Plugins', 'tgmpa'), |
|
| 336 | 336 | /* translators: %s: plugin name. */ |
| 337 | - 'installing' => __( 'Installing Plugin: %s', 'tgmpa' ), |
|
| 337 | + 'installing' => __('Installing Plugin: %s', 'tgmpa'), |
|
| 338 | 338 | /* translators: %s: plugin name. */ |
| 339 | - 'updating' => __( 'Updating Plugin: %s', 'tgmpa' ), |
|
| 340 | - 'oops' => __( 'Something went wrong with the plugin API.', 'tgmpa' ), |
|
| 339 | + 'updating' => __('Updating Plugin: %s', 'tgmpa'), |
|
| 340 | + 'oops' => __('Something went wrong with the plugin API.', 'tgmpa'), |
|
| 341 | 341 | 'notice_can_install_required' => _n_noop( |
| 342 | 342 | /* translators: 1: plugin name(s). */ |
| 343 | 343 | 'This theme requires the following plugin: %1$s.', |
@@ -389,67 +389,67 @@ discard block |
||
| 389 | 389 | 'Begin activating plugins', |
| 390 | 390 | 'tgmpa' |
| 391 | 391 | ), |
| 392 | - 'return' => __( 'Return to Required Plugins Installer', 'tgmpa' ), |
|
| 393 | - 'dashboard' => __( 'Return to the Dashboard', 'tgmpa' ), |
|
| 394 | - 'plugin_activated' => __( 'Plugin activated successfully.', 'tgmpa' ), |
|
| 395 | - 'activated_successfully' => __( 'The following plugin was activated successfully:', 'tgmpa' ), |
|
| 392 | + 'return' => __('Return to Required Plugins Installer', 'tgmpa'), |
|
| 393 | + 'dashboard' => __('Return to the Dashboard', 'tgmpa'), |
|
| 394 | + 'plugin_activated' => __('Plugin activated successfully.', 'tgmpa'), |
|
| 395 | + 'activated_successfully' => __('The following plugin was activated successfully:', 'tgmpa'), |
|
| 396 | 396 | /* translators: 1: plugin name. */ |
| 397 | - 'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'tgmpa' ), |
|
| 397 | + 'plugin_already_active' => __('No action taken. Plugin %1$s was already active.', 'tgmpa'), |
|
| 398 | 398 | /* translators: 1: plugin name. */ |
| 399 | - 'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa' ), |
|
| 399 | + 'plugin_needs_higher_version' => __('Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'tgmpa'), |
|
| 400 | 400 | /* translators: 1: dashboard link. */ |
| 401 | - 'complete' => __( 'All plugins installed and activated successfully. %1$s', 'tgmpa' ), |
|
| 402 | - 'dismiss' => __( 'Dismiss this notice', 'tgmpa' ), |
|
| 403 | - 'notice_cannot_install_activate' => __( 'There are one or more required or recommended plugins to install, update or activate.', 'tgmpa' ), |
|
| 404 | - 'contact_admin' => __( 'Please contact the administrator of this site for help.', 'tgmpa' ), |
|
| 401 | + 'complete' => __('All plugins installed and activated successfully. %1$s', 'tgmpa'), |
|
| 402 | + 'dismiss' => __('Dismiss this notice', 'tgmpa'), |
|
| 403 | + 'notice_cannot_install_activate' => __('There are one or more required or recommended plugins to install, update or activate.', 'tgmpa'), |
|
| 404 | + 'contact_admin' => __('Please contact the administrator of this site for help.', 'tgmpa'), |
|
| 405 | 405 | ); |
| 406 | 406 | |
| 407 | - do_action( 'tgmpa_register' ); |
|
| 407 | + do_action('tgmpa_register'); |
|
| 408 | 408 | |
| 409 | 409 | /* After this point, the plugins should be registered and the configuration set. */ |
| 410 | 410 | |
| 411 | 411 | // Proceed only if we have plugins to handle. |
| 412 | - if ( empty( $this->plugins ) || ! is_array( $this->plugins ) ) { |
|
| 412 | + if (empty($this->plugins) || !is_array($this->plugins)) { |
|
| 413 | 413 | return; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | // Set up the menu and notices if we still have outstanding actions. |
| 417 | - if ( true !== $this->is_tgmpa_complete() ) { |
|
| 417 | + if (true !== $this->is_tgmpa_complete()) { |
|
| 418 | 418 | // Sort the plugins. |
| 419 | - array_multisort( $this->sort_order, SORT_ASC, $this->plugins ); |
|
| 419 | + array_multisort($this->sort_order, SORT_ASC, $this->plugins); |
|
| 420 | 420 | |
| 421 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
| 422 | - add_action( 'admin_head', array( $this, 'dismiss' ) ); |
|
| 421 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
| 422 | + add_action('admin_head', array($this, 'dismiss')); |
|
| 423 | 423 | |
| 424 | 424 | // Prevent the normal links from showing underneath a single install/update page. |
| 425 | - add_filter( 'install_plugin_complete_actions', array( $this, 'actions' ) ); |
|
| 426 | - add_filter( 'update_plugin_complete_actions', array( $this, 'actions' ) ); |
|
| 425 | + add_filter('install_plugin_complete_actions', array($this, 'actions')); |
|
| 426 | + add_filter('update_plugin_complete_actions', array($this, 'actions')); |
|
| 427 | 427 | |
| 428 | - if ( $this->has_notices ) { |
|
| 429 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
| 430 | - add_action( 'admin_init', array( $this, 'admin_init' ), 1 ); |
|
| 431 | - add_action( 'admin_enqueue_scripts', array( $this, 'thickbox' ) ); |
|
| 428 | + if ($this->has_notices) { |
|
| 429 | + add_action('admin_notices', array($this, 'notices')); |
|
| 430 | + add_action('admin_init', array($this, 'admin_init'), 1); |
|
| 431 | + add_action('admin_enqueue_scripts', array($this, 'thickbox')); |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // If needed, filter plugin action links. |
| 436 | - add_action( 'load-plugins.php', array( $this, 'add_plugin_action_link_filters' ), 1 ); |
|
| 436 | + add_action('load-plugins.php', array($this, 'add_plugin_action_link_filters'), 1); |
|
| 437 | 437 | |
| 438 | 438 | // Make sure things get reset on switch theme. |
| 439 | - add_action( 'switch_theme', array( $this, 'flush_plugins_cache' ) ); |
|
| 439 | + add_action('switch_theme', array($this, 'flush_plugins_cache')); |
|
| 440 | 440 | |
| 441 | - if ( $this->has_notices ) { |
|
| 442 | - add_action( 'switch_theme', array( $this, 'update_dismiss' ) ); |
|
| 441 | + if ($this->has_notices) { |
|
| 442 | + add_action('switch_theme', array($this, 'update_dismiss')); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // Setup the force activation hook. |
| 446 | - if ( true === $this->has_forced_activation ) { |
|
| 447 | - add_action( 'admin_init', array( $this, 'force_activation' ) ); |
|
| 446 | + if (true === $this->has_forced_activation) { |
|
| 447 | + add_action('admin_init', array($this, 'force_activation')); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | // Setup the force deactivation hook. |
| 451 | - if ( true === $this->has_forced_deactivation ) { |
|
| 452 | - add_action( 'switch_theme', array( $this, 'force_deactivation' ) ); |
|
| 451 | + if (true === $this->has_forced_deactivation) { |
|
| 452 | + add_action('switch_theme', array($this, 'force_deactivation')); |
|
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | * generator on the website.}} |
| 467 | 467 | */ |
| 468 | 468 | public function load_textdomain() { |
| 469 | - if ( is_textdomain_loaded( 'tgmpa' ) ) { |
|
| 469 | + if (is_textdomain_loaded('tgmpa')) { |
|
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if ( false !== strpos( __FILE__, WP_PLUGIN_DIR ) || false !== strpos( __FILE__, WPMU_PLUGIN_DIR ) ) { |
|
| 473 | + if (false !== strpos(__FILE__, WP_PLUGIN_DIR) || false !== strpos(__FILE__, WPMU_PLUGIN_DIR)) { |
|
| 474 | 474 | // Plugin, we'll need to adjust the file name. |
| 475 | - add_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10, 2 ); |
|
| 476 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
| 477 | - remove_action( 'load_textdomain_mofile', array( $this, 'correct_plugin_mofile' ), 10 ); |
|
| 475 | + add_action('load_textdomain_mofile', array($this, 'correct_plugin_mofile'), 10, 2); |
|
| 476 | + load_theme_textdomain('tgmpa', dirname(__FILE__) . '/languages'); |
|
| 477 | + remove_action('load_textdomain_mofile', array($this, 'correct_plugin_mofile'), 10); |
|
| 478 | 478 | } else { |
| 479 | - load_theme_textdomain( 'tgmpa', dirname( __FILE__ ) . '/languages' ); |
|
| 479 | + load_theme_textdomain('tgmpa', dirname(__FILE__) . '/languages'); |
|
| 480 | 480 | } |
| 481 | 481 | } |
| 482 | 482 | |
@@ -494,12 +494,12 @@ discard block |
||
| 494 | 494 | * @param string $domain The domain for which a language file is being loaded. |
| 495 | 495 | * @return string $mofile |
| 496 | 496 | */ |
| 497 | - public function correct_plugin_mofile( $mofile, $domain ) { |
|
| 497 | + public function correct_plugin_mofile($mofile, $domain) { |
|
| 498 | 498 | // Exit early if not our domain (just in case). |
| 499 | - if ( 'tgmpa' !== $domain ) { |
|
| 499 | + if ('tgmpa' !== $domain) { |
|
| 500 | 500 | return $mofile; |
| 501 | 501 | } |
| 502 | - return preg_replace( '`/([a-z]{2}_[A-Z]{2}.mo)$`', '/tgmpa-$1', $mofile ); |
|
| 502 | + return preg_replace('`/([a-z]{2}_[A-Z]{2}.mo)$`', '/tgmpa-$1', $mofile); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -521,17 +521,17 @@ discard block |
||
| 521 | 521 | * @param string $domain The domain for which a language file is being loaded. |
| 522 | 522 | * @return string $mofile |
| 523 | 523 | */ |
| 524 | - public function overload_textdomain_mofile( $mofile, $domain ) { |
|
| 524 | + public function overload_textdomain_mofile($mofile, $domain) { |
|
| 525 | 525 | // Exit early if not our domain, not a WP_LANG_DIR load or if the file exists and is readable. |
| 526 | - if ( 'tgmpa' !== $domain || false === strpos( $mofile, WP_LANG_DIR ) || @is_readable( $mofile ) ) { |
|
| 526 | + if ('tgmpa' !== $domain || false === strpos($mofile, WP_LANG_DIR) || @is_readable($mofile)) { |
|
| 527 | 527 | return $mofile; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | 530 | // Current fallback file is not valid, let's try the alternative option. |
| 531 | - if ( false !== strpos( $mofile, '/themes/' ) ) { |
|
| 532 | - return str_replace( '/themes/', '/plugins/', $mofile ); |
|
| 533 | - } elseif ( false !== strpos( $mofile, '/plugins/' ) ) { |
|
| 534 | - return str_replace( '/plugins/', '/themes/', $mofile ); |
|
| 531 | + if (false !== strpos($mofile, '/themes/')) { |
|
| 532 | + return str_replace('/themes/', '/plugins/', $mofile); |
|
| 533 | + } elseif (false !== strpos($mofile, '/plugins/')) { |
|
| 534 | + return str_replace('/plugins/', '/themes/', $mofile); |
|
| 535 | 535 | } else { |
| 536 | 536 | return $mofile; |
| 537 | 537 | } |
@@ -547,17 +547,17 @@ discard block |
||
| 547 | 547 | * @since 2.5.0 |
| 548 | 548 | */ |
| 549 | 549 | public function add_plugin_action_link_filters() { |
| 550 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 551 | - if ( false === $this->can_plugin_activate( $slug ) ) { |
|
| 552 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_activate' ), 20 ); |
|
| 550 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 551 | + if (false === $this->can_plugin_activate($slug)) { |
|
| 552 | + add_filter('plugin_action_links_' . $plugin['file_path'], array($this, 'filter_plugin_action_links_activate'), 20); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - if ( true === $plugin['force_activation'] ) { |
|
| 556 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_deactivate' ), 20 ); |
|
| 555 | + if (true === $plugin['force_activation']) { |
|
| 556 | + add_filter('plugin_action_links_' . $plugin['file_path'], array($this, 'filter_plugin_action_links_deactivate'), 20); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - if ( false !== $this->does_plugin_require_update( $slug ) ) { |
|
| 560 | - add_filter( 'plugin_action_links_' . $plugin['file_path'], array( $this, 'filter_plugin_action_links_update' ), 20 ); |
|
| 559 | + if (false !== $this->does_plugin_require_update($slug)) { |
|
| 560 | + add_filter('plugin_action_links_' . $plugin['file_path'], array($this, 'filter_plugin_action_links_update'), 20); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | } |
@@ -571,8 +571,8 @@ discard block |
||
| 571 | 571 | * @param array $actions Action links. |
| 572 | 572 | * @return array |
| 573 | 573 | */ |
| 574 | - public function filter_plugin_action_links_activate( $actions ) { |
|
| 575 | - unset( $actions['activate'] ); |
|
| 574 | + public function filter_plugin_action_links_activate($actions) { |
|
| 575 | + unset($actions['activate']); |
|
| 576 | 576 | |
| 577 | 577 | return $actions; |
| 578 | 578 | } |
@@ -585,8 +585,8 @@ discard block |
||
| 585 | 585 | * @param array $actions Action links. |
| 586 | 586 | * @return array |
| 587 | 587 | */ |
| 588 | - public function filter_plugin_action_links_deactivate( $actions ) { |
|
| 589 | - unset( $actions['deactivate'] ); |
|
| 588 | + public function filter_plugin_action_links_deactivate($actions) { |
|
| 589 | + unset($actions['deactivate']); |
|
| 590 | 590 | |
| 591 | 591 | return $actions; |
| 592 | 592 | } |
@@ -600,12 +600,12 @@ discard block |
||
| 600 | 600 | * @param array $actions Action links. |
| 601 | 601 | * @return array |
| 602 | 602 | */ |
| 603 | - public function filter_plugin_action_links_update( $actions ) { |
|
| 603 | + public function filter_plugin_action_links_update($actions) { |
|
| 604 | 604 | $actions['update'] = sprintf( |
| 605 | 605 | '<a href="%1$s" title="%2$s" class="edit">%3$s</a>', |
| 606 | - esc_url( $this->get_tgmpa_status_url( 'update' ) ), |
|
| 607 | - esc_attr__( 'This plugin needs to be updated to be compatible with your theme.', 'tgmpa' ), |
|
| 608 | - esc_html__( 'Update Required', 'tgmpa' ) |
|
| 606 | + esc_url($this->get_tgmpa_status_url('update')), |
|
| 607 | + esc_attr__('This plugin needs to be updated to be compatible with your theme.', 'tgmpa'), |
|
| 608 | + esc_html__('Update Required', 'tgmpa') |
|
| 609 | 609 | ); |
| 610 | 610 | |
| 611 | 611 | return $actions; |
@@ -635,15 +635,15 @@ discard block |
||
| 635 | 635 | * @return null Returns early if not the TGMPA page. |
| 636 | 636 | */ |
| 637 | 637 | public function admin_init() { |
| 638 | - if ( ! $this->is_tgmpa_page() ) { |
|
| 638 | + if (!$this->is_tgmpa_page()) { |
|
| 639 | 639 | return; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | - if ( isset( $_REQUEST['tab'] ) && 'plugin-information' === $_REQUEST['tab'] ) { |
|
| 642 | + if (isset($_REQUEST['tab']) && 'plugin-information' === $_REQUEST['tab']) { |
|
| 643 | 643 | // Needed for install_plugin_information(). |
| 644 | 644 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| 645 | 645 | |
| 646 | - wp_enqueue_style( 'plugin-install' ); |
|
| 646 | + wp_enqueue_style('plugin-install'); |
|
| 647 | 647 | |
| 648 | 648 | global $tab, $body_id; |
| 649 | 649 | $body_id = 'plugin-information'; |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | * @since 2.1.0 |
| 670 | 670 | */ |
| 671 | 671 | public function thickbox() { |
| 672 | - if ( ! get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) ) { |
|
| 672 | + if (!get_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true)) { |
|
| 673 | 673 | add_thickbox(); |
| 674 | 674 | } |
| 675 | 675 | } |
@@ -691,23 +691,23 @@ discard block |
||
| 691 | 691 | */ |
| 692 | 692 | public function admin_menu() { |
| 693 | 693 | // Make sure privileges are correct to see the page. |
| 694 | - if ( ! current_user_can( 'install_plugins' ) ) { |
|
| 694 | + if (!current_user_can('install_plugins')) { |
|
| 695 | 695 | return; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | $args = apply_filters( |
| 699 | 699 | 'tgmpa_admin_menu_args', |
| 700 | 700 | array( |
| 701 | - 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
| 702 | - 'page_title' => $this->strings['page_title'], // Page title. |
|
| 703 | - 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
| 704 | - 'capability' => $this->capability, // Capability. |
|
| 705 | - 'menu_slug' => $this->menu, // Menu slug. |
|
| 706 | - 'function' => array( $this, 'install_plugins_page' ), // Callback. |
|
| 701 | + 'parent_slug' => $this->parent_slug, // Parent Menu slug. |
|
| 702 | + 'page_title' => $this->strings['page_title'], // Page title. |
|
| 703 | + 'menu_title' => $this->strings['menu_title'], // Menu title. |
|
| 704 | + 'capability' => $this->capability, // Capability. |
|
| 705 | + 'menu_slug' => $this->menu, // Menu slug. |
|
| 706 | + 'function' => array($this, 'install_plugins_page'), // Callback. |
|
| 707 | 707 | ) |
| 708 | 708 | ); |
| 709 | 709 | |
| 710 | - $this->add_admin_menu( $args ); |
|
| 710 | + $this->add_admin_menu($args); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -720,15 +720,15 @@ discard block |
||
| 720 | 720 | * |
| 721 | 721 | * @param array $args Menu item configuration. |
| 722 | 722 | */ |
| 723 | - protected function add_admin_menu( array $args ) { |
|
| 724 | - if ( has_filter( 'tgmpa_admin_menu_use_add_theme_page' ) ) { |
|
| 725 | - _deprecated_function( 'The "tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__( 'Set the parent_slug config variable instead.', 'tgmpa' ) ); |
|
| 723 | + protected function add_admin_menu(array $args) { |
|
| 724 | + if (has_filter('tgmpa_admin_menu_use_add_theme_page')) { |
|
| 725 | + _deprecated_function('The "tgmpa_admin_menu_use_add_theme_page" filter', '2.5.0', esc_html__('Set the parent_slug config variable instead.', 'tgmpa')); |
|
| 726 | 726 | } |
| 727 | 727 | |
| 728 | - if ( 'themes.php' === $this->parent_slug ) { |
|
| 729 | - $this->page_hook = call_user_func( 'add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
| 728 | + if ('themes.php' === $this->parent_slug) { |
|
| 729 | + $this->page_hook = call_user_func('add_theme_page', $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']); |
|
| 730 | 730 | } else { |
| 731 | - $this->page_hook = call_user_func( 'add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function'] ); |
|
| 731 | + $this->page_hook = call_user_func('add_submenu_page', $args['parent_slug'], $args['page_title'], $args['menu_title'], $args['capability'], $args['menu_slug'], $args['function']); |
|
| 732 | 732 | } |
| 733 | 733 | } |
| 734 | 734 | |
@@ -748,28 +748,28 @@ discard block |
||
| 748 | 748 | $plugin_table = new TGMPA_List_Table; |
| 749 | 749 | |
| 750 | 750 | // Return early if processing a plugin installation action. |
| 751 | - if ( ( ( 'tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action() ) && $plugin_table->process_bulk_actions() ) || $this->do_plugin_install() ) { |
|
| 751 | + if ((('tgmpa-bulk-install' === $plugin_table->current_action() || 'tgmpa-bulk-update' === $plugin_table->current_action()) && $plugin_table->process_bulk_actions()) || $this->do_plugin_install()) { |
|
| 752 | 752 | return; |
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | // Force refresh of available plugin information so we'll know about manual updates/deletes. |
| 756 | - wp_clean_plugins_cache( false ); |
|
| 756 | + wp_clean_plugins_cache(false); |
|
| 757 | 757 | |
| 758 | 758 | ?> |
| 759 | 759 | <div class="tgmpa wrap"> |
| 760 | - <h1><?php echo esc_html( get_admin_page_title() ); ?></h1> |
|
| 760 | + <h1><?php echo esc_html(get_admin_page_title()); ?></h1> |
|
| 761 | 761 | <?php $plugin_table->prepare_items(); ?> |
| 762 | 762 | |
| 763 | 763 | <?php |
| 764 | - if ( ! empty( $this->message ) && is_string( $this->message ) ) { |
|
| 765 | - echo wp_kses_post( $this->message ); |
|
| 764 | + if (!empty($this->message) && is_string($this->message)) { |
|
| 765 | + echo wp_kses_post($this->message); |
|
| 766 | 766 | } |
| 767 | 767 | ?> |
| 768 | 768 | <?php $plugin_table->views(); ?> |
| 769 | 769 | |
| 770 | 770 | <form id="tgmpa-plugins" action="" method="post"> |
| 771 | - <input type="hidden" name="tgmpa-page" value="<?php echo esc_attr( $this->menu ); ?>" /> |
|
| 772 | - <input type="hidden" name="plugin_status" value="<?php echo esc_attr( $plugin_table->view_context ); ?>" /> |
|
| 771 | + <input type="hidden" name="tgmpa-page" value="<?php echo esc_attr($this->menu); ?>" /> |
|
| 772 | + <input type="hidden" name="plugin_status" value="<?php echo esc_attr($plugin_table->view_context); ?>" /> |
|
| 773 | 773 | <?php $plugin_table->display(); ?> |
| 774 | 774 | </form> |
| 775 | 775 | </div> |
@@ -797,32 +797,32 @@ discard block |
||
| 797 | 797 | * @return boolean True on success, false on failure. |
| 798 | 798 | */ |
| 799 | 799 | protected function do_plugin_install() { |
| 800 | - if ( empty( $_GET['plugin'] ) ) { |
|
| 800 | + if (empty($_GET['plugin'])) { |
|
| 801 | 801 | return false; |
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | // All plugin information will be stored in an array for processing. |
| 805 | - $slug = $this->sanitize_key( urldecode( $_GET['plugin'] ) ); |
|
| 805 | + $slug = $this->sanitize_key(urldecode($_GET['plugin'])); |
|
| 806 | 806 | |
| 807 | - if ( ! isset( $this->plugins[ $slug ] ) ) { |
|
| 807 | + if (!isset($this->plugins[$slug])) { |
|
| 808 | 808 | return false; |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // Was an install or upgrade action link clicked? |
| 812 | - if ( ( isset( $_GET['tgmpa-install'] ) && 'install-plugin' === $_GET['tgmpa-install'] ) || ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) ) { |
|
| 812 | + if ((isset($_GET['tgmpa-install']) && 'install-plugin' === $_GET['tgmpa-install']) || (isset($_GET['tgmpa-update']) && 'update-plugin' === $_GET['tgmpa-update'])) { |
|
| 813 | 813 | |
| 814 | 814 | $install_type = 'install'; |
| 815 | - if ( isset( $_GET['tgmpa-update'] ) && 'update-plugin' === $_GET['tgmpa-update'] ) { |
|
| 815 | + if (isset($_GET['tgmpa-update']) && 'update-plugin' === $_GET['tgmpa-update']) { |
|
| 816 | 816 | $install_type = 'update'; |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | - check_admin_referer( 'tgmpa-' . $install_type, 'tgmpa-nonce' ); |
|
| 819 | + check_admin_referer('tgmpa-' . $install_type, 'tgmpa-nonce'); |
|
| 820 | 820 | |
| 821 | 821 | // Pass necessary information via URL if WP_Filesystem is needed. |
| 822 | 822 | $url = wp_nonce_url( |
| 823 | 823 | add_query_arg( |
| 824 | 824 | array( |
| 825 | - 'plugin' => urlencode( $slug ), |
|
| 825 | + 'plugin' => urlencode($slug), |
|
| 826 | 826 | 'tgmpa-' . $install_type => $install_type . '-plugin', |
| 827 | 827 | ), |
| 828 | 828 | $this->get_tgmpa_url() |
@@ -833,12 +833,12 @@ discard block |
||
| 833 | 833 | |
| 834 | 834 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
| 835 | 835 | |
| 836 | - if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, array() ) ) ) { |
|
| 836 | + if (false === ($creds = request_filesystem_credentials(esc_url_raw($url), $method, false, false, array()))) { |
|
| 837 | 837 | return true; |
| 838 | 838 | } |
| 839 | 839 | |
| 840 | - if ( ! WP_Filesystem( $creds ) ) { |
|
| 841 | - request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, array() ); // Setup WP_Filesystem. |
|
| 840 | + if (!WP_Filesystem($creds)) { |
|
| 841 | + request_filesystem_credentials(esc_url_raw($url), $method, true, false, array()); // Setup WP_Filesystem. |
|
| 842 | 842 | return true; |
| 843 | 843 | } |
| 844 | 844 | |
@@ -847,68 +847,68 @@ discard block |
||
| 847 | 847 | // Prep variables for Plugin_Installer_Skin class. |
| 848 | 848 | $extra = array(); |
| 849 | 849 | $extra['slug'] = $slug; // Needed for potentially renaming of directory name. |
| 850 | - $source = $this->get_download_url( $slug ); |
|
| 851 | - $api = ( 'repo' === $this->plugins[ $slug ]['source_type'] ) ? $this->get_plugins_api( $slug ) : null; |
|
| 852 | - $api = ( false !== $api ) ? $api : null; |
|
| 850 | + $source = $this->get_download_url($slug); |
|
| 851 | + $api = ('repo' === $this->plugins[$slug]['source_type']) ? $this->get_plugins_api($slug) : null; |
|
| 852 | + $api = (false !== $api) ? $api : null; |
|
| 853 | 853 | |
| 854 | 854 | $url = add_query_arg( |
| 855 | 855 | array( |
| 856 | 856 | 'action' => $install_type . '-plugin', |
| 857 | - 'plugin' => urlencode( $slug ), |
|
| 857 | + 'plugin' => urlencode($slug), |
|
| 858 | 858 | ), |
| 859 | 859 | 'update.php' |
| 860 | 860 | ); |
| 861 | 861 | |
| 862 | - if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
| 862 | + if (!class_exists('Plugin_Upgrader', false)) { |
|
| 863 | 863 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 864 | 864 | } |
| 865 | 865 | |
| 866 | - $title = ( 'update' === $install_type ) ? $this->strings['updating'] : $this->strings['installing']; |
|
| 866 | + $title = ('update' === $install_type) ? $this->strings['updating'] : $this->strings['installing']; |
|
| 867 | 867 | $skin_args = array( |
| 868 | - 'type' => ( 'bundled' !== $this->plugins[ $slug ]['source_type'] ) ? 'web' : 'upload', |
|
| 869 | - 'title' => sprintf( $title, $this->plugins[ $slug ]['name'] ), |
|
| 870 | - 'url' => esc_url_raw( $url ), |
|
| 868 | + 'type' => ('bundled' !== $this->plugins[$slug]['source_type']) ? 'web' : 'upload', |
|
| 869 | + 'title' => sprintf($title, $this->plugins[$slug]['name']), |
|
| 870 | + 'url' => esc_url_raw($url), |
|
| 871 | 871 | 'nonce' => $install_type . '-plugin_' . $slug, |
| 872 | 872 | 'plugin' => '', |
| 873 | 873 | 'api' => $api, |
| 874 | 874 | 'extra' => $extra, |
| 875 | 875 | ); |
| 876 | - unset( $title ); |
|
| 876 | + unset($title); |
|
| 877 | 877 | |
| 878 | - if ( 'update' === $install_type ) { |
|
| 879 | - $skin_args['plugin'] = $this->plugins[ $slug ]['file_path']; |
|
| 880 | - $skin = new Plugin_Upgrader_Skin( $skin_args ); |
|
| 878 | + if ('update' === $install_type) { |
|
| 879 | + $skin_args['plugin'] = $this->plugins[$slug]['file_path']; |
|
| 880 | + $skin = new Plugin_Upgrader_Skin($skin_args); |
|
| 881 | 881 | } else { |
| 882 | - $skin = new Plugin_Installer_Skin( $skin_args ); |
|
| 882 | + $skin = new Plugin_Installer_Skin($skin_args); |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | // Create a new instance of Plugin_Upgrader. |
| 886 | - $upgrader = new Plugin_Upgrader( $skin ); |
|
| 886 | + $upgrader = new Plugin_Upgrader($skin); |
|
| 887 | 887 | |
| 888 | 888 | // Perform the action and install the plugin from the $source urldecode(). |
| 889 | - add_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1, 3 ); |
|
| 889 | + add_filter('upgrader_source_selection', array($this, 'maybe_adjust_source_dir'), 1, 3); |
|
| 890 | 890 | |
| 891 | - if ( 'update' === $install_type ) { |
|
| 891 | + if ('update' === $install_type) { |
|
| 892 | 892 | // Inject our info into the update transient. |
| 893 | - $to_inject = array( $slug => $this->plugins[ $slug ] ); |
|
| 894 | - $to_inject[ $slug ]['source'] = $source; |
|
| 895 | - $this->inject_update_info( $to_inject ); |
|
| 893 | + $to_inject = array($slug => $this->plugins[$slug]); |
|
| 894 | + $to_inject[$slug]['source'] = $source; |
|
| 895 | + $this->inject_update_info($to_inject); |
|
| 896 | 896 | |
| 897 | - $upgrader->upgrade( $this->plugins[ $slug ]['file_path'] ); |
|
| 897 | + $upgrader->upgrade($this->plugins[$slug]['file_path']); |
|
| 898 | 898 | } else { |
| 899 | - $upgrader->install( $source ); |
|
| 899 | + $upgrader->install($source); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - remove_filter( 'upgrader_source_selection', array( $this, 'maybe_adjust_source_dir' ), 1 ); |
|
| 902 | + remove_filter('upgrader_source_selection', array($this, 'maybe_adjust_source_dir'), 1); |
|
| 903 | 903 | |
| 904 | 904 | // Make sure we have the correct file path now the plugin is installed/updated. |
| 905 | - $this->populate_file_path( $slug ); |
|
| 905 | + $this->populate_file_path($slug); |
|
| 906 | 906 | |
| 907 | 907 | // Only activate plugins if the config option is set to true and the plugin isn't |
| 908 | 908 | // already active (upgrade). |
| 909 | - if ( $this->is_automatic && ! $this->is_plugin_active( $slug ) ) { |
|
| 909 | + if ($this->is_automatic && !$this->is_plugin_active($slug)) { |
|
| 910 | 910 | $plugin_activate = $upgrader->plugin_info(); // Grab the plugin info from the Plugin_Upgrader method. |
| 911 | - if ( false === $this->activate_single_plugin( $plugin_activate, $slug, true ) ) { |
|
| 911 | + if (false === $this->activate_single_plugin($plugin_activate, $slug, true)) { |
|
| 912 | 912 | return true; // Finish execution of the function early as we encountered an error. |
| 913 | 913 | } |
| 914 | 914 | } |
@@ -916,19 +916,19 @@ discard block |
||
| 916 | 916 | $this->show_tgmpa_version(); |
| 917 | 917 | |
| 918 | 918 | // Display message based on if all plugins are now active or not. |
| 919 | - if ( $this->is_tgmpa_complete() ) { |
|
| 920 | - echo '<p>', sprintf( esc_html( $this->strings['complete'] ), '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' ), '</p>'; |
|
| 919 | + if ($this->is_tgmpa_complete()) { |
|
| 920 | + echo '<p>', sprintf(esc_html($this->strings['complete']), '<a href="' . esc_url(self_admin_url()) . '">' . esc_html__('Return to the Dashboard', 'tgmpa') . '</a>'), '</p>'; |
|
| 921 | 921 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
| 922 | 922 | } else { |
| 923 | - echo '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
| 923 | + echo '<p><a href="', esc_url($this->get_tgmpa_url()), '" target="_parent">', esc_html($this->strings['return']), '</a></p>'; |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | return true; |
| 927 | - } elseif ( isset( $this->plugins[ $slug ]['file_path'], $_GET['tgmpa-activate'] ) && 'activate-plugin' === $_GET['tgmpa-activate'] ) { |
|
| 927 | + } elseif (isset($this->plugins[$slug]['file_path'], $_GET['tgmpa-activate']) && 'activate-plugin' === $_GET['tgmpa-activate']) { |
|
| 928 | 928 | // Activate action link was clicked. |
| 929 | - check_admin_referer( 'tgmpa-activate', 'tgmpa-nonce' ); |
|
| 929 | + check_admin_referer('tgmpa-activate', 'tgmpa-nonce'); |
|
| 930 | 930 | |
| 931 | - if ( false === $this->activate_single_plugin( $this->plugins[ $slug ]['file_path'], $slug ) ) { |
|
| 931 | + if (false === $this->activate_single_plugin($this->plugins[$slug]['file_path'], $slug)) { |
|
| 932 | 932 | return true; // Finish execution of the function early as we encountered an error. |
| 933 | 933 | } |
| 934 | 934 | } |
@@ -943,31 +943,31 @@ discard block |
||
| 943 | 943 | * |
| 944 | 944 | * @param array $plugins The plugin information for the plugins which are to be updated. |
| 945 | 945 | */ |
| 946 | - public function inject_update_info( $plugins ) { |
|
| 947 | - $repo_updates = get_site_transient( 'update_plugins' ); |
|
| 946 | + public function inject_update_info($plugins) { |
|
| 947 | + $repo_updates = get_site_transient('update_plugins'); |
|
| 948 | 948 | |
| 949 | - if ( ! is_object( $repo_updates ) ) { |
|
| 949 | + if (!is_object($repo_updates)) { |
|
| 950 | 950 | $repo_updates = new stdClass; |
| 951 | 951 | } |
| 952 | 952 | |
| 953 | - foreach ( $plugins as $slug => $plugin ) { |
|
| 953 | + foreach ($plugins as $slug => $plugin) { |
|
| 954 | 954 | $file_path = $plugin['file_path']; |
| 955 | 955 | |
| 956 | - if ( empty( $repo_updates->response[ $file_path ] ) ) { |
|
| 957 | - $repo_updates->response[ $file_path ] = new stdClass; |
|
| 956 | + if (empty($repo_updates->response[$file_path])) { |
|
| 957 | + $repo_updates->response[$file_path] = new stdClass; |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | // We only really need to set package, but let's do all we can in case WP changes something. |
| 961 | - $repo_updates->response[ $file_path ]->slug = $slug; |
|
| 962 | - $repo_updates->response[ $file_path ]->plugin = $file_path; |
|
| 963 | - $repo_updates->response[ $file_path ]->new_version = $plugin['version']; |
|
| 964 | - $repo_updates->response[ $file_path ]->package = $plugin['source']; |
|
| 965 | - if ( empty( $repo_updates->response[ $file_path ]->url ) && ! empty( $plugin['external_url'] ) ) { |
|
| 966 | - $repo_updates->response[ $file_path ]->url = $plugin['external_url']; |
|
| 961 | + $repo_updates->response[$file_path]->slug = $slug; |
|
| 962 | + $repo_updates->response[$file_path]->plugin = $file_path; |
|
| 963 | + $repo_updates->response[$file_path]->new_version = $plugin['version']; |
|
| 964 | + $repo_updates->response[$file_path]->package = $plugin['source']; |
|
| 965 | + if (empty($repo_updates->response[$file_path]->url) && !empty($plugin['external_url'])) { |
|
| 966 | + $repo_updates->response[$file_path]->url = $plugin['external_url']; |
|
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | |
| 970 | - set_site_transient( 'update_plugins', $repo_updates ); |
|
| 970 | + set_site_transient('update_plugins', $repo_updates); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | /** |
@@ -986,14 +986,14 @@ discard block |
||
| 986 | 986 | * @param \WP_Upgrader $upgrader Instance of the upgrader which installs the plugin. |
| 987 | 987 | * @return string $source |
| 988 | 988 | */ |
| 989 | - public function maybe_adjust_source_dir( $source, $remote_source, $upgrader ) { |
|
| 990 | - if ( ! $this->is_tgmpa_page() || ! is_object( $GLOBALS['wp_filesystem'] ) ) { |
|
| 989 | + public function maybe_adjust_source_dir($source, $remote_source, $upgrader) { |
|
| 990 | + if (!$this->is_tgmpa_page() || !is_object($GLOBALS['wp_filesystem'])) { |
|
| 991 | 991 | return $source; |
| 992 | 992 | } |
| 993 | 993 | |
| 994 | 994 | // Check for single file plugins. |
| 995 | - $source_files = array_keys( $GLOBALS['wp_filesystem']->dirlist( $remote_source ) ); |
|
| 996 | - if ( 1 === count( $source_files ) && false === $GLOBALS['wp_filesystem']->is_dir( $source ) ) { |
|
| 995 | + $source_files = array_keys($GLOBALS['wp_filesystem']->dirlist($remote_source)); |
|
| 996 | + if (1 === count($source_files) && false === $GLOBALS['wp_filesystem']->is_dir($source)) { |
|
| 997 | 997 | return $source; |
| 998 | 998 | } |
| 999 | 999 | |
@@ -1001,33 +1001,33 @@ discard block |
||
| 1001 | 1001 | $desired_slug = ''; |
| 1002 | 1002 | |
| 1003 | 1003 | // Figure out what the slug is supposed to be. |
| 1004 | - if ( false === $upgrader->bulk && ! empty( $upgrader->skin->options['extra']['slug'] ) ) { |
|
| 1004 | + if (false === $upgrader->bulk && !empty($upgrader->skin->options['extra']['slug'])) { |
|
| 1005 | 1005 | $desired_slug = $upgrader->skin->options['extra']['slug']; |
| 1006 | 1006 | } else { |
| 1007 | 1007 | // Bulk installer contains less info, so fall back on the info registered here. |
| 1008 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 1009 | - if ( ! empty( $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) && $plugin['name'] === $upgrader->skin->plugin_names[ $upgrader->skin->i ] ) { |
|
| 1008 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 1009 | + if (!empty($upgrader->skin->plugin_names[$upgrader->skin->i]) && $plugin['name'] === $upgrader->skin->plugin_names[$upgrader->skin->i]) { |
|
| 1010 | 1010 | $desired_slug = $slug; |
| 1011 | 1011 | break; |
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | - unset( $slug, $plugin ); |
|
| 1014 | + unset($slug, $plugin); |
|
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | - if ( ! empty( $desired_slug ) ) { |
|
| 1018 | - $subdir_name = untrailingslashit( str_replace( trailingslashit( $remote_source ), '', $source ) ); |
|
| 1017 | + if (!empty($desired_slug)) { |
|
| 1018 | + $subdir_name = untrailingslashit(str_replace(trailingslashit($remote_source), '', $source)); |
|
| 1019 | 1019 | |
| 1020 | - if ( ! empty( $subdir_name ) && $subdir_name !== $desired_slug ) { |
|
| 1021 | - $from_path = untrailingslashit( $source ); |
|
| 1022 | - $to_path = trailingslashit( $remote_source ) . $desired_slug; |
|
| 1020 | + if (!empty($subdir_name) && $subdir_name !== $desired_slug) { |
|
| 1021 | + $from_path = untrailingslashit($source); |
|
| 1022 | + $to_path = trailingslashit($remote_source) . $desired_slug; |
|
| 1023 | 1023 | |
| 1024 | - if ( true === $GLOBALS['wp_filesystem']->move( $from_path, $to_path ) ) { |
|
| 1025 | - return trailingslashit( $to_path ); |
|
| 1024 | + if (true === $GLOBALS['wp_filesystem']->move($from_path, $to_path)) { |
|
| 1025 | + return trailingslashit($to_path); |
|
| 1026 | 1026 | } else { |
| 1027 | - return new WP_Error( 'rename_failed', esc_html__( 'The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); |
|
| 1027 | + return new WP_Error('rename_failed', esc_html__('The remote plugin package does not contain a folder with the desired slug and renaming did not work.', 'tgmpa') . ' ' . esc_html__('Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa'), array('found' => $subdir_name, 'expected' => $desired_slug)); |
|
| 1028 | 1028 | } |
| 1029 | - } elseif ( empty( $subdir_name ) ) { |
|
| 1030 | - return new WP_Error( 'packaged_wrong', esc_html__( 'The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa' ) . ' ' . esc_html__( 'Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa' ), array( 'found' => $subdir_name, 'expected' => $desired_slug ) ); |
|
| 1029 | + } elseif (empty($subdir_name)) { |
|
| 1030 | + return new WP_Error('packaged_wrong', esc_html__('The remote plugin package consists of more than one file, but the files are not packaged in a folder.', 'tgmpa') . ' ' . esc_html__('Please contact the plugin provider and ask them to package their plugin according to the WordPress guidelines.', 'tgmpa'), array('found' => $subdir_name, 'expected' => $desired_slug)); |
|
| 1031 | 1031 | } |
| 1032 | 1032 | } |
| 1033 | 1033 | |
@@ -1045,51 +1045,51 @@ discard block |
||
| 1045 | 1045 | * This determines the styling of the output messages. |
| 1046 | 1046 | * @return bool False if an error was encountered, true otherwise. |
| 1047 | 1047 | */ |
| 1048 | - protected function activate_single_plugin( $file_path, $slug, $automatic = false ) { |
|
| 1049 | - if ( $this->can_plugin_activate( $slug ) ) { |
|
| 1050 | - $activate = activate_plugin( $file_path ); |
|
| 1048 | + protected function activate_single_plugin($file_path, $slug, $automatic = false) { |
|
| 1049 | + if ($this->can_plugin_activate($slug)) { |
|
| 1050 | + $activate = activate_plugin($file_path); |
|
| 1051 | 1051 | |
| 1052 | - if ( is_wp_error( $activate ) ) { |
|
| 1053 | - echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>', |
|
| 1054 | - '<p><a href="', esc_url( $this->get_tgmpa_url() ), '" target="_parent">', esc_html( $this->strings['return'] ), '</a></p>'; |
|
| 1052 | + if (is_wp_error($activate)) { |
|
| 1053 | + echo '<div id="message" class="error"><p>', wp_kses_post($activate->get_error_message()), '</p></div>', |
|
| 1054 | + '<p><a href="', esc_url($this->get_tgmpa_url()), '" target="_parent">', esc_html($this->strings['return']), '</a></p>'; |
|
| 1055 | 1055 | |
| 1056 | 1056 | return false; // End it here if there is an error with activation. |
| 1057 | 1057 | } else { |
| 1058 | - if ( ! $automatic ) { |
|
| 1058 | + if (!$automatic) { |
|
| 1059 | 1059 | // Make sure message doesn't display again if bulk activation is performed |
| 1060 | 1060 | // immediately after a single activation. |
| 1061 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
| 1062 | - echo '<div id="message" class="updated"><p>', esc_html( $this->strings['activated_successfully'] ), ' <strong>', esc_html( $this->plugins[ $slug ]['name'] ), '.</strong></p></div>'; |
|
| 1061 | + if (!isset($_POST['action'])) { // WPCS: CSRF OK. |
|
| 1062 | + echo '<div id="message" class="updated"><p>', esc_html($this->strings['activated_successfully']), ' <strong>', esc_html($this->plugins[$slug]['name']), '.</strong></p></div>'; |
|
| 1063 | 1063 | } |
| 1064 | 1064 | } else { |
| 1065 | 1065 | // Simpler message layout for use on the plugin install page. |
| 1066 | - echo '<p>', esc_html( $this->strings['plugin_activated'] ), '</p>'; |
|
| 1066 | + echo '<p>', esc_html($this->strings['plugin_activated']), '</p>'; |
|
| 1067 | 1067 | } |
| 1068 | 1068 | } |
| 1069 | - } elseif ( $this->is_plugin_active( $slug ) ) { |
|
| 1069 | + } elseif ($this->is_plugin_active($slug)) { |
|
| 1070 | 1070 | // No simpler message format provided as this message should never be encountered |
| 1071 | 1071 | // on the plugin install page. |
| 1072 | 1072 | echo '<div id="message" class="error"><p>', |
| 1073 | 1073 | sprintf( |
| 1074 | - esc_html( $this->strings['plugin_already_active'] ), |
|
| 1075 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
| 1074 | + esc_html($this->strings['plugin_already_active']), |
|
| 1075 | + '<strong>' . esc_html($this->plugins[$slug]['name']) . '</strong>' |
|
| 1076 | 1076 | ), |
| 1077 | 1077 | '</p></div>'; |
| 1078 | - } elseif ( $this->does_plugin_require_update( $slug ) ) { |
|
| 1079 | - if ( ! $automatic ) { |
|
| 1078 | + } elseif ($this->does_plugin_require_update($slug)) { |
|
| 1079 | + if (!$automatic) { |
|
| 1080 | 1080 | // Make sure message doesn't display again if bulk activation is performed |
| 1081 | 1081 | // immediately after a single activation. |
| 1082 | - if ( ! isset( $_POST['action'] ) ) { // WPCS: CSRF OK. |
|
| 1082 | + if (!isset($_POST['action'])) { // WPCS: CSRF OK. |
|
| 1083 | 1083 | echo '<div id="message" class="error"><p>', |
| 1084 | 1084 | sprintf( |
| 1085 | - esc_html( $this->strings['plugin_needs_higher_version'] ), |
|
| 1086 | - '<strong>' . esc_html( $this->plugins[ $slug ]['name'] ) . '</strong>' |
|
| 1085 | + esc_html($this->strings['plugin_needs_higher_version']), |
|
| 1086 | + '<strong>' . esc_html($this->plugins[$slug]['name']) . '</strong>' |
|
| 1087 | 1087 | ), |
| 1088 | 1088 | '</p></div>'; |
| 1089 | 1089 | } |
| 1090 | 1090 | } else { |
| 1091 | 1091 | // Simpler message layout for use on the plugin install page. |
| 1092 | - echo '<p>', sprintf( esc_html( $this->strings['plugin_needs_higher_version'] ), esc_html( $this->plugins[ $slug ]['name'] ) ), '</p>'; |
|
| 1092 | + echo '<p>', sprintf(esc_html($this->strings['plugin_needs_higher_version']), esc_html($this->plugins[$slug]['name'])), '</p>'; |
|
| 1093 | 1093 | } |
| 1094 | 1094 | } |
| 1095 | 1095 | |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | */ |
| 1114 | 1114 | public function notices() { |
| 1115 | 1115 | // Remove nag on the install page / Return early if the nag message has been dismissed or user < author. |
| 1116 | - if ( ( $this->is_tgmpa_page() || $this->is_core_update_page() ) || get_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true ) || ! current_user_can( apply_filters( 'tgmpa_show_admin_notice_capability', 'publish_posts' ) ) ) { |
|
| 1116 | + if (($this->is_tgmpa_page() || $this->is_core_update_page()) || get_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, true) || !current_user_can(apply_filters('tgmpa_show_admin_notice_capability', 'publish_posts'))) { |
|
| 1117 | 1117 | return; |
| 1118 | 1118 | } |
| 1119 | 1119 | |
@@ -1126,114 +1126,114 @@ discard block |
||
| 1126 | 1126 | $activate_link_count = 0; |
| 1127 | 1127 | $total_required_action_count = 0; |
| 1128 | 1128 | |
| 1129 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 1130 | - if ( $this->is_plugin_active( $slug ) && false === $this->does_plugin_have_update( $slug ) ) { |
|
| 1129 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 1130 | + if ($this->is_plugin_active($slug) && false === $this->does_plugin_have_update($slug)) { |
|
| 1131 | 1131 | continue; |
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | - if ( ! $this->is_plugin_installed( $slug ) ) { |
|
| 1135 | - if ( current_user_can( 'install_plugins' ) ) { |
|
| 1134 | + if (!$this->is_plugin_installed($slug)) { |
|
| 1135 | + if (current_user_can('install_plugins')) { |
|
| 1136 | 1136 | $install_link_count++; |
| 1137 | 1137 | |
| 1138 | - if ( true === $plugin['required'] ) { |
|
| 1138 | + if (true === $plugin['required']) { |
|
| 1139 | 1139 | $message['notice_can_install_required'][] = $slug; |
| 1140 | 1140 | } else { |
| 1141 | 1141 | $message['notice_can_install_recommended'][] = $slug; |
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | - if ( true === $plugin['required'] ) { |
|
| 1144 | + if (true === $plugin['required']) { |
|
| 1145 | 1145 | $total_required_action_count++; |
| 1146 | 1146 | } |
| 1147 | 1147 | } else { |
| 1148 | - if ( ! $this->is_plugin_active( $slug ) && $this->can_plugin_activate( $slug ) ) { |
|
| 1149 | - if ( current_user_can( 'activate_plugins' ) ) { |
|
| 1148 | + if (!$this->is_plugin_active($slug) && $this->can_plugin_activate($slug)) { |
|
| 1149 | + if (current_user_can('activate_plugins')) { |
|
| 1150 | 1150 | $activate_link_count++; |
| 1151 | 1151 | |
| 1152 | - if ( true === $plugin['required'] ) { |
|
| 1152 | + if (true === $plugin['required']) { |
|
| 1153 | 1153 | $message['notice_can_activate_required'][] = $slug; |
| 1154 | 1154 | } else { |
| 1155 | 1155 | $message['notice_can_activate_recommended'][] = $slug; |
| 1156 | 1156 | } |
| 1157 | 1157 | } |
| 1158 | - if ( true === $plugin['required'] ) { |
|
| 1158 | + if (true === $plugin['required']) { |
|
| 1159 | 1159 | $total_required_action_count++; |
| 1160 | 1160 | } |
| 1161 | 1161 | } |
| 1162 | 1162 | |
| 1163 | - if ( $this->does_plugin_require_update( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) { |
|
| 1163 | + if ($this->does_plugin_require_update($slug) || false !== $this->does_plugin_have_update($slug)) { |
|
| 1164 | 1164 | |
| 1165 | - if ( current_user_can( 'update_plugins' ) ) { |
|
| 1165 | + if (current_user_can('update_plugins')) { |
|
| 1166 | 1166 | $update_link_count++; |
| 1167 | 1167 | |
| 1168 | - if ( $this->does_plugin_require_update( $slug ) ) { |
|
| 1168 | + if ($this->does_plugin_require_update($slug)) { |
|
| 1169 | 1169 | $message['notice_ask_to_update'][] = $slug; |
| 1170 | - } elseif ( false !== $this->does_plugin_have_update( $slug ) ) { |
|
| 1170 | + } elseif (false !== $this->does_plugin_have_update($slug)) { |
|
| 1171 | 1171 | $message['notice_ask_to_update_maybe'][] = $slug; |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | - if ( true === $plugin['required'] ) { |
|
| 1174 | + if (true === $plugin['required']) { |
|
| 1175 | 1175 | $total_required_action_count++; |
| 1176 | 1176 | } |
| 1177 | 1177 | } |
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | - unset( $slug, $plugin ); |
|
| 1180 | + unset($slug, $plugin); |
|
| 1181 | 1181 | |
| 1182 | 1182 | // If we have notices to display, we move forward. |
| 1183 | - if ( ! empty( $message ) || $total_required_action_count > 0 ) { |
|
| 1184 | - krsort( $message ); // Sort messages. |
|
| 1183 | + if (!empty($message) || $total_required_action_count > 0) { |
|
| 1184 | + krsort($message); // Sort messages. |
|
| 1185 | 1185 | $rendered = ''; |
| 1186 | 1186 | |
| 1187 | 1187 | // As add_settings_error() wraps the final message in a <p> and as the final message can't be |
| 1188 | 1188 | // filtered, using <p>'s in our html would render invalid html output. |
| 1189 | 1189 | $line_template = '<span style="display: block; margin: 0.5em 0.5em 0 0; clear: both;">%s</span>' . "\n"; |
| 1190 | 1190 | |
| 1191 | - if ( ! current_user_can( 'activate_plugins' ) && ! current_user_can( 'install_plugins' ) && ! current_user_can( 'update_plugins' ) ) { |
|
| 1192 | - $rendered = esc_html( $this->strings['notice_cannot_install_activate'] ) . ' ' . esc_html( $this->strings['contact_admin'] ); |
|
| 1193 | - $rendered .= $this->create_user_action_links_for_notice( 0, 0, 0, $line_template ); |
|
| 1191 | + if (!current_user_can('activate_plugins') && !current_user_can('install_plugins') && !current_user_can('update_plugins')) { |
|
| 1192 | + $rendered = esc_html($this->strings['notice_cannot_install_activate']) . ' ' . esc_html($this->strings['contact_admin']); |
|
| 1193 | + $rendered .= $this->create_user_action_links_for_notice(0, 0, 0, $line_template); |
|
| 1194 | 1194 | } else { |
| 1195 | 1195 | |
| 1196 | 1196 | // If dismissable is false and a message is set, output it now. |
| 1197 | - if ( ! $this->dismissable && ! empty( $this->dismiss_msg ) ) { |
|
| 1198 | - $rendered .= sprintf( $line_template, wp_kses_post( $this->dismiss_msg ) ); |
|
| 1197 | + if (!$this->dismissable && !empty($this->dismiss_msg)) { |
|
| 1198 | + $rendered .= sprintf($line_template, wp_kses_post($this->dismiss_msg)); |
|
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | 1201 | // Render the individual message lines for the notice. |
| 1202 | - foreach ( $message as $type => $plugin_group ) { |
|
| 1202 | + foreach ($message as $type => $plugin_group) { |
|
| 1203 | 1203 | $linked_plugins = array(); |
| 1204 | 1204 | |
| 1205 | 1205 | // Get the external info link for a plugin if one is available. |
| 1206 | - foreach ( $plugin_group as $plugin_slug ) { |
|
| 1207 | - $linked_plugins[] = $this->get_info_link( $plugin_slug ); |
|
| 1206 | + foreach ($plugin_group as $plugin_slug) { |
|
| 1207 | + $linked_plugins[] = $this->get_info_link($plugin_slug); |
|
| 1208 | 1208 | } |
| 1209 | - unset( $plugin_slug ); |
|
| 1209 | + unset($plugin_slug); |
|
| 1210 | 1210 | |
| 1211 | - $count = count( $plugin_group ); |
|
| 1212 | - $linked_plugins = array_map( array( 'TGMPA_Utils', 'wrap_in_em' ), $linked_plugins ); |
|
| 1213 | - $last_plugin = array_pop( $linked_plugins ); // Pop off last name to prep for readability. |
|
| 1214 | - $imploded = empty( $linked_plugins ) ? $last_plugin : ( implode( ', ', $linked_plugins ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
| 1211 | + $count = count($plugin_group); |
|
| 1212 | + $linked_plugins = array_map(array('TGMPA_Utils', 'wrap_in_em'), $linked_plugins); |
|
| 1213 | + $last_plugin = array_pop($linked_plugins); // Pop off last name to prep for readability. |
|
| 1214 | + $imploded = empty($linked_plugins) ? $last_plugin : (implode(', ', $linked_plugins) . ' ' . esc_html_x('and', 'plugin A *and* plugin B', 'tgmpa') . ' ' . $last_plugin); |
|
| 1215 | 1215 | |
| 1216 | 1216 | $rendered .= sprintf( |
| 1217 | 1217 | $line_template, |
| 1218 | 1218 | sprintf( |
| 1219 | - translate_nooped_plural( $this->strings[ $type ], $count, 'tgmpa' ), |
|
| 1219 | + translate_nooped_plural($this->strings[$type], $count, 'tgmpa'), |
|
| 1220 | 1220 | $imploded, |
| 1221 | 1221 | $count |
| 1222 | 1222 | ) |
| 1223 | 1223 | ); |
| 1224 | 1224 | |
| 1225 | 1225 | } |
| 1226 | - unset( $type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded ); |
|
| 1226 | + unset($type, $plugin_group, $linked_plugins, $count, $last_plugin, $imploded); |
|
| 1227 | 1227 | |
| 1228 | - $rendered .= $this->create_user_action_links_for_notice( $install_link_count, $update_link_count, $activate_link_count, $line_template ); |
|
| 1228 | + $rendered .= $this->create_user_action_links_for_notice($install_link_count, $update_link_count, $activate_link_count, $line_template); |
|
| 1229 | 1229 | } |
| 1230 | 1230 | |
| 1231 | 1231 | // Register the nag messages and prepare them to be processed. |
| 1232 | - add_settings_error( 'tgmpa', 'tgmpa', $rendered, $this->get_admin_notice_class() ); |
|
| 1232 | + add_settings_error('tgmpa', 'tgmpa', $rendered, $this->get_admin_notice_class()); |
|
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | 1235 | // Admin options pages already output settings_errors, so this is to avoid duplication. |
| 1236 | - if ( 'options-general' !== $GLOBALS['current_screen']->parent_base ) { |
|
| 1236 | + if ('options-general' !== $GLOBALS['current_screen']->parent_base) { |
|
| 1237 | 1237 | $this->display_settings_errors(); |
| 1238 | 1238 | } |
| 1239 | 1239 | } |
@@ -1249,49 +1249,49 @@ discard block |
||
| 1249 | 1249 | * @param int $line_template Template for the HTML tag to output a line. |
| 1250 | 1250 | * @return string Action links. |
| 1251 | 1251 | */ |
| 1252 | - protected function create_user_action_links_for_notice( $install_count, $update_count, $activate_count, $line_template ) { |
|
| 1252 | + protected function create_user_action_links_for_notice($install_count, $update_count, $activate_count, $line_template) { |
|
| 1253 | 1253 | // Setup action links. |
| 1254 | 1254 | $action_links = array( |
| 1255 | 1255 | 'install' => '', |
| 1256 | 1256 | 'update' => '', |
| 1257 | 1257 | 'activate' => '', |
| 1258 | - 'dismiss' => $this->dismissable ? '<a href="' . esc_url( wp_nonce_url( add_query_arg( 'tgmpa-dismiss', 'dismiss_admin_notices' ), 'tgmpa-dismiss-' . get_current_user_id() ) ) . '" class="dismiss-notice" target="_parent">' . esc_html( $this->strings['dismiss'] ) . '</a>' : '', |
|
| 1258 | + 'dismiss' => $this->dismissable ? '<a href="' . esc_url(wp_nonce_url(add_query_arg('tgmpa-dismiss', 'dismiss_admin_notices'), 'tgmpa-dismiss-' . get_current_user_id())) . '" class="dismiss-notice" target="_parent">' . esc_html($this->strings['dismiss']) . '</a>' : '', |
|
| 1259 | 1259 | ); |
| 1260 | 1260 | |
| 1261 | 1261 | $link_template = '<a href="%2$s">%1$s</a>'; |
| 1262 | 1262 | |
| 1263 | - if ( current_user_can( 'install_plugins' ) ) { |
|
| 1264 | - if ( $install_count > 0 ) { |
|
| 1263 | + if (current_user_can('install_plugins')) { |
|
| 1264 | + if ($install_count > 0) { |
|
| 1265 | 1265 | $action_links['install'] = sprintf( |
| 1266 | 1266 | $link_template, |
| 1267 | - translate_nooped_plural( $this->strings['install_link'], $install_count, 'tgmpa' ), |
|
| 1268 | - esc_url( $this->get_tgmpa_status_url( 'install' ) ) |
|
| 1267 | + translate_nooped_plural($this->strings['install_link'], $install_count, 'tgmpa'), |
|
| 1268 | + esc_url($this->get_tgmpa_status_url('install')) |
|
| 1269 | 1269 | ); |
| 1270 | 1270 | } |
| 1271 | - if ( $update_count > 0 ) { |
|
| 1271 | + if ($update_count > 0) { |
|
| 1272 | 1272 | $action_links['update'] = sprintf( |
| 1273 | 1273 | $link_template, |
| 1274 | - translate_nooped_plural( $this->strings['update_link'], $update_count, 'tgmpa' ), |
|
| 1275 | - esc_url( $this->get_tgmpa_status_url( 'update' ) ) |
|
| 1274 | + translate_nooped_plural($this->strings['update_link'], $update_count, 'tgmpa'), |
|
| 1275 | + esc_url($this->get_tgmpa_status_url('update')) |
|
| 1276 | 1276 | ); |
| 1277 | 1277 | } |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | - if ( current_user_can( 'activate_plugins' ) && $activate_count > 0 ) { |
|
| 1280 | + if (current_user_can('activate_plugins') && $activate_count > 0) { |
|
| 1281 | 1281 | $action_links['activate'] = sprintf( |
| 1282 | 1282 | $link_template, |
| 1283 | - translate_nooped_plural( $this->strings['activate_link'], $activate_count, 'tgmpa' ), |
|
| 1284 | - esc_url( $this->get_tgmpa_status_url( 'activate' ) ) |
|
| 1283 | + translate_nooped_plural($this->strings['activate_link'], $activate_count, 'tgmpa'), |
|
| 1284 | + esc_url($this->get_tgmpa_status_url('activate')) |
|
| 1285 | 1285 | ); |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | - $action_links = apply_filters( 'tgmpa_notice_action_links', $action_links ); |
|
| 1288 | + $action_links = apply_filters('tgmpa_notice_action_links', $action_links); |
|
| 1289 | 1289 | |
| 1290 | - $action_links = array_filter( (array) $action_links ); // Remove any empty array items. |
|
| 1290 | + $action_links = array_filter((array) $action_links); // Remove any empty array items. |
|
| 1291 | 1291 | |
| 1292 | - if ( ! empty( $action_links ) ) { |
|
| 1293 | - $action_links = sprintf( $line_template, implode( ' | ', $action_links ) ); |
|
| 1294 | - return apply_filters( 'tgmpa_notice_rendered_action_links', $action_links ); |
|
| 1292 | + if (!empty($action_links)) { |
|
| 1293 | + $action_links = sprintf($line_template, implode(' | ', $action_links)); |
|
| 1294 | + return apply_filters('tgmpa_notice_rendered_action_links', $action_links); |
|
| 1295 | 1295 | } else { |
| 1296 | 1296 | return ''; |
| 1297 | 1297 | } |
@@ -1308,12 +1308,12 @@ discard block |
||
| 1308 | 1308 | * @return string |
| 1309 | 1309 | */ |
| 1310 | 1310 | protected function get_admin_notice_class() { |
| 1311 | - if ( ! empty( $this->strings['nag_type'] ) ) { |
|
| 1312 | - return sanitize_html_class( strtolower( $this->strings['nag_type'] ) ); |
|
| 1311 | + if (!empty($this->strings['nag_type'])) { |
|
| 1312 | + return sanitize_html_class(strtolower($this->strings['nag_type'])); |
|
| 1313 | 1313 | } else { |
| 1314 | - if ( version_compare( $this->wp_version, '4.2', '>=' ) ) { |
|
| 1314 | + if (version_compare($this->wp_version, '4.2', '>=')) { |
|
| 1315 | 1315 | return 'notice-warning'; |
| 1316 | - } elseif ( version_compare( $this->wp_version, '4.1', '>=' ) ) { |
|
| 1316 | + } elseif (version_compare($this->wp_version, '4.1', '>=')) { |
|
| 1317 | 1317 | return 'notice'; |
| 1318 | 1318 | } else { |
| 1319 | 1319 | return 'updated'; |
@@ -1329,11 +1329,11 @@ discard block |
||
| 1329 | 1329 | protected function display_settings_errors() { |
| 1330 | 1330 | global $wp_settings_errors; |
| 1331 | 1331 | |
| 1332 | - settings_errors( 'tgmpa' ); |
|
| 1332 | + settings_errors('tgmpa'); |
|
| 1333 | 1333 | |
| 1334 | - foreach ( (array) $wp_settings_errors as $key => $details ) { |
|
| 1335 | - if ( 'tgmpa' === $details['setting'] ) { |
|
| 1336 | - unset( $wp_settings_errors[ $key ] ); |
|
| 1334 | + foreach ((array) $wp_settings_errors as $key => $details) { |
|
| 1335 | + if ('tgmpa' === $details['setting']) { |
|
| 1336 | + unset($wp_settings_errors[$key]); |
|
| 1337 | 1337 | break; |
| 1338 | 1338 | } |
| 1339 | 1339 | } |
@@ -1348,8 +1348,8 @@ discard block |
||
| 1348 | 1348 | * @since 2.1.0 |
| 1349 | 1349 | */ |
| 1350 | 1350 | public function dismiss() { |
| 1351 | - if ( isset( $_GET['tgmpa-dismiss'] ) && check_admin_referer( 'tgmpa-dismiss-' . get_current_user_id() ) ) { |
|
| 1352 | - update_user_meta( get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1 ); |
|
| 1351 | + if (isset($_GET['tgmpa-dismiss']) && check_admin_referer('tgmpa-dismiss-' . get_current_user_id())) { |
|
| 1352 | + update_user_meta(get_current_user_id(), 'tgmpa_dismissed_notice_' . $this->id, 1); |
|
| 1353 | 1353 | } |
| 1354 | 1354 | } |
| 1355 | 1355 | |
@@ -1364,55 +1364,55 @@ discard block |
||
| 1364 | 1364 | * @param array|null $plugin Array of plugin arguments or null if invalid argument. |
| 1365 | 1365 | * @return null Return early if incorrect argument. |
| 1366 | 1366 | */ |
| 1367 | - public function register( $plugin ) { |
|
| 1368 | - if ( empty( $plugin['slug'] ) || empty( $plugin['name'] ) ) { |
|
| 1367 | + public function register($plugin) { |
|
| 1368 | + if (empty($plugin['slug']) || empty($plugin['name'])) { |
|
| 1369 | 1369 | return; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | - if ( empty( $plugin['slug'] ) || ! is_string( $plugin['slug'] ) || isset( $this->plugins[ $plugin['slug'] ] ) ) { |
|
| 1372 | + if (empty($plugin['slug']) || !is_string($plugin['slug']) || isset($this->plugins[$plugin['slug']])) { |
|
| 1373 | 1373 | return; |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | 1376 | $defaults = array( |
| 1377 | - 'name' => '', // String |
|
| 1378 | - 'slug' => '', // String |
|
| 1379 | - 'source' => 'repo', // String |
|
| 1380 | - 'required' => false, // Boolean |
|
| 1381 | - 'version' => '', // String |
|
| 1382 | - 'force_activation' => false, // Boolean |
|
| 1383 | - 'force_deactivation' => false, // Boolean |
|
| 1384 | - 'external_url' => '', // String |
|
| 1385 | - 'is_callable' => '', // String|Array. |
|
| 1377 | + 'name' => '', // String |
|
| 1378 | + 'slug' => '', // String |
|
| 1379 | + 'source' => 'repo', // String |
|
| 1380 | + 'required' => false, // Boolean |
|
| 1381 | + 'version' => '', // String |
|
| 1382 | + 'force_activation' => false, // Boolean |
|
| 1383 | + 'force_deactivation' => false, // Boolean |
|
| 1384 | + 'external_url' => '', // String |
|
| 1385 | + 'is_callable' => '', // String|Array. |
|
| 1386 | 1386 | ); |
| 1387 | 1387 | |
| 1388 | 1388 | // Prepare the received data. |
| 1389 | - $plugin = wp_parse_args( $plugin, $defaults ); |
|
| 1389 | + $plugin = wp_parse_args($plugin, $defaults); |
|
| 1390 | 1390 | |
| 1391 | 1391 | // Standardize the received slug. |
| 1392 | - $plugin['slug'] = $this->sanitize_key( $plugin['slug'] ); |
|
| 1392 | + $plugin['slug'] = $this->sanitize_key($plugin['slug']); |
|
| 1393 | 1393 | |
| 1394 | 1394 | // Forgive users for using string versions of booleans or floats for version number. |
| 1395 | 1395 | $plugin['version'] = (string) $plugin['version']; |
| 1396 | - $plugin['source'] = empty( $plugin['source'] ) ? 'repo' : $plugin['source']; |
|
| 1397 | - $plugin['required'] = TGMPA_Utils::validate_bool( $plugin['required'] ); |
|
| 1398 | - $plugin['force_activation'] = TGMPA_Utils::validate_bool( $plugin['force_activation'] ); |
|
| 1399 | - $plugin['force_deactivation'] = TGMPA_Utils::validate_bool( $plugin['force_deactivation'] ); |
|
| 1396 | + $plugin['source'] = empty($plugin['source']) ? 'repo' : $plugin['source']; |
|
| 1397 | + $plugin['required'] = TGMPA_Utils::validate_bool($plugin['required']); |
|
| 1398 | + $plugin['force_activation'] = TGMPA_Utils::validate_bool($plugin['force_activation']); |
|
| 1399 | + $plugin['force_deactivation'] = TGMPA_Utils::validate_bool($plugin['force_deactivation']); |
|
| 1400 | 1400 | |
| 1401 | 1401 | // Enrich the received data. |
| 1402 | - $plugin['file_path'] = $this->_get_plugin_basename_from_slug( $plugin['slug'] ); |
|
| 1403 | - $plugin['source_type'] = $this->get_plugin_source_type( $plugin['source'] ); |
|
| 1402 | + $plugin['file_path'] = $this->_get_plugin_basename_from_slug($plugin['slug']); |
|
| 1403 | + $plugin['source_type'] = $this->get_plugin_source_type($plugin['source']); |
|
| 1404 | 1404 | |
| 1405 | 1405 | // Set the class properties. |
| 1406 | - $this->plugins[ $plugin['slug'] ] = $plugin; |
|
| 1407 | - $this->sort_order[ $plugin['slug'] ] = $plugin['name']; |
|
| 1406 | + $this->plugins[$plugin['slug']] = $plugin; |
|
| 1407 | + $this->sort_order[$plugin['slug']] = $plugin['name']; |
|
| 1408 | 1408 | |
| 1409 | 1409 | // Should we add the force activation hook ? |
| 1410 | - if ( true === $plugin['force_activation'] ) { |
|
| 1410 | + if (true === $plugin['force_activation']) { |
|
| 1411 | 1411 | $this->has_forced_activation = true; |
| 1412 | 1412 | } |
| 1413 | 1413 | |
| 1414 | 1414 | // Should we add the force deactivation hook ? |
| 1415 | - if ( true === $plugin['force_deactivation'] ) { |
|
| 1415 | + if (true === $plugin['force_deactivation']) { |
|
| 1416 | 1416 | $this->has_forced_deactivation = true; |
| 1417 | 1417 | } |
| 1418 | 1418 | } |
@@ -1426,10 +1426,10 @@ discard block |
||
| 1426 | 1426 | * (= bundled) or an external URL. |
| 1427 | 1427 | * @return string 'repo', 'external', or 'bundled' |
| 1428 | 1428 | */ |
| 1429 | - protected function get_plugin_source_type( $source ) { |
|
| 1430 | - if ( 'repo' === $source || preg_match( self::WP_REPO_REGEX, $source ) ) { |
|
| 1429 | + protected function get_plugin_source_type($source) { |
|
| 1430 | + if ('repo' === $source || preg_match(self::WP_REPO_REGEX, $source)) { |
|
| 1431 | 1431 | return 'repo'; |
| 1432 | - } elseif ( preg_match( self::IS_URL_REGEX, $source ) ) { |
|
| 1432 | + } elseif (preg_match(self::IS_URL_REGEX, $source)) { |
|
| 1433 | 1433 | return 'external'; |
| 1434 | 1434 | } else { |
| 1435 | 1435 | return 'bundled'; |
@@ -1450,9 +1450,9 @@ discard block |
||
| 1450 | 1450 | * @param string $key String key. |
| 1451 | 1451 | * @return string Sanitized key |
| 1452 | 1452 | */ |
| 1453 | - public function sanitize_key( $key ) { |
|
| 1453 | + public function sanitize_key($key) { |
|
| 1454 | 1454 | $raw_key = $key; |
| 1455 | - $key = preg_replace( '`[^A-Za-z0-9_-]`', '', $key ); |
|
| 1455 | + $key = preg_replace('`[^A-Za-z0-9_-]`', '', $key); |
|
| 1456 | 1456 | |
| 1457 | 1457 | /** |
| 1458 | 1458 | * Filter a sanitized key string. |
@@ -1462,7 +1462,7 @@ discard block |
||
| 1462 | 1462 | * @param string $key Sanitized key. |
| 1463 | 1463 | * @param string $raw_key The key prior to sanitization. |
| 1464 | 1464 | */ |
| 1465 | - return apply_filters( 'tgmpa_sanitize_key', $key, $raw_key ); |
|
| 1465 | + return apply_filters('tgmpa_sanitize_key', $key, $raw_key); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | /** |
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | * |
| 1473 | 1473 | * @param array $config Array of config options to pass as class properties. |
| 1474 | 1474 | */ |
| 1475 | - public function config( $config ) { |
|
| 1475 | + public function config($config) { |
|
| 1476 | 1476 | $keys = array( |
| 1477 | 1477 | 'id', |
| 1478 | 1478 | 'default_path', |
@@ -1487,12 +1487,12 @@ discard block |
||
| 1487 | 1487 | 'strings', |
| 1488 | 1488 | ); |
| 1489 | 1489 | |
| 1490 | - foreach ( $keys as $key ) { |
|
| 1491 | - if ( isset( $config[ $key ] ) ) { |
|
| 1492 | - if ( is_array( $config[ $key ] ) ) { |
|
| 1493 | - $this->$key = array_merge( $this->$key, $config[ $key ] ); |
|
| 1490 | + foreach ($keys as $key) { |
|
| 1491 | + if (isset($config[$key])) { |
|
| 1492 | + if (is_array($config[$key])) { |
|
| 1493 | + $this->$key = array_merge($this->$key, $config[$key]); |
|
| 1494 | 1494 | } else { |
| 1495 | - $this->$key = $config[ $key ]; |
|
| 1495 | + $this->$key = $config[$key]; |
|
| 1496 | 1496 | } |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
@@ -1506,9 +1506,9 @@ discard block |
||
| 1506 | 1506 | * @param array $install_actions Existing array of actions. |
| 1507 | 1507 | * @return false|array Amended array of actions. |
| 1508 | 1508 | */ |
| 1509 | - public function actions( $install_actions ) { |
|
| 1509 | + public function actions($install_actions) { |
|
| 1510 | 1510 | // Remove action links on the TGMPA install page. |
| 1511 | - if ( $this->is_tgmpa_page() ) { |
|
| 1511 | + if ($this->is_tgmpa_page()) { |
|
| 1512 | 1512 | return false; |
| 1513 | 1513 | } |
| 1514 | 1514 | |
@@ -1524,8 +1524,8 @@ discard block |
||
| 1524 | 1524 | * @param bool $clear_update_cache Optional. Whether to clear the Plugin updates cache. |
| 1525 | 1525 | * Parameter added in v2.5.0. |
| 1526 | 1526 | */ |
| 1527 | - public function flush_plugins_cache( $clear_update_cache = true ) { |
|
| 1528 | - wp_clean_plugins_cache( $clear_update_cache ); |
|
| 1527 | + public function flush_plugins_cache($clear_update_cache = true) { |
|
| 1528 | + wp_clean_plugins_cache($clear_update_cache); |
|
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | /** |
@@ -1536,13 +1536,13 @@ discard block |
||
| 1536 | 1536 | * @param string $plugin_slug Optional. If set, only (re-)populates the file path for that specific plugin. |
| 1537 | 1537 | * Parameter added in v2.5.0. |
| 1538 | 1538 | */ |
| 1539 | - public function populate_file_path( $plugin_slug = '' ) { |
|
| 1540 | - if ( ! empty( $plugin_slug ) && is_string( $plugin_slug ) && isset( $this->plugins[ $plugin_slug ] ) ) { |
|
| 1541 | - $this->plugins[ $plugin_slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $plugin_slug ); |
|
| 1539 | + public function populate_file_path($plugin_slug = '') { |
|
| 1540 | + if (!empty($plugin_slug) && is_string($plugin_slug) && isset($this->plugins[$plugin_slug])) { |
|
| 1541 | + $this->plugins[$plugin_slug]['file_path'] = $this->_get_plugin_basename_from_slug($plugin_slug); |
|
| 1542 | 1542 | } else { |
| 1543 | 1543 | // Add file_path key for all plugins. |
| 1544 | - foreach ( $this->plugins as $slug => $values ) { |
|
| 1545 | - $this->plugins[ $slug ]['file_path'] = $this->_get_plugin_basename_from_slug( $slug ); |
|
| 1544 | + foreach ($this->plugins as $slug => $values) { |
|
| 1545 | + $this->plugins[$slug]['file_path'] = $this->_get_plugin_basename_from_slug($slug); |
|
| 1546 | 1546 | } |
| 1547 | 1547 | } |
| 1548 | 1548 | } |
@@ -1556,11 +1556,11 @@ discard block |
||
| 1556 | 1556 | * @param string $slug Plugin slug (typically folder name) as provided by the developer. |
| 1557 | 1557 | * @return string Either file path for plugin if installed, or just the plugin slug. |
| 1558 | 1558 | */ |
| 1559 | - protected function _get_plugin_basename_from_slug( $slug ) { |
|
| 1560 | - $keys = array_keys( $this->get_plugins() ); |
|
| 1559 | + protected function _get_plugin_basename_from_slug($slug) { |
|
| 1560 | + $keys = array_keys($this->get_plugins()); |
|
| 1561 | 1561 | |
| 1562 | - foreach ( $keys as $key ) { |
|
| 1563 | - if ( preg_match( '|^' . $slug . '/|', $key ) ) { |
|
| 1562 | + foreach ($keys as $key) { |
|
| 1563 | + if (preg_match('|^' . $slug . '/|', $key)) { |
|
| 1564 | 1564 | return $key; |
| 1565 | 1565 | } |
| 1566 | 1566 | } |
@@ -1580,10 +1580,10 @@ discard block |
||
| 1580 | 1580 | * @param string $data Optional. Array key of plugin data to return. Default is slug. |
| 1581 | 1581 | * @return string|boolean Plugin slug if found, false otherwise. |
| 1582 | 1582 | */ |
| 1583 | - public function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
|
| 1584 | - foreach ( $this->plugins as $values ) { |
|
| 1585 | - if ( $name === $values['name'] && isset( $values[ $data ] ) ) { |
|
| 1586 | - return $values[ $data ]; |
|
| 1583 | + public function _get_plugin_data_from_name($name, $data = 'slug') { |
|
| 1584 | + foreach ($this->plugins as $values) { |
|
| 1585 | + if ($name === $values['name'] && isset($values[$data])) { |
|
| 1586 | + return $values[$data]; |
|
| 1587 | 1587 | } |
| 1588 | 1588 | } |
| 1589 | 1589 | |
@@ -1598,16 +1598,16 @@ discard block |
||
| 1598 | 1598 | * @param string $slug Plugin slug. |
| 1599 | 1599 | * @return string Plugin download URL or path to local file or empty string if undetermined. |
| 1600 | 1600 | */ |
| 1601 | - public function get_download_url( $slug ) { |
|
| 1601 | + public function get_download_url($slug) { |
|
| 1602 | 1602 | $dl_source = ''; |
| 1603 | 1603 | |
| 1604 | - switch ( $this->plugins[ $slug ]['source_type'] ) { |
|
| 1604 | + switch ($this->plugins[$slug]['source_type']) { |
|
| 1605 | 1605 | case 'repo': |
| 1606 | - return $this->get_wp_repo_download_url( $slug ); |
|
| 1606 | + return $this->get_wp_repo_download_url($slug); |
|
| 1607 | 1607 | case 'external': |
| 1608 | - return $this->plugins[ $slug ]['source']; |
|
| 1608 | + return $this->plugins[$slug]['source']; |
|
| 1609 | 1609 | case 'bundled': |
| 1610 | - return $this->default_path . $this->plugins[ $slug ]['source']; |
|
| 1610 | + return $this->default_path . $this->plugins[$slug]['source']; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | return $dl_source; // Should never happen. |
@@ -1621,11 +1621,11 @@ discard block |
||
| 1621 | 1621 | * @param string $slug Plugin slug. |
| 1622 | 1622 | * @return string Plugin download URL. |
| 1623 | 1623 | */ |
| 1624 | - protected function get_wp_repo_download_url( $slug ) { |
|
| 1624 | + protected function get_wp_repo_download_url($slug) { |
|
| 1625 | 1625 | $source = ''; |
| 1626 | - $api = $this->get_plugins_api( $slug ); |
|
| 1626 | + $api = $this->get_plugins_api($slug); |
|
| 1627 | 1627 | |
| 1628 | - if ( false !== $api && isset( $api->download_link ) ) { |
|
| 1628 | + if (false !== $api && isset($api->download_link)) { |
|
| 1629 | 1629 | $source = $api->download_link; |
| 1630 | 1630 | } |
| 1631 | 1631 | |
@@ -1640,26 +1640,26 @@ discard block |
||
| 1640 | 1640 | * @param string $slug Plugin slug. |
| 1641 | 1641 | * @return object Plugins_api response object on success, WP_Error on failure. |
| 1642 | 1642 | */ |
| 1643 | - protected function get_plugins_api( $slug ) { |
|
| 1643 | + protected function get_plugins_api($slug) { |
|
| 1644 | 1644 | static $api = array(); // Cache received responses. |
| 1645 | 1645 | |
| 1646 | - if ( ! isset( $api[ $slug ] ) ) { |
|
| 1647 | - if ( ! function_exists( 'plugins_api' ) ) { |
|
| 1646 | + if (!isset($api[$slug])) { |
|
| 1647 | + if (!function_exists('plugins_api')) { |
|
| 1648 | 1648 | require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | - $response = plugins_api( 'plugin_information', array( 'slug' => $slug, 'fields' => array( 'sections' => false ) ) ); |
|
| 1651 | + $response = plugins_api('plugin_information', array('slug' => $slug, 'fields' => array('sections' => false))); |
|
| 1652 | 1652 | |
| 1653 | - $api[ $slug ] = false; |
|
| 1653 | + $api[$slug] = false; |
|
| 1654 | 1654 | |
| 1655 | - if ( is_wp_error( $response ) ) { |
|
| 1656 | - wp_die( esc_html( $this->strings['oops'] ) ); |
|
| 1655 | + if (is_wp_error($response)) { |
|
| 1656 | + wp_die(esc_html($this->strings['oops'])); |
|
| 1657 | 1657 | } else { |
| 1658 | - $api[ $slug ] = $response; |
|
| 1658 | + $api[$slug] = $response; |
|
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | - return $api[ $slug ]; |
|
| 1662 | + return $api[$slug]; |
|
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | /** |
@@ -1671,32 +1671,32 @@ discard block |
||
| 1671 | 1671 | * @return string Fully formed html link to a plugin information page if available |
| 1672 | 1672 | * or the plugin name if not. |
| 1673 | 1673 | */ |
| 1674 | - public function get_info_link( $slug ) { |
|
| 1675 | - if ( ! empty( $this->plugins[ $slug ]['external_url'] ) && preg_match( self::IS_URL_REGEX, $this->plugins[ $slug ]['external_url'] ) ) { |
|
| 1674 | + public function get_info_link($slug) { |
|
| 1675 | + if (!empty($this->plugins[$slug]['external_url']) && preg_match(self::IS_URL_REGEX, $this->plugins[$slug]['external_url'])) { |
|
| 1676 | 1676 | $link = sprintf( |
| 1677 | 1677 | '<a href="%1$s" target="_blank">%2$s</a>', |
| 1678 | - esc_url( $this->plugins[ $slug ]['external_url'] ), |
|
| 1679 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
| 1678 | + esc_url($this->plugins[$slug]['external_url']), |
|
| 1679 | + esc_html($this->plugins[$slug]['name']) |
|
| 1680 | 1680 | ); |
| 1681 | - } elseif ( 'repo' === $this->plugins[ $slug ]['source_type'] ) { |
|
| 1681 | + } elseif ('repo' === $this->plugins[$slug]['source_type']) { |
|
| 1682 | 1682 | $url = add_query_arg( |
| 1683 | 1683 | array( |
| 1684 | 1684 | 'tab' => 'plugin-information', |
| 1685 | - 'plugin' => urlencode( $slug ), |
|
| 1685 | + 'plugin' => urlencode($slug), |
|
| 1686 | 1686 | 'TB_iframe' => 'true', |
| 1687 | 1687 | 'width' => '640', |
| 1688 | 1688 | 'height' => '500', |
| 1689 | 1689 | ), |
| 1690 | - self_admin_url( 'plugin-install.php' ) |
|
| 1690 | + self_admin_url('plugin-install.php') |
|
| 1691 | 1691 | ); |
| 1692 | 1692 | |
| 1693 | 1693 | $link = sprintf( |
| 1694 | 1694 | '<a href="%1$s" class="thickbox">%2$s</a>', |
| 1695 | - esc_url( $url ), |
|
| 1696 | - esc_html( $this->plugins[ $slug ]['name'] ) |
|
| 1695 | + esc_url($url), |
|
| 1696 | + esc_html($this->plugins[$slug]['name']) |
|
| 1697 | 1697 | ); |
| 1698 | 1698 | } else { |
| 1699 | - $link = esc_html( $this->plugins[ $slug ]['name'] ); // No hyperlink. |
|
| 1699 | + $link = esc_html($this->plugins[$slug]['name']); // No hyperlink. |
|
| 1700 | 1700 | } |
| 1701 | 1701 | |
| 1702 | 1702 | return $link; |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | * @return boolean True when on the TGMPA page, false otherwise. |
| 1711 | 1711 | */ |
| 1712 | 1712 | protected function is_tgmpa_page() { |
| 1713 | - return isset( $_GET['page'] ) && $this->menu === $_GET['page']; |
|
| 1713 | + return isset($_GET['page']) && $this->menu === $_GET['page']; |
|
| 1714 | 1714 | } |
| 1715 | 1715 | |
| 1716 | 1716 | /** |
@@ -1722,19 +1722,19 @@ discard block |
||
| 1722 | 1722 | */ |
| 1723 | 1723 | protected function is_core_update_page() { |
| 1724 | 1724 | // Current screen is not always available, most notably on the customizer screen. |
| 1725 | - if ( ! function_exists( 'get_current_screen' ) ) { |
|
| 1725 | + if (!function_exists('get_current_screen')) { |
|
| 1726 | 1726 | return false; |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | $screen = get_current_screen(); |
| 1730 | 1730 | |
| 1731 | - if ( 'update-core' === $screen->base ) { |
|
| 1731 | + if ('update-core' === $screen->base) { |
|
| 1732 | 1732 | // Core update screen. |
| 1733 | 1733 | return true; |
| 1734 | - } elseif ( 'plugins' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
| 1734 | + } elseif ('plugins' === $screen->base && !empty($_POST['action'])) { // WPCS: CSRF ok. |
|
| 1735 | 1735 | // Plugins bulk update screen. |
| 1736 | 1736 | return true; |
| 1737 | - } elseif ( 'update' === $screen->base && ! empty( $_POST['action'] ) ) { // WPCS: CSRF ok. |
|
| 1737 | + } elseif ('update' === $screen->base && !empty($_POST['action'])) { // WPCS: CSRF ok. |
|
| 1738 | 1738 | // Individual updates (ajax call). |
| 1739 | 1739 | return true; |
| 1740 | 1740 | } |
@@ -1755,16 +1755,16 @@ discard block |
||
| 1755 | 1755 | public function get_tgmpa_url() { |
| 1756 | 1756 | static $url; |
| 1757 | 1757 | |
| 1758 | - if ( ! isset( $url ) ) { |
|
| 1758 | + if (!isset($url)) { |
|
| 1759 | 1759 | $parent = $this->parent_slug; |
| 1760 | - if ( false === strpos( $parent, '.php' ) ) { |
|
| 1760 | + if (false === strpos($parent, '.php')) { |
|
| 1761 | 1761 | $parent = 'admin.php'; |
| 1762 | 1762 | } |
| 1763 | 1763 | $url = add_query_arg( |
| 1764 | 1764 | array( |
| 1765 | - 'page' => urlencode( $this->menu ), |
|
| 1765 | + 'page' => urlencode($this->menu), |
|
| 1766 | 1766 | ), |
| 1767 | - self_admin_url( $parent ) |
|
| 1767 | + self_admin_url($parent) |
|
| 1768 | 1768 | ); |
| 1769 | 1769 | } |
| 1770 | 1770 | |
@@ -1782,10 +1782,10 @@ discard block |
||
| 1782 | 1782 | * @param string $status Plugin status - either 'install', 'update' or 'activate'. |
| 1783 | 1783 | * @return string Properly encoded URL (not escaped). |
| 1784 | 1784 | */ |
| 1785 | - public function get_tgmpa_status_url( $status ) { |
|
| 1785 | + public function get_tgmpa_status_url($status) { |
|
| 1786 | 1786 | return add_query_arg( |
| 1787 | 1787 | array( |
| 1788 | - 'plugin_status' => urlencode( $status ), |
|
| 1788 | + 'plugin_status' => urlencode($status), |
|
| 1789 | 1789 | ), |
| 1790 | 1790 | $this->get_tgmpa_url() |
| 1791 | 1791 | ); |
@@ -1800,8 +1800,8 @@ discard block |
||
| 1800 | 1800 | */ |
| 1801 | 1801 | public function is_tgmpa_complete() { |
| 1802 | 1802 | $complete = true; |
| 1803 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 1804 | - if ( ! $this->is_plugin_active( $slug ) || false !== $this->does_plugin_have_update( $slug ) ) { |
|
| 1803 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 1804 | + if (!$this->is_plugin_active($slug) || false !== $this->does_plugin_have_update($slug)) { |
|
| 1805 | 1805 | $complete = false; |
| 1806 | 1806 | break; |
| 1807 | 1807 | } |
@@ -1818,10 +1818,10 @@ discard block |
||
| 1818 | 1818 | * @param string $slug Plugin slug. |
| 1819 | 1819 | * @return bool True if installed, false otherwise. |
| 1820 | 1820 | */ |
| 1821 | - public function is_plugin_installed( $slug ) { |
|
| 1821 | + public function is_plugin_installed($slug) { |
|
| 1822 | 1822 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
| 1823 | 1823 | |
| 1824 | - return ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ] ) ); |
|
| 1824 | + return (!empty($installed_plugins[$this->plugins[$slug]['file_path']])); |
|
| 1825 | 1825 | } |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
@@ -1832,8 +1832,8 @@ discard block |
||
| 1832 | 1832 | * @param string $slug Plugin slug. |
| 1833 | 1833 | * @return bool True if active, false otherwise. |
| 1834 | 1834 | */ |
| 1835 | - public function is_plugin_active( $slug ) { |
|
| 1836 | - return ( ( ! empty( $this->plugins[ $slug ]['is_callable'] ) && is_callable( $this->plugins[ $slug ]['is_callable'] ) ) || is_plugin_active( $this->plugins[ $slug ]['file_path'] ) ); |
|
| 1835 | + public function is_plugin_active($slug) { |
|
| 1836 | + return ((!empty($this->plugins[$slug]['is_callable']) && is_callable($this->plugins[$slug]['is_callable'])) || is_plugin_active($this->plugins[$slug]['file_path'])); |
|
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | 1839 | /** |
@@ -1845,16 +1845,16 @@ discard block |
||
| 1845 | 1845 | * @param string $slug Plugin slug. |
| 1846 | 1846 | * @return bool True if OK to update, false otherwise. |
| 1847 | 1847 | */ |
| 1848 | - public function can_plugin_update( $slug ) { |
|
| 1848 | + public function can_plugin_update($slug) { |
|
| 1849 | 1849 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
| 1850 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1850 | + if ('repo' !== $this->plugins[$slug]['source_type']) { |
|
| 1851 | 1851 | return true; |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | - $api = $this->get_plugins_api( $slug ); |
|
| 1854 | + $api = $this->get_plugins_api($slug); |
|
| 1855 | 1855 | |
| 1856 | - if ( false !== $api && isset( $api->requires ) ) { |
|
| 1857 | - return version_compare( $this->wp_version, $api->requires, '>=' ); |
|
| 1856 | + if (false !== $api && isset($api->requires)) { |
|
| 1857 | + return version_compare($this->wp_version, $api->requires, '>='); |
|
| 1858 | 1858 | } |
| 1859 | 1859 | |
| 1860 | 1860 | // No usable info received from the plugins API, presume we can update. |
@@ -1870,11 +1870,11 @@ discard block |
||
| 1870 | 1870 | * @param string $slug Plugin slug. |
| 1871 | 1871 | * @return bool True if OK to proceed with update, false otherwise. |
| 1872 | 1872 | */ |
| 1873 | - public function is_plugin_updatetable( $slug ) { |
|
| 1874 | - if ( ! $this->is_plugin_installed( $slug ) ) { |
|
| 1873 | + public function is_plugin_updatetable($slug) { |
|
| 1874 | + if (!$this->is_plugin_installed($slug)) { |
|
| 1875 | 1875 | return false; |
| 1876 | 1876 | } else { |
| 1877 | - return ( false !== $this->does_plugin_have_update( $slug ) && $this->can_plugin_update( $slug ) ); |
|
| 1877 | + return (false !== $this->does_plugin_have_update($slug) && $this->can_plugin_update($slug)); |
|
| 1878 | 1878 | } |
| 1879 | 1879 | } |
| 1880 | 1880 | |
@@ -1887,8 +1887,8 @@ discard block |
||
| 1887 | 1887 | * @param string $slug Plugin slug. |
| 1888 | 1888 | * @return bool True if OK to activate, false otherwise. |
| 1889 | 1889 | */ |
| 1890 | - public function can_plugin_activate( $slug ) { |
|
| 1891 | - return ( ! $this->is_plugin_active( $slug ) && ! $this->does_plugin_require_update( $slug ) ); |
|
| 1890 | + public function can_plugin_activate($slug) { |
|
| 1891 | + return (!$this->is_plugin_active($slug) && !$this->does_plugin_require_update($slug)); |
|
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | 1894 | /** |
@@ -1900,11 +1900,11 @@ discard block |
||
| 1900 | 1900 | * @return string Version number as string or an empty string if the plugin is not installed |
| 1901 | 1901 | * or version unknown (plugins which don't comply with the plugin header standard). |
| 1902 | 1902 | */ |
| 1903 | - public function get_installed_version( $slug ) { |
|
| 1903 | + public function get_installed_version($slug) { |
|
| 1904 | 1904 | $installed_plugins = $this->get_plugins(); // Retrieve a list of all installed plugins (WP cached). |
| 1905 | 1905 | |
| 1906 | - if ( ! empty( $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version'] ) ) { |
|
| 1907 | - return $installed_plugins[ $this->plugins[ $slug ]['file_path'] ]['Version']; |
|
| 1906 | + if (!empty($installed_plugins[$this->plugins[$slug]['file_path']]['Version'])) { |
|
| 1907 | + return $installed_plugins[$this->plugins[$slug]['file_path']]['Version']; |
|
| 1908 | 1908 | } |
| 1909 | 1909 | |
| 1910 | 1910 | return ''; |
@@ -1918,11 +1918,11 @@ discard block |
||
| 1918 | 1918 | * @param string $slug Plugin slug. |
| 1919 | 1919 | * @return bool True when a plugin needs to be updated, otherwise false. |
| 1920 | 1920 | */ |
| 1921 | - public function does_plugin_require_update( $slug ) { |
|
| 1922 | - $installed_version = $this->get_installed_version( $slug ); |
|
| 1923 | - $minimum_version = $this->plugins[ $slug ]['version']; |
|
| 1921 | + public function does_plugin_require_update($slug) { |
|
| 1922 | + $installed_version = $this->get_installed_version($slug); |
|
| 1923 | + $minimum_version = $this->plugins[$slug]['version']; |
|
| 1924 | 1924 | |
| 1925 | - return version_compare( $minimum_version, $installed_version, '>' ); |
|
| 1925 | + return version_compare($minimum_version, $installed_version, '>'); |
|
| 1926 | 1926 | } |
| 1927 | 1927 | |
| 1928 | 1928 | /** |
@@ -1933,20 +1933,20 @@ discard block |
||
| 1933 | 1933 | * @param string $slug Plugin slug. |
| 1934 | 1934 | * @return false|string Version number string of the available update or false if no update available. |
| 1935 | 1935 | */ |
| 1936 | - public function does_plugin_have_update( $slug ) { |
|
| 1936 | + public function does_plugin_have_update($slug) { |
|
| 1937 | 1937 | // Presume bundled and external plugins will point to a package which meets the minimum required version. |
| 1938 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1939 | - if ( $this->does_plugin_require_update( $slug ) ) { |
|
| 1940 | - return $this->plugins[ $slug ]['version']; |
|
| 1938 | + if ('repo' !== $this->plugins[$slug]['source_type']) { |
|
| 1939 | + if ($this->does_plugin_require_update($slug)) { |
|
| 1940 | + return $this->plugins[$slug]['version']; |
|
| 1941 | 1941 | } |
| 1942 | 1942 | |
| 1943 | 1943 | return false; |
| 1944 | 1944 | } |
| 1945 | 1945 | |
| 1946 | - $repo_updates = get_site_transient( 'update_plugins' ); |
|
| 1946 | + $repo_updates = get_site_transient('update_plugins'); |
|
| 1947 | 1947 | |
| 1948 | - if ( isset( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version ) ) { |
|
| 1949 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->new_version; |
|
| 1948 | + if (isset($repo_updates->response[$this->plugins[$slug]['file_path']]->new_version)) { |
|
| 1949 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->new_version; |
|
| 1950 | 1950 | } |
| 1951 | 1951 | |
| 1952 | 1952 | return false; |
@@ -1960,16 +1960,16 @@ discard block |
||
| 1960 | 1960 | * @param string $slug Plugin slug. |
| 1961 | 1961 | * @return string The upgrade notice or an empty string if no message was available or provided. |
| 1962 | 1962 | */ |
| 1963 | - public function get_upgrade_notice( $slug ) { |
|
| 1963 | + public function get_upgrade_notice($slug) { |
|
| 1964 | 1964 | // We currently can't get reliable info on non-WP-repo plugins - issue #380. |
| 1965 | - if ( 'repo' !== $this->plugins[ $slug ]['source_type'] ) { |
|
| 1965 | + if ('repo' !== $this->plugins[$slug]['source_type']) { |
|
| 1966 | 1966 | return ''; |
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | - $repo_updates = get_site_transient( 'update_plugins' ); |
|
| 1969 | + $repo_updates = get_site_transient('update_plugins'); |
|
| 1970 | 1970 | |
| 1971 | - if ( ! empty( $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice ) ) { |
|
| 1972 | - return $repo_updates->response[ $this->plugins[ $slug ]['file_path'] ]->upgrade_notice; |
|
| 1971 | + if (!empty($repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice)) { |
|
| 1972 | + return $repo_updates->response[$this->plugins[$slug]['file_path']]->upgrade_notice; |
|
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | 1975 | return ''; |
@@ -1983,12 +1983,12 @@ discard block |
||
| 1983 | 1983 | * @param string $plugin_folder Optional. Relative path to single plugin folder. |
| 1984 | 1984 | * @return array Array of installed plugins with plugin information. |
| 1985 | 1985 | */ |
| 1986 | - public function get_plugins( $plugin_folder = '' ) { |
|
| 1987 | - if ( ! function_exists( 'get_plugins' ) ) { |
|
| 1986 | + public function get_plugins($plugin_folder = '') { |
|
| 1987 | + if (!function_exists('get_plugins')) { |
|
| 1988 | 1988 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 1989 | 1989 | } |
| 1990 | 1990 | |
| 1991 | - return get_plugins( $plugin_folder ); |
|
| 1991 | + return get_plugins($plugin_folder); |
|
| 1992 | 1992 | } |
| 1993 | 1993 | |
| 1994 | 1994 | /** |
@@ -2000,7 +2000,7 @@ discard block |
||
| 2000 | 2000 | * @since 2.1.1 |
| 2001 | 2001 | */ |
| 2002 | 2002 | public function update_dismiss() { |
| 2003 | - delete_metadata( 'user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true ); |
|
| 2003 | + delete_metadata('user', null, 'tgmpa_dismissed_notice_' . $this->id, null, true); |
|
| 2004 | 2004 | } |
| 2005 | 2005 | |
| 2006 | 2006 | /** |
@@ -2018,14 +2018,14 @@ discard block |
||
| 2018 | 2018 | * @since 2.2.0 |
| 2019 | 2019 | */ |
| 2020 | 2020 | public function force_activation() { |
| 2021 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 2022 | - if ( true === $plugin['force_activation'] ) { |
|
| 2023 | - if ( ! $this->is_plugin_installed( $slug ) ) { |
|
| 2021 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 2022 | + if (true === $plugin['force_activation']) { |
|
| 2023 | + if (!$this->is_plugin_installed($slug)) { |
|
| 2024 | 2024 | // Oops, plugin isn't there so iterate to next condition. |
| 2025 | 2025 | continue; |
| 2026 | - } elseif ( $this->can_plugin_activate( $slug ) ) { |
|
| 2026 | + } elseif ($this->can_plugin_activate($slug)) { |
|
| 2027 | 2027 | // There we go, activate the plugin. |
| 2028 | - activate_plugin( $plugin['file_path'] ); |
|
| 2028 | + activate_plugin($plugin['file_path']); |
|
| 2029 | 2029 | } |
| 2030 | 2030 | } |
| 2031 | 2031 | } |
@@ -2046,19 +2046,19 @@ discard block |
||
| 2046 | 2046 | public function force_deactivation() { |
| 2047 | 2047 | $deactivated = array(); |
| 2048 | 2048 | |
| 2049 | - foreach ( $this->plugins as $slug => $plugin ) { |
|
| 2049 | + foreach ($this->plugins as $slug => $plugin) { |
|
| 2050 | 2050 | /* |
| 2051 | 2051 | * Only proceed forward if the parameter is set to true and plugin is active |
| 2052 | 2052 | * as a 'normal' (not must-use) plugin. |
| 2053 | 2053 | */ |
| 2054 | - if ( true === $plugin['force_deactivation'] && is_plugin_active( $plugin['file_path'] ) ) { |
|
| 2055 | - deactivate_plugins( $plugin['file_path'] ); |
|
| 2056 | - $deactivated[ $plugin['file_path'] ] = time(); |
|
| 2054 | + if (true === $plugin['force_deactivation'] && is_plugin_active($plugin['file_path'])) { |
|
| 2055 | + deactivate_plugins($plugin['file_path']); |
|
| 2056 | + $deactivated[$plugin['file_path']] = time(); |
|
| 2057 | 2057 | } |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | - if ( ! empty( $deactivated ) ) { |
|
| 2061 | - update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) ); |
|
| 2060 | + if (!empty($deactivated)) { |
|
| 2061 | + update_option('recently_activated', $deactivated + (array) get_option('recently_activated')); |
|
| 2062 | 2062 | } |
| 2063 | 2063 | } |
| 2064 | 2064 | |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | esc_html( |
| 2073 | 2073 | sprintf( |
| 2074 | 2074 | /* translators: %s: version number */ |
| 2075 | - __( 'TGMPA v%s', 'tgmpa' ), |
|
| 2075 | + __('TGMPA v%s', 'tgmpa'), |
|
| 2076 | 2076 | self::TGMPA_VERSION |
| 2077 | 2077 | ) |
| 2078 | 2078 | ), |
@@ -2087,7 +2087,7 @@ discard block |
||
| 2087 | 2087 | * @return \TGM_Plugin_Activation The TGM_Plugin_Activation object. |
| 2088 | 2088 | */ |
| 2089 | 2089 | public static function get_instance() { |
| 2090 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { |
|
| 2090 | + if (!isset(self::$instance) && !(self::$instance instanceof self)) { |
|
| 2091 | 2091 | self::$instance = new self(); |
| 2092 | 2092 | } |
| 2093 | 2093 | |
@@ -2095,7 +2095,7 @@ discard block |
||
| 2095 | 2095 | } |
| 2096 | 2096 | } |
| 2097 | 2097 | |
| 2098 | - if ( ! function_exists( 'load_tgm_plugin_activation' ) ) { |
|
| 2098 | + if (!function_exists('load_tgm_plugin_activation')) { |
|
| 2099 | 2099 | /** |
| 2100 | 2100 | * Ensure only one instance of the class is ever invoked. |
| 2101 | 2101 | * |
@@ -2106,14 +2106,14 @@ discard block |
||
| 2106 | 2106 | } |
| 2107 | 2107 | } |
| 2108 | 2108 | |
| 2109 | - if ( did_action( 'plugins_loaded' ) ) { |
|
| 2109 | + if (did_action('plugins_loaded')) { |
|
| 2110 | 2110 | load_tgm_plugin_activation(); |
| 2111 | 2111 | } else { |
| 2112 | - add_action( 'plugins_loaded', 'load_tgm_plugin_activation' ); |
|
| 2112 | + add_action('plugins_loaded', 'load_tgm_plugin_activation'); |
|
| 2113 | 2113 | } |
| 2114 | 2114 | } |
| 2115 | 2115 | |
| 2116 | -if ( ! function_exists( 'tgmpa' ) ) { |
|
| 2116 | +if (!function_exists('tgmpa')) { |
|
| 2117 | 2117 | /** |
| 2118 | 2118 | * Helper function to register a collection of required plugins. |
| 2119 | 2119 | * |
@@ -2123,30 +2123,30 @@ discard block |
||
| 2123 | 2123 | * @param array $plugins An array of plugin arrays. |
| 2124 | 2124 | * @param array $config Optional. An array of configuration values. |
| 2125 | 2125 | */ |
| 2126 | - function tgmpa( $plugins, $config = array() ) { |
|
| 2127 | - $instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 2126 | + function tgmpa($plugins, $config = array()) { |
|
| 2127 | + $instance = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance')); |
|
| 2128 | 2128 | |
| 2129 | - foreach ( $plugins as $plugin ) { |
|
| 2130 | - call_user_func( array( $instance, 'register' ), $plugin ); |
|
| 2129 | + foreach ($plugins as $plugin) { |
|
| 2130 | + call_user_func(array($instance, 'register'), $plugin); |
|
| 2131 | 2131 | } |
| 2132 | 2132 | |
| 2133 | - if ( ! empty( $config ) && is_array( $config ) ) { |
|
| 2133 | + if (!empty($config) && is_array($config)) { |
|
| 2134 | 2134 | // Send out notices for deprecated arguments passed. |
| 2135 | - if ( isset( $config['notices'] ) ) { |
|
| 2136 | - _deprecated_argument( __FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.' ); |
|
| 2137 | - if ( ! isset( $config['has_notices'] ) ) { |
|
| 2135 | + if (isset($config['notices'])) { |
|
| 2136 | + _deprecated_argument(__FUNCTION__, '2.2.0', 'The `notices` config parameter was renamed to `has_notices` in TGMPA 2.2.0. Please adjust your configuration.'); |
|
| 2137 | + if (!isset($config['has_notices'])) { |
|
| 2138 | 2138 | $config['has_notices'] = $config['notices']; |
| 2139 | 2139 | } |
| 2140 | 2140 | } |
| 2141 | 2141 | |
| 2142 | - if ( isset( $config['parent_menu_slug'] ) ) { |
|
| 2143 | - _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); |
|
| 2142 | + if (isset($config['parent_menu_slug'])) { |
|
| 2143 | + _deprecated_argument(__FUNCTION__, '2.4.0', 'The `parent_menu_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.'); |
|
| 2144 | 2144 | } |
| 2145 | - if ( isset( $config['parent_url_slug'] ) ) { |
|
| 2146 | - _deprecated_argument( __FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.' ); |
|
| 2145 | + if (isset($config['parent_url_slug'])) { |
|
| 2146 | + _deprecated_argument(__FUNCTION__, '2.4.0', 'The `parent_url_slug` config parameter was removed in TGMPA 2.4.0. In TGMPA 2.5.0 an alternative was (re-)introduced. Please adjust your configuration. For more information visit the website: http://tgmpluginactivation.com/configuration/#h-configuration-options.'); |
|
| 2147 | 2147 | } |
| 2148 | 2148 | |
| 2149 | - call_user_func( array( $instance, 'config' ), $config ); |
|
| 2149 | + call_user_func(array($instance, 'config'), $config); |
|
| 2150 | 2150 | } |
| 2151 | 2151 | } |
| 2152 | 2152 | } |
@@ -2157,11 +2157,11 @@ discard block |
||
| 2157 | 2157 | * |
| 2158 | 2158 | * @since 2.2.0 |
| 2159 | 2159 | */ |
| 2160 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 2160 | +if (!class_exists('WP_List_Table')) { |
|
| 2161 | 2161 | require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
| 2162 | 2162 | } |
| 2163 | 2163 | |
| 2164 | -if ( ! class_exists( 'TGMPA_List_Table' ) ) { |
|
| 2164 | +if (!class_exists('TGMPA_List_Table')) { |
|
| 2165 | 2165 | |
| 2166 | 2166 | /** |
| 2167 | 2167 | * List table class for handling plugins. |
@@ -2219,7 +2219,7 @@ discard block |
||
| 2219 | 2219 | * @since 2.2.0 |
| 2220 | 2220 | */ |
| 2221 | 2221 | public function __construct() { |
| 2222 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 2222 | + $this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance')); |
|
| 2223 | 2223 | |
| 2224 | 2224 | parent::__construct( |
| 2225 | 2225 | array( |
@@ -2229,11 +2229,11 @@ discard block |
||
| 2229 | 2229 | ) |
| 2230 | 2230 | ); |
| 2231 | 2231 | |
| 2232 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'install', 'update', 'activate' ), true ) ) { |
|
| 2233 | - $this->view_context = sanitize_key( $_REQUEST['plugin_status'] ); |
|
| 2232 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('install', 'update', 'activate'), true)) { |
|
| 2233 | + $this->view_context = sanitize_key($_REQUEST['plugin_status']); |
|
| 2234 | 2234 | } |
| 2235 | 2235 | |
| 2236 | - add_filter( 'tgmpa_table_data_items', array( $this, 'sort_table_items' ) ); |
|
| 2236 | + add_filter('tgmpa_table_data_items', array($this, 'sort_table_items')); |
|
| 2237 | 2237 | } |
| 2238 | 2238 | |
| 2239 | 2239 | /** |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | * @return array CSS classnames. |
| 2247 | 2247 | */ |
| 2248 | 2248 | public function get_table_classes() { |
| 2249 | - return array( 'widefat', 'fixed' ); |
|
| 2249 | + return array('widefat', 'fixed'); |
|
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | /** |
@@ -2265,37 +2265,37 @@ discard block |
||
| 2265 | 2265 | $plugins = $this->categorize_plugins_to_views(); |
| 2266 | 2266 | |
| 2267 | 2267 | // Set the counts for the view links. |
| 2268 | - $this->set_view_totals( $plugins ); |
|
| 2268 | + $this->set_view_totals($plugins); |
|
| 2269 | 2269 | |
| 2270 | 2270 | // Prep variables for use and grab list of all installed plugins. |
| 2271 | 2271 | $table_data = array(); |
| 2272 | 2272 | $i = 0; |
| 2273 | 2273 | |
| 2274 | 2274 | // Redirect to the 'all' view if no plugins were found for the selected view context. |
| 2275 | - if ( empty( $plugins[ $this->view_context ] ) ) { |
|
| 2275 | + if (empty($plugins[$this->view_context])) { |
|
| 2276 | 2276 | $this->view_context = 'all'; |
| 2277 | 2277 | } |
| 2278 | 2278 | |
| 2279 | - foreach ( $plugins[ $this->view_context ] as $slug => $plugin ) { |
|
| 2280 | - $table_data[ $i ]['sanitized_plugin'] = $plugin['name']; |
|
| 2281 | - $table_data[ $i ]['slug'] = $slug; |
|
| 2282 | - $table_data[ $i ]['plugin'] = '<strong>' . $this->tgmpa->get_info_link( $slug ) . '</strong>'; |
|
| 2283 | - $table_data[ $i ]['source'] = $this->get_plugin_source_type_text( $plugin['source_type'] ); |
|
| 2284 | - $table_data[ $i ]['type'] = $this->get_plugin_advise_type_text( $plugin['required'] ); |
|
| 2285 | - $table_data[ $i ]['status'] = $this->get_plugin_status_text( $slug ); |
|
| 2286 | - $table_data[ $i ]['installed_version'] = $this->tgmpa->get_installed_version( $slug ); |
|
| 2287 | - $table_data[ $i ]['minimum_version'] = $plugin['version']; |
|
| 2288 | - $table_data[ $i ]['available_version'] = $this->tgmpa->does_plugin_have_update( $slug ); |
|
| 2279 | + foreach ($plugins[$this->view_context] as $slug => $plugin) { |
|
| 2280 | + $table_data[$i]['sanitized_plugin'] = $plugin['name']; |
|
| 2281 | + $table_data[$i]['slug'] = $slug; |
|
| 2282 | + $table_data[$i]['plugin'] = '<strong>' . $this->tgmpa->get_info_link($slug) . '</strong>'; |
|
| 2283 | + $table_data[$i]['source'] = $this->get_plugin_source_type_text($plugin['source_type']); |
|
| 2284 | + $table_data[$i]['type'] = $this->get_plugin_advise_type_text($plugin['required']); |
|
| 2285 | + $table_data[$i]['status'] = $this->get_plugin_status_text($slug); |
|
| 2286 | + $table_data[$i]['installed_version'] = $this->tgmpa->get_installed_version($slug); |
|
| 2287 | + $table_data[$i]['minimum_version'] = $plugin['version']; |
|
| 2288 | + $table_data[$i]['available_version'] = $this->tgmpa->does_plugin_have_update($slug); |
|
| 2289 | 2289 | |
| 2290 | 2290 | // Prep the upgrade notice info. |
| 2291 | - $upgrade_notice = $this->tgmpa->get_upgrade_notice( $slug ); |
|
| 2292 | - if ( ! empty( $upgrade_notice ) ) { |
|
| 2293 | - $table_data[ $i ]['upgrade_notice'] = $upgrade_notice; |
|
| 2291 | + $upgrade_notice = $this->tgmpa->get_upgrade_notice($slug); |
|
| 2292 | + if (!empty($upgrade_notice)) { |
|
| 2293 | + $table_data[$i]['upgrade_notice'] = $upgrade_notice; |
|
| 2294 | 2294 | |
| 2295 | - add_action( "tgmpa_after_plugin_row_{$slug}", array( $this, 'wp_plugin_update_row' ), 10, 2 ); |
|
| 2295 | + add_action("tgmpa_after_plugin_row_{$slug}", array($this, 'wp_plugin_update_row'), 10, 2); |
|
| 2296 | 2296 | } |
| 2297 | 2297 | |
| 2298 | - $table_data[ $i ] = apply_filters( 'tgmpa_table_data_item', $table_data[ $i ], $plugin ); |
|
| 2298 | + $table_data[$i] = apply_filters('tgmpa_table_data_item', $table_data[$i], $plugin); |
|
| 2299 | 2299 | |
| 2300 | 2300 | $i++; |
| 2301 | 2301 | } |
@@ -2316,22 +2316,22 @@ discard block |
||
| 2316 | 2316 | 'activate' => array(), |
| 2317 | 2317 | ); |
| 2318 | 2318 | |
| 2319 | - foreach ( $this->tgmpa->plugins as $slug => $plugin ) { |
|
| 2320 | - if ( $this->tgmpa->is_plugin_active( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
| 2319 | + foreach ($this->tgmpa->plugins as $slug => $plugin) { |
|
| 2320 | + if ($this->tgmpa->is_plugin_active($slug) && false === $this->tgmpa->does_plugin_have_update($slug)) { |
|
| 2321 | 2321 | // No need to display plugins if they are installed, up-to-date and active. |
| 2322 | 2322 | continue; |
| 2323 | 2323 | } else { |
| 2324 | - $plugins['all'][ $slug ] = $plugin; |
|
| 2324 | + $plugins['all'][$slug] = $plugin; |
|
| 2325 | 2325 | |
| 2326 | - if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
| 2327 | - $plugins['install'][ $slug ] = $plugin; |
|
| 2326 | + if (!$this->tgmpa->is_plugin_installed($slug)) { |
|
| 2327 | + $plugins['install'][$slug] = $plugin; |
|
| 2328 | 2328 | } else { |
| 2329 | - if ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
| 2330 | - $plugins['update'][ $slug ] = $plugin; |
|
| 2329 | + if (false !== $this->tgmpa->does_plugin_have_update($slug)) { |
|
| 2330 | + $plugins['update'][$slug] = $plugin; |
|
| 2331 | 2331 | } |
| 2332 | 2332 | |
| 2333 | - if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
| 2334 | - $plugins['activate'][ $slug ] = $plugin; |
|
| 2333 | + if ($this->tgmpa->can_plugin_activate($slug)) { |
|
| 2334 | + $plugins['activate'][$slug] = $plugin; |
|
| 2335 | 2335 | } |
| 2336 | 2336 | } |
| 2337 | 2337 | } |
@@ -2347,9 +2347,9 @@ discard block |
||
| 2347 | 2347 | * |
| 2348 | 2348 | * @param array $plugins Plugins order by view. |
| 2349 | 2349 | */ |
| 2350 | - protected function set_view_totals( $plugins ) { |
|
| 2351 | - foreach ( $plugins as $type => $list ) { |
|
| 2352 | - $this->view_totals[ $type ] = count( $list ); |
|
| 2350 | + protected function set_view_totals($plugins) { |
|
| 2351 | + foreach ($plugins as $type => $list) { |
|
| 2352 | + $this->view_totals[$type] = count($list); |
|
| 2353 | 2353 | } |
| 2354 | 2354 | } |
| 2355 | 2355 | |
@@ -2361,12 +2361,12 @@ discard block |
||
| 2361 | 2361 | * @param string $required Plugin required setting. |
| 2362 | 2362 | * @return string |
| 2363 | 2363 | */ |
| 2364 | - protected function get_plugin_advise_type_text( $required ) { |
|
| 2365 | - if ( true === $required ) { |
|
| 2366 | - return __( 'Required', 'tgmpa' ); |
|
| 2364 | + protected function get_plugin_advise_type_text($required) { |
|
| 2365 | + if (true === $required) { |
|
| 2366 | + return __('Required', 'tgmpa'); |
|
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | - return __( 'Recommended', 'tgmpa' ); |
|
| 2369 | + return __('Recommended', 'tgmpa'); |
|
| 2370 | 2370 | } |
| 2371 | 2371 | |
| 2372 | 2372 | /** |
@@ -2377,18 +2377,18 @@ discard block |
||
| 2377 | 2377 | * @param string $type Plugin type. |
| 2378 | 2378 | * @return string |
| 2379 | 2379 | */ |
| 2380 | - protected function get_plugin_source_type_text( $type ) { |
|
| 2380 | + protected function get_plugin_source_type_text($type) { |
|
| 2381 | 2381 | $string = ''; |
| 2382 | 2382 | |
| 2383 | - switch ( $type ) { |
|
| 2383 | + switch ($type) { |
|
| 2384 | 2384 | case 'repo': |
| 2385 | - $string = __( 'WordPress Repository', 'tgmpa' ); |
|
| 2385 | + $string = __('WordPress Repository', 'tgmpa'); |
|
| 2386 | 2386 | break; |
| 2387 | 2387 | case 'external': |
| 2388 | - $string = __( 'External Source', 'tgmpa' ); |
|
| 2388 | + $string = __('External Source', 'tgmpa'); |
|
| 2389 | 2389 | break; |
| 2390 | 2390 | case 'bundled': |
| 2391 | - $string = __( 'Pre-Packaged', 'tgmpa' ); |
|
| 2391 | + $string = __('Pre-Packaged', 'tgmpa'); |
|
| 2392 | 2392 | break; |
| 2393 | 2393 | } |
| 2394 | 2394 | |
@@ -2403,36 +2403,36 @@ discard block |
||
| 2403 | 2403 | * @param string $slug Plugin slug. |
| 2404 | 2404 | * @return string |
| 2405 | 2405 | */ |
| 2406 | - protected function get_plugin_status_text( $slug ) { |
|
| 2407 | - if ( ! $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
| 2408 | - return __( 'Not Installed', 'tgmpa' ); |
|
| 2406 | + protected function get_plugin_status_text($slug) { |
|
| 2407 | + if (!$this->tgmpa->is_plugin_installed($slug)) { |
|
| 2408 | + return __('Not Installed', 'tgmpa'); |
|
| 2409 | 2409 | } |
| 2410 | 2410 | |
| 2411 | - if ( ! $this->tgmpa->is_plugin_active( $slug ) ) { |
|
| 2412 | - $install_status = __( 'Installed But Not Activated', 'tgmpa' ); |
|
| 2411 | + if (!$this->tgmpa->is_plugin_active($slug)) { |
|
| 2412 | + $install_status = __('Installed But Not Activated', 'tgmpa'); |
|
| 2413 | 2413 | } else { |
| 2414 | - $install_status = __( 'Active', 'tgmpa' ); |
|
| 2414 | + $install_status = __('Active', 'tgmpa'); |
|
| 2415 | 2415 | } |
| 2416 | 2416 | |
| 2417 | 2417 | $update_status = ''; |
| 2418 | 2418 | |
| 2419 | - if ( $this->tgmpa->does_plugin_require_update( $slug ) && false === $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
| 2420 | - $update_status = __( 'Required Update not Available', 'tgmpa' ); |
|
| 2419 | + if ($this->tgmpa->does_plugin_require_update($slug) && false === $this->tgmpa->does_plugin_have_update($slug)) { |
|
| 2420 | + $update_status = __('Required Update not Available', 'tgmpa'); |
|
| 2421 | 2421 | |
| 2422 | - } elseif ( $this->tgmpa->does_plugin_require_update( $slug ) ) { |
|
| 2423 | - $update_status = __( 'Requires Update', 'tgmpa' ); |
|
| 2422 | + } elseif ($this->tgmpa->does_plugin_require_update($slug)) { |
|
| 2423 | + $update_status = __('Requires Update', 'tgmpa'); |
|
| 2424 | 2424 | |
| 2425 | - } elseif ( false !== $this->tgmpa->does_plugin_have_update( $slug ) ) { |
|
| 2426 | - $update_status = __( 'Update recommended', 'tgmpa' ); |
|
| 2425 | + } elseif (false !== $this->tgmpa->does_plugin_have_update($slug)) { |
|
| 2426 | + $update_status = __('Update recommended', 'tgmpa'); |
|
| 2427 | 2427 | } |
| 2428 | 2428 | |
| 2429 | - if ( '' === $update_status ) { |
|
| 2429 | + if ('' === $update_status) { |
|
| 2430 | 2430 | return $install_status; |
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | 2433 | return sprintf( |
| 2434 | 2434 | /* translators: 1: install status, 2: update status */ |
| 2435 | - _x( '%1$s, %2$s', 'Install/Update Status', 'tgmpa' ), |
|
| 2435 | + _x('%1$s, %2$s', 'Install/Update Status', 'tgmpa'), |
|
| 2436 | 2436 | $install_status, |
| 2437 | 2437 | $update_status |
| 2438 | 2438 | ); |
@@ -2446,16 +2446,16 @@ discard block |
||
| 2446 | 2446 | * @param array $items Prepared table items. |
| 2447 | 2447 | * @return array Sorted table items. |
| 2448 | 2448 | */ |
| 2449 | - public function sort_table_items( $items ) { |
|
| 2449 | + public function sort_table_items($items) { |
|
| 2450 | 2450 | $type = array(); |
| 2451 | 2451 | $name = array(); |
| 2452 | 2452 | |
| 2453 | - foreach ( $items as $i => $plugin ) { |
|
| 2454 | - $type[ $i ] = $plugin['type']; // Required / recommended. |
|
| 2455 | - $name[ $i ] = $plugin['sanitized_plugin']; |
|
| 2453 | + foreach ($items as $i => $plugin) { |
|
| 2454 | + $type[$i] = $plugin['type']; // Required / recommended. |
|
| 2455 | + $name[$i] = $plugin['sanitized_plugin']; |
|
| 2456 | 2456 | } |
| 2457 | 2457 | |
| 2458 | - array_multisort( $type, SORT_DESC, $name, SORT_ASC, $items ); |
|
| 2458 | + array_multisort($type, SORT_DESC, $name, SORT_ASC, $items); |
|
| 2459 | 2459 | |
| 2460 | 2460 | return $items; |
| 2461 | 2461 | } |
@@ -2470,40 +2470,40 @@ discard block |
||
| 2470 | 2470 | public function get_views() { |
| 2471 | 2471 | $status_links = array(); |
| 2472 | 2472 | |
| 2473 | - foreach ( $this->view_totals as $type => $count ) { |
|
| 2474 | - if ( $count < 1 ) { |
|
| 2473 | + foreach ($this->view_totals as $type => $count) { |
|
| 2474 | + if ($count < 1) { |
|
| 2475 | 2475 | continue; |
| 2476 | 2476 | } |
| 2477 | 2477 | |
| 2478 | - switch ( $type ) { |
|
| 2478 | + switch ($type) { |
|
| 2479 | 2479 | case 'all': |
| 2480 | 2480 | /* translators: 1: number of plugins. */ |
| 2481 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'tgmpa' ); |
|
| 2481 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins', 'tgmpa'); |
|
| 2482 | 2482 | break; |
| 2483 | 2483 | case 'install': |
| 2484 | 2484 | /* translators: 1: number of plugins. */ |
| 2485 | - $text = _n( 'To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'tgmpa' ); |
|
| 2485 | + $text = _n('To Install <span class="count">(%s)</span>', 'To Install <span class="count">(%s)</span>', $count, 'tgmpa'); |
|
| 2486 | 2486 | break; |
| 2487 | 2487 | case 'update': |
| 2488 | 2488 | /* translators: 1: number of plugins. */ |
| 2489 | - $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'tgmpa' ); |
|
| 2489 | + $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count, 'tgmpa'); |
|
| 2490 | 2490 | break; |
| 2491 | 2491 | case 'activate': |
| 2492 | 2492 | /* translators: 1: number of plugins. */ |
| 2493 | - $text = _n( 'To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'tgmpa' ); |
|
| 2493 | + $text = _n('To Activate <span class="count">(%s)</span>', 'To Activate <span class="count">(%s)</span>', $count, 'tgmpa'); |
|
| 2494 | 2494 | break; |
| 2495 | 2495 | default: |
| 2496 | 2496 | $text = ''; |
| 2497 | 2497 | break; |
| 2498 | 2498 | } |
| 2499 | 2499 | |
| 2500 | - if ( ! empty( $text ) ) { |
|
| 2500 | + if (!empty($text)) { |
|
| 2501 | 2501 | |
| 2502 | - $status_links[ $type ] = sprintf( |
|
| 2502 | + $status_links[$type] = sprintf( |
|
| 2503 | 2503 | '<a href="%s"%s>%s</a>', |
| 2504 | - esc_url( $this->tgmpa->get_tgmpa_status_url( $type ) ), |
|
| 2505 | - ( $type === $this->view_context ) ? ' class="current"' : '', |
|
| 2506 | - sprintf( $text, number_format_i18n( $count ) ) |
|
| 2504 | + esc_url($this->tgmpa->get_tgmpa_status_url($type)), |
|
| 2505 | + ($type === $this->view_context) ? ' class="current"' : '', |
|
| 2506 | + sprintf($text, number_format_i18n($count)) |
|
| 2507 | 2507 | ); |
| 2508 | 2508 | } |
| 2509 | 2509 | } |
@@ -2521,8 +2521,8 @@ discard block |
||
| 2521 | 2521 | * @param string $column_name The name of the column. |
| 2522 | 2522 | * @return string |
| 2523 | 2523 | */ |
| 2524 | - public function column_default( $item, $column_name ) { |
|
| 2525 | - return $item[ $column_name ]; |
|
| 2524 | + public function column_default($item, $column_name) { |
|
| 2525 | + return $item[$column_name]; |
|
| 2526 | 2526 | } |
| 2527 | 2527 | |
| 2528 | 2528 | /** |
@@ -2535,12 +2535,12 @@ discard block |
||
| 2535 | 2535 | * @param array $item Array of item data. |
| 2536 | 2536 | * @return string The input checkbox with all necessary info. |
| 2537 | 2537 | */ |
| 2538 | - public function column_cb( $item ) { |
|
| 2538 | + public function column_cb($item) { |
|
| 2539 | 2539 | return sprintf( |
| 2540 | 2540 | '<input type="checkbox" name="%1$s[]" value="%2$s" id="%3$s" />', |
| 2541 | - esc_attr( $this->_args['singular'] ), |
|
| 2542 | - esc_attr( $item['slug'] ), |
|
| 2543 | - esc_attr( $item['sanitized_plugin'] ) |
|
| 2541 | + esc_attr($this->_args['singular']), |
|
| 2542 | + esc_attr($item['slug']), |
|
| 2543 | + esc_attr($item['sanitized_plugin']) |
|
| 2544 | 2544 | ); |
| 2545 | 2545 | } |
| 2546 | 2546 | |
@@ -2552,11 +2552,11 @@ discard block |
||
| 2552 | 2552 | * @param array $item Array of item data. |
| 2553 | 2553 | * @return string The plugin name and action links. |
| 2554 | 2554 | */ |
| 2555 | - public function column_plugin( $item ) { |
|
| 2555 | + public function column_plugin($item) { |
|
| 2556 | 2556 | return sprintf( |
| 2557 | 2557 | '%1$s %2$s', |
| 2558 | 2558 | $item['plugin'], |
| 2559 | - $this->row_actions( $this->get_row_actions( $item ), true ) |
|
| 2559 | + $this->row_actions($this->get_row_actions($item), true) |
|
| 2560 | 2560 | ); |
| 2561 | 2561 | } |
| 2562 | 2562 | |
@@ -2568,48 +2568,48 @@ discard block |
||
| 2568 | 2568 | * @param array $item Array of item data. |
| 2569 | 2569 | * @return string HTML-formatted version information. |
| 2570 | 2570 | */ |
| 2571 | - public function column_version( $item ) { |
|
| 2571 | + public function column_version($item) { |
|
| 2572 | 2572 | $output = array(); |
| 2573 | 2573 | |
| 2574 | - if ( $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
| 2575 | - $installed = ! empty( $item['installed_version'] ) ? $item['installed_version'] : _x( 'unknown', 'as in: "version nr unknown"', 'tgmpa' ); |
|
| 2574 | + if ($this->tgmpa->is_plugin_installed($item['slug'])) { |
|
| 2575 | + $installed = !empty($item['installed_version']) ? $item['installed_version'] : _x('unknown', 'as in: "version nr unknown"', 'tgmpa'); |
|
| 2576 | 2576 | |
| 2577 | 2577 | $color = ''; |
| 2578 | - if ( ! empty( $item['minimum_version'] ) && $this->tgmpa->does_plugin_require_update( $item['slug'] ) ) { |
|
| 2578 | + if (!empty($item['minimum_version']) && $this->tgmpa->does_plugin_require_update($item['slug'])) { |
|
| 2579 | 2579 | $color = ' color: #ff0000; font-weight: bold;'; |
| 2580 | 2580 | } |
| 2581 | 2581 | |
| 2582 | 2582 | $output[] = sprintf( |
| 2583 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Installed version:', 'tgmpa' ) . '</p>', |
|
| 2583 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __('Installed version:', 'tgmpa') . '</p>', |
|
| 2584 | 2584 | $color, |
| 2585 | 2585 | $installed |
| 2586 | 2586 | ); |
| 2587 | 2587 | } |
| 2588 | 2588 | |
| 2589 | - if ( ! empty( $item['minimum_version'] ) ) { |
|
| 2589 | + if (!empty($item['minimum_version'])) { |
|
| 2590 | 2590 | $output[] = sprintf( |
| 2591 | - '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __( 'Minimum required version:', 'tgmpa' ) . '</p>', |
|
| 2591 | + '<p><span style="min-width: 32px; text-align: right; float: right;">%1$s</span>' . __('Minimum required version:', 'tgmpa') . '</p>', |
|
| 2592 | 2592 | $item['minimum_version'] |
| 2593 | 2593 | ); |
| 2594 | 2594 | } |
| 2595 | 2595 | |
| 2596 | - if ( ! empty( $item['available_version'] ) ) { |
|
| 2596 | + if (!empty($item['available_version'])) { |
|
| 2597 | 2597 | $color = ''; |
| 2598 | - if ( ! empty( $item['minimum_version'] ) && version_compare( $item['available_version'], $item['minimum_version'], '>=' ) ) { |
|
| 2598 | + if (!empty($item['minimum_version']) && version_compare($item['available_version'], $item['minimum_version'], '>=')) { |
|
| 2599 | 2599 | $color = ' color: #71C671; font-weight: bold;'; |
| 2600 | 2600 | } |
| 2601 | 2601 | |
| 2602 | 2602 | $output[] = sprintf( |
| 2603 | - '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __( 'Available version:', 'tgmpa' ) . '</p>', |
|
| 2603 | + '<p><span style="min-width: 32px; text-align: right; float: right;%1$s">%2$s</span>' . __('Available version:', 'tgmpa') . '</p>', |
|
| 2604 | 2604 | $color, |
| 2605 | 2605 | $item['available_version'] |
| 2606 | 2606 | ); |
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | - if ( empty( $output ) ) { |
|
| 2609 | + if (empty($output)) { |
|
| 2610 | 2610 | return ' '; // Let's not break the table layout. |
| 2611 | 2611 | } else { |
| 2612 | - return implode( "\n", $output ); |
|
| 2612 | + return implode("\n", $output); |
|
| 2613 | 2613 | } |
| 2614 | 2614 | } |
| 2615 | 2615 | |
@@ -2623,7 +2623,7 @@ discard block |
||
| 2623 | 2623 | * @since 2.2.0 |
| 2624 | 2624 | */ |
| 2625 | 2625 | public function no_items() { |
| 2626 | - echo esc_html__( 'No plugins to install, update or activate.', 'tgmpa' ) . ' <a href="' . esc_url( self_admin_url() ) . '"> ' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>'; |
|
| 2626 | + echo esc_html__('No plugins to install, update or activate.', 'tgmpa') . ' <a href="' . esc_url(self_admin_url()) . '"> ' . esc_html__('Return to the Dashboard', 'tgmpa') . '</a>'; |
|
| 2627 | 2627 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
| 2628 | 2628 | } |
| 2629 | 2629 | |
@@ -2637,17 +2637,17 @@ discard block |
||
| 2637 | 2637 | public function get_columns() { |
| 2638 | 2638 | $columns = array( |
| 2639 | 2639 | 'cb' => '<input type="checkbox" />', |
| 2640 | - 'plugin' => __( 'Plugin', 'tgmpa' ), |
|
| 2641 | - 'source' => __( 'Source', 'tgmpa' ), |
|
| 2642 | - 'type' => __( 'Type', 'tgmpa' ), |
|
| 2640 | + 'plugin' => __('Plugin', 'tgmpa'), |
|
| 2641 | + 'source' => __('Source', 'tgmpa'), |
|
| 2642 | + 'type' => __('Type', 'tgmpa'), |
|
| 2643 | 2643 | ); |
| 2644 | 2644 | |
| 2645 | - if ( 'all' === $this->view_context || 'update' === $this->view_context ) { |
|
| 2646 | - $columns['version'] = __( 'Version', 'tgmpa' ); |
|
| 2647 | - $columns['status'] = __( 'Status', 'tgmpa' ); |
|
| 2645 | + if ('all' === $this->view_context || 'update' === $this->view_context) { |
|
| 2646 | + $columns['version'] = __('Version', 'tgmpa'); |
|
| 2647 | + $columns['status'] = __('Status', 'tgmpa'); |
|
| 2648 | 2648 | } |
| 2649 | 2649 | |
| 2650 | - return apply_filters( 'tgmpa_table_columns', $columns ); |
|
| 2650 | + return apply_filters('tgmpa_table_columns', $columns); |
|
| 2651 | 2651 | } |
| 2652 | 2652 | |
| 2653 | 2653 | /** |
@@ -2671,7 +2671,7 @@ discard block |
||
| 2671 | 2671 | * @return string The name of the primary column. |
| 2672 | 2672 | */ |
| 2673 | 2673 | protected function get_primary_column_name() { |
| 2674 | - if ( method_exists( 'WP_List_Table', 'get_primary_column_name' ) ) { |
|
| 2674 | + if (method_exists('WP_List_Table', 'get_primary_column_name')) { |
|
| 2675 | 2675 | return parent::get_primary_column_name(); |
| 2676 | 2676 | } else { |
| 2677 | 2677 | return $this->get_default_primary_column_name(); |
@@ -2686,34 +2686,34 @@ discard block |
||
| 2686 | 2686 | * @param array $item Array of item data. |
| 2687 | 2687 | * @return array Array with relevant action links. |
| 2688 | 2688 | */ |
| 2689 | - protected function get_row_actions( $item ) { |
|
| 2689 | + protected function get_row_actions($item) { |
|
| 2690 | 2690 | $actions = array(); |
| 2691 | 2691 | $action_links = array(); |
| 2692 | 2692 | |
| 2693 | 2693 | // Display the 'Install' action link if the plugin is not yet available. |
| 2694 | - if ( ! $this->tgmpa->is_plugin_installed( $item['slug'] ) ) { |
|
| 2694 | + if (!$this->tgmpa->is_plugin_installed($item['slug'])) { |
|
| 2695 | 2695 | /* translators: %2$s: plugin name in screen reader markup */ |
| 2696 | - $actions['install'] = __( 'Install %2$s', 'tgmpa' ); |
|
| 2696 | + $actions['install'] = __('Install %2$s', 'tgmpa'); |
|
| 2697 | 2697 | } else { |
| 2698 | 2698 | // Display the 'Update' action link if an update is available and WP complies with plugin minimum. |
| 2699 | - if ( false !== $this->tgmpa->does_plugin_have_update( $item['slug'] ) && $this->tgmpa->can_plugin_update( $item['slug'] ) ) { |
|
| 2699 | + if (false !== $this->tgmpa->does_plugin_have_update($item['slug']) && $this->tgmpa->can_plugin_update($item['slug'])) { |
|
| 2700 | 2700 | /* translators: %2$s: plugin name in screen reader markup */ |
| 2701 | - $actions['update'] = __( 'Update %2$s', 'tgmpa' ); |
|
| 2701 | + $actions['update'] = __('Update %2$s', 'tgmpa'); |
|
| 2702 | 2702 | } |
| 2703 | 2703 | |
| 2704 | 2704 | // Display the 'Activate' action link, but only if the plugin meets the minimum version. |
| 2705 | - if ( $this->tgmpa->can_plugin_activate( $item['slug'] ) ) { |
|
| 2705 | + if ($this->tgmpa->can_plugin_activate($item['slug'])) { |
|
| 2706 | 2706 | /* translators: %2$s: plugin name in screen reader markup */ |
| 2707 | - $actions['activate'] = __( 'Activate %2$s', 'tgmpa' ); |
|
| 2707 | + $actions['activate'] = __('Activate %2$s', 'tgmpa'); |
|
| 2708 | 2708 | } |
| 2709 | 2709 | } |
| 2710 | 2710 | |
| 2711 | 2711 | // Create the actual links. |
| 2712 | - foreach ( $actions as $action => $text ) { |
|
| 2712 | + foreach ($actions as $action => $text) { |
|
| 2713 | 2713 | $nonce_url = wp_nonce_url( |
| 2714 | 2714 | add_query_arg( |
| 2715 | 2715 | array( |
| 2716 | - 'plugin' => urlencode( $item['slug'] ), |
|
| 2716 | + 'plugin' => urlencode($item['slug']), |
|
| 2717 | 2717 | 'tgmpa-' . $action => $action . '-plugin', |
| 2718 | 2718 | ), |
| 2719 | 2719 | $this->tgmpa->get_tgmpa_url() |
@@ -2722,15 +2722,15 @@ discard block |
||
| 2722 | 2722 | 'tgmpa-nonce' |
| 2723 | 2723 | ); |
| 2724 | 2724 | |
| 2725 | - $action_links[ $action ] = sprintf( |
|
| 2726 | - '<a href="%1$s">' . esc_html( $text ) . '</a>', // $text contains the second placeholder. |
|
| 2727 | - esc_url( $nonce_url ), |
|
| 2728 | - '<span class="screen-reader-text">' . esc_html( $item['sanitized_plugin'] ) . '</span>' |
|
| 2725 | + $action_links[$action] = sprintf( |
|
| 2726 | + '<a href="%1$s">' . esc_html($text) . '</a>', // $text contains the second placeholder. |
|
| 2727 | + esc_url($nonce_url), |
|
| 2728 | + '<span class="screen-reader-text">' . esc_html($item['sanitized_plugin']) . '</span>' |
|
| 2729 | 2729 | ); |
| 2730 | 2730 | } |
| 2731 | 2731 | |
| 2732 | - $prefix = ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) ? 'network_admin_' : ''; |
|
| 2733 | - return apply_filters( "tgmpa_{$prefix}plugin_action_links", array_filter( $action_links ), $item['slug'], $item, $this->view_context ); |
|
| 2732 | + $prefix = (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) ? 'network_admin_' : ''; |
|
| 2733 | + return apply_filters("tgmpa_{$prefix}plugin_action_links", array_filter($action_links), $item['slug'], $item, $this->view_context); |
|
| 2734 | 2734 | } |
| 2735 | 2735 | |
| 2736 | 2736 | /** |
@@ -2740,8 +2740,8 @@ discard block |
||
| 2740 | 2740 | * |
| 2741 | 2741 | * @param object $item The current item. |
| 2742 | 2742 | */ |
| 2743 | - public function single_row( $item ) { |
|
| 2744 | - parent::single_row( $item ); |
|
| 2743 | + public function single_row($item) { |
|
| 2744 | + parent::single_row($item); |
|
| 2745 | 2745 | |
| 2746 | 2746 | /** |
| 2747 | 2747 | * Fires after each specific row in the TGMPA Plugins list table. |
@@ -2751,7 +2751,7 @@ discard block |
||
| 2751 | 2751 | * |
| 2752 | 2752 | * @since 2.5.0 |
| 2753 | 2753 | */ |
| 2754 | - do_action( "tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context ); |
|
| 2754 | + do_action("tgmpa_after_plugin_row_{$item['slug']}", $item['slug'], $item, $this->view_context); |
|
| 2755 | 2755 | } |
| 2756 | 2756 | |
| 2757 | 2757 | /** |
@@ -2765,17 +2765,17 @@ discard block |
||
| 2765 | 2765 | * @param array $item The information available in this table row. |
| 2766 | 2766 | * @return null Return early if upgrade notice is empty. |
| 2767 | 2767 | */ |
| 2768 | - public function wp_plugin_update_row( $slug, $item ) { |
|
| 2769 | - if ( empty( $item['upgrade_notice'] ) ) { |
|
| 2768 | + public function wp_plugin_update_row($slug, $item) { |
|
| 2769 | + if (empty($item['upgrade_notice'])) { |
|
| 2770 | 2770 | return; |
| 2771 | 2771 | } |
| 2772 | 2772 | |
| 2773 | 2773 | echo ' |
| 2774 | 2774 | <tr class="plugin-update-tr"> |
| 2775 | - <td colspan="', absint( $this->get_column_count() ), '" class="plugin-update colspanchange"> |
|
| 2775 | + <td colspan="', absint($this->get_column_count()), '" class="plugin-update colspanchange"> |
|
| 2776 | 2776 | <div class="update-message">', |
| 2777 | - esc_html__( 'Upgrade message from the plugin author:', 'tgmpa' ), |
|
| 2778 | - ' <strong>', wp_kses_data( $item['upgrade_notice'] ), '</strong> |
|
| 2777 | + esc_html__('Upgrade message from the plugin author:', 'tgmpa'), |
|
| 2778 | + ' <strong>', wp_kses_data($item['upgrade_notice']), '</strong> |
|
| 2779 | 2779 | </div> |
| 2780 | 2780 | </td> |
| 2781 | 2781 | </tr>'; |
@@ -2788,8 +2788,8 @@ discard block |
||
| 2788 | 2788 | * |
| 2789 | 2789 | * @param string $which 'top' or 'bottom' table navigation. |
| 2790 | 2790 | */ |
| 2791 | - public function extra_tablenav( $which ) { |
|
| 2792 | - if ( 'bottom' === $which ) { |
|
| 2791 | + public function extra_tablenav($which) { |
|
| 2792 | + if ('bottom' === $which) { |
|
| 2793 | 2793 | $this->tgmpa->show_tgmpa_version(); |
| 2794 | 2794 | } |
| 2795 | 2795 | } |
@@ -2805,18 +2805,18 @@ discard block |
||
| 2805 | 2805 | |
| 2806 | 2806 | $actions = array(); |
| 2807 | 2807 | |
| 2808 | - if ( 'update' !== $this->view_context && 'activate' !== $this->view_context ) { |
|
| 2809 | - if ( current_user_can( 'install_plugins' ) ) { |
|
| 2810 | - $actions['tgmpa-bulk-install'] = __( 'Install', 'tgmpa' ); |
|
| 2808 | + if ('update' !== $this->view_context && 'activate' !== $this->view_context) { |
|
| 2809 | + if (current_user_can('install_plugins')) { |
|
| 2810 | + $actions['tgmpa-bulk-install'] = __('Install', 'tgmpa'); |
|
| 2811 | 2811 | } |
| 2812 | 2812 | } |
| 2813 | 2813 | |
| 2814 | - if ( 'install' !== $this->view_context ) { |
|
| 2815 | - if ( current_user_can( 'update_plugins' ) ) { |
|
| 2816 | - $actions['tgmpa-bulk-update'] = __( 'Update', 'tgmpa' ); |
|
| 2814 | + if ('install' !== $this->view_context) { |
|
| 2815 | + if (current_user_can('update_plugins')) { |
|
| 2816 | + $actions['tgmpa-bulk-update'] = __('Update', 'tgmpa'); |
|
| 2817 | 2817 | } |
| 2818 | - if ( current_user_can( 'activate_plugins' ) ) { |
|
| 2819 | - $actions['tgmpa-bulk-activate'] = __( 'Activate', 'tgmpa' ); |
|
| 2818 | + if (current_user_can('activate_plugins')) { |
|
| 2819 | + $actions['tgmpa-bulk-activate'] = __('Activate', 'tgmpa'); |
|
| 2820 | 2820 | } |
| 2821 | 2821 | } |
| 2822 | 2822 | |
@@ -2833,69 +2833,69 @@ discard block |
||
| 2833 | 2833 | */ |
| 2834 | 2834 | public function process_bulk_actions() { |
| 2835 | 2835 | // Bulk installation process. |
| 2836 | - if ( 'tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action() ) { |
|
| 2836 | + if ('tgmpa-bulk-install' === $this->current_action() || 'tgmpa-bulk-update' === $this->current_action()) { |
|
| 2837 | 2837 | |
| 2838 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
| 2838 | + check_admin_referer('bulk-' . $this->_args['plural']); |
|
| 2839 | 2839 | |
| 2840 | 2840 | $install_type = 'install'; |
| 2841 | - if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
|
| 2841 | + if ('tgmpa-bulk-update' === $this->current_action()) { |
|
| 2842 | 2842 | $install_type = 'update'; |
| 2843 | 2843 | } |
| 2844 | 2844 | |
| 2845 | 2845 | $plugins_to_install = array(); |
| 2846 | 2846 | |
| 2847 | 2847 | // Did user actually select any plugins to install/update ? |
| 2848 | - if ( empty( $_POST['plugin'] ) ) { |
|
| 2849 | - if ( 'install' === $install_type ) { |
|
| 2850 | - $message = __( 'No plugins were selected to be installed. No action taken.', 'tgmpa' ); |
|
| 2848 | + if (empty($_POST['plugin'])) { |
|
| 2849 | + if ('install' === $install_type) { |
|
| 2850 | + $message = __('No plugins were selected to be installed. No action taken.', 'tgmpa'); |
|
| 2851 | 2851 | } else { |
| 2852 | - $message = __( 'No plugins were selected to be updated. No action taken.', 'tgmpa' ); |
|
| 2852 | + $message = __('No plugins were selected to be updated. No action taken.', 'tgmpa'); |
|
| 2853 | 2853 | } |
| 2854 | 2854 | |
| 2855 | - echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>'; |
|
| 2855 | + echo '<div id="message" class="error"><p>', esc_html($message), '</p></div>'; |
|
| 2856 | 2856 | |
| 2857 | 2857 | return false; |
| 2858 | 2858 | } |
| 2859 | 2859 | |
| 2860 | - if ( is_array( $_POST['plugin'] ) ) { |
|
| 2860 | + if (is_array($_POST['plugin'])) { |
|
| 2861 | 2861 | $plugins_to_install = (array) $_POST['plugin']; |
| 2862 | - } elseif ( is_string( $_POST['plugin'] ) ) { |
|
| 2862 | + } elseif (is_string($_POST['plugin'])) { |
|
| 2863 | 2863 | // Received via Filesystem page - un-flatten array (WP bug #19643). |
| 2864 | - $plugins_to_install = explode( ',', $_POST['plugin'] ); |
|
| 2864 | + $plugins_to_install = explode(',', $_POST['plugin']); |
|
| 2865 | 2865 | } |
| 2866 | 2866 | |
| 2867 | 2867 | // Sanitize the received input. |
| 2868 | - $plugins_to_install = array_map( 'urldecode', $plugins_to_install ); |
|
| 2869 | - $plugins_to_install = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins_to_install ); |
|
| 2868 | + $plugins_to_install = array_map('urldecode', $plugins_to_install); |
|
| 2869 | + $plugins_to_install = array_map(array($this->tgmpa, 'sanitize_key'), $plugins_to_install); |
|
| 2870 | 2870 | |
| 2871 | 2871 | // Validate the received input. |
| 2872 | - foreach ( $plugins_to_install as $key => $slug ) { |
|
| 2872 | + foreach ($plugins_to_install as $key => $slug) { |
|
| 2873 | 2873 | // Check if the plugin was registered with TGMPA and remove if not. |
| 2874 | - if ( ! isset( $this->tgmpa->plugins[ $slug ] ) ) { |
|
| 2875 | - unset( $plugins_to_install[ $key ] ); |
|
| 2874 | + if (!isset($this->tgmpa->plugins[$slug])) { |
|
| 2875 | + unset($plugins_to_install[$key]); |
|
| 2876 | 2876 | continue; |
| 2877 | 2877 | } |
| 2878 | 2878 | |
| 2879 | 2879 | // For install: make sure this is a plugin we *can* install and not one already installed. |
| 2880 | - if ( 'install' === $install_type && true === $this->tgmpa->is_plugin_installed( $slug ) ) { |
|
| 2881 | - unset( $plugins_to_install[ $key ] ); |
|
| 2880 | + if ('install' === $install_type && true === $this->tgmpa->is_plugin_installed($slug)) { |
|
| 2881 | + unset($plugins_to_install[$key]); |
|
| 2882 | 2882 | } |
| 2883 | 2883 | |
| 2884 | 2884 | // For updates: make sure this is a plugin we *can* update (update available and WP version ok). |
| 2885 | - if ( 'update' === $install_type && false === $this->tgmpa->is_plugin_updatetable( $slug ) ) { |
|
| 2886 | - unset( $plugins_to_install[ $key ] ); |
|
| 2885 | + if ('update' === $install_type && false === $this->tgmpa->is_plugin_updatetable($slug)) { |
|
| 2886 | + unset($plugins_to_install[$key]); |
|
| 2887 | 2887 | } |
| 2888 | 2888 | } |
| 2889 | 2889 | |
| 2890 | 2890 | // No need to proceed further if we have no plugins to handle. |
| 2891 | - if ( empty( $plugins_to_install ) ) { |
|
| 2892 | - if ( 'install' === $install_type ) { |
|
| 2893 | - $message = __( 'No plugins are available to be installed at this time.', 'tgmpa' ); |
|
| 2891 | + if (empty($plugins_to_install)) { |
|
| 2892 | + if ('install' === $install_type) { |
|
| 2893 | + $message = __('No plugins are available to be installed at this time.', 'tgmpa'); |
|
| 2894 | 2894 | } else { |
| 2895 | - $message = __( 'No plugins are available to be updated at this time.', 'tgmpa' ); |
|
| 2895 | + $message = __('No plugins are available to be updated at this time.', 'tgmpa'); |
|
| 2896 | 2896 | } |
| 2897 | 2897 | |
| 2898 | - echo '<div id="message" class="error"><p>', esc_html( $message ), '</p></div>'; |
|
| 2898 | + echo '<div id="message" class="error"><p>', esc_html($message), '</p></div>'; |
|
| 2899 | 2899 | |
| 2900 | 2900 | return false; |
| 2901 | 2901 | } |
@@ -2907,19 +2907,19 @@ discard block |
||
| 2907 | 2907 | ); |
| 2908 | 2908 | |
| 2909 | 2909 | // Give validated data back to $_POST which is the only place the filesystem looks for extra fields. |
| 2910 | - $_POST['plugin'] = implode( ',', $plugins_to_install ); // Work around for WP bug #19643. |
|
| 2910 | + $_POST['plugin'] = implode(',', $plugins_to_install); // Work around for WP bug #19643. |
|
| 2911 | 2911 | |
| 2912 | 2912 | $method = ''; // Leave blank so WP_Filesystem can populate it as necessary. |
| 2913 | - $fields = array_keys( $_POST ); // Extra fields to pass to WP_Filesystem. |
|
| 2913 | + $fields = array_keys($_POST); // Extra fields to pass to WP_Filesystem. |
|
| 2914 | 2914 | |
| 2915 | - if ( false === ( $creds = request_filesystem_credentials( esc_url_raw( $url ), $method, false, false, $fields ) ) ) { |
|
| 2915 | + if (false === ($creds = request_filesystem_credentials(esc_url_raw($url), $method, false, false, $fields))) { |
|
| 2916 | 2916 | return true; // Stop the normal page form from displaying, credential request form will be shown. |
| 2917 | 2917 | } |
| 2918 | 2918 | |
| 2919 | 2919 | // Now we have some credentials, setup WP_Filesystem. |
| 2920 | - if ( ! WP_Filesystem( $creds ) ) { |
|
| 2920 | + if (!WP_Filesystem($creds)) { |
|
| 2921 | 2921 | // Our credentials were no good, ask the user for them again. |
| 2922 | - request_filesystem_credentials( esc_url_raw( $url ), $method, true, false, $fields ); |
|
| 2922 | + request_filesystem_credentials(esc_url_raw($url), $method, true, false, $fields); |
|
| 2923 | 2923 | |
| 2924 | 2924 | return true; |
| 2925 | 2925 | } |
@@ -2933,34 +2933,34 @@ discard block |
||
| 2933 | 2933 | $to_inject = array(); // Information to inject into the update_plugins transient. |
| 2934 | 2934 | |
| 2935 | 2935 | // Prepare the data for validated plugins for the install/upgrade. |
| 2936 | - foreach ( $plugins_to_install as $slug ) { |
|
| 2937 | - $name = $this->tgmpa->plugins[ $slug ]['name']; |
|
| 2938 | - $source = $this->tgmpa->get_download_url( $slug ); |
|
| 2936 | + foreach ($plugins_to_install as $slug) { |
|
| 2937 | + $name = $this->tgmpa->plugins[$slug]['name']; |
|
| 2938 | + $source = $this->tgmpa->get_download_url($slug); |
|
| 2939 | 2939 | |
| 2940 | - if ( ! empty( $name ) && ! empty( $source ) ) { |
|
| 2940 | + if (!empty($name) && !empty($source)) { |
|
| 2941 | 2941 | $names[] = $name; |
| 2942 | 2942 | |
| 2943 | - switch ( $install_type ) { |
|
| 2943 | + switch ($install_type) { |
|
| 2944 | 2944 | |
| 2945 | 2945 | case 'install': |
| 2946 | 2946 | $sources[] = $source; |
| 2947 | 2947 | break; |
| 2948 | 2948 | |
| 2949 | 2949 | case 'update': |
| 2950 | - $file_paths[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
| 2951 | - $to_inject[ $slug ] = $this->tgmpa->plugins[ $slug ]; |
|
| 2952 | - $to_inject[ $slug ]['source'] = $source; |
|
| 2950 | + $file_paths[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
| 2951 | + $to_inject[$slug] = $this->tgmpa->plugins[$slug]; |
|
| 2952 | + $to_inject[$slug]['source'] = $source; |
|
| 2953 | 2953 | break; |
| 2954 | 2954 | } |
| 2955 | 2955 | } |
| 2956 | 2956 | } |
| 2957 | - unset( $slug, $name, $source ); |
|
| 2957 | + unset($slug, $name, $source); |
|
| 2958 | 2958 | |
| 2959 | 2959 | // Create a new instance of TGMPA_Bulk_Installer. |
| 2960 | 2960 | $installer = new TGMPA_Bulk_Installer( |
| 2961 | 2961 | new TGMPA_Bulk_Installer_Skin( |
| 2962 | 2962 | array( |
| 2963 | - 'url' => esc_url_raw( $this->tgmpa->get_tgmpa_url() ), |
|
| 2963 | + 'url' => esc_url_raw($this->tgmpa->get_tgmpa_url()), |
|
| 2964 | 2964 | 'nonce' => 'bulk-' . $this->_args['plural'], |
| 2965 | 2965 | 'names' => $names, |
| 2966 | 2966 | 'install_type' => $install_type, |
@@ -2970,22 +2970,22 @@ discard block |
||
| 2970 | 2970 | |
| 2971 | 2971 | // Wrap the install process with the appropriate HTML. |
| 2972 | 2972 | echo '<div class="tgmpa">', |
| 2973 | - '<h2 style="font-size: 23px; font-weight: 400; line-height: 29px; margin: 0; padding: 9px 15px 4px 0;">', esc_html( get_admin_page_title() ), '</h2> |
|
| 2973 | + '<h2 style="font-size: 23px; font-weight: 400; line-height: 29px; margin: 0; padding: 9px 15px 4px 0;">', esc_html(get_admin_page_title()), '</h2> |
|
| 2974 | 2974 | <div class="update-php" style="width: 100%; height: 98%; min-height: 850px; padding-top: 1px;">'; |
| 2975 | 2975 | |
| 2976 | 2976 | // Process the bulk installation submissions. |
| 2977 | - add_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1, 3 ); |
|
| 2977 | + add_filter('upgrader_source_selection', array($this->tgmpa, 'maybe_adjust_source_dir'), 1, 3); |
|
| 2978 | 2978 | |
| 2979 | - if ( 'tgmpa-bulk-update' === $this->current_action() ) { |
|
| 2979 | + if ('tgmpa-bulk-update' === $this->current_action()) { |
|
| 2980 | 2980 | // Inject our info into the update transient. |
| 2981 | - $this->tgmpa->inject_update_info( $to_inject ); |
|
| 2981 | + $this->tgmpa->inject_update_info($to_inject); |
|
| 2982 | 2982 | |
| 2983 | - $installer->bulk_upgrade( $file_paths ); |
|
| 2983 | + $installer->bulk_upgrade($file_paths); |
|
| 2984 | 2984 | } else { |
| 2985 | - $installer->bulk_install( $sources ); |
|
| 2985 | + $installer->bulk_install($sources); |
|
| 2986 | 2986 | } |
| 2987 | 2987 | |
| 2988 | - remove_filter( 'upgrader_source_selection', array( $this->tgmpa, 'maybe_adjust_source_dir' ), 1 ); |
|
| 2988 | + remove_filter('upgrader_source_selection', array($this->tgmpa, 'maybe_adjust_source_dir'), 1); |
|
| 2989 | 2989 | |
| 2990 | 2990 | echo '</div></div>'; |
| 2991 | 2991 | |
@@ -2993,70 +2993,70 @@ discard block |
||
| 2993 | 2993 | } |
| 2994 | 2994 | |
| 2995 | 2995 | // Bulk activation process. |
| 2996 | - if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
|
| 2997 | - check_admin_referer( 'bulk-' . $this->_args['plural'] ); |
|
| 2996 | + if ('tgmpa-bulk-activate' === $this->current_action()) { |
|
| 2997 | + check_admin_referer('bulk-' . $this->_args['plural']); |
|
| 2998 | 2998 | |
| 2999 | 2999 | // Did user actually select any plugins to activate ? |
| 3000 | - if ( empty( $_POST['plugin'] ) ) { |
|
| 3001 | - echo '<div id="message" class="error"><p>', esc_html__( 'No plugins were selected to be activated. No action taken.', 'tgmpa' ), '</p></div>'; |
|
| 3000 | + if (empty($_POST['plugin'])) { |
|
| 3001 | + echo '<div id="message" class="error"><p>', esc_html__('No plugins were selected to be activated. No action taken.', 'tgmpa'), '</p></div>'; |
|
| 3002 | 3002 | |
| 3003 | 3003 | return false; |
| 3004 | 3004 | } |
| 3005 | 3005 | |
| 3006 | 3006 | // Grab plugin data from $_POST. |
| 3007 | 3007 | $plugins = array(); |
| 3008 | - if ( isset( $_POST['plugin'] ) ) { |
|
| 3009 | - $plugins = array_map( 'urldecode', (array) $_POST['plugin'] ); |
|
| 3010 | - $plugins = array_map( array( $this->tgmpa, 'sanitize_key' ), $plugins ); |
|
| 3008 | + if (isset($_POST['plugin'])) { |
|
| 3009 | + $plugins = array_map('urldecode', (array) $_POST['plugin']); |
|
| 3010 | + $plugins = array_map(array($this->tgmpa, 'sanitize_key'), $plugins); |
|
| 3011 | 3011 | } |
| 3012 | 3012 | |
| 3013 | 3013 | $plugins_to_activate = array(); |
| 3014 | 3014 | $plugin_names = array(); |
| 3015 | 3015 | |
| 3016 | 3016 | // Grab the file paths for the selected & inactive plugins from the registration array. |
| 3017 | - foreach ( $plugins as $slug ) { |
|
| 3018 | - if ( $this->tgmpa->can_plugin_activate( $slug ) ) { |
|
| 3019 | - $plugins_to_activate[] = $this->tgmpa->plugins[ $slug ]['file_path']; |
|
| 3020 | - $plugin_names[] = $this->tgmpa->plugins[ $slug ]['name']; |
|
| 3017 | + foreach ($plugins as $slug) { |
|
| 3018 | + if ($this->tgmpa->can_plugin_activate($slug)) { |
|
| 3019 | + $plugins_to_activate[] = $this->tgmpa->plugins[$slug]['file_path']; |
|
| 3020 | + $plugin_names[] = $this->tgmpa->plugins[$slug]['name']; |
|
| 3021 | 3021 | } |
| 3022 | 3022 | } |
| 3023 | - unset( $slug ); |
|
| 3023 | + unset($slug); |
|
| 3024 | 3024 | |
| 3025 | 3025 | // Return early if there are no plugins to activate. |
| 3026 | - if ( empty( $plugins_to_activate ) ) { |
|
| 3027 | - echo '<div id="message" class="error"><p>', esc_html__( 'No plugins are available to be activated at this time.', 'tgmpa' ), '</p></div>'; |
|
| 3026 | + if (empty($plugins_to_activate)) { |
|
| 3027 | + echo '<div id="message" class="error"><p>', esc_html__('No plugins are available to be activated at this time.', 'tgmpa'), '</p></div>'; |
|
| 3028 | 3028 | |
| 3029 | 3029 | return false; |
| 3030 | 3030 | } |
| 3031 | 3031 | |
| 3032 | 3032 | // Now we are good to go - let's start activating plugins. |
| 3033 | - $activate = activate_plugins( $plugins_to_activate ); |
|
| 3033 | + $activate = activate_plugins($plugins_to_activate); |
|
| 3034 | 3034 | |
| 3035 | - if ( is_wp_error( $activate ) ) { |
|
| 3036 | - echo '<div id="message" class="error"><p>', wp_kses_post( $activate->get_error_message() ), '</p></div>'; |
|
| 3035 | + if (is_wp_error($activate)) { |
|
| 3036 | + echo '<div id="message" class="error"><p>', wp_kses_post($activate->get_error_message()), '</p></div>'; |
|
| 3037 | 3037 | } else { |
| 3038 | - $count = count( $plugin_names ); // Count so we can use _n function. |
|
| 3039 | - $plugin_names = array_map( array( 'TGMPA_Utils', 'wrap_in_strong' ), $plugin_names ); |
|
| 3040 | - $last_plugin = array_pop( $plugin_names ); // Pop off last name to prep for readability. |
|
| 3041 | - $imploded = empty( $plugin_names ) ? $last_plugin : ( implode( ', ', $plugin_names ) . ' ' . esc_html_x( 'and', 'plugin A *and* plugin B', 'tgmpa' ) . ' ' . $last_plugin ); |
|
| 3038 | + $count = count($plugin_names); // Count so we can use _n function. |
|
| 3039 | + $plugin_names = array_map(array('TGMPA_Utils', 'wrap_in_strong'), $plugin_names); |
|
| 3040 | + $last_plugin = array_pop($plugin_names); // Pop off last name to prep for readability. |
|
| 3041 | + $imploded = empty($plugin_names) ? $last_plugin : (implode(', ', $plugin_names) . ' ' . esc_html_x('and', 'plugin A *and* plugin B', 'tgmpa') . ' ' . $last_plugin); |
|
| 3042 | 3042 | |
| 3043 | 3043 | printf( // WPCS: xss ok. |
| 3044 | 3044 | '<div id="message" class="updated"><p>%1$s %2$s.</p></div>', |
| 3045 | - esc_html( _n( 'The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'tgmpa' ) ), |
|
| 3045 | + esc_html(_n('The following plugin was activated successfully:', 'The following plugins were activated successfully:', $count, 'tgmpa')), |
|
| 3046 | 3046 | $imploded |
| 3047 | 3047 | ); |
| 3048 | 3048 | |
| 3049 | 3049 | // Update recently activated plugins option. |
| 3050 | - $recent = (array) get_option( 'recently_activated' ); |
|
| 3051 | - foreach ( $plugins_to_activate as $plugin => $time ) { |
|
| 3052 | - if ( isset( $recent[ $plugin ] ) ) { |
|
| 3053 | - unset( $recent[ $plugin ] ); |
|
| 3050 | + $recent = (array) get_option('recently_activated'); |
|
| 3051 | + foreach ($plugins_to_activate as $plugin => $time) { |
|
| 3052 | + if (isset($recent[$plugin])) { |
|
| 3053 | + unset($recent[$plugin]); |
|
| 3054 | 3054 | } |
| 3055 | 3055 | } |
| 3056 | - update_option( 'recently_activated', $recent ); |
|
| 3056 | + update_option('recently_activated', $recent); |
|
| 3057 | 3057 | } |
| 3058 | 3058 | |
| 3059 | - unset( $_POST ); // Reset the $_POST variable in case user wants to perform one action after another. |
|
| 3059 | + unset($_POST); // Reset the $_POST variable in case user wants to perform one action after another. |
|
| 3060 | 3060 | |
| 3061 | 3061 | return true; |
| 3062 | 3062 | } |
@@ -3074,15 +3074,15 @@ discard block |
||
| 3074 | 3074 | $hidden = array(); // No columns to hide, but we must set as an array. |
| 3075 | 3075 | $sortable = array(); // No reason to make sortable columns. |
| 3076 | 3076 | $primary = $this->get_primary_column_name(); // Column which has the row actions. |
| 3077 | - $this->_column_headers = array( $columns, $hidden, $sortable, $primary ); // Get all necessary column headers. |
|
| 3077 | + $this->_column_headers = array($columns, $hidden, $sortable, $primary); // Get all necessary column headers. |
|
| 3078 | 3078 | |
| 3079 | 3079 | // Process our bulk activations here. |
| 3080 | - if ( 'tgmpa-bulk-activate' === $this->current_action() ) { |
|
| 3080 | + if ('tgmpa-bulk-activate' === $this->current_action()) { |
|
| 3081 | 3081 | $this->process_bulk_actions(); |
| 3082 | 3082 | } |
| 3083 | 3083 | |
| 3084 | 3084 | // Store all of our plugin data into $items array so WP_List_Table can use it. |
| 3085 | - $this->items = apply_filters( 'tgmpa_table_data_items', $this->_gather_plugin_data() ); |
|
| 3085 | + $this->items = apply_filters('tgmpa_table_data_items', $this->_gather_plugin_data()); |
|
| 3086 | 3086 | } |
| 3087 | 3087 | |
| 3088 | 3088 | /* *********** DEPRECATED METHODS *********** */ |
@@ -3098,16 +3098,16 @@ discard block |
||
| 3098 | 3098 | * @param string $data Optional. Array key of plugin data to return. Default is slug. |
| 3099 | 3099 | * @return string|boolean Plugin slug if found, false otherwise. |
| 3100 | 3100 | */ |
| 3101 | - protected function _get_plugin_data_from_name( $name, $data = 'slug' ) { |
|
| 3102 | - _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()' ); |
|
| 3101 | + protected function _get_plugin_data_from_name($name, $data = 'slug') { |
|
| 3102 | + _deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'TGM_Plugin_Activation::_get_plugin_data_from_name()'); |
|
| 3103 | 3103 | |
| 3104 | - return $this->tgmpa->_get_plugin_data_from_name( $name, $data ); |
|
| 3104 | + return $this->tgmpa->_get_plugin_data_from_name($name, $data); |
|
| 3105 | 3105 | } |
| 3106 | 3106 | } |
| 3107 | 3107 | } |
| 3108 | 3108 | |
| 3109 | 3109 | |
| 3110 | -if ( ! class_exists( 'TGM_Bulk_Installer' ) ) { |
|
| 3110 | +if (!class_exists('TGM_Bulk_Installer')) { |
|
| 3111 | 3111 | |
| 3112 | 3112 | /** |
| 3113 | 3113 | * Hack: Prevent TGMPA v2.4.1- bulk installer class from being loaded if 2.4.1- is loaded after 2.5+. |
@@ -3120,7 +3120,7 @@ discard block |
||
| 3120 | 3120 | class TGM_Bulk_Installer { |
| 3121 | 3121 | } |
| 3122 | 3122 | } |
| 3123 | -if ( ! class_exists( 'TGM_Bulk_Installer_Skin' ) ) { |
|
| 3123 | +if (!class_exists('TGM_Bulk_Installer_Skin')) { |
|
| 3124 | 3124 | |
| 3125 | 3125 | /** |
| 3126 | 3126 | * Hack: Prevent TGMPA v2.4.1- bulk installer skin class from being loaded if 2.4.1- is loaded after 2.5+. |
@@ -3144,26 +3144,26 @@ discard block |
||
| 3144 | 3144 | * |
| 3145 | 3145 | * @since 2.2.0 |
| 3146 | 3146 | */ |
| 3147 | -add_action( 'admin_init', 'tgmpa_load_bulk_installer' ); |
|
| 3148 | -if ( ! function_exists( 'tgmpa_load_bulk_installer' ) ) { |
|
| 3147 | +add_action('admin_init', 'tgmpa_load_bulk_installer'); |
|
| 3148 | +if (!function_exists('tgmpa_load_bulk_installer')) { |
|
| 3149 | 3149 | /** |
| 3150 | 3150 | * Load bulk installer |
| 3151 | 3151 | */ |
| 3152 | 3152 | function tgmpa_load_bulk_installer() { |
| 3153 | 3153 | // Silently fail if 2.5+ is loaded *after* an older version. |
| 3154 | - if ( ! isset( $GLOBALS['tgmpa'] ) ) { |
|
| 3154 | + if (!isset($GLOBALS['tgmpa'])) { |
|
| 3155 | 3155 | return; |
| 3156 | 3156 | } |
| 3157 | 3157 | |
| 3158 | 3158 | // Get TGMPA class instance. |
| 3159 | - $tgmpa_instance = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 3159 | + $tgmpa_instance = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance')); |
|
| 3160 | 3160 | |
| 3161 | - if ( isset( $_GET['page'] ) && $tgmpa_instance->menu === $_GET['page'] ) { |
|
| 3162 | - if ( ! class_exists( 'Plugin_Upgrader', false ) ) { |
|
| 3161 | + if (isset($_GET['page']) && $tgmpa_instance->menu === $_GET['page']) { |
|
| 3162 | + if (!class_exists('Plugin_Upgrader', false)) { |
|
| 3163 | 3163 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 3164 | 3164 | } |
| 3165 | 3165 | |
| 3166 | - if ( ! class_exists( 'TGMPA_Bulk_Installer' ) ) { |
|
| 3166 | + if (!class_exists('TGMPA_Bulk_Installer')) { |
|
| 3167 | 3167 | |
| 3168 | 3168 | /** |
| 3169 | 3169 | * Installer class to handle bulk plugin installations. |
@@ -3225,21 +3225,21 @@ discard block |
||
| 3225 | 3225 | * |
| 3226 | 3226 | * @param \Bulk_Upgrader_Skin|null $skin Installer skin. |
| 3227 | 3227 | */ |
| 3228 | - public function __construct( $skin = null ) { |
|
| 3228 | + public function __construct($skin = null) { |
|
| 3229 | 3229 | // Get TGMPA class instance. |
| 3230 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 3230 | + $this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance')); |
|
| 3231 | 3231 | |
| 3232 | - parent::__construct( $skin ); |
|
| 3232 | + parent::__construct($skin); |
|
| 3233 | 3233 | |
| 3234 | - if ( isset( $this->skin->options['install_type'] ) && 'update' === $this->skin->options['install_type'] ) { |
|
| 3234 | + if (isset($this->skin->options['install_type']) && 'update' === $this->skin->options['install_type']) { |
|
| 3235 | 3235 | $this->clear_destination = true; |
| 3236 | 3236 | } |
| 3237 | 3237 | |
| 3238 | - if ( $this->tgmpa->is_automatic ) { |
|
| 3238 | + if ($this->tgmpa->is_automatic) { |
|
| 3239 | 3239 | $this->activate_strings(); |
| 3240 | 3240 | } |
| 3241 | 3241 | |
| 3242 | - add_action( 'upgrader_process_complete', array( $this->tgmpa, 'populate_file_path' ) ); |
|
| 3242 | + add_action('upgrader_process_complete', array($this->tgmpa, 'populate_file_path')); |
|
| 3243 | 3243 | } |
| 3244 | 3244 | |
| 3245 | 3245 | /** |
@@ -3248,8 +3248,8 @@ discard block |
||
| 3248 | 3248 | * @since 2.2.0 |
| 3249 | 3249 | */ |
| 3250 | 3250 | public function activate_strings() { |
| 3251 | - $this->strings['activation_failed'] = __( 'Plugin activation failed.', 'tgmpa' ); |
|
| 3252 | - $this->strings['activation_success'] = __( 'Plugin activated successfully.', 'tgmpa' ); |
|
| 3251 | + $this->strings['activation_failed'] = __('Plugin activation failed.', 'tgmpa'); |
|
| 3252 | + $this->strings['activation_success'] = __('Plugin activated successfully.', 'tgmpa'); |
|
| 3253 | 3253 | } |
| 3254 | 3254 | |
| 3255 | 3255 | /** |
@@ -3262,12 +3262,12 @@ discard block |
||
| 3262 | 3262 | * @param array $options The installation config options. |
| 3263 | 3263 | * @return null|array Return early if error, array of installation data on success. |
| 3264 | 3264 | */ |
| 3265 | - public function run( $options ) { |
|
| 3266 | - $result = parent::run( $options ); |
|
| 3265 | + public function run($options) { |
|
| 3266 | + $result = parent::run($options); |
|
| 3267 | 3267 | |
| 3268 | 3268 | // Reset the strings in case we changed one during automatic activation. |
| 3269 | - if ( $this->tgmpa->is_automatic ) { |
|
| 3270 | - if ( 'update' === $this->skin->options['install_type'] ) { |
|
| 3269 | + if ($this->tgmpa->is_automatic) { |
|
| 3270 | + if ('update' === $this->skin->options['install_type']) { |
|
| 3271 | 3271 | $this->upgrade_strings(); |
| 3272 | 3272 | } else { |
| 3273 | 3273 | $this->install_strings(); |
@@ -3296,14 +3296,14 @@ discard block |
||
| 3296 | 3296 | * @param array $args Arbitrary passed extra arguments. |
| 3297 | 3297 | * @return array|false Install confirmation messages on success, false on failure. |
| 3298 | 3298 | */ |
| 3299 | - public function bulk_install( $plugins, $args = array() ) { |
|
| 3299 | + public function bulk_install($plugins, $args = array()) { |
|
| 3300 | 3300 | // [TGMPA + ] Hook auto-activation in. |
| 3301 | - add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
| 3301 | + add_filter('upgrader_post_install', array($this, 'auto_activate'), 10); |
|
| 3302 | 3302 | |
| 3303 | 3303 | $defaults = array( |
| 3304 | 3304 | 'clear_update_cache' => true, |
| 3305 | 3305 | ); |
| 3306 | - $parsed_args = wp_parse_args( $args, $defaults ); |
|
| 3306 | + $parsed_args = wp_parse_args($args, $defaults); |
|
| 3307 | 3307 | |
| 3308 | 3308 | $this->init(); |
| 3309 | 3309 | $this->bulk = true; |
@@ -3317,8 +3317,8 @@ discard block |
||
| 3317 | 3317 | $this->skin->header(); |
| 3318 | 3318 | |
| 3319 | 3319 | // Connect to the Filesystem first. |
| 3320 | - $res = $this->fs_connect( array( WP_CONTENT_DIR, WP_PLUGIN_DIR ) ); |
|
| 3321 | - if ( ! $res ) { |
|
| 3320 | + $res = $this->fs_connect(array(WP_CONTENT_DIR, WP_PLUGIN_DIR)); |
|
| 3321 | + if (!$res) { |
|
| 3322 | 3322 | $this->skin->footer(); |
| 3323 | 3323 | return false; |
| 3324 | 3324 | } |
@@ -3331,22 +3331,22 @@ discard block |
||
| 3331 | 3331 | * - a plugin with an update available is currently active. |
| 3332 | 3332 | * @TODO: For multisite, maintenance mode should only kick in for individual sites if at all possible. |
| 3333 | 3333 | */ |
| 3334 | - $maintenance = ( is_multisite() && ! empty( $plugins ) ); |
|
| 3334 | + $maintenance = (is_multisite() && !empty($plugins)); |
|
| 3335 | 3335 | |
| 3336 | 3336 | /* |
| 3337 | 3337 | [TGMPA - ] |
| 3338 | 3338 | foreach ( $plugins as $plugin ) |
| 3339 | 3339 | $maintenance = $maintenance || ( is_plugin_active( $plugin ) && isset( $current->response[ $plugin] ) ); |
| 3340 | 3340 | */ |
| 3341 | - if ( $maintenance ) { |
|
| 3342 | - $this->maintenance_mode( true ); |
|
| 3341 | + if ($maintenance) { |
|
| 3342 | + $this->maintenance_mode(true); |
|
| 3343 | 3343 | } |
| 3344 | 3344 | |
| 3345 | 3345 | $results = array(); |
| 3346 | 3346 | |
| 3347 | - $this->update_count = count( $plugins ); |
|
| 3347 | + $this->update_count = count($plugins); |
|
| 3348 | 3348 | $this->update_current = 0; |
| 3349 | - foreach ( $plugins as $plugin ) { |
|
| 3349 | + foreach ($plugins as $plugin) { |
|
| 3350 | 3350 | $this->update_current++; |
| 3351 | 3351 | |
| 3352 | 3352 | /* |
@@ -3381,15 +3381,15 @@ discard block |
||
| 3381 | 3381 | ) |
| 3382 | 3382 | ); |
| 3383 | 3383 | |
| 3384 | - $results[ $plugin ] = $this->result; |
|
| 3384 | + $results[$plugin] = $this->result; |
|
| 3385 | 3385 | |
| 3386 | 3386 | // Prevent credentials auth screen from displaying multiple times. |
| 3387 | - if ( false === $result ) { |
|
| 3387 | + if (false === $result) { |
|
| 3388 | 3388 | break; |
| 3389 | 3389 | } |
| 3390 | 3390 | } //end foreach $plugins |
| 3391 | 3391 | |
| 3392 | - $this->maintenance_mode( false ); |
|
| 3392 | + $this->maintenance_mode(false); |
|
| 3393 | 3393 | |
| 3394 | 3394 | /** |
| 3395 | 3395 | * Fires when the bulk upgrader process is complete. |
@@ -3407,12 +3407,12 @@ discard block |
||
| 3407 | 3407 | * @type array $packages Array of plugin, theme, or core packages to update. |
| 3408 | 3408 | * } |
| 3409 | 3409 | */ |
| 3410 | - do_action( 'upgrader_process_complete', $this, array( |
|
| 3410 | + do_action('upgrader_process_complete', $this, array( |
|
| 3411 | 3411 | 'action' => 'install', // [TGMPA + ] adjusted. |
| 3412 | 3412 | 'type' => 'plugin', |
| 3413 | 3413 | 'bulk' => true, |
| 3414 | 3414 | 'plugins' => $plugins, |
| 3415 | - ) ); |
|
| 3415 | + )); |
|
| 3416 | 3416 | |
| 3417 | 3417 | $this->skin->bulk_footer(); |
| 3418 | 3418 | |
@@ -3422,10 +3422,10 @@ discard block |
||
| 3422 | 3422 | /* [TGMPA - ] remove_filter('upgrader_clear_destination', array($this, 'delete_old_plugin')); */ |
| 3423 | 3423 | |
| 3424 | 3424 | // [TGMPA + ] Remove our auto-activation hook. |
| 3425 | - remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
| 3425 | + remove_filter('upgrader_post_install', array($this, 'auto_activate'), 10); |
|
| 3426 | 3426 | |
| 3427 | 3427 | // Force refresh of plugin update information. |
| 3428 | - wp_clean_plugins_cache( $parsed_args['clear_update_cache'] ); |
|
| 3428 | + wp_clean_plugins_cache($parsed_args['clear_update_cache']); |
|
| 3429 | 3429 | |
| 3430 | 3430 | return $results; |
| 3431 | 3431 | } |
@@ -3441,13 +3441,13 @@ discard block |
||
| 3441 | 3441 | * @param array $args Arbitrary passed extra arguments. |
| 3442 | 3442 | * @return string|bool Install confirmation messages on success, false on failure. |
| 3443 | 3443 | */ |
| 3444 | - public function bulk_upgrade( $plugins, $args = array() ) { |
|
| 3444 | + public function bulk_upgrade($plugins, $args = array()) { |
|
| 3445 | 3445 | |
| 3446 | - add_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
| 3446 | + add_filter('upgrader_post_install', array($this, 'auto_activate'), 10); |
|
| 3447 | 3447 | |
| 3448 | - $result = parent::bulk_upgrade( $plugins, $args ); |
|
| 3448 | + $result = parent::bulk_upgrade($plugins, $args); |
|
| 3449 | 3449 | |
| 3450 | - remove_filter( 'upgrader_post_install', array( $this, 'auto_activate' ), 10 ); |
|
| 3450 | + remove_filter('upgrader_post_install', array($this, 'auto_activate'), 10); |
|
| 3451 | 3451 | |
| 3452 | 3452 | return $result; |
| 3453 | 3453 | } |
@@ -3462,9 +3462,9 @@ discard block |
||
| 3462 | 3462 | * @param bool $bool The value we need to give back (true). |
| 3463 | 3463 | * @return bool |
| 3464 | 3464 | */ |
| 3465 | - public function auto_activate( $bool ) { |
|
| 3465 | + public function auto_activate($bool) { |
|
| 3466 | 3466 | // Only process the activation of installed plugins if the automatic flag is set to true. |
| 3467 | - if ( $this->tgmpa->is_automatic ) { |
|
| 3467 | + if ($this->tgmpa->is_automatic) { |
|
| 3468 | 3468 | // Flush plugins cache so the headers of the newly installed plugins will be read correctly. |
| 3469 | 3469 | wp_clean_plugins_cache(); |
| 3470 | 3470 | |
@@ -3472,14 +3472,14 @@ discard block |
||
| 3472 | 3472 | $plugin_info = $this->plugin_info(); |
| 3473 | 3473 | |
| 3474 | 3474 | // Don't try to activate on upgrade of active plugin as WP will do this already. |
| 3475 | - if ( ! is_plugin_active( $plugin_info ) ) { |
|
| 3476 | - $activate = activate_plugin( $plugin_info ); |
|
| 3475 | + if (!is_plugin_active($plugin_info)) { |
|
| 3476 | + $activate = activate_plugin($plugin_info); |
|
| 3477 | 3477 | |
| 3478 | 3478 | // Adjust the success string based on the activation result. |
| 3479 | 3479 | $this->strings['process_success'] = $this->strings['process_success'] . "<br />\n"; |
| 3480 | 3480 | |
| 3481 | - if ( is_wp_error( $activate ) ) { |
|
| 3482 | - $this->skin->error( $activate ); |
|
| 3481 | + if (is_wp_error($activate)) { |
|
| 3482 | + $this->skin->error($activate); |
|
| 3483 | 3483 | $this->strings['process_success'] .= $this->strings['activation_failed']; |
| 3484 | 3484 | } else { |
| 3485 | 3485 | $this->strings['process_success'] .= $this->strings['activation_success']; |
@@ -3492,7 +3492,7 @@ discard block |
||
| 3492 | 3492 | } |
| 3493 | 3493 | } |
| 3494 | 3494 | |
| 3495 | - if ( ! class_exists( 'TGMPA_Bulk_Installer_Skin' ) ) { |
|
| 3495 | + if (!class_exists('TGMPA_Bulk_Installer_Skin')) { |
|
| 3496 | 3496 | |
| 3497 | 3497 | /** |
| 3498 | 3498 | * Installer skin to set strings for the bulk plugin installations.. |
@@ -3556,9 +3556,9 @@ discard block |
||
| 3556 | 3556 | * |
| 3557 | 3557 | * @param array $args Arguments to pass for use within the class. |
| 3558 | 3558 | */ |
| 3559 | - public function __construct( $args = array() ) { |
|
| 3559 | + public function __construct($args = array()) { |
|
| 3560 | 3560 | // Get TGMPA class instance. |
| 3561 | - $this->tgmpa = call_user_func( array( get_class( $GLOBALS['tgmpa'] ), 'get_instance' ) ); |
|
| 3561 | + $this->tgmpa = call_user_func(array(get_class($GLOBALS['tgmpa']), 'get_instance')); |
|
| 3562 | 3562 | |
| 3563 | 3563 | // Parse default and new args. |
| 3564 | 3564 | $defaults = array( |
@@ -3567,13 +3567,13 @@ discard block |
||
| 3567 | 3567 | 'names' => array(), |
| 3568 | 3568 | 'install_type' => 'install', |
| 3569 | 3569 | ); |
| 3570 | - $args = wp_parse_args( $args, $defaults ); |
|
| 3570 | + $args = wp_parse_args($args, $defaults); |
|
| 3571 | 3571 | |
| 3572 | 3572 | // Set plugin names to $this->plugin_names property. |
| 3573 | 3573 | $this->plugin_names = $args['names']; |
| 3574 | 3574 | |
| 3575 | 3575 | // Extract the new args. |
| 3576 | - parent::__construct( $args ); |
|
| 3576 | + parent::__construct($args); |
|
| 3577 | 3577 | } |
| 3578 | 3578 | |
| 3579 | 3579 | /** |
@@ -3585,32 +3585,32 @@ discard block |
||
| 3585 | 3585 | * @since 2.2.0 |
| 3586 | 3586 | */ |
| 3587 | 3587 | public function add_strings() { |
| 3588 | - if ( 'update' === $this->options['install_type'] ) { |
|
| 3588 | + if ('update' === $this->options['install_type']) { |
|
| 3589 | 3589 | parent::add_strings(); |
| 3590 | 3590 | /* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
| 3591 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3591 | + $this->upgrader->strings['skin_before_update_header'] = __('Updating Plugin %1$s (%2$d/%3$d)', 'tgmpa'); |
|
| 3592 | 3592 | } else { |
| 3593 | 3593 | /* translators: 1: plugin name, 2: error message. */ |
| 3594 | - $this->upgrader->strings['skin_update_failed_error'] = __( 'An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa' ); |
|
| 3594 | + $this->upgrader->strings['skin_update_failed_error'] = __('An error occurred while installing %1$s: <strong>%2$s</strong>.', 'tgmpa'); |
|
| 3595 | 3595 | /* translators: 1: plugin name. */ |
| 3596 | - $this->upgrader->strings['skin_update_failed'] = __( 'The installation of %1$s failed.', 'tgmpa' ); |
|
| 3596 | + $this->upgrader->strings['skin_update_failed'] = __('The installation of %1$s failed.', 'tgmpa'); |
|
| 3597 | 3597 | |
| 3598 | - if ( $this->tgmpa->is_automatic ) { |
|
| 3598 | + if ($this->tgmpa->is_automatic) { |
|
| 3599 | 3599 | // Automatic activation strings. |
| 3600 | - $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
| 3600 | + $this->upgrader->strings['skin_upgrade_start'] = __('The installation and activation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa'); |
|
| 3601 | 3601 | /* translators: 1: plugin name. */ |
| 3602 | - $this->upgrader->strings['skin_update_successful'] = __( '%1$s installed and activated successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>'; |
|
| 3603 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations and activations have been completed.', 'tgmpa' ); |
|
| 3602 | + $this->upgrader->strings['skin_update_successful'] = __('%1$s installed and activated successfully.', 'tgmpa') . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__('Show Details', 'tgmpa') . '</span><span class="hidden">' . esc_html__('Hide Details', 'tgmpa') . '</span>.</a>'; |
|
| 3603 | + $this->upgrader->strings['skin_upgrade_end'] = __('All installations and activations have been completed.', 'tgmpa'); |
|
| 3604 | 3604 | /* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
| 3605 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3605 | + $this->upgrader->strings['skin_before_update_header'] = __('Installing and Activating Plugin %1$s (%2$d/%3$d)', 'tgmpa'); |
|
| 3606 | 3606 | } else { |
| 3607 | 3607 | // Default installation strings. |
| 3608 | - $this->upgrader->strings['skin_upgrade_start'] = __( 'The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa' ); |
|
| 3608 | + $this->upgrader->strings['skin_upgrade_start'] = __('The installation process is starting. This process may take a while on some hosts, so please be patient.', 'tgmpa'); |
|
| 3609 | 3609 | /* translators: 1: plugin name. */ |
| 3610 | - $this->upgrader->strings['skin_update_successful'] = esc_html__( '%1$s installed successfully.', 'tgmpa' ) . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__( 'Show Details', 'tgmpa' ) . '</span><span class="hidden">' . esc_html__( 'Hide Details', 'tgmpa' ) . '</span>.</a>'; |
|
| 3611 | - $this->upgrader->strings['skin_upgrade_end'] = __( 'All installations have been completed.', 'tgmpa' ); |
|
| 3610 | + $this->upgrader->strings['skin_update_successful'] = esc_html__('%1$s installed successfully.', 'tgmpa') . ' <a href="#" class="hide-if-no-js" onclick="%2$s"><span>' . esc_html__('Show Details', 'tgmpa') . '</span><span class="hidden">' . esc_html__('Hide Details', 'tgmpa') . '</span>.</a>'; |
|
| 3611 | + $this->upgrader->strings['skin_upgrade_end'] = __('All installations have been completed.', 'tgmpa'); |
|
| 3612 | 3612 | /* translators: 1: plugin name, 2: action number 3: total number of actions. */ |
| 3613 | - $this->upgrader->strings['skin_before_update_header'] = __( 'Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa' ); |
|
| 3613 | + $this->upgrader->strings['skin_before_update_header'] = __('Installing Plugin %1$s (%2$d/%3$d)', 'tgmpa'); |
|
| 3614 | 3614 | } |
| 3615 | 3615 | } |
| 3616 | 3616 | } |
@@ -3622,11 +3622,11 @@ discard block |
||
| 3622 | 3622 | * |
| 3623 | 3623 | * @param string $title Unused in this implementation. |
| 3624 | 3624 | */ |
| 3625 | - public function before( $title = '' ) { |
|
| 3626 | - if ( empty( $title ) ) { |
|
| 3627 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
| 3625 | + public function before($title = '') { |
|
| 3626 | + if (empty($title)) { |
|
| 3627 | + $title = esc_html($this->plugin_names[$this->i]); |
|
| 3628 | 3628 | } |
| 3629 | - parent::before( $title ); |
|
| 3629 | + parent::before($title); |
|
| 3630 | 3630 | } |
| 3631 | 3631 | |
| 3632 | 3632 | /** |
@@ -3639,11 +3639,11 @@ discard block |
||
| 3639 | 3639 | * |
| 3640 | 3640 | * @param string $title Unused in this implementation. |
| 3641 | 3641 | */ |
| 3642 | - public function after( $title = '' ) { |
|
| 3643 | - if ( empty( $title ) ) { |
|
| 3644 | - $title = esc_html( $this->plugin_names[ $this->i ] ); |
|
| 3642 | + public function after($title = '') { |
|
| 3643 | + if (empty($title)) { |
|
| 3644 | + $title = esc_html($this->plugin_names[$this->i]); |
|
| 3645 | 3645 | } |
| 3646 | - parent::after( $title ); |
|
| 3646 | + parent::after($title); |
|
| 3647 | 3647 | |
| 3648 | 3648 | $this->i++; |
| 3649 | 3649 | } |
@@ -3665,15 +3665,15 @@ discard block |
||
| 3665 | 3665 | // Display message based on if all plugins are now active or not. |
| 3666 | 3666 | $update_actions = array(); |
| 3667 | 3667 | |
| 3668 | - if ( $this->tgmpa->is_tgmpa_complete() ) { |
|
| 3668 | + if ($this->tgmpa->is_tgmpa_complete()) { |
|
| 3669 | 3669 | // All plugins are active, so we display the complete string and hide the menu to protect users. |
| 3670 | 3670 | echo '<style type="text/css">#adminmenu .wp-submenu li.current { display: none !important; }</style>'; |
| 3671 | 3671 | $update_actions['dashboard'] = sprintf( |
| 3672 | - esc_html( $this->tgmpa->strings['complete'] ), |
|
| 3673 | - '<a href="' . esc_url( self_admin_url() ) . '">' . esc_html__( 'Return to the Dashboard', 'tgmpa' ) . '</a>' |
|
| 3672 | + esc_html($this->tgmpa->strings['complete']), |
|
| 3673 | + '<a href="' . esc_url(self_admin_url()) . '">' . esc_html__('Return to the Dashboard', 'tgmpa') . '</a>' |
|
| 3674 | 3674 | ); |
| 3675 | 3675 | } else { |
| 3676 | - $update_actions['tgmpa_page'] = '<a href="' . esc_url( $this->tgmpa->get_tgmpa_url() ) . '" target="_parent">' . esc_html( $this->tgmpa->strings['return'] ) . '</a>'; |
|
| 3676 | + $update_actions['tgmpa_page'] = '<a href="' . esc_url($this->tgmpa->get_tgmpa_url()) . '" target="_parent">' . esc_html($this->tgmpa->strings['return']) . '</a>'; |
|
| 3677 | 3677 | } |
| 3678 | 3678 | |
| 3679 | 3679 | /** |
@@ -3684,10 +3684,10 @@ discard block |
||
| 3684 | 3684 | * @param array $update_actions Array of plugin action links. |
| 3685 | 3685 | * @param array $plugin_info Array of information for the last-handled plugin. |
| 3686 | 3686 | */ |
| 3687 | - $update_actions = apply_filters( 'tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info ); |
|
| 3687 | + $update_actions = apply_filters('tgmpa_update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info); |
|
| 3688 | 3688 | |
| 3689 | - if ( ! empty( $update_actions ) ) { |
|
| 3690 | - $this->feedback( implode( ' | ', (array) $update_actions ) ); |
|
| 3689 | + if (!empty($update_actions)) { |
|
| 3690 | + $this->feedback(implode(' | ', (array) $update_actions)); |
|
| 3691 | 3691 | } |
| 3692 | 3692 | } |
| 3693 | 3693 | |
@@ -3701,7 +3701,7 @@ discard block |
||
| 3701 | 3701 | * @see Bulk_Upgrader_Skin::flush_output() |
| 3702 | 3702 | */ |
| 3703 | 3703 | public function before_flush_output() { |
| 3704 | - _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' ); |
|
| 3704 | + _deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()'); |
|
| 3705 | 3705 | $this->flush_output(); |
| 3706 | 3706 | } |
| 3707 | 3707 | |
@@ -3714,7 +3714,7 @@ discard block |
||
| 3714 | 3714 | * @see Bulk_Upgrader_Skin::flush_output() |
| 3715 | 3715 | */ |
| 3716 | 3716 | public function after_flush_output() { |
| 3717 | - _deprecated_function( __FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()' ); |
|
| 3717 | + _deprecated_function(__FUNCTION__, 'TGMPA 2.5.0', 'Bulk_Upgrader_Skin::flush_output()'); |
|
| 3718 | 3718 | $this->flush_output(); |
| 3719 | 3719 | $this->i++; |
| 3720 | 3720 | } |
@@ -3724,7 +3724,7 @@ discard block |
||
| 3724 | 3724 | } |
| 3725 | 3725 | } |
| 3726 | 3726 | |
| 3727 | -if ( ! class_exists( 'TGMPA_Utils' ) ) { |
|
| 3727 | +if (!class_exists('TGMPA_Utils')) { |
|
| 3728 | 3728 | |
| 3729 | 3729 | /** |
| 3730 | 3730 | * Generic utilities for TGMPA. |
@@ -3762,8 +3762,8 @@ discard block |
||
| 3762 | 3762 | * @param string $string Text to be wrapped. |
| 3763 | 3763 | * @return string |
| 3764 | 3764 | */ |
| 3765 | - public static function wrap_in_em( $string ) { |
|
| 3766 | - return '<em>' . wp_kses_post( $string ) . '</em>'; |
|
| 3765 | + public static function wrap_in_em($string) { |
|
| 3766 | + return '<em>' . wp_kses_post($string) . '</em>'; |
|
| 3767 | 3767 | } |
| 3768 | 3768 | |
| 3769 | 3769 | /** |
@@ -3776,8 +3776,8 @@ discard block |
||
| 3776 | 3776 | * @param string $string Text to be wrapped. |
| 3777 | 3777 | * @return string |
| 3778 | 3778 | */ |
| 3779 | - public static function wrap_in_strong( $string ) { |
|
| 3780 | - return '<strong>' . wp_kses_post( $string ) . '</strong>'; |
|
| 3779 | + public static function wrap_in_strong($string) { |
|
| 3780 | + return '<strong>' . wp_kses_post($string) . '</strong>'; |
|
| 3781 | 3781 | } |
| 3782 | 3782 | |
| 3783 | 3783 | /** |
@@ -3790,15 +3790,15 @@ discard block |
||
| 3790 | 3790 | * @param mixed $value Arbitrary value. |
| 3791 | 3791 | * @return bool |
| 3792 | 3792 | */ |
| 3793 | - public static function validate_bool( $value ) { |
|
| 3794 | - if ( ! isset( self::$has_filters ) ) { |
|
| 3795 | - self::$has_filters = extension_loaded( 'filter' ); |
|
| 3793 | + public static function validate_bool($value) { |
|
| 3794 | + if (!isset(self::$has_filters)) { |
|
| 3795 | + self::$has_filters = extension_loaded('filter'); |
|
| 3796 | 3796 | } |
| 3797 | 3797 | |
| 3798 | - if ( self::$has_filters ) { |
|
| 3799 | - return filter_var( $value, FILTER_VALIDATE_BOOLEAN ); |
|
| 3798 | + if (self::$has_filters) { |
|
| 3799 | + return filter_var($value, FILTER_VALIDATE_BOOLEAN); |
|
| 3800 | 3800 | } else { |
| 3801 | - return self::emulate_filter_bool( $value ); |
|
| 3801 | + return self::emulate_filter_bool($value); |
|
| 3802 | 3802 | } |
| 3803 | 3803 | } |
| 3804 | 3804 | |
@@ -3812,9 +3812,9 @@ discard block |
||
| 3812 | 3812 | * @param mixed $value Value to cast. |
| 3813 | 3813 | * @return bool |
| 3814 | 3814 | */ |
| 3815 | - protected static function emulate_filter_bool( $value ) { |
|
| 3815 | + protected static function emulate_filter_bool($value) { |
|
| 3816 | 3816 | // @codingStandardsIgnoreStart |
| 3817 | - static $true = array( |
|
| 3817 | + static $true = array( |
|
| 3818 | 3818 | '1', |
| 3819 | 3819 | 'true', 'True', 'TRUE', |
| 3820 | 3820 | 'y', 'Y', |
@@ -3830,17 +3830,17 @@ discard block |
||
| 3830 | 3830 | ); |
| 3831 | 3831 | // @codingStandardsIgnoreEnd |
| 3832 | 3832 | |
| 3833 | - if ( is_bool( $value ) ) { |
|
| 3833 | + if (is_bool($value)) { |
|
| 3834 | 3834 | return $value; |
| 3835 | - } elseif ( is_int( $value ) && ( 0 === $value || 1 === $value ) ) { |
|
| 3835 | + } elseif (is_int($value) && (0 === $value || 1 === $value)) { |
|
| 3836 | 3836 | return (bool) $value; |
| 3837 | - } elseif ( ( is_float( $value ) && ! is_nan( $value ) ) && ( (float) 0 === $value || (float) 1 === $value ) ) { |
|
| 3837 | + } elseif ((is_float($value) && !is_nan($value)) && ((float) 0 === $value || (float) 1 === $value)) { |
|
| 3838 | 3838 | return (bool) $value; |
| 3839 | - } elseif ( is_string( $value ) ) { |
|
| 3840 | - $value = trim( $value ); |
|
| 3841 | - if ( in_array( $value, $true, true ) ) { |
|
| 3839 | + } elseif (is_string($value)) { |
|
| 3840 | + $value = trim($value); |
|
| 3841 | + if (in_array($value, $true, true)) { |
|
| 3842 | 3842 | return true; |
| 3843 | - } elseif ( in_array( $value, $false, true ) ) { |
|
| 3843 | + } elseif (in_array($value, $false, true)) { |
|
| 3844 | 3844 | return false; |
| 3845 | 3845 | } else { |
| 3846 | 3846 | return false; |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once(BRIGHTY_CORE_PLUGIN_DIR .'/templates/woocommerce/my-account-top-menu.php'); |
|
| 3 | +require_once(BRIGHTY_CORE_PLUGIN_DIR . '/templates/woocommerce/my-account-top-menu.php'); |
|
| 4 | 4 | |
| 5 | -$user = wp_get_current_user() ; |
|
| 5 | +$user = wp_get_current_user(); |
|
| 6 | 6 | ?> |
| 7 | 7 | <!-- ***logout from everywhere |
| 8 | 8 | ***2factor authentication |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | * @version 3.5.0 |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | -defined( 'ABSPATH' ) || exit; |
|
| 29 | +defined('ABSPATH') || exit; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | -$sessions = WP_Session_Tokens::get_instance( get_current_user_id() ); |
|
| 32 | +$sessions = WP_Session_Tokens::get_instance(get_current_user_id()); |
|
| 33 | 33 | |
| 34 | 34 | ?> |
| 35 | 35 | |
@@ -64,37 +64,37 @@ discard block |
||
| 64 | 64 | <div class="col-6"> |
| 65 | 65 | <div class="card shadow"> |
| 66 | 66 | <div class="card-body"> |
| 67 | - <?php if ( count( $sessions->get_all() ) === 1 ) : ?> |
|
| 67 | + <?php if (count($sessions->get_all()) === 1) : ?> |
|
| 68 | 68 | <tr class="user-sessions-wrap hide-if-no-js"> |
| 69 | - <h2 class="h5 mb-4"><?php _e( 'Sessions' ); ?></h2> |
|
| 69 | + <h2 class="h5 mb-4"><?php _e('Sessions'); ?></h2> |
|
| 70 | 70 | <td aria-live="assertive"> |
| 71 | 71 | <p class="description"> |
| 72 | - <?php _e( 'You are logged in only at this location. If you forget to logout elsewhere in future, You can use button below to log out everywhere else.' ); ?> |
|
| 72 | + <?php _e('You are logged in only at this location. If you forget to logout elsewhere in future, You can use button below to log out everywhere else.'); ?> |
|
| 73 | 73 | </p> |
| 74 | - <div class="destroy-sessions"><button type="button" disabled class="button btn btn-outline-primary <?php if($_GET['cleared']){ echo "btn-outline-success"; } ?> "><?php if($_GET['cleared']){ echo "You have been logged out everywhere else"; } else { _e( 'Log Out Everywhere Else' ); } ?></button></div> |
|
| 74 | + <div class="destroy-sessions"><button type="button" disabled class="button btn btn-outline-primary <?php if ($_GET['cleared']) { echo "btn-outline-success"; } ?> "><?php if ($_GET['cleared']) { echo "You have been logged out everywhere else"; } else { _e('Log Out Everywhere Else'); } ?></button></div> |
|
| 75 | 75 | |
| 76 | 76 | </td> |
| 77 | 77 | </tr> |
| 78 | - <?php elseif ( count( $sessions->get_all() ) > 1 ) : ?> |
|
| 78 | + <?php elseif (count($sessions->get_all()) > 1) : ?> |
|
| 79 | 79 | <tr class="user-sessions-wrap hide-if-no-js"> |
| 80 | - <h2 class="h5 mb-4"><?php _e( 'Sessions' ); ?></h2> |
|
| 80 | + <h2 class="h5 mb-4"><?php _e('Sessions'); ?></h2> |
|
| 81 | 81 | <td aria-live="assertive"> |
| 82 | 82 | <p class="description"> |
| 83 | - <?php _e( 'Did you lose your phone or leave your account logged in at a public computer? You can log out everywhere else, and stay logged in here.' ); ?> |
|
| 83 | + <?php _e('Did you lose your phone or leave your account logged in at a public computer? You can log out everywhere else, and stay logged in here.'); ?> |
|
| 84 | 84 | </p> |
| 85 | - <div class="destroy-sessions"><a href="/wp-admin/admin-ajax.php?action=brighty_logout_everywhere_else"><button type="button" class="btn btn-primary" id="destroy-sessions"><?php _e( 'Log Out Everywhere Else' ); ?></button></a></div> |
|
| 85 | + <div class="destroy-sessions"><a href="/wp-admin/admin-ajax.php?action=brighty_logout_everywhere_else"><button type="button" class="btn btn-primary" id="destroy-sessions"><?php _e('Log Out Everywhere Else'); ?></button></a></div> |
|
| 86 | 86 | |
| 87 | 87 | </td> |
| 88 | 88 | </tr> |
| 89 | - <?php elseif ( $sessions->get_all() ) : ?> |
|
| 89 | + <?php elseif ($sessions->get_all()) : ?> |
|
| 90 | 90 | <tr class="user-sessions-wrap hide-if-no-js"> |
| 91 | - <th><?php _e( 'Sessions' ); ?></th> |
|
| 91 | + <th><?php _e('Sessions'); ?></th> |
|
| 92 | 92 | <td> |
| 93 | - <p><button type="button" class="button" id="destroy-sessions"><?php if($_GET['cleared']){ echo "You have been logged our everywhere else"; } else { _e( 'Log Out Everywhere' );} ?></button></p> |
|
| 93 | + <p><button type="button" class="button" id="destroy-sessions"><?php if ($_GET['cleared']) { echo "You have been logged our everywhere else"; } else { _e('Log Out Everywhere'); } ?></button></p> |
|
| 94 | 94 | <p class="description"> |
| 95 | 95 | <?php |
| 96 | 96 | /* translators: %s: User's display name. */ |
| 97 | - printf( __( 'Log %s out of all locations.' ), $profile_user->display_name ); |
|
| 97 | + printf(__('Log %s out of all locations.'), $profile_user->display_name); |
|
| 98 | 98 | ?> |
| 99 | 99 | </p> |
| 100 | 100 | </td> |
@@ -120,47 +120,47 @@ discard block |
||
| 120 | 120 | <div id="collapseTwo" class="accordion-collapse collapse " aria-labelledby="headingOne" data-bs-parent="#accordionExample"> |
| 121 | 121 | <div class="accordion-body"> |
| 122 | 122 | |
| 123 | - <form class="woocommerce-EditAccountForm edit-account card" action="" method="post" <?php do_action( 'woocommerce_edit_account_form_tag' ); ?> > |
|
| 123 | + <form class="woocommerce-EditAccountForm edit-account card" action="" method="post" <?php do_action('woocommerce_edit_account_form_tag'); ?> > |
|
| 124 | 124 | |
| 125 | - <?php do_action( 'woocommerce_edit_account_form_start' ); ?> |
|
| 125 | + <?php do_action('woocommerce_edit_account_form_start'); ?> |
|
| 126 | 126 | |
| 127 | 127 | <div class="card-body"> |
| 128 | 128 | <fieldset > |
| 129 | - <h2 class="h5 mb-4"><?php esc_html_e( 'Password change', 'woocommerce' ); ?></h2> |
|
| 129 | + <h2 class="h5 mb-4"><?php esc_html_e('Password change', 'woocommerce'); ?></h2> |
|
| 130 | 130 | |
| 131 | 131 | <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide description"> |
| 132 | - <label for="password_current"><?php esc_html_e( 'Current password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> |
|
| 132 | + <label for="password_current"><?php esc_html_e('Current password (leave blank to leave unchanged)', 'woocommerce'); ?></label> |
|
| 133 | 133 | <input type="password" class="woocommerce-Input woocommerce-Input--password form-control" name="password_current" id="password_current" autocomplete="off" /> |
| 134 | 134 | </p> |
| 135 | 135 | <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide description mt-3"> |
| 136 | - <label for="password_1"><?php esc_html_e( 'New password (leave blank to leave unchanged)', 'woocommerce' ); ?></label> |
|
| 136 | + <label for="password_1"><?php esc_html_e('New password (leave blank to leave unchanged)', 'woocommerce'); ?></label> |
|
| 137 | 137 | <input type="password" class="woocommerce-Input woocommerce-Input--password form-control" name="password_1" id="password_1" autocomplete="off" /> |
| 138 | 138 | </p> |
| 139 | 139 | <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide description mt-3"> |
| 140 | - <label for="password_2"><?php esc_html_e( 'Confirm new password', 'woocommerce' ); ?></label> |
|
| 140 | + <label for="password_2"><?php esc_html_e('Confirm new password', 'woocommerce'); ?></label> |
|
| 141 | 141 | <input type="password" class="woocommerce-Input woocommerce-Input--password form-control" name="password_2" id="password_2" autocomplete="off" /> |
| 142 | 142 | </p> |
| 143 | 143 | </fieldset> |
| 144 | 144 | |
| 145 | 145 | <div class="clear"></div> |
| 146 | 146 | |
| 147 | - <?php do_action( 'woocommerce_edit_account_form' ); ?> |
|
| 147 | + <?php do_action('woocommerce_edit_account_form'); ?> |
|
| 148 | 148 | |
| 149 | 149 | <p> |
| 150 | - <?php wp_nonce_field( 'save_account_details', 'save-account-details-nonce' ); ?> |
|
| 151 | - <button class="btn btn-primary btn-sm mt-3" name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>"><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button> |
|
| 152 | - <input type="hidden" name="account_first_name" value="<?php echo esc_attr( $user->first_name ); ?>" /> |
|
| 153 | - <input type="hidden" name="account_last_name" value="<?php echo esc_attr( $user->last_name ); ?>" /> |
|
| 154 | - <input type="hidden" name="account_display_name" value="<?php echo esc_attr( $user->display_name) ; ?>" /> |
|
| 155 | - <input type="hidden" name="account_email" value="<?php echo esc_attr( $user->user_email ); ?>" /> |
|
| 150 | + <?php wp_nonce_field('save_account_details', 'save-account-details-nonce'); ?> |
|
| 151 | + <button class="btn btn-primary btn-sm mt-3" name="save_account_details" value="<?php esc_attr_e('Save changes', 'woocommerce'); ?>"><?php esc_html_e('Save changes', 'woocommerce'); ?></button> |
|
| 152 | + <input type="hidden" name="account_first_name" value="<?php echo esc_attr($user->first_name); ?>" /> |
|
| 153 | + <input type="hidden" name="account_last_name" value="<?php echo esc_attr($user->last_name); ?>" /> |
|
| 154 | + <input type="hidden" name="account_display_name" value="<?php echo esc_attr($user->display_name); ?>" /> |
|
| 155 | + <input type="hidden" name="account_email" value="<?php echo esc_attr($user->user_email); ?>" /> |
|
| 156 | 156 | <input type="hidden" name="action" value="save_account_details" /> |
| 157 | 157 | </p> |
| 158 | 158 | |
| 159 | - <?php do_action( 'woocommerce_edit_account_form_end' ); ?> |
|
| 159 | + <?php do_action('woocommerce_edit_account_form_end'); ?> |
|
| 160 | 160 | </div> |
| 161 | 161 | </form> |
| 162 | 162 | |
| 163 | -<?php do_action( 'woocommerce_after_edit_account_form' ); ?> |
|
| 163 | +<?php do_action('woocommerce_after_edit_account_form'); ?> |
|
| 164 | 164 | |
| 165 | 165 | |
| 166 | 166 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | |
| 177 | 177 | |
| 178 | -<?php do_action( 'woocommerce_after_edit_account_form' ); ?> |
|
| 178 | +<?php do_action('woocommerce_after_edit_account_form'); ?> |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once(BRIGHTY_CORE_PLUGIN_DIR .'/templates/woocommerce/my-account-top-menu.php'); |
|
| 3 | +require_once(BRIGHTY_CORE_PLUGIN_DIR . '/templates/woocommerce/my-account-top-menu.php'); |
|
| 4 | 4 | |
| 5 | 5 | ?> |
| 6 | 6 | <div class="row"> |
@@ -8,24 +8,24 @@ discard block |
||
| 8 | 8 | <?php |
| 9 | 9 | $default = [ |
| 10 | 10 | [ |
| 11 | - 'document-name' => esc_html__( 'ID Card', 'brighty-core' ), |
|
| 11 | + 'document-name' => esc_html__('ID Card', 'brighty-core'), |
|
| 12 | 12 | 'document-description' => 'JPG, GIF or PNG. Max size of 800K', |
| 13 | 13 | 'document-id' =>'idcard', |
| 14 | 14 | 'file-type' => '.png,.jpg,.jpeg,.pdf,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document' |
| 15 | 15 | ], |
| 16 | 16 | [ |
| 17 | - 'document-name' => esc_html__( 'Address Proof', 'brighty-core' ), |
|
| 17 | + 'document-name' => esc_html__('Address Proof', 'brighty-core'), |
|
| 18 | 18 | 'document-description' => 'JPG, GIF or PNG. Max size of 800K', |
| 19 | 19 | 'document-id' => 'addressproof', |
| 20 | 20 | 'file-type' => '.png,.jpg,.jpeg,.pdf,.doc,.doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document' |
| 21 | 21 | ] |
| 22 | 22 | ]; |
| 23 | -$documents = get_theme_mod( 'documents_required',$default); |
|
| 23 | +$documents = get_theme_mod('documents_required', $default); |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | -foreach($documents as $document) { |
|
| 28 | +foreach ($documents as $document) { |
|
| 29 | 29 | ?> |
| 30 | 30 | |
| 31 | 31 | <div class="col-6"> |
@@ -44,17 +44,17 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <?php |
| 46 | 46 | |
| 47 | - $file_url = get_user_meta(get_current_user_id(),$document['document-id'],true); |
|
| 47 | + $file_url = get_user_meta(get_current_user_id(), $document['document-id'], true); |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - if($file_url){ |
|
| 50 | + if ($file_url) { |
|
| 51 | 51 | |
| 52 | 52 | $name_array = explode('.', $file_url); |
| 53 | 53 | |
| 54 | 54 | $ext = strtolower(end($name_array)); |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - if($ext =='png' || $ext =='PNG' || $ext =='jpg' || $ext =='JPG' || $ext =='jpeg' || $ext =='JPEG' ){ |
|
| 57 | + if ($ext == 'png' || $ext == 'PNG' || $ext == 'jpg' || $ext == 'JPG' || $ext == 'jpeg' || $ext == 'JPEG') { |
|
| 58 | 58 | |
| 59 | 59 | ?> |
| 60 | 60 | <div class="me-3"> <img class="rounded avatar-xl" style="max-height:50px" src="<?php |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once(BRIGHTY_CORE_PLUGIN_DIR .'/templates/woocommerce/my-account-top-menu.php'); |
|
| 3 | +require_once(BRIGHTY_CORE_PLUGIN_DIR . '/templates/woocommerce/my-account-top-menu.php'); |
|
| 4 | 4 | |
| 5 | 5 | ?> |
| 6 | 6 | <div class="row"> |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | ), |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | - $clients = get_posts( $args ); |
|
| 33 | + $clients = get_posts($args); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | <?php |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - foreach($clients as $client){ |
|
| 48 | + foreach ($clients as $client) { |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | $billing = get_client_billing_address($client->ID); |
@@ -66,26 +66,26 @@ discard block |
||
| 66 | 66 | <div class="card-body text-center"> |
| 67 | 67 | <img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-chat/ava3.webp" alt="avatar" |
| 68 | 68 | class="rounded-circle img-fluid" style="width: 150px;"> |
| 69 | - <h5 class="my-3"><?php echo $client->post_title."<br />(CRN: ".$client->ID.")"; ?></h5> |
|
| 69 | + <h5 class="my-3"><?php echo $client->post_title . "<br />(CRN: " . $client->ID . ")"; ?></h5> |
|
| 70 | 70 | <p class="text-muted mb-1"><?php |
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | |
| 74 | -$admin_list = get_post_meta($client->ID,'contacts'); |
|
| 74 | +$admin_list = get_post_meta($client->ID, 'contacts'); |
|
| 75 | 75 | $is_admin = 0; |
| 76 | -foreach($admin_list as $admin){ |
|
| 77 | - if($admin == get_current_user_ID()) |
|
| 76 | +foreach ($admin_list as $admin) { |
|
| 77 | + if ($admin == get_current_user_ID()) |
|
| 78 | 78 | { |
| 79 | 79 | echo " <span class='badge bg-success mr-2'>Admin</span>"; |
| 80 | - $is_admin =1; |
|
| 80 | + $is_admin = 1; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | -if(!$is_admin){ |
|
| 85 | - $permissions_list = get_post_meta($client->ID,'permissions',true); |
|
| 86 | - foreach($permissions_list as $permission){ |
|
| 87 | - if($permission['user'] == get_current_user_ID()){ |
|
| 88 | - foreach($permission['allowed_permissions'] as $feature){ |
|
| 84 | +if (!$is_admin) { |
|
| 85 | + $permissions_list = get_post_meta($client->ID, 'permissions', true); |
|
| 86 | + foreach ($permissions_list as $permission) { |
|
| 87 | + if ($permission['user'] == get_current_user_ID()) { |
|
| 88 | + foreach ($permission['allowed_permissions'] as $feature) { |
|
| 89 | 89 | echo " <span class='badge bg-info mr-2'>$feature</span>"; |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | ?></p> |
| 96 | - <p class="text-muted mb-4"><?php echo $billing['city']." ".$billing['state']." ".$billing['country']." ".$billing['postcode']; ?></p> |
|
| 96 | + <p class="text-muted mb-4"><?php echo $billing['city'] . " " . $billing['state'] . " " . $billing['country'] . " " . $billing['postcode']; ?></p> |
|
| 97 | 97 | <div class="d-flex justify-content-center mb-2"> |
| 98 | 98 | <button type="button" class="btn btn-primary"><i class="fa fa-edit"></i> Edit</button> |
| 99 | - <button onclick="leave_company(<?php echo $client->ID; ?>)" type="button" class="btn btn-danger ms-1">Leave</button> |
|
| 99 | + <button onclick="leave_company(<?php echo $client->ID; ?>)" type="button" class="btn btn-danger ms-1">Leave</button> |
|
| 100 | 100 | |
| 101 | 101 | </div> |
| 102 | 102 | </div> |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | <p class="mb-0">Address</p> |
| 219 | 219 | </div> |
| 220 | 220 | <div class="col-sm-9"> |
| 221 | - <p class="text-muted mb-0"><?php echo $billing['address_1']." ".$billing['city']." ".$billing['state']." ".$billing['country']." ".$billing['postcode']; ?></p> |
|
| 221 | + <p class="text-muted mb-0"><?php echo $billing['address_1'] . " " . $billing['city'] . " " . $billing['state'] . " " . $billing['country'] . " " . $billing['postcode']; ?></p> |
|
| 222 | 222 | </div> |
| 223 | 223 | </div> |
| 224 | 224 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | <p class="mb-0">Address</p> |
| 263 | 263 | </div> |
| 264 | 264 | <div class="col-sm-9"> |
| 265 | - <p class="text-muted mb-0"><?php echo $shipping['address_1']." ".$shipping['city']." ".$shipping['state']." ".$shipping['country']." ".$shipping['postcode']; ?></p> |
|
| 265 | + <p class="text-muted mb-0"><?php echo $shipping['address_1'] . " " . $shipping['city'] . " " . $shipping['state'] . " " . $shipping['country'] . " " . $shipping['postcode']; ?></p> |
|
| 266 | 266 | </div> |
| 267 | 267 | </div> |
| 268 | 268 | </div> |
@@ -281,11 +281,11 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | <?php |
| 283 | 283 | |
| 284 | - $admins = get_post_meta($client->ID,'contacts'); |
|
| 284 | + $admins = get_post_meta($client->ID, 'contacts'); |
|
| 285 | 285 | |
| 286 | - foreach($admins as $admin){ |
|
| 286 | + foreach ($admins as $admin) { |
|
| 287 | 287 | |
| 288 | - $admin_user = get_user_by("ID",$admin); |
|
| 288 | + $admin_user = get_user_by("ID", $admin); |
|
| 289 | 289 | |
| 290 | 290 | |
| 291 | 291 | ?> |
@@ -307,8 +307,8 @@ discard block |
||
| 307 | 307 | </div> |
| 308 | 308 | </div> |
| 309 | 309 | <div class="col text-end"> |
| 310 | - <?php if(get_current_user_ID()!=$admin_user->ID){ ?> |
|
| 311 | - <button onclick="remove_user_from_client(<?php echo $admin_user->ID.",".$client->ID; ?>)" class="btn btn-sm btn-outline-warning d-inline-flex align-items-center"> |
|
| 310 | + <?php if (get_current_user_ID() != $admin_user->ID) { ?> |
|
| 311 | + <button onclick="remove_user_from_client(<?php echo $admin_user->ID . "," . $client->ID; ?>)" class="btn btn-sm btn-outline-warning d-inline-flex align-items-center"> |
|
| 312 | 312 | <svg class="icon icon-xxs me-2" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> |
| 313 | 313 | <path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path> |
| 314 | 314 | </svg> Remove </button> |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | <?php |
| 324 | 324 | |
| 325 | - $access = get_post_meta($client->ID,'access'); |
|
| 325 | + $access = get_post_meta($client->ID, 'access'); |
|
| 326 | 326 | |
| 327 | 327 | |
| 328 | - foreach($access as $accessible) { |
|
| 328 | + foreach ($access as $accessible) { |
|
| 329 | 329 | |
| 330 | - $permissions_list = get_post_meta($client->ID,'permissions',true); |
|
| 330 | + $permissions_list = get_post_meta($client->ID, 'permissions', true); |
|
| 331 | 331 | |
| 332 | 332 | |
| 333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | |
| 337 | 337 | |
| 338 | - $access_user = get_user_by("ID",$accessible,true); |
|
| 338 | + $access_user = get_user_by("ID", $accessible, true); |
|
| 339 | 339 | |
| 340 | 340 | ?> |
| 341 | 341 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | <div class="col-auto ms--2"> |
| 352 | 352 | <h4 class="h6 mb-0"> |
| 353 | - <a href="#"><?php echo $access_user->display_name." <span class='badge bg-secondary text-primary'><i class='fa fa-envelope-o'></i> ".$access_user->user_email."</span>"; ?></a> |
|
| 353 | + <a href="#"><?php echo $access_user->display_name . " <span class='badge bg-secondary text-primary'><i class='fa fa-envelope-o'></i> " . $access_user->user_email . "</span>"; ?></a> |
|
| 354 | 354 | </h4> |
| 355 | 355 | |
| 356 | 356 | <div class="d-flex align-items-center"> |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | |
| 363 | 363 | |
| 364 | - foreach($permissions_list as $permission){ |
|
| 365 | - if($permission['user'] == $accessible){ |
|
| 366 | - foreach($permission['allowed_permissions'] as $feature){ |
|
| 364 | + foreach ($permissions_list as $permission) { |
|
| 365 | + if ($permission['user'] == $accessible) { |
|
| 366 | + foreach ($permission['allowed_permissions'] as $feature) { |
|
| 367 | 367 | echo " <div class='bg-info dot rounded-circle me-1'></div> |
| 368 | 368 | <small>$feature</small>"; |
| 369 | 369 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | |
| 382 | 382 | <div class="col text-end"> |
| 383 | - <button onclick="remove_user_from_client(<?php echo $access_user->ID.",".$client->ID; ?>)" class="btn btn-sm btn-outline-secondary d-inline-flex align-items-center"> |
|
| 383 | + <button onclick="remove_user_from_client(<?php echo $access_user->ID . "," . $client->ID; ?>)" class="btn btn-sm btn-outline-secondary d-inline-flex align-items-center"> |
|
| 384 | 384 | <i class="fa fa-times"></i> |
| 385 | 385 | Remove </button> |
| 386 | 386 | </div> |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | <td> |
| 419 | 419 | <a href="#" class="d-flex align-items-center"> |
| 420 | 420 | <div class="d-block"> |
| 421 | - <div class="small text-gray"><?php $billing = get_post_meta($client->ID,'details',true); print_r($billing['email']); ?></div> |
|
| 421 | + <div class="small text-gray"><?php $billing = get_post_meta($client->ID, 'details', true); print_r($billing['email']); ?></div> |
|
| 422 | 422 | </div> |
| 423 | 423 | </a> |
| 424 | 424 | </td> |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | </tr> |
| 436 | 436 | <?php } |
| 437 | 437 | |
| 438 | - if(!$clients){ |
|
| 438 | + if (!$clients) { |
|
| 439 | 439 | ?> |
| 440 | 440 | |
| 441 | 441 | <tr> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once(BRIGHTY_CORE_PLUGIN_DIR .'/templates/woocommerce/my-account-top-menu.php'); |
|
| 3 | +require_once(BRIGHTY_CORE_PLUGIN_DIR . '/templates/woocommerce/my-account-top-menu.php'); |
|
| 4 | 4 | |
| 5 | 5 | ?> |
| 6 | 6 | <div class="row"> |
@@ -71,18 +71,18 @@ discard block |
||
| 71 | 71 | ), |
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | - $clients = get_posts( $args ); |
|
| 74 | + $clients = get_posts($args); |
|
| 75 | 75 | // print_r($clients); |
| 76 | 76 | |
| 77 | 77 | |
| 78 | - foreach($clients as $client){ |
|
| 78 | + foreach ($clients as $client) { |
|
| 79 | 79 | |
| 80 | 80 | //fetch if any pending requests exists |
| 81 | - $requests = get_post_meta($client->ID,'requests'); |
|
| 81 | + $requests = get_post_meta($client->ID, 'requests'); |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | |
| 85 | - foreach($requests as $request) { |
|
| 85 | + foreach ($requests as $request) { |
|
| 86 | 86 | |
| 87 | 87 | $no_requests = 0; |
| 88 | 88 | |
@@ -94,18 +94,18 @@ discard block |
||
| 94 | 94 | <div class=" col-8"> |
| 95 | 95 | <h6 class="mb-1 "><?php echo $user_data->display_name; ?> </h6> |
| 96 | 96 | <p class=" description pb-0"> |
| 97 | - Requested access to <a href=""><?php echo $client->post_title."(".$client->ID.")"; ?></a><br/> |
|
| 97 | + Requested access to <a href=""><?php echo $client->post_title . "(" . $client->ID . ")"; ?></a><br/> |
|
| 98 | 98 | Email: <?php echo $user_data->user_email; ?> UserID: <?php echo $request['user']; ?> |
| 99 | 99 | </p> |
| 100 | 100 | </div> |
| 101 | 101 | |
| 102 | 102 | <div class="col-4"> |
| 103 | 103 | <!-- data-bs-toggle="collapse" data-bs-target="#collapsePendingRequest" aria-expanded="true" aria-controls="collapsePendingRequest" --> |
| 104 | - <button data-bs-toggle="modal" data-bs-target="#permissionsModal" class="btn btn-success" type="button" onclick="set_values_in_permission_form(<?php echo "'$user_data->user_email',$client->ID,$request[user]"; ?>)"> |
|
| 104 | + <button data-bs-toggle="modal" data-bs-target="#permissionsModal" class="btn btn-success" type="button" onclick="set_values_in_permission_form(<?php echo "'$user_data->user_email',$client->ID,$request[user]"; ?>)"> |
|
| 105 | 105 | Allow |
| 106 | 106 | </button> |
| 107 | 107 | |
| 108 | - <button onclick="deny_access_request(<?php echo "$request[user],$request[crn],'$request[requested_on]'"; ?>)" class="btn btn-primary" type="button"> |
|
| 108 | + <button onclick="deny_access_request(<?php echo "$request[user],$request[crn],'$request[requested_on]'"; ?>)" class="btn btn-primary" type="button"> |
|
| 109 | 109 | Deny |
| 110 | 110 | </button> |
| 111 | 111 | |
@@ -129,11 +129,11 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | //get_post_meta($_GET['crn'], 'requests', $permission_request); |
| 131 | 131 | // //add to pending request for user |
| 132 | - $permission_requests = get_user_meta(get_current_user_id(),'sent_requests'); |
|
| 132 | + $permission_requests = get_user_meta(get_current_user_id(), 'sent_requests'); |
|
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - foreach ($permission_requests as $key => $permission_request ){ |
|
| 136 | + foreach ($permission_requests as $key => $permission_request) { |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | <button onclick="cancel_access_request(<?php |
| 156 | 156 | |
| 157 | - echo "'".$permission_request['requested_on']."', ".$permission_request['crn']; |
|
| 157 | + echo "'" . $permission_request['requested_on'] . "', " . $permission_request['crn']; |
|
| 158 | 158 | |
| 159 | 159 | ?>)" class="btn btn-outline-white" type="button" > |
| 160 | 160 | Cancel Request |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | <?php } |
| 168 | - if($no_requests) { |
|
| 168 | + if ($no_requests) { |
|
| 169 | 169 | ?> |
| 170 | 170 | |
| 171 | 171 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | ), |
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | - $clients = get_posts( $args ); |
|
| 217 | + $clients = get_posts($args); |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | <?php |
| 242 | 242 | |
| 243 | 243 | |
| 244 | - foreach($clients as $client){ |
|
| 244 | + foreach ($clients as $client) { |
|
| 245 | 245 | |
| 246 | 246 | |
| 247 | 247 | |
@@ -269,21 +269,21 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | |
| 272 | - $admin_list = get_post_meta($client->ID,'contacts'); |
|
| 272 | + $admin_list = get_post_meta($client->ID, 'contacts'); |
|
| 273 | 273 | $is_admin = 0; |
| 274 | - foreach($admin_list as $admin){ |
|
| 275 | - if($admin == get_current_user_ID()) |
|
| 274 | + foreach ($admin_list as $admin) { |
|
| 275 | + if ($admin == get_current_user_ID()) |
|
| 276 | 276 | { |
| 277 | 277 | echo " <span class='badge bg-success mr-2'>Admin</span>"; |
| 278 | - $is_admin =1; |
|
| 278 | + $is_admin = 1; |
|
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if(!$is_admin){ |
|
| 283 | - $permissions_list = get_post_meta($client->ID,'permissions',true); |
|
| 284 | - foreach($permissions_list as $permission){ |
|
| 285 | - if($permission['user'] == get_current_user_ID()){ |
|
| 286 | - foreach($permission['allowed_permissions'] as $feature){ |
|
| 282 | + if (!$is_admin) { |
|
| 283 | + $permissions_list = get_post_meta($client->ID, 'permissions', true); |
|
| 284 | + foreach ($permissions_list as $permission) { |
|
| 285 | + if ($permission['user'] == get_current_user_ID()) { |
|
| 286 | + foreach ($permission['allowed_permissions'] as $feature) { |
|
| 287 | 287 | echo " <span class='badge bg-info mr-2'>$feature</span>"; |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | <path fill-rule="evenodd" d="M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z" clip-rule="evenodd"></path> |
| 310 | 310 | </svg> Edit </a> |
| 311 | 311 | |
| 312 | - <span onclick="leave_company(<?php echo $client->ID; ?>)" class="btn btn-sm btn-danger" href="#"> |
|
| 312 | + <span onclick="leave_company(<?php echo $client->ID; ?>)" class="btn btn-sm btn-danger" href="#"> |
|
| 313 | 313 | <svg class="dropdown-icon text-danger me-2" style="width:20px" fill="white" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> |
| 314 | 314 | <path d="M11 6a3 3 0 11-6 0 3 3 0 016 0zM14 17a6 6 0 00-12 0h12zM13 8a1 1 0 100 2h4a1 1 0 100-2h-4z"></path> |
| 315 | 315 | </svg> Leave </span> |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | </tr> |
| 321 | 321 | <?php } |
| 322 | 322 | |
| 323 | - if(!$clients){ |
|
| 323 | + if (!$clients) { |
|
| 324 | 324 | ?> |
| 325 | 325 | |
| 326 | 326 | <tr> |
@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - $user = wp_get_current_user() ; |
|
| 2 | + $user = wp_get_current_user(); |
|
| 3 | 3 | |
| 4 | - require_once(BRIGHTY_CORE_PLUGIN_DIR .'/templates/woocommerce/my-account-top-menu.php'); |
|
| 5 | - $editable = is_wc_endpoint_url( 'edit-account' ); |
|
| 4 | + require_once(BRIGHTY_CORE_PLUGIN_DIR . '/templates/woocommerce/my-account-top-menu.php'); |
|
| 5 | + $editable = is_wc_endpoint_url('edit-account'); |
|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | ?> |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | <div class="col-12 col-xl-8"> |
| 17 | 17 | |
| 18 | - <form class="woocommerce-EditAccountForm edit-account" action="" method="post" <?php do_action( 'woocommerce_edit_account_form_tag' ); ?> > |
|
| 18 | + <form class="woocommerce-EditAccountForm edit-account" action="" method="post" <?php do_action('woocommerce_edit_account_form_tag'); ?> > |
|
| 19 | 19 | |
| 20 | - <div class="card card-body border-0 shadow mb-4 profile-card <?php if(!$editable){ echo 'no-edit'; } ?>"> |
|
| 20 | + <div class="card card-body border-0 shadow mb-4 profile-card <?php if (!$editable) { echo 'no-edit'; } ?>"> |
|
| 21 | 21 | <h2 class="h5 mb-4">General information</h2> |
| 22 | 22 | <a class="btn btn-primary btn-sm edit-profile right-5" href="/my-account/edit-account/" class="edit"> |
| 23 | 23 | <i class="fa fa-edit"></i> |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | <div> |
| 33 | 33 | <label for="first_name">First Name</label> |
| 34 | 34 | |
| 35 | - <input <?php if(!$editable){ echo 'disabled '; } ?> class="form-control" name="account_first_name" type="text" autocomplete="given-name" placeholder="Tariq Abdullah" value="<?php echo esc_attr( $user->first_name ); ?>"> |
|
| 35 | + <input <?php if (!$editable) { echo 'disabled '; } ?> class="form-control" name="account_first_name" type="text" autocomplete="given-name" placeholder="Tariq Abdullah" value="<?php echo esc_attr($user->first_name); ?>"> |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | </div> |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | <div class="col-md-6 mb-3"> |
| 41 | 41 | <div> |
| 42 | 42 | <label for="last_name">Last Name</label> |
| 43 | - <input <?php if(!$editable){ echo 'disabled '; } ?> class="form-control" type="text" placeholder="Also your last name" |
|
| 44 | - name="account_last_name" id="last_name" autocomplete="family-name" value="<?php echo esc_attr( $user->last_name ); ?>" |
|
| 43 | + <input <?php if (!$editable) { echo 'disabled '; } ?> class="form-control" type="text" placeholder="Also your last name" |
|
| 44 | + name="account_last_name" id="last_name" autocomplete="family-name" value="<?php echo esc_attr($user->last_name); ?>" |
|
| 45 | 45 | > |
| 46 | 46 | </div> |
| 47 | 47 | </div> |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | <div class="col-md-6 mb-3"> |
| 53 | 53 | <div> |
| 54 | 54 | <label for="first_name">Display Name</label> |
| 55 | - <input <?php if(!$editable){ echo 'disabled '; } ?> class="form-control" id="phone" type="text" placeholder="Enter Display Name" name="account_display_name" value="<?php echo esc_attr( $user->display_name) ; ?>"> |
|
| 55 | + <input <?php if (!$editable) { echo 'disabled '; } ?> class="form-control" id="phone" type="text" placeholder="Enter Display Name" name="account_display_name" value="<?php echo esc_attr($user->display_name); ?>"> |
|
| 56 | 56 | </div> |
| 57 | 57 | </div> |
| 58 | 58 | <div class="col-md-6 mb-3"> |
| 59 | 59 | <div> |
| 60 | 60 | <label for="first_name">Company Name</label> |
| 61 | - <input <?php if(!$editable){ echo 'disabled '; } ?> class="form-control" id="phone" type="text" placeholder="Enter Company Name" name="billing_company" value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_company',true) ); ?>"> |
|
| 61 | + <input <?php if (!$editable) { echo 'disabled '; } ?> class="form-control" id="phone" type="text" placeholder="Enter Company Name" name="billing_company" value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_company', true)); ?>"> |
|
| 62 | 62 | </div> |
| 63 | 63 | </div> |
| 64 | 64 | </div> |
@@ -74,18 +74,18 @@ discard block |
||
| 74 | 74 | <path fill-rule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clip-rule="evenodd"></path> |
| 75 | 75 | </svg> |
| 76 | 76 | </span> |
| 77 | - <input <?php if(!$editable){ echo 'disabled '; } ?> name="dob" data-datepicker="" class="form-control datepicker-input" id="birthday" type="text" placeholder="dd/mm/yyyy" |
|
| 78 | - value="<?php echo esc_attr( get_user_meta($user->ID, 'dob',true) ); ?>" > |
|
| 77 | + <input <?php if (!$editable) { echo 'disabled '; } ?> name="dob" data-datepicker="" class="form-control datepicker-input" id="birthday" type="text" placeholder="dd/mm/yyyy" |
|
| 78 | + value="<?php echo esc_attr(get_user_meta($user->ID, 'dob', true)); ?>" > |
|
| 79 | 79 | </div> |
| 80 | 80 | </div> |
| 81 | 81 | <div class="col-md-6 mb-3"> |
| 82 | 82 | <label for="gender">Gender</label> |
| 83 | - <select <?php if(!$editable){ echo 'disabled '; } ?> name="gender" class="form-select mb-0" id="gender" aria-label="Gender select example"> |
|
| 83 | + <select <?php if (!$editable) { echo 'disabled '; } ?> name="gender" class="form-select mb-0" id="gender" aria-label="Gender select example"> |
|
| 84 | 84 | <option selected="selected">Gender</option> |
| 85 | 85 | <option value="1" <?php |
| 86 | - if(get_user_meta($user->ID, 'gender',true)==1){ echo "selected"; } ?>>Female</option> |
|
| 86 | + if (get_user_meta($user->ID, 'gender', true) == 1) { echo "selected"; } ?>>Female</option> |
|
| 87 | 87 | <option value="2" <?php |
| 88 | - if(get_user_meta($user->ID, 'gender',true)==2){ echo "selected"; } ?>>Male</option> |
|
| 88 | + if (get_user_meta($user->ID, 'gender', true) == 2) { echo "selected"; } ?>>Male</option> |
|
| 89 | 89 | </select> |
| 90 | 90 | </div> |
| 91 | 91 | </div> |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | <div class="col-md-6 mb-3"> |
| 94 | 94 | <div class="form-group"> |
| 95 | 95 | <label for="email">Email</label> |
| 96 | - <input class="form-control" <?php if(!$editable){ echo 'disabled '; } ?> id="email" type="email" placeholder="[email protected]" autocomplete="email" name="account_email" |
|
| 97 | - value="<?php echo esc_attr( $user->user_email ); ?>" |
|
| 96 | + <input class="form-control" <?php if (!$editable) { echo 'disabled '; } ?> id="email" type="email" placeholder="[email protected]" autocomplete="email" name="account_email" |
|
| 97 | + value="<?php echo esc_attr($user->user_email); ?>" |
|
| 98 | 98 | > |
| 99 | 99 | |
| 100 | 100 | |
@@ -104,16 +104,16 @@ discard block |
||
| 104 | 104 | <div class="col-md-6 mb-3"> |
| 105 | 105 | <div class="form-group"> |
| 106 | 106 | <label for="phone">Phone</label> |
| 107 | - <input class="form-control" <?php if(!$editable){ echo 'disabled '; } ?> id="phone" type="text" placeholder="Enter Phone Number" required="" |
|
| 107 | + <input class="form-control" <?php if (!$editable) { echo 'disabled '; } ?> id="phone" type="text" placeholder="Enter Phone Number" required="" |
|
| 108 | 108 | name="billing_phone" |
| 109 | - value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_phone',true) ); ?>"> |
|
| 109 | + value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_phone', true)); ?>"> |
|
| 110 | 110 | </div> |
| 111 | 111 | </div> |
| 112 | 112 | </div> |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | <div class="mt-3"> |
| 116 | - <button name="save_account_details" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" class="save-btn btn btn-gray-800 mt-2 animate-up-2" type="submit"> |
|
| 116 | + <button name="save_account_details" value="<?php esc_attr_e('Save changes', 'woocommerce'); ?>" class="save-btn btn btn-gray-800 mt-2 animate-up-2" type="submit"> |
|
| 117 | 117 | Save all |
| 118 | 118 | </button> |
| 119 | 119 | </div> |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | <div class="row"> |
| 135 | 135 | <div class="col-sm-12 mb-3"> |
| 136 | - <div class="form-group"><label for="address">Address</label> <input disabled class="form-control" id="address" type="text" placeholder="Enter your home address" required="" value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_address_1',true) ); echo " "; |
|
| 137 | - echo esc_attr( get_user_meta($user->ID, 'billing_address_2',true) ); |
|
| 136 | + <div class="form-group"><label for="address">Address</label> <input disabled class="form-control" id="address" type="text" placeholder="Enter your home address" required="" value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_address_1', true)); echo " "; |
|
| 137 | + echo esc_attr(get_user_meta($user->ID, 'billing_address_2', true)); |
|
| 138 | 138 | ?>"></div> |
| 139 | 139 | </div> |
| 140 | 140 | |
@@ -145,18 +145,18 @@ discard block |
||
| 145 | 145 | <div class="form-group"> |
| 146 | 146 | <label for="city">City</label> |
| 147 | 147 | <input class="form-control" disabled id="city" type="text" placeholder="City" required="" |
| 148 | - value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_city',true) ); ?>"> |
|
| 148 | + value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_city', true)); ?>"> |
|
| 149 | 149 | </div> |
| 150 | 150 | </div> |
| 151 | 151 | |
| 152 | 152 | <div class="col-sm-4 mb-3"> |
| 153 | 153 | <label for="state">State</label> |
| 154 | 154 | <input class="form-control" disabled id="city" type="text" placeholder="City" required="" |
| 155 | - value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_state',true) ); ?>"> |
|
| 155 | + value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_state', true)); ?>"> |
|
| 156 | 156 | </div> |
| 157 | 157 | |
| 158 | 158 | <div class="col-sm-4"> |
| 159 | - <div class="form-group"><label for="zip">ZIP</label> <input class="form-control" disabled id="zip" type="tel" placeholder="ZIP" required="" value="<?php echo esc_attr( get_user_meta($user->ID, 'billing_postcode',true) ); ?>"></div> |
|
| 159 | + <div class="form-group"><label for="zip">ZIP</label> <input class="form-control" disabled id="zip" type="tel" placeholder="ZIP" required="" value="<?php echo esc_attr(get_user_meta($user->ID, 'billing_postcode', true)); ?>"></div> |
|
| 160 | 160 | </div> |
| 161 | 161 | </div> |
| 162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | |
| 167 | 167 | |
| 168 | - <?php wp_nonce_field( 'save_account_details', 'save-account-details-nonce' ); ?> |
|
| 168 | + <?php wp_nonce_field('save_account_details', 'save-account-details-nonce'); ?> |
|
| 169 | 169 | |
| 170 | 170 | |
| 171 | 171 | |
@@ -190,19 +190,19 @@ discard block |
||
| 190 | 190 | <div class="card shadow border-0 text-center p-0"> |
| 191 | 191 | <div class="profile-cover rounded-top" style="background: url("<?php |
| 192 | 192 | |
| 193 | - $default = BRIGHTY_CORE_PLUGIN_URL.'public/assets/img/signin-bg.svg'; |
|
| 194 | - echo get_theme_mod( 'default_user_cover_picture',$default); |
|
| 193 | + $default = BRIGHTY_CORE_PLUGIN_URL . 'public/assets/img/signin-bg.svg'; |
|
| 194 | + echo get_theme_mod('default_user_cover_picture', $default); |
|
| 195 | 195 | |
| 196 | 196 | ?>");"></div> |
| 197 | 197 | <div class="card-body pb-5"> |
| 198 | 198 | <img src="<?php echo get_avatar_url($user->ID); ?>" class="avatar-xl rounded-circle mx-auto mt-n7 mb-4" alt="Neil Portrait"> |
| 199 | - <h4 class="h3"><?php echo esc_attr( $user->display_name); ?></h4> |
|
| 200 | - <h5 class="fw-normal"><?php echo esc_attr( get_user_meta($user->ID, 'billing_company',true) ); ?></h5> |
|
| 199 | + <h4 class="h3"><?php echo esc_attr($user->display_name); ?></h4> |
|
| 200 | + <h5 class="fw-normal"><?php echo esc_attr(get_user_meta($user->ID, 'billing_company', true)); ?></h5> |
|
| 201 | 201 | <p class="text-gray mb-4"><?php |
| 202 | 202 | |
| 203 | - echo esc_attr( get_user_meta($user->ID, 'billing_city',true) )." "; |
|
| 204 | - echo esc_attr( get_user_meta($user->ID, 'billing_state',true) ).", "; |
|
| 205 | - echo esc_attr( get_user_meta($user->ID, 'billing_country',true) ); |
|
| 203 | + echo esc_attr(get_user_meta($user->ID, 'billing_city', true)) . " "; |
|
| 204 | + echo esc_attr(get_user_meta($user->ID, 'billing_state', true)) . ", "; |
|
| 205 | + echo esc_attr(get_user_meta($user->ID, 'billing_country', true)); |
|
| 206 | 206 | |
| 207 | 207 | ?></p> |
| 208 | 208 | |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | <?php |
| 214 | 214 | |
| 215 | - $has_account_manager = get_user_meta(get_current_user_id(), 'account_manager',true); |
|
| 215 | + $has_account_manager = get_user_meta(get_current_user_id(), 'account_manager', true); |
|
| 216 | 216 | |
| 217 | - if($has_account_manager){ |
|
| 218 | - $account_manager = get_userdata( $has_account_manager ); |
|
| 217 | + if ($has_account_manager) { |
|
| 218 | + $account_manager = get_userdata($has_account_manager); |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if(($has_account_manager || get_theme_mod( 'default_account_manager_name'))&&get_theme_mod( 'enable_account_manager')) { |
|
| 222 | + if (($has_account_manager || get_theme_mod('default_account_manager_name')) && get_theme_mod('enable_account_manager')) { |
|
| 223 | 223 | |
| 224 | 224 | ?> |
| 225 | 225 | |
@@ -234,36 +234,36 @@ discard block |
||
| 234 | 234 | <div class="row align-items-center"> |
| 235 | 235 | <div class="col-auto"> <a href="#" class="avatar-md"><img class="rounded" alt="Image placeholder" src="<?php |
| 236 | 236 | |
| 237 | - if($has_account_manager){ |
|
| 237 | + if ($has_account_manager) { |
|
| 238 | 238 | |
| 239 | 239 | echo get_avatar_url($has_account_manager); |
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | else { |
| 243 | 243 | |
| 244 | - $default = BRIGHTY_CORE_PLUGIN_URL.'public/assets/img/signin-bg.svg'; |
|
| 245 | - echo get_theme_mod( 'default_account_manager_photo',$default); |
|
| 244 | + $default = BRIGHTY_CORE_PLUGIN_URL . 'public/assets/img/signin-bg.svg'; |
|
| 245 | + echo get_theme_mod('default_account_manager_photo', $default); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | ?>"></a></div> |
| 249 | 249 | <div class="col-auto px-0"> |
| 250 | 250 | <h4 class="fs-6 text-dark mb-0"><a href="#"><?php |
| 251 | 251 | |
| 252 | - if($has_account_manager){ |
|
| 252 | + if ($has_account_manager) { |
|
| 253 | 253 | echo $account_manager->display_name; |
| 254 | 254 | } |
| 255 | 255 | else { |
| 256 | - echo get_theme_mod( 'default_account_manager_name'); |
|
| 256 | + echo get_theme_mod('default_account_manager_name'); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | ?></a></h4> |
| 260 | 260 | <span class="small"><?php |
| 261 | 261 | |
| 262 | - if($has_account_manager){ |
|
| 263 | - echo get_user_meta($account_manager->ID,'account_manager_position',true); |
|
| 262 | + if ($has_account_manager) { |
|
| 263 | + echo get_user_meta($account_manager->ID, 'account_manager_position', true); |
|
| 264 | 264 | } |
| 265 | 265 | else { |
| 266 | - echo get_theme_mod( 'default_account_manager_position'); |
|
| 266 | + echo get_theme_mod('default_account_manager_position'); |
|
| 267 | 267 | } ?></span> |
| 268 | 268 | </div> |
| 269 | 269 | </div> |
@@ -271,11 +271,11 @@ discard block |
||
| 271 | 271 | |
| 272 | 272 | <p><?php |
| 273 | 273 | |
| 274 | - if($has_account_manager){ |
|
| 275 | - echo get_user_meta($account_manager->ID,'description',true); |
|
| 274 | + if ($has_account_manager) { |
|
| 275 | + echo get_user_meta($account_manager->ID, 'description', true); |
|
| 276 | 276 | } |
| 277 | 277 | else { |
| 278 | - echo get_theme_mod( 'default_account_manager_description'); |
|
| 278 | + echo get_theme_mod('default_account_manager_description'); |
|
| 279 | 279 | } |
| 280 | 280 | ?></p> |
| 281 | 281 | |
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | <div class="d-block"> |
| 291 | 291 | <label class="mb-0">Phone</label> |
| 292 | 292 | <h4 class="mb-0"><?php |
| 293 | - if($has_account_manager){ |
|
| 294 | - echo get_user_meta($account_manager->ID,'billing_phone',true); |
|
| 293 | + if ($has_account_manager) { |
|
| 294 | + echo get_user_meta($account_manager->ID, 'billing_phone', true); |
|
| 295 | 295 | } |
| 296 | 296 | else { |
| 297 | - echo get_theme_mod( 'default_account_manager_phone'); |
|
| 297 | + echo get_theme_mod('default_account_manager_phone'); |
|
| 298 | 298 | } |
| 299 | 299 | ?></h4> |
| 300 | 300 | </div> |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | <div class="d-block"> |
| 309 | 309 | <label class="mb-0">Email</label> |
| 310 | 310 | <p class="mb-0" style="font-size: 11px;"><?php |
| 311 | - if($has_account_manager){ |
|
| 311 | + if ($has_account_manager) { |
|
| 312 | 312 | echo $account_manager->user_email; |
| 313 | 313 | } |
| 314 | 314 | else { |
| 315 | - echo get_theme_mod( 'default_account_manager_email'); |
|
| 315 | + echo get_theme_mod('default_account_manager_email'); |
|
| 316 | 316 | |
| 317 | 317 | }?></p> |
| 318 | 318 | </div> |