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


PHP sfToolkit::stripComments方法代码示例

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


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

示例1: execute

 /**
  * Executes this configuration handler.
  *
  * @param array $configFiles An array of absolute filesystem path to a configuration file
  *
  * @return string Data to be written to a cache file
  *
  * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
  * @throws sfParseException If a requested configuration file is improperly formatted
  */
 public function execute($configFiles)
 {
     // parse the yaml
     $config = self::getConfiguration($configFiles);
     // init our data
     $data = '';
     // let's do our fancy work
     foreach ($config as $file) {
         if (!is_readable($file)) {
             // file doesn't exist
             throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
         }
         $contents = file_get_contents($file);
         // strip comments (not in debug mode)
         if (!sfConfig::get('sf_debug')) {
             $contents = sfToolkit::stripComments($contents);
         }
         // strip php tags
         $contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php\\s*)?/m' => '', '/^\\s*\\?>/m' => ''));
         // replace windows and mac format with unix format
         $contents = str_replace("\r", "\n", $contents);
         // replace multiple new lines with a single newline
         $contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents);
         // append file data
         $data .= "\n" . $contents;
     }
     // compile data
     return sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n" . "%s\n", date('Y/m/d H:i:s'), $data);
 }
开发者ID:sabaki-dev,项目名称:symfony1,代码行数:39,代码来源:sfCompileConfigHandler.class.php

示例2: execute

 /**
  * Executes this configuration handler.
  *
  * @param array $configFiles An array of absolute filesystem path to a configuration file
  *
  * @return string Data to be written to a cache file
  *
  * @throws sfConfigurationException If a requested configuration file does not exist or is not readable
  * @throws sfParseException If a requested configuration file is improperly formatted
  */
 public function execute($configFiles)
 {
     // parse the yaml
     $config = self::getConfiguration($configFiles);
     // init our data
     $data = '';
     // let's do our fancy work
     foreach ($config as $file) {
         if (!is_readable($file)) {
             // file doesn't exist
             throw new sfParseException(sprintf('Configuration file "%s" specifies nonexistent or unreadable file "%s".', $configFiles[0], $file));
         }
         $contents = file_get_contents($file);
         // strip comments (not in debug mode)
         if (!sfConfig::get('sf_debug')) {
             $contents = sfToolkit::stripComments($contents);
         }
         // insert configuration files
         /*      $contents = preg_replace_callback(array('#(require|include)(_once)?\((sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->checkConfig\(\'config/([^\']+)\'\)\);#m',
                                                   '#()()(sfContext::getInstance\(\)\->getConfigCache\(\)|\$configCache)->import\(\'config/([^\']+)\'(, false)?\);#m'),
                                                 array($this, 'insertConfigFileCallback'), $contents);
         */
         // strip php tags
         $contents = sfToolkit::pregtr($contents, array('/^\\s*<\\?(php)?/m' => '', '/^\\s*\\?>/m' => ''));
         // replace windows and mac format with unix format
         $contents = str_replace("\r", "\n", $contents);
         // replace multiple new lines with a single newline
         $contents = preg_replace(array('/\\s+$/Sm', '/\\n+/S'), "\n", $contents);
         // append file data
         $data .= "\n" . $contents;
     }
     // compile data
     $retval = sprintf("<?php\n" . "// auto-generated by sfCompileConfigHandler\n" . "// date: %s\n%s\n", date('Y/m/d H:i:s'), $data);
     return $retval;
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:45,代码来源:sfCompileConfigHandler.class.php

示例3: build

 public function build()
 {
     if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
         return sfToolkit::stripComments(parent::build());
     }
     return parent::build();
 }
开发者ID:taryono,项目名称:school,代码行数:7,代码来源:SfPeerBuilder.php

示例4: addClassBody

  protected function addClassBody(&$script)
  {
    parent::addClassBody($script);

    // remove comments and fix coding standards
    $script = str_replace(array("\t", "{\n  \n"), array('  ', "{\n"), sfToolkit::stripComments($script));
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:7,代码来源:SfMultiExtendObjectBuilder.php

示例5: build

 public function build()
 {
     $objectCode = parent::build();
     if (!$this->getBuildProperty('builderAddComments')) {
         $objectCode = sfToolkit::stripComments($objectCode);
     }
     return $objectCode;
 }
开发者ID:souravmondal-cn,项目名称:symfonyweather,代码行数:8,代码来源:SfObjectBuilder.php

示例6: build

 public function build()
 {
     $code = parent::build();
     if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
         $code = sfToolkit::stripComments($code);
     }
     return $code;
 }
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:8,代码来源:SfMapBuilderBuilder.php

示例7: build

 public function build()
 {
     $peerCode = parent::build();
     if (!$this->getBuildProperty('builderAddComments')) {
         $peerCode = sfToolkit::stripComments($peerCode);
     }
     // change Propel::import() calls to sfPropel::import()
     $peerCode = str_replace('Propel::import(', 'sfPropel::import(', $peerCode);
     return $peerCode;
 }
开发者ID:ArnaudD,项目名称:RdvZ,代码行数:10,代码来源:SfPeerBuilder.php

示例8: build

 public function build()
 {
     $objectCode = parent::build();
     if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
         $objectCode = sfToolkit::stripComments($objectCode);
     }
     if (!DataModelBuilder::getBuildProperty('builderAddIncludes')) {
         // remove all inline includes: object classes include the peers
         $objectCode = preg_replace("/include_once\\s*.*Base.*Peer\\.php.*\\s*/", "", $objectCode);
     }
     return $objectCode;
 }
开发者ID:mediasadc,项目名称:alba,代码行数:12,代码来源:SfObjectBuilder.php

示例9: build

 public function build()
 {
     $peerCode = parent::build();
     if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
         $peerCode = sfToolkit::stripComments($peerCode);
     }
     if (!DataModelBuilder::getBuildProperty('builderAddIncludes')) {
         //remove all inline includes: peer class include inline the mapbuilder classes
         $peerCode = preg_replace("/(include|require)_once\\s*.*MapBuilder\\.php.*\\s*/", "", $peerCode);
     }
     return $peerCode;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:12,代码来源:SfPeerBuilder.php

示例10: validate

 public function validate()
 {
     $found = array();
     $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array(sfConfig::get('sf_apps_dir'), sfConfig::get('sf_lib_dir'), sfConfig::get('sf_test_dir'), sfConfig::get('sf_plugins_dir')));
     foreach ($files as $file) {
         $content = sfToolkit::stripComments(file_get_contents($file));
         if (preg_match('#\\b(get|has|remove)(Request)*Parameter\\(\\s*[\'"][^\\),]*?\\[[^\\),]#', $content)) {
             $found[$file] = true;
         }
     }
     return $found;
 }
开发者ID:sensorsix,项目名称:app,代码行数:12,代码来源:sfParameterHolderValidation.class.php

示例11: build

 public function build()
 {
     $peerCode = parent::build();
     if (!DataModelBuilder::getBuildProperty('builderAddComments')) {
         $peerCode = sfToolkit::stripComments($peerCode);
     }
     if (!DataModelBuilder::getBuildProperty('builderAddIncludes')) {
         // remove all inline includes: peer class include inline the mapbuilder classes
         $peerCode = preg_replace("/(include|require)_once\\s*.*Base.*Peer\\.php.*\\s*/", "", $peerCode);
         $peerCode = preg_replace("/(include|require)_once\\s*.*MapBuilder\\.php.*\\s*/", "", $peerCode);
     }
     // change Propel::import() calls to sfPropel::import()
     $peerCode = str_replace('Propel::import(', 'sfPropel::import(', $peerCode);
     return $peerCode;
 }
开发者ID:habtom,项目名称:uas,代码行数:15,代码来源:SfPeerBuilder.php

示例12: doValidate

 public function doValidate($methods, $dir)
 {
     $found = array();
     $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in($dir);
     foreach ($files as $file) {
         $content = sfToolkit::stripComments(file_get_contents($file));
         $matches = array();
         foreach ($methods as $method) {
             if (preg_match('#\\b' . preg_quote($method, '#') . '\\b#', $content)) {
                 $matches[] = $method;
             }
         }
         if ($matches) {
             $found[$file] = implode(', ', $matches);
         }
     }
     return $found;
 }
开发者ID:cuongnv540,项目名称:jobeet,代码行数:18,代码来源:sfDeprecatedMethodsValidation.class.php

示例13: validate

 public function validate()
 {
     $settings = array('sf_check_symfony_version', 'sf_max_forwards', 'sf_lazy_cache_key', 'sf_strip_comments', 'sf_lazy_routes_deserialize', 'sf_calendar_web_dir', 'sf_rich_text_js_dir', 'sf_validation_error_prefix', 'sf_validation_error_suffix', 'sf_validation_error_class', 'sf_validation_error_id_prefix', '_is_internal', 'sf_doc_dir');
     $found = array();
     $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array(sfConfig::get('sf_apps_dir'), sfConfig::get('sf_lib_dir'), sfConfig::get('sf_test_dir'), sfConfig::get('sf_plugins_dir')));
     foreach ($files as $file) {
         $content = sfToolkit::stripComments(file_get_contents($file));
         $matches = array();
         foreach ($settings as $setting) {
             if (false !== stripos($content, $setting)) {
                 $matches[] = $setting;
             }
         }
         if ($matches) {
             $found[$file] = implode(', ', $matches);
         }
     }
     return $found;
 }
开发者ID:mediasadc,项目名称:alba,代码行数:19,代码来源:sfDeprecatedSettingsValidation.class.php

示例14: validate

 public function validate()
 {
     $helpers = array('select_day_tag', 'select_month_tag', 'select_year_tag', 'select_date_tag', 'select_second_tag', 'select_minute_tag', 'select_hour_tag', 'select_ampm_tag', 'select_time_tag', 'select_datetime_tag', 'select_number_tag', 'select_timezone_tag', 'options_for_select', 'select_tag', 'select_country_tag', 'select_language_tag', 'select_currency_tag', 'input_tag', 'input_hidden_tag', 'input_file_tag', 'input_password_tag', 'textarea_tag', 'checkbox_tag', 'radiobutton_tag', 'input_date_range_tag', 'input_date_tag', 'submit_tag', 'reset_tag', 'submit_image_tag', 'label_for', 'object_admin_input_file_tag', 'object_admin_double_list', 'object_admin_select_list', 'object_admin_check_list', 'object_input_date_tag', 'object_textarea_tag', 'objects_for_select', 'object_select_tag', 'object_select_country_tag', 'object_select_language_tag', 'object_input_hidden_tag', 'object_input_tag', 'object_checkbox_tag', 'form_has_error', 'form_error', 'get_callbacks', 'get_ajax_options', 'button_to_remote', 'link_to_remote', 'periodically_call_remote', 'form_remote_tag', 'submit_to_remote', 'submit_image_to_remote', 'update_element_function', 'evaluate_remote_response', 'remote_function', 'observe_field', 'observe_form', 'visual_effect', 'sortable_element', 'draggable_element', 'drop_receiving_element', 'input_auto_complete_tag', 'input_in_place_editor_tag');
     $found = array();
     $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array(sfConfig::get('sf_apps_dir'), sfConfig::get('sf_lib_dir'), sfConfig::get('sf_test_dir'), sfConfig::get('sf_plugins_dir')));
     foreach ($files as $file) {
         $content = sfToolkit::stripComments(file_get_contents($file));
         $matches = array();
         foreach ($helpers as $helper) {
             if (preg_match('#\\b' . preg_quote($helper, '#') . '\\b#', $content)) {
                 $matches[] = $helper;
             }
         }
         if ($matches) {
             $found[$file] = implode(', ', $matches);
         }
     }
     return $found;
 }
开发者ID:Phennim,项目名称:symfony1,代码行数:19,代码来源:sfDeprecatedHelpersValidation.class.php

示例15: validate

 public function validate()
 {
     $classes = array('sfDoctrineLogger', 'sfNoRouting', 'sfPathInfoRouting', 'sfRichTextEditor', 'sfRichTextEditorFCK', 'sfRichTextEditorTinyMCE', 'sfCrudGenerator', 'sfAdminGenerator', 'sfPropelCrudGenerator', 'sfPropelAdminGenerator', 'sfPropelUniqueValidator', 'sfDoctrineUniqueValidator', 'sfLoader', 'sfConsoleRequest', 'sfConsoleResponse', 'sfConsoleController', 'sfDoctrineDataRetriever', 'sfPropelDataRetriever', 'sfWidgetFormI18nSelectLanguage', 'sfWidgetFormI18nSelectCurrency', 'sfWidgetFormI18nSelectCountry', 'sfWidgetFormChoiceMany', 'sfWidgetFormPropelChoiceMany', 'sfWidgetFormDoctrineChoiceMany', 'sfValidatorChoiceMany', 'sfValidatorPropelChoiceMany', 'sfValidatorPropelDoctrineMany', 'SfExtensionObjectBuilder', 'SfExtensionPeerBuilder', 'SfMultiExtendObjectBuilder', 'SfNestedSetBuilder', 'SfNestedSetPeerBuilder', 'SfObjectBuilder', 'SfPeerBuilder', 'sfWidgetFormPropelSelect', 'sfWidgetFormPropelSelectMany', 'sfWidgetFormDoctrineSelect', 'sfWidgetFormDoctrineSelectMany', 'sfEzComponentsBridge', 'sfZendFrameworkBridge', 'sfProcessCache', 'sfValidatorConfigHandler', 'sfActionException', 'sfValidatorException', 'sfFillInFormFilter', 'sfValidationExecutionFilter', 'sfRequestCompat10', 'sfFillInForm', 'sfCallbackValidator', 'sfCompareValidator', 'sfDateValidator', 'sfEmailValidator', 'sfFileValidator', 'sfNumberValidator', 'sfRegexValidator', 'sfStringValidator', 'sfUrlValidator', 'sfValidator', 'sfValidatorManager', 'sfMailView', 'sfMail');
     $found = array();
     $files = sfFinder::type('file')->name('*.php')->prune('vendor')->in(array(sfConfig::get('sf_apps_dir'), sfConfig::get('sf_lib_dir'), sfConfig::get('sf_test_dir'), sfConfig::get('sf_plugins_dir')));
     foreach ($files as $file) {
         $content = sfToolkit::stripComments(file_get_contents($file));
         $matches = array();
         foreach ($classes as $class) {
             if (preg_match('#\\b' . preg_quote($class, '#') . '\\b#', $content)) {
                 $matches[] = $class;
             }
         }
         if ($matches) {
             $found[$file] = implode(', ', $matches);
         }
     }
     return $found;
 }
开发者ID:mediasadc,项目名称:alba,代码行数:19,代码来源:sfDeprecatedClassesValidation.class.php


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