Exemplo n.º 1
0
function qCal_Autoloader($name)
{
    // Try to load only concerned class...
    if (strpos($name, 'qCal') === 0) {
        qCal_Loader::loadClass($name);
    }
}
Exemplo n.º 2
0
 /**
  * qCal library loader
  *
  * NOTE: qCal expects to be in the include path. As qCal is rearly used, we wait 
  *       for its first load request before we register the lib
  *       
  * @param $name
  * @throws Zend_Exception
  */
 public static function qCal($class)
 {
     $qCalPath = dirname(dirname(__FILE__)) . '/library/qCal/lib/';
     require_once "{$qCalPath}/qCal/Loader.php";
     $autoloader = Zend_Loader_Autoloader::getInstance();
     $autoloader->unregisterNamespace('qCal');
     $autoloader->pushAutoloader(array('qCal_Loader', 'loadClass'), 'qCal');
     qCal_Loader::loadClass($class);
 }
Exemplo n.º 3
0
 /**
  * Factory method generates the correct recur type based on the string it is passed: "yearly, weekly, etc."
  * @param string The frequency type of recurrence rule you want to generate
  * @param mixed The start date/time for the recurrence. Accepts anything qCal_Date accepts
  */
 public static function factory($freq, $start)
 {
     $freq = ucfirst(strtolower($freq));
     $className = "qCal_DateTime_Recur_" . $freq;
     $fileName = str_replace("_", DIRECTORY_SEPARATOR, $className) . ".php";
     qCal_Loader::loadFile($fileName);
     $class = new $className($start);
     return $class;
 }
 /**
  * The only thing I need this for so far is the parser, but it may come in handy for the facade as well
  * @param string $name The name of the component to be created
  * @param array $properties The properties that should be contained in the component
  * @return qCal_Component The generated qCal_Component
  * @access public
  * @static
  */
 public static function factory($name, $properties = array())
 {
     if (empty($name)) {
         return false;
     }
     // capitalize
     $component = ucfirst(strtolower($name));
     $className = "qCal_Component_" . $component;
     $fileName = str_replace("_", DIRECTORY_SEPARATOR, $className) . ".php";
     qCal_Loader::loadFile($fileName);
     $class = new $className($properties);
     return $class;
 }
Exemplo n.º 5
0
 /**
  * Generates a qCal_Property class based on property name, params, and value
  * which can come directly from an icalendar file
  * @todo I need a way to detect INVALID properties as they are being parsed. This
  * way there can be an option to NOT stop on errors. To just log and then continue.
  */
 public static function factory($name, $value, $params = array())
 {
     $className = self::getClassNameFromPropertyName($name);
     $fileName = str_replace("_", DIRECTORY_SEPARATOR, $className) . ".php";
     try {
         qCal_Loader::loadFile($fileName);
         $class = new $className($value, $params);
     } catch (qCal_Exception_InvalidFile $e) {
         // if there is no class available for this property, check if it is non-standard
         $xname = strtoupper(substr($name, 0, 2));
         // non-standard property
         if ($xname == "X-") {
             $class = new qCal_Property_NonStandard($value, $params, $name);
         } else {
             // if it's not a non-standard property, rethrow
             throw $e;
         }
     }
     return $class;
 }
Exemplo n.º 6
0
function qCal_Autoloader($name)
{
    qCal_Loader::loadClass($name);
}