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


PHP AppCore::GetSmarty方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $host = "cache.railpage.com.au";
     $port = 6379;
     $this->Cache = new Redis();
     $this->Cache->connect($host, $port);
     $Smarty = AppCore::GetSmarty();
     $Smarty->caching_type = "redis";
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:9,代码来源:Template_Cache_Redis.php

示例2: __construct

 public function __construct()
 {
     //$this->Cache = AppCore::getMemcached();
     $host = defined("RP_MEMCACHE_HOST") ? RP_MEMCACHE_HOST : "cache.railpage.com.au";
     $port = defined("RP_MEMCACHE_PORT") ? RP_MEMCACHE_PORT : 11211;
     $this->Cache = new PhpMemcached();
     $this->Cache->addServer($host, $port);
     $Smarty = AppCore::GetSmarty();
     $Smarty->caching_type = "memcached";
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:10,代码来源:Template_Cache_Memcached.php

示例3: GetHTML

 /**
  * Get menu as HTML
  * @return string
  */
 public function GetHTML()
 {
     $Smarty = AppCore::GetSmarty();
     $Smarty->Assign("submenu", $this->menu);
     return $Smarty->Fetch(RP_SITE_ROOT . DS . "content" . DS . "inc.submenu.tpl");
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:10,代码来源:Submenu.php

示例4: __construct

 /**
  * Constructor
  * @since Version 3.10.0
  */
 public function __construct()
 {
     $this->smarty = AppCore::GetSmarty();
     $this->cacheProvider = AppCore::GetMemcached();
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:9,代码来源:Prerender.php

示例5: prepareTemplate

 /**
  * Fetch our template contents and replace the smarty variables with decoration placeholders
  * @since Version 3.10.0
  * @return \Railpage\Newsletters\Weekly
  */
 private function prepareTemplate()
 {
     $start = 0;
     $num = 10;
     $replacements = [];
     for ($i = $start; $i < $start + $this->num_items; $i++) {
         $replacements[$i] = ["subtitle" => "##block" . $i . ".subtitle##", "featuredimage" => "##block" . $i . ".featuredimage##", "text" => "##block" . $i . ".text##", "link" => "##block" . $i . ".link##", "alt_title" => "##block" . $i . ".alt_title##", "linktext" => "##block" . $i . ".link_text##"];
     }
     $template = $this->Newsletter->template;
     $params = $this->Newsletter->getArray();
     $params['content'] = $replacements;
     $params['unsubscribe'] = "##unsubscribe##";
     $Smarty = AppCore::GetSmarty();
     $Smarty->Assign("newsletter", $params);
     $html = $Smarty->Fetch("string:" . $template['html']);
     #$this->replacements = $replacements;
     $this->html = $html;
     return $this;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:24,代码来源:Weekly.php

示例6: NotifyTied

 /**
  * Send out a notification to site admins to cast a deciding vote in the event of a tied competition
  * @since Version 3.10.0
  * @param \Railpage\Images\Competition $photoComp
  * @return void
  */
 public static function NotifyTied(Competition $photoComp)
 {
     if (isset($photoComp->meta['notifytied']) && $photoComp->meta['notifytied'] >= strtotime("-1 day")) {
         return;
     }
     $photoComp->meta['notifytied'] = time();
     $photoComp->commit();
     $Smarty = AppCore::GetSmarty();
     // User who will cast the deciding vote
     $Decider = UserFactory::CreateUser(45);
     // Create the push notification
     $Push = new Notification();
     $Push->transport = Notifications::TRANSPORT_PUSH;
     $Push->subject = "Tied photo competition";
     $Push->body = sprintf("The %s photo competition is tied. Cast a deciding vote ASAP.", $photoComp->title);
     $Push->setActionUrl($photoComp->url->tied)->addRecipient($Decider->id, $Decider->username, $Decider->username);
     $Push->commit()->dispatch();
     // Create an email notification as a backup
     $Email = new Notification();
     $Email->subject = "Tied competition: " . $photoComp->title;
     $Email->addRecipient($Decider->id, $Decider->username, $Decider->username);
     $tpl = $Smarty->ResolveTemplate("template.generic");
     $email = array("subject" => $Email->subject, "subtitle" => "Photo competitions", "body" => sprintf("<p>The <a href='%s'>%s</a>photo competition is tied and requires a deciding vote. <a href='%s'>Cast it ASAP</a>.</p>", $photoComp->url->canonical, $photoComp->title, $photoComp->url->tied));
     $Smarty->Assign("email", $email);
     $Email->body = $Smarty->fetch($tpl);
     $Email->commit();
     return;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:34,代码来源:CompetitionUtility.php

示例7: banUser

 /**
  * Ban user
  * @since Version 3.2
  * @version 3.2
  * @param int|boolean $userId
  * @param string|boolean $reason
  * @param int|boolean $expiry
  * @param int|boolean $adminUserId
  * @return boolean
  */
 public function banUser($userId = null, $reason = null, $expiry = "0", $adminUserId = null)
 {
     if (!filter_var($userId, FILTER_VALIDATE_INT)) {
         throw new InvalidArgumentException("No user ID supplied");
     }
     if (is_null($reason)) {
         throw new InvalidArgumentException("No reason was supplied");
     }
     if (!filter_var($adminUserId, FILTER_VALIDATE_INT)) {
         throw new InvalidArgumentException("No administrative user ID was supplied");
     }
     /**
      * Empty the cache
      */
     $this->Memcached = AppCore::getMemcached();
     try {
         if ($this->Memcached->Fetch("railpage:bancontrol.users")) {
             $this->Memcached->delete("railpage:bancontrol.users");
         }
         if ($this->Memcached->Fetch(self::CACHE_KEY_ALL)) {
             $this->Memcached->delete(self::CACHE_KEY_ALL);
         }
     } catch (Exception $e) {
         // throw it away
     }
     try {
         $this->Redis->delete("railpage:bancontrol");
     } catch (Exception $e) {
         // throw it away
     }
     $data = array("user_id" => $userId, "ban_active" => 1, "ban_time" => time(), "ban_reason" => $reason, "banned_by" => $adminUserId, "ban_expire" => $expiry);
     $this->db->insert("bancontrol", $data);
     $cachekey_user = sprintf(self::CACHE_KEY_USER, $userId);
     $expire = $expiry > 0 ? $expiry : 0;
     $this->Memcached->save($cachekey_user, true, $expire);
     /**
      * Update the cache
      */
     $this->cacheAll(true);
     /**
      * Tell the world that they've been naughty
      */
     $ThisUser = UserFactory::CreateUser($userId);
     $ThisUser->active = 0;
     $ThisUser->location = "Banned";
     $ThisUser->signature = "Banned";
     $ThisUser->avatar = "";
     $ThisUser->interests = "";
     $ThisUser->occupation = "";
     $ThisUser->commit(true);
     $ThisUser->addNote("Banned", $adminUserId);
     $Smarty = AppCore::GetSmarty();
     // Send the ban email
     $Smarty->Assign("userdata_username", $ThisUser->username);
     $Smarty->Assign("ban_reason", $reason);
     if ($expiry > 0) {
         $Smarty->Assign("ban_expire_nice", date($ThisUser->date_format, $expiry));
     }
     // Send the confirmation email
     $Notification = new Notification();
     if ($adminUserId !== false) {
         $Notification->setAuthor(UserFactory::CreateUser($adminUserId));
     }
     $Notification->addRecipient($ThisUser->id, $ThisUser->username, $ThisUser->contact_email);
     $Notification->body = $Smarty->Fetch($Smarty->ResolveTemplate("email.ban"));
     $Notification->subject = "Railpage account suspension";
     $Notification->transport = Notifications::TRANSPORT_EMAIL;
     $Notification->commit()->dispatch();
     return true;
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:80,代码来源:BanControl.php

示例8: __construct

 /**
  * Constructor
  * @since Version 3.10.0
  * @param string $urlFormat
  * @param int $currentPage
  * @param int $totalItems
  * @param int $itemsPerPage
  */
 public function __construct($urlFormat, $currentPage, $totalItems, $itemsPerPage = 25)
 {
     $this->Smarty = AppCore::GetSmarty();
     $this->setParam("current_page", $currentPage)->setParam("url_format", $urlFormat)->setParam("num_items", $totalItems)->setParam("per_page", $itemsPerPage);
 }
开发者ID:railpage,项目名称:railpagecore,代码行数:13,代码来源:Pagination.php


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