本文整理汇总了PHP中EE_Registry::CFG方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Registry::CFG方法的具体用法?PHP EE_Registry::CFG怎么用?PHP EE_Registry::CFG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Registry
的用法示例。
在下文中一共展示了EE_Registry::CFG方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset_posts_page_shortcode_for_post
/**
* unset_post_shortcodes_on_delete
*
* @access protected
* @param int $ID
* @param $shortcode_class
* @param $shortcode_posts
* @param $page_for_posts
* @param bool $update_post_shortcodes
* @return bool
*/
protected static function unset_posts_page_shortcode_for_post($ID, $shortcode_class, $shortcode_posts, $page_for_posts, $update_post_shortcodes = false)
{
// make sure that an array of post IDs is being tracked for each shortcode
if (!is_array($shortcode_posts)) {
\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array($shortcode_posts => true);
$update_post_shortcodes = true;
}
// now if the ID of the post being deleted is in the $shortcode_posts array
if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) {
unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]);
$update_post_shortcodes = true;
}
// if nothing is registered for that shortcode anymore, then delete the shortcode altogether
if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) {
unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]);
$update_post_shortcodes = true;
}
return $update_post_shortcodes;
}