/** * Get conditional restrictions * and authorize access for user * * @since 0.1 * @return void */ public function authorize_access() { if ($this->_has_global_access()) { return; } $posts = WPCACore::get_posts(RUA_App::TYPE_RESTRICT); if ($posts) { $kick = 0; $levels = array_flip($this->_get_user_levels()); foreach ($posts as $post) { if (!isset($levels[$post->ID])) { $kick = $post->ID; } else { $kick = 0; break; } } if ($kick) { $action = $this->metadata()->get('handle')->get_data($kick); self::$page = $this->metadata()->get('page')->get_data($kick); switch ($action) { case 0: if (self::$page != get_the_ID()) { wp_safe_redirect(get_permalink(self::$page)); exit; } break; case 1: add_filter('the_content', array($this, 'content_tease'), 8); break; default: break; } return; } } }
/** * Runs is_active_sidebar for sidebars * Widget management in Theme Customizer * expects this * * @global type $wp_customize * @since 2.2 * @return void */ public function sidebar_notify_theme_customizer() { global $wp_customize; if (!empty($wp_customize)) { $sidebars = WPCACore::get_posts(CAS_App::TYPE_SIDEBAR); if ($sidebars) { foreach ($sidebars as $sidebar) { is_active_sidebar(CAS_App::SIDEBAR_PREFIX . $sidebar->ID); } } } }