本文整理匯總了PHP中TablePress::shortcode方法的典型用法代碼示例。如果您正苦於以下問題:PHP TablePress::shortcode方法的具體用法?PHP TablePress::shortcode怎麽用?PHP TablePress::shortcode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TablePress
的用法示例。
在下文中一共展示了TablePress::shortcode方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
/**
* 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);
}
示例2: run
/**
* 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()
{
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.5
if (version_compare($GLOBALS['wp_version'], '3.5', '<')) {
// 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;
}
// some filtering of "global" class variables
self::$shortcode = apply_filters('tablepress_table_shortcode', self::$shortcode);
self::$shortcode_info = apply_filters('tablepress_table_info_shortcode', self::$shortcode_info);
if (is_admin()) {
$controller = 'admin';
if (defined('DOING_AJAX') && DOING_AJAX) {
$controller .= '_ajax';
}
} else {
$controller = 'frontend';
}
self::$controller = self::load_controller($controller);
}