SF.net SVN: postfixadmin:[1577] trunk/scripts
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2013-11-14 21:15:57
|
Revision: 1577 http://sourceforge.net/p/postfixadmin/code/1577 Author: christian_boltz Date: 2013-11-14 21:15:55 +0000 (Thu, 14 Nov 2013) Log Message: ----------- scripts/postfixadmin-cli.php - replace usage of Inflector::camelize() with ucfirst() - for our usage, it gives the same result with easier understandable code - remove unused PHP5 define shells/shell.php: - remove definition of unused variable $shellKey, which also removes the last usage of Inflector::underscore - remove code that was commented out since a while scripts/inflector.php: - delete file, no longer needed Modified Paths: -------------- trunk/scripts/postfixadmin-cli.php trunk/scripts/shells/shell.php Removed Paths: ------------- trunk/scripts/inflector.php Deleted: trunk/scripts/inflector.php =================================================================== --- trunk/scripts/inflector.php 2013-11-13 19:17:05 UTC (rev 1576) +++ trunk/scripts/inflector.php 2013-11-14 21:15:55 UTC (rev 1577) @@ -1,57 +0,0 @@ -<?php -/** - * -. - * - * Used by Cake's naming conventions throughout the framework. - * - * PHP versions 4 and 5 - * - * CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/> - * Copyright 2005-2008, Cake Software Foundation, Inc. - * 1785 E. Sahara Avenue, Suite 490-204 - * Las Vegas, Nevada 89104 - * Modified for Postfixadmin by Valkum - * - * Copyright 2010 - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @filesource - * @copyright Copyright 2005-2008, Cake Software Foundation, Inc. - * @link http://postfixadmin.sourceforge.net/ Postfixadmin on Sourceforge - * @package postfixadmin - * @subpackage - - * @since - - * @version $Revision$ - * @modifiedby $LastChangedBy$ - * @lastmodified $Date$ - * @license http://www.opensource.org/licenses/mit-license.php The MIT License - */ -class Inflector { -/** - * Returns given $lower_case_and_underscored_word as a CamelCased word. - * - * @param string $lower_case_and_underscored_word Word to camelize - * @return string Camelized word. LikeThis. - * @access public - * @static - */ - public static function camelize($lowerCaseAndUnderscoredWord) { - $replace = str_replace(" ", "", ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord))); - return $replace; - } -/** - * Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word. - * - * @param string $camel_cased_word Camel-cased word to be "underscorized" - * @return string Underscore-syntaxed version of the $camel_cased_word - * @access public - * @static - */ - public static function underscore($camelCasedWord) { - $replace = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord)); - return $replace; - } -} - Modified: trunk/scripts/postfixadmin-cli.php =================================================================== --- trunk/scripts/postfixadmin-cli.php 2013-11-13 19:17:05 UTC (rev 1576) +++ trunk/scripts/postfixadmin-cli.php 2013-11-14 21:15:55 UTC (rev 1577) @@ -146,7 +146,6 @@ } define('DS', DIRECTORY_SEPARATOR); - define('PHP5', (PHP_VERSION >= 5)); define('CORE_INCLUDE_PATH', dirname(__FILE__)); define('CORE_PATH', dirname(CORE_INCLUDE_PATH) ); # CORE_INCLUDE_PATH/../ @@ -236,7 +235,7 @@ $this->shell = $this->args[0]; $this->shiftArgs(); - $this->shellName = Inflector::camelize($this->shell); + $this->shellName = ucfirst($this->shell); $this->shellClass = $this->shellName . 'Handler'; @@ -254,7 +253,7 @@ } $this->shellCommand = $command; - $this->shellClass = 'Cli' . Inflector::camelize($command); + $this->shellClass = 'Cli' . ucfirst($command); if (ucfirst($command) == 'Add' || ucfirst($command) == 'Update') { $this->shellClass = 'CliEdit'; @@ -274,7 +273,7 @@ return; } - $task = Inflector::camelize($command); + $task = ucfirst($command); $shell->new = 0; if ($task == 'Add') { Modified: trunk/scripts/shells/shell.php =================================================================== --- trunk/scripts/shells/shell.php 2013-11-13 19:17:05 UTC (rev 1576) +++ trunk/scripts/shells/shell.php 2013-11-14 21:15:55 UTC (rev 1577) @@ -128,17 +128,6 @@ $this->name = str_replace(array('shell', 'Shell', 'task', 'Task'), '', $this->className); } - $shellKey = Inflector::underscore($this->className); - -# if (!PHP5 && isset($this->args[0])) { -# if(strpos($this->className, strtolower(Inflector::camelize($this->args[0]))) !== false) { -# $dispatch->shiftArgs(); -# } -# if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) { -# $dispatch->shiftArgs(); -# } -# } - $this->Dispatch =& $dispatch; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |