From 40f3a01d1e44c0d8e2da9830f1af2b92a9dca569 Mon Sep 17 00:00:00 2001 From: phpnut Date: Thu, 9 Feb 2006 05:23:26 +0000 Subject: [PATCH] Merging fixes and enhancements into trunk Revision: [1953] Added @ before session_destroy() in CakeSession::_destroyInvalid() to suppress warning Revision: [1952] Fixing Ticket #380, and adding JSON object generator to JavascriptHelper Revision: [1951] Removing code that is not used in Inflector class git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1954 3807eeeb-6ff5-0310-8944-8be069107fe0 --- VERSION.txt | 2 +- .../components/dbacl/models/aclnode.php | 2 - cake/libs/inflector.php | 77 ------------------- cake/libs/session.php | 2 +- cake/libs/view/helpers/javascript.php | 54 +++++++++++-- 5 files changed, 50 insertions(+), 87 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 1f7424b72..29516f467 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.8.1949 RC 4 \ No newline at end of file +0.10.8.1954 \ No newline at end of file diff --git a/cake/libs/controller/components/dbacl/models/aclnode.php b/cake/libs/controller/components/dbacl/models/aclnode.php index 83a55a82d..64f28f8ed 100644 --- a/cake/libs/controller/components/dbacl/models/aclnode.php +++ b/cake/libs/controller/components/dbacl/models/aclnode.php @@ -261,11 +261,9 @@ class AclNode extends AppModel */ function _syncTable($table, $dir, $lft, $rght) { - pr('...Syncing...'); $shift = ($dir == 2 ? 1 : 2); $this->db->query("UPDATE $table SET rght = rght " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE rght > " . $rght); $this->db->query("UPDATE $table SET lft = lft " . ($dir > 0 ? "+" : "-") . " {$shift} WHERE lft > " . $lft); - pr('...Done Syncing...'); } /** diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 64c2968b8..a4e440cb7 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -308,83 +308,6 @@ class Inflector extends Object { return Inflector::camelize(Inflector::singularize($tableName)); } - -/** - * Returns $class_name in underscored form, with "_id" tacked on at the end. - * This is for use in dealing with foreign keys in the database. - * - * @param string $class_name - * @return string - */ - function foreignKey($className) - { - return Inflector::underscore($className) . "_id"; - } - -/** - * Returns filename for given Cake controller name. - * - * @param string $name - * @return string - */ - function toControllerFilename($name) - { - return CONTROLLERS.Inflector::underscore($name).'.php'; - } - -/** - * Returns filename for given Cake helper name. - * - * @param string $name - * @return string - */ - function toHelperFilename($name) - { - return HELPERS.Inflector::underscore($name).'.php'; - } - -/** - * Returns given name as camelized. - * - * @param string $name - * @param string $correct - * @return string - * @todo Explain this method - */ - function toFullName($name, $correct) - { - if (strstr($name, '_') && (strtolower($name) == $name)) - { - return Inflector::camelize($name); - } - - if (preg_match("/^(.*)({$correct})$/i", $name, $reg)) - { - if ($reg[2] == $correct) - { - return $name; - } - else - { - return ucfirst($reg[1].$correct); - } - } - else - { - return ucfirst($name.$correct); - } - } - -/** - * Returns filename for given Cake library name. - * - * @param string $name - * @return string - */ - function toLibraryFilename ($name) - { - return LIBS.Inflector::underscore($name).'.php'; - } } function __enclose($string) diff --git a/cake/libs/session.php b/cake/libs/session.php index e307cfdfe..7c61621ca 100644 --- a/cake/libs/session.php +++ b/cake/libs/session.php @@ -321,7 +321,7 @@ class CakeSession extends Object setcookie(CAKE_SESSION_COOKIE, '', time()-42000, $this->path); } $file = $sessionpath.DS."sess_".session_id(); - session_destroy(); + @session_destroy(); @unlink($file); $this->__construct($this->path); } diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 3c60154bd..c4527f287 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -153,11 +153,11 @@ class JavascriptHelper extends Helper * * @return null */ - function cacheEvents () - { - $this->_cacheEvents = true; - } - + function cacheEvents () + { + $this->_cacheEvents = true; + } + /** * Write cached JavaScript events @@ -170,7 +170,6 @@ class JavascriptHelper extends Helper return $this->codeBlock("\n" . implode("\n", $this->_cachedEvents) . "\n"); } - /** * Includes the Prototype Javascript library (and anything else) inside a single script tag. * @@ -201,6 +200,49 @@ class JavascriptHelper extends Helper return $this->codeBlock("\n\n" . $javascript); } +/** + * Generates a JavaScript object in JavaScript Object Notation (JSON) + * from an array + * + * @param array $data Data to be converted + * @param boolean $block Wraps return value in a