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


PHP Context::last方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $conf = Context::last()->config->get('modules/drawtext');
     if (isset($conf['font'])) {
         $this->setFont($conf['font']);
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:7,代码来源:class.textdrawer.php

示例2: moveFileToS3

 /**
  * Загружает файл в S3.
  */
 public static function moveFileToS3($fileName, $mimeType = null, $baseName = null)
 {
     self::checkEnv($ctx = Context::last());
     $conf = $ctx->config->get('modules/s3');
     $s3 = new S3($conf['accesskey'], $conf['secretkey']);
     if (!($bucketName = trim($ctx->config->get('modules/s3/bucket', 'files'), '/'))) {
         throw new RuntimeException(t('Модуль s3 не настроен (bucket).'));
     }
     if ($folderName = $ctx->config->get('module/s3/folder', 'files')) {
         $folderName .= '/';
     }
     /*
     if (!in_array($bucketName, $s3->listBuckets()))
       throw new RuntimeException(t('Нет такой папки: ' . $bucketName));
     */
     if ($f = fopen($fileName, 'rb')) {
         if (null === $baseName) {
             $baseName = basename($fileName);
         }
         if (!($r = S3::inputResource($f, filesize($fileName)))) {
             throw new RuntimeException(t('Не удалось создать ресурс из файла %filename.', array('%filename' => $fileName)));
         }
         if (!($response = S3::putObject($r, $bucketName, $folderName . $baseName, S3::ACL_PUBLIC_READ))) {
             throw new RuntimeException(t('Не удалось загрузить файл %filename в папку %bucket.', array('%filename' => $fileName, '%bucket' => $bucketName)));
         }
         $url = 'http://' . $bucketName . '.s3.amazonaws.com/' . $folderName . $baseName;
         Logger::log('S3: ' . $url);
         return $url;
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:33,代码来源:class.s3api.php

示例3: on_clone

 /**
  * Клонирование прав при клонировании объекта.
  * @mcms_message ru.molinos.cms.node.clone
  */
 public static function on_clone(Node $node)
 {
     if ($node instanceof UserNode) {
         $node->name .= '/tmp' . rand();
     }
     $node->uid = Context::last()->user->getNode();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:class.authhooks.php

示例4: format

 /**
  * Форматирование значения. Вызывает обработчики вроде типографа.
  */
 public function format(Node $node, $em)
 {
     $value = $node->{$this->value};
     $ctx = Context::last();
     $ctx->registry->broadcast('ru.molinos.cms.format.text', array($ctx, $this->value, &$value));
     return html::wrap($em, html::cdata($value));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:10,代码来源:control.textarea.php

示例5: on_get_settings

 /**
  * @mcms_message ru.molinos.cms.module.settings.drawtext
  */
 public static function on_get_settings(Context $ctx)
 {
     $fonts = array();
     foreach (Node::find(Context::last()->db, array('class' => 'file', 'filetype' => 'application/x-font-ttf')) as $n) {
         $fonts[$n->id] = isset($n->name) ? $n->name : $n->filename;
     }
     return new Schema(array('font' => array('type' => 'EnumControl', 'label' => t('Шрифт по умолчанию'), 'default' => t('(не использовать)'), 'options' => $fonts, 'description' => t('Вы можете <a href=\'@url\'>загрузить новый шрифт</a> в файловый архив.', array('@url' => '?q=admin/content/create&type=file&destination=CURRENT')))));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:class.drawtextmodule.php

示例6: getSelected

 public function getSelected($data)
 {
     if (null === ($email = $this->findEmail($data))) {
         return array();
     }
     $tags = Context::last()->db->getResultsV("tid", "SELECT tid FROM node__rel WHERE nid IN (SELECT id FROM node WHERE class = 'subscription' AND deleted = 0 AND name = ?)", array($email));
     return is_array($tags) ? $tags : array();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:8,代码来源:control.subscription.php

示例7: getEnabledSections

 public function getEnabledSections()
 {
     $conf = Context::last()->config->get('modules/subscription');
     if (!array_key_exists('sections', $conf)) {
         return array();
     }
     return $conf['sections'];
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:8,代码来源:node.subscription.php

示例8: isActive

 private function isActive($data)
 {
     if ($data->id) {
         return false;
     }
     $ctx = Context::last();
     if ($ctx->user->id and !$this->required) {
         return false;
     }
     return true;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:11,代码来源:control.captcha.php

示例9: checkPermission

 public function checkPermission($perm)
 {
     $user = Context::last()->user;
     mcms::debug($this->uid, $this->re);
     if ($this->cmp($this->uid, $user->id)) {
         return true;
     }
     if ($this->cmp($this->re, $user->id)) {
         return true;
     }
     return false;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:node.message.php

示例10: __construct

 public function __construct($url = '', $code = 302)
 {
     if ('POST' == $_SERVER['REQUEST_METHOD']) {
         $code = self::OTHER;
     }
     $u = new url($url);
     $url = $u->getAbsolute(Context::last());
     $this->url = $url;
     $message = t('<html><head><title>Redirecting</title>' . '<meta http-equiv=\'refresh\' content=\'0; url=@url\' />' . '</head><body>' . '<h1>Redirecting</h1><p>Redirecting to <a href=\'@url\'>a new location</a>.</p>' . '</body></html>', array('@url' => $url));
     $this->headers[] = 'Location: ' . $this->url;
     parent::__construct($message, 'text/html', $code);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.redirect.php

示例11: getProfileFields

 private static function getProfileFields()
 {
     $result = array();
     foreach (Schema::load(Context::last()->db, 'user') as $k => $v) {
         $result[$k] = $v->label;
     }
     if (isset($result['groups'])) {
         unset($result['groups']);
     }
     asort($result);
     return $result;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:12,代码来源:class.userconfig.php

示例12: getExtraXMLContent

 /**
  * Добавляет в комментарий информацию о ноде.
  */
 public function getExtraXMLContent()
 {
     $content = parent::getExtraXMLContent();
     $db = Context::last()->db;
     $node = $this->node ? $this->node : $db->fetch("SELECT `tid` FROM `node__rel` WHERE `nid` = ? LIMIT 1", array($this->id));
     if ($node) {
         if ($data = $db->getResults("SELECT id, class, name FROM node WHERE id = ?", array($node))) {
             $content .= html::em('node', $data[0]);
         }
     }
     return $content;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:node.comment.php

示例13: login

 /**
  * Переключается в указанного пользователя, проверяет его статус.
  */
 private static function login($uid)
 {
     if ($uid) {
         $data = Context::last()->db->fetch("SELECT `id`, `published` FROM `node` WHERE `class` = 'user' AND `deleted` = 0 AND `id` = ?", array($uid));
         if (empty($data)) {
             throw new ForbiddenException(t('Нет такого пользователя.'));
         } elseif (empty($data['published'])) {
             throw new ForbiddenException(t('Ваш профиль заблокирован.'));
         }
     }
     User::storeSessionData($uid);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:15,代码来源:class.authrpc.php

示例14: format

 public function format(Node $node, $em)
 {
     $result = '';
     $value = $node->{$this->value};
     if (!empty($value) and is_array($value)) {
         $params = array();
         $data = (array) Context::last()->db->getResults($sql = "SELECT `id`, `published`, `name` FROM `node` WHERE `class` = 'label' AND `deleted` = 0 AND `id` " . sql::in(array_keys($value), $params), $params);
         foreach ($data as $row) {
             $result .= html::em('label', array('id' => $row['id'], 'published' => (bool) $row['published']), html::cdata($row['name']));
         }
     }
     return html::wrap($em, $result);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:13,代码来源:control.labels.php

示例15: getProductLink

 private function getProductLink(array $item)
 {
     $ctx = Context::last();
     if (empty($item['id'])) {
         return htmlspecialchars($item['name']);
     }
     if (0 === strpos($ctx->query(), 'admin/')) {
         $url = '?q=admin/edit/' . $item['id'] . '&destination=admin';
     } else {
         $url = '?q=nodeapi.rpc&action=locate&node=' . $item['id'];
     }
     return html::link($url, html::plain($item['name']));
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:13,代码来源:control.orderdetails.php


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