Skip to content

Instantly share code, notes, and snippets.

View dragoonis's full-sized avatar

Paul Dragoonis dragoonis

View GitHub Profile
<?php
// -------------- Library Autoloading Process --------------
if(!empty($this->_config->system->autoloadLibs)) {
foreach(explode(',', $this->_config->system->autoloadLibs) as $sLib) {
switch(strtolower($sLib)) {
case 'zf':
PPI_Autoload::add('Zend', array(
'path' => SYSTEMPATH . 'Vendor/',
<?php
static function getCache($p_mOptions = null) {
switch(true) {
case is_array($p_mOptions):
return new PPI_Cache($p_mOptions);
break;
case is_null($p_mOptions) || ($bIsString = is_string($p_mOptions)):
<?php
static function getCache($p_mOptions = null)
{
if (!is_array($p_mOptions)) {
$config = self::getConfig();
$options = isset($config->cache) ? $config->cache->toArray() : array();
if (is_string($p_mOptions)) {
$options['handler'] = $p_mOptions;
}
$p_mOptions = $options;
<?php
static function getCache($p_mOptions = null) {
if (!is_array($p_mOptions)) {
$config = self::getConfig();
$options = isset($config->cache) ? $config->cache->toArray() : array();
if (is_string($p_mOptions) && $p_mOptions !== '') {
$options['handler'] = $p_mOptions;
}
$p_mOptions = $options;
}
<?php
/**
*
* @version 1.0
* @author Paul Dragoonis <dragoonis@php.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Digiflex Development
* @package Cache
*/
<?php
if($enquiry['Deleted'] == 0) {
if($enquiry['Status'] == 'Replied') {
$this->page->replace['notificationMessage'] = '<div class="ems-success">This enquiry has been replied to.</div>';
} elseif($enquiry['Status'] == 'Escalated') {
$this->page->replace['notificationMessage'] = '<div class="ems-error">This enquiry has not been actioned and as a result has been escalated.</div>';
} elseif($enquiry['Status'] == 'New') {
$this->page->replace['notificationMessage'] = '<div class="ems-warning">This enquiry has not yet been actioned.</div>';
<?php
function compare() {
$sLevel = $this->get(__FUNCTION__, '');
$iCatID = $this->get($sLevel, 0);
if(empty($sLevel)) {
throw new PPI_Exception('Unable to locate compare function\'s category level.');
}
if(empty($iCatID) || $iCatID < 1) {
throw new PPI_Exception('Unable to locate category ID');
<?php
// Do we have attachments ?
if($attachment !== null) {
// If its a singular string based attachment we convert it to conform with the generic attachment structure
if(!is_array($attachment)) {
$attachment = (array) $attachment;
}
// Attach all of our attachments
<?php
/**
* Obtain a url segments value pair by specifying the key.
* eg: /key/val/key2/val2 - by specifying key, you get val, by specifying key2, you get val2.
* @param string $p_sIndex The specified key
* @param string $p_sDefaultValue The default value to return in the situation that the key or subsequent value was not found.
* @return mixed (Can be user defined)
*/
function get($p_sIndex, $p_sDefaultValue = "") {
$tmp = array();
<?php
/**
* Obtain a url segments value pair by specifying the key.
* eg: /key/val/key2/val2 - by specifying key, you get val, by specifying key2, you get val2.
* @param string $p_sIndex The specified key
* @param string $p_sDefaultValue The default value to return in the situation that the key or subsequent value was not found.
* @return mixed (Can be user defined)
*/
function get($p_sIndex, $p_sDefaultValue = "") {
$tmp = array();