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


PHP cmsCore::loadWidgetLanguage方法代码示例

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


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

示例1: run

 public function run($binded_id = false)
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!$binded_id) {
         cmsCore::error404();
     }
     $template = cmsTemplate::getInstance();
     $widgets_model = cmsCore::getModel('widgets');
     $widget = $widgets_model->getWidgetBinding($binded_id);
     cmsCore::loadWidgetLanguage($widget['name'], $widget['controller']);
     $form = cmsCore::getWidgetOptionsForm($widget['name'], $widget['controller'], $widget['options']);
     return $template->render('widgets_settings', array('form' => $form, 'widget' => $widget, 'errors' => false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:15,代码来源:widgets_edit.php

示例2: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     $widget_id = $this->request->get('widget_id', 0);
     $page_id = $this->request->get('page_id', 0);
     $position = $this->request->get('position', '');
     $template = $this->request->get('template', '');
     $tpls = cmsCore::getTemplates();
     if (!$template || !in_array($template, $tpls)) {
         $template = cmsConfig::get('template');
     }
     $widgets_model = cmsCore::getModel('widgets');
     $widget = $widgets_model->getWidget($widget_id);
     $binded_id = $widgets_model->addWidgetBinding($widget, $page_id, $position, $template);
     $bind_widget = $widgets_model->getWidgetBinding($binded_id);
     cmsCore::loadWidgetLanguage($bind_widget['name'], $bind_widget['controller']);
     $form = cmsCore::getWidgetOptionsForm($bind_widget['name'], $bind_widget['controller'], false, $bind_widget['template']);
     $data = $form->parse(new cmsRequest($bind_widget));
     $widgets_model->updateWidgetBinding($binded_id, $data);
     $this->cms_template->renderJSON(array('error' => !(bool) $binded_id, 'id' => $binded_id));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:23,代码来源:widgets_add.php

示例3: run

 public function run()
 {
     if (!$this->request->isAjax()) {
         cmsCore::error404();
     }
     if (!$this->request->has('id')) {
         cmsCore::error404();
     }
     $template = cmsTemplate::getInstance();
     $widgets_model = cmsCore::getModel('widgets');
     $widget_id = $this->request->get('id');
     $widget = $widgets_model->getWidgetBinding($widget_id);
     cmsCore::loadWidgetLanguage($widget['name'], $widget['controller']);
     $form = cmsCore::getWidgetOptionsForm($widget['name'], $widget['controller'], false);
     $widget = $form->parse($this->request, true);
     $errors = $form->validate($this, $widget);
     if (!$errors) {
         $widgets_model->updateWidgetBinding($widget_id, $widget);
         $template->renderJSON(array('errors' => false, 'callback' => 'widgetUpdated'));
     }
     if ($errors) {
         $template->renderJSON(array('errors' => $errors));
     }
 }
开发者ID:asphix,项目名称:icms2,代码行数:24,代码来源:widgets_update.php

示例4: runWidget

 public function runWidget($widget)
 {
     $user = cmsUser::getInstance();
     $is_user_view = $user->isInGroups($widget['groups_view']);
     $is_user_hide = !empty($widget['groups_hide']) && $user->isInGroups($widget['groups_hide']) && !$user->is_admin;
     if ($is_user_hide) {
         return false;
     }
     if (!$is_user_view) {
         return false;
     }
     $path = 'system/' . cmsCore::getWidgetPath($widget['name'], $widget['controller']);
     $file = $path . '/widget.php';
     cmsCore::includeFile($file);
     cmsCore::loadWidgetLanguage($widget['name'], $widget['controller']);
     $class = 'widget' . ($widget['controller'] ? string_to_camel('_', $widget['controller']) : '') . string_to_camel('_', $widget['name']);
     $widget_object = new $class($widget);
     $cache_key = "widgets.{$widget['id']}";
     $cache = cmsCache::getInstance();
     if (!$widget_object->isCacheable() || false === ($result = $cache->get($cache_key))) {
         $result = call_user_func_array(array($widget_object, 'run'), array());
         if ($result) {
             // Отдельно кешируем имя шаблона виджета, поскольку оно могло быть
             // изменено внутри виджета, а в кеш у нас попадает только тот массив
             // который возвращается кодом виджета (без самих свойств $widget_object)
             $result['_wd_template'] = $widget_object->getTemplate();
         }
         $cache->set($cache_key, $result);
     }
     if ($result === false) {
         return false;
     }
     if (isset($result['_wd_template'])) {
         $widget_object->setTemplate($result['_wd_template']);
     }
     cmsTemplate::getInstance()->renderWidget($widget_object, $result);
 }
开发者ID:asphix,项目名称:icms2,代码行数:37,代码来源:core.php


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