本文整理汇总了PHP中JPath::check方法的典型用法代码示例。如果您正苦于以下问题:PHP JPath::check方法的具体用法?PHP JPath::check怎么用?PHP JPath::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPath
的用法示例。
在下文中一共展示了JPath::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connector
function connector()
{
$mainframe = JFactory::getApplication();
$params = JComponentHelper::getParams('com_digicom');
$root = $params->get('ftp_source_path', 'digicom');
$folder = JRequest::getVar('folder', $root, 'default', 'path');
if (JString::trim($folder) == "") {
$folder = $root;
} else {
// Ensure that we are always below the root directory
if (strpos($folder, $root) !== 0) {
$folder = $root;
}
}
// Disable debug
JRequest::setVar('debug', false);
$url = JURI::root(true) . '/' . $folder;
$path = JPATH_SITE . '/' . JPath::clean($folder);
JPath::check($path);
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderConnector.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinder.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeDriver.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/libs/elfinder/elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$mainframe = JFactory::getApplication();
// Hide PHP files.
$ext = strtolower(JFile::getExt(basename($path)));
if ($ext == 'php') {
return true;
}
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
return $mainframe->isSite() ? false : true;
break;
case 'locked':
return $mainframe->isSite() ? true : false;
break;
case 'hidden':
return false;
break;
}
}
if ($mainframe->isAdmin()) {
$permissions = array('read' => true, 'write' => true);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('debug' => false, 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例2: isset
/**
* Get the params for the configuration variables
*/
function &getParams()
{
static $instance;
if ($instance == null) {
$component = JEV_COM_COMPONENT;
$table = JTable::getInstance('extension');
//if (!$table->loadByOption( $component ))
if (!$table->load(array("element" => "com_jevents", "type" => "component"))) {
JError::raiseWarning(500, 'Not a valid component');
return false;
}
// work out file path
if ($path = JRequest::getString('path')) {
$path = JPath::clean(JPATH_SITE . '/' . $path);
JPath::check($path);
} else {
$option = preg_replace('#\\W#', '', isset($table->element) ? $table->element : $table->option);
$path = JPATH_ADMINISTRATOR . '/' . 'components' . '/' . $option . '/' . 'config.xml';
}
// Use our own class to add more functionality!
include_once JEV_ADMINLIBS . "jevparams.php";
if (file_exists($path)) {
$instance = new JevParameter($table->params, $path);
} else {
$instance = new JevParameter($table->params);
}
}
return $instance;
}
示例3: connector
public function connector()
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$path = SigProHelper::getPath('site');
$url = SigProHelper::getHTTPPath($path);
JPath::check($path);
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderConnector.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinder.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeDriver.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
if ($mainframe->isSite()) {
return false;
} else {
return version_compare(JVERSION, '1.6.0', 'ge') ? $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro') : true;
}
break;
case 'locked':
if ($mainframe->isSite()) {
return true;
} else {
return version_compare(JVERSION, '1.6.0', 'ge') ? !($user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro')) : false;
}
break;
case 'hidden':
return false;
break;
}
}
if ($mainframe->isAdmin()) {
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$write = $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro');
} else {
$write = true;
}
$permissions = array('read' => true, 'write' => $write);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例4: image
/**
* Display an image.
*
* @param string $src The source of the image
*
* @return string A <img> element if the specified file exists, otherwise, a null string
*
* @since 2.5
*/
public static function image($src)
{
$src = preg_replace('#[^A-Z0-9\\-_\\./]#i', '', $src);
$file = JPATH_SITE . '/' . $src;
jimport('joomla.filesystem.path');
JPath::check($file);
if (!file_exists($file)) {
return '';
}
return '<img src="' . JUri::root() . $src . '" alt="" />';
}
示例5: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState()
{
// Set the component (option) we are dealing with.
$component = JRequest::getCmd('component');
$this->setState('component.option', $component);
// Set an alternative path for the configuration file.
if ($path = JRequest::getString('path')) {
$path = JPath::clean(JPATH_SITE . '/' . $path);
JPath::check($path);
$this->setState('component.path', $path);
}
}
示例6: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState()
{
$input = JFactory::getApplication()->input;
// Set the component (option) we are dealing with.
$component = $input->get('component');
$this->setState('component.option', $component);
// Set an alternative path for the configuration file.
if ($path = $input->getString('path')) {
$path = JPath::clean(JPATH_SITE . '/' . $path);
JPath::check($path);
$this->setState('component.path', $path);
}
}
示例7: connector
function connector()
{
$mainframe =& JFactory::getApplication();
$params =& JComponentHelper::getParams('com_media');
$root = $params->get('file_path', 'media');
$folder = JRequest::getVar('folder', $root, 'default', 'path');
$type = JRequest::getCmd('type', 'video');
if (JString::trim($folder) == "") {
$folder = $root;
}
$url = JURI::root(true) . '/' . $folder;
$path = JPATH_SITE . DS . JPath::clean($folder);
JPath::check($path);
include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderConnector.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinder.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderVolumeDriver.class.php';
include_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'elfinder' . DS . 'elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$mainframe =& JFactory::getApplication();
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
return $mainframe->isSite() ? false : true;
break;
case 'locked':
return $mainframe->isSite() ? true : false;
break;
case 'hidden':
return false;
break;
}
}
if ($mainframe->isAdmin()) {
$permissions = array('read' => true, 'write' => true);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
}
示例8: getPath
public static function getPath($type = 'site')
{
jimport('joomla.filesystem.file');
$application = JFactory::getApplication();
if ($type == 'k2') {
$path = JPATH_SITE . '/media/k2/galleries';
} else {
if ($type == 'site') {
$user = JFactory::getUser();
if (version_compare(JVERSION, '2.5', 'ge')) {
$isAdmin = $user->authorise('core.admin', 'com_sigpro');
} else {
$isAdmin = $user->gid == 25;
}
if ($application->isAdmin() || $isAdmin) {
if (version_compare(JVERSION, '1.6.0', 'ge')) {
$defaultImagePath = 'images';
} else {
$defaultImagePath = 'images/stories';
}
$params = JComponentHelper::getParams('com_sigpro');
$path = JPATH_SITE . '/' . $params->get('galleries_rootfolder', $defaultImagePath);
} else {
$folder = self::getUserFolder();
$path = JPATH_SITE . '/media/jw_sigpro/users/' . $folder;
if (!JFolder::exists($path)) {
JFolder::create($path);
}
}
} else {
if ($type == 'users') {
$path = JPATH_SITE . '/media/jw_sigpro/users';
}
}
}
$path = JPath::clean($path);
JPath::check($path);
if (JString::substr($path, -1, 1) == DIRECTORY_SEPARATOR) {
$path = JString::rtrim($path, DIRECTORY_SEPARATOR);
}
return $path;
}
示例9: getPluginHelper
/**
* Method to load a user activity plugin translation helper
*
* @param string $name The name of the plugin
* @param string $type The plugin type (Optional)
* @param array $config Config options (Optional)
*
* @return mixed $plugin The plugin helper instance on success, Null if not found
*/
public static function getPluginHelper($name, $type = 'useractivity', $config = array())
{
static $plugins = array();
// Check the cache
$cache = $type . '.' . $name;
if (isset($plugins[$cache])) {
return $plugins[$cache];
}
// Include the helper file
$helper_file = JPath::check(JPATH_PLUGINS . '/' . $type . '/' . $name . '/helpers/' . $name . '.php');
if (!file_exists($helper_file)) {
$plugins[$cache] = null;
return null;
}
require_once $helper_file;
// Create class instance
$class_name = 'plg' . $type . $name . 'Helper';
$plugins[$cache] = new $class_name($config);
return $plugins[$cache];
}
示例10: getFiles
function getFiles($path)
{
static $list;
// Only process the list once per request
if (is_array($list)) {
return $list;
}
$path = JPath::clean($path, '/');
$folder = JPath::check(JPATH_ROOT . '/' . $path);
if (!is_readable($folder)) {
return false;
}
$files = array();
$folders = array();
$docs = array();
$extensions = array('jpg', 'png', 'gif', 'jpeg');
// Get upload files if any
include 'getuploads.php';
// Iterate over the files if they exist
foreach (JFolder::files($folder) as $file) {
$extension = strtolower(pathinfo($folder . '/' . $file, PATHINFO_EXTENSION));
if (!in_array($extension, $extensions)) {
continue;
}
$tmp = new stdClass();
$tmp->name = $file;
$tmp->path = $path . '/' . $file;
$tmp->url = JURI::root() . $path . '/' . $file;
$tmp->size = filesize(JPATH_ROOT . '/' . $tmp->path);
$tmp->date = date("Y-m-d H:i:s", getlastmod(JPATH_ROOT . '/' . $tmp->path));
$tmp->isimage = true;
$info = getimagesize(JPATH_ROOT . '/' . $tmp->path);
$tmp->width = $info[0];
$tmp->height = $info[1];
$tmp->type = $info[2];
$tmp->mime = $info['mime'];
$tmp->thumbnailUrl = $this->getThumbnailUrl($tmp, 60, 60);
$files[] = $tmp;
}
return $files;
}
示例11: parseComponentArea
/**
* Parses the configuration options of a specific component area
*
* @param string $component Which component's cionfiguration to parse
* @param string $area Which area to parse (frontend, backend, cli)
*
* @return array A hash array with the configuration data
*/
protected function parseComponentArea($component, $area)
{
// Initialise the return array
$ret = array();
// Check that the path exists
JLoader::import('joomla.filesystem.folder');
$path = JPATH_ADMINISTRATOR . '/components/' . $component;
$path = JPath::check($path);
if (!JFolder::exists($path)) {
return $ret;
}
// Read the filename if it exists
$filename = $path . '/fof.xml';
if (!JFile::exists($filename)) {
return $ret;
}
$data = JFile::read($filename);
// Load the XML data in a SimpleXMLElement object
$xml = simplexml_load_string($data);
if (!$xml instanceof SimpleXMLElement) {
return $ret;
}
// Get this area's data
$areaData = $xml->xpath('//' . $area);
if (empty($areaData)) {
return $ret;
}
$xml = array_shift($areaData);
// Parse individual configuration domains
$domains = $this->getDomains();
foreach ($domains as $dom) {
$class = 'FOFConfigDomain' . ucfirst($dom);
if (class_exists($class, true)) {
$o = new $class();
$o->parseDomain($xml, $ret);
}
}
// Finally, return the result
return $ret;
}
示例12: JParameter
/**
* Get the params for the configuration variables
*/
function &getParams()
{
static $instance;
if ($instance == null) {
$component = JRequest::getCmd('component');
$table =& JTable::getInstance('component');
$table->loadByOption($component);
// work out file path
if ($path = JRequest::getString('path')) {
$path = JPath::clean(JPATH_SITE . DS . $path);
JPath::check($path);
} else {
$option = preg_replace('#\\W#', '', $table->option);
$path = JPATH_ADMINISTRATOR . DS . 'components' . DS . $option . DS . 'config.xml';
}
if (file_exists($path)) {
$instance = new JParameter($table->params, $path);
} else {
$instance = new JParameter($table->params);
}
}
return $instance;
}
示例13: connector
public function connector()
{
$application = JFactory::getApplication();
$user = JFactory::getUser();
if ($user->guest) {
K2Response::throwError(JText::_('K2_YOU_ARE_NOT_AUTHORIZED_TO_PERFORM_THIS_OPERATION'), 403);
}
$params = JComponentHelper::getParams('com_media');
$root = $params->get('file_path', 'media');
$folder = $this->input->get('folder', $root, 'path');
$type = $this->input->get('type', 'video', 'cmd');
if (JString::trim($folder) == "") {
$folder = $root;
} else {
// Ensure that we are always below the root directory
if (strpos($folder, $root) !== 0) {
$folder = $root;
}
}
// Disable debug
$this->input->set('debug', false);
$url = JURI::root(true) . '/' . $folder;
$path = JPATH_SITE . '/' . JPath::clean($folder);
JPath::check($path);
include_once JPATH_SITE . '/media/k2app/vendor/elfinder/php/elFinderConnector.class.php';
include_once JPATH_SITE . '/media/k2app/vendor/elfinder/php/elFinder.class.php';
include_once JPATH_SITE . '/media/k2app/vendor/elfinder/php/elFinderVolumeDriver.class.php';
include_once JPATH_SITE . '/media/k2app/vendor/elfinder/php/elFinderVolumeLocalFileSystem.class.php';
function access($attr, $path, $data, $volume)
{
$application = JFactory::getApplication();
$ext = strtolower(JFile::getExt(basename($path)));
if ($ext == 'php') {
return true;
}
// Hide files and folders starting with .
if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
return true;
}
// Read only access for front-end. Full access for administration section.
switch ($attr) {
case 'read':
return true;
break;
case 'write':
return $application->isSite() ? false : true;
break;
case 'locked':
return $application->isSite() ? true : false;
break;
case 'hidden':
return false;
break;
}
}
if ($application->isAdmin()) {
$permissions = array('read' => true, 'write' => true);
} else {
$permissions = array('read' => true, 'write' => false);
}
$options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
$connector = new elFinderConnector(new elFinder($options));
$connector->run();
return $this;
}
示例14: pathCheck
/**
* Checks for snooping outside of the file system root.
*
* @param string $path A file system path to check.
*
* @return string A cleaned version of the path or exit on error.
*
* @throws \Exception
*/
public function pathCheck($path)
{
return \JPath::check($path);
}
示例15: check
/**
* Helper wrapper method for check
*
* @param string $path A file system path to check.
*
* @return string A cleaned version of the path or exit on error.
*
* @see JPath::check()
* @since 3.4
* @throws Exception
*/
public function check($path)
{
return JPath::check($path);
}