• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP shortcode_parse_atts函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中shortcode_parse_atts函数的典型用法代码示例。如果您正苦于以下问题:PHP shortcode_parse_atts函数的具体用法?PHP shortcode_parse_atts怎么用?PHP shortcode_parse_atts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了shortcode_parse_atts函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Group items
  *
  * @param type $element
  *
  * @return string
  */
 static function render($element)
 {
     $_element = $element;
     $label_item = isset($element['label_item']) ? $element['label_item'] : '';
     $sub_items = $_element['sub_items'];
     $overwrite_shortcode_data = isset($element['overwrite_shortcode_data']) ? $element['overwrite_shortcode_data'] : true;
     $sub_item_type = $element['sub_item_type'];
     $items_html = array();
     $shortcode_name = str_replace('WR_', '', $element['shortcode']);
     // get id of parameter to extract
     $extract_title = isset($element['extract_title']) ? $element['extract_title'] : '';
     $extra_params = array('drag_handle' => false);
     if ($sub_items) {
         foreach ($sub_items as $idx => $item) {
             $el = new $sub_item_type();
             $el->init_element();
             // check if $item['std'] is empty or not
             $shortcode_data = '';
             if (!$label_item) {
                 $content = __($shortcode_name, WR_PBL) . ' ' . __('Item', WR_PBL) . ' ' . ($idx + 1);
             } else {
                 $content = $label_item . ($idx + 1);
             }
             if (isset($_element['no_title'])) {
                 $content = $_element['no_title'];
             }
             if (!empty($item['std'])) {
                 // keep shortcode data as it is
                 $shortcode_data = $item['std'];
                 // reassign params for shortcode base on std string
                 $extract_params = WR_Pb_Helper_Shortcode::extract_params($item['std']);
                 $params = WR_Pb_Helper_Shortcode::generate_shortcode_params($el->items, NULL, $extract_params, TRUE, FALSE, $content);
                 $el->shortcode_data();
                 $params['extract_title'] = empty($params['extract_title']) ? __('(Untitled)', WR_PBL) : $params['extract_title'];
                 $content = $params['extract_title'];
                 if ($overwrite_shortcode_data) {
                     $shortcode_data = $el->config['shortcode_structure'];
                 }
             }
             $element_type = (array) $el->element_in_pgbldr($content, $shortcode_data, '', '', true, $extra_params);
             foreach ($element_type as $element_structure) {
                 $items_html[$shortcode_data] = $element_structure;
             }
         }
     }
     $style = isset($_element['style']) ? 'style="' . $_element['style'] . '"' : '';
     // Wrap item html to table
     $html = '';
     foreach ($items_html as $shortcode_data => $item_html) {
         if (!empty($extract_title)) {
             $attrs = shortcode_parse_atts($shortcode_data);
             $title = isset($attrs[$extract_title]) ? $attrs[$extract_title] : '';
             $html .= sprintf('<tr><td><b>%s</b></td><td>%s</td></tr>', $title, $item_html);
         }
     }
     $html = sprintf('<table class="%s" %s>%s</table>', 'table table-bordered', $style, balanceTags($html));
     $element_name = isset($_element['name']) ? $_element['name'] : __(ucwords(!$label_item ? $shortcode_name : $label_item), WR_PBL) . ' ' . __('Items', WR_PBL);
     $html_element = "<div id='{$_element['id']}' class='form-group control-group clearfix'><label class='control-label'>{$element_name}</label>\n\t\t\t\t<div class='item-container submodal_frame_2 controls group-table {$_element['class']}'>\n                    <div class='item-container-content jsn-items-list'>\n                    {$html}\n                    </div>\n                </div>\n                </div>";
     return $html_element;
 }
开发者ID:zulfnore,项目名称:WR-PageBuilder,代码行数:67,代码来源:group-table.php


示例2: parse_shortcode_id

 /**
  * Parse the CF7 shortcode ID in single or nested shortcodes
  * @return (array) of CF7 id(s)
  * @since 1.0.2
  */
 function parse_shortcode_id($content)
 {
     $tag = 'contact-form-7';
     // Return if there is no CF7 shortcode in post content
     if (!has_shortcode($content, $tag)) {
         return false;
     }
     // Get all the CF7 form shortcodes in the post content
     // Use similar approach as wp-includes\shortcodes.php has_shortcode() function
     preg_match_all('/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER);
     if (empty($matches)) {
         return false;
     }
     // Loop through shortcodes, parse shortcode attributes and get the CF7 form ID
     foreach ($matches as $shortcode) {
         if ($tag === $shortcode[2]) {
             $atts = shortcode_parse_atts($shortcode[3]);
             $ids[] = $atts['id'];
             // Add the CF7 form ID
             // Nested shortcode
         } elseif (!empty($shortcode[5]) && has_shortcode($shortcode[5], $tag)) {
             // nested shortcodes
             $shortcode = $this->parse_shortcode_id($shortcode[5]);
         }
     }
     // Return all the CF7 form ID
     if (isset($ids)) {
         return $ids;
     }
 }
开发者ID:pabloe01,项目名称:Rawsonenmovimiento,代码行数:35,代码来源:contact.php


示例3: iva_accordion

function iva_accordion($atts, $content)
{
    extract(shortcode_atts(array('animation' => ''), $atts));
    if (!preg_match_all("/(.?)\\[(accordion)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/accordion\\])?(.?)/s", $content, $matches)) {
        return do_shortcode($content);
    } else {
        for ($i = 0; $i < count($matches[0]); $i++) {
            $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
        }
        // Animation Effects
        //--------------------------------------------------------
        $animation = $animation ? ' data-id="' . $animation . '"' : '';
        $out = '<div ' . $animation . ' id="accordion' . rand(1, 9) . '" class="ac_wrap iva_anim">';
        for ($i = 0; $i < count($matches[0]); $i++) {
            $active = isset($matches[3][$i]['active']) == 'true' ? 'active' : '';
            $out .= '<div class="ac_title ' . $active . '"><span class="arrow"></span>';
            if (isset($matches[3][$i]['icon'])) {
                $out .= '<i class="' . $matches[3][$i]['icon'] . '"></i>';
            }
            $out .= $matches[3][$i]['title'] . '</div>';
            $out .= '<div class="ac_content ' . $active . '">' . do_shortcode(trim($matches[5][$i])) . '</div>';
        }
        $out .= '</div>';
        return $out;
    }
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:26,代码来源:accordion.php


示例4: sc_pricing

function sc_pricing($atts, $content = null, $code) {
	if(is_null($content)) return;
	
	preg_match_all('/\[price\b([^\]]*)\]((?:(?!\[\/price\]).)+)\[\/price\]/s', $content, $matches);
	
	$sub_atts = $matches[1];
	$sub_contents = $matches[2];

	$price_count = sizeof($sub_atts);
	
	ob_start();
?>
	<div class="pricing col-<?php echo $price_count?> clearfix">
		<?php for($i=0; $i<$price_count; $i++): ?>
			<?php $sub_atts[$i] = shortcode_parse_atts($sub_atts[$i]); ?>
			<div class="price <?php if($sub_atts[$i]['featured'] == 'true') echo 'featured'?>">
				<h2><?php echo $sub_atts[$i]['title'] ?></h2>
				<h3><?php echo $sub_atts[$i]['amount'] ?></h3>
				<div class="description"><?php echo $sub_contents[$i]?></div>
				<a href="<?php echo $sub_atts[$i]['button_link']?>" title="<?php echo $sub_atts[$i]['button_text']?>" class="button"><?php echo $sub_atts[$i]['button_text']?></a>
			</div>
		<?php endfor ?>
	</div>
<?php
	return ob_get_clean();
}
开发者ID:nyordanov,项目名称:ShortcodeGenerator,代码行数:26,代码来源:demo.php


示例5: translator_template_helper

function translator_template_helper($matches)
{
    $attr = shortcode_parse_atts($matches[3]);
    // anything which is not a slug is not an exercise and passes through unchanged.
    if (!array_key_exists('slug', $attr)) {
        return $matches[0];
    }
    if (!array_key_exists('title', $attr)) {
        pyboxlog('[in translator_template_helper] Warning: ' . $attr['slug'] . ' has no title!');
        $attr['title'] = "";
    }
    $r = '[pyRecall slug="' . $attr['slug'] . '"';
    $to_translate = array('title', 'epilogue', 'right', 'wrong', 'defaultcode');
    foreach ($to_translate as $key) {
        if (array_key_exists($key, $attr)) {
            $r .= ' ' . $key . '="';
            $value = $attr[$key];
            $value = str_replace('"', '""', $value);
            $value = str_replace("\n", '\\n', $value);
            $r .= $value . '"';
        }
    }
    $r .= ']' . $matches[5] . '[/pyRecall]';
    return $r;
}
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:25,代码来源:shortcodes-misc.php


示例6: replace_tag

 /**
  * @param $matches
  *
  * @return string
  */
 protected function replace_tag($matches)
 {
     $tags = $this->all();
     $tag = $matches[1];
     if (isset($tags[$tag])) {
         $config = $tags[$tag];
         $replacement = '';
         if (isset($config['replacement'])) {
             $replacement = $config['replacement'];
         } elseif (isset($config['callback'])) {
             // parse attributes
             $attributes = array();
             if (isset($matches[2])) {
                 $attribute_string = $matches[2];
                 $attributes = shortcode_parse_atts($attribute_string);
             }
             // call function
             $replacement = call_user_func($config['callback'], $attributes);
         }
         return $this->escape_value($replacement);
     }
     // default to not replacing it
     // @todo always replace with empty string?
     return $matches[0];
 }
开发者ID:dannyvankooten,项目名称:mailchimp-for-wordpress,代码行数:30,代码来源:class-dynamic-content-tags.php


示例7: shortcodesOnPost

function shortcodesOnPost()
{
    // get the post data
    global $post;
    // get the shortcode regex
    $pattern = get_shortcode_regex();
    // run regex on the content to find all the shortcodes being used
    preg_match_all('/' . $pattern . '/s', $post->post_content, $matches);
    // only if there are matches
    if (!empty($matches)) {
        //loop through the results
        //$matches[3] contains the atts
        //$matches[2] contains the shortcode name
        //$matches[5] contains the shortcode Data
        foreach ($matches[3] as $key => $arg) {
            $shortcode = $matches[2][$key];
            //check to see if the found code is mine :)
            if ($shortcode == 'myShortCode') {
                // Parse the attributes to an array
                $data = shortcode_parse_atts($arg);
                // get the shortcode content
                $content = $matches[5][$key];
                // wp_enqueue_script
                // wp_enqueue_style
                // for the specific shortcodes used
            }
        }
    }
}
开发者ID:routexl,项目名称:DB-Toolkit,代码行数:29,代码来源:actions.php


示例8: mom_graph

function mom_graph($atts, $content)
{
    extract(shortcode_atts(array('height' => '', 'strips' => ''), $atts));
    if ($strips == 'true') {
        $strips = '<div class="mom_graph_strips"></div>';
    }
    $line_height = '';
    if ($height != '') {
        $line_height = 'line-height:' . ($height + 2) . 'px;';
        $height = 'height:' . $height . 'px;';
    }
    if (!preg_match_all("/(.?)\\[(graph)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/graph\\])?(.?)/s", $content, $matches)) {
        return do_shortcode($content);
    } else {
        for ($i = 0; $i < count($matches[0]); $i++) {
            $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
        }
        $output = '';
        for ($i = 0; $i < count($matches[0]); $i++) {
            $color = '';
            $text_color = '';
            if (isset($matches[3][$i]['color'])) {
                $color = $matches[3][$i]['color'];
            }
            if (isset($matches[3][$i]['text_color'])) {
                $text_color = 'color:' . $matches[3][$i]['text_color'] . ';';
            }
            $output .= '<div class="progress_bar"><span style="' . $text_color . $height . $line_height . '">' . $matches[3][$i]['title'] . ' ' . $matches[3][$i]['score'] . '%</span><div class="progress_wrap"><div class="parograss_text" style="' . $height . '"></div><div class="parograss_inner" style="width:' . $matches[3][$i]['score'] . '%; background-color:' . $color . ';' . $height . '">' . $strips . '</div>
                     </div>
                </div>';
        }
        return '<div class="progress_outer">' . $output . '</div>';
    }
}
开发者ID:justinwool,项目名称:vortago,代码行数:34,代码来源:graph.php


示例9: pl_get_attachment_ids_from_gallery

function pl_get_attachment_ids_from_gallery()
{
    global $post;
    if ($post != null) {
        $attachment_ids = array();
        $pattern = get_shortcode_regex();
        $ids = array();
        //finds the "gallery" shortcode, puts the image ids in an associative array: $matches[3]
        if (preg_match_all('/' . $pattern . '/s', $post->post_content, $matches)) {
            $count = count($matches[3]);
            //in case there is more than one gallery in the post.
            for ($i = 0; $i < $count; $i++) {
                $atts = shortcode_parse_atts($matches[3][$i]);
                if (isset($atts['ids'])) {
                    $attachment_ids = explode(',', $atts['ids']);
                    $ids = array_merge($ids, $attachment_ids);
                }
            }
        }
        return $ids;
    } else {
        $ids = array();
        return $ids;
    }
}
开发者ID:taeche,项目名称:SoDoEx,代码行数:25,代码来源:lib.posts.php


示例10: prefetch_items

 /**
  * Loop over all the content in the main loop and do a request for all the items present so that we're only getting
  * a few API hits instead of all of them. Then, when anything else calls `easyazon_get_item` it will get the cached
  * data and not have to hit the API.
  */
 public static function prefetch_items()
 {
     global $wp_query;
     $identifiers = array_fill_keys(array_keys(easyazon_get_locales()), array());
     $preparsed = array();
     $shortcodes = easyazon_get_shortcodes();
     foreach ($wp_query->posts as $post) {
         preg_match_all('/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER);
         foreach ($matches as $match) {
             $shortcode = trim($match[2]);
             if (in_array($shortcode, $shortcodes)) {
                 $attributes = shortcode_parse_atts($match[3]);
                 $locale = isset($attributes['locale']) ? $attributes['locale'] : false;
                 $identifier = isset($attributes['identifier']) ? $attributes['identifier'] : false;
                 if (!is_array($preparsed[$shortcode])) {
                     $preparsed[$shortcode] = array();
                 }
                 $preparsed[$shortcode][] = $attributes;
                 if ($locale && $identifier) {
                     $identifiers[$locale][] = $identifier;
                 }
             }
         }
     }
     foreach ($identifiers as $locale => $queryable) {
         $cached_items = easyazon_get_items($queryable, $locale);
     }
     self::$preparsed_shortcodes = $preparsed;
 }
开发者ID:sushant-chaudhari-sp,项目名称:easyazon,代码行数:34,代码来源:performance.php


示例11: inbound_shortcode_tabs

function inbound_shortcode_tabs($atts, $content = null)
{
    extract(shortcode_atts(array('heading' => ''), $atts));
    $out = '';
    if (!preg_match_all("/(.?)\\[(tab)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/tab\\])?(.?)/s", $content, $matches)) {
        return do_shortcode($content);
    } else {
        for ($i = 0; $i < count($matches[0]); $i++) {
            $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
        }
        if ($heading != '') {
            $out .= '<div class="heading"><h3>' . $heading . '</h3><div class="sep"></div></div>';
        }
        $out .= '<div class="tabs-content">';
        $out .= '<ul class="tabs-nav clearfix">';
        for ($i = 0; $i < count($matches[0]); $i++) {
            $icon = $matches[3][$i]['icon'] != '' ? '<i class="tab-icon icon-' . $matches[3][$i]['icon'] . '"></i>' : '';
            $out .= '<li><a id="tab_' . $i . '_nav" title="' . $matches[3][$i]['title'] . '" href="#tab_' . $i . '">' . $icon . '<span>' . $matches[3][$i]['title'] . '<span></a></li>';
        }
        $out .= '</ul>';
        $out .= '<div class="tabs">';
        for ($i = 0; $i < count($matches[0]); $i++) {
            $out .= '<div id="tab_' . $i . '">' . do_shortcode(trim($matches[5][$i])) . '</div>';
        }
        $out .= '</div>';
        $out .= '</div>';
        return $out;
    }
}
开发者ID:jyotiprava,项目名称:45serverbackup,代码行数:29,代码来源:tabs.php


示例12: input

 static function input($args, $formdata = false)
 {
     if (false !== $formdata) {
         $form = new scbForm($formdata);
         return $form->input($args);
     }
     if (empty($args['name'])) {
         return trigger_error('Empty name', E_USER_WARNING);
     }
     $args = wp_parse_args($args, array('desc' => '', 'desc_pos' => 'after', 'wrap' => self::TOKEN, 'wrap_each' => self::TOKEN));
     if (isset($args['value']) && is_array($args['value'])) {
         $args['values'] = $args['value'];
         unset($args['value']);
     }
     if (isset($args['extra']) && !is_array($args['extra'])) {
         $args['extra'] = shortcode_parse_atts($args['extra']);
     }
     self::$cur_name = self::get_name($args['name']);
     switch ($args['type']) {
         case 'select':
         case 'radio':
             $input = self::_single_choice($args);
             break;
         case 'checkbox':
             if (isset($args['values'])) {
                 $input = self::_multiple_choice($args);
             } else {
                 $input = self::_checkbox($args);
             }
             break;
         default:
             $input = self::_input($args);
     }
     return str_replace(self::TOKEN, $input, $args['wrap']);
 }
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:35,代码来源:Forms.php


示例13: get_post_gallery_images_gpgi

/**
 * Get Image from Post core file
 *
 * This file contains all the logic required for the plugin
 *
 * @package         Get Post Gallery Images
 * @copyright       Copyright (c) 2013, Sierj Khaletski
 * @license         http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License, v2 (or newer)
 *
 * @since           Get Post Gallery Images 0.1
 */
function get_post_gallery_images_gpgi()
{
    $attachment_ids = array();
    $pattern = get_shortcode_regex();
    $images = array();
    if (preg_match_all('/' . $pattern . '/s', get_the_content(), $matches)) {
        //finds the "gallery" shortcode and puts the image ids in an associative array at $matches[3]
        $count = count($matches[3]);
        //in case there is more than one gallery in the post.
        for ($i = 0; $i < $count; $i++) {
            $atts = shortcode_parse_atts($matches[3][$i]);
            if (isset($atts['ids'])) {
                $attachment_ids = explode(',', $atts['ids']);
                $attachementsCount = count($attachment_ids);
                if ($attachementsCount > 0) {
                    for ($j = 0; $j < $attachementsCount; $j++) {
                        $image = array();
                        $attachmentId = intval($attachment_ids[$j]);
                        $image['id'] = $attachmentId;
                        $image['full'] = wp_get_attachment_image_src($attachmentId, 'full');
                        $image['medium'] = wp_get_attachment_image_src($attachmentId, 'medium');
                        $image['thumbnail'] = wp_get_attachment_image_src($attachmentId, 'thumbnail');
                        array_push($images, $image);
                    }
                }
            }
        }
    }
    return $images;
}
开发者ID:TheML9I,项目名称:get-post-gallery-images,代码行数:41,代码来源:get-post-gallery-images.php


示例14: curly_tabs_vc

function curly_tabs_vc($atts, $content = null)
{
    $GLOBALS['tabsID'] = isset($GLOBALS['tabsID']) ? $GLOBALS['tabsID'] + 1 : 0;
    $GLOBALS['tabsSlideID'] = $GLOBALS['tabsID'] * 100;
    $pattern = get_shortcode_regex();
    preg_match_all("/{$pattern}/", $content, $shortcodes);
    $shortcodes_array = $shortcodes[2];
    $shortcodes_values_array = $shortcodes[3];
    $shortcodes_content_array = $shortcodes[5];
    extract(shortcode_atts(array(), $atts));
    if (has_shortcode($content, 'curly_tab')) {
        $html = '<div class="tabs-container">';
        $html .= '<ul class="nav nav-tabs">';
        $tabs_keys = array_keys($shortcodes_array, 'curly_tab');
        $index = 0;
        foreach ($tabs_keys as $key => $tab) {
            extract(shortcode_atts(array('title' => null), shortcode_parse_atts($shortcodes_values_array[$tab]), 'curly_tab'));
            $html .= '<li class="' . ($index === 0 ? 'active' : '') . '"><a href="#tab' . (100 * $GLOBALS['tabsID'] + 1) . '" data-toggle="tab">' . $title . '</a></li>';
            $index++;
        }
        $html .= '</ul>';
        $html .= '<div class="tab-content">';
        $html .= do_shortcode($content);
        $html .= '</div>';
        $html .= '</div>';
        return $html;
    }
}
开发者ID:raducretu,项目名称:curly-extension,代码行数:28,代码来源:tabs.php


示例15: build

 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     $tag = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
     $fields->render();
     die;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:14,代码来源:class-vc-shortcode-edit-form.php


示例16: build

 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     $tag = vc_post_param('element');
     $shortCode = stripslashes(vc_post_param('shortcode'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortCode));
     $fields->render();
     die;
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:15,代码来源:class-vc-shortcode-edit-form.php


示例17: iva_tabs

function iva_tabs($atts, $content = null, $code)
{
    extract(shortcode_atts(array('type' => '', 'position' => '', 'animation' => ''), $atts));
    $icons = $out = $customtabcolor = $customtabtextcolor = '';
    if ($type == "vertical") {
        $type = 'vertical';
    } else {
        $type = "";
    }
    switch ($position) {
        case 'centertabs':
            $positiontype = "centertabs";
            break;
        case 'righttabs':
            $positiontype = "righttabs";
            break;
        default:
            $positiontype = "";
    }
    if (!preg_match_all("/(.?)\\[(tab)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/tab\\])?(.?)/s", $content, $matches)) {
        return do_shortcode($content);
    } else {
        for ($i = 0; $i < count($matches[0]); $i++) {
            $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
        }
        // Animation Effects
        //--------------------------------------------------------
        $animation = $animation ? ' data-id="' . $animation . '"' : '';
        $tabid = 'tab' . rand(1, 99);
        $out .= '<div ' . $animation . ' id="' . $tabid . '" class="iva_anim systabspane ' . $type . '">';
        $out .= '<ul  class="tabs">';
        for ($i = 0; $i < count($matches[0]); $i++) {
            if (isset($matches[3][$i]['tabcolor'])) {
                if (strpos($matches[3][$i]['tabcolor'], '#') !== false) {
                    $customtabcolor = ' style="background-color:' . $matches[3][$i]['tabcolor'] . '"';
                }
            }
            if (isset($matches[3][$i]['textcolor'])) {
                if (strpos($matches[3][$i]['textcolor'], '#') !== false) {
                    $customtabtextcolor = ' style="color:' . $matches[3][$i]['textcolor'] . '"';
                }
            }
            if (isset($matches[3][$i]['icon'])) {
                $icons = $matches[3][$i]['icon'];
            }
            $out .= '<li class="' . $icons . '"  id="#' . $tabid . $i . '" ' . $customtabcolor . '  ><a ' . $customtabtextcolor . '>' . $matches[3][$i]['title'] . '</a></li>';
        }
        $out .= '</ul>';
        $out .= '<div class="panes">';
        for ($i = 0; $i < count($matches[0]); $i++) {
            $out .= '<div  class="tab_content" id="' . $tabid . $i . '" >' . pre_process_shortcode(do_shortcode(trim($matches[5][$i]))) . '</div>';
        }
        $out .= '</div></div>';
        return $out;
    }
}
开发者ID:pryspry,项目名称:MusicPlay,代码行数:56,代码来源:tabs_toggles.php


示例18: ratings

 /**
  *
  */
 public static function ratings($atts = null, $content = null, $code = null)
 {
     if ($atts == 'generator') {
         $numbers = range(1, 10);
         $scores = array('0.5' => '0.5', '1' => '1', '1.5' => '1.5', '2' => '2', '2.5' => '2.5', '3' => '3', '3.5' => '3.5', '4' => '4', '4.5' => '4.5', '5' => '5');
         $option = array('name' => __('Stars', MISS_ADMIN_TEXTDOMAIN), 'value' => 'ratings', 'options' => array(array('name' => __('Number of Bars', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Select the number of slides you wish to display. Slides are the selectable areas which change the content.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'multiply', 'default' => '', 'options' => $numbers, 'type' => 'select', 'shortcode_multiplier' => true), array('name' => __('Show Total', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Check this option to display total score.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'show_overall', 'default' => '', 'type' => 'checkbox', 'options' => array('true' => __('Enable Total Score', MISS_ADMIN_TEXTDOMAIN)), 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Icon', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select score icon type.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'icon', 'default' => 'im-icon-accessibility', 'type' => 'icons', 'target' => 'all_icons', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Active Colour', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select active icon colour.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'style_color', 'default' => '', 'type' => 'color', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Inactive Colour', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Please select inactive icon colour.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'style_color2', 'default' => '', 'type' => 'color', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Icon size', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Change icon size.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'size', 'default' => '18', 'type' => 'numeral', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Animation', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Turn on CSS3 transitions. You may specify animation effect.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'animation', 'default' => 'im-icon-android', 'type' => 'select', 'target' => 'css_animation', 'shortcode_dont_multiply' => true, 'shortcode_optional_wrap' => false), array('name' => __('Criteria 1 Title', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Enter criteria title.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'content', 'default' => '', 'type' => 'text', 'shortcode_multiply' => true), array('name' => __('Criteria 1 Value', MISS_ADMIN_TEXTDOMAIN), 'desc' => __('Define score value from 0.5 to 5.', MISS_ADMIN_TEXTDOMAIN), 'id' => 'score', 'default' => '', 'type' => 'select', 'options' => $scores, 'shortcode_multiply' => true), array('value' => 'score', 'nested' => true), 'shortcode_has_atts' => true));
         return $option;
     }
     if (!preg_match_all("/(.?)\\[(score)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/score\\])?(.?)/s", $content, $matches)) {
         return miss_content_group($content);
     } else {
         for ($i = 0; $i < count($matches[0]); $i++) {
             $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
         }
         extract(shortcode_atts(array('size' => '18', 'animation' => '', 'icon' => 'im-icon-star'), $atts));
         $out = '';
         $out .= !empty($atts['caption']) ? '<h4><span>' . $atts['caption'] . '</span></h4>' : '';
         $atts['animation'] = !empty($atts['animation']) ? ' im-transform im-animate-element ' . $atts['animation'] : '';
         $atts['size'] = !empty($atts['size']) ? $atts['size'] : '18';
         $atts['style_color'] = !empty($atts['style_color']) ? $atts['style_color'] : '';
         $atts['style_color2'] = !empty($atts['style_color2']) ? $atts['style_color2'] : '';
         $out .= '<ul class="rates">';
         $overall = 0;
         $counter = 0;
         for ($i = 0; $i < count($matches[0]); $i++) {
             $counter++;
             $rating = $matches[3][$i]['score'];
             if (!isset($atts['icon'])) {
                 $atts['icon'] = 'im-icon-star-6';
             }
             $out .= '<li class="rating_row' . $atts['animation'] . '">';
             $out .= $matches[5][$i];
             $out .= '<div class="rating_right">';
             $out .= score_output($rating, $atts['size'], $atts['style_color'], $atts['style_color2'], $atts['icon']);
             $out .= '</div>';
             $out .= '</li>';
             $overall += $rating;
         }
         $out .= '</ul>';
         if (isset($atts['show_overall']) && $atts['show_overall'] == "true") {
             if ($counter > 1) {
                 $out .= '<div class="overall_rating' . $atts['animation'] . '">';
                 $overall = $overall / $counter;
                 $overget = $overall - floor($overall);
                 if ($overget >= 0.5) {
                     $overall = floor($overall) + 0.5;
                 } else {
                     $overall = floor($overall);
                 }
                 $out .= "<h4><span class='uppercase transform-uppercase'>" . __("Total", MISS_TEXTDOMAIN) . "</span></h4><div class='total-inner'><span class='score total'>" . $overall . "</span><span class='right'>" . score_output($overall, '40', $atts['style_color'], $atts['style_color2'], $atts['icon']) . "</span></div>";
                 $out .= '</div>';
             }
         }
         return '<div class="rating_box shortcode">' . $out . '</div>';
     }
 }
开发者ID:schiz,项目名称:scrollax,代码行数:59,代码来源:ratings.php


示例19: build

 /**
  * Build edit form fields
  *
  * @deprecated 4.4
  * @use Vc_Shortcode_Edit_Form::renderFields
  */
 public function build()
 {
     // _deprecated_function( 'Vc_Shortcode_Edit_Form::build', '4.4 (will be removed in 4.10)', 'Vc_Shortcode_Edit_Form::renderFields' );
     $tag = vc_post_param('element');
     vc_user_access()->checkAdminNonce()->validateDie(__('Access denied', 'js_composer'))->wpAny('edit_posts', 'edit_pages')->validateDie(__('Access denied', 'js_composer'))->check('vc_user_access_check_shortcode_edit', $tag)->validateDie(__('Access denied', 'js_composer'));
     $shortcode = stripslashes(vc_post_param('shortcode'));
     require_once vc_path_dir('EDITORS_DIR', 'class-vc-edit-form-fields.php');
     $fields = new Vc_Edit_Form_Fields($tag, shortcode_parse_atts($shortcode));
     $fields->render();
     die;
 }
开发者ID:k2jysy,项目名称:wedev,代码行数:17,代码来源:class-vc-shortcode-edit-form.php


示例20: inbound_shortcode_teaser

function inbound_shortcode_teaser($atts, $content = null)
{
    extract(shortcode_atts(array('heading' => '', 'style' => '', 'column' => '4'), $atts));
    $out = '';
    $grid = ' grid full';
    if ($column == '2') {
        $grid = ' grid one-half';
    }
    if ($column == '3') {
        $grid = ' grid one-third';
    }
    if ($column == '4') {
        $grid = ' grid one-fourth';
    }
    if ($column == '5') {
        $grid = ' grid one-fifth';
    }
    $style = $style != '' ? ' ' . $style : '';
    if (!preg_match_all("/(.?)\\[(block)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/block\\])?(.?)/s", $content, $matches)) {
        return do_shortcode($content);
    } else {
        for ($i = 0; $i < count($matches[0]); $i++) {
            $matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
        }
        $out .= '<div class="row">';
        if ($heading != '') {
            $out .= '<div class="grid full"><div class="heading"><h3>' . $heading . '</h3><div class="sep"></div></div></div>';
        }
        for ($i = 0; $i < count($matches[0]); $i++) {
            $title = $matches[3][$i]['link'] ? '<a class="reserve" href="' . $matches[3][$i]['link'] . '">' . $matches[3][$i]['title'] . '</a>' : $matches[3][$i]['title'];
            $out .= '<aside class="teaser' . $grid . $style . '">';
            if ($matches[3][$i]['image']) {
                $out .= '<div class="teaser-image"><img src="' . $matches[3][$i]['image'] . '" alt="" /></div>';
            } elseif ($matches[3][$i]['icon']) {
                $out .= '<div class="teaser-icon"><i class="icon-' . $matches[3][$i]['icon'] . '"></i></div>';
            }
            $out .= '<header class="teaser-header">';
            $out .= '<h3 class="teaser-title">' . $title . '</h3>';
            if ($matches[3][$i]['subtitle']) {
                $out .= '<div class="teaser-subtitle">' . $matches[3][$i]['subtitle'] . '</div>';
            }
            $out .= '</header>';
            if ($matches[5][$i]) {
                $out .= '<div class="teaser-content">' . do_shortcode(trim($matches[5][$i])) . '</div>';
            }
            $out .= '</aside>';
        }
        if ($i == $column - 1) {
            $out .= '<div class="clear"></div>';
        }
        $out .= '</div>';
    }
    return $out;
}
开发者ID:devilcranx,项目名称:landing-pages,代码行数:54,代码来源:teaser.php



注:本文中的shortcode_parse_atts函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP shortcode_ui_register_for_shortcode函数代码示例发布时间:2022-05-24
下一篇:
PHP shortcode_new_to_old_params函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap