/** * Start-up TablePress (run on WordPress "init") and load the controller for the current state * * @since 1.0.0 * @uses load_controller() */ public static function run() { /** * Fires when TablePress is loaded. * * @since 1.0.0 */ do_action('tablepress_run'); // exit early if TablePress doesn't have to be loaded if ('wp-login.php' === basename($_SERVER['SCRIPT_FILENAME']) || defined('XMLRPC_REQUEST') && XMLRPC_REQUEST || defined('DOING_CRON') && DOING_CRON) { return; } // check if minimum requirements are fulfilled, currently WordPress 3.8 if (version_compare(str_replace('-src', '', $GLOBALS['wp_version']), '3.8', '<')) { // show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work if (current_user_can('update_plugins')) { add_action('admin_notices', array('TablePress', 'show_minimum_requirements_error_notice')); } // and exit TablePress return; } /** * Filter the string that is used as the [table] Shortcode. * * @since 1.0.0 * * @param string $shortcode The [table] Shortcode string. */ self::$shortcode = apply_filters('tablepress_table_shortcode', self::$shortcode); /** * Filter the string that is used as the [table-info] Shortcode. * * @since 1.0.0 * * @param string $shortcode_info The [table-info] Shortcode string. */ self::$shortcode_info = apply_filters('tablepress_table_info_shortcode', self::$shortcode_info); // Load modals for table and options, to be accessible from everywhere via `TablePress::$model_options` and `TablePress::$model_table` self::$model_options = self::load_model('options'); self::$model_table = self::load_model('table'); if (is_admin()) { $controller = 'admin'; if (defined('DOING_AJAX') && DOING_AJAX) { $controller .= '_ajax'; } } else { $controller = 'frontend'; } self::$controller = self::load_controller($controller); }