-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from Groruk/qol-patch
QOL | Start of templating rework
- Loading branch information
Showing
93 changed files
with
5,387 additions
and
1,289 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "1.7.0", | ||
"git": "788", | ||
"git": "808", | ||
"dev": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
class AdminTabs | ||
{ | ||
private $tabs = []; | ||
public function __construct(array $tabs, $userbank) | ||
{ | ||
foreach ($tabs as $tab) { | ||
if ($userbank->HasAccess($tab['permission'])) { | ||
if (!isset($tab['config']) || $tab['config']) { | ||
$this->tabs[] = $tab; | ||
} | ||
} | ||
} | ||
Template::render('core/admin_tabs', [ | ||
'tabs' => $this->tabs | ||
]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Mustache.php. | ||
* | ||
* (c) 2010-2017 Justin Hileman | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Mustache class autoloader. | ||
*/ | ||
class Mustache_Autoloader | ||
{ | ||
private $baseDir; | ||
|
||
/** | ||
* An array where the key is the baseDir and the key is an instance of this | ||
* class. | ||
* | ||
* @var array | ||
*/ | ||
private static $instances; | ||
|
||
/** | ||
* Autoloader constructor. | ||
* | ||
* @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..') | ||
*/ | ||
public function __construct($baseDir = null) | ||
{ | ||
if ($baseDir === null) { | ||
$baseDir = dirname(__FILE__) . '/..'; | ||
} | ||
|
||
// realpath doesn't always work, for example, with stream URIs | ||
$realDir = realpath($baseDir); | ||
if (is_dir($realDir)) { | ||
$this->baseDir = $realDir; | ||
} else { | ||
$this->baseDir = $baseDir; | ||
} | ||
} | ||
|
||
/** | ||
* Register a new instance as an SPL autoloader. | ||
* | ||
* @param string $baseDir Mustache library base directory (default: dirname(__FILE__).'/..') | ||
* | ||
* @return Mustache_Autoloader Registered Autoloader instance | ||
*/ | ||
public static function register($baseDir = null) | ||
{ | ||
$key = $baseDir ? $baseDir : 0; | ||
|
||
if (!isset(self::$instances[$key])) { | ||
self::$instances[$key] = new self($baseDir); | ||
} | ||
|
||
$loader = self::$instances[$key]; | ||
spl_autoload_register(array($loader, 'autoload')); | ||
|
||
return $loader; | ||
} | ||
|
||
/** | ||
* Autoload Mustache classes. | ||
* | ||
* @param string $class | ||
*/ | ||
public function autoload($class) | ||
{ | ||
if ($class[0] === '\\') { | ||
$class = substr($class, 1); | ||
} | ||
|
||
if (strpos($class, 'Mustache') !== 0) { | ||
return; | ||
} | ||
|
||
$file = sprintf('%s/%s.php', $this->baseDir, str_replace('_', '/', $class)); | ||
if (is_file($file)) { | ||
require $file; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Mustache.php. | ||
* | ||
* (c) 2010-2017 Justin Hileman | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Mustache Cache interface. | ||
* | ||
* Interface for caching and loading Mustache_Template classes | ||
* generated by the Mustache_Compiler. | ||
*/ | ||
interface Mustache_Cache | ||
{ | ||
/** | ||
* Load a compiled Mustache_Template class from cache. | ||
* | ||
* @param string $key | ||
* | ||
* @return bool indicates successfully class load | ||
*/ | ||
public function load($key); | ||
|
||
/** | ||
* Cache and load a compiled Mustache_Template class. | ||
* | ||
* @param string $key | ||
* @param string $value | ||
*/ | ||
public function cache($key, $value); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Mustache.php. | ||
* | ||
* (c) 2010-2017 Justin Hileman | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
/** | ||
* Abstract Mustache Cache class. | ||
* | ||
* Provides logging support to child implementations. | ||
* | ||
* @abstract | ||
*/ | ||
abstract class Mustache_Cache_AbstractCache implements Mustache_Cache | ||
{ | ||
private $logger = null; | ||
|
||
/** | ||
* Get the current logger instance. | ||
* | ||
* @return Mustache_Logger|Psr\Log\LoggerInterface | ||
*/ | ||
public function getLogger() | ||
{ | ||
return $this->logger; | ||
} | ||
|
||
/** | ||
* Set a logger instance. | ||
* | ||
* @param Mustache_Logger|Psr\Log\LoggerInterface $logger | ||
*/ | ||
public function setLogger($logger = null) | ||
{ | ||
if ($logger !== null && !($logger instanceof Mustache_Logger || is_a($logger, 'Psr\\Log\\LoggerInterface'))) { | ||
throw new Mustache_Exception_InvalidArgumentException('Expected an instance of Mustache_Logger or Psr\\Log\\LoggerInterface.'); | ||
} | ||
|
||
$this->logger = $logger; | ||
} | ||
|
||
/** | ||
* Add a log record if logging is enabled. | ||
* | ||
* @param int $level The logging level | ||
* @param string $message The log message | ||
* @param array $context The log context | ||
*/ | ||
protected function log($level, $message, array $context = array()) | ||
{ | ||
if (isset($this->logger)) { | ||
$this->logger->log($level, $message, $context); | ||
} | ||
} | ||
} |
Oops, something went wrong.