static function get_instance()
 {
     if (!isset(self::$instance)) {
         $class_name = __CLASS__;
         self::$instance = new $class_name();
     }
     return self::$instance;
 }
 function get_default_review_type()
 {
     $review_type = get_option('vip-scanner-default-async-review-type', null);
     if (is_null($review_type)) {
         $review_types = $this->vip_scanner_instance->get_review_types();
         $review_type = $review_types[VIP_Scanner_UI::get_instance()->default_review];
     }
     return $review_type;
 }
示例#3
0
} else {
    wp_die('VIP-Scanner could not find PHP-Parser, which it requires to run. ' . 'Please refer to the "Requirements" section in readme.md. <br>(tl;dr
	        You probably need to run "git submodule update --init --recursive"
	        inside the vip-scanner folder in the plugins directory to fetch
	        the PHP-Parser submodule that is now required.)');
}
spl_autoload_register('vip_scanner_autoload');
require_once VIP_SCANNER_DIR . '/class-vip-scanner.php';
VIP_Scanner::get_instance();
require_once VIP_SCANNER_DIR . '/config-vip-scanner.php';
if (defined('WP_CLI') && WP_CLI) {
    require_once VIP_SCANNER_DIR . '/class-wp-cli.php';
}
if (is_admin()) {
    require_once VIP_SCANNER_DIR . '/admin/class-vip-scanner-ui.php';
    VIP_Scanner_UI::get_instance();
    VIP_Scanner_Async::get_instance();
}
function vip_scanner_autoload($class_name)
{
    // Class names that are in files that aren't found by our scheme below.
    $other = array('VIP_PregFile' => 'class-preg-file.php', 'VIP_Scanner_Async' => 'vip-scanner-async.php', 'AnalyzedPHPFile' => 'class-analyzed-php-file.php', 'AnalyzedCSSFile' => 'class-analyzed-css-file.php', 'ElementGroup' => 'elements/class-element-group.php');
    if (array_key_exists($class_name, $other)) {
        require VIP_SCANNER_DIR . '/' . $other[$class_name];
        return;
    }
    // Example: $class_name === 'ThemeScanner'
    $hyphenated_name = strtolower(preg_replace('/([a-z])([A-Z])/', '$1-$2', $class_name));
    // Example: theme-scanner
    $category = substr(strrchr($hyphenated_name, '-'), 1);
    // Example: scanner