本文整理汇总了PHP中Zend_View_Helper_Placeholder_Container_Standalone类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View_Helper_Placeholder_Container_Standalone类的具体用法?PHP Zend_View_Helper_Placeholder_Container_Standalone怎么用?PHP Zend_View_Helper_Placeholder_Container_Standalone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_View_Helper_Placeholder_Container_Standalone类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: headMin
/**
* Main view helper function
*
* @param Zend_View_Helper_Placeholder_Container_Standalone $headScript
* @param array $options
* @return Zend_View_Helper_Placeholder_Container_Standalone
*/
public function headMin(Zend_View_Helper_Placeholder_Container_Standalone $headScript, array $options)
{
//read all options
if (isset($options['disabled']) && $options['disabled']) {
return $headScript;
}
if ($headScript instanceof Zend_View_Helper_HeadScript) {
$this->_type = 'script';
} else {
if ($headScript instanceof Zend_View_Helper_HeadLink) {
$this->_type = 'link';
} else {
throw new Zend_Exception("{$headScript} must be Zend_View_Helper_HeadScript or Zend_View_Helper_HeadLink");
}
}
if (isset($options['public_dir'])) {
$this->_publicDir = $options['public_dir'];
}
if (isset($options['content_dir'])) {
$this->_contentDir = $options['content_dir'];
}
if (isset($options['content_web'])) {
$this->_contentWeb = $options['content_web'];
}
if (isset($options['minify_cmd'])) {
$this->_minifyCmd = $options['minify_cmd'];
}
if (isset($options['version'])) {
$this->_version = $options['version'];
}
//get items for minification
$items = array();
$headScript->getContainer()->ksort();
$unsetKeys = array();
foreach ($headScript as $key => $item) {
//Zend_Debug::dump($item);
$itemDesc = $this->_getItemDesc($item);
if ($itemDesc === false) {
continue;
}
//include only local paths
if (!isset($itemDesc['path']) || substr($itemDesc['path'], 0, 7) != 'http://' && substr($itemDesc['path'], 0, 8) != 'https://') {
$items[] = $itemDesc;
$unsetKeys[] = $key;
}
}
//unset items to be minified
foreach ($unsetKeys as $key) {
unset($headScript[$key]);
}
$cacheId = $this->_calculateHash($items);
$cacheFileName = $this->_contentDir . '/' . $cacheId . $this->_getCacheExt();
if (!file_exists($cacheFileName)) {
//create minified cache file
$content = '';
foreach ($items as $key => $itemDesc) {
if (isset($itemDesc['content'])) {
$content .= PHP_EOL . $itemDesc['content'];
} elseif (isset($itemDesc['path'])) {
$content .= PHP_EOL . file_get_contents($this->_publicDir . '/' . $itemDesc['path']);
}
}
//save bundled content
file_put_contents($cacheFileName, $content);
//minify
if (isset($this->_minifyCmd)) {
$this->_execMinifyCmd($cacheFileName);
}
}
//append cache file
$cacheFileWeb = $this->_contentWeb . '/' . $cacheId . $this->_getCacheExt();
//print_r($headScript->getContainer());
if ($this->_type == 'script') {
$headScript->appendFile($cacheFileWeb);
} else {
$headScript->appendStylesheet($cacheFileWeb);
}
return $headScript;
}
开发者ID:bokultis,项目名称:kardiomedika,代码行数:86,代码来源:HeadMin.php
示例2: __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);
}
开发者ID:robeendey,项目名称:ce,代码行数:69,代码来源:HeadScript.php
示例3: __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);
}
开发者ID:jcvpalma,项目名称:avaliacao_desenv_php_zend17,代码行数:69,代码来源:HeadLink.php
示例4: __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);
}
开发者ID:sadikeser,项目名称:tickets,代码行数:47,代码来源:HeadStyle.php
示例5: __construct
/**
* Constructor
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
开发者ID:rexmac,项目名称:zyndax,代码行数:9,代码来源:PageTitle.php
示例6: __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);
}
开发者ID:staywithabhi,项目名称:porto,代码行数:52,代码来源:HeadMeta.php
示例7: captureStart
/**
* Start capture action
*
* @param mixed $captureType
* @param string $typeOrAttrs
* @return void
*/
public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $attrs = null)
{
$this->_captureAttrs = $attrs;
return parent::captureStart($type);
}
开发者ID:dalinhuang,项目名称:popo,代码行数:12,代码来源:HeadStyle.php
示例8: offsetSet
/**
* Override offsetSet
*
* @param string|int $index
* @param mixed $value
* @return void
*/
public function offsetSet($index, $value)
{
if (!$this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception('Invalid argument passed to offsetSet(); please use one of the helper methods, offsetSetScript() or offsetSetFile()');
}
$this->_isValid($value);
return parent::offsetSet($index, $value);
}
开发者ID:dalinhuang,项目名称:popo,代码行数:16,代码来源:HeadScript.php
示例9: set
/**
* set()
*
* @param array $value
* @return Zend_Layout_ViewHelper_HeadLink
*/
public function set($value)
{
if (!$this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception('set() expects a data token; please use one of the custom set*() methods');
}
return parent::set($value);
}
开发者ID:dalinhuang,项目名称:popo,代码行数:14,代码来源:HeadLink.php
示例10: set
/**
* Set
*
* @param string $value
* @return void
* @throws Zend_View_Exception
*/
public function set($value)
{
if (!$this->_isValid($value)) {
require_once 'Zend/View/Exception.php';
throw new Zend_View_Exception('Invalid value passed to set; please use setMeta()');
}
return parent::set($value);
}
开发者ID:dalinhuang,项目名称:popo,代码行数:15,代码来源:HeadMeta.php
注:本文中的Zend_View_Helper_Placeholder_Container_Standalone类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论