當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RevSliderBase::add_wrap_around_url方法代碼示例

本文整理匯總了PHP中RevSliderBase::add_wrap_around_url方法的典型用法代碼示例。如果您正苦於以下問題:PHP RevSliderBase::add_wrap_around_url方法的具體用法?PHP RevSliderBase::add_wrap_around_url怎麽用?PHP RevSliderBase::add_wrap_around_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RevSliderBase的用法示例。


在下文中一共展示了RevSliderBase::add_wrap_around_url方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: set_stream_data

 public function set_stream_data($text, $attr, $stream_type, $additions = array(), $is_action = false)
 {
     $img_sizes = RevSliderBase::get_all_image_sizes($stream_type);
     $text = str_replace(array('%title%', '{{title}}'), $attr['title'], $text);
     $text = str_replace(array('%excerpt%', '{{excerpt}}'), $attr['excerpt'], $text);
     $text = str_replace(array('%alias%', '{{alias}}'), $attr['alias'], $text);
     $text = str_replace(array('%content%', '{{content}}'), $attr['content'], $text);
     $text = str_replace(array('%link%', '{{link}}'), $attr['link'], $text);
     $text = str_replace(array('%date_published%', '{{date_published}}', '%date%', '{{date}}'), $attr['date'], $text);
     $text = str_replace(array('%date_modified%', '{{date_modified}}'), $attr['date_modified'], $text);
     $text = str_replace(array('%author_name%', '{{author_name}}'), $attr['author_name'], $text);
     $text = str_replace(array('%num_comments%', '{{num_comments}}'), $attr['num_comments'], $text);
     $text = str_replace(array('%catlist%', '{{catlist}}'), $attr['catlist'], $text);
     $text = str_replace(array('%taglist%', '{{taglist}}'), $attr['taglist'], $text);
     $text = str_replace(array('%likes%', '{{likes}}'), $attr['likes'], $text);
     $text = str_replace(array('%retweet_count%', '{{retweet_count}}'), $attr['retweet_count'], $text);
     $text = str_replace(array('%favorite_count%', '{{favorite_count}}'), $attr['favorite_count'], $text);
     $text = str_replace(array('%views%', '{{views}}'), $attr['views'], $text);
     if ($stream_type == 'twitter' && $is_action === false) {
         $text = RevSliderBase::add_wrap_around_url($text);
     }
     switch ($stream_type) {
         case 'facebook':
             foreach ($img_sizes as $img_handle => $img_name) {
                 if (!isset($attr['img_urls'])) {
                     $attr['img_urls'] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle])) {
                     $attr['img_urls'][$img_handle] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle]['url'])) {
                     $attr['img_urls'][$img_handle]['url'] = '';
                 }
                 if (!isset($attr['img_urls'][$img_handle]['tag'])) {
                     $attr['img_urls'][$img_handle]['tag'] = '';
                 }
                 if ($additions['fb_type'] == 'album') {
                     $text = str_replace(array('%image_url_' . $img_handle . '%', '{{image_url_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['url'], $text);
                     $text = str_replace(array('%image_' . $img_handle . '%', '{{image_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['tag'], $text);
                 } else {
                     $text = str_replace(array('%image_url_' . $img_handle . '%', '{{image_url_' . $img_handle . '}}'), $attr['img_urls']['url'], $text);
                     $text = str_replace(array('%image_' . $img_handle . '%', '{{image_' . $img_handle . '}}'), $attr['img_urls']['tag'], $text);
                 }
             }
             break;
         case 'youtube':
         case 'vimeo':
             //$text = str_replace(array('%image_url_'.$img_handle.'%', '{{image_url_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['url'], $text);
             //$text = str_replace(array('%image_'.$img_handle.'%', '{{image_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['tag'], $text);
         //$text = str_replace(array('%image_url_'.$img_handle.'%', '{{image_url_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['url'], $text);
         //$text = str_replace(array('%image_'.$img_handle.'%', '{{image_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['tag'], $text);
         case 'twitter':
         case 'instagram':
         case 'flickr':
             foreach ($img_sizes as $img_handle => $img_name) {
                 if (!isset($attr['img_urls'])) {
                     $attr['img_urls'] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle])) {
                     $attr['img_urls'][$img_handle] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle]['url'])) {
                     $attr['img_urls'][$img_handle]['url'] = '';
                 }
                 if (!isset($attr['img_urls'][$img_handle]['tag'])) {
                     $attr['img_urls'][$img_handle]['tag'] = '';
                 }
                 $text = str_replace(array('%image_url_' . $img_handle . '%', '{{image_url_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['url'], $text);
                 $text = str_replace(array('%image_' . $img_handle . '%', '{{image_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['tag'], $text);
             }
             break;
     }
     return $text;
 }
開發者ID:hathbanger,項目名稱:squab,代碼行數:74,代碼來源:slide.class.php

示例2: set_stream_data

 public function set_stream_data($text, $attr, $stream_type, $additions = array(), $is_action = false)
 {
     $img_sizes = RevSliderBase::get_all_image_sizes($stream_type);
     $text = apply_filters('revslider_slide_set_stream_data_pre', $text, $attr, $stream_type, $additions, $is_action, $img_sizes);
     $title = $stream_type == 'twitter' && $is_action === false ? RevSliderBase::add_wrap_around_url($attr['title']) : $attr['title'];
     $excerpt = $stream_type == 'twitter' && $is_action === false ? RevSliderBase::add_wrap_around_url($attr['excerpt']) : $attr['excerpt'];
     $content = $stream_type == 'twitter' && $is_action === false ? RevSliderBase::add_wrap_around_url($attr['content']) : $attr['content'];
     $text = str_replace(array('%title%', '{{title}}'), $title, $text);
     $text = str_replace(array('%excerpt%', '{{excerpt}}'), $excerpt, $text);
     $text = str_replace(array('%alias%', '{{alias}}'), $attr['alias'], $text);
     $text = str_replace(array('%content%', '{{content}}'), $content, $text);
     $text = str_replace(array('%link%', '{{link}}'), $attr['link'], $text);
     $text = str_replace(array('%date_published%', '{{date_published}}', '%date%', '{{date}}'), $attr['date'], $text);
     $text = str_replace(array('%date_modified%', '{{date_modified}}'), $attr['date_modified'], $text);
     $text = str_replace(array('%author_name%', '{{author_name}}'), $attr['author_name'], $text);
     $text = str_replace(array('%num_comments%', '{{num_comments}}'), $attr['num_comments'], $text);
     $text = str_replace(array('%catlist%', '{{catlist}}'), $attr['catlist'], $text);
     $text = str_replace(array('%catlist_raw%', '{{catlist_raw}}'), $attr['catlist_raw'], $text);
     $text = str_replace(array('%taglist%', '{{taglist}}'), $attr['taglist'], $text);
     $text = str_replace(array('%likes%', '{{likes}}'), $attr['likes'], $text);
     $text = str_replace(array('%retweet_count%', '{{retweet_count}}'), $attr['retweet_count'], $text);
     $text = str_replace(array('%favorite_count%', '{{favorite_count}}'), $attr['favorite_count'], $text);
     $text = str_replace(array('%views%', '{{views}}'), $attr['views'], $text);
     $arrMatches = array();
     preg_match_all("/{{content:\\w+[\\:]\\w+}}/", $text, $arrMatches);
     foreach ($arrMatches as $matched) {
         foreach ($matched as $match) {
             //now check length and type
             $meta = str_replace("{{content:", "", $match);
             $meta = str_replace("}}", "", $meta);
             $meta = str_replace('_REVSLIDER_', '-', $meta);
             $vals = explode(':', $meta);
             if (count($vals) !== 2) {
                 continue;
             }
             //not correct values
             $vals[1] = intval($vals[1]);
             //get real number
             if ($vals[1] === 0 || $vals[1] < 0) {
                 continue;
             }
             //needs to be at least 1
             if ($vals[0] == 'words') {
                 $metaValue = explode(' ', strip_tags($content), $vals[1] + 1);
                 if (is_array($metaValue) && count($metaValue) > $vals[1]) {
                     array_pop($metaValue);
                 }
                 $metaValue = implode(' ', $metaValue);
             } elseif ($vals[0] == 'chars') {
                 $metaValue = substr(strip_tags($content), 0, $vals[1]);
             } else {
                 continue;
             }
             $text = str_replace($match, $metaValue, $text);
         }
     }
     switch ($stream_type) {
         case 'facebook':
             foreach ($img_sizes as $img_handle => $img_name) {
                 if (!isset($attr['img_urls'])) {
                     $attr['img_urls'] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle])) {
                     $attr['img_urls'][$img_handle] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle]['url'])) {
                     $attr['img_urls'][$img_handle]['url'] = '';
                 }
                 if (!isset($attr['img_urls'][$img_handle]['tag'])) {
                     $attr['img_urls'][$img_handle]['tag'] = '';
                 }
                 if ($additions['fb_type'] == 'album') {
                     $text = str_replace(array('%image_url_' . $img_handle . '%', '{{image_url_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['url'], $text);
                     $text = str_replace(array('%image_' . $img_handle . '%', '{{image_' . $img_handle . '}}'), $attr['img_urls'][$img_handle]['tag'], $text);
                 } else {
                     $text = str_replace(array('%image_url_' . $img_handle . '%', '{{image_url_' . $img_handle . '}}'), $attr['img_urls']['url'], $text);
                     $text = str_replace(array('%image_' . $img_handle . '%', '{{image_' . $img_handle . '}}'), $attr['img_urls']['tag'], $text);
                 }
             }
             break;
         case 'youtube':
         case 'vimeo':
             //$text = str_replace(array('%image_url_'.$img_handle.'%', '{{image_url_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['url'], $text);
             //$text = str_replace(array('%image_'.$img_handle.'%', '{{image_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['tag'], $text);
         //$text = str_replace(array('%image_url_'.$img_handle.'%', '{{image_url_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['url'], $text);
         //$text = str_replace(array('%image_'.$img_handle.'%', '{{image_'.$img_handle.'}}'), @$attr['img_urls'][$img_handle]['tag'], $text);
         case 'twitter':
         case 'instagram':
         case 'flickr':
             foreach ($img_sizes as $img_handle => $img_name) {
                 if (!isset($attr['img_urls'])) {
                     $attr['img_urls'] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle])) {
                     $attr['img_urls'][$img_handle] = array();
                 }
                 if (!isset($attr['img_urls'][$img_handle]['url'])) {
                     $attr['img_urls'][$img_handle]['url'] = '';
                 }
                 if (!isset($attr['img_urls'][$img_handle]['tag'])) {
//.........這裏部分代碼省略.........
開發者ID:ksan5835,項目名稱:maadithottam,代碼行數:101,代碼來源:slide.class.php


注:本文中的RevSliderBase::add_wrap_around_url方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。