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


PHP WFModelEditor::getPlugins方法代码示例

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


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

示例1: getProfile

 /**
  * Get an appropriate editor profile
  * @access public
  * @return $profile Object
  */
 public function getProfile($plugin = null)
 {
     if (!isset(self::$profile)) {
         $mainframe = JFactory::getApplication();
         $db = JFactory::getDBO();
         $user = JFactory::getUser();
         $option = $this->getComponentOption();
         $query = $db->getQuery(true);
         if (is_object($query)) {
             $query->select('*')->from('#__wf_profiles')->where('published = 1')->order('ordering ASC');
         } else {
             $query = 'SELECT * FROM #__wf_profiles' . ' WHERE published = 1' . ' ORDER BY ordering ASC';
         }
         $db->setQuery($query);
         $profiles = $db->loadObjectList();
         if ($option == 'com_jce') {
             $component_id = JRequest::getInt('component_id');
             if ($component_id) {
                 $component = WFExtensionHelper::getComponent($component_id);
                 $option = isset($component->element) ? $component->element : $component->option;
             }
         }
         // get the Joomla! area (admin or site)
         $area = $mainframe->isAdmin() ? 2 : 1;
         if (!class_exists('Wf_Mobile_Detect')) {
             // load mobile detect class
             require_once dirname(__FILE__) . '/mobile.php';
         }
         $mobile = new Wf_Mobile_Detect();
         // set device values
         if ($mobile->isMobile()) {
             $device = 'phone';
         } else {
             if ($mobile->isTablet()) {
                 $device = 'tablet';
             } else {
                 $device = 'desktop';
             }
         }
         // Joomla! 1.6+
         if (method_exists('JUser', 'getAuthorisedGroups')) {
             $keys = $user->getAuthorisedGroups();
         } else {
             $keys = array($user->gid);
         }
         foreach ($profiles as $item) {
             // at least one user group or user must be set
             if (empty($item->types) && empty($item->users)) {
                 continue;
             }
             // check user groups - a value should always be set
             $groups = array_intersect($keys, explode(',', $item->types));
             // user not in the current group...
             if (empty($groups)) {
                 // no additional users set or no user match
                 if (empty($item->users) || in_array($user->id, explode(',', $item->users)) === false) {
                     continue;
                 }
             }
             // check component
             if ($option !== 'com_jce' && $item->components && in_array($option, explode(',', $item->components)) === false) {
                 continue;
             }
             // set device default as 'desktop,tablet,mobile'
             if (!isset($item->device) || empty($item->device)) {
                 $item->device = 'desktop,tablet,phone';
             }
             // check device
             if (in_array($device, explode(',', $item->device)) === false) {
                 continue;
             }
             // check area
             if (!empty($item->area) && (int) $item->area != $area) {
                 continue;
             }
             // check for individual plugin - use Editor Model as it adds "core" plugins to profile set
             if ($plugin) {
                 wfimport('admin.models.editor');
                 $model = new WFModelEditor();
                 $plugins = (array) $model->getPlugins();
                 if (in_array($plugin, $plugins) === false) {
                     continue;
                 }
             }
             // decrypt params
             if (!empty($item->params)) {
                 wfimport('admin.helpers.encrypt');
                 $item->params = WFEncryptHelper::decrypt($item->params);
             }
             // assign item to profile
             self::$profile = $item;
             // return
             return self::$profile;
         }
         return null;
//.........这里部分代码省略.........
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:101,代码来源:editor.php


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