本文整理汇总了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;
}
示例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'])) {
//.........这里部分代码省略.........