Last active
August 29, 2015 14:17
-
-
Save ryandemmer/46ff99c9e05cea2fea75 to your computer and use it in GitHub Desktop.
Example WFCustomFileSystem extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package JCE | |
* @copyright Copyright (c) 2009-2015 Ryan Demmer. All rights reserved. | |
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
* JCE is free software. This version may have been modified pursuant | |
* to the GNU General Public License, and as distributed it includes or | |
* is derivative of works licensed under the GNU General Public License or | |
* other free or open source software licenses. | |
*/ | |
defined('_JEXEC') or die('RESTRICTED'); | |
require_once(__DIR__ . '/joomla.php'); | |
class WFCustomFileSystem extends WFJoomlaSystem { | |
public function getRootDir() { | |
static $root; | |
if (!isset($root)) { | |
// Get base directory as shared parameter | |
$dir = $this->get('dir', ''); | |
// get custom variable to replace | |
$custom = JRequest::getVar('custom_var', ''); | |
// replace value | |
$dir = str_replace('$custom', $custom, $dir); | |
// set dir variable with custom | |
$this->set('dir', $dir); | |
// use parent class to process root directory | |
$root = parent::getRootDir(); | |
} | |
return $root; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment