Fix class naming calls

This commit is contained in:
Deon George 2013-03-23 07:37:04 +11:00
parent f2816dd902
commit 9d4b2f50ff
11 changed files with 10 additions and 10 deletions

View File

@ -29,7 +29,7 @@ class Controller_Admin_Module extends Controller_TemplateDefault_Admin {
array_unshift($classes,''); array_unshift($classes,'');
foreach ($classes as $c) { foreach ($classes as $c) {
$cn = sprintf($ch,$c ? ucfirst($c).'_'.ucfirst($class) : $class); $cn = Kohana::classname('Controller_'.$c ? $c.'_'.$class : $class);
if (class_exists($cn)) { if (class_exists($cn)) {
$r = new ReflectionClass($cn); $r = new ReflectionClass($cn);

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Product_Plugin_ADSL extends Model_Product_Plugin { class Model_Product_Plugin_Adsl extends Model_Product_Plugin {
protected $_table_name = 'adsl_plan'; protected $_table_name = 'adsl_plan';
protected $_belongs_to = array( protected $_belongs_to = array(

View File

@ -50,7 +50,7 @@ class Service_Traffic_Adsl {
* @return HeadImage * @return HeadImage
*/ */
public static function instance($supplier) { public static function instance($supplier) {
$sc = sprintf('%s_%s',get_called_class(),ucwords(strtolower($supplier))); $sc = Kohana::classname(get_called_class().'_'.$supplier);
if (! class_exists($sc)) if (! class_exists($sc))
throw new Kohana_Exception('Class doesnt exist for :supplier',array(':supplier'=>$supplier)); throw new Kohana_Exception('Class doesnt exist for :supplier',array(':supplier'=>$supplier));

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Model_Product_Plugin_DOMAIN extends Model_Product_Plugin { class Model_Product_Plugin_Domain extends Model_Product_Plugin {
// This model doesnt have a database table // This model doesnt have a database table
public function __construct() { public function __construct() {
} }

View File

@ -23,7 +23,7 @@ class Controller_Affiliate_Export extends Controller_TemplateDefault_Affiliate {
if (empty($_POST['plugin'])) if (empty($_POST['plugin']))
$this->request->redirect('affiliate/export/index'); $this->request->redirect('affiliate/export/index');
$sc = sprintf('Export_%s',ucfirst($_POST['plugin'])); $sc = Kohana::classname('Export_'.$_POST['plugin']);
if (! class_exists($sc)) if (! class_exists($sc))
throw new Kohana_Exception('Export Class doesnt exist for :plugin',array(':plugin'=>$_POST['plugin'])); throw new Kohana_Exception('Export Class doesnt exist for :plugin',array(':plugin'=>$_POST['plugin']));
else else

View File

@ -21,7 +21,7 @@ class Model_Host_Server extends ORM_OSB {
* Return the object of the product plugin * Return the object of the product plugin
*/ */
public function plugin($type='') { public function plugin($type='') {
$c = sprintf('Host_Plugin_%s',ucfirst(strtolower($this->provision_plugin))); $c = Kohana::classname('Host_Plugin_'.$this->provision_plugin);
if (! $this->provision_plugin OR ! class_exists($c)) if (! $this->provision_plugin OR ! class_exists($c))
return NULL; return NULL;

View File

@ -93,7 +93,7 @@ SELECT i.id AS iid,i.due_date AS due FROM ab_invoice i,ab_invoice_item ii WHERE
* Generate a PDF invoice * Generate a PDF invoice
*/ */
public function pdf() { public function pdf() {
$invoice_class = sprintf('Invoice_TCPDF_%s',ucfirst(Kohana::$config->load('invoice')->driver)); $invoice_class = Kohana::classname('Invoice_TCPDF_'.Kohana::$config->load('invoice')->driver);
$pdf = new $invoice_class($this->io); $pdf = new $invoice_class($this->io);

View File

@ -9,7 +9,7 @@
* @copyright (c) 2009-2013 Open Source Billing * @copyright (c) 2009-2013 Open Source Billing
* @license http://dev.osbill.net/license.html * @license http://dev.osbill.net/license.html
*/ */
class Invoice_TCPDF_Default extends Invoice_TCPDF { class Invoice_TCPDF_Default extends Invoice_Tcpdf {
// Current line being printed // Current line being printed
public $sum_y = 0; public $sum_y = 0;

View File

@ -90,7 +90,7 @@ class Model_Product extends ORM_OSB {
if (! is_numeric($this->prod_plugin_data)) if (! is_numeric($this->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->id,':type'=>$this->prod_plugin_file)); throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->id,':type'=>$this->prod_plugin_file));
return ORM::factory(sprintf('Product_Plugin_%s',$this->prod_plugin_file),$this->prod_plugin_data); return ORM::factory(Kohana::classname(sprintf('Product_Plugin_%s',$this->prod_plugin_file)),$this->prod_plugin_data);
} }
/** /**

View File

@ -56,7 +56,7 @@ class Model_Service extends ORM_OSB {
if (! is_numeric($this->product->prod_plugin_data)) if (! is_numeric($this->product->prod_plugin_data))
throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file)); throw new Kohana_Exception('Missing plugin_id for :product (:type)',array(':product'=>$this->product->id,':type'=>$this->product->prod_plugin_file));
$o = ORM::factory(sprintf('Service_Plugin_%s',ucwords(strtolower($this->product->prod_plugin_file))),array('service_id'=>$this->id)); $o = ORM::factory(Kohana::classname(sprintf('Service_Plugin_%s',$this->product->prod_plugin_file)),array('service_id'=>$this->id));
return $type ? $o->$type : $o; return $type ? $o->$type : $o;
} }