]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Merge commit 'mainline/0.9.x' into 0.9.x
[quix0rs-gnu-social.git] / lib / action.php
index 87d8a43993811069a4facf9f9baf810f2dabc2df..6efa9163dc65550239db89c52d439f00e7af194b 100644 (file)
@@ -141,7 +141,7 @@ class Action extends HTMLOutputter // lawsuit
     function showTitle()
     {
         $this->element('title', null,
-                       sprintf(_("%s - %s"),
+                       sprintf(_("%1$s - %2$s"),
                                $this->title(),
                                common_config('site', 'name')));
     }
@@ -252,6 +252,8 @@ class Action extends HTMLOutputter // lawsuit
             if (Event::handle('StartShowJQueryScripts', array($this))) {
                 $this->script('js/jquery.min.js');
                 $this->script('js/jquery.form.js');
+                $this->script('js/jquery.cookie.js');
+                $this->script('js/json2.js');
                 $this->script('js/jquery.joverlay.min.js');
                 Event::handle('EndShowJQueryScripts', array($this));
             }
@@ -735,6 +737,8 @@ class Action extends HTMLOutputter // lawsuit
                             _('Privacy'));
             $this->menuItem(common_local_url('doc', array('title' => 'source')),
                             _('Source'));
+            $this->menuItem(common_local_url('version'),
+                            _('Version'));
             $this->menuItem(common_local_url('doc', array('title' => 'contact')),
                             _('Contact'));
             $this->menuItem(common_local_url('doc', array('title' => 'badge')),
@@ -951,6 +955,36 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
+    /**
+     * Integer value of an argument
+     *
+     * @param string $key      query key we're interested in
+     * @param string $defValue optional default value (default null)
+     * @param string $maxValue optional max value (default null)
+     * @param string $minValue optional min value (default null)
+     *
+     * @return integer integer value
+     */
+
+    function int($key, $defValue=null, $maxValue=null, $minValue=null)
+    {
+        $arg = strtolower($this->trimmed($key));
+
+        if (is_null($arg) || !is_integer($arg)) {
+            return $defValue;
+        }
+
+        if (!is_null($maxValue)) {
+            $arg = min($arg, $maxValue);
+        }
+
+        if (!is_null($minValue)) {
+            $arg = max($arg, $minValue);
+        }
+
+        return $arg;
+    }
+
     /**
      * Server error
      *