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


PHP core::lib方法代码示例

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


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

示例1: action_api_editor_menu

 /**
  * Editor nav menu
  */
 function action_api_editor_menu()
 {
     /** @var tf_editor $ed */
     $ed = core::lib('editor');
     $menu = array();
     // dies on get_editor_actions
     $menu['core'] = core::get_instance()->get_editor_actions();
     foreach (core::modules() as $module) {
         $menu[$module->get_name()] = $module->get_editor_actions();
     }
     $menuNormalized = array();
     foreach ($menu as $key => $actions) {
         $submenuNormalized = array();
         if (!empty($actions)) {
             foreach ($actions as $subKey => $subMenu) {
                 if (!empty($subMenu['url'])) {
                     $subMenu['url'] = $ed->make_url($subMenu['url'], 1);
                 }
                 $submenuNormalized[] = !$subMenu ? array() : array_merge(array('id' => $subKey), $subMenu);
             }
             $menuNormalized[] = array('id' => $key, 'title' => i18n::T(array($key, '_name')), 'actions' => $submenuNormalized);
         }
     }
     $this->renderer->set_ajax_answer($menuNormalized)->ajax_flush();
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:28,代码来源:controller.php

示例2: activate

 /**
  * Activate filter
  */
 function activate()
 {
     core::dprint('Activate RSS');
     // tpl_loader::set_template('');
     core::lib('renderer')->set_page_template('root.embed');
     tf_request::set_ident('embed', 'yes');
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:10,代码来源:embed.php

示例3: activate

 /**
  * Activate filter
  */
 function activate()
 {
     core::dprint('Activate RSS');
     tpl_loader::set_template('rss');
     core::lib('renderer')->set_content_type('text/xml');
     // 'application/rss+xml'
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:10,代码来源:rss.php

示例4: notify_user

 function notify_user($email, $text)
 {
     if (!$this->get_container()->get_notify_user()) {
         return;
     }
     core::lib('mailer')->email(array('from' => 'info@' . ($domain = core::module('sat')->get_current_site()->get_domain()), 'to' => $email, 'subject' => 'Пользователь заполнил анкету на сайте ' . $domain, 'msg' => $text, 'is_html' => true));
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:7,代码来源:item.php

示例5: __get

 /**
  * Get lib (IOC)
  * $module->renderer etc.
  * @param $key
  */
 function __get($key)
 {
     if (isset($this->dependencies[$key])) {
         return $this->resolve_dependency($key);
     }
     // fallback to libs
     return core::lib($key);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:13,代码来源:module_ioc.php

示例6: render_before

 function render_before()
 {
     if (isset($_POST['filter'])) {
         $key = core::lib('db')->escape($_POST['filter']['title']);
         $this->set_where("LCASE(p1.nick) like '%{$key}%' OR LCASE(p1.login) like '%{$key}%'");
         $this->renderer->set_data('_filter', array('title' => $key));
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:8,代码来源:users.php

示例7: create_after

 /**
  * Notify user about
  * @param $data
  */
 function create_after($data)
 {
     $notify_tpl = $this->container->config->get('notify_template');
     if ($notify_tpl) {
         /** @var tf_mailer */
         $mailer = core::lib('mailer');
         $mailer->email_template($notify_tpl, $data['email'] ? $data['email'] : 'test@domain.ru', $data, true);
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:13,代码来源:item.php

示例8: run

 /**
  * Remember!
  * Assign current item in controller for comment linking!
  */
 function run()
 {
     if (loader::in_ajax() !== true) {
         throw new controller_exception('Cant touch this ' . __METHOD__);
         return false;
     }
     core::dprint('run comment modify');
     $pctl = core::modules()->get_router()->get_controller();
     $user = core::lib('auth')->get_user();
     /**
      * Parent item, must be assigned thru @see module_controller::set_current_item()
      * @var abs_collection_item
      */
     $post = $pctl->get_current_item();
     // var_dump(get_class($post), core::get_modules()->get_router()->get_name());
     if (!$post) {
         throw new controller_exception('No item assigned');
     }
     if (!$post->has_behavior('sat.commentable')) {
         throw new controller_exception('Not commentable');
     }
     $comments = $post->behavior('sat.commentable')->get_attach_model();
     //get_comments();
     $request = core::lib('request');
     $renderer = core::lib('renderer');
     $user_id = core::lib('auth')->get_user()->id;
     $pid = (int) $request->post('pid', 0);
     $limit = core::selfie()->cfg('comment_interval', 60);
     $auth = core::lib('auth');
     /** @var aregistry $sd */
     $sd = $auth->get_current_session()->get_storage();
     $time = $sd->comments_last_time;
     //$time = $comments->get_last_time($pid, $user_id);
     // disallow by interval
     if ($time && $time + $limit > time()) {
         $pctl->set_null_template();
         $renderer->set_ajax_answer(array('status' => false, 'id' => 0, 'message' => vsprintf(i18n::T('sat\\comment_interval_restriction'), $time + $limit - time())))->ajax_flush();
         // else core::get_instance()->set_message(array('content', 'comment_interval_restriction'));
         return;
         // exit
     }
     $sd->comments_last_time = time();
     $username = functions::request_var('username', '');
     $text = functions::request_var('text', '');
     $api = functions::request_var('api');
     $id = $comments->modify(array('user_ip' => core::lib('auth')->get_user_ip(true), 'user_id' => $user_id, 'ctype_id' => $post->get_ctype_id(), 'username' => $username, 'pid' => $pid, 'text' => $text, 'type' => functions::request_var('type', 0), 'tpid' => functions::request_var('tpid', 0), 'api' => $api));
     $comment = $comments->get_item_by_id($id);
     if (!$comment) {
         throw new controller_exception('[ajax] Comment create failed');
     }
     $comment->load_secondary();
     $renderer->set_data('comment', $comment->render())->set_ajax_answer(array('status' => true, 'id' => $id))->set_ajax_message(i18n::T('sat\\comment_posted'));
     //->set_main_template('content/comment/view');
     $renderer->ajax_flush('shared/comments/comment');
     // alright, update counter
     return $id;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:61,代码来源:modify.php

示例9: send_feedback

 private function send_feedback()
 {
     $template = 'feedback';
     $vars = $this->request->post();
     $to = $vars['email'];
     /** @var tf_mailer */
     $mailer = core::lib('mailer');
     $result = $mailer->email_template($template, $to, $vars, true);
     $this->set_message('Отправка сообщения', $result)->set_message_data($vars);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:10,代码来源:feedback.php

示例10: notify_user

 function notify_user($data, $result)
 {
     /*
     $mtpl = core::get_instance()->get_mail_tpl_handle()->get_mail_template('edu_request');
     */
     $data['test_result'] = $result ? $result->text : '';
     /** @var tf_mailer */
     $mailer = core::lib('mailer');
     $mailer->email_template('edu_request', $data['email'] ? $data['email'] : 'test@domain.ru', $data, true);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:10,代码来源:collection.php

示例11: parse_data

 /** 
  * Parse smarty data
  */
 function parse_data()
 {
     if ($this->plain) {
         return;
     }
     $pre = 'string: ' . $this->text;
     /** @var smarty */
     $tpl = core::lib('tpl_parser');
     //tpl_loader::get_parser();
     $this->content = !empty($this->text) ? $tpl->fetch($pre) : '';
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:14,代码来源:item.php

示例12: set_current

 /**
  * Doamin matched in initial_route
  */
 function set_current()
 {
     $this->_current = true;
     if (0 != $this->template) {
         $core = core::get_instance();
         $templates = $core->get_cfg_var('templates');
         if (isset($templates[$this->template])) {
             core::dprint(array('SITE_LAYOUT : %s', $templates[$this->template]), core::E_DEBUG1);
             core::lib('renderer')->set_layout($templates[$this->template]);
         }
     }
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:15,代码来源:item.php

示例13: elFinderIsAuthed

/**
* Transler bridge
*/
function elFinderIsAuthed()
{
    if (!defined('ELFIINDER_AUTHED')) {
        require_once dirname(__FILE__) . '/../../../modules/core/loader.php';
        loader::bootstrap();
        /** @var users_item */
        $user = core::lib('auth')->get_user();
        $authed = $user->level >= 50;
        define('ELFIINDER_AUTHED', $authed);
    }
    return ELFIINDER_AUTHED;
}
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:15,代码来源:Authorize.php

示例14: run

 function run()
 {
     $q = trim(urldecode($this->request->get('q')));
     $q = core::lib('db')->escape($q);
     if (strings::strlen($q) < 2) {
         $this->renderer->set_ajax_result(false)->set_ajax_message('Короткое сообщение')->ajax_flush(false);
         return;
     }
     $pmod = $this->_controller->get_context();
     $ph = $pmod->get_search_handle()->set_working_fields('keyword')->set_limit(10);
     if (!empty($q)) {
         $ph->set_where("keyword like '%{$q}%' AND c_count > 0");
     }
     $sugg = $ph->load()->render();
     core::get_instance()->ajax_answer($sugg);
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:16,代码来源:suggest.php

示例15: run

 function run()
 {
     $name = functions::request_var('template', '');
     $name = $name ? $name : 'default';
     if (empty($name) || !preg_match('@^[a-z\\d]+$@i', $name)) {
         throw new controller_exception('Bad id');
     }
     $domain = preg_replace('@^www\\.@', '', $_SERVER['HTTP_HOST']);
     $vars = $this->request->post();
     $to = $vars['email'];
     /** @var tf_mailer */
     $mailer = core::lib('mailer');
     $result = $mailer->email_template($name, $to, $vars, true);
     $this->renderer->set_ajax_result($result)->set_ajax_message('ok')->ajax_flush();
     return;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:16,代码来源:mailer.php


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