function builder_pods_integration_replace_template_redirect() { global $pod_page_exists; if (!isset($pod_page_exists) && function_exists('pod_page_exists')) { $pod_page_exists =& pod_page_exists(); } if (!is_array($pod_page_exists) || !isset($pod_page_exists['page_template'])) { return; } if (preg_match('/^builder-layout::/', $pod_page_exists['page_template'])) { add_filter('builder_filter_current_layout', 'builder_pods_integration_filter_current_layout'); } else { if (!empty($pod_page_exists['page_template'])) { return; } } global $pods_init; remove_action('template_redirect', array(&$pods_init, 'template_redirect')); add_action('template_redirect', 'builder_pods_integration_template_redirect'); }
/** * Constructor - Pods Initialization * * @license http://www.gnu.org/licenses/gpl-2.0.html */ function __construct() { global $pod_page_exists, $pods; // Activate and Install register_activation_hook(__FILE__, array($this, 'activate')); add_action('wpmu_new_blog', array($this, 'new_blog'), 10, 6); $installed = get_option('pods_version'); if (0 < strlen($installed) && false === strpos($installed, '.')) { $installed = pods_version_to_point($installed); } if (version_compare($installed, PODS_VERSION, '<')) { $this->setup(); } elseif (version_compare($installed, PODS_VERSION, '>')) { delete_option('pods_version'); add_option('pods_version', PODS_VERSION); } add_action('init', array($this, 'init')); add_action('after_setup_theme', array($this, 'deprecated')); add_action('admin_menu', array($this, 'admin_menu'), 99); add_action('template_redirect', array($this, 'template_redirect')); add_action('delete_attachment', array($this, 'delete_attachment')); add_shortcode('pods', 'pods_shortcode'); if (!defined('PODS_DISABLE_POD_PAGE_CHECK')) { $pod_page_exists = pod_page_exists(); if (false !== $pod_page_exists) { add_action('wp_head', array($this, 'wp_head')); add_filter('redirect_canonical', array($this, 'kill_redirect')); add_filter('wp_title', array($this, 'wp_title'), 0, 3); add_filter('body_class', array($this, 'body_class'), 0, 1); add_filter('status_header', array($this, 'status_header')); if (defined('PODS_PAGE_PRECODE_TIMING') && false !== PODS_PAGE_PRECODE_TIMING) { add_action('after_setup_theme', array($this, 'precode')); } else { add_action('plugins_loaded', array($this, 'precode')); } add_action('wp', array($this, 'silence_404')); } } }
/** * Check if a Pod Page exists */ public function page_check() { if (self::$checked) { return; } global $pods; // Fix any global confusion wherever this runs if (isset($pods) && !isset($GLOBALS['pods'])) { $GLOBALS['pods'] =& $pods; } elseif (!isset($pods) && isset($GLOBALS['pods'])) { $pods =& $GLOBALS['pods']; } if (!defined('PODS_DISABLE_POD_PAGE_CHECK') || !PODS_DISABLE_POD_PAGE_CHECK) { if (null === self::$exists) { self::$exists = pod_page_exists(); } if (false !== self::$exists) { $pods = apply_filters('pods_global', $pods, self::$exists); if (!is_wp_error($pods) && (is_object($pods) || 404 != $pods)) { add_action('template_redirect', array($this, 'template_redirect')); add_filter('redirect_canonical', '__return_false'); add_action('wp_head', array($this, 'wp_head')); add_filter('wp_title', array($this, 'wp_title'), 0, 3); add_filter('body_class', array($this, 'body_class'), 0, 1); add_filter('status_header', array($this, 'status_header')); add_action('after_setup_theme', array($this, 'precode')); add_action('wp', array($this, 'silence_404'), 1); // Genesis theme integration add_action('genesis_loop', 'pods_content', 11); } } self::$checked = true; } }