Edit File by line
/home/barbar84/www/wp-conte.../plugins/ninja-fo.../deprecat.../includes
File: stack.class.php
<?php if ( ! defined( 'ABSPATH' ) ) exit;
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Basic Stack Class
[3] Fix | Delete
*
[4] Fix | Delete
* Created for use with eqEOS. May eventually be replaced with native
[5] Fix | Delete
* PHP functions `array_pop()`, `array_push()`, and `end()`
[6] Fix | Delete
*
[7] Fix | Delete
* @author Jon Lawrence <jlawrence11@gmail.com>
[8] Fix | Delete
* @copyright Copyright �2005-2013 Jon Lawrence
[9] Fix | Delete
* @license http://opensource.org/licenses/LGPL-2.1 LGPL 2.1 License
[10] Fix | Delete
* @package eos.class.php
[11] Fix | Delete
* @version 2.0
[12] Fix | Delete
*/
[13] Fix | Delete
class phpStack {
[14] Fix | Delete
private $index;
[15] Fix | Delete
private $locArray;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Constructor
[19] Fix | Delete
*
[20] Fix | Delete
* Initializes the stack
[21] Fix | Delete
*/
[22] Fix | Delete
public function __construct() {
[23] Fix | Delete
//define the private vars
[24] Fix | Delete
$this->locArray = array();
[25] Fix | Delete
$this->index = -1;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
/**
[29] Fix | Delete
* Peek
[30] Fix | Delete
*
[31] Fix | Delete
* Will view the last element of the stack without removing it
[32] Fix | Delete
*
[33] Fix | Delete
* @return Mixed An element of the array or false if none exist
[34] Fix | Delete
*/
[35] Fix | Delete
public function peek() {
[36] Fix | Delete
if($this->index > -1)
[37] Fix | Delete
return $this->locArray[$this->index];
[38] Fix | Delete
else
[39] Fix | Delete
return false;
[40] Fix | Delete
}
[41] Fix | Delete
[42] Fix | Delete
/**
[43] Fix | Delete
* Poke
[44] Fix | Delete
*
[45] Fix | Delete
* Will add an element to the end of the stack
[46] Fix | Delete
*
[47] Fix | Delete
* @param Mixed Element to add
[48] Fix | Delete
*/
[49] Fix | Delete
public function poke($data) {
[50] Fix | Delete
$this->locArray[++$this->index] = $data;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* Push
[55] Fix | Delete
*
[56] Fix | Delete
* Alias of {@see phpStack::poke()}
[57] Fix | Delete
* Adds element to the stack
[58] Fix | Delete
*
[59] Fix | Delete
* @param Mixed Element to add
[60] Fix | Delete
*/
[61] Fix | Delete
public function push($data) {
[62] Fix | Delete
//allias for 'poke'
[63] Fix | Delete
$this->poke($data);
[64] Fix | Delete
}
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* Pop
[68] Fix | Delete
*
[69] Fix | Delete
* Retrives an element from the end of the stack, and removes it from
[70] Fix | Delete
* the stack at the same time. If no elements, returns boolean false
[71] Fix | Delete
*
[72] Fix | Delete
* @return Mixed Element at end of stack or false if none exist
[73] Fix | Delete
*/
[74] Fix | Delete
public function pop() {
[75] Fix | Delete
if($this->index > -1)
[76] Fix | Delete
{
[77] Fix | Delete
$this->index--;
[78] Fix | Delete
return $this->locArray[$this->index+1];
[79] Fix | Delete
}
[80] Fix | Delete
else
[81] Fix | Delete
return false;
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
/**
[85] Fix | Delete
* Clear
[86] Fix | Delete
*
[87] Fix | Delete
* Clears the stack to be reused.
[88] Fix | Delete
*/
[89] Fix | Delete
public function clear() {
[90] Fix | Delete
$this->index = -1;
[91] Fix | Delete
$this->locArray = array();
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* Get Stack
[96] Fix | Delete
*
[97] Fix | Delete
* Returns the array of stack elements, keeping all, indexed at 0
[98] Fix | Delete
*
[99] Fix | Delete
* @return Mixed Array of stack elements or false if none exist.
[100] Fix | Delete
*/
[101] Fix | Delete
public function getStack() {
[102] Fix | Delete
if($this->index > -1)
[103] Fix | Delete
{
[104] Fix | Delete
return array_values($this->locArray);
[105] Fix | Delete
}
[106] Fix | Delete
else
[107] Fix | Delete
return false;
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
?>
[112] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function