• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfProjectConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadTasks

 /**
  * Loads all available tasks.
  *
  * Looks for tasks in the symfony core, the current project and all project plugins.
  *
  * @param sfProjectConfiguration $configuration The project configuration
  */
 protected function loadTasks(sfProjectConfiguration $configuration)
 {
     // Symfony core tasks
     $dirs = array(sfConfig::get('sf_symfony_lib_dir') . '/task');
     // Plugin tasks
     foreach ($configuration->getPluginPaths() as $path) {
         if (is_dir($taskPath = $path . '/lib/task')) {
             $dirs[] = $taskPath;
         }
     }
     // project tasks
     $dirs[] = sfConfig::get('sf_lib_dir') . '/task';
     $finder = sfFinder::type('file')->name('*Task.class.php');
     foreach ($finder->in($dirs) as $file) {
         $this->taskFiles[basename($file, '.class.php')] = $file;
     }
     // register local autoloader for tasks
     spl_autoload_register(array($this, 'autoloadTask'));
     // require tasks
     foreach ($this->taskFiles as $task => $file) {
         // forces autoloading of each task class
         class_exists($task, true);
     }
     // unregister local autoloader
     spl_autoload_unregister(array($this, 'autoloadTask'));
 }
开发者ID:yasirgit,项目名称:afids,代码行数:33,代码来源:sfSymfonyCommandApplication.class.php


示例2: initialize

 /**
  * @param sfProjectConfiguration $configuration
  * 
  * @return fpErrorNotifier
  */
 public static function initialize(sfProjectConfiguration $configuration)
 {
     if (empty(self::$instance)) {
         $configFiles = $configuration->getConfigPaths('config/notify.yml');
         $config = sfDefineEnvironmentConfigHandler::getConfiguration($configFiles);
         foreach ($config as $name => $value) {
             sfConfig::set("sf_notify_{$name}", $value);
         }
         self::$instance = new self($configuration->getEventDispatcher());
         self::getInstance()->handler()->initialize();
     }
     return self::$instance;
 }
开发者ID:66Ton99,项目名称:fpErrorNotifierPlugin,代码行数:18,代码来源:fpErrorNotifier.php


示例3: __construct

 /**
  * Constructor.
  * 
  * @param sfProjectConfiguration $configuration The project configuration
  * @param string                 $rootDir       The plugin root directory
  * @param string                 $name          The plugin name
  */
 public function __construct(sfProjectConfiguration $configuration, $rootDir = null, $name = null)
 {
     $this->configuration = $configuration;
     $this->dispatcher = $configuration->getEventDispatcher();
     $this->rootDir = null === $rootDir ? $this->guessRootDir() : realpath($rootDir);
     $this->name = null === $name ? $this->guessName() : $name;
     $this->setup();
     $this->configure();
     if (!$this->configuration instanceof sfApplicationConfiguration) {
         $this->initializeAutoload();
         $this->initialize();
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:20,代码来源:sfPluginConfiguration.class.php


示例4: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $applicationConfig = sfProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $context = sfContext::createInstance($applicationConfig);
     ProjectConfiguration::registerCron();
     $quiet = (bool) $options['quiet'];
     $passed = array();
     $assigned = array();
     if ($arguments['subreddit'] == '%') {
         if (!$quiet) {
             echo "Advancing EpisodeAssignments for all Subreddits...";
         }
         SubredditTable::getInstance()->advanceEpisodeAssignments();
     } else {
         $subreddit = SubredditTable::getInstance()->findOneByName($arguments['subreddit']);
         if ($subreddit) {
             if (!$quiet) {
                 echo "Advancing EpisodeAssignments for {$subreddit} Subreddit...";
             }
             $subreddit->advanceEpisodeAssignments();
         } else {
             throw new sfException('Cannot find Subreddit: ' . $arguments['subreddit']);
         }
     }
     if (!$quiet) {
         echo "\n";
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:31,代码来源:herdditAdvanceepisodesTask.class.php


示例5: execute

 public function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager(sfProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true));
     $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', $options['env'], true);
     sfContext::createInstance($configuration);
     $conn = Doctrine_Manager::connection();
     // Récupération de toutes les notices.
     $noeuds = $conn->execute("SELECT id, name FROM ei_data_set_structure;");
     $this->log('Récupération des noeuds...OK');
     // Création de la requête permettant
     $this->log('Création de la requête de mise à jour...');
     $requeteToUpdate = "UPDATE ei_data_set_structure SET slug = #{NEW_SLUG} WHERE id = #{NODE_ID};";
     $requeteGlobale = array();
     foreach ($noeuds->fetchAll() as $noeud) {
         // Remplacement SLUG.
         $tmpRequete = str_replace("#{NEW_SLUG}", $conn->quote(MyFunction::sluggifyForXML($noeud["name"])), $requeteToUpdate);
         // Remplacement ID.
         $tmpRequete = str_replace("#{NODE_ID}", $noeud["id"], $tmpRequete);
         // Ajout dans la requête globale.
         $requeteGlobale[] = $tmpRequete;
     }
     // Préparation de la requête.
     $this->log("Préparation de la requête...");
     $requete = implode(" ", $requeteGlobale);
     try {
         // Exécution de la requête.
         $this->log("Exécution de la requête...");
         $conn->execute($requete);
         // Fin.
         $this->log("Processus terminé avec succès.");
     } catch (Exception $exc) {
         $this->log($exc->getMessage());
     }
 }
开发者ID:lendji4000,项目名称:compose,代码行数:34,代码来源:SluggifyDataSetStructureNamesTask.class.php


示例6: configure

 public function configure()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Thumb'));
     $this->widgetSchema['asso_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['start_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['start_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['end_date'] = new sfWidgetDatePicker();
     $this->validatorSchema['end_date'] = new sfValidatorDatePicker(array());
     $this->widgetSchema['affiche'] = new sfWidgetFormInputFileEditable(array('file_src' => doThumb($this->getObject()->getAffiche(), 'events', array('width' => 150, 'height' => 150), 'scale'), 'is_image' => true, 'edit_mode' => !$this->isNew() && $this->getObject()->getAffiche(), 'with_delete' => true, 'delete_label' => "Supprimer cette illustration"));
     $this->validatorSchema['affiche'] = new sfValidatorFileImage(array('required' => false, 'path' => sfConfig::get('sf_upload_dir') . '/events/source', 'mime_types' => 'web_images', 'max_width' => 1000, 'max_height' => 1000));
     $this->widgetSchema['guest_asso_list']->setOption('method', 'getName');
     $this->widgetSchema->setLabel('guest_asso_list', 'Associations Partenaires');
     $this->widgetSchema['guest_asso_list']->setAttributes(array('style' => 'width:100%;', 'class' => 'select2'));
     $this->validatorSchema['affiche_delete'] = new sfValidatorBoolean();
     $this->widgetSchema->setLabel('name', 'Nom');
     $this->widgetSchema->setLabel('type_id', 'Type');
     $this->widgetSchema->setLabel('start_date', 'Début');
     $this->widgetSchema->setLabel('end_date', 'Fin');
     $this->widgetSchema->setLabel('summary', 'Résumé en une ligne');
     $this->widgetSchema->setLabel('description', 'Description');
     $this->widgetSchema->setLabel('place', 'Lieu');
     $this->widgetSchema->setLabel('is_public', 'Ouvert au public ?');
     $this->widgetSchema->setLabel('affiche', 'Illustration');
     $this->widgetSchema->setLabel('is_weekmail', 'Paraître dans le Weekmail ?');
     $this->widgetSchema['is_weekmail']->setAttribute('style', 'width: 15px;');
     $this->useFields(array('asso_id', 'name', 'type_id', 'start_date', 'end_date', 'summary', 'description', 'place', 'is_public', 'affiche', 'is_weekmail', 'guest_asso_list'));
 }
开发者ID:TheoJD,项目名称:portail,代码行数:27,代码来源:EventForm.class.php


示例7: get

 public static function get()
 {
     sfProjectConfiguration::getActive()->loadHelpers(array("Url"));
     sfProjectConfiguration::getActive()->loadHelpers(array("Tag"));
     //TODO: fix this
     return "<div id='skulebar'>\n\t\t<a id='skule' href='/'>Skule Courses</a>\n\t\t<form method='get' action='" . url_for("search/fuzzySearch") . "' name='frmSearchBar'>\n\t\t<div style='margin: 0pt; padding: 0pt; display: inline;'>\n\t\t</div>\n\t\t<input type='text' title='Quick search in Skule Courses' size='30' name='query' id='search_search' autocomplete='off'/>\n\t\t</form>\n\t\t<div id='user'>\n\t\t<a href='/login'>Login</a>\n\t\t</div>\n\t\t</div>";
 }
开发者ID:jasonkouoft,项目名称:SkuleCourses,代码行数:7,代码来源:SearchBar.class.php


示例8: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', $options['env'], true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $options_task_server_backup = array('location' => $arguments['location'], 'filepath' => $arguments['filepath']);
     if ($arguments['snapshot']) {
         $options_task_server_backup['snapshot'] = $arguments['snapshot'];
     }
     if ($arguments['newsnapshot']) {
         $options_task_server_backup['newsnapshot'] = $arguments['newsnapshot'];
     }
     if ($arguments['delete']) {
         $options_task_server_backup['deletesnapshot'] = $arguments['delete'];
     }
     if ($arguments['location']) {
         if ($arguments['do_not_generate_tar'] && $arguments['do_not_generate_tar'] != 'false') {
             $options_task_server_backup['do_not_generate_tar'] = true;
         }
     }
     $task_server_backup = new serverBackupTask($this->dispatcher, new sfFormatter());
     return $task_server_backup->run(array('serverid' => $arguments['serverid']), $options_task_server_backup);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:26,代码来源:serverDownloadbackupsnapshotTask.class.php


示例9: execute

    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
        $context = sfContext::createInstance($this->configuration);
        sfProjectConfiguration::getActive()->loadHelpers('Partial', 'I18N', 'Url');
        $serverUrl = $options['setenvironment'] == '' ? $serverUrl = $options['host'] : $serverUrl = $options['host'] . '/' . $options['setenvironment'];
        $workflows = WorkflowVersionTable::instance()->getWorkflowsToStart(time())->toArray();
        foreach($workflows as $workflow) {
            $sender = WorkflowTemplateTable::instance()->getWorkflowTemplateById($workflow['workflowtemplate_id'])->toArray();
            $userSettings = new UserMailSettings($sender[0]['sender_id']);
            $sendMail = new SendStartWorkflowEmail($userSettings, $context, $workflow, $sender, $serverUrl);
            $workflowTemplate = WorkflowTemplateTable::instance()->getWorkflowTemplateByVersionId($workflow['id']);
            WorkflowVersionTable::instance()->startWorkflowInFuture($workflow['id']);
            $sendToAllSlotsAtOnce = $workflowTemplate[0]->getMailinglistVersion()->toArray();
            if($sendToAllSlotsAtOnce[0]['sendtoallslotsatonce'] == 1) {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addAllSlots();
            }
            else {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addSingleSlot();
            }

        }
  }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:29,代码来源:startWorkflowTask.class.php


示例10: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $applicationConfig = sfProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
     $context = sfContext::createInstance($applicationConfig);
     // Go to the Subreddit and obtain the past few keys.
     $reddit_location = $options['subreddit'];
     $reddit = new RedditObject($reddit_location);
     $quiet = (bool) $options['quiet'];
     if (!$quiet) {
         echo "Obtaining the most recent comments from {$reddit_location}...";
     }
     $reddit->appendData();
     $found_keys = count($reddit->getComments());
     if (!$quiet) {
         echo "\nFound {$found_keys} keys.  Updating keys in the database...";
     }
     ValidationTable::getInstance()->storeNewKeys($reddit->getComments());
     // Now that new keys are stored in the database we need to update all applicable users
     $users = sfGuardUserTable::getInstance()->getUsersToBeValidated();
     $updated = sfGuardUserTable::getInstance()->validateUsers($users);
     if (!$quiet) {
         echo "\nSending emails...";
     }
     foreach ($users as $user_id) {
         $sf_user = $context->getUser();
         $sf_user->setApiUserId($user_id);
         $sf_user->sendMail('RedditValidationSucceeded');
     }
     if (!$quiet) {
         echo "\n{$updated} users validated and email sent.\n";
     }
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:35,代码来源:herdditValidateusersTask.class.php


示例11: initialize

 /**
  * Initializes the current sfGenerator instance.
  *
  * @param sfGeneratorManager $generatorManager A sfGeneratorManager instance
  */
 public function initialize(sfGeneratorManager $generatorManager)
 {
     parent::initialize($generatorManager);
     $configuration = sfProjectConfiguration::getActive();
     $this->databaseManager = new sfDatabaseManager($configuration);
     $this->setGeneratorClass('sfDoctrineModule');
 }
开发者ID:blt04,项目名称:sfDoctrine2Plugin,代码行数:12,代码来源:sfDoctrineGenerator.class.php


示例12: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->user = $this->getUser();
     //$user_id = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id'];
     $user = $this->getUser()->getRaykuUser();
     if ($user) {
         $user_id = $user->getId();
     }
     if (!$user_id) {
         $this->forward('/dashboard');
     }
     $this->setVar('user_id', $user_id);
     //Form submitted
     if (sfWebRequest::POST == $this->getRequest()->getMethod()) {
         $emails = $this->getRequestParameter('emails');
         $ref = $this->getRequestParameter('ref');
         if (!$emails) {
             echo "Invalid emails";
             return false;
         }
         $mail = Mailman::createMailer();
         $mail->setContentType('text/html');
         $mail->addAddress($emails);
         $mail->setSubject('Invitation');
         sfProjectConfiguration::getActive()->loadHelpers(array('Asset', 'Url', 'Partial'));
         $mail->setBody(get_partial('invitationEmailHtml', array('ref' => $ref, 'user' => $user)));
         $mail->send();
         //$this->forward('referrals', 'invitesSent');
     }
 }
开发者ID:rayku,项目名称:rayku,代码行数:35,代码来源:actions.class.php


示例13: executeNovaPagina

 public function executeNovaPagina(sfWebRequest $request)
 {
     if ($request->isXmlHttpRequest() || true) {
         //apenas por ajax
         sfConfig::set('sf_web_debug', false);
         sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Date'));
         $cmspage = new Cmspage();
         $content = new Content();
         $content->setId(null);
         $cmspage->setContent($content);
         $cmspage->setId(null);
         $cmsGroupcontent = $this->getUser()->getAttribute('contentGroup');
         $this->forward404Unless($cmsGroupcontent);
         $cmspage->setCmsgroupcontent($cmsGroupcontent);
         $this->formContent = new PageContentForm($cmspage);
         if ($request->isMethod('post')) {
             //return $this->renderPartial('cms/debug',array('values'=>$request->getParameter('pagina')));
             $this->formContent->bind($request->getParameter('pagina'));
             if ($this->formContent->isValid()) {
                 $this->logMessage('O formContent foi válido. cms/actions: ' . __FILE__ . __LINE__);
                 try {
                     $this->formContent->save();
                     return $this->renderPartial("cms/viewPage", array('page' => $this->formContent->getCmspageobj(), 'isNew' => true, 'values' => $this->formContent->getValues()));
                 } catch (Exception $e) {
                     //TODO: We should to handle the error and render it.
                     throw $e;
                 }
                 //return $this->renderPartial("cms/viewPage",array('page'));
             }
         }
         //parent::executeNew($request);
         return $this->renderPartial('cms/content_form', array('formContent' => $this->formContent));
     }
 }
开发者ID:rafaelccomp,项目名称:compsite,代码行数:34,代码来源:actions.class.php


示例14: customize

 public function customize($params)
 {
     $params['moduleName'] = 'search';
     sfToolkit::clearDirectory(sfConfig::get('sf_app_cache_dir'));
     $generatorManager = new sfGeneratorManager(sfProjectConfiguration::getActive());
     sfGeneratorConfigHandler::getContent($generatorManager, 'xfGeneratorInterface', $params);
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:7,代码来源:xfGeneratorInterfaceTest.php


示例15: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', 'dev', true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $con = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $this->log('[INFO] Flushing old data...' . "\n");
     $eventlog_flush = EtvaSettingPeer::retrieveByPK('eventlog_flush');
     $flush_range = $eventlog_flush->getValue();
     $con->beginTransaction();
     $affected = 0;
     try {
         $offset_date = date("c", time() - $flush_range * 24 * 60 * 60);
         /*
          * get event records that have creation date outdated
          */
         $c = new Criteria();
         $c->add(EtvaEventPeer::CREATED_AT, $offset_date, Criteria::LESS_THAN);
         $affected = EtvaEventPeer::doDelete($c, $con);
         $con->commit();
         $message = sprintf('Events Log - %d Record(s) deleted after %d day offset', $affected, $flush_range);
         $context->getEventDispatcher()->notify(new sfEvent(sfConfig::get('config_acronym'), 'event.log', array('message' => $message)));
         $this->log('[INFO] ' . $message);
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     $logger = new sfFileLogger($context->getEventDispatcher(), array('file' => sfConfig::get("sf_log_dir") . '/cron_status.log'));
     // log the message!
     $logger->log("[INFO] The events flush task ran!", 6);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:33,代码来源:eventFlushlogTask.class.php


示例16: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', $options['env'], true));
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $nid = $arguments['id'];
     $this->log("[INFO] node check id={$nid}");
     if (!($etva_node = EtvaNodePeer::retrieveByPK($nid))) {
         $msg_i18n = $context->getI18N()->__(EtvaNodePeer::_ERR_NOTFOUND_ID_, array('%id%' => $nid));
         $error = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => $msg_i18n, 'info' => $msg_i18n);
         $this->log("[ERROR] " . $error['error']);
         return $error;
     } else {
         $etva_node_va = new EtvaNode_VA($etva_node);
         $response = $etva_node_va->checkState();
         if (!$response['success']) {
             $this->log("[ERROR] " . $response['error']);
         } else {
             $this->log("[INFO] " . $response['response']);
         }
         return $response;
     }
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:25,代码来源:nodeCheckTask.class.php


示例17: reloadClasses

 public function reloadClasses($force = false)
 {
       if (self::$freshCache && !$force)
   {
     return false;
   }
   $configuration = sfProjectConfiguration::getActive();
   if (!$configuration || !$configuration instanceof sfApplicationConfiguration)
   {
     return false;
   }
   self::$freshCache = true;
   if (file_exists($configuration->getConfigCache()->getCacheName('config/autoload.yml')))
   {
     self::$freshCache = false;
     if ($force)
     {
       unlink($configuration->getConfigCache()->getCacheName('config/autoload.yml'));
     }
   }
   $file = $configuration->getConfigCache()->checkConfig('config/autoload.yml');
   $this->classes = include($file);
   foreach ($this->overriden as $class => $path)
   {
     $this->classes[$class] = $path;
   }
   return true;
 }
开发者ID:rieteke,项目名称:guizmed,代码行数:28,代码来源:config_core_compile.yml.php


示例18: __construct

 public function __construct($containerObject, $attributes = array())
 {
     $this->afExtjs = afExtjs::getInstance();
     if (isset($attributes['label'])) {
         $this->attributes['text'] = $attributes['label'];
         unset($attributes['label']);
     }
     if (isset($attributes['url'])) {
         $param_name = isset($attributes['param']) ? $attributes['param'] : "param";
         $url = $attributes['url'] . "&" . $param_name . "=";
         $param = $containerObject->privateName . '.stack["text"]';
         $cellDiv = $containerObject->privateName . '.stack["cellDiv"]';
         if (isset($attributes['ajax'])) {
             sfProjectConfiguration::getActive()->loadHelpers(array('afExtjsContextMenu'));
             $source = ajax_source($url . '"+' . $param);
         } else {
             $source = 'window.location.href="' . $url . '"+' . $param;
         }
         $this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $source));
         unset($attributes['url']);
         unset($attributes['ajax']);
         unset($attributes['param']);
     }
     if (isset($attributes['source'])) {
         $this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $attributes["source"]));
     }
     parent::__construct($containerObject, $attributes);
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:28,代码来源:afExtjsMenuItem.php


示例19: setup

 public function setup()
 {
     parent::setup();
     sfProjectConfiguration::getActive()->loadHelpers(array('I18N'));
     $this->required = __('Required', array(), 'vjComment');
     $this->invalid_mail = __('Invalid Mail', array(), 'vjComment');
     $this->invalid_url = __('Invalid Url', array(), 'vjComment');
     $this->required_msg = __('Required message', array(), 'vjComment');
     $this->widgetSchema['record_model'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['record_id'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['reply_author'] = new sfWidgetFormInputHidden();
     $this->widgetSchema['user_name'] = new sfWidgetFormInputHidden();
     $this->validatorSchema['reply'] = new sfValidatorPass();
     $this->validatorSchema['reply_author'] = new sfValidatorPass();
     $this->validatorSchema['user_name'] = new sfValidatorPass();
     $this->widgetSchema->setLabel('author_name', __('Name', array(), 'vjComment'));
     $this->widgetSchema->setLabel('author_email', 'Email');
     $this->widgetSchema->setLabel('author_website', __('Website', array(), 'vjComment'));
     $this->widgetSchema->setLabel('body', 'Message');
     $this->widgetSchema->setHelp('author_website', __('Must start with http:// or https://', array(), 'vjComment'));
     $this->validatorSchema['author_email'] = new sfValidatorEmail();
     $this->validatorSchema['author_website'] = new sfValidatorUrl();
     $this->validatorSchema['author_name']->setMessage('required', $this->required);
     $this->validatorSchema['author_email']->setMessage('required', $this->required)->setMessage('invalid', $this->invalid_mail);
     $this->validatorSchema['author_website']->setOption('required', false)->setMessage('invalid', $this->invalid_url);
     $this->validatorSchema['body']->setOption('required', true)->setMessage('required', $this->required_msg);
 }
开发者ID:eldister,项目名称:dosye,代码行数:28,代码来源:PluginCommentCommonForm.class.php


示例20: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // need a scriptname otherwise it uses the symfony file
     if ($arguments['env'] != 'prod') {
         $_SERVER['SCRIPT_NAME'] = '/' . $arguments['application'] . '_' . $arguments['env'] . '.php';
     } else {
         $_SERVER['SCRIPT_NAME'] = '/index.php';
     }
     sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration($arguments['application'], $arguments['env'], true));
     $searchIndex = new zsSearchIndex($arguments['index']);
     //optimize to increase speed
     $searchIndex->optimize();
     //loop thru all models specified in this index and update all entries
     foreach ($searchIndex->getModels() as $model => $config) {
         $this->logSection('update', 'model: ' . $model);
         foreach (Doctrine::getTable($model)->findAll() as $object) {
             $searchIndex->updateIndex($object);
             echo '.';
         }
         echo "\n";
     }
     //re-optimize index
     $searchIndex->optimize();
 }
开发者ID:kbond,项目名称:zsUtilPlugin,代码行数:27,代码来源:zsSearchUpdateIndexTask.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfPropel类代码示例发布时间:2022-05-23
下一篇:
PHP sfOutputEscaper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap