本文整理汇总了PHP中Ak::parseOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::parseOptions方法的具体用法?PHP Ak::parseOptions怎么用?PHP Ak::parseOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::parseOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClasses
public function getClasses($options = null)
{
if ($options == null) {
return $this->classes;
} else {
if (is_array($options)) {
$default_options = array();
$available_options = array('visibility', 'tags');
$parameters = array('available_options' => $available_options);
Ak::parseOptions($options, $default_options, $parameters);
$returnClasses = array();
foreach ($this->classes as $class) {
if (isset($options['visibility']) && $class->getVisibility() != $options['visibility']) {
continue;
}
if (isset($options['tags'])) {
$options['tags'] = !is_array($options['tags']) ? array($options['tags']) : $options['tags'];
$docBlock = $method->getDocBlock();
foreach ($options['tags'] as $tag) {
if ($docBlock->getTag($tag) == false) {
continue;
}
}
}
$returnClasses[] = $class;
}
return $returnClasses;
}
}
}
示例2: toSentence
function toSentence($options = array())
{
$default_options = array('skip_last_comma'=>true,'connector'=>'and');
Ak::parseOptions($options,$default_options);
$parts = array();
for($i=0;$i<count($this->value);$i++) {
$separator = ', ';
if ($i==0) {
$separator = '';
} else if ($i+1==count($this->value)) {
$separator = $options['skip_last_comma']?' ':', ';
$separator.= $options['connector'].' ';
}
$parts[]=$separator.$this->value[$i];
}
return implode('',$parts);
}
示例3: parseOptions
/**
*
* @param array $options
* @param array $default_options
* @param array $available_options
* @param boolean $walk_keys
*/
function parseOptions(&$options, $default_options = array(), $parameters = array(), $walk_keys = false)
{
if ($walk_keys) {
foreach ($options as $key => $value) {
if (!is_array($value)) {
unset($options[$key]);
$options[$value] = $default_options;
} else {
Ak::parseOptions($value, $default_options, $parameters);
$options[$key] = $value;
}
}
return;
}
$options = array_merge($default_options, $options);
foreach ($options as $key => $value) {
if (isset($parameters['available_options'])) {
if (!isset($parameters['available_options'][$key])) {
continue;
}
}
$options[$key] = $value;
}
}
示例4: getMethods
function getMethods($options = null)
{
if ($options == null) {
return $this->methods;
} else {
if (is_array($options)) {
$default_options = array();
$available_options = array('visibility', 'static', 'tags', 'returnByReference');
$parameters = array('available_options' => $available_options);
Ak::parseOptions(&$options, $default_options, $parameters);
$returnMethods = array();
foreach ($this->methods as $method) {
if (isset($options['visibility']) && $method->getVisibility() != $options['visibility']) {
continue;
}
if (isset($options['returnByReference']) && $method->returnByReference() != $options['returnByReference']) {
continue;
}
if (isset($options['static']) && $method->isStatic() != $options['static']) {
continue;
}
if (isset($options['tags'])) {
$options['tags'] = !is_array($options['tags']) ? array($options['tags']) : $options['tags'];
$docBlock = $method->getDocBlock();
$broke = false;
foreach ($options['tags'] as $tag => $value) {
$res = $docBlock->getTag($tag);
if (!@preg_match('/' . $value . '/', $res) || $value !== false && $res === false) {
$broke = true;
break;
}
}
if ($broke) {
continue;
}
}
$returnMethods[] = $method;
}
//echo "Return methods:\n";
//var_dump($returnMethods);
return $returnMethods;
}
}
}
示例5: xml_instruct
function xml_instruct($type, $options = array())
{
$default_options = array('version' => '1.0');
$config = array('available_options' => array('version'));
Ak::parseOptions($options, $default_options, $config);
return $this->_renderTag(false, $type, '', $options, '<?', '?>', '?>');
}
示例6: _setCachesAction
function _setCachesAction($options)
{
if (!$this->_perform_caching) {
$this->_enableGzippedOutput();
return;
}
if (is_string($options)) {
$options = Ak::toArray($options);
}
$default_options = array(
'include_get_parameters'=>array(),
'cache_path'=>''
);
Ak::parseOptions($options, $default_options,array(),true);
$this->_caches_action = $options;
$actionName = $this->_controller->getActionName();
if ($this->_caching_type == null && isset($this->_caches_action[$actionName])) {
if (isset($this->_caches_page[$actionName]['format']) && $format !=$this->_caches_page[$actionName]['format']) {
$this->_enableGzippedOutput();
return;
}
$this->_caching_type = 'action';
$this->_action_include_get_parameters = $this->_caches_action[$actionName]['include_get_parameters'];
if(!empty($this->_caches_action[$actionName]['host'])) {
$this->_action_cache_host = $this->_caches_action[$actionName]['host'];
}
$path = $this->_caches_action[$actionName]['cache_path'];
$parts = parse_url($path);
if (isset($parts['host'])) {
$this->_action_cache_host = $parts['host'];
$this->_action_cache_path = $parts['path'];
} else {
$this->_action_cache_path = $path;
}
if (!isset($this->_action_cache_host)) {
$this->_action_cache_host = $this->_controller->Request->getHost();
}
$this->_action_cache_path = $this->_actionPath($this->_action_cache_path);
$this->_controller->beforeFilter(array(&$this,'beforeActionCache'));
$this->_controller->appendAfterFilter(array(&$this,'afterActionCache'));
} else {
$this->_enableGzippedOutput();
}
}