本文整理汇总了PHP中Zend_View_Helper_Placeholder_Container_Standalone::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Helper_Placeholder_Container_Standalone::__call方法的具体用法?PHP Zend_View_Helper_Placeholder_Container_Standalone::__call怎么用?PHP Zend_View_Helper_Placeholder_Container_Standalone::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View_Helper_Placeholder_Container_Standalone
的用法示例。
在下文中一共展示了Zend_View_Helper_Placeholder_Container_Standalone::__call方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Overload method access
*
* Allows the following method calls:
* - appendFile($src, $type = 'text/javascript', $attrs = array())
* - offsetSetFile($index, $src, $type = 'text/javascript', $attrs = array())
* - prependFile($src, $type = 'text/javascript', $attrs = array())
* - setFile($src, $type = 'text/javascript', $attrs = array())
* - appendScript($script, $type = 'text/javascript', $attrs = array())
* - offsetSetScript($index, $src, $type = 'text/javascript', $attrs = array())
* - prependScript($script, $type = 'text/javascript', $attrs = array())
* - setScript($script, $type = 'text/javascript', $attrs = array())
*
* @param string $method
* @param array $args
* @return Zend_View_Helper_HeadScript
* @throws Zend_View_Exception if too few arguments or invalid method
*/
public function __call($method, $args)
{
if (preg_match('/^(?P<action>set|(ap|pre)pend|offsetSet)(?P<mode>File|Script)$/', $method, $matches)) {
if (1 > count($args)) {
// require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception(sprintf('Method "%s" requires at least one argument', $method));
}
$action = $matches['action'];
$mode = strtolower($matches['mode']);
$type = 'text/javascript';
$attrs = array();
if ('offsetSet' == $action) {
$index = array_shift($args);
if (1 > count($args)) {
// require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception(sprintf('Method "%s" requires at least two arguments, an index and source', $method));
}
}
$content = $args[0];
if (isset($args[1])) {
$type = (string) $args[1];
}
if (isset($args[2])) {
$attrs = (array) $args[2];
}
switch ($mode) {
case 'script':
$item = $this->createData($type, $attrs, $content);
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->{$action}($item);
}
break;
case 'file':
default:
if (!$this->_isDuplicate($content)) {
$attrs['src'] = $content;
$item = $this->createData($type, $attrs);
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->{$action}($item);
}
}
break;
}
return $this;
}
return parent::__call($method, $args);
}
示例2: __call
/**
* Overload method access
*
* Creates the following virtual methods:
* - appendStylesheet($href, $media, $conditionalStylesheet, $extras)
* - offsetSetStylesheet($index, $href, $media, $conditionalStylesheet, $extras)
* - prependStylesheet($href, $media, $conditionalStylesheet, $extras)
* - setStylesheet($href, $media, $conditionalStylesheet, $extras)
* - appendAlternate($href, $type, $title, $extras)
* - offsetSetAlternate($index, $href, $type, $title, $extras)
* - prependAlternate($href, $type, $title, $extras)
* - setAlternate($href, $type, $title, $extras)
*
* Items that may be added in the future:
* - Navigation? need to find docs on this
* - public function appendStart()
* - public function appendContents()
* - public function appendPrev()
* - public function appendNext()
* - public function appendIndex()
* - public function appendEnd()
* - public function appendGlossary()
* - public function appendAppendix()
* - public function appendHelp()
* - public function appendBookmark()
* - Other?
* - public function appendCopyright()
* - public function appendChapter()
* - public function appendSection()
* - public function appendSubsection()
*
* @param mixed $method
* @param mixed $args
* @return void
*/
public function __call($method, $args)
{
if (preg_match('/^(?P<action>set|(ap|pre)pend|offsetSet)(?P<type>Stylesheet|Alternate)$/', $method, $matches)) {
$argc = count($args);
$action = $matches['action'];
$type = $matches['type'];
$index = null;
if ('offsetSet' == $action) {
if (0 < $argc) {
$index = array_shift($args);
--$argc;
}
}
if (1 > $argc) {
require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception(sprintf('%s requires at least one argument', $method));
}
if (is_array($args[0])) {
$item = $this->createData($args[0]);
} else {
$dataMethod = 'createData' . $type;
$item = $this->{$dataMethod}($args);
}
if ($item) {
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->{$action}($item);
}
}
return $this;
}
return parent::__call($method, $args);
}
示例3: __call
/**
* Overload method calls
*
* Allows the following method calls:
* - appendStyle($content, $attributes = array())
* - offsetSetStyle($index, $content, $attributes = array())
* - prependStyle($content, $attributes = array())
* - setStyle($content, $attributes = array())
*
* @param string $method
* @param array $args
* @return void
* @throws Zend_View_Exception When no $content provided or invalid method
*/
public function __call($method, $args)
{
if (preg_match('/^(?P<action>set|(ap|pre)pend|offsetSet)(Style)$/', $method, $matches)) {
$index = null;
$argc = count($args);
$action = $matches['action'];
if ('offsetSet' == $action) {
if (0 < $argc) {
$index = array_shift($args);
--$argc;
}
}
if (1 > $argc) {
// require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception(sprintf('Method "%s" requires minimally content for the stylesheet', $method));
$e->setView($this->view);
throw $e;
}
$content = $args[0];
$attrs = array();
if (isset($args[1])) {
$attrs = (array) $args[1];
}
$item = $this->createData($content, $attrs);
if ('offsetSet' == $action) {
$this->offsetSet($index, $item);
} else {
$this->{$action}($item);
}
return $this;
}
return parent::__call($method, $args);
}
示例4: __call
/**
* Overload method access
*
* Allows the following 'virtual' methods:
* - appendName($keyValue, $content, $modifiers = array())
* - offsetGetName($index, $keyValue, $content, $modifers = array())
* - prependName($keyValue, $content, $modifiers = array())
* - setName($keyValue, $content, $modifiers = array())
* - appendHttpEquiv($keyValue, $content, $modifiers = array())
* - offsetGetHttpEquiv($index, $keyValue, $content, $modifers = array())
* - prependHttpEquiv($keyValue, $content, $modifiers = array())
* - setHttpEquiv($keyValue, $content, $modifiers = array())
* - appendProperty($keyValue, $content, $modifiers = array())
* - offsetGetProperty($index, $keyValue, $content, $modifiers = array())
* - prependProperty($keyValue, $content, $modifiers = array())
* - setProperty($keyValue, $content, $modifiers = array())
*
* @param string $method
* @param array $args
* @return Zend_View_Helper_HeadMeta
*/
public function __call($method, $args)
{
if (preg_match('/^(?P<action>set|(pre|ap)pend|offsetSet)(?P<type>Name|HttpEquiv|Property)$/', $method, $matches)) {
$action = $matches['action'];
$type = $this->_normalizeType($matches['type']);
$argc = count($args);
$index = null;
if ('offsetSet' == $action) {
if (0 < $argc) {
$index = array_shift($args);
--$argc;
}
}
if (2 > $argc) {
#require_once 'Zend/View/Exception.php';
$e = new Zend_View_Exception('Too few arguments provided; requires key value, and content');
$e->setView($this->view);
throw $e;
}
if (3 > $argc) {
$args[] = array();
}
$item = $this->createData($type, $args[0], $args[1], $args[2]);
if ('offsetSet' == $action) {
return $this->offsetSet($index, $item);
}
$this->{$action}($item);
return $this;
}
return parent::__call($method, $args);
}