當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JAccess::getActionsFromFile方法代碼示例

本文整理匯總了PHP中JAccess::getActionsFromFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP JAccess::getActionsFromFile方法的具體用法?PHP JAccess::getActionsFromFile怎麽用?PHP JAccess::getActionsFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JAccess的用法示例。


在下文中一共展示了JAccess::getActionsFromFile方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: bind

 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  *
  * @return    null|string    null is operation was satisfactory, otherwise returns an error
  * @see        JTable:bind
  * @since      1.5
  */
 public function bind($array, $ignore = '')
 {
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_mapa.mapadevenezuela.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_mapa/access.xml', "/access/section[@name='mapadevenezuela']/");
         $default_actions = JAccess::getAssetRules('com_mapa.mapadevenezuela.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     //Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
開發者ID:amilianm,項目名稱:Joomla-MapaVenezuela,代碼行數:36,代碼來源:mapadevenezuela.php

示例2: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @param   \JUser  $user       The user object.
  * @param   string  $component  The component access file path, component base path or option name.
  * @param   string  $assetName  The asset name
  * @param   integer $categoryId The category ID.
  * @param   integer $id         The item ID.
  *
  * @return  Object
  */
 public static function getActions(\JUser $user, $component, $assetName, $categoryId = 0, $id = 0)
 {
     $result = new Object();
     // New rules: If path is access file
     $path = $component;
     if (!is_file($path)) {
         // New rules: If path is component base path
         $path = $path . '/access.xml';
     }
     if (!is_file($path)) {
         $path = PathHelper::getAdmin($component) . '/etc/access.xml';
     }
     if (!is_file($path)) {
         $path = PathHelper::getAdmin($component) . '/access.xml';
     }
     if (!$id && !$categoryId) {
         $section = 'component';
     } elseif (!$id && $categoryId) {
         $section = 'category';
         $assetName .= '.category.' . $categoryId;
     } elseif ($id && !$categoryId) {
         $section = $assetName;
         $assetName .= '.' . $assetName . '.' . $id;
     } else {
         $section = $assetName;
         $assetName .= '.' . $assetName;
     }
     $actions = \JAccess::getActionsFromFile($path, "/access/section[@name='" . $section . "']/");
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, $assetName));
     }
     return $result;
 }
開發者ID:Biromain,項目名稱:windwalker-joomla-rad,代碼行數:44,代碼來源:ComponentHelper.php

示例3: bind

 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  Optional array or list of parameters to ignore
  *
  * @return  null|string  null is operation was satisfactory, otherwise returns an error
  *
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_autofilter') && $array['state'] == 1)) {
         $array['state'] = 0;
     }
     if ($array['id'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_autofilter.categorie.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_autofilter/access.xml', "/access/section[@name='categorie']/");
         $default_actions = JAccess::getAssetRules('com_autofilter.categorie.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     // Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
開發者ID:tomazkramberger,項目名稱:autofilter,代碼行數:46,代碼來源:categorie.php

示例4: getActions

 /**
  * Получаем доступы для действий.
  *
  * @param   int  $categoryId  Id категории.
  * @param   int  $messageId   Id сообщения.
  *
  * @return  object
  */
 public static function getActions($categoryId = 0, $messageId = 0)
 {
     // Определяем имя ассета (ресурса).
     if (empty($messageId) && empty($categoryId)) {
         $assetName = 'com_helloworld';
         $section = 'component';
     } elseif (empty($messageId)) {
         $assetName = 'com_helloworld.category.' . (int) $categoryId;
         $section = 'category';
     } else {
         $assetName = 'com_helloworld.message.' . (int) $messageId;
         $section = 'message';
     }
     if (empty(self::$actions)) {
         // Получаем список доступных действий для компонента.
         $accessFile = JPATH_ADMINISTRATOR . '/components/com_helloworld/access.xml';
         $actions = JAccess::getActionsFromFile($accessFile, "/access/section[@name='" . $section . "']/");
         // Для сообщения и категорий добавляем действие core.admin.
         if ($section == 'category' || $section == 'message') {
             $adminAction = new stdClass();
             $adminAction->name = 'core.admin';
             array_push($actions, $adminAction);
         }
         self::$actions = new JObject();
         foreach ($actions as $action) {
             // Устанавливаем доступы пользователя для действий.
             self::$actions->set($action->name, JFactory::getUser()->authorise($action->name, $assetName));
         }
     }
     return self::$actions;
 }
開發者ID:thebeuving,項目名稱:joomla-25-component-example,代碼行數:39,代碼來源:helloworld.php

示例5: bind

 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  Optional array or list of parameters to ignore
  *
  * @return  null|string  null is operation was satisfactory, otherwise returns an error
  *
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     // Support for multiple or not foreign key field: ingredients_id
     if (!empty($array['ingredients_id'])) {
         if (is_array($array['ingredients_id'])) {
             $array['ingredients_id'] = implode(',', $array['ingredients_id']);
         } else {
             if (strrpos($array['ingredients_id'], ',') != false) {
                 $array['ingredients_id'] = explode(',', $array['ingredients_id']);
             }
         }
     } else {
         $array['ingredients_id'] = '';
     }
     // Support for multiple or not foreign key field: recipe_id
     if (!empty($array['recipe_id'])) {
         if (is_array($array['recipe_id'])) {
             $array['recipe_id'] = implode(',', $array['recipe_id']);
         } else {
             if (strrpos($array['recipe_id'], ',') != false) {
                 $array['recipe_id'] = explode(',', $array['recipe_id']);
             }
         }
     } else {
         $array['recipe_id'] = '';
     }
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if (($task == 'save' || $task == 'apply') && (!JFactory::getUser()->authorise('core.edit.state', 'com_akrecipes') && $array['state'] == 1)) {
         $array['state'] = 0;
     }
     if ($array['id'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_akrecipes.ingredient997479.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_akrecipes/access.xml', "/access/section[@name='ingredient997479']/");
         $default_actions = JAccess::getAssetRules('com_akrecipes.ingredient997479.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     // Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
開發者ID:rutvikd,項目名稱:ak-recipes,代碼行數:70,代碼來源:ingredient997479.php

示例6: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @return  JObject
  */
 public static function getActions()
 {
     $user = JFactory::getUser();
     $result = new JObject();
     $actions = JAccess::getActionsFromFile('com_modules');
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, 'com_modules'));
     }
     return $result;
 }
開發者ID:densem-2013,項目名稱:exikom,代碼行數:15,代碼來源:modules.php

示例7: getActions

 /**
  * Get the actions for ACL
  */
 public static function getActions()
 {
     $user = JFactory::getUser();
     $result = new JObject();
     $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_sichtweiten/access.xml', "/access/section[@name='component']/");
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, 'com_sichtweiten'));
     }
     return $result;
 }
開發者ID:Bakual,項目名稱:Sichtweiten,代碼行數:13,代碼來源:sichtweiten.php

示例8: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @return JObject
  */
 public static function getActions()
 {
     $result = new JObject();
     $actions = JAccess::getActionsFromFile(JPATH_COMPONENT_ADMINISTRATOR . '/access.xml');
     if ($actions !== false) {
         $user = JFactory::getUser();
         foreach ($actions as $action) {
             $result->set($action->name, $user->authorise($action->name, 'com_proofreader'));
         }
     }
     return $result;
 }
開發者ID:pupsikus,項目名稱:iman007.test,代碼行數:17,代碼來源:proofreader.php

示例9: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @param   integer  The module ID.
  *
  * @return  JObject
  */
 public static function getActions($moduleId = 0)
 {
     $user = JFactory::getUser();
     $result = new JObject();
     if (empty($moduleId)) {
         $assetName = 'com_modules';
     } else {
         $assetName = 'com_modules.module.' . (int) $moduleId;
     }
     $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_modules/access.xml', "/access/section[@name='component']/");
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, $assetName));
     }
     return $result;
 }
開發者ID:shoffmann52,項目名稱:install-from-web-server,代碼行數:22,代碼來源:modules.php

示例10: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @param   string   $component  The component name.
  * @param   string   $section    The access section name.
  * @param   integer  $id         The item ID.
  *
  * @return  JObject
  *
  * @since   3.2
  */
 public static function getActions($component = '', $section = '', $id = 0)
 {
     $user = JFactory::getUser();
     $result = new JObject();
     $path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml';
     if ($section && $id) {
         $assetName = $component . '.' . $section . '.' . (int) $id;
     } else {
         $assetName = $component;
     }
     $actions = JAccess::getActionsFromFile($path, "/access/section[@name='component']/");
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, $assetName));
     }
     return $result;
 }
開發者ID:Rai-Ka,項目名稱:joomla-cms,代碼行數:27,代碼來源:content.php

示例11: getActions

 public static function getActions()
 {
     $user = JFactory::getUser();
     $result = new JObject();
     $assetName = 'com_jcomments';
     $actions = JAccess::getActionsFromFile(JPATH_COMPONENT_ADMINISTRATOR . '/access.xml');
     if (is_array($actions)) {
         foreach ($actions as $action) {
             $result->set($action->name, $user->authorise($action->name, $assetName));
         }
     } else {
         $actions = array('core.admin', 'core.manage', 'core.create', 'core.delete', 'core.edit', 'core.edit.state');
         foreach ($actions as $action) {
             $result->set($action, $user->authorise($action, $assetName));
         }
     }
     return $result;
 }
開發者ID:DanyCan,項目名稱:wisten.github.io,代碼行數:18,代碼來源:jcomments.php

示例12: getActions

 /**
  * Gets a list of the actions that can be performed.
  *
  * @param	int		The category ID.
  * @param	int		The article ID.
  *
  * @return	JObject
  * @since	1.6
  */
 public static function getActions($formId = 0, $fieldId = 0)
 {
     $user = JFactory::getUser();
     $result = new JObject();
     if (empty($formId) && empty($fieldId)) {
         $assetName = 'com_visforms';
     } else {
         if (empty($fieldId)) {
             $assetName = 'com_visforms.visform.' . (int) $formId;
         } else {
             $assetName = 'com_visforms.visform.' . (int) $formId . '.visfield.' . (int) $fieldId;
         }
     }
     $actions = JAccess::getActionsFromFile(JPath::clean(JPATH_ADMINISTRATOR . '/components/com_visforms/access.xml'), "/access/section[@name='component']/");
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, $assetName));
     }
     return $result;
 }
開發者ID:shamusdougan,項目名稱:GDMCWebsite,代碼行數:28,代碼來源:visforms.php

示例13: bind

 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param   array  $array   Named array
  * @param   mixed  $ignore  Optional array or list of parameters to ignore
  *
  * @return  null|string  null is operation was satisfactory, otherwise returns an error
  *
  * @see     JTable:bind
  * @since   1.5
  */
 public function bind($array, $ignore = '')
 {
     $input = JFactory::getApplication()->input;
     $task = $input->getString('task', '');
     if ($array['id'] == 0) {
         $array['created_by'] = JFactory::getUser()->id;
     }
     if ($array['id'] == 0) {
         $array['modified_by'] = JFactory::getUser()->id;
     }
     // Support for alias field: alias
     if (empty($array['alias'])) {
         if (empty($array['brand_name'])) {
             $array['alias'] = JFilterOutput::stringURLSafe(date('Y-m-d H:i:s'));
         } else {
             $array['alias'] = JFilterOutput::stringURLSafe(trim($array['brand_name']));
         }
     }
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     if (isset($array['metadata']) && is_array($array['metadata'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['metadata']);
         $array['metadata'] = (string) $registry;
     }
     if (!JFactory::getUser()->authorise('core.admin', 'com_akrecipes.brand.' . $array['id'])) {
         $actions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/com_akrecipes/access.xml', "/access/section[@name='brand']/");
         $default_actions = JAccess::getAssetRules('com_akrecipes.brand.' . $array['id'])->getData();
         $array_jaccess = array();
         foreach ($actions as $action) {
             $array_jaccess[$action->name] = $default_actions[$action->name];
         }
         $array['rules'] = $this->JAccessRulestoArray($array_jaccess);
     }
     // Bind the rules for ACL where supported.
     if (isset($array['rules']) && is_array($array['rules'])) {
         $this->setRules($array['rules']);
     }
     return parent::bind($array, $ignore);
 }
開發者ID:rutvikd,項目名稱:ak-recipes,代碼行數:54,代碼來源:brand.php

示例14: getFieldActions

 /**
  * Method to get the list of possible permission action names for the form field.
  *
  * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the
  *                                      form field object.
  *
  * @return  array   A list of permission action names from the form field element definition.
  *
  * @since   11.1
  */
 protected function getFieldActions(SimpleXMLElement $element)
 {
     $actions = array();
     // Initialise some field attributes.
     $section = $element['section'] ? (string) $element['section'] : '';
     $component = $element['component'] ? (string) $element['component'] : '';
     // Get the asset actions for the element.
     $elActions = JAccess::getActionsFromFile(JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml', "/access/section[@name='" . $section . "']/");
     // Iterate over the asset actions and add to the actions.
     foreach ($elActions as $item) {
         $actions[] = $item->name;
     }
     // Iterate over the children and add to the actions.
     foreach ($element->children() as $el) {
         if ($el->getName() == 'action') {
             $actions[] = (string) $el['name'];
         }
     }
     return $actions;
 }
開發者ID:ZerGabriel,項目名稱:joomla-platform,代碼行數:30,代碼來源:rules.php

示例15: getActions

 public static function getActions($component = '', $section = '', $id = 0)
 {
     if (is_int($component) || is_null($component) || (empty($section) || $section == 'component')) {
         $result = JHelperContent::getActions($component, $section, $id);
         return $result;
     }
     $user = JFactory::getUser();
     $result = new JObject();
     $path = JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml';
     if ($section && $id) {
         $assetName = $component . '.' . $section . '.' . (int) $id;
     } else {
         $assetName = $component;
     }
     $actions = JAccess::getActionsFromFile($path, "/access/section[@name='" . $section . "']/");
     //linha modificada em relacao a funcao original
     foreach ($actions as $action) {
         $result->set($action->name, $user->authorise($action->name, $assetName));
     }
     return $result;
 }
開發者ID:VierlingMt,項目名稱:joomla-3.x,代碼行數:21,代碼來源:agendadirigentes.php


注:本文中的JAccess::getActionsFromFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。