Back to Access class

Method getActionsFromFile

public static bool|array
getActionsFromFile
(mixed $file, mixed $xpath = "/access/section[@name='component']/")
Method to return a list of actions from a file for which permissions can be set.
Parameters
  • string $file The path to the XML file.
  • string $xpath An optional xpath to search for the fields.
Returns
  • bool|array False if case of error or the list of actions available.
Since
  • 3.0.0
Class: Access
Project: Joomla

Method getActionsFromFile - Source code

/**
 * Method to return a list of actions from a file for which permissions can be set.
 *
 * @param   string  $file   The path to the XML file.
 * @param   string  $xpath  An optional xpath to search for the fields.
 *
 * @return  boolean|array   False if case of error or the list of actions available.
 *
 * @since   3.0.0
 */
public static function getActionsFromFile($file, $xpath = "/access/section[@name='component']/")
{
    if (!is_file($file) || !is_readable($file)) {
        // If unable to find the file return false.
        return false;
    } else {
        // Else return the actions from the xml.
        $xml = simplexml_load_file($file);
        return self::getActionsFromData($xml, $xpath);
    }
}