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

PHP Properties类代码示例

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

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



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

示例1: assignConfiguration

 /**
  * Stores the configuration. Calls the parent configuration first,
  * then does additional operations.
  * 
  * @param object Properties $configuration
  * @return object
  * @access public
  * @since 3/24/05
  */
 function assignConfiguration(Properties $configuration)
 {
     // Set the configuration values to our custom values.
     $configuration->addProperty('authentication_table', 'auth_visitor');
     $configuration->addProperty('username_field', 'email');
     $configuration->addProperty('password_field', 'password');
     $propertiesFields = array('name' => 'display_name', 'email' => 'email');
     $configuration->addProperty('properties_fields', $propertiesFields);
     try {
         ArgumentValidator::validate($configuration->getProperty('email_from_name'), NonzeroLengthStringValidatorRule::getRule());
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'email_from_name' must be a string. " . $e->getMessage());
     }
     try {
         ArgumentValidator::validate($configuration->getProperty('email_from_address'), RegexValidatorRule::getRule('/^.+@.+$/'));
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'email_from_address' must be an email address. " . $e->getMessage());
     }
     try {
         ArgumentValidator::validate($configuration->getProperty('domain_blacklist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
         ArgumentValidator::validate($configuration->getProperty('domain_whitelist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule())));
     } catch (InvalidArgumentException $e) {
         throw new ConfigurationErrorException("'domain_blacklist' and 'domain_whitelist' if specified must be arrays of domain name strings. " . $e->getMessage());
     }
     parent::assignConfiguration($configuration);
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:35,代码来源:VisitorSQLDatabaseAuthNMethod.class.php


示例2: activarPantalla

 public function activarPantalla()
 {
     $pantallaActual = new Properties();
     $pantallaActual->load(file_get_contents("./pantallaActiva.properties"));
     $pantallaActual->setProperty("Pantalla.activa", 10);
     file_put_contents('./pantallaActiva.properties', $pantallaActual->toString(true));
 }
开发者ID:Tknika,项目名称:areto-server,代码行数:7,代码来源:GUI_DVDGrabador.php


示例3: current

 public function current()
 {
     Timer::start('iterator::' . get_class($this) . '::current');
     $content = $this->get_next_record();
     $separator = "**********\n";
     //split the file at the separator
     $meta = substr($content, 0, strpos($content, $separator));
     $source = substr(strstr($content, $separator), strlen($separator));
     Logger::info($meta);
     $fp = fopen($this->currentArticleFile, "w");
     fwrite($fp, $meta);
     fclose($fp);
     $fp = fopen($this->currentArticleFile, "r");
     $p = new Properties();
     $p->load($fp);
     $meta = array();
     $names = $p->propertyNames();
     foreach ($names as $key) {
         $meta[$key] = $p->getProperty($key);
     }
     fclose($fp);
     $source = html_entity_decode($source);
     $fp = fopen($this->currentArticleFile, "w");
     fwrite($fp, $source);
     fclose($fp);
     Timer::stop('iterator::' . get_class($this) . '::current');
     //$meta['title'] = urldecode($meta['title']);
     $meta['pageTitle'] = urldecode($meta['pageTitle']);
     $this->key = $meta['pageTitle'];
     //			return urldecode($pageID);
     return $meta;
 }
开发者ID:ljarray,项目名称:dbpedia,代码行数:32,代码来源:LiveUpdateIterator.php


示例4: merge

 static function merge($project, $codeCoverageInformation)
 {
     $database = new PhingFile($project->getProperty('coverage.database'));
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $coverage) {
         foreach ($coverage as $filename => $coverageFile) {
             $filename = strtolower($filename);
             if ($props->getProperty($filename) != null) {
                 $file = unserialize($props->getProperty($filename));
                 $left = $file['coverage'];
                 $right = $coverageFile;
                 if (!is_array($right)) {
                     $right = array_shift(PHPUnit_Util_CodeCoverage::bitStringToCodeCoverage(array($right), 1));
                 }
                 $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $right);
                 foreach ($coverageMerged as $key => $value) {
                     if ($value == -2) {
                         unset($coverageMerged[$key]);
                     }
                 }
                 $file['coverage'] = $coverageMerged;
                 $props->setProperty($filename, serialize($file));
             }
         }
     }
     $props->store($database);
 }
开发者ID:nhemsley,项目名称:phing,代码行数:29,代码来源:CoverageMerger.php


示例5: assignConfiguration

 /**
  * Assign the configuration of this Manager. There are no valid configuration options for
  * this manager.
  *
  * @param object Properties $configuration (original type: java.util.Properties)
  *
  * @throws object OsidException An exception with one of the following
  *		   messages defined in org.osid.OsidException:	{@link
  *		   org.osid.OsidException#OPERATION_FAILED OPERATION_FAILED},
  *		   {@link org.osid.OsidException#PERMISSION_DENIED
  *		   PERMISSION_DENIED}, {@link
  *		   org.osid.OsidException#CONFIGURATION_ERROR
  *		   CONFIGURATION_ERROR}, {@link
  *		   org.osid.OsidException#UNIMPLEMENTED UNIMPLEMENTED}, {@link
  *		   org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT}
  *
  * @access public
  */
 function assignConfiguration(Properties $configuration)
 {
     $def = $configuration->getProperty('default_authority');
     // ** parameter validation
     ArgumentValidator::validate($def, StringValidatorRule::getRule(), true);
     // ** end of parameter validation
     $this->_defaultAuthority = $def;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:26,代码来源:HarmoniSchedulingManager.class.php


示例6: propertiesJsonQuery

 public function propertiesJsonQuery($string)
 {
     $propertiesClient = new Properties();
     if (!$this->validateProperties($string)) {
         return "";
     }
     $response = $propertiesClient->find($string);
     return $response;
 }
开发者ID:linniux,项目名称:atsd-api-php,代码行数:9,代码来源:BasicApiProxy.php


示例7: assignConfiguration

 /**
  * Assigns the configuration of databases etc.
  * 
  * @param object $configuration
  * 
  * @access public
  *
  * @return void
  */
 function assignConfiguration(Properties $configuration)
 {
     $this->_configuration = $configuration;
     $dbIndex = $configuration->getProperty('database_index');
     // ** parameter validation
     ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule(), true);
     // ** end of parameter validation
     $this->_dbIndex = $dbIndex;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:18,代码来源:HarmoniPropertyManager.class.php


示例8: getDetailed

 public function getDetailed($criterion = null)
 {
     $Properties = new Properties();
     $featured_properties = $this->get($criterion);
     foreach ($featured_properties as &$featured_property) {
         $featured_property = $Properties->get($featured_property->property_id);
     }
     return $featured_properties;
 }
开发者ID:Qclanton,项目名称:retheme,代码行数:9,代码来源:FeaturedProperties.php


示例9: _getDatabase

 /**
  * @param  Project $project
  * @return Properties
  * @throws BuildException
  */
 protected static function _getDatabase($project)
 {
     $coverageDatabase = $project->getProperty('coverage.database');
     if (!$coverageDatabase) {
         throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file");
     }
     $database = new PhingFile($coverageDatabase);
     $props = new Properties();
     $props->load($database);
     return $props;
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:16,代码来源:CoverageMerger.php


示例10: resolve

 /**
  * Retrieves the new property or properties.
  *
  * @return     Properties The list of properties.
  */
 public function resolve()
 {
     if ($this->name === null) {
         throw new BuildException('The name attribute must be specified');
     }
     if ($this->value === null) {
         throw new BuildException('The value attribute must be specified');
     }
     $properties = new Properties();
     $properties->setProperty($this->name, $this->value);
     return $properties;
 }
开发者ID:horros,项目名称:agavi,代码行数:17,代码来源:AgaviPropertyType.php


示例11: forUser

 public static function forUser($id)
 {
     $properties = new Properties(array(Properties::KEY => $id));
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $id));
     $source_id = $properties->getProperty('stuffpress_source');
     if (!$source_id) {
         $source_id = $sources->addSource('stuffpress');
         $sources->setImported($source_id, 1);
         $properties->setProperty('stuffpress_source', $source_id);
     }
     $source = $sources->getSource($source_id);
     return new StuffpressModel($source);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:13,代码来源:StuffpressModel.php


示例12: testMergePropertiesWithSameKeyAndOverride

 /**
  * Test's the merge() method with two properties instances containing the same key
  * and the override flag has been passed.
  *
  * @return void
  */
 public function testMergePropertiesWithSameKeyAndOverride()
 {
     // initialize the properties
     $properties = new Properties();
     $properties->setProperty('foo', '${bar}');
     // initialize the properties to be merged
     $propertiesToMerge = new Properties();
     $propertiesToMerge->setProperty('foo', 'bar');
     // merge the properties
     $properties->mergeProperties($propertiesToMerge, true);
     // assert that the results are as expected
     $this->assertSame('bar', $properties->getProperty('foo'));
 }
开发者ID:appserver-io,项目名称:properties,代码行数:19,代码来源:PropertiesUtilTest.php


示例13: merge

 static function merge($project, $codeCoverageInformation)
 {
     $coverageDatabase = $project->getProperty('coverage.database');
     if (!$coverageDatabase) {
         throw new BuildException("Property coverage.database is not set - please include coverage-setup in your build file");
     }
     $database = new PhingFile($coverageDatabase);
     $props = new Properties();
     $props->load($database);
     $coverageTotal = $codeCoverageInformation;
     foreach ($coverageTotal as $filename => $data) {
         if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) {
             $ignoreLines = PHP_CodeCoverage_Util::getLinesToBeIgnored($filename);
         } else {
             // FIXME retrieve ignored lines for PHPUnit Version < 3.5.0
             $ignoreLines = array();
         }
         $lines = array();
         $filename = strtolower($filename);
         if ($props->getProperty($filename) != null) {
             foreach ($data as $_line => $_data) {
                 if (is_array($_data)) {
                     $count = count($_data);
                 } else {
                     if (isset($ignoreLines[$_line])) {
                         // line is marked as ignored
                         $count = 1;
                     } else {
                         if ($_data == -1) {
                             // not executed
                             $count = -1;
                         } else {
                             if ($_data == -2) {
                                 // dead code
                                 $count = -2;
                             }
                         }
                     }
                 }
                 $lines[$_line] = $count;
             }
             ksort($lines);
             $file = unserialize($props->getProperty($filename));
             $left = $file['coverage'];
             $coverageMerged = CoverageMerger::mergeCodeCoverage($left, $lines);
             $file['coverage'] = $coverageMerged;
             $props->setProperty($filename, serialize($file));
         }
     }
     $props->store($database);
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:51,代码来源:CoverageMerger.php


示例14: signupAction

 public function signupAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->addErrorMessage("Form was not properly posted.");
         $this->_forward('index');
     }
     // Retrieve the form values and its values
     $form = $this->getForm();
     $valid = $form->isValid($_POST);
     $values = $form->getValues();
     $username = $values['username'];
     $email = $values['email'];
     $password = $values['password'];
     // Validate the form itself
     if (!$form->isValid($_POST)) {
         // Failed validation; redisplay form
         $this->view->form = $form;
         $this->addErrorMessage("Your form contains some errors, please correct them and submit this form again");
         return $this->_forward('register');
     }
     // Register user
     $users = new Users();
     $user = $users->addUser($username, $password, $email);
     // Add some default widgets to the user
     $widgets = new Widgets(array(Stuffpress_Db_Table::USER => $user->id));
     $widgets->addWidget('search');
     $widgets->addWidget('rsslink');
     $widgets->addWidget('links');
     $widgets->addWidget('lastcomments');
     $widgets->addWidget('archives');
     $widgets->addWidget('logo');
     // Add some default properties
     $properties = new Properties(array(Stuffpress_Db_Properties::KEY => $user->id));
     $properties->setProperty('theme', 'clouds');
     $properties->setProperty('title', ucfirst($username));
     $properties->setProperty('subtitle', "my life online");
     // Add the storytlr data source
     StuffpressModel::forUser($user->id);
     // Add default pages
     $pages = new Pages(array(Stuffpress_Db_Table::USER => $user->id));
     //$pages->addPage('dashboard', 'Home');
     $pages->addPage('lifestream', 'Stream');
     $pages->addPage('stories', 'Stories');
     // Send the user a verification email
     Stuffpress_Emails::sendWelcomeEmail($email, $username, $password, $user->token);
     // Done !
     $this->view->username = $username;
     $this->view->email = $email;
     $this->render('success');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:50,代码来源:RegisterController.php


示例15: updateData

 public function updateData($import = false)
 {
     // Get service propertie
     $config = Zend_Registry::get("configuration");
     $pages = $import ? 50 : 1;
     $count = $import ? 200 : 50;
     // Get application properties
     $app_properties = new Properties(array(Stuffpress_Db_Properties::KEY => Zend_Registry::get("shard")));
     // Get twitter user properties
     $username = $this->getProperty('username');
     $uid = $this->getProperty('uid', 0);
     if (!$username) {
         throw new Stuffpress_Exception("Update failed, connector not properly configured");
     }
     // Get twitter consumer tokens and user secrets
     $consumer_key = $config->twitter->consumer_key;
     $consumer_secret = $config->twitter->consumer_secret;
     $oauth_token = $app_properties->getProperty('twitter_oauth_token');
     $oauth_token_secret = $app_properties->getProperty('twitter_oauth_token_secret');
     if (!$consumer_key || !$consumer_secret || !$oauth_token || !$oauth_token_secret) {
         throw new Stuffpress_Exception("Missing twitter credentials. Please configure your twitter account in the <a href='/admin/sns/'>Configure -> Social Networks</a> section.");
     }
     // Fetch the data from twitter
     $result = array();
     $connection = new TwitterOAuth_Client($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
     $connection->host = "https://api.twitter.com/1.1/";
     $max_id = false;
     $params = array('screen_name' => $username, 'count' => $count);
     for ($page = 1; $page <= $pages; $page++) {
         if ($max_id) {
             $params['max_id'] = $max_id;
         }
         $response = $connection->get('statuses/user_timeline', $params);
         if ($response && isset($response->errors) && count($response->errors) > 0) {
             throw new Stuffpress_Exception($response->errors[0]->message);
         }
         if (count($response) == 0) {
             break;
         }
         $max_id = $response[count($response) - 1]->id_str;
         $items = $this->processItems($response);
         if (count($items) == 0) {
             break;
         }
         $result = array_merge($result, $items);
     }
     // Mark as updated (could have been with errors)
     $this->markUpdated();
     return $result;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:50,代码来源:TwitterModel.php


示例16: generateUnsetPrivatePropertiesCode

 private static function generateUnsetPrivatePropertiesCode(Properties $properties, string $instanceName) : string
 {
     $groups = $properties->getGroupedPrivateProperties();
     if (!$groups) {
         return '';
     }
     $unsetClosureCalls = [];
     /* @var $privateProperties \ReflectionProperty[] */
     foreach ($groups as $privateProperties) {
         /* @var $firstProperty \ReflectionProperty */
         $firstProperty = reset($privateProperties);
         $unsetClosureCalls[] = self::generateUnsetClassPrivatePropertiesBlock($firstProperty->getDeclaringClass(), $privateProperties, $instanceName);
     }
     return implode("\n\n", $unsetClosureCalls) . "\n\n";
 }
开发者ID:jbafford,项目名称:ProxyManager,代码行数:15,代码来源:UnsetPropertiesGenerator.php


示例17: __construct

 public function __construct($id, $module = null, $redirect = true)
 {
     parent::__construct($id, $module);
     $fullname = Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname');
     $this->userHello = $fullname;
     $this->message = "Hello " . $fullname;
     $this->ShowMessage = false;
     $this->propertyName = Yii::app()->user->getState('property_property_name');
     $this->propertyCountry = Yii::app()->user->getState('property_country');
     $this->propertyAdminCountry = Yii::app()->user->getState('property_adminCountry');
     $this->title = $this->propertyName;
     $this->propertyId = Yii::app()->user->getState('property_id');
     $this->access = $this->getActivePropertyAccess();
     $this->getAllProperties();
     $property = Properties::model()->find('id=:id AND isdeactivated=:isdeactivated', array(':id' => Yii::app()->user->getState('propertyId'), ':isdeactivated' => 1));
     if ($property != null && $redirect) {
         $access = UserAccessTable::getCurrentAccess();
         if ($access < UserAccessTable::GUEST) {
             $this->redirect(basePath('property/' . Yii::app()->user->getState('propertyId')));
         } else {
             $this->redirect(basePath('property/deactivated'));
         }
     }
     //        $this->access = UserAccessTable::BASIC_ACCESS;
 }
开发者ID:salem-dev-acc,项目名称:yiiapp,代码行数:25,代码来源:SharedKeyAppController.php


示例18: run

 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 20) as $index) {
         Properties::create(['serialno' => '123abc', 'propname' => $faker->firstName, 'propdesc' => 'Lorem ipsum dolor sit amet', 'propstatus' => 'In stock', 'propcondition' => 'Good', 'prop_category' => $faker->numberBetween($min = 1, $max = 5), 'propcost' => $faker->randomFloat(NULL, 500, 35000), 'dateacq' => $faker->dateTimeBetween('-10 years', '-1 year')->format('Y-m-d')]);
     }
 }
开发者ID:codeblues1516,项目名称:godaddy,代码行数:7,代码来源:PropertiesTableSeeder.php


示例19: initPhingProperties

 protected function initPhingProperties(Project $project)
 {
     // Apply all file properties, then all non-file properties
     $properties = new Properties();
     foreach ($this->fileProps as $key => $value) {
         $properties->put($key, $value);
     }
     foreach ($this->customProps as $key => $value) {
         $properties->put($key, $value);
     }
     // Then swap out placeholder values
     foreach ($properties->getProperties() as $key => $value) {
         $value = ProjectConfigurator::replaceProperties($project, $value, $properties->getProperties());
         $project->setProperty($key, $value);
     }
 }
开发者ID:halfer,项目名称:Meshing,代码行数:16,代码来源:Task.php


示例20: propertiesFromSameFileAreEqual

 public function propertiesFromSameFileAreEqual()
 {
     $one = Properties::fromFile($this->getClass()->getPackage()->getResourceAsStream('example.ini'));
     $two = Properties::fromFile($this->getClass()->getPackage()->getResourceAsStream('example.ini'));
     $this->assertFalse($one === $two);
     $this->assertTrue($one->equals($two));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:FileBasedPropertiesTest.class.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Property类代码示例发布时间:2022-05-23
下一篇:
PHP PropelQuickBuilder类代码示例发布时间: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