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


PHP url::arg方法代码示例

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


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

示例1: on_get_search_form

 /**
  * Вывод поисковой формы.
  */
 public static function on_get_search_form(Context $ctx)
 {
     $output = '';
     $url = new url($ctx->get('destination', $ctx->get('from')));
     if (null === $url->arg('preset')) {
         $types = Node::find(array('class' => 'type', 'published' => 1, 'deleted' => 0, 'name' => $ctx->user->getAccess(ACL::READ)), $ctx->db);
         $list = array();
         foreach ($types as $type) {
             if (!$type->isdictionary) {
                 $list[$type->name] = $type->title;
             }
         }
         asort($list);
         if ('file' == ($type = $ctx->get('type')) and array_key_exists($type, $list)) {
             $list = array($type => $type);
         }
         $tmp = '';
         foreach ($list as $k => $v) {
             $tmp .= html::em('type', array('name' => $k, 'title' => $v));
         }
         $output .= html::em('types', $tmp);
     }
     $tmp = '';
     foreach (Node::getSortedList('user', 'fullname', 'id') as $k => $v) {
         $tmp .= html::em('user', array('id' => $k, 'name' => $v));
     }
     $output .= html::em('users', $tmp);
     if (null === $url->arg('preset')) {
         $tmp = '';
         foreach (Node::getSortedList('tag', 'id', 'name') as $k => $v) {
             $tmp .= html::em('section', array('id' => $k, 'name' => $v));
         }
         $output .= html::em('sections', $tmp);
     }
     return html::em('content', array('name' => 'search', 'query' => self::get_clean_query($url->arg('search')), 'from' => urlencode($ctx->get('from'))), $output);
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:39,代码来源:class.adminadvsearch.php

示例2: getAction

 private function getAction()
 {
     $action = isset($this->action) ? $this->action : MCMS_REQUEST_URI;
     if ($this->edit) {
         $url = new url($action);
         if (null !== ($next = $url->arg('destination'))) {
             $next = new url($next);
             $next->setarg('pending', null);
             $next->setarg('created', null);
             $destination = $next->string();
             $next->setarg('mode', 'edit');
             $next->setarg('type', null);
             $next->setarg('id', '%ID');
             $next->setarg('destination', $destination);
             $url->setarg('destination', $next->string());
             $action = $url->string();
         }
     }
     return $action;
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:20,代码来源:class.form.php

示例3: on_post_sendto

 public static function on_post_sendto(Context $ctx)
 {
     if ($pick = $ctx->post('selected')) {
         if (false === strpos($ctx->post('sendto'), '.')) {
             list($nid, $fieldName) = array($ctx->post('sendto'), null);
         } else {
             list($nid, $fieldName) = explode('.', $ctx->post('sendto'));
         }
         $params = array($fieldName);
         $sql = "REPLACE INTO `node__rel` (`tid`, `nid`, `key`) SELECT %ID%, `id`, ? FROM `node` WHERE `deleted` = 0 AND `id` " . sql::in($pick, $params);
         $ctx->db->beginTransaction();
         $node = Node::load($nid)->knock(ACL::UPDATE);
         if (isset($node->{$fieldName})) {
             unset($node->{$fieldName});
         }
         $node->onSave("DELETE FROM `node__rel` WHERE `tid` = %ID% AND `key` = ?", array($fieldName))->onSave($sql, $params)->save();
         $ctx->db->commit();
         // destiantion сейчас указывает на список, а нам надо
         // вернуться на уровень выше.
         $url = new url($ctx->get('destination'));
         if ($next = $url->arg('destination')) {
             $ctx->redirect($next);
         }
     }
     return $ctx->getRedirect();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:26,代码来源:class.nodeapimodule.php

示例4: redirect

 /**
  * Перенаправление в контексте CMS.
  *
  * Позволяет перенаправлять используя относительные урлы (относительно папки,
  * в которой установлена CMS).
  *
  * @param mixed $url текст ссылки, массив или объект url.
  * @return void
  */
 public function redirect($url, $status = 301, Node $node = null)
 {
     $url1 = new url($url);
     if (empty($_GET['__cleanurls'])) {
         if (isset($url1->path)) {
             $url1->setarg('q', $url1->path);
             $url1->path = null;
         }
     } elseif (!isset($url1->path)) {
         $url1->path = $url1->arg('q');
         $url1->setarg('q', null);
     }
     $next = $url1->getAbsolute($this);
     if (null !== $node and $node->id) {
         if (!$node->published) {
             $mode = 'pending';
         } elseif ($node->isNew()) {
             $mode = 'created';
         } else {
             $mode = 'updated';
         }
         $url = new url($next);
         $url->setarg('pending', null);
         $url->setarg('created', null);
         $url->setarg('updated', null);
         if ('%ID' == $url->arg('id')) {
             $url->setarg('id', $node->id);
         } else {
             $url->setarg($mode, $node->id);
             $url->setarg('type', $node->class);
         }
         $next = $url->string();
     }
     $r = new Redirect($next, $status);
     $r->send();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:45,代码来源:class.context.php


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