Completed
Pull Request — master (#286)
by Frank
07:37
created
plugins/phile/phpFastCache/Classes/Plugin.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,20 +18,20 @@
 block discarded – undo
18 18
  */
19 19
 class Plugin extends AbstractPlugin {
20 20
 
21
-	protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
21
+    protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
22 22
 
23
-	/**
24
-	 * onPluginsLoaded method
25
-	 */
26
-	public function onPluginsLoaded() {
27
-		// phpFastCache not working in CLI mode...
28
-		if (PHILE_CLI_MODE) {
29
-			return;
30
-		}
31
-		unset($this->settings['active']);
32
-		$config = $this->settings + \phpFastCache::$config;
33
-		$storage = $this->settings['storage'];
34
-		$cache = phpFastCache($storage, $config);
35
-		ServiceLocator::registerService('Phile_Cache', new PhpFastCache($cache));
36
-	}
23
+    /**
24
+     * onPluginsLoaded method
25
+     */
26
+    public function onPluginsLoaded() {
27
+        // phpFastCache not working in CLI mode...
28
+        if (PHILE_CLI_MODE) {
29
+            return;
30
+        }
31
+        unset($this->settings['active']);
32
+        $config = $this->settings + \phpFastCache::$config;
33
+        $storage = $this->settings['storage'];
34
+        $cache = phpFastCache($storage, $config);
35
+        ServiceLocator::registerService('Phile_Cache', new PhpFastCache($cache));
36
+    }
37 37
 }
Please login to merge, or discard this patch.
plugins/phile/errorHandler/Classes/ErrorLog.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The Error Handler
4
- */
3
+     * The Error Handler
4
+     */
5 5
 
6 6
 namespace Phile\Plugin\Phile\ErrorHandler;
7 7
 use Phile\ServiceLocator\ErrorHandlerInterface;
@@ -10,29 +10,29 @@  discard block
 block discarded – undo
10 10
  * Class ErrorLog
11 11
  */
12 12
 class ErrorLog implements ErrorHandlerInterface {
13
-	/**
14
-	 * handle the error
15
-	 *
16
-	 * @param int    $errno
17
-	 * @param string $errstr
18
-	 * @param string $errfile
19
-	 * @param int    $errline
20
-	 * @param array  $errcontext
21
-	 *
22
-	 * @return boolean
23
-	 */
24
-	public function handleError($errno, $errstr, $errfile, $errline, array $errcontext) {
25
-		error_log("[{$errno}] {$errstr} in {$errfile} on line {$errline}");
26
-	}
13
+    /**
14
+     * handle the error
15
+     *
16
+     * @param int    $errno
17
+     * @param string $errstr
18
+     * @param string $errfile
19
+     * @param int    $errline
20
+     * @param array  $errcontext
21
+     *
22
+     * @return boolean
23
+     */
24
+    public function handleError($errno, $errstr, $errfile, $errline, array $errcontext) {
25
+        error_log("[{$errno}] {$errstr} in {$errfile} on line {$errline}");
26
+    }
27 27
 
28
-	/**
29
-	 * handle all exceptions
30
-	 *
31
-	 * @param \Exception $exception
32
-	 *
33
-	 * @return mixed
34
-	 */
35
-	public function handleException(\Exception $exception) {
36
-		error_log("[{$exception->getCode()}] {$exception->getMessage()} in {$exception->getFile()} on line {$exception->getLine()}");
37
-	}
28
+    /**
29
+     * handle all exceptions
30
+     *
31
+     * @param \Exception $exception
32
+     *
33
+     * @return mixed
34
+     */
35
+    public function handleException(\Exception $exception) {
36
+        error_log("[{$exception->getCode()}] {$exception->getMessage()} in {$exception->getFile()} on line {$exception->getLine()}");
37
+    }
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
plugins/phile/errorHandler/config.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * the configuration file
4
- */
3
+     * the configuration file
4
+     */
5 5
 
6 6
 return array(
7
-	'handler' 			=> \Phile\Plugin\Phile\ErrorHandler\Plugin::HANDLER_ERROR_LOG
7
+    'handler' 			=> \Phile\Plugin\Phile\ErrorHandler\Plugin::HANDLER_ERROR_LOG
8 8
 );
Please login to merge, or discard this patch.
plugins/phile/parserMeta/Classes/Plugin.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin class
4
- */
3
+     * Plugin class
4
+     */
5 5
 namespace Phile\Plugin\Phile\ParserMeta;
6 6
 
7 7
 use Phile\Core\ServiceLocator;
@@ -19,18 +19,18 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class Plugin extends AbstractPlugin {
21 21
 
22
-	protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
22
+    protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
23 23
 
24
-	/**
25
-	 * onPluginsLoaded method
26
-	 *
27
-	 * @param null   $data
28
-	 *
29
-	 * @return mixed|void
30
-	 */
31
-	public function onPluginsLoaded($data = null) {
32
-		ServiceLocator::registerService('Phile_Parser_Meta',
33
-			new Meta($this->settings));
34
-	}
24
+    /**
25
+     * onPluginsLoaded method
26
+     *
27
+     * @param null   $data
28
+     *
29
+     * @return mixed|void
30
+     */
31
+    public function onPluginsLoaded($data = null) {
32
+        ServiceLocator::registerService('Phile_Parser_Meta',
33
+            new Meta($this->settings));
34
+    }
35 35
 
36 36
 }
Please login to merge, or discard this patch.
plugins/phile/parserMeta/Classes/Parser/Meta.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -16,97 +16,97 @@
 block discarded – undo
16 16
  * @package Phile\Plugin\Phile\ParserMeta\Parser
17 17
  */
18 18
 class Meta implements MetaInterface {
19
-	/** @var array $config the configuration for this parser */
20
-	private $config;
19
+    /** @var array $config the configuration for this parser */
20
+    private $config;
21 21
 
22
-	/**
23
-	 * the constructor
24
-	 *
25
-	 * @param array $config
26
-	 */
27
-	public function __construct(array $config = null) {
28
-		if (!is_null($config)) {
29
-			$this->config = $config;
30
-		}
31
-	}
22
+    /**
23
+     * the constructor
24
+     *
25
+     * @param array $config
26
+     */
27
+    public function __construct(array $config = null) {
28
+        if (!is_null($config)) {
29
+            $this->config = $config;
30
+        }
31
+    }
32 32
 
33
-	/**
34
-	 * parse the content and extract meta information
35
-	 *
36
-	 * @param string $rawData raw page data
37
-	 * @return array with key/value store
38
-	 */
39
-	public function parse($rawData) {
40
-		$rawData = trim($rawData);
33
+    /**
34
+     * parse the content and extract meta information
35
+     *
36
+     * @param string $rawData raw page data
37
+     * @return array with key/value store
38
+     */
39
+    public function parse($rawData) {
40
+        $rawData = trim($rawData);
41 41
 
42
-		$start = substr($rawData, 0, 4);
43
-		if ($start === '<!--') {
44
-			$stop = '-->';
45
-		} elseif (substr($start, 0, 2) === '/*') {
46
-			$start = '/*';
47
-			$stop = '*/';
48
-		} else {
49
-			return [];
50
-		}
42
+        $start = substr($rawData, 0, 4);
43
+        if ($start === '<!--') {
44
+            $stop = '-->';
45
+        } elseif (substr($start, 0, 2) === '/*') {
46
+            $start = '/*';
47
+            $stop = '*/';
48
+        } else {
49
+            return [];
50
+        }
51 51
 
52
-		$meta = trim(substr($rawData, strlen($start), strpos($rawData, $stop) - (strlen($stop) + 1)));
53
-		if (strtolower($this->config['format']) === 'yaml') {
54
-			$meta = Yaml::parse($meta);
55
-		} else {
56
-			$meta = $this->parsePhileFormat($meta);
57
-		}
58
-		$meta = ($meta === null) ? [] : $this->convertKeys($meta);
59
-		return $meta;
60
-	}
52
+        $meta = trim(substr($rawData, strlen($start), strpos($rawData, $stop) - (strlen($stop) + 1)));
53
+        if (strtolower($this->config['format']) === 'yaml') {
54
+            $meta = Yaml::parse($meta);
55
+        } else {
56
+            $meta = $this->parsePhileFormat($meta);
57
+        }
58
+        $meta = ($meta === null) ? [] : $this->convertKeys($meta);
59
+        return $meta;
60
+    }
61 61
 
62
-	/**
63
-	 * convert meta data keys
64
-	 *
65
-	 * Creates "compatible" keys allowing easy access e.g. as template var.
66
-	 *
67
-	 * Conversions applied:
68
-	 *
69
-	 * - lowercase all chars
70
-	 * - replace special chars and whitespace with underscore
71
-	 *
72
-	 * @param array $meta meta-data
73
-	 * @return array
74
-	 */
75
-	protected function convertKeys(array $meta) {
76
-		$return = [];
77
-		foreach ($meta as $key => $value) {
78
-			if (is_array($value)) {
79
-				$value = $this->convertKeys($value);
80
-			}
81
-			$newKey = strtolower($key);
82
-			$newKey = preg_replace('/[^\w+]/', '_', $newKey);
83
-			$return[$newKey] = $value;
84
-		}
85
-		return $return;
86
-	}
62
+    /**
63
+     * convert meta data keys
64
+     *
65
+     * Creates "compatible" keys allowing easy access e.g. as template var.
66
+     *
67
+     * Conversions applied:
68
+     *
69
+     * - lowercase all chars
70
+     * - replace special chars and whitespace with underscore
71
+     *
72
+     * @param array $meta meta-data
73
+     * @return array
74
+     */
75
+    protected function convertKeys(array $meta) {
76
+        $return = [];
77
+        foreach ($meta as $key => $value) {
78
+            if (is_array($value)) {
79
+                $value = $this->convertKeys($value);
80
+            }
81
+            $newKey = strtolower($key);
82
+            $newKey = preg_replace('/[^\w+]/', '_', $newKey);
83
+            $return[$newKey] = $value;
84
+        }
85
+        return $return;
86
+    }
87 87
 
88
-	/**
89
-	 * Phile meta format parser.
90
-	 *
91
-	 * @param string $string unparsed meta-data
92
-	 * @return array|null array with meta-tags; null: on meta-data found
93
-	 *
94
-	 * @deprecated since 1.6.0 Phile is going to switch to YAML
95
-	 */
96
-	protected function parsePhileFormat($string) {
97
-		if (empty($string)) {
98
-			return null;
99
-		}
100
-		$meta = [];
101
-		$lines = explode("\n", $string);
102
-		foreach ($lines as $line) {
103
-			$parts = explode(':', $line, 2);
104
-			if (count($parts) !== 2) {
105
-				continue;
106
-			}
107
-			$parts = array_map('trim', $parts);
108
-			$meta[$parts[0]] = $parts[1];
109
-		}
110
-		return $meta;
111
-	}
88
+    /**
89
+     * Phile meta format parser.
90
+     *
91
+     * @param string $string unparsed meta-data
92
+     * @return array|null array with meta-tags; null: on meta-data found
93
+     *
94
+     * @deprecated since 1.6.0 Phile is going to switch to YAML
95
+     */
96
+    protected function parsePhileFormat($string) {
97
+        if (empty($string)) {
98
+            return null;
99
+        }
100
+        $meta = [];
101
+        $lines = explode("\n", $string);
102
+        foreach ($lines as $line) {
103
+            $parts = explode(':', $line, 2);
104
+            if (count($parts) !== 2) {
105
+                continue;
106
+            }
107
+            $parts = array_map('trim', $parts);
108
+            $meta[$parts[0]] = $parts[1];
109
+        }
110
+        return $meta;
111
+    }
112 112
 }
Please login to merge, or discard this patch.
plugins/phile/parserMarkdown/Classes/Plugin.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Plugin class
4
- */
3
+     * Plugin class
4
+     */
5 5
 namespace Phile\Plugin\Phile\ParserMarkdown;
6 6
 
7 7
 use Phile\Core\ServiceLocator;
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class Plugin extends AbstractPlugin {
21 21
 
22
-	protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
22
+    protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
23 23
 
24
-	/**
25
-	 * onPluginsLoaded method
26
-	 *
27
-	 * @param null   $data
28
-	 *
29
-	 * @return mixed|void
30
-	 */
31
-	public function onPluginsLoaded($data = null) {
32
-		ServiceLocator::registerService('Phile_Parser', new Markdown($this->settings));
33
-	}
24
+    /**
25
+     * onPluginsLoaded method
26
+     *
27
+     * @param null   $data
28
+     *
29
+     * @return mixed|void
30
+     */
31
+    public function onPluginsLoaded($data = null) {
32
+        ServiceLocator::registerService('Phile_Parser', new Markdown($this->settings));
33
+    }
34 34
 }
Please login to merge, or discard this patch.
plugins/phile/parserMarkdown/Classes/Parser/Markdown.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The Mardown parser class
4
- */
3
+     * The Mardown parser class
4
+     */
5 5
 namespace Phile\Plugin\Phile\ParserMarkdown\Parser;
6 6
 
7 7
 use Michelf\MarkdownExtra;
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
  * @package Phile\Plugin\Phile\ParserMarkdown\Parser
17 17
  */
18 18
 class Markdown implements ParserInterface {
19
-	/** @var mixed the configuration */
20
-	private $config;
19
+    /** @var mixed the configuration */
20
+    private $config;
21 21
 
22
-	/**
23
-	 * the constructor
24
-	 *
25
-	 * @param null $config
26
-	 */
27
-	public function __construct($config = null) {
28
-		if (!is_null($config)) {
29
-			$this->config = $config;
30
-		}
31
-	}
22
+    /**
23
+     * the constructor
24
+     *
25
+     * @param null $config
26
+     */
27
+    public function __construct($config = null) {
28
+        if (!is_null($config)) {
29
+            $this->config = $config;
30
+        }
31
+    }
32 32
 
33
-	/**
34
-	 * overload parse with the MarkdownExtra parser
35
-	 *
36
-	 * @param $data
37
-	 *
38
-	 * @return string
39
-	 */
40
-	public function parse($data) {
41
-		$parser = new MarkdownExtra;
42
-		foreach ($this->config as $key => $value) {
43
-			$parser->{$key} = $value;
44
-		}
33
+    /**
34
+     * overload parse with the MarkdownExtra parser
35
+     *
36
+     * @param $data
37
+     *
38
+     * @return string
39
+     */
40
+    public function parse($data) {
41
+        $parser = new MarkdownExtra;
42
+        foreach ($this->config as $key => $value) {
43
+            $parser->{$key} = $value;
44
+        }
45 45
 
46
-		return $parser->transform($data);
47
-	}
46
+        return $parser->transform($data);
47
+    }
48 48
 }
Please login to merge, or discard this patch.
plugins/phile/parserMarkdown/config.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * the configuration file
4
- *
5
- * @see https://michelf.ca/projects/php-markdown/configuration/
6
- */
3
+     * the configuration file
4
+     *
5
+     * @see https://michelf.ca/projects/php-markdown/configuration/
6
+     */
7 7
 
8 8
 return array(
9
-	'empty_element_suffix' => ' />',
10
-	'tab_width'            => 4,
11
-	'no_markup'            => false,
12
-	'no_entities'          => false,
13
-	'predef_urls'          => array(
14
-		'base_url' => \Phile\Core\Utility::getBaseUrl() // base_url is a good reference to have
15
-	),
16
-	'predef_titles'        => array(),
17
-	'fn_id_prefix'         => "",
18
-	'fn_link_title'        => "",
19
-	'fn_backlink_title'    => "",
20
-	'fn_link_class'        => "footnote-ref",
21
-	'fn_backlink_class'    => "footnote-backref",
22
-	'code_class_prefix'    => "",
23
-	'code_attr_on_pre'     => false,
24
-	'predef_abbr'          => array()
9
+    'empty_element_suffix' => ' />',
10
+    'tab_width'            => 4,
11
+    'no_markup'            => false,
12
+    'no_entities'          => false,
13
+    'predef_urls'          => array(
14
+        'base_url' => \Phile\Core\Utility::getBaseUrl() // base_url is a good reference to have
15
+    ),
16
+    'predef_titles'        => array(),
17
+    'fn_id_prefix'         => "",
18
+    'fn_link_title'        => "",
19
+    'fn_backlink_title'    => "",
20
+    'fn_link_class'        => "footnote-ref",
21
+    'fn_backlink_class'    => "footnote-backref",
22
+    'code_class_prefix'    => "",
23
+    'code_attr_on_pre'     => false,
24
+    'predef_abbr'          => array()
25 25
 );
Please login to merge, or discard this patch.
plugins/mycompany/demoPlugin/config.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,5 +3,5 @@
 block discarded – undo
3 3
  * config file
4 4
  */
5 5
 return [
6
-	'setting-example' => 'I love Phile!'
6
+    'setting-example' => 'I love Phile!'
7 7
 ];
Please login to merge, or discard this patch.