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


PHP core::module方法代码示例

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


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

示例1: run

 function run()
 {
     /**@var tf_sat $sat */
     $sat = core::module('sat');
     $site = $sat->get_current_site();
     $json_file = loader::get_public('assets/' . $site->domain . '.json');
     $last_mod = @filemtime($json_file);
     $tree_last_mod = 0;
     if ($last_mod) {
         $last_node = $sat->get_node_handle()->set_where('site_id = %d', $sat->get_current_site_id())->set_order('updated_at DESC')->load_first();
         $tree_last_mod = $last_node ? $last_node->updated_at : 0;
         core::dprint(__METHOD__ . ': cached');
         // uptodate
         if ($tree_last_mod <= $last_mod) {
             $this->renderer->set_ajax_answer(file_get_contents($json_file))->ajax_flush();
             return;
         }
     }
     core::dprint(__METHOD__ . ': fetch!');
     $tree = $sat->get_current_site_tree();
     $allowedKeys = array('title', 'url');
     array_walk($tree, function (&$v) use($allowedKeys) {
         $v = array_intersect_key($v, array_flip($allowedKeys));
     });
     $tree = array_values($tree);
     // cache
     file_put_contents($json_file, functions::json_encode($tree));
     $this->renderer->set_ajax_answer($tree)->ajax_flush();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:29,代码来源:tree.php

示例2: get_result_options

 /** @return anket_result_option_collection */
 function get_result_options()
 {
     if (!isset($this->_result_options)) {
         $this->_result_options = core::module('anket')->get_result_option_handle()->set_where('pid = %d', $this->id)->load();
     }
     return $this->_result_options;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:8,代码来源:item.php

示例3: get_anket_result

 function get_anket_result()
 {
     if (!isset($this->_anket_result) && core::modules()->is_registered('anket')) {
         $this->_anket_result = core::module('anket')->get_managed_item('anket_result', $this->result_id, array('with_module_prefix' => 1));
     }
     return $this->_anket_result;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:7,代码来源:item.php

示例4: get_answers

 /** @return anket_answer_collection */
 function get_answers()
 {
     if (!isset($this->_answers)) {
         $this->_answers = core::module('anket')->get_answer_handle()->set_where('pid = %d', $this->id)->load();
     }
     return $this->_answers;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:8,代码来源:item.php

示例5: get_widgets

 function get_widgets()
 {
     if (!isset($this->_widgets)) {
         $this->_widgets = core::module('sat')->get_widget_handle()->set_where('pid = %d', $this->id)->load();
     }
     return $this->_widgets;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:7,代码来源:item.php

示例6: get_childrens

 function get_childrens()
 {
     if (!isset($this->_childrens)) {
         $this->_childrens = core::module('sat')->get_menu_handle()->set_where('pid = %d', $this->id)->load();
     }
     return $this->_childrens;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:7,代码来源:collection.php

示例7: run

 function run()
 {
     $site_id = core::module('sat')->get_current_site_id();
     $page = ($pf = $this->_controller->get_router()->get_filter('pagination')) ? $pf->get_start() : 0;
     /** @var \tf\core\collection_filter*/
     $f = $this->_controller->get_context()->get_qa_question_handle()->get_filter('/contacts/qa/')->set_config(array('where_sql' => "site_id = {$site_id} AND active"))->set_per_page($this->_per_page)->set_pagination($page);
     $this->renderer->set_return('posts', $f->apply()->as_array());
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:8,代码来源:list.php

示例8: create_objects

 private function create_objects($classes)
 {
     $this->_objects = array();
     foreach ($classes as $class) {
         list($module, $class) = explode('/', $class);
         $this->_objects["{$module}_{$class}"] = core::module($module)->class_register($class, array('no_preload' => true));
     }
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:8,代码来源:generator.php

示例9: get_fields

 function get_fields($parent = null)
 {
     if (!isset($this->_fields)) {
         $this->_fields = core::module('extrafs')->get_field_handle()->set_where('gid = %d', $this->id)->set_parent($parent ? $parent : $this->get_container()->get_parent())->load();
         foreach ($this->_fields as $f) {
             $f->set_group($this);
         }
     }
     return $this->_fields;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:10,代码来源:collection.php

示例10: qa

 /**
  * Similar posts
  * @param array (site_id, pid, count)
  */
 function qa($params = null)
 {
     // 'pid' => int 558
     $site_id = core::module('sat')->get_current_site_id();
     $count = isset($params->count) ? $params->count : 5;
     $ctx = $this->get_context();
     $posts = $ctx->get_qa_question_handle();
     $posts->set_limit($count)->set_where('site_id = %d AND active', $site_id)->load();
     return $posts ? $posts->render() : false;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:14,代码来源:blocks.php

示例11: create_objects

 private function create_objects($classes)
 {
     $this->_objects = array();
     if (!empty($classes)) {
         foreach ($classes as $class) {
             list($module, $class) = explode('.', $class);
             $this->_objects["{$module}_{$class}"] = core::module($module)->model($class);
             core::dprint(array("[GENERATOR] Add %s", "{$module}_{$class}"), core::E_MESSAGE);
         }
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:11,代码来源:generator.php

示例12: get_handle

 /**
  * Get handle for this content type
  * 
  * Calls to module::get_{ctype}_handle()
  * Warn! Handle are cached/cleaned
  * 
  * @return IAbs_Collection handle
  */
 function get_handle()
 {
     if (!empty($this->_handle)) {
         $this->_handle->clear();
     } else {
         $module = core::module($this->module);
         $method = 'get_' . $this->name . 's_handle';
         $this->_handle = call_user_func(array($module, $method));
     }
     return $this->_handle;
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:19,代码来源:item.php

示例13: get_field_values

 /**
  * get values for mapped parent
  * @return extrafs_value_collection
  */
 function get_field_values()
 {
     if (!isset($this->_extra_fs_values_collection)) {
         // fetch values for current parent *pid*
         $this->_extra_fs_values_collection = core::module('extrafs')->get_value_handle()->set_where('pid = %d AND ctype_id = %d', $this->_parent->get_id(), $this->_parent->get_ctype_id())->load();
     }
     foreach ($this as $v) {
         $v->get_field_value();
     }
     return $this->_extra_fs_values_collection;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:15,代码来源:collection.php

示例14: run

 function run()
 {
     $posts = core::module('sat')->get_news_handle()->set_order('created_at DESC')->set_limit(10)->where('active', true)->with_deps(array('category'))->load()->render();
     $parser = tpl_loader::get_parser(true);
     $parser->assign('site', core::module('sat')->get_current_site()->render());
     $parser->assign('posts', $posts);
     header('Content-Type: text/xml; charset=UTF-8');
     // display appends smarty_debug
     echo $parser->fetch('partials/sat/news/xml.tpl');
     core::selfie()->halt();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:11,代码来源:rss.php

示例15: sync_children

 /**
  * @param int $id
  */
 function sync_children($id = 0)
 {
     // sqlite: UPDATE sat_sat_news_category SET c_count = (SELECT COUNT(*) FROM sat_sat_news p2 WHERE p2.pid = sat_sat_news_category.id)
     $collection = core::module('sat')->model($this->child_model);
     if (!$collection) {
         throw new collection_exception('Bad model in category: ' . $this->child_model);
     }
     $table = $this->get_table();
     $table_model = $collection->get_table();
     $sql = "UPDATE {$table} SET c_count = (SELECT COUNT(*) FROM {$table_model} p2 WHERE p2.pid = {$table}.id)";
     if ($id) {
         $sql .= " WHERE id = {$id}";
     }
     $this->db->query($sql);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:18,代码来源:collection.php


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