/**
  * method must be called after preflight
  * Sets the paths and loads VMFramework config
  */
 public function loadVm()
 {
     // 			$this->path = JInstaller::getInstance()->getPath('extension_administrator');
     if (empty($this->path)) {
         $this->path = VMPATH_ADMIN;
     }
     if (!class_exists('tsmConfig')) {
         require_once $this->path . '/helpers/config.php';
     }
     tsmConfig::loadConfig(false, true);
     if (!class_exists('tsmTable')) {
         require_once $this->path . '/helpers/tsmtable.php';
     }
     if (!class_exists('tmsModel')) {
         require_once $this->path . '/helpers/tsmmodel.php';
     }
     tsmTable::addIncludePath($this->path . DS . 'tables');
     tmsModel::addIncludePath($this->path . DS . 'models');
 }
Exemple #2
0
 /**
  * Static method to get an instance of a JTable class if it can be found in
  * the table include paths.  To add include paths for searching for JTable
  * classes @see JTable::addIncludePath().
  *
  * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
  * @param   string  $type    The type (name) of the JTable class to get an instance of.
  * @param   string  $prefix  An optional prefix for the table class name.
  * @param   array   $config  An optional array of configuration values for the JTable object.
  *
  * @return  mixed    A JTable object if found or boolean false if one could not be found.
  *
  * @link	http://docs.joomla.org/JTable/getInstance
  * @since   11.1
  */
 public static function getInstance($type, $prefix = 'VmTable', $config = array())
 {
     // Sanitize and prepare the table class name.
     $type = preg_replace('/[^A-Z0-9_\\.-]/i', '', $type);
     $tableClass = $prefix . ucfirst($type);
     // Only try to load the class if it doesn't already exist.
     if (!class_exists($tableClass)) {
         // Search for the class file in the JTable include paths.
         jimport('joomla.filesystem.path');
         $paths = tsmTable::addIncludePath();
         $pathIndex = 0;
         while (!class_exists($tableClass) && $pathIndex < count($paths)) {
             if ($tryThis = JPath::find($paths[$pathIndex++], strtolower($type) . '.php')) {
                 // Import the class file.
                 include_once $tryThis;
             }
         }
         if (!class_exists($tableClass)) {
             vmdebug('Did not find file in ', $paths, $tryThis);
             return false;
         }
     }
     // If a database object was passed in the configuration array use it, otherwise get the global one from JFactory.
     $db = isset($config['dbo']) ? $config['dbo'] : JFactory::getDbo();
     // Instantiate a new table class and return it.
     return new $tableClass($db);
 }
Exemple #3
0
defined('JPATH_VM_SITE') or define('JPATH_VM_SITE', VMPATH_SITE);
defined('JPATH_VM_ADMINISTRATOR') or define('JPATH_VM_ADMINISTRATOR', VMPATH_ADMIN);
// define( 'VMPATH_ADMIN', JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_tsmart' );
define('JPATH_VM_PLUGINS', VMPATH_PLUGINLIBS);
define('JPATH_VM_MODULES', VMPATH_MODULES);
defined('VM_VERSION') or define('VM_VERSION', 3);
//This number is for obstruction, similar to the prefix jos_ of joomla it should be avoided
//to use the standard 7, choose something else between 1 and 99, it is added to the ordernumber as counter
// and must not be lowered.
defined('VM_ORDER_OFFSET') or define('VM_ORDER_OFFSET', 3);
require VMPATH_ADMIN . DS . 'version.php';
defined('VM_REV') or define('VM_REV', vmVersion::$REVISION);
if (!class_exists('tsmTable')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmtable.php';
}
tsmTable::addIncludePath(VMPATH_ADMIN . DS . 'tables');
if (!class_exists('tmsModel')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmmodel.php';
}
if (!class_exists('vRequest')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'vrequest.php';
}
if (!class_exists('tsmText')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmtext.php';
}
if (!class_exists('vmJsApi')) {
    require VMPATH_ADMIN . DS . 'helpers' . DS . 'tsmjsapi.php';
}
/**
 * Where type can be one of
 * 'warning' - yellow
Exemple #4
0
 /**
  * Adds to the stack of model table paths in LIFO order.
  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  * @license     GNU General Public License version 2 or later; see LICENSE
  *
  * @param   mixed  $path  The directory as a string or directories as an array to add.
  *
  * @return  void
  *
  * @since   12.2
  */
 public static function addTablePath($path)
 {
     tsmTable::addIncludePath($path);
 }