Skip to content

Instantly share code, notes, and snippets.

View dragoonis's full-sized avatar

Paul Dragoonis dragoonis

View GitHub Profile
<?php
public function getRenderVars() {
$requestMethod = strtolower($this->getRequestMethod());
$isVars = array();
foreach(array('post', 'get', 'head', 'delete', 'put') as $method) {
$isVars[$method] = $requestMethod === $method;
}
$isVars['ajax'] = $this->is('ajax');
$isVars['https'] = $isVars['ssl'] = $this->is('https');
return array(
<?php
/**
* The Environment Options for the PPI Application
*
* @var array
*/
protected $_envOptions = array(
'siteMode' => 'development', // This determines how PPI handles things like exceptions
'configBlock' => 'development' // The block in the config file to get the config data from
);
<?php
$this->_config = new PPI_Config(array(
'configBlock' => $this->getEnv('configBlock'),
'configFile' => $this->getEnv('configFile'),
'cacheConfig' => $this->getEnv('cacheConfig', false),
'cacheConfigPath' => $this->getEnv('cacheConfigPath', '')
));
<?php
require_once '../ppi-framework/init.php';
$app = new PPI_App();
$app->boot()->dispatch();
<?php
require_once '../ppi-framework/init.php';
$app = new PPI_App();
$app->siteMode = 'production';
$app->cacheConfig = true;
$app->configCachePath = APPFOLDER . 'Cache/Config/';
$app->setRouter(new APP_General_Router());
$app->boot()->dispatch();
<?php
$this->charset = strtolower($bIsCharsetOverride ? $oConfig->db->charset : 'utf8');
if(version_compare(PHP_VERSION, '5.3.6', '<')) {
$connectParams[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $this->charset;
}
$this->rHandler = new PDO($this->makeDSN(), $this->sUserName, $this->sPassword, $connectParams);
public function makeDSN() {
SELECT p.*, u.first_name, u.last_name,
(SELECT count(*) from ppi_blog_comment WHERE post_id = ppi_blog.id) num_comments
FROM ppi_blog p
LEFT JOIN users u ON u.id = p.user_id
WHERE (published = 1)
ORDER BY created DESC
<?php
require_once '../ppi-framework/init.php';
$app = new PPI_App();
$app->siteMode = 'development';
$app->configBlock = 'development';
$app->router = new PPI_Router();
$app->boot();
var_dump(new Solar_View()); exit;
<?php
/**
* Unit test for PPI Session
*
* @package Core
* @author Paul Dragoonis <[email protected]>
* @license http://opensource.org/licenses/mit-license.php MIT
* @link http://www.ppiframework.com
*/
class PPI_SessionTest extends PHPUnit_Framework_TestCase {
<?php
Environment::is(function($request) {
if ($request->env('HTTP_HOST') == 'localhost') {
return 'development';
}
if ($request->env('HTTP_HOST') == 'staging.server') {
return 'test';
}
return 'production';
});