/**
  *    parse_post_content_on_save
  *
  *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
  *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before the_content() runs.
  *    this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the shortcodes are actually used on
  *
  * @access    public
  * @param int     $post_ID
  * @param \WP_Post $post
  * @return    void
  */
 public static function parse_post_content_on_save($post_ID, $post)
 {
     // if the post is trashed, then let's remove our post shortcode tracking
     if ($post instanceof \WP_Post && $post->post_status === 'trash') {
         PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID);
         return;
     }
     // default post types
     $post_types = array('post' => 0, 'page' => 1);
     // add CPTs
     $CPTs = \EE_Register_CPTs::get_CPTs();
     $post_types = array_merge($post_types, $CPTs);
     // for default or CPT posts...
     if (isset($post_types[$post->post_type])) {
         // post on frontpage ?
         $page_for_posts = \EE_Config::get_page_for_posts();
         if ($post->post_name === $page_for_posts) {
             PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts);
             return;
         }
         // array of shortcodes indexed by post name
         \EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes) ? \EE_Registry::CFG()->core->post_shortcodes : array();
         // whether to proceed with update
         $update_post_shortcodes = false;
         // empty both arrays
         \EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array();
         // check that posts page is already being tracked
         if (!isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
             // if not, then ensure that it is properly added
             \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
         }
         // loop thru shortcodes
         foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
             // convert to UPPERCASE to get actual shortcode
             $EES_Shortcode = strtoupper($EES_Shortcode);
             // is the shortcode in the post_content ?
             if (strpos($post->post_content, $EES_Shortcode) !== false) {
                 // map shortcode to post names and post IDs
                 \EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
                 // and add this shortcode to the tracking for the blog page
                 PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
                 $update_post_shortcodes = true;
             } else {
                 // shortcode is not present in post content, so check if we were tracking it previously
                 // stop tracking if shortcode is not used in this specific post
                 if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) {
                     unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]);
                     $update_post_shortcodes = true;
                 }
                 // make sure that something is set for the shortcode posts (even though we may remove this)
                 $shortcode_posts = isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]) ? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] : array();
                 // and stop tracking for this shortcode on the blog page if it is not used
                 $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post($post_ID, $EES_Shortcode, $shortcode_posts, $page_for_posts, $update_post_shortcodes) ? true : $update_post_shortcodes;
             }
         }
         if ($update_post_shortcodes) {
             PostShortcodeTracking::update_post_shortcodes($page_for_posts);
         }
     }
 }
 /**
  * 	_set_CPT_taxonomies
  *
  * 	@access private
  * 	@return void
  */
 private function _set_CPT_taxonomies()
 {
     // check if taxonomies have already been set
     if (empty($this->_CPT_taxonomies)) {
         // and that this CPT has taxonomies registered for it
         if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) {
             // if so then grab them, but we want the taxonomy name as the key
             $taxonomies = array_flip($this->CPT['args']['taxonomies']);
             // then grab the list of ALL taxonomies
             $all_taxonomies = EE_Register_CPTs::get_taxonomies();
             foreach ($taxonomies as $taxonomy => $details) {
                 // add details to our taxonomies if they exist
                 $taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL;
             }
             $this->_CPT_taxonomies = $taxonomies;
         }
     }
 }
 /**
  *    parse_post_content_on_save
  *
  *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
  *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before the_content() runs.
  *    this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the shortcodes are actually used on
  *
  * @access    public
  * @param $post_ID
  * @param $post
  * @return    void
  */
 public static function parse_post_content_on_save($post_ID, $post)
 {
     // default post types
     $post_types = array('post' => 0, 'page' => 1);
     // add CPTs
     $CPTs = EE_Register_CPTs::get_CPTs();
     $post_types = array_merge($post_types, $CPTs);
     // for default or CPT posts...
     if (isset($post_types[$post->post_type])) {
         // post on frontpage ?
         $page_for_posts = EE_Config::get_page_for_posts();
         $maybe_remove_from_posts = array();
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
         $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
         // array of shortcodes indexed by post name
         EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
         // whether to proceed with update, if an entry already exists for this post, then we want to update
         $update_post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name]) ? true : false;
         // empty both arrays
         EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
         // check that posts page is already being tracked
         if (!isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
             // if not, then ensure that it is properly added
             EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
         }
         // loop thru shortcodes
         foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
             // convert to UPPERCASE to get actual shortcode
             $EES_Shortcode = strtoupper($EES_Shortcode);
             // is the shortcode in the post_content ?
             if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
                 // map shortcode to post names and post IDs
                 EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
                 // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
                 if (!in_array($EES_Shortcode, $critical_shortcodes)) {
                     // add shortcode to "Posts page" tracking
                     EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
                 }
                 $update_post_shortcodes = TRUE;
                 unset($maybe_remove_from_posts[$EES_Shortcode]);
             } else {
                 $maybe_remove_from_posts[$EES_Shortcode] = $post_ID;
             }
         }
         if ($update_post_shortcodes) {
             // remove shortcodes from $maybe_remove_from_posts that are still being used
             foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $shortcodes) {
                 if ($post_name == $page_for_posts) {
                     continue;
                 }
                 // compute difference between active post_shortcodes array and $maybe_remove_from_posts array
                 $maybe_remove_from_posts = array_diff_key($maybe_remove_from_posts, $shortcodes);
             }
             // now unset unused shortcodes from the $page_for_posts post_shortcodes
             foreach ($maybe_remove_from_posts as $shortcode => $post_ID) {
                 unset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode]);
             }
             EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
         }
     }
 }
 /**
  * Determine whether the current cpt supports page templates or not.
  *
  * @since %VER%
  * @param string $cpt_name The cpt slug we're checking on.
  * @return bool True supported, false not.
  */
 private function _supports_page_templates($cpt_name)
 {
     $cpt_args = EE_Register_CPTs::get_CPTs();
     $cpt_args = isset($cpt_args[$cpt_name]) ? $cpt_args[$cpt_name]['args'] : array();
     return !empty($cpt_args['page_templates']) ? TRUE : FALSE;
 }
 /**
  *    locate_template
  *
  *    locate a template file by looking in the following places, in the following order:
  *        <assumed full absolute server path>
  *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
  *        <server path up to>/wp-content/uploads/espresso/templates/
  *        <server path up to>/wp-content/plugins/<EE4 folder>/templates/<current EE theme>/
  *        <server path up to>/wp-content/plugins/<EE4 folder>/<relative path>
  *    as soon as the template is found in one of these locations, it will be returned or loaded
  *
  * @param array|string $templates array of template file names including extension (or just a single string)
  * @param  array   $template_args an array of arguments to be extracted for use in the template
  * @param  boolean $load          whether to pass the located template path on to the EEH_Template::display_template() method or simply return it
  * @param  boolean $return_string whether to send output immediately to screen, or capture and return as a string
  * @param boolean $check_if_custom If TRUE, this flags this method to return boolean for whether this will generate a custom template or not.
  * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
  * @return mixed
  */
 public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE)
 {
     // first use WP locate_template to check for template in the current theme folder
     $template_path = locate_template($templates);
     if ($check_if_custom && !empty($template_path)) {
         return TRUE;
     }
     // not in the theme
     if (empty($template_path)) {
         // not even a template to look for ?
         if (empty($templates)) {
             // get post_type
             $post_type = EE_Registry::instance()->REQ->get('post_type');
             // get array of EE Custom Post Types
             $EE_CPTs = EE_Register_CPTs::get_CPTs();
             // build template name based on request
             if (isset($EE_CPTs[$post_type])) {
                 $archive_or_single = is_archive() ? 'archive' : '';
                 $archive_or_single = is_single() ? 'single' : $archive_or_single;
                 $templates = $archive_or_single . '-' . $post_type . '.php';
             }
         }
         // currently active EE template theme
         $current_theme = EE_Config::get_current_theme();
         // array of paths to folders that may contain templates
         $template_folder_paths = array(EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, EVENT_ESPRESSO_TEMPLATE_DIR);
         //add core plugin folders for checking only if we're not $check_if_custom
         if (!$check_if_custom) {
             $core_paths = array(EE_PUBLIC . $current_theme, EE_TEMPLATES . $current_theme, EE_PLUGIN_DIR_PATH);
             $template_folder_paths = array_merge($template_folder_paths, $core_paths);
         }
         // now filter that array
         $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
         // array to hold all possible template paths
         $full_template_paths = array();
         // loop through $templates
         foreach ((array) $templates as $template) {
             // while looping through all template folder paths
             foreach ((array) $template_folder_paths as $template_folder_path) {
                 // build up our template locations array by combining our template folder paths with our templates
                 $full_template_paths[] = rtrim($template_folder_path, DS) . DS . $template;
             }
             // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
             array_unshift($full_template_paths, $template);
         }
         // filter final array of full template paths
         $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths);
         // now loop through our final array of template location paths and check each location
         foreach ((array) $full_template_paths as $full_template_path) {
             if (is_readable($full_template_path)) {
                 $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
                 break;
             }
         }
     }
     // if we got it and you want to see it...
     if ($template_path && $load && !$check_if_custom) {
         if ($return_string) {
             return EEH_Template::display_template($template_path, $template_args, TRUE);
         } else {
             EEH_Template::display_template($template_path, $template_args, FALSE);
         }
     }
     return $check_if_custom && !empty($template_path) ? TRUE : $template_path;
 }
 /**
  * filter_wp_comments
  * This simply makes sure that any "private" EE CPTs do not have their comments show up in any wp comment widgets/queries done on frontend
  *
  * @param  array $clauses array of comment clauses setup by WP_Comment_Query
  * @return array array of comment clauses with modifications.
  */
 public function filter_wp_comments($clauses)
 {
     global $wpdb;
     if (strpos($clauses['join'], $wpdb->posts) !== FALSE) {
         $cpts = EE_Register_CPTs::get_private_CPTs();
         foreach ($cpts as $cpt => $details) {
             $clauses['where'] .= $wpdb->prepare(" AND {$wpdb->posts}.post_type != %s", $cpt);
         }
     }
     return $clauses;
 }
예제 #7
0
 /**
  * admin_init
  *
  * @access public
  * @return void
  */
 public function admin_init()
 {
     /**
      * our cpt models must be instantiated on WordPress post processing routes (wp-admin/post.php),
      * so any hooking into core WP routes is taken care of.  So in this next few lines of code:
      * - check if doing post processing.
      * - check if doing post processing of one of EE CPTs
      * - instantiate the corresponding EE CPT model for the post_type being processed.
      */
     if (isset($_POST['action'], $_POST['post_type']) && $_POST['action'] === 'editpost') {
         EE_Registry::instance()->load_core('Register_CPTs');
         EE_Register_CPTs::instantiate_cpt_models($_POST['post_type']);
     }
     /**
      * This code is for removing any set EE critical pages from the "Static Page" option dropdowns on the
      * 'options-reading.php' core WordPress admin settings page.  This is for user-proofing.
      */
     global $pagenow;
     if ($pagenow === 'options-reading.php') {
         add_filter('wp_dropdown_pages', array($this, 'modify_dropdown_pages'));
     }
 }
 /**
  *    locate_template
  *
  *    locate a template file by looking in the following places, in the following order:
  *        <server path up to>/wp-content/themes/<current active WordPress theme>/
  *        <assumed full absolute server path>
  *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
  *        <server path up to>/wp-content/uploads/espresso/templates/
  *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
  *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
  *        <server path up to>/wp-content/plugins/<EE4 folder>/
  *    as soon as the template is found in one of these locations, it will be returned or loaded
  *
  * 		Example:
  * 		  You are using the WordPress Twenty Sixteen theme,
  *        and you want to customize the "some-event.template.php" template,
  * 		  which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
  * 		  Assuming WP is installed on your server in the "/home/public_html/" folder,
  *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
  *
  *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
  *        /relative/path/to/some-event.template.php
  *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
  *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
  *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
  *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
  *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
  *
  * 		  Had you passed an absolute path to your template that was in some other location,
  *        ie: "/absolute/path/to/some-event.template.php"
  * 		  then the search would have been :
  *
  *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
  *        /absolute/path/to/some-event.template.php
  *
  * 		  and stopped there upon finding it in the second location
  *
  * @param array|string $templates array of template file names including extension (or just a single string)
  * @param  array   $template_args an array of arguments to be extracted for use in the template
  * @param  boolean $load          whether to pass the located template path on to the EEH_Template::display_template() method or simply return it
  * @param  boolean $return_string whether to send output immediately to screen, or capture and return as a string
  * @param boolean $check_if_custom If TRUE, this flags this method to return boolean for whether this will generate a custom template or not.
  * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
  * @return mixed
  */
 public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE)
 {
     // first use WP locate_template to check for template in the current theme folder
     $template_path = locate_template($templates);
     if ($check_if_custom && !empty($template_path)) {
         return TRUE;
     }
     // not in the theme
     if (empty($template_path)) {
         // not even a template to look for ?
         if (empty($templates)) {
             // get post_type
             $post_type = EE_Registry::instance()->REQ->get('post_type');
             // get array of EE Custom Post Types
             $EE_CPTs = EE_Register_CPTs::get_CPTs();
             // build template name based on request
             if (isset($EE_CPTs[$post_type])) {
                 $archive_or_single = is_archive() ? 'archive' : '';
                 $archive_or_single = is_single() ? 'single' : $archive_or_single;
                 $templates = $archive_or_single . '-' . $post_type . '.php';
             }
         }
         // currently active EE template theme
         $current_theme = EE_Config::get_current_theme();
         // array of paths to folders that may contain templates
         $template_folder_paths = array(EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, EVENT_ESPRESSO_TEMPLATE_DIR);
         //add core plugin folders for checking only if we're not $check_if_custom
         if (!$check_if_custom) {
             $core_paths = array(EE_PUBLIC . $current_theme, EE_TEMPLATES . $current_theme, EE_PLUGIN_DIR_PATH);
             $template_folder_paths = array_merge($template_folder_paths, $core_paths);
         }
         // now filter that array
         $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
         $templates = is_array($templates) ? $templates : array($templates);
         $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
         // array to hold all possible template paths
         $full_template_paths = array();
         EE_Registry::instance()->load_helper('File');
         // loop through $templates
         foreach ($templates as $template) {
             // normalize directory separators
             $template = EEH_File::standardise_directory_separators($template);
             $file_name = basename($template);
             $template_path_minus_file_name = substr($template, 0, strlen($file_name) * -1);
             // while looping through all template folder paths
             foreach ($template_folder_paths as $template_folder_path) {
                 // normalize directory separators
                 $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
                 // determine if any common base path exists between the two paths
                 $common_base_path = EEH_Template::_find_common_base_path(array($template_folder_path, $template_path_minus_file_name));
                 if ($common_base_path !== '') {
                     // both paths have a common base, so just tack the filename onto our search path
                     $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
                 } else {
                     // no common base path, so let's just concatenate
                     $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
                 }
                 // build up our template locations array by adding our resolved paths
                 $full_template_paths[] = $resolved_path;
             }
             // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
             array_unshift($full_template_paths, $template);
             // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
             array_unshift($full_template_paths, get_stylesheet_directory() . DS . $file_name);
         }
         // filter final array of full template paths
         $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
         // now loop through our final array of template location paths and check each location
         foreach ((array) $full_template_paths as $full_template_path) {
             if (is_readable($full_template_path)) {
                 $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
                 break;
             }
         }
     }
     // if we got it and you want to see it...
     if ($template_path && $load && !$check_if_custom) {
         if ($return_string) {
             return EEH_Template::display_template($template_path, $template_args, TRUE);
         } else {
             EEH_Template::display_template($template_path, $template_args, FALSE);
         }
     }
     return $check_if_custom && !empty($template_path) ? TRUE : $template_path;
 }
 /**
  * Sets the _cpt_model_object property using what has been set for the _cpt_model_name and a given id.
  *
  * @access protected
  * @param int  $id The id to retrieve the model object for. If empty we set a default object.
  * @param bool $ignore_route_check
  */
 protected function _set_model_object($id = NULL, $ignore_route_check = false)
 {
     $model = null;
     if (empty($this->_cpt_model_names) || !$ignore_route_check && !isset($this->_cpt_routes[$this->_req_action]) || $this->_cpt_model_obj instanceof EE_CPT_Base && $this->_cpt_model_obj->ID() === $id) {
         //get out cuz we either don't have a model name OR the object has already been set and it has the same id as what has been sent.
         return;
     }
     //if ignore_route_check is true, then get the model name via EE_Register_CPTs
     if ($ignore_route_check) {
         $model_names = EE_Register_CPTs::get_cpt_model_names();
         $post_type = get_post_type($id);
         if (isset($model_names[$post_type])) {
             $model = EE_Registry::instance()->load_model($model_names[$post_type]);
         }
     } else {
         $model = EE_Registry::instance()->load_model($this->_cpt_model_names[$this->_req_action]);
     }
     if ($model instanceof EEM_Base) {
         $this->_cpt_model_obj = !empty($id) ? $model->get_one_by_ID($id) : $model->create_default_object();
     }
     do_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object');
 }
예제 #10
0
 /**
  *    parse_post_content_on_save
  *
  *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
  *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before the_content() runs.
  *    this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the shortcodes are actually used on
  *
  * @access    public
  * @param $post_ID
  * @param $post
  * @return    void
  */
 public static function parse_post_content_on_save($post_ID, $post)
 {
     // default post types
     $post_types = array('post' => 0, 'page' => 1);
     // add CPTs
     $CPTs = EE_Register_CPTs::get_CPTs();
     $post_types = array_merge($post_types, $CPTs);
     // for default or CPT posts...
     if (isset($post_types[$post->post_type])) {
         // whether to proceed with update
         $update_post_shortcodes = FALSE;
         // post on frontpage ?
         $page_for_posts = EE_Config::get_page_for_posts();
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
         $critical_shortcodes = EE_Registry::instance()->CFG->core->get_critical_pages_shortcodes_array();
         // array of shortcodes indexed by post name
         EE_Registry::instance()->CFG->core->post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
         // empty both arrays
         EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name] = array();
         // loop thru shortcodes
         foreach (EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
             // convert to UPPERCASE to get actual shortcode
             $EES_Shortcode = strtoupper($EES_Shortcode);
             // is the shortcode in the post_content ?
             if (strpos($post->post_content, $EES_Shortcode) !== FALSE) {
                 // map shortcode to post names and post IDs
                 EE_Registry::instance()->CFG->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
                 // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
                 if (!in_array($EES_Shortcode, $critical_shortcodes)) {
                     // check that posts page is already being tracked
                     if (!isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) {
                         // if not, then ensure that it is properly added
                         EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts] = array();
                     }
                     // add shortcode to "Posts page" tracking
                     EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = $post_ID;
                 }
                 $update_post_shortcodes = TRUE;
             }
         }
         if ($update_post_shortcodes) {
             EE_Registry::instance()->CFG->update_post_shortcodes($page_for_posts);
         }
     }
 }
 /**
  * Callback for AHEE__EE_Register_CPTs__construct_end which is used to set the default terms
  *
  * @param EE_Register_CPTs $cpt_class
  *
  * @return void
  */
 public static function default_terms(EE_Register_CPTs $cpt_class)
 {
     foreach (self::$_registry as $registries) {
         foreach ($registries['default_terms'] as $taxonomy => $terms) {
             foreach ($terms as $term => $cpts) {
                 $cpt_class->set_default_term($taxonomy, $term, $cpts);
             }
         }
     }
 }