/home/forge/bondit.staging.testing.pm/src/PMCOM/Core/Database.php
$run = new \Whoops\Run;
$handler = new \PMCOM\Core\PurposeHandler;
$handler->addDataTable( 'Database Query Error', array(
'Error' => $error,
'Query' => $query
));
$run->pushHandler($handler);
$run->register();
Throw new \Exception( 'Database error: Please check the "Database Query Error" details below' );
}
/**
* [exists description]
* @param [type] $table [description]
* @param array $perams [description]
* @return [type] [description]
*/
function exists( $table, $perams = array() )
{
/home/forge/bondit.staging.testing.pm/src/PMCOM/Core/Database.php
* Execute a standard sql query to return one result
*
* @param string $query sql query
* @return array of objects
*/
function query_unique($query)
{
$query .= ' LIMIT 1';
if( ! $this->lastResult = self::$instance->query( $query ) ) {
self::died( self::$instance->error, $query );
}
if ( $this->lastResult->num_rows > 0 ) return $this->lastResult->fetch_object();
}
/**
* Get a subset of all items
*
* @param string $table The value of the table
* @param array $args values to filter by
* @return array of objects
/home/forge/bondit.staging.testing.pm/src/PMCOM/Front/Product.php
*
* @param string $slug
* @return boolen
*/
function exists($slug)
{
$site_id = SITE;
$product = $this->database->query_unique("SELECT products.*, product_sites.name as site_name
FROM product_sites INNER JOIN products ON product_sites.product_id = products.id
WHERE site_id = $site_id AND status = 1 AND (products.slug = '$slug' OR product_sites.slug = '$slug') GROUP By products.id ORDER BY products.sort ASC");
$prod = new STDclass();
if( $product ) {
$prod->has_stock = $product->unlimited_stock == 1 ? 1 : $this->check_stock($product->id);
if( $prod->has_stock || ( ! $prod->has_stock && $product->display_not_in_stock ) ) {
return TRUE;
} else {
return FALSE;
}
} else {
/home/forge/bondit.staging.testing.pm/src/PMCOM/Core/Router.php
$method = array_reverse( $segments )[0];
} elseif( $method === 'index' ) {
$method = $class;
}
foreach( $controllers as $controller ) :
try {
$routed = $this->container->get( $controller );
if( $routed->exists( $method ) ) :
die( $routed->view( $method ) );
endif;
} catch( \Orno\Di\Exception\ReflectionException $e ) {}
endforeach;
endif;
endif;
// Show 404
die( call_user_func_array( array( $this->container->get( 'PMCOM\Core\View' ), '_show404' ), $segments ) );
}
/home/forge/bondit.staging.testing.pm/src/PMCOM/Core/Router.php
* @return [type] [description]
*/
public static function __callStatic( $method, $parameters )
{
if( is_null( static::$instance ) )
{
static::$instance = new Router();
}
return call_user_func_array( array( static::$instance, '_' . $method ), $parameters );
}
}
/home/forge/bondit.staging.testing.pm/src/PMCOM/Core/Router.php
* @return [type] [description]
*/
public static function __callStatic( $method, $parameters )
{
if( is_null( static::$instance ) )
{
static::$instance = new Router();
}
return call_user_func_array( array( static::$instance, '_' . $method ), $parameters );
}
}
/home/forge/bondit.staging.testing.pm/index.php
|---------------------------------------------------------------
| LOAD THE ROUTES CLASS
|---------------------------------------------------------------
|
| And away we go...
|
*/
if( ! $disableRouter ) {
PMCOM\Core\Router::get_route( $container );
} else {
PMCOM\Core\Router::setContainer( $container );
}