public function onContentPrepare($context, &$article, &$params, $limitstart) { if (!JFactory::getApplication()->isAdmin()) { JHtml::_('jquery.framework'); $document = JFactory::getDocument(); $type = $document->getType(); if ($type == 'html') { $currentHeadData = $document->getHeadData(); $path = JPATH_PLUGINS . str_replace("plugins", "", strstr(realpath(dirname(__FILE__)), 'plugins')); require_once 'core/shortcode_include.php'; importShortCodeFiles($path); $data = do_shortcode(shortcode_unautop($article->text)); $newHeadData = $document->getHeadData(); $scripts = (array) array_diff_key($currentHeadData['scripts'], $newHeadData['scripts']); $styles = (array) array_diff_key($currentHeadData['styleSheets'], $newHeadData['styleSheets']); $finalHeadData = ''; foreach ($scripts as $key => $type) { $document->addScript($key); } foreach ($styles as $key => $type) { $document->addStyleSheet($key); } $article->text = $data; } } }
function headermenus($atts, $content = null) { extract(shortcode_atts(array('title' => ''), $atts)); $output = '<h3>' . $title . '</h3>'; $output .= '<ul class="menulist unstyled">' . trim(do_shortcode(shortcode_unautop($content))) . '</ul>'; return $output; }
function st_remove_wpautop($content) { if (function_exists('wpb_js_remove_wpautop')) { $content = wpautop(preg_replace('/<\\/?p\\>/', "\n", $content) . "\n"); return do_shortcode(shortcode_unautop($content)); } }
function ts_our_clients_func($atts, $content = null) { extract(shortcode_atts(array('header' => ''), $atts)); $rand = rand(15000, 50000); return ' <section class="widget widget_our_clients"> <h2 class="title">' . $header . '</h2> <div class="separator"><div></div></div> <div class="pagination"></div> <div class="grid_12"> <div class="widget_our_clients-container flexslider clearfix" id="flexslider-' . $rand . '"> <ul class="slides"> ' . do_shortcode(shortcode_unautop($content)) . ' </ul> </div> </div> </section> <script type="text/javascript">// <![CDATA[ jQuery(document).ready(function() { jQuery("#flexslider-' . $rand . '").flexslider({ animation: "slide", controlNav: false, directionNav: true, itemWidth: 200, itemMargin: 0, minItems: 1, maxItems: 5, move:1 }); }); // ]]> </script>'; }
/** * Display the testimonial content. * * @param null $length * * @since 1.24.0 * @since 2.4.0 Run content through selected filters only, instead * of all filters added to the_excerpt() or the_content(). * * @todo Use native auto-excerpt and trim_words instead. */ function wpmtst_the_content($length = null) { if ($length) { $excerpt = false; } else { $excerpt = WPMST()->atts('excerpt'); $length = WPMST()->atts('length'); } // In View settings, {excerpt} overrides {length} overrides {full content}. if ($excerpt) { $content = get_the_excerpt(); $content = apply_filters('the_excerpt', $content); } else { if ($length) { $content = wpmtst_get_field('truncated', array('char_limit' => $length)); } else { $content = get_the_content(); } // Applying all content filters breaks POS NextGEN Gallery. // So need to find a way to select which additional filters, if any, to apply. // For instance, All In One Rich Snippets. //$content = apply_filters( 'the_content', $content ); $content = wptexturize($content); $content = convert_smilies($content); $content = wpautop($content); $content = shortcode_unautop($content); $content = do_shortcode($content); } echo $content; }
public function shortcode_item($atts, $content = null) { $attributes = shortcode_atts(array('title' => ''), $atts); $attributes['title'] = wp_kses($attributes['title'], array()); $output = sprintf('<li><a class="text-primary" href="#">%s</a><div class="st-content">%s</div></li>', $attributes['title'], do_shortcode(shortcode_unautop(wpautop($content)))); return $output; }
function remove_wpautop($content) { $content = do_shortcode(shortcode_unautop($content)); $new_content = preg_replace('#^<\\/p>|^<br \\/>|<p>$#', '', $content); $new_content = str_replace('<br />', "", $new_content); return $new_content; }
public function contentAdmin($atts, $content = null) { /** * @var string @el_class - comes */ extract(shortcode_atts($this->predefined_atts, $atts)); $output = ''; $column_controls = $this->getControls($this->settings('controls')); $output .= '<div ' . $this->mainHtmlBlockParams('12', '') . '>'; $output .= $column_controls; $output .= '<div ' . $this->containerHtmlBlockParams('12', '') . '>'; $output .= $this->itemGrid(); $output .= do_shortcode(shortcode_unautop($content)); $output .= '</div>'; if (isset($this->settings['params'])) { $inner = ''; foreach ($this->settings['params'] as $param) { $param_value = isset(${$param}['param_name']) ? ${$param}['param_name'] : ''; if (is_array($param_value)) { // Get first element from the array reset($param_value); $first_key = key($param_value); $param_value = $param_value[$first_key]; } $inner .= $this->singleParamHtmlHolder($param, $param_value); } $output .= $inner; } $output .= '</div>'; $output .= '</div>'; return $output; }
protected static function contentHelper($content, $pre = 'c') { if (strpos($content, '[_') !== false) { $content = preg_replace('@(\\[_*)_(' . $pre . '|/)@', "\$1\$2", $content); } return do_shortcode(shortcode_unautop($content)); }
function bic_rm_wpautop($content) { $content = do_shortcode(shortcode_unautop($content)); $content = preg_replace('#^<\\/p>|^<br \\/>|<p>$#', '', $content); //$content = str_replace("</p>", "<br />", $content); return $content; }
function lpd_js_remove_wpautop($content, $autop = false) { if ($autop) { $content = wpautop(preg_replace('/<\\/?p\\>/', "\n", $content) . "\n"); } return do_shortcode(shortcode_unautop($content)); }
function wpsight_format_content($content) { if (!$content) { return; } $content = do_shortcode(shortcode_unautop(wpautop(convert_chars(convert_smilies(wptexturize($content)))))); return apply_filters('wpsight_format_content', $content); }
function elite_animation_right($atts, $content = null) { $content = do_shortcode($content); // Allow other shortcodes inside the column content. if (false !== strpos($content, '[')) { $content = do_shortcode(shortcode_unautop($content)); } return sprintf('<div class="cbp-so-side cbp-so-side-right">%s</div>', $content); }
function seed_ucp_description() { $o = seed_ucp_get_settings(); extract($o); $output = ''; if (!empty($description)) { $output .= '<div id="seed-ucp-description">' . shortcode_unautop(wpautop(convert_chars(wptexturize($description)))) . '</div>'; } return $output; }
/** * Properly parse content to detect images/text keywords. * @since 4.4 * * @param $content * * @return string */ public function filterResults($content) { /** * @since 4.4.3 * vc_filter: vc_vendor_yoastseo_filter_results */ do_action('vc_vendor_yoastseo_filter_results'); $content = do_shortcode(shortcode_unautop($content)); return $content; }
protected function render() { $shortcode = $this->get_settings('shortcode'); $shortcode = do_shortcode(shortcode_unautop($shortcode)); ?> <div class="elementor-shortcode"><?php echo $shortcode; ?> </div> <?php }
/** * Helper function for removing automatic p and br tags from nested short codes */ function return_clean($content, $p_tag = false, $br_tag = false) { $content = preg_replace('#^<\\/p>|^<br \\/>|<p>$#', '', $content); if ($br_tag) { $content = preg_replace('#<br \\/>#', '', $content); } if ($p_tag) { $content = preg_replace('#<p>|</p>#', '', $content); } return do_shortcode(shortcode_unautop(trim($content))); }
function labels($atts = null, $content = null) { extract(shortcode_atts(array('type' => ''), $atts)); $content = do_shortcode(shortcode_unautop($content)); if ($type == 'heading') { $out = '<span class="labelHeading">' . $content . '</span>'; return $out; } else { return $content; } }
/** * Convert a Visual Composer nested child element data into an array * @param string $child_shortcode_content the nested child elements shortcodes * @return array */ static function get_child_elements_data($child_shortcode_content) { // Convert the shortcode to the actual content $content = do_shortcode(shortcode_unautop($child_shortcode_content)); $json_array = explode(PHP_EOL, $content); // Remove the first element of the json_array since it will be always empty array_shift($json_array); // Create a valid JSON $json = '[' . implode(',', $json_array) . ']'; // return an associative array or the data return json_decode($json, true); }
public function dh_tooltip_shortcode($atts, $content = null) { $tooltip = ''; extract(shortcode_atts(array('text' => '', 'url' => '#', 'type' => '', 'position' => '', 'title' => '', 'trigger' => ''), $atts)); $data_el = ''; if (!empty($type)) { $data_el = ' data-toggle="' . $type . '" data-container="body" data-original-title="' . ($type === 'tooltip' ? esc_attr(do_shortcode(shortcode_unautop($content))) : esc_attr($title)) . '" data-trigger="' . $trigger . '" data-placement="' . $position . '" ' . ($type === 'popover' ? ' data-content="' . esc_attr(do_shortcode(shortcode_unautop($content))) . '"' : '') . ''; } if (!empty($data_el)) { $tooltip = '<a' . $data_el . ' href="' . esc_url($url) . '">' . do_shortcode(shortcode_unautop($text)) . '</a>'; } return $tooltip; }
/** * Content filter for only "un-auto-p'ing" allowed shortcodes. This is a wrapper for `shortcode_unautop()`. * * @since 1.0.0 * @access public * @param string $content * @return string */ function mb_shortcode_unautop($content) { global $shortcode_tags; $temp = $shortcode_tags; foreach ($shortcode_tags as $tag => $func) { if (!in_array($tag, mb_get_allowed_shortcodes())) { remove_shortcode($tag); } } $content = shortcode_unautop($content); $shortcode_tags = $temp; return $content; }
public function shortcode_item($atts, $content = null) { extract(shortcode_atts(array('image' => ''), $atts)); $image = esc_url($image); if (isset(self::$atts['style']) && '3' == self::$atts['style']) { $content = '<div>' . $content . '</div>'; if ($image) { $content = sprintf('<div><img src="%s" class="list-img" alt="" /></div>%s', $image, $content); } $content = '<div class="wf-table">' . $content . '</div>'; } $output = sprintf('<li>%s</li>', do_shortcode(shortcode_unautop(wpautop($content)))); return $output; }
function sdm_get_item_description_output($id) { $item_description = get_post_meta($id, 'sdm_description', true); $isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : ''; //$isset_item_description = apply_filters('the_content', $isset_item_description); $isset_item_description = do_shortcode($isset_item_description); $isset_item_description = wptexturize($isset_item_description); $isset_item_description = convert_smilies($isset_item_description); $isset_item_description = convert_chars($isset_item_description); $isset_item_description = wpautop($isset_item_description); $isset_item_description = shortcode_unautop($isset_item_description); $isset_item_description = prepend_attachment($isset_item_description); return $isset_item_description; }
/** * Format events excerpt view. * * @param string $text Content to excerpt. * * @return string Formatted event excerpt. */ public function event_excerpt($text) { if (!$this->_registry->get('acl.aco')->is_our_post_type()) { return $text; } $event = $this->_registry->get('model.event', get_the_ID()); $post = $this->_registry->get('view.event.post'); $ob = $this->_registry->get('compatibility.ob'); $ob->start(); $this->excerpt_view($event); // Re-apply any filters to the post content that normally would have // been applied if it weren't for our interference (below). echo shortcode_unautop(wpautop($post->trim_excerpt($event))); return $ob->get_clean(); }
/** * Actual processing of the shortcode happens here. */ function dt_run_puny_shortcode($content) { global $shortcode_tags; // Backup current registered shortcodes and clear them all out $orig_shortcode_tags = $shortcode_tags; remove_all_shortcodes(); foreach (dt_get_puny_shortcodes() as $shortcode => $callback) { add_shortcode($shortcode, $callback); } // Do the shortcode (only the one above is registered) $content = do_shortcode(shortcode_unautop($content)); // Put the original shortcodes back $shortcode_tags = $orig_shortcode_tags; return $content; }
/** * Content formatter. * * @since 1.0.0 * * @param sting $content Content */ function themeblvd_content_formatter($content) { $new_content = ''; $pattern_full = '{(\\[raw\\].*?\\[/raw\\])}is'; $pattern_contents = '{\\[raw\\](.*?)\\[/raw\\]}is'; $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($pieces as $piece) { if (preg_match($pattern_contents, $piece, $matches)) { $new_content .= $matches[1]; } else { $new_content .= shortcode_unautop(wpautop(wptexturize($piece))); } } return $new_content; }
function parse_shortcode_content($content) { $content = trim(do_shortcode(shortcode_unautop($content))); // 去除首尾空格 if (substr($content, 0, 4) == '') { $content = substr($content, 4); } if (substr($content, -3, 3) == '') { $content = substr($content, 0, -3); } // 去除空换行 $content = str_replace(array('<p></p>'), '', $content); $content = str_replace(array('<p> </p>'), '', $content); return $content; }
/** * Properly parse content to detect images/text keywords. * @since 4.4 * * @param $content * * @return string */ public function filterResults($content) { if (empty($this->parsedContent)) { global $post, $wp_the_query; $wp_the_query->post = $post; // since 4.5.3 to avoid the_post replaces /** * @since 4.4.3 * vc_filter: vc_vendor_yoastseo_filter_results */ do_action('vc_vendor_yoastseo_filter_results'); $this->parsedContent = do_shortcode(shortcode_unautop($content)); wp_reset_query(); } return $this->parsedContent; }
function parse_shortcode_content($content) { /* Parse nested shortcodes and add formatting. */ $content = trim(do_shortcode(shortcode_unautop($content))); /* Remove '' from the start of the string. */ if (substr($content, 0, 4) == '') { $content = substr($content, 4); } /* Remove '' from the end of the string. */ if (substr($content, -3, 3) == '') { $content = substr($content, 0, -3); } /* Remove any instances of ''. */ $content = str_replace(array('<p></p>'), '', $content); $content = str_replace(array('<p> </p>'), '', $content); return $content; }
function liveeditor_elements($atts, $content = '') { $newcontent = $content; if (defined('OP_AJAX_SHORTCODE') && isset($GLOBALS['OP_LIVEEDITOR_DEPTH']) && $GLOBALS['OP_LIVEEDITOR_DEPTH'] === 1 && $GLOBALS['OP_ADD_ELEMENT_ROWS'] === true) { $mc = preg_match_all('/' . op_shortcode_regex('op_liveeditor_element') . '/s', $content, $matches); $new_content = ''; if ($mc > 0) { for ($i = 0; $i < $mc; $i++) { $sc = op_clean_shortcode_content($matches[5][$i]); $new_content .= '<div class="row element-container cf"><div class="op-element-links"><a class="element-settings" href="#settings"><img alt="' . __('Edit Element', OP_SN) . '" title="' . __('Edit Element', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-advanced" href="#op-le-advanced"><img alt="' . __('Advanced Element Options', OP_SN) . '" title="' . __('Advanced Element Options', OP_SN) . '" src="' . OP_IMG . 'pencil.png" /></a><a class="element-move" href="#move"><img alt="' . __('Move', OP_SN) . '" src="' . OP_IMG . 'move-icon.png" /></a><a class="element-delete" href="#delete"><img alt="' . __('Remove Element', OP_SN) . '" src="' . OP_IMG . 'remove-row.png" /></a></div><div class="op-hidden op-waiting"><img class="op-bsw-waiting op-show-waiting" alt="" src="images/wpspin_light.gif" /></div><div class="element">' . do_shortcode(shortcode_unautop(wpautop($sc))) . '</div><div class="op-hidden"><textarea class="op-le-child-shortcode" name="shortcode[]">' . op_attr(trim(shortcode_unautop($sc))) . '</textarea></div></div>'; } } return $new_content; } $newcontent = do_shortcode(op_clean_shortcode_content($content)) . (defined('OP_LIVEEDITOR') ? '<a href="#add_element" class="add-new-element"><img src="' . OP_IMG . '/live_editor/add_new.png" alt="' . __('Add Element', OP_SN) . '"><span>' . __('Add Element', OP_SN) . '</span></a>' : ''); return $newcontent; }