本文整理汇总了PHP中ShortcodeHelper::clean_up_shortcode方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeHelper::clean_up_shortcode方法的具体用法?PHP ShortcodeHelper::clean_up_shortcode怎么用?PHP ShortcodeHelper::clean_up_shortcode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShortcodeHelper
的用法示例。
在下文中一共展示了ShortcodeHelper::clean_up_shortcode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: meta_box_save
/**
*set status of builder (open/closed) and save the shortcodes that are used in the post
**/
public function meta_box_save()
{
if (isset($_POST['post_ID'])) {
//save if the editor is active
if (isset($_POST['aviaLayoutBuilder_active'])) {
update_post_meta((int) $_POST['post_ID'], '_aviaLayoutBuilder_active', $_POST['aviaLayoutBuilder_active']);
$_POST['content'] = ShortcodeHelper::clean_up_shortcode($_POST['content']);
}
//save the hidden container with unmodified shortcode
if (isset($_POST['_aviaLayoutBuilderCleanData'])) {
update_post_meta((int) $_POST['post_ID'], '_aviaLayoutBuilderCleanData', $_POST['_aviaLayoutBuilderCleanData']);
}
//extract all shortcodes from the post array and store them so we know what we are dealing with when the user opens a page.
//usesfull for special elements that we might need to render outside of the default loop like fullscreen slideshows
preg_match_all("/" . ShortcodeHelper::get_fake_pattern() . "/s", $_POST['content'], $matches);
if (is_array($matches) && !empty($matches[0])) {
$matches = ShortcodeHelper::build_shortcode_tree($matches);
update_post_meta((int) $_POST['post_ID'], '_avia_builder_shortcode_tree', $matches);
}
}
}
示例2: save_builder_template
/**
* Ajax Function that checks if template can be saved
*
*/
public function save_builder_template($name = "%", $value = "")
{
check_ajax_referer('avia_nonce_save', 'avia-save-nonce');
$name = isset($_POST['templateName']) ? $_POST['templateName'] : $name;
$value = isset($_POST['templateValue']) ? $_POST['templateValue'] : $value;
$id = AviaStoragePost::get_custom_post('template_builder_snippets');
$key = $this->generate_key($name);
$old = $this->get_meta_values($key);
if (!empty($old)) {
echo __('Template name already in use. Please delete the template with this name first or choose a different name', 'avia_framework');
} else {
$value = ShortcodeHelper::clean_up_shortcode($value);
$result = update_post_meta($id, $key, '{{{' . $name . '}}}' . $value);
echo 'avia_template_saved';
}
die;
}