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


PHP Object::combined_static方法代码示例

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


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

示例1: testCombinedStatic

 public function testCombinedStatic()
 {
     // test basic operation
     $this->assertEquals(array('test_1', 'test_2', 'test_3'), Object::combined_static('ObjectStaticTest_Combined3', 'first'));
     // test that null values are ignored, but values on either side are still merged
     $this->assertEquals(array('test_1', 'test_3'), Object::combined_static('ObjectStaticTest_Combined3', 'second'));
     // test the $ceiling param
     $this->assertEquals(array('test_2', 'test_3'), Object::combined_static('ObjectStaticTest_Combined3', 'first', 'ObjectStaticTest_Combined2'));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:9,代码来源:ObjectStaticTest.php

示例2: testAccessRestrictionWithNonAdminMember

	/**
	 * Since DataObjectRetroactiveCleanerTask can be destructive,
	 * make sure that only admins can run it.
	 */
	public function testAccessRestrictionWithNonAdminMember() {
		$devServers = Object::combined_static('Director', 'dev_servers');
		Director::set_dev_servers(array('example.com'));
		$response = $this->get("dev/tasks/DataObjectRetroactiveCleanerTask");
		
		$selector = 'form[action="Security/LoginForm"]';
		$this->assertTrue((bool)$this->cssParser()->getBySelector($selector),
			'Non admin members can run DataObjectRetroactiveCleanerTask.');
		
		Director::set_dev_servers($devServers);
	}
开发者ID:redema,项目名称:silverstripe-janitor,代码行数:15,代码来源:DevTasksSecurityTest.php

示例3: getAvailableKeywords

 /**
  * Return a list of all available keywords in the format 
  * 
  * array(
  *	'keyword' => 'A description'
  * )
  *
  * @return array
  */
 public function getAvailableKeywords()
 {
     if (!$this->availableKeywords) {
         $objectFields = Object::combined_static($this->class, 'db');
         // $objectFields = array_combine(array_keys($objectFields), array_keys($objectFields));
         $objectFields['Created'] = 'Created';
         $objectFields['LastEdited'] = 'LastEdited';
         $this->availableKeywords = array();
         foreach ($objectFields as $key => $value) {
             $this->availableKeywords[$key] = array('short' => $key, 'long' => $key);
         }
     }
     return $this->availableKeywords;
 }
开发者ID:sheadawson,项目名称:silverstripe-notifications,代码行数:23,代码来源:NotifyOnThis.php

示例4: updatableRelations

	/**
	 * Get all updatable relations from $this->owner.
	 * 
	 * @return array
	 */
	protected function updatableRelations() {
		$updatableRelations = array();
		foreach (array_merge($this->owner->has_many(), $this->getExtensionComponents('has_many')) as
				$hasManyRelation => $hasManyClass) {
			$hasOneOnVersioning = (array)Object::combined_static($hasManyClass, 'has_one_on_versioning');
			foreach ($hasOneOnVersioning as $onUpdateRelation => $process) {
				$hasOneClass = singleton($hasManyClass)->has_one($onUpdateRelation);
				if (in_array($hasOneClass, ClassInfo::ancestry($this->owner->ClassName)) && $process) {
					$updatableRelations[$hasManyRelation] = array(
						$hasManyClass,
						$onUpdateRelation
					);
				}
			}
		}
		return $updatableRelations;
	}
开发者ID:redema,项目名称:silverstripe-handyman,代码行数:22,代码来源:DataObjectOnVersioningDecorator.php

示例5: __construct

 public function __construct($name, $title = null, $options = array())
 {
     parent::__construct($name, $title);
     $defaults = Object::combined_static($this->class, 'default_options', 'ItemSetField');
     $this->options = array_merge($defaults, $options ? $options : array());
 }
开发者ID:d00616,项目名称:silverstripe-itemsetfield,代码行数:6,代码来源:ItemSetField.php

示例6: allowedActions

 /**
  * Get a unified array of allowed actions on this controller (if such data is available) from both the controller
  * ancestry and any extensions.
  *
  * @return array|null
  */
 public function allowedActions()
 {
     $actions = Object::combined_static(get_class($this), 'allowed_actions', 'RequestHandler');
     foreach ($this->extension_instances as $extension) {
         if ($extensionActions = Object::get_static(get_class($extension), 'allowed_actions')) {
             $actions = array_merge($actions, $extensionActions);
         }
     }
     if ($actions) {
         // convert all keys and values to lowercase to
         // allow for easier comparison, unless it is a permission code
         $actions = array_change_key_case($actions, CASE_LOWER);
         foreach ($actions as $key => $value) {
             if (is_numeric($key)) {
                 $actions[$key] = strtolower($value);
             }
         }
         return $actions;
     }
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:26,代码来源:RequestHandler.php

示例7: Metadata

 /**
  * Builds out the metadata for the class attribute of the file input tag. This
  * is later parsed by the jQuery metadata plugin.
  *
  * @return string
  */
 public function Metadata()
 {
     $ret = array();
     $vars = Object::combined_static(get_class($this), "defaults");
     foreach ($vars as $setting => $value) {
         $ret[] = "{$setting} : '" . $this->getSetting($setting) . "'";
     }
     $data = implode(",", $ret);
     if (!empty($this->extraParams)) {
         $data .= ", scriptData : { ";
         $extras = array();
         foreach ($this->extraParams as $key => $val) {
             $extras[] = "'{$key}' : '{$val}'";
         }
         $params = implode(",", $extras);
         $data .= $params . "}";
     }
     return $data;
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:25,代码来源:UploadifyField.php

示例8: checkAccessAction

 /**
  * Check that the given action is allowed to be called from a URL.
  * It will interrogate {@link self::$allowed_actions} to determine this.
  */
 function checkAccessAction($action)
 {
     $action = strtolower($action);
     $allowedActions = Object::combined_static(get_class($this), 'allowed_actions');
     $newAllowedActions = array();
     // merge in any $allowed_actions from extensions
     if ($this->extension_instances) {
         foreach ($this->extension_instances as $extension) {
             if ($extAccess = $extension->stat('allowed_actions')) {
                 $allowedActions = array_merge($allowedActions, $extAccess);
             }
         }
     }
     if ($action == 'index') {
         return true;
     }
     if ($allowedActions) {
         foreach ($allowedActions as $key => $value) {
             $newAllowedActions[strtolower($key)] = strtolower($value);
         }
         $allowedActions = $newAllowedActions;
         if (isset($allowedActions[$action])) {
             $test = $allowedActions[$action];
             // PHP can be loose about typing; let's give people a break if true becomes 1 or '1'
             if ($test === true || $test === 1 || $test === '1') {
                 return true;
             } elseif (substr($test, 0, 2) == '->') {
                 return $this->{substr($test, 2)}();
             } elseif (Permission::check($test)) {
                 return true;
             }
         } elseif (($key = array_search($action, $allowedActions)) !== false && is_numeric($key)) {
             return true;
         }
     }
     if ($allowedActions === null || !$this->uninherited('allowed_actions')) {
         // If no allowed_actions are provided, then we should only let through actions that aren't handled by magic methods
         // we test this by calling the unmagic method_exists and comparing it to the magic $this->hasMethod().  This will
         // still let through actions that are handled by templates.
         return method_exists($this, $action) || !$this->hasMethod($action);
     }
     return false;
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:47,代码来源:RequestHandler.php

示例9: castingHelper

 /**
  * Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field
  * on this object. MODIFIED TO LEAVE FAILOVER ALONE (so it doesn't have to inherit Object).
  *
  * @param string $field
  * @return string
  */
 public function castingHelper($field)
 {
     if ($this->hasMethod('db') && ($fieldSpec = $this->db($field))) {
         return $fieldSpec;
     }
     $specs = Object::combined_static(get_class($this), 'casting');
     if (isset($specs[$field])) {
         return $specs[$field];
     }
     //if($this->failover) return $this->failover->castingHelper($field);
 }
开发者ID:helpfulrobot,项目名称:markguinn-silverstripe-livepub,代码行数:18,代码来源:ViewableWrapper.php

示例10: has_many

 /**
  * Gets the class of a one-to-many relationship. If no $component is specified then an array of all the one-to-many
  * relationships and their classes will be returned.
  *
  * @param string $component Name of component
  * @param bool $classOnly If this is TRUE, than any has_many relationships in the form "ClassName.Field" will have
  *        the field data stripped off. It defaults to TRUE.
  * @return string|array
  */
 public function has_many($component = null, $classOnly = true)
 {
     $hasMany = Object::combined_static($this->class, 'has_many', 'DataObject');
     if ($component) {
         if ($hasMany && array_key_exists($component, $hasMany)) {
             $hasMany = $hasMany[$component];
         } else {
             return false;
         }
     }
     if ($hasMany && $classOnly) {
         return preg_replace('/(.+)?\\..+/', '$1', $hasMany);
     } else {
         return $hasMany ? $hasMany : array();
     }
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:25,代码来源:DataObject.php

示例11: probeRelationClass

	/**
	 * Probe the given relation, it is necessary to find out
	 * which relations on $class which links back to the given
	 * $ownerRelationName, for each match self::handleRelation()
	 * is called to have it handled.
	 * 
	 * @param string $ownerRelationName The name of the current
	 * relation on the owner.
	 * @param string $class The class for $ownerRelationName.
	 */
	public function probeRelationClass($ownerRelationName, $class) {
		$ancestry = ClassInfo::ancestry($this->object->ClassName);
		foreach ((array)Object::combined_static($class, 'has_one') as $relationName => $relationClass) {
			if (in_array($relationClass, $ancestry))
				$this->handleRelation($ownerRelationName, $class, $relationName);
		}
	}
开发者ID:redema,项目名称:silverstripe-janitor,代码行数:17,代码来源:DataObjectOnDeleteDecorator.php

示例12: __construct

 public function __construct()
 {
     $this->options = Object::combined_static(get_class($this), 'default_options');
 }
开发者ID:rixrix,项目名称:sapphire,代码行数:4,代码来源:FileFinder.php


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