当前位置: 首页>>代码示例>>PHP>>正文


PHP sfInflector::camelize方法代码示例

本文整理汇总了PHP中sfInflector::camelize方法的典型用法代码示例。如果您正苦于以下问题:PHP sfInflector::camelize方法的具体用法?PHP sfInflector::camelize怎么用?PHP sfInflector::camelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfInflector的用法示例。


在下文中一共展示了sfInflector::camelize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Executes this filter.
  *
  * @param sfFilterChain $filterChain A sfFilterChain instance
  */
 public function execute($filterChain)
 {
     // disable stateful security checking on signin and secure actions
     if (sfConfig::get('sf_login_module') == $this->context->getModuleName() && sfConfig::get('sf_login_action') == $this->context->getActionName() || sfConfig::get('sf_secure_module') == $this->context->getModuleName() && sfConfig::get('sf_secure_action') == $this->context->getActionName()) {
         $filterChain->execute();
         return;
     }
     $sf_user = $this->context->getUser();
     // retrieve the current action
     $action = $this->context->getController()->getActionStack()->getLastEntry()->getActionInstance();
     // get the current module and action names
     $module_name = sfInflector::camelize($action->getModuleName());
     $action_name = sfInflector::camelize($action->getActionName());
     // get the object for the current route
     $object = $this->getObjectForRoute($action->getRoute());
     // i.e.: canIndexDefault
     $method = "can{$action_name}{$module_name}";
     // if the method exist
     if (method_exists($sf_user, $method)) {
         // execute it
         if (!$sf_user->{$method}($object)) {
             $this->forwardToSecureAction();
         }
     } else {
         // get the default policy
         $default_policy = $this->getParameter('default_policy', 'allow');
         // if the default policy is not 'allow'
         if ($default_policy != 'allow') {
             $this->forwardToSecureAction();
         }
     }
     $filterChain->execute();
     return;
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:39,代码来源:dcStatefulSecurityFilter.class.php

示例2: getObjectsForParameters

 protected function getObjectsForParameters($parameters)
 {
     $this->options['model'] = Doctrine::getTable($this->options['model']);
     if (!isset($this->options['method'])) {
         $variables = $this->getRealVariables();
         switch (count($variables)) {
             case 0:
                 $this->options['method'] = 'findAll';
                 break;
             case 1:
                 $this->options['method'] = 'findOneBy' . sfInflector::camelize($variables[0]);
                 $parameters = $parameters[$variables[0]];
                 break;
             default:
                 $this->options['method'] = 'findByDQL';
                 $wheres = array();
                 foreach ($variables as $variable) {
                     $variable = $this->options['model']->getFieldName($variable);
                     $wheres[] = $variable . " = '" . $parameters[$variable] . "'";
                 }
                 $parameters = implode(' AND ', $wheres);
         }
     }
     return parent::getObjectsForParameters($parameters);
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:25,代码来源:sfDoctrineRoute.class.php

示例3: populateWithFacebook

 public function populateWithFacebook(m14tFacebook $fb, $force = true)
 {
     $sfGuardUser = $this->getInvoker();
     foreach ($this->_options['fields'] as $fb_key => $sfg_key) {
         $func = 'get' . sfInflector::camelize($fb_key);
         switch ($fb_key) {
             case 'location':
             case 'hometown':
             case 'languages':
             case 'education':
                 $sfGuardUser->{$sfg_key}($fb->{$func}(), $force);
                 break;
             case 'birthday':
                 if ($force || "" == $sfGuardUser[$sfg_key]) {
                     $sfGuardUser[$sfg_key] = date('Y-m-d', strtotime($fb->{$func}()));
                 }
                 break;
             default:
                 if ($force || "" == $sfGuardUser[$sfg_key]) {
                     $sfGuardUser[$sfg_key] = $fb->{$func}();
                 }
                 break;
         }
     }
 }
开发者ID:ner0tic,项目名称:m14tFacebookConnectPlugin,代码行数:25,代码来源:Facebookified.php

示例4: retrieveOrCreateByObject

 public static function retrieveOrCreateByObject(BaseObject $object)
 {
     if ($object->isNew() === true || $object->isModified() === true || $object->isDeleted() === true) {
         throw new Exception('You can only approve an object which has already been saved');
     }
     $columnName = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_column', 'is_approved');
     $approvedValue = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_approved_value', true);
     $disabledApplications = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_disabled_applications');
     // Test if we should crated an approval - is the column value different to out required value?
     // If our object is already approved then we can delete other
     $columnGetter = 'get' . sfInflector::camelize($columnName);
     if ($approvedValue != $object->{$columnGetter}()) {
         $c = new Criteria();
         $c->add(sfApprovalPeer::APPROVABLE_ID, $object->getPrimaryKey());
         $c->add(sfApprovalPeer::APPROVABLE_MODEL, get_class($object));
         $approval = sfApprovalPeer::doSelectOne($c);
         if (!$approval) {
             $approval = new sfApproval();
             $approval->setApprovableModel(get_class($object));
             $approval->setApprovableId($object->getPrimaryKey());
             $approval->setUuid(sfPropelApprovableToolkit::generateUuid());
             $approval->save();
         }
         return $approval;
     } else {
         sfApprovalPeer::deleteByObject($object);
         return null;
     }
     return $approval;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:30,代码来源:PluginsfApprovalPeer.php

示例5: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     /**
      * include path to propel generator
      */
     sfToolkit::addIncludePath(array(sfConfig::get('sf_propel_path') . '/generator/lib'));
     /**
      * first check the db connectivity for all connections
      */
     $this->logBlock('Checking Db Connectivity', "QUESTION");
     if (!$this->createTask('afs:db-connectivity')->run()) {
         return;
     }
     $this->logBlock('Creating specific AppFlower folders', "QUESTION");
     $this->createFolders();
     $this->logBlock('Setting Symfony project permissions', "QUESTION");
     $this->createTask('project:permissions')->run();
     $type_method = 'execute' . sfInflector::camelize($options['type']);
     if (!method_exists($this, $type_method)) {
         throw new sfCommandException("Type method '{$type_method}' not defined.");
     }
     call_user_func(array($this, $type_method), $arguments, $options);
     $this->logBlock('Creating models from current schema', "QUESTION");
     $this->createTask('propel:build-model')->run();
     $this->logBlock('Creating forms from current schema', "QUESTION");
     $this->createTask('propel:build-forms')->run();
     $this->logBlock('Setting AppFlower project permissions', "QUESTION");
     $this->createTask('afs:fix-perms')->run();
     $this->logBlock('Creating AppFlower validator cache', "QUESTION");
     $this->createTask('appflower:validator-cache')->run(array('frontend', 'cache', 'yes'));
     $this->logBlock('Clearing Symfony cache', "QUESTION");
     $this->createTask('cc')->run();
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:36,代码来源:afsInitTask.class.php

示例6: __construct

 public function __construct($feed_array = array(), $extensions = array())
 {
     $version = '1.0';
     parent::__construct();
     /// we call initialize() later so we don't need to pass feed_array in yet
     $encoding = 'UTF-8';
     // sensible default
     $dom = $this->dom = new DOMDocument($version, $encoding);
     $this->setEncoding($encoding);
     // needed to avoid trying to set encoding to ''
     $this->context = sfContext::getInstance();
     $this->plugin_path = realpath(dirname(__FILE__) . '/../');
     $prefix = 'sfDomFeedExtension';
     $this->extensions = array();
     foreach ($extensions as $extension) {
         $class_name = $prefix . sfInflector::camelize($extension);
         $extension = new $class_name();
         if (!$extension instanceof sfDomFeedExtension) {
             throw new sfException("{$class_name} is not a sfDomFeedExtension");
         }
         // unfortunately ^ class_exists() is useless here; it will error instead of exception.
         $this->extensions[] = $extension;
     }
     if ($feed_array) {
         $this->initialize($feed_array);
     }
     if (!$dom->load($this->genTemplatePath(), LIBXML_NOERROR)) {
         throw new sfDomFeedException("DOMDocument::load failed");
     }
 }
开发者ID:WIZARDISHUNGRY,项目名称:sfDomFeedPlugin,代码行数:30,代码来源:sfDomFeed.class.php

示例7: getLinkToAction

 public function getLinkToAction($actionName, $params, $pk_link = false)
 {
     $options = isset($params['params']) && !is_array($params['params']) ? sfToolkit::stringToArray($params['params']) : array();
     // default values
     if ($actionName[0] == '_') {
         $actionName = substr($actionName, 1);
         $name = $actionName;
         //$icon       = sfConfig::get('sf_admin_web_dir').'/images/'.$actionName.'_icon.png';
         $action = $actionName;
         if ($actionName == 'delete') {
             $options['post'] = true;
             if (!isset($options['confirm'])) {
                 $options['confirm'] = 'Are you sure?';
             }
         }
     } else {
         $name = isset($params['name']) ? $params['name'] : $actionName;
         //$icon   = isset($params['icon']) ? sfToolkit::replaceConstants($params['icon']) : sfConfig::get('sf_admin_web_dir').'/images/default_icon.png';
         $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);
     }
     $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';
     $phpOptions = var_export($options, true);
     // little hack
     $phpOptions = preg_replace("/'confirm' => '(.+?)(?<!\\\\)'/", '\'confirm\' => __(\'$1\')', $phpOptions);
     return '<li class="sf_admin_action_' . sfInflector::underscore($name) . '">[?php echo link_to(__(\'' . $params['label'] . '\'), \'' . $this->getModuleName() . '/' . $action . $url_params . ($options ? ', ' . $phpOptions : '') . ') ?]</li>' . "\n";
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:26,代码来源:sfPropelRevisitedGenerator.class.php

示例8: create

 public static function create($class, $title = null, $multisheet = false)
 {
     $managerClass = sprintf('sfExportManager%s', sfInflector::camelize($class));
     if (class_exists($managerClass)) {
         return new $managerClass($class, $title, $multisheet);
     }
     return new self($class, $title, $multisheet);
 }
开发者ID:bshaffer,项目名称:Donate-Nashville,代码行数:8,代码来源:sfExportManager.class.php

示例9: __get

 public function __get($name)
 {
     if (in_array($name, array('base_amount', 'discount_amount', 'net_amount', 'tax_amount', 'gross_amount'))) {
         $m = sfInflector::camelize("get_{$name}");
         return $this->{$m}();
     }
     return parent::__get($name);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:8,代码来源:Item.class.php

示例10: initialize

 public function initialize($context, $moduleName, $actionName, $viewName)
 {
     $this->nameSuffix = sfSmartphoneViewToolKit::getViewNameSuffixFromUA($this, $context, $moduleName, $actionName, $viewName, false);
     if ($this->nameSuffix) {
         $this->enableNameSuffix = sfSmartphoneViewToolKit::getViewNameSuffixFromUA($this, $context, $moduleName, $actionName, $viewName);
     }
     parent::initialize($context, $moduleName, $actionName, $viewName . sfInflector::camelize($this->enableNameSuffix));
 }
开发者ID:kawahara,项目名称:sfSmartphoneViewPlugin,代码行数:8,代码来源:sfSmartphoneView.class.php

示例11: getColumnGetter

 /**
  * Returns the getter either non-developped: 'getFoo' or developped: '$class->getFoo()'.
  *
  * @param string  $column     The column name
  * @param boolean $developed  true if you want developped method names, false otherwise
  * @param string  $prefix     The prefix value
  *
  * @return string PHP code
  */
 public function getColumnGetter($column, $developed = false, $prefix = '')
 {
     $getter = 'get' . sfInflector::camelize($column);
     if ($developed) {
         $getter = sprintf('$%s%s->%s()', $prefix, $this->getSingularName(), $getter);
     }
     return $getter;
 }
开发者ID:yankeemedia,项目名称:symfony1,代码行数:17,代码来源:sfDoctrineGenerator.class.php

示例12: executeFeed

 public function executeFeed()
 {
     /** @var sfWebRequest **/
     $request = $this->getContext()->getRequest();
     $IdType = $this->getRequestParameter('IdType', null);
     $id = $this->getRequestParameter('id', null);
     //Build the title
     $title = "Metadata Registry Change History";
     $filter = false;
     switch ($IdType) {
         //ElementSet :: (Schema)Element  :: (Schema)ElementProperty
         //Schema     :: SchemaProperty :: SchemaPropertyElement
         case "schema_property_element_id":
             /** @var SchemaPropertyElement **/
             $element = DbFinder::from('SchemaPropertyElement')->findPk($id);
             if ($element) {
                 /** @var SchemaProperty **/
                 $property = $element->getSchemaPropertyRelatedBySchemaPropertyId();
                 $title .= " for Property: '" . $element->getProfileProperty()->getLabel();
                 if ($property) {
                     $title .= "' of Element: '" . $property->getLabel() . "' in Element Set: '" . $property->getSchema()->getName() . "'";
                 }
             }
             $filter = true;
             break;
         case "schema_property_id":
             /** @var SchemaProperty **/
             $property = DbFinder::from('SchemaProperty')->findPk($id);
             if ($property) {
                 $title .= " for Element: '" . $property->getLabel() . "' in Element Set: '" . $property->getSchema()->getName() . "'";
             }
             $filter = true;
             break;
         case "schema_id":
             /** @var Schema **/
             $schema = DbFinder::from('Schema')->findPk($id);
             if ($schema) {
                 $title .= " for Element Set: '" . $schema->getName() . "'";
             }
             $filter = true;
             break;
         default:
             //the whole shebang
             $title .= " for all Element Sets";
             break;
     }
     $column = sfInflector::camelize($IdType);
     //default limit to 100 if not set in config
     $limit = $request->getParameter('nb', sfConfig::get('app_frontend_feed_count', 100));
     $finder = DbFinder::from('SchemaPropertyElementHistory')->orderBy('SchemaPropertyElementHistory.CreatedAt', 'desc')->join('SchemaPropertyElementHistory.SchemaPropertyElementId', 'SchemaPropertyElement.Id', 'left join')->join('SchemaProperty', 'left join')->join('Schema', 'left join')->join('Status', 'left join')->join('User', 'left join')->join('ProfileProperty', 'left join')->with('Schema', 'ProfileProperty', 'User', 'Status', 'SchemaProperty');
     if ($filter) {
         $finder = $finder->where('SchemaPropertyElementHistory.' . $column, $id);
     }
     $finder = $finder->find($limit);
     $this->setTemplate('feed');
     $this->feed = sfFeedPeer::createFromObjects($finder, array('format' => $request->getParameter('format', 'atom1'), 'link' => $request->getUriPrefix() . $request->getPathInfo(), 'feedUrl' => $request->getUriPrefix() . $request->getPathInfo(), 'title' => htmlentities($title), 'methods' => array('authorEmail' => '', 'link' => 'getFeedUniqueId')));
     return;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:58,代码来源:actions.class.php

示例13: filterGet

 public function filterGet(Doctrine_Record $record, $name)
 {
     $method = 'get' . sfInflector::camelize($name);
     $event = sfProjectConfiguration::getActive()->getEventDispatcher()->notifyUntil(new sfEvent($record, 'sympal.' . $this->_eventName . '.method_not_found', array('method' => $method)));
     if ($event->isProcessed()) {
         return $event->getReturnValue();
     }
     throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record)));
 }
开发者ID:slemoigne,项目名称:sympal,代码行数:9,代码来源:sfSympalRecordEventFilter.class.php

示例14: updateIndex

 /**
  * Updates the index for an object
  *
  * @param Doctrine_Record $object
  */
 public function updateIndex(Doctrine_Record $object, $delete = false)
 {
     /* error checking */
     if (!array_key_exists('models', $this->config) || empty($this->config['models'])) {
         throw new Exception(sprintf('No models set in search.yml', $name));
     }
     if (!array_key_exists($model = get_class($object), $this->config['models'])) {
         throw new Exception(sprintf('Model "%s" not defined in "%s" index in your search.yml', $model, $this->name));
     }
     $id = $this->generateId($object->getId(), $model);
     $config = $this->config['models'][$model];
     //delete existing entries
     foreach ($this->search('_id:"' . $id . '"') as $hit) {
         $this->getIndex()->delete($hit->id);
     }
     if ($delete) {
         return;
     }
     //only add to search if canSearch method on model returns true (search if no method exists)
     if (method_exists($object, 'canSearch')) {
         if (!call_user_func(array($object, 'canSearch'))) {
             return;
         }
     }
     $doc = new Zend_Search_Lucene_Document();
     // store a key for deleting in future
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_id', $id));
     // store job primary key and model name to identify it in the search results
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_pk', $object->getId()));
     $doc->addField(Zend_Search_Lucene_Field::Keyword('_model', $model));
     // store title - used for search result title
     if (!array_key_exists('title', $config)) {
         throw new Exception(sprintf('A title must be set for model "%s" in search.yml', $model));
     }
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_title', call_user_func(array($object, 'get' . sfInflector::camelize($config['title'])))));
     // store description - used for search result description
     if (!array_key_exists('description', $config)) {
         throw new Exception(sprintf('A description must be set for model "%s" in search.yml', $model));
     }
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_description', call_user_func(array($object, 'get' . sfInflector::camelize($config['description'])))));
     // store url - @todo add more routing options
     if (!array_key_exists('route', $config)) {
         throw new Exception(sprintf('A route must be set for model "%s" in search.yml', $model));
     }
     sfContext::getInstance()->getConfiguration()->loadHelpers('Url');
     $url = url_for($config['route'], $object);
     $doc->addField(Zend_Search_Lucene_Field::unIndexed('_url', $url));
     //store fields
     if (array_key_exists('fields', $config)) {
         foreach ($config['fields'] as $field => $config) {
             $doc->addField(Zend_Search_Lucene_Field::UnStored($field, call_user_func(array($object, 'get' . sfInflector::camelize($field))), 'utf-8'));
         }
     }
     //save index
     $this->getIndex()->addDocument($doc);
     $this->getIndex()->commit();
 }
开发者ID:kbond,项目名称:zsUtilPlugin,代码行数:62,代码来源:zsSearchIndex.class.php

示例15: getLinkToAction

 public function getLinkToAction($actionName, $params, $pk_link = false)
 {
     $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);
     $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';
     if (isset($params['extend_url'])) {
         $url_params .= '.(has_slot(\'sf_admin.extend_url\') ? \'' . $params['extend_url'] . '\'.get_slot(\'sf_admin.extend_url\') : \'\')';
     }
     return '[?php echo link_to(__(\'' . $params['label'] . '\', array(), \'' . $this->getI18nCatalogue() . '\'), \'' . (isset($params['module']) ? $params['module'] : $this->getModuleName()) . '/' . $action . $url_params . ', ' . $this->asPhp($params['params']) . ') ?]';
 }
开发者ID:nova76,项目名称:nova-plugins,代码行数:9,代码来源:jRollerDoctrineGenerator.class.php


注:本文中的sfInflector::camelize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。