@@ -12,19 +12,19 @@ |
||
| 12 | 12 | * @package Phile\ServiceLocator |
| 13 | 13 | */ |
| 14 | 14 | interface TemplateInterface { |
| 15 | - /** |
|
| 16 | - * render the template |
|
| 17 | - * |
|
| 18 | - * @return mixed |
|
| 19 | - */ |
|
| 20 | - public function render(); |
|
| 15 | + /** |
|
| 16 | + * render the template |
|
| 17 | + * |
|
| 18 | + * @return mixed |
|
| 19 | + */ |
|
| 20 | + public function render(); |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * set current page |
|
| 24 | - * |
|
| 25 | - * @param \Phile\Model\Page $page |
|
| 26 | - * |
|
| 27 | - * @return mixed |
|
| 28 | - */ |
|
| 29 | - public function setCurrentPage(\Phile\Model\Page $page); |
|
| 22 | + /** |
|
| 23 | + * set current page |
|
| 24 | + * |
|
| 25 | + * @param \Phile\Model\Page $page |
|
| 26 | + * |
|
| 27 | + * @return mixed |
|
| 28 | + */ |
|
| 29 | + public function setCurrentPage(\Phile\Model\Page $page); |
|
| 30 | 30 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The ServiceLocator interface |
|
| 4 | - */ |
|
| 3 | + * The ServiceLocator interface |
|
| 4 | + */ |
|
| 5 | 5 | namespace Phile\ServiceLocator; |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * @package Phile\ServiceLocator |
| 13 | 13 | */ |
| 14 | 14 | interface ParserInterface { |
| 15 | - /** |
|
| 16 | - * parse data |
|
| 17 | - * |
|
| 18 | - * @param $data |
|
| 19 | - * |
|
| 20 | - * @return mixed |
|
| 21 | - */ |
|
| 22 | - public function parse($data); |
|
| 15 | + /** |
|
| 16 | + * parse data |
|
| 17 | + * |
|
| 18 | + * @param $data |
|
| 19 | + * |
|
| 20 | + * @return mixed |
|
| 21 | + */ |
|
| 22 | + public function parse($data); |
|
| 23 | 23 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The EventObserverInterface |
|
| 4 | - */ |
|
| 3 | + * The EventObserverInterface |
|
| 4 | + */ |
|
| 5 | 5 | namespace Phile\Gateway; |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | * @package Phile\Gateway |
| 14 | 14 | */ |
| 15 | 15 | interface EventObserverInterface { |
| 16 | - /** |
|
| 17 | - * event method |
|
| 18 | - * |
|
| 19 | - * @param string $eventKey |
|
| 20 | - * @param mixed $data |
|
| 21 | - * |
|
| 22 | - * @return mixed |
|
| 23 | - */ |
|
| 24 | - public function on($eventKey, $data = null); |
|
| 16 | + /** |
|
| 17 | + * event method |
|
| 18 | + * |
|
| 19 | + * @param string $eventKey |
|
| 20 | + * @param mixed $data |
|
| 21 | + * |
|
| 22 | + * @return mixed |
|
| 23 | + */ |
|
| 24 | + public function on($eventKey, $data = null); |
|
| 25 | 25 | } |
@@ -1,21 +1,21 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * the filter class for all files |
|
| 4 | - */ |
|
| 3 | + * the filter class for all files |
|
| 4 | + */ |
|
| 5 | 5 | namespace Phile\FilterIterator; |
| 6 | 6 | /** |
| 7 | - * Class GeneralFileFilterIterator |
|
| 8 | - * |
|
| 9 | - * @package Phile\FilterIterator |
|
| 10 | - */ |
|
| 7 | + * Class GeneralFileFilterIterator |
|
| 8 | + * |
|
| 9 | + * @package Phile\FilterIterator |
|
| 10 | + */ |
|
| 11 | 11 | class GeneralFileFilterIterator extends \FilterIterator { |
| 12 | - /** |
|
| 13 | - * method to decide if file is filterd or not |
|
| 14 | - * @return bool |
|
| 15 | - */ |
|
| 16 | - public function accept() { |
|
| 17 | - // accept all kind of files, no filter |
|
| 18 | - return true; |
|
| 19 | - } |
|
| 12 | + /** |
|
| 13 | + * method to decide if file is filterd or not |
|
| 14 | + * @return bool |
|
| 15 | + */ |
|
| 16 | + public function accept() { |
|
| 17 | + // accept all kind of files, no filter |
|
| 18 | + return true; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | 21 | } |
| 22 | 22 | \ No newline at end of file |
@@ -10,13 +10,13 @@ |
||
| 10 | 10 | * @package Phile\FilterIterator |
| 11 | 11 | */ |
| 12 | 12 | class ContentFileFilterIterator extends \FilterIterator { |
| 13 | - /** |
|
| 14 | - * method to decide if file is filterd or not |
|
| 15 | - * @return bool |
|
| 16 | - */ |
|
| 17 | - public function accept() { |
|
| 18 | - /** @var \SplFileInfo $this */ |
|
| 19 | - return (preg_match('/^[^\.]{1}.*'.CONTENT_EXT.'/', $this->getFilename()) > 0); |
|
| 20 | - } |
|
| 13 | + /** |
|
| 14 | + * method to decide if file is filterd or not |
|
| 15 | + * @return bool |
|
| 16 | + */ |
|
| 17 | + public function accept() { |
|
| 18 | + /** @var \SplFileInfo $this */ |
|
| 19 | + return (preg_match('/^[^\.]{1}.*'.CONTENT_EXT.'/', $this->getFilename()) > 0); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | 22 | } |
| 23 | 23 | \ No newline at end of file |
@@ -28,37 +28,37 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class Plugin extends \Phile\Plugin\AbstractPlugin { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * subscribe to Phile events with methods of this class |
|
| 33 | - * |
|
| 34 | - * In this example we subscribe to "before_parse_content" and |
|
| 35 | - * "outputPluginSettings" will be called. |
|
| 36 | - */ |
|
| 37 | - protected $events = ['before_parse_content' => 'outputPluginSettings']; |
|
| 31 | + /** |
|
| 32 | + * subscribe to Phile events with methods of this class |
|
| 33 | + * |
|
| 34 | + * In this example we subscribe to "before_parse_content" and |
|
| 35 | + * "outputPluginSettings" will be called. |
|
| 36 | + */ |
|
| 37 | + protected $events = ['before_parse_content' => 'outputPluginSettings']; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * the method we assigned to the 'before_parse_content' event |
|
| 41 | - * |
|
| 42 | - * in this example we output this plugins' settings on the top of every page |
|
| 43 | - * |
|
| 44 | - * @param null|array $data depends on the particular event (see Phile's event docs) |
|
| 45 | - */ |
|
| 46 | - public function outputPluginSettings($data = null) { |
|
| 47 | - // you can access this plugins' config in $this->settings |
|
| 48 | - $settings = $this->settings; |
|
| 39 | + /** |
|
| 40 | + * the method we assigned to the 'before_parse_content' event |
|
| 41 | + * |
|
| 42 | + * in this example we output this plugins' settings on the top of every page |
|
| 43 | + * |
|
| 44 | + * @param null|array $data depends on the particular event (see Phile's event docs) |
|
| 45 | + */ |
|
| 46 | + public function outputPluginSettings($data = null) { |
|
| 47 | + // you can access this plugins' config in $this->settings |
|
| 48 | + $settings = $this->settings; |
|
| 49 | 49 | |
| 50 | - $content = $data['content']; |
|
| 51 | - $content = $this->printPhpAsMarkdown($settings) . $content; |
|
| 50 | + $content = $data['content']; |
|
| 51 | + $content = $this->printPhpAsMarkdown($settings) . $content; |
|
| 52 | 52 | |
| 53 | - $page = $data['page']; |
|
| 54 | - $page->setContent($content); |
|
| 55 | - } |
|
| 53 | + $page = $data['page']; |
|
| 54 | + $page->setContent($content); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * plugin helper method for printing PHP as markdown code |
|
| 59 | - */ |
|
| 60 | - protected function printPhpAsMarkdown($input) { |
|
| 61 | - return "\n```php\n" . trim(print_r($input, true), "\n") . "\n```\n"; |
|
| 62 | - } |
|
| 57 | + /** |
|
| 58 | + * plugin helper method for printing PHP as markdown code |
|
| 59 | + */ |
|
| 60 | + protected function printPhpAsMarkdown($input) { |
|
| 61 | + return "\n```php\n" . trim(print_r($input, true), "\n") . "\n```\n"; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * The PhpFastCache implemenation class |
|
| 4 | - */ |
|
| 3 | + * The PhpFastCache implemenation class |
|
| 4 | + */ |
|
| 5 | 5 | namespace Phile\Plugin\Phile\PhpFastCache; |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -13,73 +13,73 @@ discard block |
||
| 13 | 13 | * @package Phile\Plugin\Phile\PhpFastCache |
| 14 | 14 | */ |
| 15 | 15 | class PhpFastCache implements \Phile\ServiceLocator\CacheInterface { |
| 16 | - /** |
|
| 17 | - * @var \BasePhpFastCache the cache engine |
|
| 18 | - */ |
|
| 19 | - protected $cacheEngine; |
|
| 16 | + /** |
|
| 17 | + * @var \BasePhpFastCache the cache engine |
|
| 18 | + */ |
|
| 19 | + protected $cacheEngine; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * the constructor |
|
| 23 | - * |
|
| 24 | - * @param \BasePhpFastCache $cacheEngine |
|
| 25 | - */ |
|
| 26 | - public function __construct(\BasePhpFastCache $cacheEngine) { |
|
| 27 | - $this->cacheEngine = $cacheEngine; |
|
| 28 | - } |
|
| 21 | + /** |
|
| 22 | + * the constructor |
|
| 23 | + * |
|
| 24 | + * @param \BasePhpFastCache $cacheEngine |
|
| 25 | + */ |
|
| 26 | + public function __construct(\BasePhpFastCache $cacheEngine) { |
|
| 27 | + $this->cacheEngine = $cacheEngine; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * method to check if cache has entry for given key |
|
| 32 | - * |
|
| 33 | - * @param $key |
|
| 34 | - * |
|
| 35 | - * @return bool|mixed |
|
| 36 | - */ |
|
| 37 | - public function has($key) { |
|
| 38 | - return ($this->cacheEngine->get($key) !== null); |
|
| 39 | - } |
|
| 30 | + /** |
|
| 31 | + * method to check if cache has entry for given key |
|
| 32 | + * |
|
| 33 | + * @param $key |
|
| 34 | + * |
|
| 35 | + * @return bool|mixed |
|
| 36 | + */ |
|
| 37 | + public function has($key) { |
|
| 38 | + return ($this->cacheEngine->get($key) !== null); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * method to get cache entry |
|
| 43 | - * |
|
| 44 | - * @param $key |
|
| 45 | - * |
|
| 46 | - * @return mixed|null |
|
| 47 | - */ |
|
| 48 | - public function get($key) { |
|
| 49 | - return $this->cacheEngine->get($key); |
|
| 50 | - } |
|
| 41 | + /** |
|
| 42 | + * method to get cache entry |
|
| 43 | + * |
|
| 44 | + * @param $key |
|
| 45 | + * |
|
| 46 | + * @return mixed|null |
|
| 47 | + */ |
|
| 48 | + public function get($key) { |
|
| 49 | + return $this->cacheEngine->get($key); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * method to set cache entry |
|
| 54 | - * |
|
| 55 | - * @param string $key |
|
| 56 | - * @param string $value |
|
| 57 | - * @param int $time |
|
| 58 | - * @param array $options |
|
| 59 | - * |
|
| 60 | - * @return mixed|void |
|
| 61 | - */ |
|
| 62 | - public function set($key, $value, $time = 300, array $options = array()) { |
|
| 63 | - $this->cacheEngine->set($key, $value, $time, $options); |
|
| 64 | - } |
|
| 52 | + /** |
|
| 53 | + * method to set cache entry |
|
| 54 | + * |
|
| 55 | + * @param string $key |
|
| 56 | + * @param string $value |
|
| 57 | + * @param int $time |
|
| 58 | + * @param array $options |
|
| 59 | + * |
|
| 60 | + * @return mixed|void |
|
| 61 | + */ |
|
| 62 | + public function set($key, $value, $time = 300, array $options = array()) { |
|
| 63 | + $this->cacheEngine->set($key, $value, $time, $options); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * method to delete cache entry |
|
| 68 | - * |
|
| 69 | - * @param string $key |
|
| 70 | - * @param array $options |
|
| 71 | - * |
|
| 72 | - * @return mixed|void |
|
| 73 | - */ |
|
| 74 | - public function delete($key, array $options = array()) { |
|
| 75 | - $this->cacheEngine->delete($key, $options); |
|
| 76 | - } |
|
| 66 | + /** |
|
| 67 | + * method to delete cache entry |
|
| 68 | + * |
|
| 69 | + * @param string $key |
|
| 70 | + * @param array $options |
|
| 71 | + * |
|
| 72 | + * @return mixed|void |
|
| 73 | + */ |
|
| 74 | + public function delete($key, array $options = array()) { |
|
| 75 | + $this->cacheEngine->delete($key, $options); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * clean complete cache and delete all cached entries |
|
| 80 | - */ |
|
| 81 | - public function clean() { |
|
| 82 | - $this->cacheEngine->clean(); |
|
| 83 | - } |
|
| 78 | + /** |
|
| 79 | + * clean complete cache and delete all cached entries |
|
| 80 | + */ |
|
| 81 | + public function clean() { |
|
| 82 | + $this->cacheEngine->clean(); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | } |
@@ -3,48 +3,48 @@ |
||
| 3 | 3 | * config file for plugin |
| 4 | 4 | */ |
| 5 | 5 | $config = [ |
| 6 | - /** |
|
| 7 | - * Default storage engine |
|
| 8 | - * |
|
| 9 | - * e.g. "files": $cache = phpFastCache(); <-- will be files cache |
|
| 10 | - * |
|
| 11 | - * auto, files, sqlite, auto, apc, wincache, xcache, memcache, memcached, |
|
| 12 | - */ |
|
| 13 | - 'storage' => 'auto', |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Default Path for File Cache |
|
| 17 | - * |
|
| 18 | - * Use full PATH like /home/username/cache |
|
| 19 | - * Keep it blank "", it will automatic setup for you |
|
| 20 | - */ |
|
| 21 | - 'path' => CACHE_DIR, |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Permissions for file storage |
|
| 25 | - */ |
|
| 6 | + /** |
|
| 7 | + * Default storage engine |
|
| 8 | + * |
|
| 9 | + * e.g. "files": $cache = phpFastCache(); <-- will be files cache |
|
| 10 | + * |
|
| 11 | + * auto, files, sqlite, auto, apc, wincache, xcache, memcache, memcached, |
|
| 12 | + */ |
|
| 13 | + 'storage' => 'auto', |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Default Path for File Cache |
|
| 17 | + * |
|
| 18 | + * Use full PATH like /home/username/cache |
|
| 19 | + * Keep it blank "", it will automatic setup for you |
|
| 20 | + */ |
|
| 21 | + 'path' => CACHE_DIR, |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Permissions for file storage |
|
| 25 | + */ |
|
| 26 | 26 | // 'default_chmod' => 0777, // For security, please use 0666 for module and 0644 for cgi. |
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | // "securityKey" => "auto", // default will good. It will create a path by PATH/securityKey |
| 30 | 30 | |
| 31 | - /* |
|
| 31 | + /* |
|
| 32 | 32 | * FallBack Driver |
| 33 | 33 | * Example, in your code, you use memcached, apc..etc, but when you moved your web hosting |
| 34 | 34 | * The new hosting don't have memcached, or apc. What you do? Set fallback that driver to other driver. |
| 35 | 35 | */ |
| 36 | 36 | // "fallback" => "files", |
| 37 | 37 | |
| 38 | - /* |
|
| 38 | + /* |
|
| 39 | 39 | * .htaccess protect |
| 40 | 40 | * default will be true |
| 41 | 41 | */ |
| 42 | 42 | // "htaccess" => true, |
| 43 | 43 | |
| 44 | - /* |
|
| 44 | + /* |
|
| 45 | 45 | * Default Memcache Server for all $cache = phpFastCache("memcache"); |
| 46 | 46 | */ |
| 47 | - /* |
|
| 47 | + /* |
|
| 48 | 48 | "memcache" => array( |
| 49 | 49 | array("127.0.0.1",11211,1), |
| 50 | 50 | // array("new.host.ip",11211,1), |
@@ -20,28 +20,28 @@ |
||
| 20 | 20 | * @package Phile\Plugin\Phile\ParserMarkdown |
| 21 | 21 | */ |
| 22 | 22 | class Plugin extends AbstractPlugin { |
| 23 | - const HANDLER_ERROR_LOG = 'error_log'; |
|
| 24 | - const HANDLER_DEVELOPMENT = 'development'; |
|
| 23 | + const HANDLER_ERROR_LOG = 'error_log'; |
|
| 24 | + const HANDLER_DEVELOPMENT = 'development'; |
|
| 25 | 25 | |
| 26 | - protected $events = ['plugins_loaded' => 'onPluginsLoaded']; |
|
| 26 | + protected $events = ['plugins_loaded' => 'onPluginsLoaded']; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * called on 'plugins_loaded' event |
|
| 30 | - * |
|
| 31 | - * @param null $data |
|
| 32 | - * @throws \Phile\Exception\ServiceLocatorException |
|
| 33 | - */ |
|
| 34 | - public function onPluginsLoaded($data = null) { |
|
| 35 | - $this->settings['base_url'] = (new Router)->getBaseUrl(); |
|
| 36 | - switch ($this->settings['handler']) { |
|
| 37 | - case Plugin::HANDLER_ERROR_LOG: |
|
| 38 | - ServiceLocator::registerService('Phile_ErrorHandler', |
|
| 39 | - new ErrorLog($this->settings)); |
|
| 40 | - break; |
|
| 41 | - case Plugin::HANDLER_DEVELOPMENT: |
|
| 42 | - ServiceLocator::registerService('Phile_ErrorHandler', |
|
| 43 | - new Development($this->settings)); |
|
| 44 | - break; |
|
| 45 | - } |
|
| 46 | - } |
|
| 28 | + /** |
|
| 29 | + * called on 'plugins_loaded' event |
|
| 30 | + * |
|
| 31 | + * @param null $data |
|
| 32 | + * @throws \Phile\Exception\ServiceLocatorException |
|
| 33 | + */ |
|
| 34 | + public function onPluginsLoaded($data = null) { |
|
| 35 | + $this->settings['base_url'] = (new Router)->getBaseUrl(); |
|
| 36 | + switch ($this->settings['handler']) { |
|
| 37 | + case Plugin::HANDLER_ERROR_LOG: |
|
| 38 | + ServiceLocator::registerService('Phile_ErrorHandler', |
|
| 39 | + new ErrorLog($this->settings)); |
|
| 40 | + break; |
|
| 41 | + case Plugin::HANDLER_DEVELOPMENT: |
|
| 42 | + ServiceLocator::registerService('Phile_ErrorHandler', |
|
| 43 | + new Development($this->settings)); |
|
| 44 | + break; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |