Ejemplo n.º 1
0
 /**
  * Create an instance of the specified class
  * 
  * This method is internally called by 'create' to create classes instances.
  * It can also be used by local factories.
  */
 function &createInstanceOf($class, $options = null, $args = null)
 {
     $inst = false;
     if (!class_exists($class)) {
         trigger_error("Unknown class {$class}", E_USER_WARNING);
         return $inst;
     }
     $inst =& new $class();
     if (is_object($inst)) {
         // Set specified properties values
         XOS::apply($inst, $options);
         XOS::apply($inst, $GLOBALS[EXXOS]->registry[$class]);
         $inst->xoBundleIdentifier = $class;
         // Initialize the component instance
         if (method_exists($inst, 'xoInit')) {
             if (!$inst->xoInit($options)) {
                 return $inst;
             }
         }
         return $inst;
     }
     return $inst;
 }
Ejemplo n.º 2
0
 function xoInit($options = array())
 {
     global $xoops;
     $this->path = $xoops->path('/themes/' . $this->folderName);
     $this->template =& XOS::create('xoops_template_Smarty');
     $this->template->currentTheme =& $this;
     $this->template->compile_id = $this->folderName;
     if ($info = @(include "{$this->path}/xo-info.php")) {
         XOS::apply($this, $info);
     } else {
         $this->themeAPI = '2.0';
         $this->parentTheme = $this->folderName == 'xoops20' ? '' : 'xoops20';
     }
     if ($this->bufferOutput) {
         ob_start();
     }
     // Instanciate and initialize all the theme plugins
     foreach ($this->plugins as $k => $bundleId) {
         $this->plugins[$k] =& XOS::create($bundleId, array('theme' => &$this));
     }
     return true;
 }
Ejemplo n.º 3
0
 function xoops_kernel_Xoops2($hostId, $hostVars)
 {
     $GLOBALS['xoops'] =& $this;
     $GLOBALS['exxos']->pathHandler =& $this;
     $this->hostId = $hostId;
     XOS::apply($this, $hostVars);
     if ($this->xoRunMode & XO_MODE_DEV_MASK) {
         $this->errorReporting |= E_ALL;
     }
     //error_reporting(E_ALL);
     $this->activateErrorHandler(true);
     $this->loadRegistry();
     $this->services =& $GLOBALS['exxos']->services;
     $captures = @(include $this->path('var/Application Support/xoops_kernel_Xoops2/services.php'));
     if (is_array($captures)) {
         $this->captures = array_merge($this->captures, $captures);
     }
     $this->bootFile = str_replace(array('/', '\\'), '', $this->bootFile);
     // Might be useless check, but this one won't hurt
     $this->baseLocation = $this->isSecure ? $this->secureLocation : $this->hostLocation;
     if (false !== ($pos = strpos($this->baseLocation, '/'))) {
         $this->baseLocation = substr($this->baseLocation, $pos);
     } else {
         $this->baseLocation = '';
     }
     //$this->services['logger'] = $this->services['errorhandler'] = $this;
 }
Ejemplo n.º 4
0
 function xoops_kernel_Xoops2($hostId, $hostVars)
 {
     $GLOBALS['xoops'] =& $this;
     $this->pathHandler =& $this;
     $this->hostId = $hostId;
     XOS::apply($this, $hostVars);
     if (@$GLOBALS['xoPreventDevMode']) {
         $this->xoRunMode = 0;
     }
     // Enable error reporting by default in development mode, enable it otherwise
     error_reporting($this->xoRunMode == XO_MODE_DEV ? E_ALL : 0);
     $this->loadRegistry();
     //$this->services =& $GLOBALS['exxos']->services;
     $captures = @(include $this->path('var/Application Support/xoops_kernel_Xoops2/services.php'));
     if (is_array($captures)) {
         $this->captures = array_merge($this->captures, $captures);
     }
     $this->bootFile = str_replace(array('/', '\\'), '', $this->bootFile);
     // Might be useless check, but this one won't hurt
     $this->baseLocation = $this->isSecure ? $this->secureLocation : $this->hostLocation;
     if (false !== ($pos = strpos($this->baseLocation, '/'))) {
         $this->hostName = substr($this->baseLocation, 0, $pos);
         $this->baseLocation = substr($this->baseLocation, $pos);
     } else {
         $this->hostName = $this->baseLocation;
         $this->baseLocation = '';
     }
 }
Ejemplo n.º 5
0
 function fetch($mode = null, $orientation = null, $offset = null)
 {
     if (!$this->result) {
         return false;
     }
     if (!$mode) {
         $mode = $this->fetchMode;
     }
     switch ($mode) {
         case PDO_FETCH_ASSOC:
             return mysql_fetch_array($this->result, MYSQL_ASSOC);
         case PDO_FETCH_BOTH:
             return mysql_fetch_array($this->result, MYSQL_BOTH);
         case PDO_FETCH_NUM:
             return mysql_fetch_array($this->result, MYSQL_NUM);
         case PDO_FETCH_LAZY:
         case PDO_FETCH_OBJ:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 $target = new stdClass();
                 XOS::apply($target, $props);
                 return $target;
             }
             return false;
         case PDO_FETCH_INTO:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 XOS::apply($this->fetchTarget, $props);
                 return $this->fetchTarget;
             }
             return false;
         case PDO_FETCH_CLASS:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 return XOS::create($this->fetchTarget, $props);
             }
             return false;
         case PDO_FETCH_CLASS | PDO_FETCH_CLASSTYPE:
             if ($props = mysql_fetch_array($this->result, MYSQL_ASSOC)) {
                 $classType = array_shift($props);
                 return XOS::create($classType, $props);
             }
             return false;
         case PDO_FETCH_BOUND:
             if ($row = mysql_fetch_array($this->result, MYSQL_BOTH)) {
                 foreach ($this->columnBindings as $k => $col) {
                     $col[0] = $this->castValue(is_int($k) ? $row[$k - 1] : $row[$k], $col[1]);
                 }
                 return true;
             }
             return false;
     }
 }
Ejemplo n.º 6
0
 function xoInit($options = array())
 {
     global $xoops;
     $this->path = $xoops->path('/themes/' . $this->folderName);
     $this->template =& XOS::create('xoops_template_Smarty');
     $this->template->currentTheme =& $this;
     $this->template->compile_id = $this->folderName;
     if ($info = @(include "{$this->path}/xo-info.php")) {
         XOS::apply($this, $info);
     } else {
         $this->themeAPI = '2.0';
         $this->parentTheme = $this->folderName == 'xoops20' ? '' : 'xoops20';
     }
     if ($this->bufferOutput) {
         ob_start();
     }
     return true;
 }