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


PHP Render类代码示例

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


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

示例1: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = false;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     // get valid people
     $people = $connection->deepQuery("\n\t\t\tSELECT email, username, first_name, last_access\n\t\t\tFROM person\n\t\t\tWHERE active=1\n\t\t\tAND email not in (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND DATE(last_access) > DATE('2016-05-01')\n\t\t\tAND email like '%.cu'\n\t\t\tAND email not like '%@mms.cubacel.cu'");
     // send the remarketing
     $log = "";
     foreach ($people as $person) {
         // get the email address
         $newEmail = "apretaste+{$person->username}@gmail.com";
         // create the variabels to pass to the template
         $content = array("newemail" => $newEmail, "name" => $person->first_name);
         // create html response
         $response->setEmailLayout("email_simple.tpl");
         $response->createFromTemplate('newEmail.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send the email
         $email->sendEmail($person->email, "Sorteando las dificultades, un email lleno de alegria", $html);
         $log .= $person->email . "\n";
     }
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/newemail.log");
     $logger->log($log);
     $logger->close();
 }
开发者ID:Apretaste,项目名称:Core,代码行数:34,代码来源:NewemailTask.php

示例2: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = true;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     $log = "";
     // people who were invited but never used Apretaste
     $invitedPeople = $connection->deepQuery("\n\t\t\tSELECT invitation_time, email_inviter, email_invited\n\t\t\tFROM invitations \n\t\t\tWHERE used=0 \n\t\t\tAND DATEDIFF(CURRENT_DATE, invitation_time) > 15 \n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from delivery_dropped)\n\t\t\tAND email_invited NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tORDER BY invitation_time DESC\n\t\t\tLIMIT 450");
     // send the first remarketing
     $log .= "\nINVITATIONS (" . count($invitedPeople) . ")\n";
     foreach ($invitedPeople as $person) {
         // check number of days since the invitation was sent
         $datediff = time() - strtotime($person->invitation_time);
         $daysSinceInvitation = floor($datediff / (60 * 60 * 24));
         // validate old invitations to avoid bounces
         if ($daysSinceInvitation > 60) {
             // re-validate the email
             $res = $utils->deepValidateEmail($person->email_invited);
             // if response not ok or temporal, delete from invitations list
             if ($res[0] != "ok" && $res[0] != "temporal") {
                 $connection->deepQuery("DELETE FROM invitations WHERE email_invited = '{$person->email_invited}'");
                 $log .= "\t --skiping {$person->email_invited}\n";
                 continue;
             }
         }
         // send data to the template
         $content = array("date" => $person->invitation_time, "inviter" => $person->email_inviter, "invited" => $person->email_invited, "expires" => strtotime('next month'));
         // create html response
         $response->createFromTemplate('pendinginvitation.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send the invitation email
         $subject = "Su amigo {$person->email_inviter} esta esperando por usted!";
         $email->sendEmail($person->email_invited, $subject, $html);
         // insert into remarketing table
         $connection->deepQuery("INSERT INTO remarketing(email, type) VALUES ('{$person->email_invited}', 'INVITE')");
         // display notifications
         $log .= "\t{$person->email_invited}\n";
     }
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // printing log
     $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n";
     echo $log;
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_invitation.log");
     $logger->log($log);
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='invitation'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:59,代码来源:InvitationTask.php

示例3: mainAction

 public function mainAction()
 {
     // inicialize supporting classes
     $timeStart = time();
     $connection = new Connection();
     $email = new Email();
     $service = new Service();
     $service->showAds = true;
     $render = new Render();
     $response = new Response();
     $utils = new Utils();
     $wwwroot = $this->di->get('path')['root'];
     $log = "";
     // people in the list to be automatically invited
     $people = $connection->deepQuery("\n\t\t\tSELECT * FROM autoinvitations\n\t\t\tWHERE email NOT IN (SELECT email FROM person)\n\t\t\tAND email NOT IN (SELECT DISTINCT email FROM delivery_dropped)\n\t\t\tAND email NOT IN (SELECT DISTINCT email from remarketing)\n\t\t\tAND error=0\n\t\t\tLIMIT 450");
     // send the first remarketing
     $log .= "\nAUTOMATIC INVITATIONS (" . count($people) . ")\n";
     foreach ($people as $person) {
         // if response not ok, check the email as error
         $res = $utils->deepValidateEmail($person->email);
         if ($res[0] != "ok") {
             $connection->deepQuery("UPDATE autoinvitations SET error=1, processed=CURRENT_TIMESTAMP WHERE email='{$person->email}'");
             $log .= "\t --skiping {$person->email}\n";
             continue;
         }
         // create html response
         $content = array("email" => $person->email);
         $response->createFromTemplate('autoinvitation.tpl', $content);
         $response->internal = true;
         $html = $render->renderHTML($service, $response);
         // send invitation email
         $subject = "Dos problemas, y una solucion";
         $email->sendEmail($person->email, $subject, $html);
         // mark as sent
         $connection->deepQuery("\n\t\t\t\tSTART TRANSACTION;\n\t\t\t\tDELETE FROM autoinvitations WHERE email='{$person->email}';\n\t\t\t\tINSERT INTO remarketing(email, type) VALUES ('{$person->email}', 'AUTOINVITE');\n\t\t\t\tCOMMIT;");
         // display notifications
         $log .= "\t{$person->email}\n";
     }
     // get final delay
     $timeEnd = time();
     $timeDiff = $timeEnd - $timeStart;
     // printing log
     $log .= "EXECUTION TIME: {$timeDiff} seconds\n\n";
     echo $log;
     // saving the log
     $logger = new \Phalcon\Logger\Adapter\File("{$wwwroot}/logs/remarketing_autoinvitation.log");
     $logger->log($log);
     $logger->close();
     // save the status in the database
     $connection->deepQuery("UPDATE task_status SET executed=CURRENT_TIMESTAMP, delay='{$timeDiff}' WHERE task='autoinvitation'");
 }
开发者ID:Apretaste,项目名称:Core,代码行数:51,代码来源:AutoinvitationTask.php

示例4: processAction

 /**
  * Process the page when its submitted
  *
  * @author kuma, salvipascual
  * @version 1.0
  * */
 public function processAction()
 {
     // get the values from the post
     $captcha = trim($this->request->getPost('captcha'));
     $name = trim($this->request->getPost('name'));
     $inviter = trim($this->request->getPost('email'));
     $guest = trim($this->request->getPost('guest'));
     if (!isset($_SESSION['phrase'])) {
         $_SESSION['phrase'] = uniqid();
     }
     // throw a die()
     // check all values passed are valid
     if (strtoupper($captcha) != strtoupper($_SESSION['phrase']) || $name == "" || !filter_var($inviter, FILTER_VALIDATE_EMAIL) || !filter_var($guest, FILTER_VALIDATE_EMAIL)) {
         die("Error procesando, por favor valla atras y comience nuevamente.");
     }
     // params for the response
     $this->view->name = $name;
     $this->view->email = $inviter;
     // create classes needed
     $connection = new Connection();
     $email = new Email();
     $utils = new Utils();
     $render = new Render();
     // do not invite people who are already using Apretaste
     if ($utils->personExist($guest)) {
         $this->view->already = true;
         return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index"));
     }
     // send notification to the inviter
     $response = new Response();
     $response->setResponseSubject("Gracias por darle internet a un Cubano");
     $response->setEmailLayout("email_simple.tpl");
     $response->createFromTemplate("invitationThankYou.tpl", array('num_notifications' => 0));
     $response->internal = true;
     $html = $render->renderHTML(new Service(), $response);
     $email->sendEmail($inviter, $response->subject, $html);
     // send invitations to the guest
     $response = new Response();
     $response->setResponseSubject("{$name} le ha invitado a revisar internet desde su email");
     $responseContent = array("host" => $name, "guest" => $guest, 'num_notifications' => 0);
     $response->createFromTemplate("invitation.tpl", $responseContent);
     $response->internal = true;
     $html = $render->renderHTML(new Service(), $response);
     $email->sendEmail($guest, $response->subject, $html);
     // save all the invitations into the database at the same time
     $connection->deepQuery("INSERT INTO invitations (email_inviter,email_invited,source) VALUES ('{$inviter}','{$guest}','abroad')");
     // redirect to the invite page
     $this->view->message = true;
     return $this->dispatcher->forward(array("controller" => "invitar", "action" => "index"));
 }
开发者ID:Apretaste,项目名称:Core,代码行数:56,代码来源:InvitarController.php

示例5: uploadFile

 public function uploadFile()
 {
     $view = \Render::view('sections.file.upload');
     $view['section'] = 'upload';
     $view['page_id'] = 0;
     return $view;
 }
开发者ID:pongocms,项目名称:cms,代码行数:7,代码来源:FileController.php

示例6: update

 function update($params)
 {
     $c = $this->updated_companies[0];
     $c->save();
     Render::msg($c->getName() . ' Updated.');
     $this->redirectTo(array('controller' => 'Company', 'action' => 'show', 'id' => $c->id));
 }
开发者ID:radicaldesigns,项目名称:gtd,代码行数:7,代码来源:CompanyController.php

示例7: post

 public static function post($buffer = '')
 {
     if (Router::is_api_request()) {
         return $buffer;
     }
     // additional processes added by ctrls
     foreach (self::$processes as $proc) {
         $buffer = $proc($buffer);
     }
     // custom angular directives
     $buffer = preg_replace_callback("/data-(md-[a-z][^=\\s>]*)/", function ($matches) {
         $name = Filter::snake_to_camel($matches[1]);
         Render::include_script("app/{$name}");
         return $matches[0];
     }, $buffer);
     // assets
     $buffer = preg_replace_callback("/<--([^-]+)-->/", function ($matches) {
         return Render::$matches[1]();
     }, $buffer);
     // href and src urls
     $buffer = preg_replace_callback('/="(\\/[^"]*)/', function ($matches) {
         return '="' . SUBDIR . $matches[1];
     }, $buffer);
     // css urls
     $buffer = preg_replace_callback("/\\((\\/[^)]*)/", function ($matches) {
         return "(" . SUBDIR . $matches[1];
     }, $buffer);
     return $buffer;
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:29,代码来源:content_processor.php

示例8: get

 public static function get($inputData = array())
 {
     $limitQuery = "";
     $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
     $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
     $limitPage = (int) $limitPage > 0 ? $limitPage : 0;
     $limitPosition = $limitPage * (int) $limitShow;
     $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
     $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
     $field = "cronid,timenumber,timetype,timeinterval,last_update,jobdata,date_added,status";
     $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
     $whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
     $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by cronid desc';
     $result = array();
     $command = "select {$selectFields} from cronjobs {$whereQuery} {$orderBy}";
     $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
     $queryCMD .= $limitQuery;
     $query = Database::query($queryCMD);
     $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
     if ((int) $query->num_rows > 0) {
         while ($row = Database::fetch_assoc($query)) {
             if (isset($row['jobdata'])) {
                 $row['jobdata'] = String::jsonToArray($row['jobdata']);
             }
             $row['date_addedFormat'] = Render::dateFormat($row['date_added']);
             $result[] = $row;
         }
     } else {
         return false;
     }
     // print_r($result);die();
     return $result;
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:33,代码来源:Cronjobs.php

示例9: create_one

 public function create_one($params = [])
 {
     Session::permit_admin();
     $class = Filter::controller_model(get_called_class());
     $item = $class::create(Record::allow($params, ['name', 'title']));
     Render::json($class::read(['*'], $item['id']));
 }
开发者ID:wileybenet,项目名称:mobile-docs,代码行数:7,代码来源:ctrl.php

示例10: init

 /**
  * Generate bootstrap javascript virtual file
  * 
  * @return void
  */
 public function init()
 {
     $contents = \Render::view('partials.initjs');
     $response = \Response::make($contents, 200);
     $response->header('Content-Type', 'application/javascript');
     return $response;
 }
开发者ID:pongocms,项目名称:cms,代码行数:12,代码来源:BaseController.php

示例11: link

 /**
  * Listing accounts
  */
 public static function link($link = '')
 {
     $share = array();
     $data = array();
     $task = array();
     $service = array();
     $backups = array();
     $profile = array();
     $share = SharesModel::first(array('link' => $link));
     if ($share) {
         $share = $share->toArray();
         $data = json_decode($share['data'], true);
         if (strtotime($share['created_at']) + $share['expires'] > time()) {
             $task = TasksModel::first($share['task_id'])->toArray();
             $service = ServicesModel::first($share['service_id'])->toArray();
             $profile = UsersModel::profile($task['user_id']);
             $backups = call_user_func_array(array('app\\libraries\\' . $service['library'], 'shared'), array($task));
         } else {
             \Util::notice(array('type' => 'danger', 'text' => 'The requested link has expired.'));
         }
     } else {
         \Util::notice(array('type' => 'danger', 'text' => 'The requested link does not exist.'));
     }
     $templateData = array('template' => 'shared/content', 'title' => 'Migrate - Shared Data', 'bodyId' => 'shared', 'styles' => array('shared.css'), 'scripts' => array('common/request.js', 'shared.js'), 'share' => $share, 'data' => $data, 'task' => $task, 'service' => $service, 'backups' => $backups, 'profile' => $profile);
     \Render::layout('template', $templateData);
 }
开发者ID:unDemian,项目名称:gcdc-migrate,代码行数:29,代码来源:shared.php

示例12: edit

 /**
  * [edit description]
  * @return [type] [description]
  */
 public function edit($page_id, $block_id)
 {
     \Pongo::viewShare('page_id', $page_id);
     \Pongo::viewShare('block_id', $block_id);
     $block = $this->manager->getBlock($block_id);
     return \Render::view('sections.blocks.edit', array('block' => $block));
 }
开发者ID:pongocms,项目名称:cms,代码行数:11,代码来源:BlockController.php

示例13: antiTampering

 public static function antiTampering($tmplData)
 {
     //echo "Render::antiTampering()";
     Render::error($tmplData, "Detected tampering of data. Stop it!!");
     Render::login($tmplData);
     exit;
 }
开发者ID:Kloadut,项目名称:phpFileManager,代码行数:7,代码来源:Render.php

示例14: html_list

 public function html_list($document)
 {
     Backend::add('Sub Title', $document->getMeta('name'));
     Backend::add('TabLinks', $this->getTabLinks(Controller::$action));
     Backend::add('Object', $document);
     Backend::addContent(Render::renderFile('document_list.tpl.php'));
 }
开发者ID:jrgns,项目名称:backend-php,代码行数:7,代码来源:Document.obj.php

示例15: get

 public static function get($inputData = array())
 {
     $limitQuery = "";
     $limitShow = isset($inputData['limitShow']) ? $inputData['limitShow'] : 0;
     $limitPage = isset($inputData['limitPage']) ? $inputData['limitPage'] : 0;
     $limitPage = (int) $limitPage > 0 ? $limitPage : 0;
     $limitPosition = $limitPage * (int) $limitShow;
     $limitQuery = (int) $limitShow == 0 ? '' : " limit {$limitPosition},{$limitShow}";
     $limitQuery = isset($inputData['limitQuery']) ? $inputData['limitQuery'] : $limitQuery;
     $field = "id,parentid,date_added,title,url,status,sort_order";
     $selectFields = isset($inputData['selectFields']) ? $inputData['selectFields'] : $field;
     $whereQuery = isset($inputData['where']) ? $inputData['where'] : '';
     $orderBy = isset($inputData['orderby']) ? $inputData['orderby'] : 'order by id desc';
     $result = array();
     $command = "select {$selectFields} from " . Database::getPrefix() . "links {$whereQuery}";
     $command .= " {$orderBy}";
     $queryCMD = isset($inputData['query']) ? $inputData['query'] : $command;
     $queryCMD .= $limitQuery;
     $cache = isset($inputData['cache']) ? $inputData['cache'] : 'yes';
     $cacheTime = isset($inputData['cacheTime']) ? $inputData['cacheTime'] : -1;
     $md5Query = md5($queryCMD);
     if ($cache == 'yes') {
         // Load dbcache
         $loadCache = Cache::loadKey('dbcache/system/link/' . $md5Query, $cacheTime);
         if ($loadCache != false) {
             $loadCache = unserialize($loadCache);
             return $loadCache;
         }
         // end load
     }
     $query = Database::query($queryCMD);
     if (isset(Database::$error[5])) {
         return false;
     }
     $inputData['isHook'] = isset($inputData['isHook']) ? $inputData['isHook'] : 'yes';
     if ((int) $query->num_rows > 0) {
         while ($row = Database::fetch_assoc($query)) {
             if (isset($row['title'])) {
                 $row['title'] = String::decode($row['title']);
             }
             if (isset($row['date_added'])) {
                 $row['date_addedFormat'] = Render::dateFormat($row['date_added']);
             }
             if (isset($row['url']) && !preg_match('/^http/i', $row['url'])) {
                 if (preg_match('/^\\/(.*?)$/i', $row['url'], $matches)) {
                     $tmp = $matches[1];
                     $row['urlFormat'] = System::getUrl() . $tmp;
                 }
             }
             $result[] = $row;
         }
     } else {
         return false;
     }
     // Save dbcache
     Cache::saveKey('dbcache/system/link/' . $md5Query, serialize($result));
     // end save
     return $result;
 }
开发者ID:neworldwebsites,项目名称:noblessecms,代码行数:59,代码来源:Links.php


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