]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
replace flash messages library
authorNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 18 Jan 2015 21:11:41 +0000 (22:11 +0100)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Sun, 18 Jan 2015 21:11:41 +0000 (22:11 +0100)
composer.json
composer.lock
inc/3rdparty/class.messages.php [deleted file]
inc/poche/global.inc.php

index 11eaa5612008a9ff0f28ee3bc0e8889a4ab934d3..3bb7bf076e894c16c7b50eac811607b58113a9db 100644 (file)
         "email": "hello@wallabag.org",
         "issues": "https://github.com/wallabag/wallabag/issues"
     },
+    "repositories": [
+        {
+            "type": "vcs",
+            "url": "https://github.com/wallabag/PHP-Flash-Messages"
+        }
+    ],
     "require": {
         "twig/twig": "1.*",
         "twig/extensions": "1.0.*",
         "umpirsky/twig-gettext-extractor": "1.1.*",
         "fabpot/goutte": "2.0.*@dev",
         "ezyang/htmlpurifier": "dev-master",
-        "mgargano/simplehtmldom": "dev-master"
+        "mgargano/simplehtmldom": "dev-master",
+        "wallabag/PHP-Flash-Messages": "dev-master"
     }
 }
\ No newline at end of file
index baf59eef56c2cac6f6d9ca123c3581aafbb75500..a984ce5249c5685af033ce9794f0ea115184bc98 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "67435ca652abe6c90bdd29701ecd679a",
+    "hash": "f5e69c21a929d0997c771526484a9d7e",
     "packages": [
         {
             "name": "ezyang/htmlpurifier",
             ],
             "description": "The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.",
             "time": "2013-02-14 16:41:48"
+        },
+        {
+            "name": "wallabag/php-flash-messages",
+            "version": "dev-master",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/wallabag/PHP-Flash-Messages.git",
+                "reference": "ea68eb768f32156baa15f7a3cd880ba8ff5af6ab"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/wallabag/PHP-Flash-Messages/zipball/ea68eb768f32156baa15f7a3cd880ba8ff5af6ab",
+                "reference": "ea68eb768f32156baa15f7a3cd880ba8ff5af6ab",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "class.messages.php"
+                ]
+            },
+            "license": [
+                "Apache"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Lœuillet",
+                    "email": "nicolas@loeuillet.org",
+                    "homepage": "http://www.cdetc.fr"
+                }
+            ],
+            "description": "Session-based Flash Messages class for PHP",
+            "homepage": "https://github.com/wallabag/PHP-Flash-Messages",
+            "keywords": [
+                "flash",
+                "messages",
+                "php-flash-messages",
+                "sessions"
+            ],
+            "support": {
+                "source": "https://github.com/wallabag/PHP-Flash-Messages/tree/master"
+            },
+            "time": "2015-01-18 19:51:55"
         }
     ],
     "packages-dev": [],
     "stability-flags": {
         "fabpot/goutte": 20,
         "ezyang/htmlpurifier": 20,
-        "mgargano/simplehtmldom": 20
+        "mgargano/simplehtmldom": 20,
+        "wallabag/php-flash-messages": 20
     },
     "prefer-stable": false,
     "prefer-lowest": false,
diff --git a/inc/3rdparty/class.messages.php b/inc/3rdparty/class.messages.php
deleted file mode 100644 (file)
index fbca0df..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-<?php\r
-//--------------------------------------------------------------------------------------------------\r
-// Session-Based Flash Messages v1.0\r
-// Copyright 2012 Mike Everhart (http://mikeeverhart.net)\r
-//\r
-//   Licensed under the Apache License, Version 2.0 (the "License");\r
-//   you may not use this file except in compliance with the License.\r
-//   You may obtain a copy of the License at\r
-//\r
-//     http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-//   Unless required by applicable law or agreed to in writing, software\r
-//   distributed under the License is distributed on an "AS IS" BASIS,\r
-//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-//   See the License for the specific language governing permissions and\r
-//      limitations under the License.\r
-//      \r
-//------------------------------------------------------------------------------\r
-// Description:\r
-//------------------------------------------------------------------------------\r
-//\r
-//     Stores messages in Session data to be easily retrieved later on.\r
-//     This class includes four different types of messages:\r
-//  - Success\r
-//  - Error\r
-//  - Warning\r
-//  - Information\r
-// \r
-//  See README for basic usage instructions, or see samples/index.php for more advanced samples\r
-//\r
-//--------------------------------------------------------------------------------------------------\r
-// Changelog\r
-//--------------------------------------------------------------------------------------------------\r
-// \r
-//     2011-05-15 - v1.0 - Initial Version\r
-//\r
-//--------------------------------------------------------------------------------------------------\r
-\r
-class Messages {\r
-       \r
-       //-----------------------------------------------------------------------------------------------\r
-       // Class Variables\r
-       //-----------------------------------------------------------------------------------------------       \r
-       var $msgId;\r
-       var $msgTypes = array( 'help', 'info', 'warning', 'success', 'error' );\r
-       var $msgClass = 'messages';\r
-       var $msgWrapper = "<div class='%s %s'><a href='#' class='closeMessage'>&times;</a>\n%s</div>\n";\r
-       var $msgBefore = '<p>';\r
-       var $msgAfter = "</p>\n";\r
-\r
-       \r
-       /**\r
-        * Constructor\r
-        * @author Mike Everhart\r
-        */\r
-       public function __construct() {\r
-       \r
-               // Generate a unique ID for this user and session\r
-               $this->msgId = md5(uniqid());\r
-               \r
-               // Create the session array if it doesnt already exist\r
-               settype($_SESSION, 'array');
-               if( !array_key_exists('flash_messages', $_SESSION) ) $_SESSION['flash_messages'] = array();\r
-               \r
-       }\r
-       \r
-       /**\r
-        * Add a message to the queue\r
-        * \r
-        * @author Mike Everhart\r
-        * \r
-        * @param  string   $type               The type of message to add\r
-        * @param  string   $message            The message\r
-        * @param  string   $redirect_to        (optional) If set, the user will be redirected to this URL\r
-        * @return  bool \r
-        * \r
-        */\r
-       public function add($type, $message, $redirect_to=null) {\r
-               \r
-               if( !isset($_SESSION['flash_messages']) ) return false;\r
-               \r
-               if( !isset($type) || !isset($message[0]) ) return false;\r
-\r
-               // Replace any shorthand codes with their full version\r
-               if( strlen(trim($type)) == 1 ) {\r
-                       $type = str_replace( array('h', 'i', 'w', 'e', 's'), array('help', 'info', 'warning', 'error', 'success'), $type );\r
-               \r
-               // Backwards compatibility...\r
-               } elseif( $type == 'information' ) {\r
-                       $type = 'info'; \r
-               }\r
-               \r
-               // Make sure it's a valid message type\r
-               if( !in_array($type, $this->msgTypes) ) die('"' . strip_tags($type) . '" is not a valid message type!' );\r
-               \r
-               // If the session array doesn't exist, create it\r
-               if( !array_key_exists( $type, $_SESSION['flash_messages'] ) ) $_SESSION['flash_messages'][$type] = array();\r
-               \r
-               $_SESSION['flash_messages'][$type][] = $message;\r
-\r
-               if( !is_null($redirect_to) ) {\r
-                       header("Location: $redirect_to");\r
-                       exit();\r
-               }\r
-               \r
-               return true;\r
-               \r
-       }\r
-       \r
-       //-----------------------------------------------------------------------------------------------\r
-       // display()\r
-       // print queued messages to the screen\r
-       //-----------------------------------------------------------------------------------------------\r
-       /**\r
-        * Display the queued messages\r
-        * \r
-        * @author Mike Everhart\r
-        * \r
-        * @param  string   $type     Which messages to display\r
-        * @param  bool         $print    True  = print the messages on the screen\r
-        * @return mixed              \r
-        * \r
-        */\r
-       public function display($type='all', $print=true) {\r
-               $messages = '';\r
-               $data = '';\r
-               \r
-               if( !isset($_SESSION['flash_messages']) ) return false;\r
-               \r
-               if( $type == 'g' || $type == 'growl' ) {\r
-                       $this->displayGrowlMessages();\r
-                       return true;\r
-               }\r
-               \r
-               // Print a certain type of message?\r
-               if( in_array($type, $this->msgTypes) ) {\r
-                       foreach( $_SESSION['flash_messages'][$type] as $msg ) {\r
-                               $messages .= $this->msgBefore . $msg . $this->msgAfter;\r
-                       }\r
-\r
-                       $data .= sprintf($this->msgWrapper, $this->msgClass, $type, $messages);\r
-                       \r
-                       // Clear the viewed messages\r
-                       $this->clear($type);\r
-               \r
-               // Print ALL queued messages\r
-               } elseif( $type == 'all' ) {\r
-                       foreach( $_SESSION['flash_messages'] as $type => $msgArray ) {\r
-                               $messages = '';\r
-                               foreach( $msgArray as $msg ) {\r
-                                       $messages .= $this->msgBefore . $msg . $this->msgAfter; \r
-                               }\r
-                               $data .= sprintf($this->msgWrapper, $this->msgClass, $type, $messages);\r
-                       }\r
-                       \r
-                       // Clear ALL of the messages\r
-                       $this->clear();\r
-               \r
-               // Invalid Message Type?\r
-               } else { \r
-                       return false;\r
-               }\r
-               \r
-               // Print everything to the screen or return the data\r
-               if( $print ) { \r
-                       echo $data; \r
-               } else { \r
-                       return $data; \r
-               }\r
-       }\r
-       \r
-       \r
-       /**\r
-        * Check to  see if there are any queued error messages\r
-        * \r
-        * @author Mike Everhart\r
-        * \r
-        * @return bool  true  = There ARE error messages\r
-        *               false = There are NOT any error messages\r
-        * \r
-        */\r
-       public function hasErrors() { \r
-               return empty($_SESSION['flash_messages']['error']) ? false : true;      \r
-       }\r
-       \r
-       /**\r
-        * Check to see if there are any ($type) messages queued\r
-        * \r
-        * @author Mike Everhart\r
-        * \r
-        * @param  string   $type     The type of messages to check for\r
-        * @return bool                   \r
-        * \r
-        */\r
-       public function hasMessages($type=null) {\r
-               if( !is_null($type) ) {\r
-                       if( !empty($_SESSION['flash_messages'][$type]) ) return $_SESSION['flash_messages'][$type];     \r
-               } else {\r
-                       foreach( $this->msgTypes as $type ) {\r
-                               if( !empty($_SESSION['flash_messages']) ) return true;  \r
-                       }\r
-               }\r
-               return false;\r
-       }\r
-       \r
-       /**\r
-        * Clear messages from the session data\r
-        * \r
-        * @author Mike Everhart\r
-        * \r
-        * @param  string   $type     The type of messages to clear\r
-        * @return bool \r
-        * \r
-        */\r
-       public function clear($type='all') { \r
-               if( $type == 'all' ) {\r
-                       unset($_SESSION['flash_messages']); \r
-               } else {\r
-                       unset($_SESSION['flash_messages'][$type]);\r
-               }\r
-               return true;\r
-       }\r
-       \r
-       public function __toString() { return $this->hasMessages();     }\r
-\r
-       public function __destruct() {\r
-               //$this->clear();\r
-       }\r
-\r
-\r
-} // end class\r
-?>
index 1ecef8bf7bc3a4e51358b68f8c07d65d2918996a..3e04b3831998f8bf5aa876e1dd8ee3abc08cb4a6 100755 (executable)
@@ -17,7 +17,6 @@ define('ROOT', INCLUDES . '/..');
 require_once INCLUDES . '/poche/Tools.class.php';
 require_once INCLUDES . '/poche/User.class.php';
 require_once INCLUDES . '/poche/Url.class.php';
-require_once INCLUDES . '/3rdparty/class.messages.php';
 require_once ROOT . '/vendor/autoload.php';
 require_once INCLUDES . '/poche/Template.class.php';
 require_once INCLUDES . '/poche/Language.class.php';