当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::addURLParameters方法代码示例

本文整理汇总了PHP中Frontend\Core\Engine\Model::addURLParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::addURLParameters方法的具体用法?PHP Model::addURLParameters怎么用?PHP Model::addURLParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Frontend\Core\Engine\Model的用法示例。


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

示例1: setImage

 /**
  * Set the image for the feed.
  *
  * @param string $url         URL of the image.
  * @param string $title       Title of the image.
  * @param string $link        Link of the image.
  * @param int    $width       Width of the image.
  * @param int    $height      Height of the image.
  * @param string $description Description of the image.
  */
 public function setImage($url, $title, $link, $width = null, $height = null, $description = null)
 {
     // add UTM-parameters
     $link = Model::addURLParameters($link, array('utm_source' => 'feed', 'utm_medium' => 'rss', 'utm_campaign' => CommonUri::getUrl($this->getTitle())));
     // call the parent
     parent::setImage($url, $title, $link, $width, $height, $description);
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:17,代码来源:Rss.php

示例2: processLinks

 /**
  * Process links, will prepend SITE_URL if needed and append UTM-parameters
  *
  * @param string $content The content to process.
  *
  * @return string
  */
 public function processLinks($content)
 {
     // redefine
     $content = (string) $content;
     // replace URLs and images
     $search = array('href="/', 'src="/');
     $replace = array('href="' . SITE_URL . '/', 'src="' . SITE_URL . '/');
     // replace links to files
     $content = str_replace($search, $replace, $content);
     // init var
     $matches = array();
     // match links
     preg_match_all('/href="(http:\\/\\/(.*))"/iU', $content, $matches);
     // any links?
     if (isset($matches[1]) && !empty($matches[1])) {
         // init vars
         $searchLinks = array();
         $replaceLinks = array();
         // loop old links
         foreach ($matches[1] as $i => $link) {
             $searchLinks[] = $matches[0][$i];
             $replaceLinks[] = 'href="' . Model::addURLParameters($link, $this->utm) . '"';
         }
         // replace
         $content = str_replace($searchLinks, $replaceLinks, $content);
     }
     return $content;
 }
开发者ID:forkcms,项目名称:forkcms,代码行数:35,代码来源:RssItem.php

示例3: setUrl

 /**
  * Set the url
  *
  * @param string $url The url to associate the item with.
  */
 public function setUrl($url)
 {
     // redefine var
     $url = (string) $url;
     // if link doesn't start with http, we prepend the URL of the site
     if (substr($url, 0, 7) != 'http://') {
         $url = SITE_URL . $url;
     }
     $url = FrontendModel::addURLParameters($url, $this->utm);
     $url = htmlspecialchars_decode($url);
     // call parent
     parent::setUrl($url);
 }
开发者ID:arashrasoulzadeh,项目名称:forkcms,代码行数:18,代码来源:Ical.php

示例4: addUTM

 /**
  * @param  string $html    The html to convert links in.
  * @param  string $subject The subject of the mail
  * @return string
  */
 private function addUTM($html, $subject)
 {
     // match links
     $matches = array();
     preg_match_all('/href="(http:\\/\\/(.*))"/iU', $html, $matches);
     // any links?
     $utm = array('utm_source' => 'mail', 'utm_medium' => 'email', 'utm_campaign' => Uri::getUrl($subject));
     if (isset($matches[0]) && !empty($matches[0])) {
         $searchLinks = array();
         $replaceLinks = array();
         // loop old links
         foreach ($matches[1] as $i => $link) {
             $searchLinks[] = $matches[0][$i];
             $replaceLinks[] = 'href="' . Model::addURLParameters($link, $utm) . '"';
         }
         $html = str_replace($searchLinks, $replaceLinks, $html);
     }
     return $html;
 }
开发者ID:bwgraves,项目名称:forkcms,代码行数:24,代码来源:Message.php


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