本文整理汇总了PHP中WPFB_Core::ajax_url方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::ajax_url方法的具体用法?PHP WPFB_Core::ajax_url怎么用?PHP WPFB_Core::ajax_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPFB_Core
的用法示例。
在下文中一共展示了WPFB_Core::ajax_url方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitClass
static function InitClass()
{
self::$ajax_url = WPFB_Core::PluginUrl('wpfb-ajax.php');
if (defined('WPFB_NO_CORE_INIT')) {
return;
}
// used with CSS proxy
//Load settings
self::$settings = (object) get_option(WPFB_OPT_NAME);
// load lang
$lang_dir = defined('WPFB_LANG_DIR') ? '../../' . WPFB_LANG_DIR : basename(WPFB_PLUGIN_ROOT) . '/languages';
load_plugin_textdomain(WPFB, 'wp-content/plugins/' . $lang_dir, $lang_dir);
add_action('parse_query', array(__CLASS__, 'ParseQuery'));
// search
add_action('wp_enqueue_scripts', array(__CLASS__, 'EnqueueScripts'));
add_action('wp_footer', array(__CLASS__, 'Footer'));
add_action('generate_rewrite_rules', array(__CLASS__, 'GenRewriteRules'));
add_action(WPFB . '_cron', array(__CLASS__, 'Cron'));
add_action('wpfilebase_sync', array(__CLASS__, 'Sync'));
// for Developers: New wp-filebase actions
add_shortcode('wpfilebase', array(__CLASS__, 'ShortCode'));
// for attachments and file browser
add_filter('the_content', array(__CLASS__, 'ContentFilter'), 10);
// must be lower than 11 (before do_shortcode) and after wpautop (>9)
add_filter('ext2type', array(__CLASS__, 'Ext2TypeFilter'));
add_filter('pre_set_site_transient_update_plugins', array(__CLASS__, 'PreSetPluginsTransientFilter'));
add_filter('plugins_api', array(__CLASS__, 'PluginsApiFilter'), 10, 3);
// register treeview stuff
//wp_register_script('jquery-cookie', WPFB_PLUGIN_URI.'extras/jquery/jquery.cookie.js', array('jquery'));
wp_register_script('jquery-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.js', array('jquery'), WPFB_VERSION);
wp_register_script('jquery-treeview-edit', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.edit.js', array('jquery-treeview'), WPFB_VERSION);
wp_register_script('jquery-treeview-async', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.async.js', array('jquery-treeview-edit'), WPFB_VERSION);
wp_register_style('jquery-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.css', array(), WPFB_VERSION);
// DataTables
wp_register_script('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/js/jquery.dataTables.min.js', array('jquery'), WPFB_VERSION);
wp_register_style('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/css/jquery.dataTables.css', array(), WPFB_VERSION);
wp_register_script('jquery-dataTables-columnFilter', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/js/jquery.dataTables.columnFilter.js', array('jquery-dataTables'), WPFB_VERSION);
wp_register_script(WPFB, WPFB_PLUGIN_URI . 'js/common.js', array('jquery'), WPFB_VERSION);
// cond loading (see Footer)
if (empty(WPFB_Core::$settings->disable_css)) {
$wpfb_css = get_option('wpfb_css');
if ($wpfb_css) {
// static file?
wp_enqueue_style(WPFB, strstr($wpfb_css, '//'), array(), WPFB_VERSION, 'all');
} else {
$upload_path = path_is_absolute(WPFB_Core::$settings->upload_path) ? '' : WPFB_Core::$settings->upload_path;
wp_enqueue_style(WPFB, WPFB_Core::PluginUrl("wp-filebase_css.php?rp={$upload_path}"), array(), WPFB_VERSION, 'all');
}
}
$wpfb_admin_page = is_admin() && !empty($_GET['page']) && strpos($_GET['page'], 'wpfilebase_') !== false || defined('WPFB_EDITOR_PLUGIN');
if ($wpfb_admin_page) {
wpfb_loadclass('Admin');
}
// live admin
if ($wpfb_admin_page && @$_GET['page'] == 'wpfilebase_filebrowser' || (WPFB_Core::CurUserCanCreateCat() || WPFB_Core::CurUserCanUpload()) && !is_admin()) {
wp_enqueue_script(WPFB . '-live-admin', WPFB_PLUGIN_URI . 'js/live-admin.js', array('jquery'), WPFB_VERSION);
if (self::GetOpt('admin_bar')) {
add_action('admin_bar_menu', array(__CLASS__, 'AdminBar'), 80);
}
if (self::GetOpt('file_context_menu')) {
wp_enqueue_script('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.js', array('jquery'));
wp_enqueue_style('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.css', array(), WPFB_VERSION);
}
wp_enqueue_style('wpfb-live-admin', WPFB_PLUGIN_URI . 'css/live-admin.css', array(), WPFB_VERSION);
}
// for admin
if (current_user_can('edit_posts') || current_user_can('edit_pages')) {
self::MceAddBtns();
}
self::DownloadRedirect();
if ((WPFB_Core::$settings->frontend_upload || current_user_can('upload_files')) && (!empty($_GET['wpfb_upload_file']) || !empty($_GET['wpfb_add_cat']))) {
wpfb_call('Admin', empty($_GET['wpfb_upload_file']) ? 'ProcessWidgetAddCat' : 'ProcessWidgetUpload');
}
}
示例2: InitClass
static function InitClass()
{
self::$ajax_url = admin_url('admin-ajax.php?action=wpfilebase');
self::$ajax_url_public = strstr(home_url('/?wpfilebase_ajax=1'), '//');
// remove protocol qualifier
self::$settings = (object) get_option(WPFB_OPT_NAME, array());
if (defined('WPFB_NO_CORE_INIT')) {
return;
}
// on activation
$lang_dir = defined('WPFB_LANG_DIR') ? '../../' . WPFB_LANG_DIR : basename(WPFB_PLUGIN_ROOT) . '/languages';
load_plugin_textdomain('wp-filebase', false, $lang_dir);
add_action('parse_query', array(__CLASS__, 'ParseQuery'));
// search
add_action('wp_enqueue_scripts', array(__CLASS__, 'EnqueueScripts'));
add_action('wp_footer', array(__CLASS__, 'Footer'));
add_action('generate_rewrite_rules', array(__CLASS__, 'GenRewriteRules'));
add_action('wp_ajax_nopriv_wpfilebase', wpfb_callback('Ajax', 'PublicRequest'));
add_action('wp_ajax_wpfilebase', wpfb_callback('Ajax', 'AdminRequest'));
add_action('wpfb_cron', array(__CLASS__, 'Cron'));
add_action('wpfilebase_sync', array(__CLASS__, 'Sync'));
// for Developers: New wp-filebase actions
add_action('wpfilebase_bgscan', array(__CLASS__, 'BgScanWork'));
// for Developers: New wp-filebase actions
// for attachments and file browser
add_filter('the_content', array(__CLASS__, 'ContentFilter'), 10);
// must be lower than 11 (before do_shortcode) and after wpautop (>9)
add_filter('pre_set_site_transient_update_plugins', array(__CLASS__, 'PreSetPluginsTransientFilter'));
add_filter('plugins_api', array(__CLASS__, 'PluginsApiFilter'), 10, 3);
add_filter('ext2type', array(__CLASS__, 'Ext2TypeFilter'));
add_shortcode('wpfilebase', array(__CLASS__, 'ShortCode'));
self::DownloadRedirect();
if (isset($_GET['wpfilebase_ajax'])) {
define('DOING_AJAX', true);
wpfb_loadclass('Ajax');
WPFB_Ajax::PublicRequest();
}
// register treeview stuff
wp_register_script('wpfb-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview-async-edit.min.js', array('jquery'), WPFB_VERSION);
wp_register_style('wpfb-treeview', WPFB_PLUGIN_URI . 'extras/jquery/treeview/jquery.treeview.css', array(), WPFB_VERSION);
// DataTables
wp_register_script('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/datatables.min.js', array('jquery'), WPFB_VERSION);
wp_register_style('jquery-dataTables', WPFB_PLUGIN_URI . 'extras/jquery/dataTables/datatables.min.css', array(), WPFB_VERSION);
wp_register_script(WPFB, WPFB_PLUGIN_URI . 'js/common.js', array('jquery'), WPFB_VERSION);
// cond loading (see Footer)
wp_register_script('wpfb-live-admin', WPFB_PLUGIN_URI . 'js/live-admin.js', array('jquery'), WPFB_VERSION);
if (empty(WPFB_Core::$settings->disable_css)) {
$wpfb_css = get_option('wpfb_css');
wp_enqueue_style(WPFB, strstr($wpfb_css ? $wpfb_css : WPFB_PLUGIN_URI . 'wp-filebase.css', '//'), array(), WPFB_VERSION, 'all');
}
// live admin normaly for front-end, but also on filebrowser backend
if (is_admin() ? isset($_GET['page']) && $_GET['page'] == 'wpfilebase_filebrowser' : WPFB_Core::CurUserCanCreateCat() || WPFB_Core::CurUserCanUpload()) {
wp_enqueue_script('wpfb-live-admin');
wp_enqueue_style('wpfb-live-admin', WPFB_PLUGIN_URI . 'css/live-admin.css', array(), WPFB_VERSION);
self::$settings->admin_bar && add_action('admin_bar_menu', array(__CLASS__, 'AdminBar'), 80);
if (!empty(self::$settings->file_context_menu)) {
wp_enqueue_script('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.js', array('jquery'));
wp_enqueue_style('jquery-contextmenu', WPFB_PLUGIN_URI . 'extras/jquery/contextmenu/jquery.contextmenu.css', array(), WPFB_VERSION);
}
}
if (WPFB_Core::$settings->frontend_upload && (!empty($_GET['wpfb_upload_file']) || !empty($_GET['wpfb_add_cat'])) && (WPFB_Core::CurUserCanUpload() || WPFB_Core::CurUserCanCreateCat())) {
wpfb_call('Admin', empty($_GET['wpfb_upload_file']) ? 'ProcessWidgetAddCat' : 'ProcessWidgetUpload');
}
}