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


PHP BaseObject::get_meta_info方法代码示例

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


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

示例1: fetch_entries


//.........这里部分代码省略.........
                 $no_resort = 0;
             } else {
                 $sort_field = 'entry_' . $args['sort_by'];
             }
             if ($sort_field) {
                 $no_resort = 1;
             }
             if ($args['sort_by'] == 'score' || $args['sort_by'] == 'rate') {
                 $post_sort_limit = $limit;
                 $post_sort_offset = $offset;
                 $limit = 0;
                 $offset = 0;
                 $no_resort = 0;
                 $sort_field = "entry_modified_on";
             }
         } else {
             $sort_field = isset($timestamp_field) ? $timestamp_field : 'entry_authored_on';
         }
     } else {
         $sort_field = isset($timestamp_field) ? $timestamp_field : 'entry_authored_on';
         $no_resort = 0;
     }
     if ($sort_field) {
         $base_order = (isset($args['sort_order']) ? $args['sort_order'] : (isset($args['base_sort_order']) ? $args['base_sort_order'] : '')) === 'ascend' ? 'asc' : 'desc';
     }
     if (count($filters) || !is_null($total_count)) {
         $post_select_limit = $limit;
         $post_select_offset = $offset;
         $limit = 0;
         $offset = 0;
     }
     if (count($fields)) {
         $meta_join_num = 1;
         $entry_meta_info = Entry::get_meta_info('entry');
         if (!empty($entry_meta_info)) {
             foreach ($fields as $name => $value) {
                 if (isset($entry_meta_info['field.' . $name])) {
                     $meta_col = $entry_meta_info['field.' . $name];
                     $value = $this->escape($value);
                     $table = "mt_entry_meta entry_meta{$meta_join_num}";
                     $extras['join'][$table] = array('condition' => "(entry_meta{$meta_join_num}.entry_meta_entry_id = entry_id\n                                and entry_meta{$meta_join_num}.entry_meta_type = 'field.{$name}'\n                                and entry_meta{$meta_join_num}.entry_meta_{$meta_col}='{$value}')\n");
                     $meta_join_num++;
                 }
             }
         }
     }
     $join_clause = '';
     if (isset($extras['join'])) {
         $joins = $extras['join'];
         $keys = array_keys($joins);
         foreach ($keys as $key) {
             $table = $key;
             $cond = $joins[$key]['condition'];
             $type = '';
             if (isset($joins[$key]['type'])) {
                 $type = $joins[$key]['type'];
             }
             $join_clause .= ' ' . strtolower($type) . ' JOIN ' . $table . ' ON ' . $cond;
         }
     }
     $sql = "select\n                    mt_entry.*\n                from mt_entry\n                    {$join_clause}\n                where\n                    entry_status = 2\n                    {$blog_filter}\n                    {$entry_filter}\n                    {$author_filter}\n                    {$date_filter}\n                    {$day_filter}\n                    {$class_filter}\n                    {$max_comment_filter}\n                    {$min_comment_filter}";
     if ($sort_field) {
         $sql .= "order by {$sort_field} {$base_order}";
         if ($sort_field == 'entry_authored_on') {
             $sql .= ",entry_id {$base_order}";
         }
开发者ID:OCMO,项目名称:movabletype,代码行数:67,代码来源:mtdb.base.php

示例2: has_column

 public function has_column($col_name)
 {
     if (empty($col_name)) {
         return false;
     }
     // Retrieve from MetaInfo
     $col = $col_name;
     if (preg_match('/^field[:\\.](.+)$/', $col, $match)) {
         $col = $match[1];
     }
     $cls = strtolower(get_class($this));
     $meta_info = BaseObject::get_meta_info($cls);
     if (!empty($meta_info)) {
         if (array_key_exists($col, $meta_info)) {
             return true;
         }
     }
     // Retrieve from column
     $pattern = '/^' . $this->_prefix . "/i";
     if (!preg_match($pattern, $col)) {
         $col = $this->_prefix . $col;
     }
     $flds = $this->GetAttributeNames();
     return in_array(strtolower($col), $flds);
 }
开发者ID:benvanstaveren,项目名称:movabletype,代码行数:25,代码来源:class.baseobject.php


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