Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/remove-view-protected-underscores' of https://gi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 25 changed files with 237 additions and 237 deletions.
20 changes: 10 additions & 10 deletions src/Helper/AbstractHtmlElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract class AbstractHtmlElement extends AbstractHelper
*
* @var string
*/
protected $_closingBracket = null;
protected $closingBracket = null;

/**
* Get the tag closing bracket
Expand All @@ -36,23 +36,23 @@ abstract class AbstractHtmlElement extends AbstractHelper
*/
public function getClosingBracket()
{
if (!$this->_closingBracket) {
if ($this->_isXhtml()) {
$this->_closingBracket = ' />';
if (!$this->closingBracket) {
if ($this->isXhtml()) {
$this->closingBracket = ' />';
} else {
$this->_closingBracket = '>';
$this->closingBracket = '>';
}
}

return $this->_closingBracket;
return $this->closingBracket;
}

/**
* Is doctype XHTML?
*
* @return boolean
*/
protected function _isXhtml()
protected function isXhtml()
{
$doctype = $this->view->plugin('doctype');
return $doctype->isXhtml();
Expand All @@ -68,7 +68,7 @@ protected function _isXhtml()
*
* @return string The XHTML for the attributes.
*/
protected function _htmlAttribs($attribs)
protected function htmlAttribs($attribs)
{
$xhtml = '';
$escaper = $this->view->plugin('escapehtml');
Expand All @@ -94,7 +94,7 @@ protected function _htmlAttribs($attribs)
}

if ('id' == $key) {
$val = $this->_normalizeId($val);
$val = $this->normalizeId($val);
}

if (strpos($val, '"') !== false) {
Expand All @@ -113,7 +113,7 @@ protected function _htmlAttribs($attribs)
* @param string $value
* @return string
*/
protected function _normalizeId($value)
protected function normalizeId($value)
{
if (strstr($value, '[')) {
if ('[]' == substr($value, -2)) {
Expand Down
50 changes: 25 additions & 25 deletions src/Helper/Cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ class Cycle extends AbstractHelper implements \Iterator
*
* @var array
*/
protected $_pointers = array(self::DEFAULT_NAME =>-1) ;
protected $pointers = array(self::DEFAULT_NAME =>-1) ;

/**
* Array of values
*
* @var array
*/
protected $_data = array(self::DEFAULT_NAME=>array());
protected $data = array(self::DEFAULT_NAME=>array());

/**
* Actual name of cycle
*
* @var string
*/
protected $_name = self::DEFAULT_NAME;
protected $name = self::DEFAULT_NAME;

/**
* Add elements to alternate
Expand All @@ -56,7 +56,7 @@ class Cycle extends AbstractHelper implements \Iterator
public function __invoke(array $data = array(), $name = self::DEFAULT_NAME)
{
if(!empty($data))
$this->_data[$name] = $data;
$this->data[$name] = $data;

$this->setName($name);
return $this;
Expand All @@ -72,7 +72,7 @@ public function __invoke(array $data = array(), $name = self::DEFAULT_NAME)
public function assign(Array $data , $name = self::DEFAULT_NAME)
{
$this->setName($name);
$this->_data[$name] = $data;
$this->data[$name] = $data;
$this->rewind();
return $this;
}
Expand All @@ -85,12 +85,12 @@ public function assign(Array $data , $name = self::DEFAULT_NAME)
*/
public function setName($name = self::DEFAULT_NAME)
{
$this->_name = $name;
$this->name = $name;

if(!isset($this->_data[$this->_name]))
$this->_data[$this->_name] = array();
if(!isset($this->data[$this->name]))
$this->data[$this->name] = array();

if(!isset($this->_pointers[$this->_name]))
if(!isset($this->pointers[$this->name]))
$this->rewind();

return $this;
Expand All @@ -104,7 +104,7 @@ public function setName($name = self::DEFAULT_NAME)
*/
public function getName()
{
return $this->_name;
return $this->name;
}


Expand All @@ -115,7 +115,7 @@ public function getName()
*/
public function getAll()
{
return $this->_data[$this->_name];
return $this->data[$this->name];
}

/**
Expand All @@ -125,7 +125,7 @@ public function getAll()
*/
public function toString()
{
return (string) $this->_data[$this->_name][$this->key()];
return (string) $this->data[$this->name][$this->key()];
}

/**
Expand All @@ -145,11 +145,11 @@ public function __toString()
*/
public function next()
{
$count = count($this->_data[$this->_name]);
if ($this->_pointers[$this->_name] == ($count - 1))
$this->_pointers[$this->_name] = 0;
$count = count($this->data[$this->name]);
if ($this->pointers[$this->name] == ($count - 1))
$this->pointers[$this->name] = 0;
else
$this->_pointers[$this->_name] = ++$this->_pointers[$this->_name];
$this->pointers[$this->name] = ++$this->pointers[$this->name];
return $this;
}

Expand All @@ -160,11 +160,11 @@ public function next()
*/
public function prev()
{
$count = count($this->_data[$this->_name]);
if ($this->_pointers[$this->_name] <= 0)
$this->_pointers[$this->_name] = $count - 1;
$count = count($this->data[$this->name]);
if ($this->pointers[$this->name] <= 0)
$this->pointers[$this->name] = $count - 1;
else
$this->_pointers[$this->_name] = --$this->_pointers[$this->_name];
$this->pointers[$this->name] = --$this->pointers[$this->name];
return $this;
}

Expand All @@ -175,10 +175,10 @@ public function prev()
*/
public function key()
{
if ($this->_pointers[$this->_name] < 0)
if ($this->pointers[$this->name] < 0)
return 0;
else
return $this->_pointers[$this->_name];
return $this->pointers[$this->name];
}

/**
Expand All @@ -188,7 +188,7 @@ public function key()
*/
public function rewind()
{
$this->_pointers[$this->_name] = -1;
$this->pointers[$this->name] = -1;
return $this;
}

Expand All @@ -199,7 +199,7 @@ public function rewind()
*/
public function valid()
{
return isset($this->_data[$this->_name][$this->key()]);
return isset($this->data[$this->name][$this->key()]);
}

/**
Expand All @@ -209,6 +209,6 @@ public function valid()
*/
public function current()
{
return $this->_data[$this->_name][$this->key()];
return $this->data[$this->name][$this->key()];
}
}
6 changes: 3 additions & 3 deletions src/Helper/DeclareVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public function __invoke()
foreach($args as $key) {
if (is_array($key)) {
foreach ($key as $name => $value) {
$this->_declareVar($name, $value);
$this->declareVar($name, $value);
}
} elseif (!isset($view->vars()->$key)) {
$this->_declareVar($key);
$this->declareVar($key);
}
}
}
Expand All @@ -72,7 +72,7 @@ public function __invoke()
* @param string $value Defaults to an empty string
* @return void
*/
protected function _declareVar($key, $value = '')
protected function declareVar($key, $value = '')
{
$view = $this->getView();
$vars = $view->vars();
Expand Down
2 changes: 1 addition & 1 deletion src/Helper/Gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ public function getImgTag()
{
$this->setSrcAttribForImg();
$html = '<img'
. $this->_htmlAttribs($this->getAttribs())
. $this->htmlAttribs($this->getAttribs())
. $this->getClosingBracket();

return $html;
Expand Down
28 changes: 14 additions & 14 deletions src/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ class HeadLink extends Placeholder\Container\AbstractStandalone
*
* @var array
*/
protected $_itemKeys = array('charset', 'href', 'hreflang', 'id', 'media', 'rel', 'rev', 'type', 'title', 'extras');
protected $itemKeys = array('charset', 'href', 'hreflang', 'id', 'media', 'rel', 'rev', 'type', 'title', 'extras');

/**
* @var string registry key
*/
protected $_regKey = 'Zend_View_Helper_HeadLink';
protected $regKey = 'Zend_View_Helper_HeadLink';

/**
* Constructor
Expand Down Expand Up @@ -160,15 +160,15 @@ public function __call($method, $args)
* @param mixed $value
* @return boolean
*/
protected function _isValid($value)
protected function isValid($value)
{
if (!$value instanceof \stdClass) {
return false;
}

$vars = get_object_vars($value);
$keys = array_keys($vars);
$intersection = array_intersect($this->_itemKeys, $keys);
$intersection = array_intersect($this->itemKeys, $keys);
if (empty($intersection)) {
return false;
}
Expand All @@ -185,7 +185,7 @@ protected function _isValid($value)
*/
public function append($value)
{
if (!$this->_isValid($value)) {
if (!$this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'append() expects a data token; please use one of the custom append*() methods'
);
Expand All @@ -204,7 +204,7 @@ public function append($value)
*/
public function offsetSet($index, $value)
{
if (!$this->_isValid($value)) {
if (!$this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'offsetSet() expects a data token; please use one of the custom offsetSet*() methods'
);
Expand All @@ -222,7 +222,7 @@ public function offsetSet($index, $value)
*/
public function prepend($value)
{
if (!$this->_isValid($value)) {
if (!$this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'prepend() expects a data token; please use one of the custom prepend*() methods'
);
Expand All @@ -240,7 +240,7 @@ public function prepend($value)
*/
public function set($value)
{
if (!$this->_isValid($value)) {
if (!$this->isValid($value)) {
throw new Exception\InvalidArgumentException(
'set() expects a data token; please use one of the custom set*() methods'
);
Expand All @@ -261,14 +261,14 @@ public function itemToString(\stdClass $item)
$attributes = (array) $item;
$link = '<link ';

foreach ($this->_itemKeys as $itemKey) {
foreach ($this->itemKeys as $itemKey) {
if (isset($attributes[$itemKey])) {
if(is_array($attributes[$itemKey])) {
foreach($attributes[$itemKey] as $key => $value) {
$link .= sprintf('%s="%s" ', $key, ($this->_autoEscape) ? $this->_escape($value) : $value);
$link .= sprintf('%s="%s" ', $key, ($this->autoEscape) ? $this->escape($value) : $value);
}
} else {
$link .= sprintf('%s="%s" ', $itemKey, ($this->_autoEscape) ? $this->_escape($attributes[$itemKey]) : $attributes[$itemKey]);
$link .= sprintf('%s="%s" ', $itemKey, ($this->autoEscape) ? $this->escape($attributes[$itemKey]) : $attributes[$itemKey]);
}
}
}
Expand Down Expand Up @@ -311,7 +311,7 @@ public function toString($indent = null)
$items[] = $this->itemToString($item);
}

return $indent . implode($this->_escape($this->getSeparator()) . $indent, $items);
return $indent . implode($this->escape($this->getSeparator()) . $indent, $items);
}

/**
Expand Down Expand Up @@ -340,7 +340,7 @@ public function createDataStylesheet(array $args)
$conditionalStylesheet = false;
$href = array_shift($args);

if ($this->_isDuplicateStylesheet($href)) {
if ($this->isDuplicateStylesheet($href)) {
return false;
}

Expand Down Expand Up @@ -376,7 +376,7 @@ public function createDataStylesheet(array $args)
* @param string $uri
* @return bool
*/
protected function _isDuplicateStylesheet($uri)
protected function isDuplicateStylesheet($uri)
{
foreach ($this->getContainer() as $item) {
if (($item->rel == 'stylesheet') && ($item->href == $uri)) {
Expand Down
Loading

0 comments on commit b35fa7a

Please sign in to comment.