aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Configuration.php9
-rw-r--r--lib/Minz/ControllerNotActionControllerException.php3
-rw-r--r--lib/Minz/ExtensionException.php6
-rw-r--r--lib/Minz/ExtensionManager.php42
-rw-r--r--lib/Minz/Log.php8
-rw-r--r--lib/Minz/Paginator.php2
-rw-r--r--lib/lib_install.php2
-rw-r--r--lib/lib_rss.php9
8 files changed, 34 insertions, 47 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php
index 7c60c7567..8c9c59802 100644
--- a/lib/Minz/Configuration.php
+++ b/lib/Minz/Configuration.php
@@ -17,8 +17,7 @@ class Minz_Configuration {
* @param $default_filename a filename containing default values for the configuration
* @param $configuration_setter an optional helper to set values in configuration
*/
- public static function register($namespace, $config_filename, $default_filename = null,
- $configuration_setter = null) {
+ public static function register($namespace, $config_filename, $default_filename = null, $configuration_setter = null) {
self::$config_list[$namespace] = new Minz_Configuration(
$namespace, $config_filename, $default_filename, $configuration_setter
);
@@ -103,8 +102,7 @@ class Minz_Configuration {
* @param $default_filename the file containing default values, null by default.
* @param $configuration_setter an optional helper to set values in configuration
*/
- private function __construct($namespace, $config_filename, $default_filename = null,
- $configuration_setter = null) {
+ private function __construct($namespace, $config_filename, $default_filename = null, $configuration_setter = null) {
$this->namespace = $namespace;
$this->config_filename = $config_filename;
$this->default_filename = $default_filename;
@@ -206,8 +204,7 @@ class Minz_Configuration {
@rename($this->config_filename, $back_filename);
if (file_put_contents($this->config_filename,
- "<?php\nreturn " . var_export($this->data, true) . ';',
- LOCK_EX) === false) {
+ "<?php\nreturn " . var_export($this->data, true) . ';', LOCK_EX) === false) {
return false;
}
diff --git a/lib/Minz/ControllerNotActionControllerException.php b/lib/Minz/ControllerNotActionControllerException.php
index 1a8e0729c..5cf418404 100644
--- a/lib/Minz/ControllerNotActionControllerException.php
+++ b/lib/Minz/ControllerNotActionControllerException.php
@@ -1,8 +1,7 @@
<?php
class Minz_ControllerNotActionControllerException extends Minz_Exception {
public function __construct ($controller_name, $code = self::ERROR) {
- $message = 'Controller `' . $controller_name
- . '` isn\'t instance of ActionController';
+ $message = 'Controller `' . $controller_name . '` isn’t instance of ActionController';
parent::__construct ($message, $code);
}
diff --git a/lib/Minz/ExtensionException.php b/lib/Minz/ExtensionException.php
index 647f1a9b9..ab4c5c419 100644
--- a/lib/Minz/ExtensionException.php
+++ b/lib/Minz/ExtensionException.php
@@ -3,11 +3,9 @@
class Minz_ExtensionException extends Minz_Exception {
public function __construct ($message, $extension_name = false, $code = self::ERROR) {
if ($extension_name) {
- $message = 'An error occured in `' . $extension_name
- . '` extension with the message: ' . $message;
+ $message = 'An error occured in `' . $extension_name . '` extension with the message: ' . $message;
} else {
- $message = 'An error occured in an unnamed '
- . 'extension with the message: ' . $message;
+ $message = 'An error occured in an unnamed extension with the message: ' . $message;
}
parent::__construct($message, $code);
diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php
index 841d970dd..0f542894d 100644
--- a/lib/Minz/ExtensionManager.php
+++ b/lib/Minz/ExtensionManager.php
@@ -15,63 +15,63 @@ class Minz_ExtensionManager {
// List of available hooks. Please keep this list sorted.
private static $hook_list = array(
- 'check_url_before_add' => array( // function($url) -> Url | null
+ 'check_url_before_add' => array( // function($url) -> Url | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'entry_before_display' => array( // function($entry) -> Entry | null
+ 'entry_before_display' => array( // function($entry) -> Entry | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'entry_before_insert' => array( // function($entry) -> Entry | null
+ 'entry_before_insert' => array( // function($entry) -> Entry | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'feed_before_actualize' => array( // function($feed) -> Feed | null
+ 'feed_before_actualize' => array( // function($feed) -> Feed | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'feed_before_insert' => array( // function($feed) -> Feed | null
+ 'feed_before_insert' => array( // function($feed) -> Feed | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'freshrss_init' => array( // function() -> none
+ 'freshrss_init' => array( // function() -> none
'list' => array(),
'signature' => 'NoneToNone',
),
- 'freshrss_user_maintenance' => array( // function() -> none
+ 'freshrss_user_maintenance' => array( // function() -> none
'list' => array(),
'signature' => 'NoneToNone',
),
- 'js_vars' => array( // function($vars = array) -> array | null
+ 'js_vars' => array( // function($vars = array) -> array | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'menu_admin_entry' => array( // function() -> string
+ 'menu_admin_entry' => array( // function() -> string
'list' => array(),
'signature' => 'NoneToString',
),
- 'menu_configuration_entry' => array( // function() -> string
+ 'menu_configuration_entry' => array( // function() -> string
'list' => array(),
'signature' => 'NoneToString',
),
- 'menu_other_entry' => array( // function() -> string
+ 'menu_other_entry' => array( // function() -> string
'list' => array(),
'signature' => 'NoneToString',
),
- 'nav_menu' => array( // function() -> string
+ 'nav_menu' => array( // function() -> string
'list' => array(),
'signature' => 'NoneToString',
),
- 'nav_reading_modes' => array( // function($readingModes = array) -> array | null
+ 'nav_reading_modes' => array( // function($readingModes = array) -> array | null
'list' => array(),
'signature' => 'OneToOne',
),
- 'post_update' => array( // function(none) -> none
+ 'post_update' => array( // function(none) -> none
'list' => array(),
'signature' => 'NoneToNone',
),
- 'simplepie_before_init' => array( // function($simplePie, $feed) -> none
+ 'simplepie_before_init' => array( // function($simplePie, $feed) -> none
'list' => array(),
'signature' => 'PassArguments',
),
@@ -144,9 +144,7 @@ class Minz_ExtensionManager {
*/
public static function isValidMetadata($meta) {
$valid_chars = array('_');
- return !(empty($meta['name']) ||
- empty($meta['entrypoint']) ||
- !ctype_alnum(str_replace($valid_chars, '', $meta['entrypoint'])));
+ return !(empty($meta['name']) || empty($meta['entrypoint']) || !ctype_alnum(str_replace($valid_chars, '', $meta['entrypoint'])));
}
/**
@@ -163,8 +161,7 @@ class Minz_ExtensionManager {
// Test if the given extension class exists.
if (!class_exists($ext_class_name)) {
- Minz_Log::warning('`' . $ext_class_name .
- '` cannot be found in `' . $entry_point_filename . '`');
+ Minz_Log::warning("`{$ext_class_name}` cannot be found in `{$entry_point_filename}`");
return null;
}
@@ -174,14 +171,13 @@ class Minz_ExtensionManager {
$extension = new $ext_class_name($info);
} catch (Exception $e) {
// We cannot load the extension? Invalid!
- Minz_Log::warning('Invalid extension `' . $ext_class_name . '`: ' . $e->getMessage());
+ Minz_Log::warning("Invalid extension `{$ext_class_name}`: " . $e->getMessage());
return null;
}
// Test if class is correct.
if (!($extension instanceof Minz_Extension)) {
- Minz_Log::warning('`' . $ext_class_name .
- '` is not an instance of `Minz_Extension`');
+ Minz_Log::warning("`{$ext_class_name}` is not an instance of `Minz_Extension`");
return null;
}
diff --git a/lib/Minz/Log.php b/lib/Minz/Log.php
index f8d024c1f..1686bdaf0 100644
--- a/lib/Minz/Log.php
+++ b/lib/Minz/Log.php
@@ -30,9 +30,7 @@ class Minz_Log {
}
}
- if (! ($env === 'silent'
- || ($env === 'production'
- && ($level >= LOG_NOTICE)))) {
+ if (! ($env === 'silent' || ($env === 'production' && ($level >= LOG_NOTICE)))) {
$username = Minz_Session::param('currentUser', '');
if ($username == '') {
$username = '_';
@@ -61,9 +59,7 @@ class Minz_Log {
$level_label = 'info';
}
- $log = '[' . date('r') . ']'
- . ' [' . $level_label . ']'
- . ' --- ' . $information . "\n";
+ $log = '[' . date('r') . '] [' . $level_label . '] --- ' . $information . "\n";
if (defined('COPY_LOG_TO_SYSLOG') && COPY_LOG_TO_SYSLOG) {
syslog($level, '[' . $username . '] ' . trim($log));
diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php
index 795085a30..ae506f1ae 100644
--- a/lib/Minz/Paginator.php
+++ b/lib/Minz/Paginator.php
@@ -144,7 +144,7 @@ class Minz_Paginator {
return $array;
}
- public function nbItemsPerPage () {
+ public function nbItemsPerPage () {
return $this->nbItemsPerPage;
}
public function currentPage () {
diff --git a/lib/lib_install.php b/lib/lib_install.php
index e1a4c98dd..f28cb094d 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -68,7 +68,7 @@ function checkRequirements($dbType = '') {
'favicons' => $favicons ? 'ok' : 'ko',
'message' => $message ?: '',
'all' => $php && $curl && $pdo && $pcre && $ctype && $dom && $xml &&
- $data && $cache && $tmp && $users && $favicons && $message == '' ? 'ok' : 'ko'
+ $data && $cache && $tmp && $users && $favicons && $message == '' ? 'ok' : 'ko'
);
}
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 067b7653d..13fce3d8c 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -124,7 +124,7 @@ function escapeToUnicodeAlternative($text, $extended = true) {
function format_number($n, $precision = 0) {
// number_format does not seem to be Unicode-compatible
- return str_replace(' ', ' ', //Espace fine insécable
+ return str_replace(' ', ' ', //Espace fine insécable
number_format($n, $precision, '.', ' ')
);
}
@@ -358,8 +358,8 @@ function get_user_configuration($username) {
$namespace = 'user_' . $username;
try {
Minz_Configuration::register($namespace,
- join_path(USERS_PATH, $username, 'config.php'),
- join_path(FRESHRSS_PATH, 'config-user.default.php'));
+ USERS_PATH . '/' . $username . '/config.php',
+ FRESHRSS_PATH . '/config-user.default.php');
} catch (Minz_ConfigurationNamespaceException $e) {
// namespace already exists, do nothing.
Minz_Log::warning($e->getMessage(), USERS_PATH . '/_/log.txt');
@@ -572,7 +572,8 @@ function errorMessage($errorTitle, $error = '') {
<h1>{$errorTitle}</h1>
{$error}
<h2>Common problems</h2>
- <p>A typical problem leading to this message is wrong file permissions in the <code>./FreshRSS/data/</code> folder so make sure the Web server can write there and in sub-directories.</p>
+ <p>A typical problem leading to this message is wrong file permissions in the <code>./FreshRSS/data/</code> folder
+ so make sure the Web server can write there and in sub-directories.</p>
<h2>Common locations for additional logs</h2>
<p><strong>N.B.:</strong> Adapt names and paths according to your local setup.</p>
<ul>