summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornashe <thomas@chauchefoin.fr>2017-07-16 17:16:49 +0200
committernashe <thomas@chauchefoin.fr>2017-07-16 17:16:49 +0200
commit8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd (patch)
tree20e4aaffab5229a1dd1ece3a53bdcc4b4e40c344
parent662f5fa67d03520215a0334318b3afe95d51c2d3 (diff)
downloadplanet-8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd.tar
planet-8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd.tar.gz
planet-8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd.tar.bz2
planet-8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd.tar.xz
planet-8ba18b9ff7f0b9a258d258722eb3a5222fdf6abd.zip
Move helper functions to a separate file
This will be useful to use it in the tests.
-rwxr-xr-xapp/app.php14
-rw-r--r--app/helpers.php33
-rw-r--r--composer.json1
3 files changed, 34 insertions, 14 deletions
diff --git a/app/app.php b/app/app.php
index 5cda95c..a6232cf 100755
--- a/app/app.php
+++ b/app/app.php
@@ -28,17 +28,3 @@ if (is_installed()) {
$l10n = new Simplel10n($conf['locale']);
-// this is an helper function. We will usually use that function and not Simplel10n::getString()
-function _g($str, $comment='') {
- return Simplel10n::getString($str);
-}
-
-function custom_path($file = '')
-{
- return __DIR__.'/../custom' . (!empty($file) ? '/'.$file : '');
-}
-
-function is_installed()
-{
- return file_exists(custom_path('config.yml')) && file_exists(custom_path('people.opml'));
-}
diff --git a/app/helpers.php b/app/helpers.php
new file mode 100644
index 0000000..6ec55c1
--- /dev/null
+++ b/app/helpers.php
@@ -0,0 +1,33 @@
+<?php
+
+/**
+ * Path to the _custom_ directory.
+ *
+ * @param string $file Append this filename to the returned path.
+ * @return string
+ */
+function custom_path($file = '')
+{
+ return __DIR__.'/../custom' . (!empty($file) ? '/'.$file : '');
+}
+
+/**
+ * Is moonmoon installed?
+ *
+ * @return bool
+ */
+function is_installed()
+{
+ return file_exists(custom_path('config.yml')) && file_exists(custom_path('people.opml'));
+}
+
+/**
+ * Shortcut to Simplel10n::getString().
+ *
+ * @param string $str
+ * @param string $comment
+ * @return string
+ */
+function _g($str, $comment='') {
+ return Simplel10n::getString($str, $comment);
+} \ No newline at end of file
diff --git a/composer.json b/composer.json
index 40f96ee..de51eb6 100644
--- a/composer.json
+++ b/composer.json
@@ -29,6 +29,7 @@
},
"files": [
"app/lib/lib.opml.php",
+ "app/helpers.php",
"app/lib/Cache.php"
]
}