Exemple #1
0
 /**
  * This is simply a front-runner for the extended dependency utilities provided by the XDaRk Core.
  *    There is NO need to load the entire dependency scanner unless we really need to.
  *
  * @inheritdoc deps_x_xd_v141226_dev::check()
  * @see deps_x_xd_v141226_dev::check()
  */
 public static function check($plugin_name = '', $plugin_dir_names = '', $report_notices = TRUE, $report_warnings = TRUE, $check_last_ok = TRUE, $maybe_display_wp_admin_notices = TRUE)
 {
     if (!is_string($plugin_name) || !is_string($plugin_dir_names) || !is_bool($report_notices) || !is_bool($report_warnings) || !is_bool($check_last_ok) || !is_bool($maybe_display_wp_admin_notices)) {
         throw new exception(sprintf(xd_v141226_dev::__('Invalid arguments: `%1$s`'), print_r(func_get_args(), TRUE)));
     }
     if (apply_filters('xd__deps__check_disable', FALSE)) {
         return TRUE;
     }
     // Return now (DISABLED by a filter).
     $php_version = PHP_VERSION;
     // Installed PHP version.
     global $wp_version;
     // Global made available by WordPress®.
     if ($check_last_ok && is_array($last_ok = get_option('xd__deps__last_ok')) && isset($last_ok['xd_v141226_dev'], $last_ok['time'], $last_ok['php_version'], $last_ok['wp_version']) && $last_ok['time'] >= strtotime('-7 days') && $last_ok['php_version'] === $php_version && $last_ok['wp_version'] === $wp_version) {
         return TRUE;
     }
     // Return TRUE. A re-scan is NOT necessary; everything is still OK.
     if (!class_exists('deps_x_xd_v141226_dev')) {
         require_once dirname(__FILE__) . '/deps-x.php';
     }
     $x = new deps_x_xd_v141226_dev();
     $check_last_ok = FALSE;
     // We just checked this above. No reason to check again.
     return $x->check($plugin_name, $plugin_dir_names, $report_notices, $report_warnings, $check_last_ok, $maybe_display_wp_admin_notices);
 }