Changed the visibility to methods that not affect others classes.

This commit is contained in:
Juan Basso 2011-08-20 01:39:30 -04:00
parent f5a54d00dd
commit 61833294f0
26 changed files with 111 additions and 111 deletions

View file

@ -94,7 +94,7 @@ class MemcacheEngine extends CacheEngine {
* @param string $server The server address string.
* @return array Array containing host, port
*/
function _parseServerString($server) {
protected function _parseServerString($server) {
if (substr($server, 0, 1) == '[') {
$position = strpos($server, ']:');
if ($position !== false) {

View file

@ -127,12 +127,12 @@ class XcacheEngine extends CacheEngine {
* @return boolean True if the cache was successfully cleared, false otherwise
*/
public function clear($check) {
$this->__auth();
$this->_auth();
$max = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $max; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
$this->__auth(true);
$this->_auth(true);
return true;
}
@ -146,7 +146,7 @@ class XcacheEngine extends CacheEngine {
* @param boolean $reverse Revert changes
* @return void
*/
function __auth($reverse = false) {
protected function _auth($reverse = false) {
static $backup = array();
$keys = array('PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password');
foreach ($keys as $key => $setting) {

View file

@ -109,7 +109,7 @@ class AclShell extends Shell {
* @return void
*/
public function create() {
extract($this->__dataVars());
extract($this->_dataVars());
$class = ucfirst($this->args[0]);
$parent = $this->parseIdentifier($this->args[1]);
@ -142,7 +142,7 @@ class AclShell extends Shell {
* @return void
*/
public function delete() {
extract($this->__dataVars());
extract($this->_dataVars());
$identifier = $this->parseIdentifier($this->args[1]);
$nodeId = $this->_getNodeId($class, $identifier);
@ -159,7 +159,7 @@ class AclShell extends Shell {
* @return void
*/
public function setParent() {
extract($this->__dataVars());
extract($this->_dataVars());
$target = $this->parseIdentifier($this->args[1]);
$parent = $this->parseIdentifier($this->args[2]);
@ -183,7 +183,7 @@ class AclShell extends Shell {
* @return void
*/
public function getPath() {
extract($this->__dataVars());
extract($this->_dataVars());
$identifier = $this->parseIdentifier($this->args[1]);
$id = $this->_getNodeId($class, $identifier);
@ -226,7 +226,7 @@ class AclShell extends Shell {
* @return void
*/
public function check() {
extract($this->__getParams());
extract($this->_getParams());
if ($this->Acl->check($aro, $aco, $action)) {
$this->out(__d('cake_console', '%s is <success>allowed</success>.', $aroName), true);
@ -241,7 +241,7 @@ class AclShell extends Shell {
* @return void
*/
public function grant() {
extract($this->__getParams());
extract($this->_getParams());
if ($this->Acl->allow($aro, $aco, $action)) {
$this->out(__d('cake_console', 'Permission <success>granted</success>.'), true);
@ -256,7 +256,7 @@ class AclShell extends Shell {
* @return void
*/
public function deny() {
extract($this->__getParams());
extract($this->_getParams());
if ($this->Acl->deny($aro, $aco, $action)) {
$this->out(__d('cake_console', 'Permission denied.'), true);
@ -271,7 +271,7 @@ class AclShell extends Shell {
* @return void
*/
public function inherit() {
extract($this->__getParams());
extract($this->_getParams());
if ($this->Acl->inherit($aro, $aco, $action)) {
$this->out(__d('cake_console', 'Permission inherited.'), true);
@ -286,7 +286,7 @@ class AclShell extends Shell {
* @return void
*/
public function view() {
extract($this->__dataVars());
extract($this->_dataVars());
if (isset($this->args[1])) {
$identity = $this->parseIdentifier($this->args[1]);
@ -511,7 +511,7 @@ class AclShell extends Shell {
if (!isset($this->args[0]) || !isset($this->args[1])) {
return false;
}
extract($this->__dataVars($this->args[0]));
extract($this->_dataVars($this->args[0]));
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
$conditions = array($class . '.' . $key => $this->args[1]);
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
@ -546,7 +546,7 @@ class AclShell extends Shell {
* @param mixed $identifier A mixed identifier for finding the node.
* @return integer Integer of NodeId. Will trigger an error if nothing is found.
*/
function _getNodeId($class, $identifier) {
protected function _getNodeId($class, $identifier) {
$node = $this->Acl->{$class}->node($identifier);
if (empty($node)) {
if (is_array($identifier)) {
@ -562,7 +562,7 @@ class AclShell extends Shell {
*
* @return array aro, aco, action
*/
function __getParams() {
protected function _getParams() {
$aro = is_numeric($this->args[0]) ? intval($this->args[0]) : $this->args[0];
$aco = is_numeric($this->args[1]) ? intval($this->args[1]) : $this->args[1];
$aroName = $aro;
@ -590,7 +590,7 @@ class AclShell extends Shell {
* @param string $type Node type (ARO/ACO)
* @return array Variables
*/
function __dataVars($type = null) {
protected function _dataVars($type = null) {
if ($type == null) {
$type = $this->args[0];
}

View file

@ -243,7 +243,7 @@ class SchemaShell extends Shell {
*/
public function create() {
list($Schema, $table) = $this->_loadSchema();
$this->__create($Schema, $table);
$this->_create($Schema, $table);
}
/**
@ -253,7 +253,7 @@ class SchemaShell extends Shell {
*/
public function update() {
list($Schema, $table) = $this->_loadSchema();
$this->__update($Schema, $table);
$this->_update($Schema, $table);
}
/**
@ -261,7 +261,7 @@ class SchemaShell extends Shell {
*
* @return void
*/
function _loadSchema() {
protected function _loadSchema() {
$name = $plugin = null;
if (!empty($this->params['name'])) {
$name = $this->params['name'];
@ -302,7 +302,7 @@ class SchemaShell extends Shell {
* @param string $table
* @return void
*/
function __create($Schema, $table = null) {
protected function _create($Schema, $table = null) {
$db = ConnectionManager::getDataSource($this->Schema->connection);
$drop = $create = array();
@ -326,7 +326,7 @@ class SchemaShell extends Shell {
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
$this->out(__d('cake_console', 'Dropping table(s).'));
$this->__run($drop, 'drop', $Schema);
$this->_run($drop, 'drop', $Schema);
}
$this->out("\n" . __d('cake_console', 'The following table(s) will be created.'));
@ -334,7 +334,7 @@ class SchemaShell extends Shell {
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
$this->out(__d('cake_console', 'Creating table(s).'));
$this->__run($create, 'create', $Schema);
$this->_run($create, 'create', $Schema);
}
$this->out(__d('cake_console', 'End create.'));
}
@ -347,7 +347,7 @@ class SchemaShell extends Shell {
* @param string $table
* @return void
*/
function __update(&$Schema, $table = null) {
protected function _update(&$Schema, $table = null) {
$db = ConnectionManager::getDataSource($this->Schema->connection);
$this->out(__d('cake_console', 'Comparing Database to Schema...'));
@ -378,21 +378,21 @@ class SchemaShell extends Shell {
if ('y' == $this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
$this->out();
$this->out(__d('cake_console', 'Updating Database...'));
$this->__run($contents, 'update', $Schema);
$this->_run($contents, 'update', $Schema);
}
$this->out(__d('cake_console', 'End update.'));
}
/**
* Runs sql from __create() or __update()
* Runs sql from _create() or _update()
*
* @param array $contents
* @param string $event
* @param CakeSchema $Schema
* @return void
*/
function __run($contents, $event, &$Schema) {
protected function _run($contents, $event, &$Schema) {
if (empty($contents)) {
$this->err(__d('cake_console', 'Sql could not be run'));
return;

View file

@ -180,7 +180,7 @@ class TestsuiteShell extends Shell {
*
* @return array Array of params for CakeTestDispatcher
*/
protected function parseArgs() {
protected function _parseArgs() {
if (empty($this->args)) {
return;
}
@ -212,7 +212,7 @@ class TestsuiteShell extends Shell {
*
* @return array Array of params for CakeTestDispatcher
*/
protected function runnerOptions() {
protected function _runnerOptions() {
$options = array();
$params = $this->params;
unset($params['help']);
@ -244,23 +244,23 @@ class TestsuiteShell extends Shell {
$this->out(__d('cake_console', 'CakePHP Test Shell'));
$this->hr();
$args = $this->parseArgs();
$args = $this->_parseArgs();
if (empty($args['case'])) {
return $this->available();
}
$this->run($args, $this->runnerOptions());
$this->_run($args, $this->_runnerOptions());
}
/**
* Runs the test case from $runnerArgs
*
* @param array $runnerArgs list of arguments as obtained from parseArgs()
* @param array $options list of options as constructed by runnerOptions()
* @param array $runnerArgs list of arguments as obtained from _parseArgs()
* @param array $options list of options as constructed by _runnerOptions()
* @return void
*/
protected function run($runnerArgs, $options = array()) {
protected function _run($runnerArgs, $options = array()) {
restore_error_handler();
restore_error_handler();
@ -274,7 +274,7 @@ class TestsuiteShell extends Shell {
* @return void
*/
public function available() {
$params = $this->parseArgs();
$params = $this->_parseArgs();
$testCases = CakeTestLoader::generateTestList($params);
$app = $params['app'];
$plugin = $params['plugin'];
@ -308,14 +308,14 @@ class TestsuiteShell extends Shell {
if (is_numeric($choice) && isset($cases[$choice])) {
$this->args[0] = $category;
$this->args[1] = $cases[$choice];
$this->run($this->parseArgs(), $this->runnerOptions());
$this->_run($this->_parseArgs(), $this->_runnerOptions());
break;
}
if (is_string($choice) && in_array($choice, $cases)) {
$this->args[0] = $category;
$this->args[1] = $choice;
$this->run($this->parseArgs(), $this->runnerOptions());
$this->_run($this->_parseArgs(), $this->_runnerOptions());
break;
}

View file

@ -774,7 +774,7 @@ class Shell extends Object {
* @param string $pluginName Name of the plugin you want ie. DebugKit
* @return string $path path to the correct plugin.
*/
function _pluginPath($pluginName) {
protected function _pluginPath($pluginName) {
if (CakePlugin::loaded($pluginName)) {
return CakePlugin::path($pluginName);
}

View file

@ -277,7 +277,7 @@ class AuthComponent extends Component {
return true;
}
if (!$this->__setDefaults()) {
if (!$this->_setDefaults()) {
return false;
}
$request = $controller->request;
@ -339,7 +339,7 @@ class AuthComponent extends Component {
*
* @return boolean
*/
function __setDefaults() {
protected function _setDefaults() {
$defaults = array(
'logoutRedirect' => $this->loginAction,
'authError' => __d('cake', 'You are not authorized to access that location.')
@ -502,7 +502,7 @@ class AuthComponent extends Component {
* @link http://book.cakephp.org/view/1261/login
*/
public function login($user = null) {
$this->__setDefaults();
$this->_setDefaults();
if (empty($user)) {
$user = $this->identify($this->request, $this->response);
@ -524,7 +524,7 @@ class AuthComponent extends Component {
* @link http://book.cakephp.org/view/1262/logout
*/
public function logout() {
$this->__setDefaults();
$this->_setDefaults();
if (empty($this->_authenticateObjects)) {
$this->constructAuthenticate();
}

View file

@ -407,7 +407,7 @@ class EmailComponent extends Component {
* @param string $attachment Attachment file name to find
* @return string Path to located file
*/
function _findFiles($attachment) {
protected function _findFiles($attachment) {
if (file_exists($attachment)) {
return $attachment;
}
@ -426,7 +426,7 @@ class EmailComponent extends Component {
* @param string $subject String to encode
* @return string Encoded string
*/
function _encode($subject) {
protected function _encode($subject) {
$subject = $this->_strip($subject);
$nl = "\r\n";
@ -472,7 +472,7 @@ class EmailComponent extends Component {
* @param boolean $message Set to true to indicate main message content
* @return string Stripped value
*/
function _strip($value, $message = false) {
protected function _strip($value, $message = false) {
$search = '%0a|%0d|Content-(?:Type|Transfer-Encoding)\:';
$search .= '|charset\=|mime-version\:|multipart/mixed|(?:[^a-z]to|b?cc)\:.*';

View file

@ -175,7 +175,7 @@ class RequestHandlerComponent extends Component {
* @param string $xml
* @return array Xml array data
*/
public function _convertXml($xml) {
protected function _convertXml($xml) {
try {
$xml = Xml::build($xml);
if (isset($xml->data)) {

View file

@ -526,7 +526,7 @@ class Controller extends Object {
*
* @return void
*/
protected function __mergeVars() {
protected function _mergeControllerVars() {
$pluginController = $pluginDot = null;
if (!empty($this->plugin)) {
@ -584,7 +584,7 @@ class Controller extends Object {
* @throws MissingModelException
*/
public function constructClasses() {
$this->__mergeVars();
$this->_mergeControllerVars();
$this->Components->init($this);
if ($this->uses) {
$this->uses = (array) $this->uses;

View file

@ -259,7 +259,7 @@ class CakeSchema extends Object {
if (in_array($fulltable, $currentTables)) {
$key = array_search($fulltable, $currentTables);
if (empty($tables[$table])) {
$tables[$table] = $this->__columns($Object);
$tables[$table] = $this->_columns($Object);
$tables[$table]['indexes'] = $db->index($Object);
$tables[$table]['tableParameters'] = $db->readTableParameters($fulltable);
unset($currentTables[$key]);
@ -278,7 +278,7 @@ class CakeSchema extends Object {
$key = array_search($withTable, $currentTables);
$noPrefixWith = $this->_noPrefixTable($prefix, $withTable);
$tables[$noPrefixWith] = $this->__columns($Object->$class);
$tables[$noPrefixWith] = $this->_columns($Object->$class);
$tables[$noPrefixWith]['indexes'] = $db->index($Object->$class);
$tables[$noPrefixWith]['tableParameters'] = $db->readTableParameters($withTable);
unset($currentTables[$key]);
@ -307,15 +307,15 @@ class CakeSchema extends Object {
'aros', 'acos', 'aros_acos', Configure::read('Session.table'), 'i18n'
);
if (in_array($table, $systemTables)) {
$tables[$Object->table] = $this->__columns($Object);
$tables[$Object->table] = $this->_columns($Object);
$tables[$Object->table]['indexes'] = $db->index($Object);
$tables[$Object->table]['tableParameters'] = $db->readTableParameters($table);
} elseif ($models === false) {
$tables[$table] = $this->__columns($Object);
$tables[$table] = $this->_columns($Object);
$tables[$table]['indexes'] = $db->index($Object);
$tables[$table]['tableParameters'] = $db->readTableParameters($table);
} else {
$tables['missing'][$table] = $this->__columns($Object);
$tables['missing'][$table] = $this->_columns($Object);
$tables['missing'][$table]['indexes'] = $db->index($Object);
$tables['missing'][$table]['tableParameters'] = $db->readTableParameters($table);
}
@ -403,12 +403,12 @@ class CakeSchema extends Object {
}
$col = "\t\t'{$field}' => array('type' => '" . $value['type'] . "', ";
unset($value['type']);
$col .= join(', ', $this->__values($value));
$col .= join(', ', $this->_values($value));
} elseif ($field == 'indexes') {
$col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$value as $key => $index) {
$props[] = "'{$key}' => array(" . join(', ', $this->__values($index)) . ")";
$props[] = "'{$key}' => array(" . join(', ', $this->_values($index)) . ")";
}
$col .= join(', ', $props);
} elseif ($field == 'tableParameters') {
@ -560,7 +560,7 @@ class CakeSchema extends Object {
* @param array $values options keys(type, null, default, key, length, extra)
* @return array Formatted values
*/
public function __values($values) {
protected function _values($values) {
$vals = array();
if (is_array($values)) {
foreach ($values as $key => $val) {
@ -581,7 +581,7 @@ class CakeSchema extends Object {
* @param array $Obj model object
* @return array Formatted columns
*/
public function __columns(&$Obj) {
protected function _columns(&$Obj) {
$db = $Obj->getDataSource();
$fields = $Obj->schema(true);
@ -691,7 +691,7 @@ class CakeSchema extends Object {
* @param string $table Full table name
* @return string Prefix-less table name
*/
function _noPrefixTable($prefix, $table) {
protected function _noPrefixTable($prefix, $table) {
return preg_replace('/^' . preg_quote($prefix) . '/', '', $table);
}
}

View file

@ -126,7 +126,7 @@ class DataSource extends Object {
if (isset($this->_descriptions[$table])) {
return $this->_descriptions[$table];
}
$cache = $this->__cacheDescription($table);
$cache = $this->_cacheDescription($table);
if ($cache !== null) {
$this->_descriptions[$table] =& $cache;
@ -287,7 +287,7 @@ class DataSource extends Object {
* @param mixed $data The description of the model, usually a string or array
* @return mixed
*/
function __cacheDescription($object, $data = null) {
protected function _cacheDescription($object, $data = null) {
if ($this->cacheSources === false) {
return null;
}

View file

@ -323,7 +323,7 @@ class Mysql extends DboSource {
}
}
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
$this->_cacheDescription($this->fullTableName($model, false), $fields);
$cols->closeCursor();
return $fields;
}

View file

@ -505,7 +505,7 @@ class DboOracle extends DboSource {
'length'=> $row[0]['DATA_LENGTH']
);
}
$this->__cacheDescription($this->fullTableName($model, false), $fields);
$this->_cacheDescription($this->fullTableName($model, false), $fields);
return $fields;
}

View file

@ -249,7 +249,7 @@ class Postgres extends DboSource {
$fields[$c->name]['default'] = constant($fields[$c->name]['default']);
}
}
$this->__cacheDescription($table, $fields);
$this->_cacheDescription($table, $fields);
}
if (isset($model->sequence)) {
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;

View file

@ -185,7 +185,7 @@ class Sqlite extends DboSource {
}
$result->closeCursor();
$this->__cacheDescription($model->tablePrefix . $model->table, $fields);
$this->_cacheDescription($model->tablePrefix . $model->table, $fields);
return $fields;
}

View file

@ -247,7 +247,7 @@ class Sqlserver extends DboSource {
$fields[$field]['length'] = $fields[$field]['length'] . ',' . $column->Size;
}
}
$this->__cacheDescription($table, $fields);
$this->_cacheDescription($table, $fields);
$cols->closeCursor();
return $fields;
}

View file

@ -422,7 +422,7 @@ class SchemaShellTest extends CakeTestCase {
public function testUpdateWithTable() {
$this->Shell = $this->getMock(
'SchemaShell',
array('in', 'out', 'hr', 'createFile', 'error', 'err', '_stop', '__run'),
array('in', 'out', 'hr', 'createFile', 'error', 'err', '_stop', '_run'),
array(&$this->Dispatcher)
);
@ -433,7 +433,7 @@ class SchemaShellTest extends CakeTestCase {
$this->Shell->args = array('SchemaShellTest', 'articles');
$this->Shell->startup();
$this->Shell->expects($this->any())->method('in')->will($this->returnValue('y'));
$this->Shell->expects($this->once())->method('__run')
$this->Shell->expects($this->once())->method('_run')
->with($this->arrayHasKey('articles'), 'update', $this->isInstanceOf('CakeSchema'));
$this->Shell->update();

View file

@ -236,7 +236,7 @@ class ControllerMergeVarsTest extends CakeTestCase {
}
/**
* Ensure that __mergeVars is not being greedy and merging with
* Ensure that _mergeControllerVars is not being greedy and merging with
* AppController when you make an instance of Controller
*
* @return void

View file

@ -904,7 +904,7 @@ class ControllerTest extends CakeTestCase {
}
/**
* Ensure that __mergeVars is not being greedy and merging with
* Ensure that _mergeControllerVars is not being greedy and merging with
* ControllerTestAppController when you make an instance of Controller
*
* @return void

View file

@ -398,7 +398,7 @@ class Folder {
}
while (!empty($this->_directories)) {
$dir = array_pop($this->_directories);
$this->__tree($dir, $exceptions);
$this->_tree($dir, $exceptions);
$directories[] = $dir;
}
@ -420,7 +420,7 @@ class Folder {
* @param mixed $exceptions Array of files to exclude from the read that will be performed.
* @return void
*/
public function __tree($path, $exceptions) {
protected function _tree($path, $exceptions) {
$this->path = $path;
list($dirs, $files) = $this->read(false, $exceptions, true);
$this->_directories = array_merge($this->_directories, $dirs);

View file

@ -126,7 +126,7 @@ class Set {
if (empty($val)) {
return null;
}
return Set::__map($val, $class);
return Set::_map($val, $class);
}
/**
@ -142,7 +142,7 @@ class Set {
* @param boolean $primary whether to assign first array key as the _name_
* @return mixed Mapped object
*/
public static function __map(&$array, $class, $primary = false) {
protected static function _map(&$array, $class, $primary = false) {
if ($class === true) {
$out = new stdClass;
} else {
@ -158,7 +158,7 @@ class Set {
if (is_object($out)) {
$out = get_object_vars($out);
}
$out[$key] = Set::__map($value, $class);
$out[$key] = Set::_map($value, $class);
if (is_object($out[$key])) {
if ($primary !== true && is_array($value) && Set::countDim($value, true) === 2) {
if (!isset($out[$key]->_name_)) {
@ -173,18 +173,18 @@ class Set {
}
$primary = false;
foreach ($value as $key2 => $value2) {
$out->{$key2} = Set::__map($value2, true);
$out->{$key2} = Set::_map($value2, true);
}
} else {
if (!is_numeric($key)) {
$out->{$key} = Set::__map($value, true, $key);
$out->{$key} = Set::_map($value, true, $key);
if (is_object($out->{$key}) && !is_numeric($key)) {
if (!isset($out->{$key}->_name_)) {
$out->{$key}->_name_ = $key;
}
}
} else {
$out->{$key} = Set::__map($value, true);
$out->{$key} = Set::_map($value, true);
}
}
} else {

View file

@ -187,7 +187,7 @@ class CacheHelper extends AppHelper {
*
* @return string The content with cake:nocache tags replaced.
*/
function _replaceSection() {
protected function _replaceSection() {
$this->_counter += 1;
return sprintf('<!--nocache:%03d-->', $this->_counter);
}
@ -200,7 +200,7 @@ class CacheHelper extends AppHelper {
* @param string $content String to remove tags from.
* @return string String with tags removed.
*/
function _stripTags($content) {
protected function _stripTags($content) {
return preg_replace('#<!--/?nocache(\:\d{3})?-->#', '', $content);
}

View file

@ -98,7 +98,7 @@ class FormHelper extends AppHelper {
* An array of fieldnames that have been excluded from
* the Token hash used by SecurityComponent's validatePost method
*
* @see FormHelper::__secure()
* @see FormHelper::_secure()
* @see SecurityComponent::validatePost()
* @var array
*/
@ -591,7 +591,7 @@ class FormHelper extends AppHelper {
* @param mixed $value Field value, if value should not be tampered with.
* @return void
*/
protected function __secure($lock, $field = null, $value = null) {
protected function _secure($lock, $field = null, $value = null) {
if (!$field) {
$field = $this->entity();
} elseif (is_string($field)) {
@ -1400,7 +1400,7 @@ class FormHelper extends AppHelper {
));
if ($secure && $secure !== self::SECURE_SKIP) {
$this->__secure(true, null, '' . $options['value']);
$this->_secure(true, null, '' . $options['value']);
}
return $this->Html->useTag('hidden', $options['name'], array_diff_key($options, array('name' => '')));
@ -1423,7 +1423,7 @@ class FormHelper extends AppHelper {
$field = $this->entity();
foreach (array('name', 'type', 'tmp_name', 'error', 'size') as $suffix) {
$this->__secure($secure, array_merge($field, array($suffix)));
$this->_secure($secure, array_merge($field, array($suffix)));
}
return $this->Html->useTag('file', $options['name'], array_diff_key($options, array('name' => '')));
@ -1448,7 +1448,7 @@ class FormHelper extends AppHelper {
$title = h($title);
}
if (isset($options['name'])) {
$this->__secure($options['secure'], $options['name']);
$this->_secure($options['secure'], $options['name']);
}
return $this->Html->useTag('button', $options['type'], array_diff_key($options, array('type' => '')), $title);
}
@ -1592,7 +1592,7 @@ class FormHelper extends AppHelper {
}
if (isset($options['name'])) {
$this->__secure($options['secure'], $options['name']);
$this->_secure($options['secure'], $options['name']);
}
unset($options['secure']);
@ -1698,7 +1698,7 @@ class FormHelper extends AppHelper {
));
if (is_string($options) && isset($this->_options[$options])) {
$options = $this->__generateOptions($options);
$options = $this->_generateOptions($options);
} elseif (!is_array($options)) {
$options = array();
}
@ -1729,7 +1729,7 @@ class FormHelper extends AppHelper {
if (!empty($tag) || isset($template)) {
if (!isset($secure) || $secure == true) {
$this->__secure(true);
$this->_secure(true);
}
$select[] = $this->Html->useTag($tag, $attributes['name'], array_diff_key($attributes, array('name' => '', 'value' => '')));
}
@ -1751,7 +1751,7 @@ class FormHelper extends AppHelper {
$attributes['id'] = Inflector::camelize($attributes['id']);
}
$select = array_merge($select, $this->__selectOptions(
$select = array_merge($select, $this->_selectOptions(
array_reverse($options, true),
array(),
$showParents,
@ -1786,14 +1786,14 @@ class FormHelper extends AppHelper {
*/
public function day($fieldName = null, $attributes = array()) {
$attributes += array('empty' => true, 'value' => null);
$attributes = $this->__dateTimeSelected('day', $fieldName, $attributes);
$attributes = $this->_dateTimeSelected('day', $fieldName, $attributes);
if (strlen($attributes['value']) > 2) {
$attributes['value'] = date('d', strtotime($attributes['value']));
} elseif ($attributes['value'] === false) {
$attributes['value'] = null;
}
return $this->select($fieldName . ".day", $this->__generateOptions('day'), $attributes);
return $this->select($fieldName . ".day", $this->_generateOptions('day'), $attributes);
}
/**
@ -1845,7 +1845,7 @@ class FormHelper extends AppHelper {
unset($attributes['orderYear']);
}
return $this->select(
$fieldName . '.year', $this->__generateOptions('year', $yearOptions),
$fieldName . '.year', $this->_generateOptions('year', $yearOptions),
$attributes
);
}
@ -1868,7 +1868,7 @@ class FormHelper extends AppHelper {
*/
public function month($fieldName, $attributes = array()) {
$attributes += array('empty' => true, 'value' => null);
$attributes = $this->__dateTimeSelected('month', $fieldName, $attributes);
$attributes = $this->_dateTimeSelected('month', $fieldName, $attributes);
if (strlen($attributes['value']) > 2) {
$attributes['value'] = date('m', strtotime($attributes['value']));
@ -1882,7 +1882,7 @@ class FormHelper extends AppHelper {
return $this->select(
$fieldName . ".month",
$this->__generateOptions('month', array('monthNames' => $monthNames)),
$this->_generateOptions('month', array('monthNames' => $monthNames)),
$attributes
);
}
@ -1904,7 +1904,7 @@ class FormHelper extends AppHelper {
*/
public function hour($fieldName, $format24Hours = false, $attributes = array()) {
$attributes += array('empty' => true, 'value' => null);
$attributes = $this->__dateTimeSelected('hour', $fieldName, $attributes);
$attributes = $this->_dateTimeSelected('hour', $fieldName, $attributes);
if (strlen($attributes['value']) > 2) {
if ($format24Hours) {
@ -1917,7 +1917,7 @@ class FormHelper extends AppHelper {
}
return $this->select(
$fieldName . ".hour",
$this->__generateOptions($format24Hours ? 'hour24' : 'hour'),
$this->_generateOptions($format24Hours ? 'hour24' : 'hour'),
$attributes
);
}
@ -1938,7 +1938,7 @@ class FormHelper extends AppHelper {
*/
public function minute($fieldName, $attributes = array()) {
$attributes += array('empty' => true, 'value' => null);
$attributes = $this->__dateTimeSelected('min', $fieldName, $attributes);
$attributes = $this->_dateTimeSelected('min', $fieldName, $attributes);
if (strlen($attributes['value']) > 2) {
$attributes['value'] = date('i', strtotime($attributes['value']));
@ -1952,7 +1952,7 @@ class FormHelper extends AppHelper {
unset($attributes['interval']);
}
return $this->select(
$fieldName . ".min", $this->__generateOptions('minute', $minuteOptions),
$fieldName . ".min", $this->_generateOptions('minute', $minuteOptions),
$attributes
);
}
@ -1965,7 +1965,7 @@ class FormHelper extends AppHelper {
* @param array $attributes Array of attributes, must contain 'empty' key.
* @return array Attributes array with currently selected value.
*/
function __dateTimeSelected($select, $fieldName, $attributes) {
protected function _dateTimeSelected($select, $fieldName, $attributes) {
if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) {
if (is_array($value) && isset($value[$select])) {
$attributes['value'] = $value[$select];
@ -2017,7 +2017,7 @@ class FormHelper extends AppHelper {
$attributes['value'] = null;
}
return $this->select(
$fieldName . ".meridian", $this->__generateOptions('meridian'),
$fieldName . ".meridian", $this->_generateOptions('meridian'),
$attributes
);
}
@ -2264,7 +2264,7 @@ class FormHelper extends AppHelper {
* @param array $attributes
* @return array
*/
function __selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
$select = array();
$attributes = array_merge(
array('escape' => true, 'style' => null, 'value' => null, 'class' => null),
@ -2284,7 +2284,7 @@ class FormHelper extends AppHelper {
}
$parents[] = $name;
}
$select = array_merge($select, $this->__selectOptions(
$select = array_merge($select, $this->_selectOptions(
$title, $parents, $showParents, $attributes
));
@ -2357,7 +2357,7 @@ class FormHelper extends AppHelper {
* @param array $options
* @return array
*/
function __generateOptions($name, $options = array()) {
protected function _generateOptions($name, $options = array()) {
if (!empty($this->options[$name])) {
return $this->options[$name];
}
@ -2487,7 +2487,7 @@ class FormHelper extends AppHelper {
}
}
$this->__secure($secure, $fieldName);
$this->_secure($secure, $fieldName);
return $result;
}
}

View file

@ -902,7 +902,7 @@ class HtmlHelper extends AppHelper {
$tag = $options;
$options = array();
}
$items = $this->__nestedListItem($list, $options, $itemOptions, $tag);
$items = $this->_nestedListItem($list, $options, $itemOptions, $tag);
return sprintf($this->_tags[$tag], $this->_parseAttributes($options, null, ' ', ''), $items);
}
@ -916,7 +916,7 @@ class HtmlHelper extends AppHelper {
* @return string The nested list element
* @see HtmlHelper::nestedList()
*/
function __nestedListItem($items, $options, $itemOptions, $tag) {
protected function _nestedListItem($items, $options, $itemOptions, $tag) {
$out = '';
$index = 1;

View file

@ -251,7 +251,7 @@ class PaginatorHelper extends AppHelper {
'rel' => 'prev'
);
$options = array_merge($defaults, (array)$options);
return $this->__pagingLink('Prev', $title, $options, $disabledTitle, $disabledOptions);
return $this->_pagingLink('Prev', $title, $options, $disabledTitle, $disabledOptions);
}
/**
@ -274,7 +274,7 @@ class PaginatorHelper extends AppHelper {
'rel' => 'next'
);
$options = array_merge($defaults, (array)$options);
return $this->__pagingLink('Next', $title, $options, $disabledTitle, $disabledOptions);
return $this->_pagingLink('Next', $title, $options, $disabledTitle, $disabledOptions);
}
/**
@ -426,7 +426,7 @@ class PaginatorHelper extends AppHelper {
* @param array $disabledOptions
* @return string
*/
protected function __pagingLink($which, $title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
protected function _pagingLink($which, $title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
$check = 'has' . $which;
$_defaults = array(
'url' => array(), 'step' => 1, 'escape' => true,
@ -468,7 +468,7 @@ class PaginatorHelper extends AppHelper {
* @return boolean True if the result set is not at the first page.
*/
public function hasPrev($model = null) {
return $this->__hasPage($model, 'prev');
return $this->_hasPage($model, 'prev');
}
/**
@ -478,7 +478,7 @@ class PaginatorHelper extends AppHelper {
* @return boolean True if the result set is not at the last page.
*/
public function hasNext($model = null) {
return $this->__hasPage($model, 'next');
return $this->_hasPage($model, 'next');
}
/**
@ -504,7 +504,7 @@ class PaginatorHelper extends AppHelper {
* @param integer $page Page number you are checking.
* @return boolean Whether model has $page
*/
protected function __hasPage($model, $page) {
protected function _hasPage($model, $page) {
$params = $this->params($model);
if (!empty($params)) {
if ($params["{$page}Page"] == true) {