public function test_singularize_plurals()
 {
     $ar = (require __DIR__ . '/cases/singular_to_plural.php');
     foreach ($ar as $singular => $plural) {
         $this->assertEquals($singular, self::$inflector->singularize($plural));
         $this->assertEquals($singular, self::$inflector->singularize($singular));
         $this->assertEquals(ucfirst($singular), self::$inflector->singularize(ucfirst($plural)));
         $this->assertEquals(ucfirst($singular), self::$inflector->singularize(ucfirst($singular)));
     }
 }
 /**
  * Show tabs
  *
  * @return string
  */
 public function panelTabs($show = null)
 {
     if (!isset($this->adminTabs)) {
         $this->adminTabs = false;
     }
     $output = '';
     $tabs = Configure::read('Webshop.panel.tabs.' . Inflector::camelize($this->request->params['controller']) . '/' . $this->request->params['action']);
     if (is_array($tabs)) {
         foreach ($tabs as $title => $tab) {
             $tab = Hash::merge(array('options' => array('linkOptions' => array(), 'elementData' => array(), 'elementOptions' => array())), $tab);
             if (!isset($tab['options']['type']) || isset($tab['options']['type']) && in_array($this->_View->viewVars['typeAlias'], $tab['options']['type'])) {
                 $domId = strtolower(Inflector::singularize($this->request->params['controller'])) . '-' . strtolower(Inflector::slug($title, '-'));
                 if ($this->adminTabs) {
                     list($plugin, $element) = pluginSplit($tab['element']);
                     $elementOptions = Hash::merge(array('plugin' => $plugin), $tab['options']['elementOptions']);
                     $output .= '<div id="' . $domId . '" class="tab-pane">';
                     $output .= $this->_View->element($element, $tab['options']['elementData'], $elementOptions);
                     $output .= '</div>';
                 } else {
                     $output .= $this->panelTab(__d('croogo', $title), '#' . $domId, $tab['options']['linkOptions']);
                 }
             }
         }
     }
     $this->adminTabs = true;
     return $output;
 }
示例#3
0
 function flash($message, $url)
 {
     $controllerName = Inflector::humanize(Inflector::singularize($this->params['controller']));
     if ($url == 'dashboard') {
         $url = array('controller' => 'projects', 'action' => 'index');
     } elseif ($url == 'index') {
         $url = array('action' => 'index');
     }
     switch ($message) {
         case 'saved':
             $message = 'The ' . $controllerName . ' has been saved.';
             break;
         case 'deleted':
             $message = 'The ' . $controllerName . ' has been deleted.';
             break;
         case 'failed':
             $message = 'The ' . $controllerName . ' could not be saved. Please try again';
             break;
         case 'invalid':
             $message = 'Invalid ' . $controllerName . '.';
             break;
         case 'noid':
             $message = 'Invalid ID.';
             break;
     }
     $this->Session->setFlash($message);
     if (!empty($url)) {
         $this->redirect($url);
     }
 }
示例#4
0
 public function onAttachBehaviors($event)
 {
     if ($event->Handler->shouldAutoAttachBehavior()) {
         // attach the expandable (eva) behavior if there is a table for it
         $attributesTable = Inflector::singularize($event->Handler->tablePrefix . $event->Handler->table) . '_attributes';
         if (in_array($attributesTable, $event->Handler->getTables($event->Handler->useDbConfig))) {
             $event->Handler->bindModel(array('hasMany' => array($event->Handler->name . 'Attribute' => array('className' => Inflector::camelize($attributesTable), 'foreignKey' => Inflector::underscore($event->Handler->name) . '_id', 'dependent' => true))), false);
             $event->Handler->Behaviors->attach('Libs.Expandable');
         }
         if ($event->Handler->shouldAutoAttachBehavior('Libs.Sluggable', array('slug'))) {
             $event->Handler->Behaviors->attach('Libs.Sluggable', array('label' => array($event->Handler->displayField)));
         }
         if ($event->Handler->shouldAutoAttachBehavior('Libs.Sequence', array('ordering'))) {
             $event->Handler->Behaviors->attach('Libs.Sequence');
         }
         if ($event->Handler->shouldAutoAttachBehavior('Libs.Rateable', array('rating'))) {
             $event->Handler->Behaviors->attach('Libs.Rateable');
         }
         if ($event->Handler->shouldAutoAttachBehavior('Tree', array('lft', 'rght')) && $event->Handler->shouldAutoAttachBehavior('InfiniTree', array('lft', 'rght'))) {
             $event->Handler->Behaviors->attach('Tree');
         }
         if ($event->Handler->shouldAutoAttachBehavior('Libs.Validation')) {
             $event->Handler->Behaviors->attach('Libs.Validation');
         }
     }
 }
示例#5
0
 function generate()
 {
     $this->name = Inflector::singularize($this->name);
     $this->class_name = Inflector::camelize($this->name);
     $model_template = $this->templates_path . '/model.php';
     if (stristr($this->name, '_')) {
         $model_file = Znap::$models_path . '/' . strtolower($this->name) . '.php';
     } else {
         $model_file = Znap::$models_path . '/' . Inflector::underscore($this->name) . '.php';
     }
     if (!is_file($model_file)) {
         if (is_file($model_template)) {
             $model_data = file_get_contents($model_template);
             $model_data = str_replace('[class_name]', $this->class_name, $model_data);
             if (file_put_contents($model_file, $model_data)) {
                 $this->echo_create($model_file);
             } else {
                 $this->echo_create_error($model_file, 'model');
             }
         } else {
             $this->echo_template_error($model_template, 'model');
             exit;
         }
     } else {
         $this->echo_exists($model_file);
     }
     return true;
 }
示例#6
0
 function arr2Xml($arr)
 {
     foreach ($arr as $key => $val) {
         //starting tag
         if (!is_numeric($key)) {
             $this->response .= sprintf('<%s>', $key);
         }
         //Another array
         if (is_array($val)) {
             //Handle non-associative arrays
             if ($this->is_numerically_indexed_array($val)) {
                 foreach ($val as $item) {
                     $tag = Inflector::singularize($key);
                     $this->response .= sprintf("<%s>", $tag);
                     $this->arr2Xml($item);
                     $this->response .= sprintf("</%s>", $tag);
                 }
             } else {
                 $this->arr2Xml($val);
             }
         } elseif (is_string($val)) {
             $this->response .= $val;
         }
         //Draw closing tag
         if (!is_numeric($key)) {
             $this->response .= sprintf('</%s>', $key);
         }
     }
 }
 function admin_index()
 {
     /* Active/Inactive/Delete functionality */
     if (isset($this->request->data["SiteType"]["setStatus"])) {
         //pr($this->request->data);die;
         if (!empty($this->request->data['SiteType']['status'])) {
             $status = $this->request->data['SiteType']['status'];
         } else {
             $this->Session->setFlash("Please select the action.", 'default', array('class' => 'alert alert-danger'));
             $this->redirect(array('action' => 'admin_index'));
         }
         $CheckedList = $this->request->data['checkboxes'];
         $model = 'SiteType';
         $controller = $this->params['controller'];
         $action = $this->params['action'];
         parent::setStatus($status, $CheckedList, $model, $controller, $action);
     }
     /* Active/Inactive/Delete functionality */
     $value = "";
     $value1 = "";
     $show = "";
     $criteria = "";
     if (!empty($this->params)) {
         if (!empty($this->params->query['keyword'])) {
             $criteria .= " SiteType.name LIKE '%" . trim($this->params->query['keyword']) . "%' ";
         }
     }
     $this->Paginator->settings = array('conditions' => array($criteria), 'limit' => Configure::read('Settings.paginationLimit'), 'order' => array('SiteType.id' => 'DESC'));
     $this->set('getData', $this->Paginator->paginate('SiteType'));
     $this->set('keyword', $value);
     $this->set('show', $show);
     $this->set('navadmins', 'class = "active"');
     $this->set('breadcrumb', 'SiteTypes/Listing');
     $this->set('models', Inflector::singularize($this->name));
 }
示例#8
0
 /**
  *  Test {@link Inflector::singularize()}
  */
 public function testSingularize()
 {
     $this->assertEquals(Inflector::singularize('orders'), 'order');
     $this->assertEquals(Inflector::singularize('people'), 'person');
     $this->assertEquals(Inflector::singularize('processes'), 'process');
     $this->assertEquals(Inflector::singularize('queries'), 'query');
 }
示例#9
0
 public function beforeRender()
 {
     $this->Navigation->Process($this);
     $this->set('trail', $this->Navigation->trail);
     $this->loadModel('Config');
     $config = $this->Config->find('all', array('conditions' => array('Config.active_flg' => true)));
     $config = $config[0];
     $this->loadModel('User');
     $this->User->recursive = 1;
     $signedUser = $this->User->read(null, $this->Session->read('Auth.User.id'));
     $slangConf = '';
     if (isset($config['Config']['prefLanguage'])) {
         $slangConf = $config['Config']['prefLanguage'];
     }
     Configure::write('Config.language', $slangConf);
     $this->appLangConf = $slangConf;
     try {
         $relObjType = Inflector::singularize($this->name);
     } catch (Exception $ex) {
         $relObjType = "";
     }
     $relObjId = isset($this->data[$relObjType]["id"]) ? $this->request->data[$relObjType]["id"] : 0;
     $this->set('slangConf', $slangConf);
     $this->set('menu', $this->buildMainMenu());
     $this->set('config', $config);
     $this->set('signedUser', $signedUser);
     $this->set('relObjType', $relObjType);
     $this->set('relObjId', $relObjId);
     $this->set('pricelistID', $this->getPricelistID());
 }
 function add($type = null, $recordId = null)
 {
     if (!ctype_digit($recordId) || !ctype_alpha($type) || ($model =& ClassRegistry::init(strtolower($type))) == false) {
         $this->_showCritError('Invalid type and/or record id');
     } else {
         $type = ucwords(Inflector::singularize(strtolower($type)));
         if (!empty($this->data)) {
             if (($type_id = constant('VARIABLE_TYPE_' . strtoupper($type))) === false) {
                 $type_id = -1;
             }
             // Will cause validation to fail, since we only use positive integers
             $this->Variable->create();
             $this->data['Variable']['ref_id'] = $recordId;
             $this->data['Variable']['ref_type'] = $type_id;
             if ($this->Variable->save($this->data)) {
                 $this->Session->setFlash('The Variable has been saved');
                 $this->redirect(array('action' => 'view', $type, $recordId));
                 //$this->redirect(array('controller' => Inflector::pluralize(strtolower($type)), 'action'=>'view', $recordId));
             } else {
                 $this->Session->setFlash('The Variable could not be saved');
             }
         }
         $name = $model->field($model->displayField, array("{$type}.id" => $recordId));
         if (!$name) {
             $this->Session->setFlash("Invalid {$type} id.");
             $this->redirect(array('controller' => strtolower($type), 'action' => 'index'));
         }
         $this->set(compact('type', 'recordId', 'name'));
     }
 }
示例#11
0
文件: v1.php 项目: xXLXx/ddc
 public function action_update($controller, $id = null)
 {
     $class = $this->getClass($controller);
     $success = false;
     $errors = [];
     if (!$id) {
         $errors[] = 'Please include a PK ID';
         return $this->response(['errors' => $errors]);
     }
     $obj = $class::find($id);
     if (!$obj) {
         $errors[] = 'Cannot find ' . Inflector::singularize(Inflector::humanize($controller)) . ' with ID: ' . $id;
     } else {
         foreach (Input::post() as $key => $value) {
             $obj->{$key} = $value;
         }
         $success = $obj->save();
         if (!$success) {
             $errors[] = 'Could not save ' . Inflector::singularize(Inflector::humanize($controller));
         } else {
             $data = $obj;
         }
     }
     return $this->response(['data' => $data, 'success' => $success, 'errors' => $errors]);
 }
示例#12
0
 public static function getExternalConditions($select, $parentModel, $childName, $attributes)
 {
     $parentModelName = get_class($parentModel);
     $parentTableName = $parentModel->getTableName();
     // exhibitions
     $childName = array_key_exists('source', $attributes) ? $attributes['source'] : $childName;
     $childModelName = Inflector::classify($childName);
     $childTableName = Bbx_Model::load($childModelName)->getTableName();
     // images
     if (!array_key_exists($childTableName, $select->getPart('from'))) {
         $select->from($childTableName, array());
         // images
     }
     if (array_key_exists('as', $attributes)) {
         $refColumn = $attributes['as'] . '_id';
         $polyType = $attributes['as'] . '_type';
     } else {
         $refColumn = Inflector::singularize($parentTableName) . '_id';
     }
     try {
         $parentModel->getRowData();
         $select->where("`" . $childTableName . "`.`" . $refColumn . "` = " . $parentModel->id);
     } catch (Exception $e) {
         $select->where("`" . $childTableName . "`.`" . $refColumn . "` = `" . $parentTableName . "`.`id`");
     }
     if (isset($polyType)) {
         $select->where("`" . $childTableName . "`.`" . $polyType . "` = '" . Inflector::underscore($parentModelName) . "'");
     }
     return $select;
 }
 function _importTables($from)
 {
     $defaultDb = ConnectionManager::getDataSource($from);
     foreach ($defaultDb->listSources() as $table) {
         $this->fixtures[] = "app." . Inflector::singularize($table);
     }
 }
示例#14
0
 function generate()
 {
     $layout_template = $this->templates_path . '/layout.phtml';
     if (is_file($layout_template)) {
         $this->name = Inflector::singularize($this->name);
         $this->class_name = Inflector::camelize($this->name);
         if (stristr($this->name, '_')) {
             $layout_filename = strtolower($this->name) . '.' . Znap::$views_extension;
         } else {
             $layout_filename = Inflector::underscore($this->name) . '.' . Znap::$views_extension;
         }
         $view_paths = glob(Znap::$app_path . '/views*');
         foreach ($view_paths as $path) {
             $layout_file = $path . '/__layouts/' . $layout_filename;
             if (!is_file($layout_file)) {
                 $layout_data = file_get_contents($layout_template);
                 $layout_data = str_replace('[layout]', $this->name, $layout_data);
                 if (file_put_contents($layout_file, $layout_data)) {
                     $this->echo_create($layout_file);
                 } else {
                     $this->echo_create_error($layout_file, 'layout');
                     exit;
                 }
             } else {
                 $this->echo_exists($layout_file);
             }
         }
     } else {
         $this->echo_template_error($layout_template, 'layout');
         exit;
     }
     return true;
 }
示例#15
0
文件: Privilege.php 项目: ayaou/Zuha
 /**
  * Write link permissions method
  * 
  */
 protected function _writeLinkPermissions()
 {
     $acos = array();
     $privileges = $this->find('all', array('conditions' => array('Privilege._create' => 1, 'Privilege._read' => 1, 'Privilege._update' => 1, 'Privilege._delete' => 1)));
     foreach ($privileges as $privilege) {
         if (!empty($acos[$privilege['Privilege']['aco_id']])) {
             $acos[$privilege['Privilege']['aco_id']] = $acos[$privilege['Privilege']['aco_id']] . ',' . $privilege['Privilege']['aro_id'];
         } else {
             $acos[$privilege['Privilege']['aco_id']] = $privilege['Privilege']['aro_id'];
         }
     }
     $settings = '';
     foreach ($acos as $aco => $aros) {
         $path = $this->Section->getPath($aco);
         // all of the acos parents
         if ($path === null) {
             // if path is null we need to delete the aros_acos that use that aco because it doesn't exist
             $this->deleteAll(array('Privilege.aco_id' => $aco));
         } else {
             $url = str_replace('controllers', '', Inflector::singularize(Inflector::tableize(ZuhaInflector::flatten(Set::extract('/Section/alias', $path), array('separator' => '/')))));
             $settings .= $url . ' = ' . $aros . PHP_EOL;
         }
     }
     App::uses('Setting', 'Model');
     $Setting = new Setting();
     $data['Setting']['type'] = 'APP';
     $data['Setting']['name'] = 'LINK_PERMISSIONS';
     $data['Setting']['value'] = trim($settings);
     $Setting->add($data);
 }
示例#16
0
function smarty_function_header($params, &$smarty)
{
    $self = $smarty->getTemplateVars('self');
    $theme = $smarty->getTemplateVars('theme');
    $title = $smarty->getTemplateVars('page_title');
    $inflector = new Inflector();
    $item_name = prettify($inflector->singularize($smarty->getTemplateVars('controller')));
    if (empty($title) || $title === 'Index') {
        switch ($smarty->getTemplateVars('action')) {
            case 'view':
                $title = $item_name . ' Details';
                break;
            case 'edit':
                $title = 'Editing ' . $item_name . ' Details';
                break;
            case 'new':
                $title = 'Create new ' . $item_name;
                break;
            case 'index':
            default:
                $title = $item_name;
                break;
        }
    }
    return '<h1 class="page_title">' . $title . '</h1>';
}
 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     if (!$this->_controller) {
         $this->_controller = Inflector::singularize($this->plugin) . '_' . 'block_role_permissions';
     }
     parent::setUp();
 }
示例#18
0
 public function import()
 {
     if (isset($this->params['name'])) {
         $dataObjects = array(Inflector::camelize(Inflector::singularize($this->params['name'])) . 'Data');
     } else {
         $dataObjects = App::objects('class', $this->directory);
     }
     $passFields = null;
     if (array_key_exists('pass', $this->params)) {
         $passFields = array('created', 'updated', 'modified');
     }
     foreach ($dataObjects as $data) {
         App::import('class', $data, false, $this->directory);
         extract(get_class_vars($data));
         if (empty($records) || !is_array($records)) {
             continue;
         }
         $Model = ClassRegistry::init($name);
         $Model->useDbConfig = $this->connection;
         if ($passFields) {
             foreach ($records as &$record) {
                 foreach ($passFields as $field) {
                     unset($record[$field]);
                 }
             }
         }
         $Model->query("TRUNCATE `{$Model->table}`");
         $success = 'Faild';
         if ($Model->saveAll($records, array('validate' => false))) {
             $success = 'Success';
         }
         $this->out("Data imported: {$Model->name} [{$success}]");
     }
 }
 /**
  * REST api dispatcher
  */
 public function disparador()
 {
     # Load the appropriate version of the api
     $api['version'] = $this->params['version'];
     # Detect method: get/post/put/delete
     $api['method'] = strtolower($_SERVER['REQUEST_METHOD']);
     # Override the method when it is explicitly set
     if (isset($this->params->query['method'])) {
         $api['method'] = strtolower($this->params->query['method']);
         unset($this->params->query['method']);
     }
     # Define the noun
     $api['modelo'] = ucwords(Inflector::singularize($this->params['noun']));
     $api['controller'] = Inflector::pluralize($this->params['noun']);
     $this->loadModel($api['modelo']);
     # Check if we have a passed argument we should use
     if (isset($this->request->params['pass'][1])) {
         $api['id'] = $this->request->params['pass'][1];
         if ($api['id'] === 0) {
             return $this->_apiFallo('ID inválido');
         }
     }
     # Define possible parameters
     $api['parameters'] = $this->request->query;
     # If the header has signature and key, override the api['parameters']-value
     #if (isset($header['HTTP_KEY']))
     #	$api['parameters']['key'] = $header['HTTP_KEY'];
     if (isset($header['HTTP_SIGNATURE'])) {
         $api['parameters']['signature'] = $header['HTTP_SIGNATURE'];
     }
     # Check if we need to suppress the response codes
     if (isset($api['parameters']['suppress_response_code'])) {
         unset($api['parameters']['suppress_response_code']);
         $api['suppress_response_code'] = true;
     }
     # Check if we are debugging: ?debug should be set (or debug should be defined in header)
     if (isset($api['parameters']['debug']) || isset($header['HTTP_DEBUG'])) {
         unset($api['parameters']['debug']);
         $api['debug'] = true;
         $result['call'] = $api;
     }
     if (empty($this->request->params['pass'][0])) {
         return $this->_apiFallo('Metodo no encontrado');
     }
     $action = 'api_' . $this->request->params['pass'][0];
     if (!method_exists($this, $action)) {
         return $this->_apiFallo('Metodo no encontrado');
     }
     if (empty($api['parameters']['key'])) {
         $api['key'] = 'id';
     } else {
         $api['key'] = $api['parameters']['key'];
         unset($api['parameters']['key']);
         if (!ClassRegistry::init($api['controller'])->hasField($api['key'])) {
             return $this->_apiFallo('Key no encontrado');
         }
     }
     $this->setAction($action, $api);
 }
 public function testSingulars()
 {
     $this->assertEqual(Inflector::singularize('categories'), 'category');
     $this->assertEqual(Inflector::singularize('mice'), 'mouse');
     $this->assertEqual(Inflector::singularize('searches'), 'search');
     $this->assertEqual(Inflector::singularize('years'), 'year');
     $this->assertEqual(Inflector::singularize('aliases'), 'alias');
 }
示例#21
0
 public static function create_linking_table($table1, $table2)
 {
     $table = $table1 . '_' . $table2;
     $col1 = Inflector::singularize($table1) . '_id';
     $col2 = Inflector::singularize($table2) . '_id';
     $sql = "CREATE TABLE `{$table}` (\n\t\t  `{$col1}` int(11) NOT NULL,\n\t\t  `{$col2}` int(11) NOT NULL\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
     return DatabaseTransaction::run_query($sql) ? "Created linking table: {$table}\n" : false;
 }
示例#22
0
 /**
  * @param $model
  *
  * @return mixed
  */
 protected function _set_model($model)
 {
     if (empty($model)) {
         $model = Inflector::camelize(Inflector::singularize(Inflector::humanize($this->request->controller)));
         return $model;
     }
     return $model;
 }
示例#23
0
 public function references($ref_table, $ref_column = 'id', $options = array('on_update' => 'CASCADE', 'on_delete' => 'CASCADE'))
 {
     $column_name = Inflector::singularize($ref_table) . '_' . Inflector::singularize($ref_column);
     $ref_table = Inflector::pluralize($ref_table);
     $this->add_column($column_name, 'integer', array('null' => false));
     $this->add_index($column_name);
     $this->add_foreign_key($column_name, $ref_table, $ref_column, $options);
 }
示例#24
0
 function test_singularize_and_pluralize()
 {
     $plurals = array("cow" => "kine", "news" => "news", "person" => "people", "fish" => "fish", "attachment" => "attachments");
     foreach ($plurals as $singular => $plural) {
         $this->assertEqual($singular, Inflector::singularize($plural));
         $this->assertEqual(Inflector::pluralize($singular), $plural);
     }
 }
示例#25
0
 /**
  * Called after the Controller::beforeRender(), after the view class is loaded, and before the
  * Controller::render()
  *
  * @param object $controller Controller with components to beforeRender
  * @return void
  */
 public function beforeRender(&$controller)
 {
     $modelAliases = array_keys($this->translateModels);
     $singularCamelizedControllerName = Inflector::camelize(Inflector::singularize($controller->params['controller']));
     if (in_array($singularCamelizedControllerName, $modelAliases)) {
         Configure::write('Admin.rowActions.Translations', 'plugin:translate/controller:translate/action:index/:id/' . $singularCamelizedControllerName);
     }
 }
示例#26
0
 function beforeRender(&$controller)
 {
     $model = Inflector::singularize($controller->name);
     if ($controller->params['action'] == 'view' && $model != "Forum" || $controller->params['action'] == 'view_topic') {
         $id = $controller->params['pass'][0];
         $controller->{$model}->commentsReaded($id);
     }
 }
示例#27
0
 static function singularize($str = '')
 {
     $str = strtolower($str);
     if (array_key_exists($str, $tmp = array_flip(self::GetPluralizeExceptions()))) {
         return $tmp[$str];
     } else {
         return parent::singularize($str);
     }
 }
 /**
  * Adds a new CakeResponse object to the response collection.
  *
  * @param integer $tid Transaction ID
  * @param CakeResponse $response Cake response object
  * @param CakeRequest $request CakeRequest object
  * @param boolean $exception TRUE if the response is an exception.
  * @return BanchaResponseCollection
  */
 public function addResponse($tid, CakeResponse $response, CakeRequest $request, $exception = false)
 {
     $response = array('type' => 'rpc', 'tid' => $tid, 'action' => Inflector::singularize($request->controller), 'method' => BanchaResponseTransformer::getMethod($request), 'result' => BanchaResponseTransformer::transform($response->body(), $request));
     if ($request['extUpload']) {
         $response['extUpload'] = true;
     }
     $this->responses[] = $response;
     return $this;
 }
示例#29
0
 /**
  * Initialization method. You may override configuration options from a controller
  *
  * @param $controller object
  * @param $config array
  */
 function initialize(&$controller, $config)
 {
     $this->controller = $controller;
     $model_prefix = Inflector::tableize($controller->modelClass);
     // lower case, studley caps -> underscores
     $prefix = Inflector::singularize($model_prefix);
     // make singular. 'GalleryImage' becomes 'gallery_image'
     $this->config = array_merge(array('default_col' => $prefix), $this->config, $config);
 }
示例#30
0
 function _setPath($type, $path)
 {
     if (version_compare(Configure::version(), '1.3') > 0) {
         App::build(array(Inflector::pluralize($type) => (array) $path));
         $this->Interactive->objectPath = dirname($path) . DS;
     } else {
         Configure::write(Inflector::singularize($type) . 'Paths', (array) $path);
         $this->Interactive->objectPath = $path;
     }
 }