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


PHP Draft::where方法代码示例

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


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

示例1: index

 function index()
 {
     list($params, $id) = $this->parse_params(func_get_args());
     $theme = new Theme();
     $themes = $theme->read(true);
     if ($this->method == 'post' && isset($_POST['theme'])) {
         $t = $_POST['theme'];
         if (isset($themes[$t])) {
             $d = new Draft();
             $d->where('draft', 1)->update('draft', 0);
             $d->where('path', $t)->get();
             $d->path = $t;
             $d->draft = 1;
             if (isset($_POST['refresh'])) {
                 $d->init_draft_nav($_POST['refresh']);
             }
             $d->save();
             $this->redirect('/drafts');
         } else {
             // error
         }
     } else {
         if ($this->method == 'delete' && isset($_POST['theme'])) {
             $d = new Draft();
             $d->where('path', $_POST['theme'])->get();
             if ($d->exists()) {
                 $d->delete();
             }
             exit;
         }
     }
     $final = array();
     $d = new Draft();
     $drafts = $d->get_iterated();
     foreach ($drafts as $d) {
         if (isset($themes[$d->path])) {
             $final[] = array('id' => $d->id, 'theme' => $themes[$d->path], 'published' => (bool) $d->current, 'active' => (bool) $d->draft, 'created_on' => (int) $d->created_on, 'modified_on' => (int) $d->modified_on);
         }
     }
     $this->set_response_data($final);
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:41,代码来源:drafts.php

示例2: form_urls

 public function form_urls()
 {
     if ($this->urls) {
         return $this->urls;
     }
     $d = new Draft();
     $context = defined('DRAFT_CONTEXT') ? DRAFT_CONTEXT : false;
     $path = '';
     if (!$context) {
         $d->where('current', 1)->get();
         $path = $d->path;
     } else {
         if (is_numeric(DRAFT_CONTEXT)) {
             $d->get_by_id(DRAFT_CONTEXT);
             $path = $d->path;
         } else {
             $path = DRAFT_CONTEXT;
         }
     }
     list($this->urls, $this->url_data, , $this->segments) = $d->setup_urls(FCPATH . 'storage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $path . DIRECTORY_SEPARATOR);
     return $this->urls;
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:22,代码来源:koken.php

示例3: publish

 function publish($draft_id = false)
 {
     if (!$draft_id) {
         $this->error('400', 'Draft ID parameter not present.');
         return;
     }
     if ($this->method === 'post') {
         $draft = new Draft();
         $draft->where('id', $draft_id)->get();
         if ($draft->exists()) {
             $draft->where('current', 1)->update('current', 0);
             $draft->live_data = $draft->data;
             $draft->current = 1;
             $draft->save();
             $guid = FCPATH . 'storage' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $draft->path . DIRECTORY_SEPARATOR . 'koken.guid';
             if (file_exists($guid)) {
                 $s = new Setting();
                 $s->where('name', 'uuid')->get();
                 $curl = curl_init();
                 curl_setopt($curl, CURLOPT_URL, KOKEN_STORE_URL . '/register?uuid=' . $s->value . '&theme=' . trim(file_get_contents($guid)));
                 curl_setopt($curl, CURLOPT_HEADER, 0);
                 curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
                 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                 $r = curl_exec($curl);
                 curl_close($curl);
             }
             exit;
         } else {
             $this->error('404', "Draft not found.");
             return;
         }
     } else {
         $this->error('400', 'This endpoint only accepts tokenized POST requests.');
         return;
     }
 }
开发者ID:Caldis,项目名称:htdocs,代码行数:38,代码来源:sites.php

示例4: array

 function init_draft_nav($refresh = true)
 {
     if ($refresh === 'nav') {
         $this->data = json_decode($this->data, true);
     } else {
         $this->data = array();
     }
     $ds = DIRECTORY_SEPARATOR;
     $template_path = FCPATH . 'storage' . $ds . 'themes' . $ds;
     $theme_root = $template_path . $this->path . $ds;
     $template_info = json_decode(file_get_contents($theme_root . 'info.json'), true);
     list($urls, $data, $routes) = $this->setup_urls($theme_root);
     $this->data['navigation'] = array('items' => array());
     $this->data['navigation']['groups'] = $groups = array();
     $defaults = array('timeline', 'albums', 'contents', 'essays');
     $used_autos = array();
     $user = new User();
     $user->get();
     $front = array('auto' => 'home', 'front' => true);
     if (isset($template_info['default_front_page']) && in_array($template_info['default_front_page'], array('timeline', 'albums', 'contents', 'essays', 'archives')) && isset($urls[$template_info['default_front_page']])) {
         $defaults = array_diff($defaults, array($template_info['default_front_page']));
         $front['path'] = $urls[$template_info['default_front_page']];
         $front['auto'] = $template_info['default_front_page'];
         $used_autos[] = $template_info['default_front_page'];
     } else {
         $front['path'] = '/home/';
     }
     $this->data['navigation']['items'][] = $front;
     foreach ($defaults as $default) {
         if (file_exists($theme_root . $default . '.lens')) {
             $used_autos[] = $default;
             $this->data['navigation']['items'][] = array('auto' => $default);
         }
     }
     if (isset($template_info['navigation_groups'])) {
         foreach ($template_info['navigation_groups'] as $key => $info) {
             $items = array();
             if (isset($info['defaults'])) {
                 foreach ($info['defaults'] as $def) {
                     if (is_array($def)) {
                         $def['path'] = $def['url'];
                         unset($def['url']);
                         $items[] = $def;
                     } else {
                         if ($def === 'front') {
                             $items[] = $front;
                         } else {
                             if (in_array($def, array('twitter', 'facebook', 'gplus'))) {
                                 $def = $def === 'gplus' ? 'google' : $def;
                                 if (!empty($user->{$def})) {
                                     $items[] = array('auto' => 'profile', 'id' => $def);
                                 }
                             } else {
                                 if (file_exists($theme_root . $def . '.lens')) {
                                     $items[] = array('auto' => $def);
                                 }
                             }
                         }
                     }
                 }
             }
             $this->data['navigation']['groups'][] = array('key' => $key, 'label' => $info['label'], 'items' => $items);
         }
     }
     if ($refresh === 'nav') {
         $this->data['routes'] = $routes;
     } else {
         $p = new Draft();
         $p->where('current', 1)->get();
         $pub_data = json_decode($p->live_data, true);
         foreach ($pub_data['navigation']['items'] as $item) {
             if ((!isset($item['front']) || !$item['front']) && !in_array($item, $this->data['navigation']['items']) && (isset($item['custom']) || isset($item['auto']) && isset($urls[$item['auto']]) && !in_array($item['auto'], $used_autos))) {
                 $this->data['navigation']['items'][] = $item;
             }
         }
     }
     $this->data = json_encode($this->data);
 }
开发者ID:Atomox,项目名称:benhelmerphotography,代码行数:78,代码来源:draft.php

示例5: fetchDraftText

 public function fetchDraftText($msg_id)
 {
     $thisMessage = Draft::where('id', '=', $msg_id)->first();
     $thisMessageText = $thisMessage->message;
     return $thisMessageText;
 }
开发者ID:Nabil5352,项目名称:Team-Management-Application,代码行数:6,代码来源:FunctionController.php


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