Skip to content

Commit

Permalink
Prefix constants, main controller and model to prevent conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
PabloVallejo committed Oct 14, 2013
1 parent c0d8e1c commit 51e0479
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions application/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
/**
* Path for the helpers folder
*/
define( 'HELPERS_PATH', APP_PATH . 'helpers/' );
define( 'WP_BLADE_HELPERS_PATH', WP_BLADE_APP_PATH . 'helpers/' );

/**
* Path for the models
*/
define( 'MODELS_PATH', APP_PATH . 'models/' );
define( 'WP_BLADE_MODELS_PATH', WP_BLADE_APP_PATH . 'models/' );

/**
* Path for the controllers
*/
define( 'CONTROLLERS_PATH', APP_PATH . 'controllers/' );
define( 'WP_BLADE_CONTROLLERS_PATH', WP_BLADE_APP_PATH . 'controllers/' );

/**
* Path for views
*/
define( 'VIEWS_PATH', APP_PATH . 'views/' );
define( 'WP_BLADE_VIEWS_PATH', WP_BLADE_APP_PATH . 'views/' );

/**
* Storage path
Expand Down
10 changes: 5 additions & 5 deletions application/config/initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
$config = array( 'constants' );

foreach ( $config as $filename )
require_once ( CONFIG_PATH . $filename . '.php' );
require_once ( WP_BLADE_CONFIG_PATH . $filename . '.php' );


/*
Expand All @@ -47,7 +47,7 @@
$libraries = array( 'laravel/blade', 'laravel/section', 'laravel/view', 'laravel/event' );

foreach ( $libraries as $filename )
require_once( LIBRARIES_PATH . $filename . '.php' );
require_once( WP_BLADE_LIBRARIES_PATH . $filename . '.php' );


/*
Expand All @@ -62,7 +62,7 @@
$helpers = array( 'wp-blade', 'helpers' );

foreach ( $helpers as $filename )
require_once( HELPERS_PATH . $filename . '.php' );
require_once( WP_BLADE_HELPERS_PATH . $filename . '.php' );


/*
Expand All @@ -78,7 +78,7 @@
$models = array( 'main-model' );

foreach ( $models as $filename )
require_once ( MODELS_PATH . $filename . '.php' );
require_once ( WP_BLADE_MODELS_PATH . $filename . '.php' );

/*
|---------------------------------------------------------------------------
Expand All @@ -93,4 +93,4 @@
$controllers = array( 'main-controller' );

foreach ( $controllers as $filename )
require_once ( CONTROLLERS_PATH . $filename . '.php' );
require_once ( WP_BLADE_CONTROLLERS_PATH . $filename . '.php' );
4 changes: 2 additions & 2 deletions application/controllers/main-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Main controller
*/
class Main_Controller {
class WP_Blade_Main_Controller {

/**
* Main model
Expand All @@ -21,7 +21,7 @@ class Main_Controller {
function __construct() {

// Instantiate main model
$this->main_model = new Main_Model();
$this->main_model = new WP_Blade_Main_Model();

// Globalize "blade_storage_path"
$GLOBALS[ 'blade_storage_path' ] = BLADE_STORAGE_PATH;
Expand Down
4 changes: 2 additions & 2 deletions application/models/main-model.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Main model
*/
class Main_Model {
class WP_Blade_Main_Model {

/**
* Return a new class instance
Expand Down Expand Up @@ -37,7 +37,7 @@ public function template_include_blade( $template ) {
if( ! $template )
return $template; // Noting to do here. Come back later.

require_once( CONFIG_PATH . 'paths.php' );
require_once( WP_BLADE_CONFIG_PATH . 'paths.php' );

Laravel\Blade::sharpen();
$view = Laravel\View::make( 'path: ' . $template, array() );
Expand Down
12 changes: 6 additions & 6 deletions blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
/**
* Path for the application foler inside the theme
*/
define( 'APP_PATH', WP_BLADE_ROOT . 'application/' );
define( 'WP_BLADE_APP_PATH', WP_BLADE_ROOT . 'application/' );

/**
* Path of assets
*/
define( 'ASSETS_PATH', WP_BLADE_ROOT . 'assets/' );
define( 'WP_BLADE_ASSETS_PATH', WP_BLADE_ROOT . 'assets/' );

/**
* Path for the config folder
*/
define( 'CONFIG_PATH', APP_PATH . 'config/' );
define( 'WP_BLADE_CONFIG_PATH', WP_BLADE_APP_PATH . 'config/' );

/**
* Path for libraries
*/
define( 'LIBRARIES_PATH', APP_PATH . 'lib/' );
define( 'WP_BLADE_LIBRARIES_PATH', WP_BLADE_APP_PATH . 'lib/' );

/*
|-------------------------------------------------------------------------
Expand All @@ -68,5 +68,5 @@
| After that, instanciate the main controller which will add actions and the like.
*/

require_once ( CONFIG_PATH . '/initialize.php' );
Main_Controller::make();
require_once ( WP_BLADE_CONFIG_PATH . '/initialize.php' );
WP_Blade_Main_Controller::make();

0 comments on commit 51e0479

Please sign in to comment.