Example #1
0
 function __construct()
 {
     global $pagenow;
     $this->load_config();
     // determine if query filtering has been disabled by option storage or API
     global $pp_plugin_page;
     $no_filter_uris = apply_filters('pp_nofilter_uris', array());
     if (defined('DOING_CRON') && pp_doing_cron() || pp_unfiltered() && !is_user_logged_in() || in_array($pagenow, $no_filter_uris) || in_array($pp_plugin_page, (array) $no_filter_uris) || defined('PP_DISABLE_QUERYFILTERS') && PP_DISABLE_QUERYFILTERS) {
         $this->filtering_enabled = false;
     }
     // legacy extension API (todo: check property instead)
     if (!defined('PP_ENABLE_QUERYFILTERS')) {
         define('PP_ENABLE_QUERYFILTERS', $this->filtering_enabled);
     }
     if (!($this->direct_file_access = isset($_REQUEST['pp_rewrite']) && !empty($_REQUEST['attachment']))) {
         $this->add_main_filters();
     }
     // no further filtering on plugin-install.php, plugin-editor.php unless it's for one of our own
     if (is_admin() && $this->plugin_page_bail()) {
         return;
     }
     // configuration / filter additions which depend on whether the current user is an Administrator
     $this->load_user_config();
     if (is_admin() && 'async-upload.php' != $pagenow && !defined('XMLRPC_REQUEST')) {
         // don't load admin filters on Ajax calls, but PP Collaborative Editing < 2.2 loads post maintenance filters on 'pp_admin_ui' action
         $skip_ui_filters = defined('DOING_AJAX') && DOING_AJAX && (!defined('PPCE_VERSION') || version_compare(PPCE_VERSION, '2.2', '>='));
         if (!$skip_ui_filters) {
             // filters which are only needed for the wp-admin UI
             global $pp_admin;
             require_once dirname(__FILE__) . '/admin/admin-ui_pp.php';
             $pp_admin = new PP_AdminUI();
         }
     }
     add_filter('the_posts', array(&$this, 'flt_posts_listing'), 50);
     do_action('pp_init');
 }
Example #2
0
function pp_is_front()
{
    return !is_admin() && !defined('XMLRPC_REQUEST') && !defined('DOING_AJAX') && !pp_doing_cron();
}