コード例 #1
0
 function __construct()
 {
     wp_enqueue_script('post');
     wp_enqueue_script('postbox');
     wp_enqueue_style('pp-item-edit', PP_URLPATH . '/admin/css/pp-item-edit.css', array(), PPC_VERSION);
     //$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
     //wp_enqueue_script( 'pp_agent_search', PP_URLPATH . "/admin/js/listbox{$suffix}.js", array('jquery', 'jquery-form'), PPC_VERSION );  // this caused redundant loading
     require_once dirname(__FILE__) . '/item-edit-ui_pp.php';
     add_action('admin_print_scripts', 'pp_item_edit_js');
     add_action('admin_menu', array(&$this, 'add_meta_boxes'));
     if (!empty($_REQUEST['taxonomy'])) {
         if (pp_is_taxonomy_enabled($_REQUEST['taxonomy'])) {
             add_action('admin_head', array(&$this, 'wp_scripts'));
             add_action('edit_category_form', array(&$this, 'exception_edit_ui'));
             add_action('edit_tag_form', array(&$this, 'exception_edit_ui'));
         } else {
             add_action('edit_category_form', array(&$this, 'tx_enable_ui'));
             add_action('edit_tag_form', array(&$this, 'tx_enable_ui'));
         }
         if (!empty($_REQUEST['pp_universal'])) {
             add_action('edit_category_form', array(&$this, 'pp_universal_hidden_input'));
             add_action('edit_tag_form', array(&$this, 'pp_universal_hidden_input'));
         }
     }
     do_action('pp_term_edit_ui');
 }
コード例 #2
0
ファイル: admin-ui_pp.php プロジェクト: severnrescue/web
 function __construct()
 {
     global $pagenow, $pp_plugin_page;
     do_action('_pp_admin_ui');
     // ============== UI-related filters ================
     add_action('admin_menu', array(&$this, 'build_menu'));
     add_action('show_user_profile', array(&$this, 'ui_user'), 2);
     add_action('edit_user_profile', array(&$this, 'ui_user'), 2);
     add_action('admin_print_scripts-user-new.php', array(&$this, 'insert_groups_ui'));
     add_action('admin_menu', array(&$this, 'ngg_uploader_workaround'));
     $is_post_admin = false;
     if (array_intersect(array($pagenow, $pp_plugin_page), array('post-new.php', 'post.php'))) {
         global $pp_post_edit_ui;
         require_once dirname(__FILE__) . '/post-edit-ui_pp.php';
         $pp_post_edit_ui = new PP_PostEditUI();
         $is_post_admin = true;
     } elseif ('edit-tags.php' == $pagenow && !empty($_REQUEST['action']) && 'edit' == $_REQUEST['action']) {
         if (current_user_can('pp_assign_roles')) {
             global $pp_term_edit_ui;
             require_once dirname(__FILE__) . '/term-edit-ui_pp.php';
             $pp_term_edit_ui = new PP_TermEditUI();
         }
     }
     if (pp_is_user_administrator() || 0 === strpos($pp_plugin_page, 'pp-')) {
         add_action('in_admin_footer', array(&$this, 'ui_admin_footer'));
     }
     if ('users.php' == $pagenow) {
         require_once dirname(__FILE__) . '/users-ui_pp.php';
     } elseif ('edit.php' == $pagenow || pp_is_ajax('inline-save')) {
         $post_type = isset($_REQUEST['post_type']) ? pp_sanitize_key($_REQUEST['post_type']) : 'post';
         if (in_array($post_type, pp_get_enabled_post_types())) {
             global $pp_post_listing_ui;
             require_once dirname(__FILE__) . '/post-listing-ui_pp.php';
             $pp_post_listing_ui = new PP_PostsAdmin();
             $is_post_admin = true;
         }
     } elseif (in_array($pagenow, array('edit-tags.php')) || defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('inline-save-tax', 'add-tag'))) {
         if (!empty($_REQUEST['taxonomy']) && pp_is_taxonomy_enabled($_REQUEST['taxonomy'])) {
             global $pp_admin_terms_listing;
             require_once dirname(__FILE__) . '/term-listing-ui_pp.php';
             $pp_admin_terms_listing = new PP_TermsAdmin();
         }
     } elseif (in_array($pagenow, array('plugins.php', 'plugin-install.php'))) {
         global $pp_plugin_admin;
         require_once dirname(__FILE__) . '/admin-plugins_pp.php';
         $pp_plugin_admin = new PP_Plugin_Admin();
     } else {
         if (strpos($_SERVER['REQUEST_URI'], 'page=pp-groups') && isset($_REQUEST['wp_screen_options'])) {
             require_once dirname(__FILE__) . '/ui-helper_pp.php';
             PP_UI_Helper::handle_screen_options();
         }
         if (in_array($pp_plugin_page, array('pp-edit-permissions'))) {
             // pp-group-new
             add_action('admin_head', array(&$this, 'load_scripts'));
         } elseif (in_array($pp_plugin_page, array('pp-settings', 'pp-about'))) {
             wp_enqueue_style('plugin-install');
             wp_enqueue_script('plugin-install');
             add_thickbox();
         }
     }
     if ($is_post_admin) {
         do_action('pp_post_admin');
     }
     add_action('admin_head', array(&$this, 'admin_head'));
     wp_enqueue_style('pp', PP_URLPATH . '/admin/css/pp.css', array(), PPC_VERSION);
     if (0 === strpos($pp_plugin_page, 'pp-')) {
         wp_enqueue_style('pp-plugin-pages', PP_URLPATH . '/admin/css/pp-plugin-pages.css', array(), PPC_VERSION);
     }
     if (in_array($pagenow, array('user-edit.php', 'user-new.php', 'profile.php'))) {
         wp_enqueue_style('pp-edit-permissions', PP_URLPATH . '/admin/css/pp-edit-permissions.css', array(), PPC_VERSION);
         wp_enqueue_style('pp-groups-checklist', PP_URLPATH . '/admin/css/pp-groups-checklist.css', array(), PPC_VERSION);
         if (!pp_wp_ver('3.8')) {
             wp_enqueue_style('pp-edit-perm-legacy', PP_URLPATH . '/admin/css/pp-edit-permissions-legacy.css', array(), PPC_VERSION);
         }
     } elseif (in_array($pp_plugin_page, array('pp-edit-permissions', 'pp-group-new'))) {
         wp_enqueue_style('pp-edit-permissions', PP_URLPATH . '/admin/css/pp-edit-permissions.css', array(), PPC_VERSION);
         wp_enqueue_style('pp-groups-checklist', PP_URLPATH . '/admin/css/pp-groups-checklist.css', array(), PPC_VERSION);
         if (!pp_wp_ver('3.8')) {
             wp_enqueue_style('pp-edit-perm-legacy', PP_URLPATH . '/admin/css/pp-edit-permissions-legacy.css', array(), PPC_VERSION);
         }
     } elseif ('pp-settings' == $pp_plugin_page) {
         wp_enqueue_style('pp-settings', PP_URLPATH . '/admin/css/pp-settings.css', array(), PPC_VERSION);
     } elseif ('pp-about' == $pp_plugin_page) {
         wp_enqueue_style('pp-about', PP_URLPATH . '/admin/css/pp-about.css', array(), PPC_VERSION);
     }
     global $pagenow;
     if (in_array($pagenow, array('edit.php', 'post.php')) && pp_wp_ver('3.5-beta')) {
         add_action('admin_menu', array(&$this, 'reinstate_solo_submenus'));
         add_action('network_admin_menu', array(&$this, 'reinstate_solo_submenus'));
     }
     if (in_array($pagenow, array('edit.php', 'post.php', 'post-new.php', 'edit-tags.php', 'index.php')) || !empty($pp_plugin_page)) {
         add_action('admin_notices', array(&$this, 'admin_notice'));
     }
     do_action('pp_admin_ui');
 }