Source for file component.php

Documentation is available at component.php

  1. <?php
  2. /**
  3.  *  @package     FrameworkOnFramework
  4.  *  @subpackage  autoloader
  5.  *  @copyright   Copyright (c)2010-2012 Nicholas K. Dionysopoulos
  6.  *  @license     GNU General Public License version 2, or later
  7.  */
  8.  
  9. defined('FOF_INCLUDED'or die();
  10.  
  11. /**
  12.  * An autoloader for FOF-powered components. It allows the autoloading of
  13.  * various classes related to the operation of a component, from Controllers
  14.  * and Models to Helpers and Fields. If a class doesn't exist, it will be
  15.  * created on the fly.
  16.  *
  17.  * @package  FrameworkOnFramework
  18.  * @subpackage  autoloader
  19.  * @since    2.1
  20.  */
  21. {
  22.     /**
  23.      * An instance of this autoloader
  24.      *
  25.      * @var   FOFAutoloaderComponent 
  26.      */
  27.     public static $autoloader null;
  28.  
  29.     /**
  30.      * The path to the FOF root directory
  31.      *
  32.      * @var   string 
  33.      */
  34.     public static $fofPath null;
  35.  
  36.     /**
  37.      * An array holding component names and their FOF-ness status
  38.      *
  39.      * @var   array 
  40.      */
  41.     protected static $fofComponents array();
  42.  
  43.     /**
  44.      * Initialise this autoloader
  45.      *
  46.      * @return  FOFAutoloaderComponent 
  47.      */
  48.     public static function init()
  49.     {
  50.         if (self::$autoloader == null)
  51.         {
  52.             self::$autoloader new self;
  53.         }
  54.  
  55.         return self::$autoloader;
  56.     }
  57.  
  58.     /**
  59.      * Public constructor. Registers the autoloader with PHP.
  60.      */
  61.     public function __construct()
  62.     {
  63.         self::$fofPath realpath(__DIR__ . '/../');
  64.  
  65.         spl_autoload_register(array($this,'autoload_fof_controller'));
  66.         spl_autoload_register(array($this,'autoload_fof_model'));
  67.         spl_autoload_register(array($this,'autoload_fof_view'));
  68.         spl_autoload_register(array($this,'autoload_fof_table'));
  69.         spl_autoload_register(array($this,'autoload_fof_helper'));
  70.         spl_autoload_register(array($this,'autoload_fof_toolbar'));
  71.         spl_autoload_register(array($this,'autoload_fof_field'));
  72.     }
  73.  
  74.     /**
  75.      * Returns true if this is a FOF-powered component, i.e. if it has a fof.xml
  76.      * file in its main directory.
  77.      *
  78.      * @param   string  $component  The component's name
  79.      *
  80.      * @return  boolean 
  81.      */
  82.     public function isFOFComponent($component)
  83.     {
  84.         if (!isset($fofComponents[$component]))
  85.         {
  86.             $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  87.             $fofComponents[$componentfile_exists($componentPaths['admin''/fof.xml');
  88.         }
  89.  
  90.         return $fofComponents[$component];
  91.     }
  92.  
  93.     /**
  94.      * Creates class aliases. On systems where eval() is enabled it creates a
  95.      * real class. On other systems it merely creates an alias. The eval()
  96.      * method is preferred as class_aliases result in the name of the class
  97.      * being instanciated not being available, making it impossible to create
  98.      * a class instance without passing a $config array :(
  99.      *
  100.      * @param   string   $original  The name of the original (existing) class
  101.      * @param   string   $alias     The name of the new (aliased) class
  102.      * @param   boolean  $autoload  Should I try to autoload the $original class?
  103.      *
  104.      * @return  void 
  105.      */
  106.     private function class_alias($original$alias$autoload true)
  107.     {
  108.         static $hasEval null;
  109.  
  110.         if (is_null($hasEval))
  111.         {
  112.             $hasEval false;
  113.  
  114.             if (function_exists('ini_get'))
  115.             {
  116.                 $disabled_functions ini_get('disabled_functions');
  117.  
  118.                 if (!is_string($disabled_functions))
  119.                 {
  120.                     $hasEval true;
  121.                 }
  122.                 else
  123.                 {
  124.                     $disabled_functions explode(','$disabled_functions);
  125.                     $hasEval !in_array('eval'$disabled_functions);
  126.                 }
  127.             }
  128.         }
  129.  
  130.         if (!class_exists($original$autoload))
  131.         {
  132.             return;
  133.         }
  134.  
  135.         if ($hasEval)
  136.         {
  137.             $phpCode "class $alias extends $original {}";
  138.             eval($phpCode);
  139.         }
  140.         else
  141.         {
  142.             class_alias($original$alias$autoload);
  143.         }
  144.     }
  145.  
  146.     /**
  147.      * Autoload Controllers
  148.      *
  149.      * @param   string  $class_name  The name of the class to load
  150.      *
  151.      * @return  void 
  152.      */
  153.     public function autoload_fof_controller($class_name)
  154.     {
  155.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  156.  
  157.         static $isCli null$isAdmin null;
  158.  
  159.         if (is_null($isCli&& is_null($isAdmin))
  160.         {
  161.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  162.         }
  163.  
  164.         if (strpos($class_name'Controller'=== false)
  165.         {
  166.             return;
  167.         }
  168.  
  169.         // Change from camel cased into a lowercase array
  170.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  171.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  172.         $parts explode('_'$class_modified);
  173.  
  174.         // We need three parts in the name
  175.  
  176.         if (count($parts!= 3)
  177.         {
  178.             return;
  179.         }
  180.  
  181.         // We need the second part to be "controller"
  182.  
  183.         if ($parts[1!= 'controller')
  184.         {
  185.             return;
  186.         }
  187.  
  188.         // Get the information about this class
  189.         $component_raw  $parts[0];
  190.         $component 'com_' $parts[0];
  191.         $view $parts[2];
  192.  
  193.         // Is this an FOF 2.1 or later component?
  194.  
  195.         if (!$this->isFOFComponent($component))
  196.         {
  197.             return;
  198.         }
  199.  
  200.         // Get the alternate view and class name (opposite singular/plural name)
  201.         $alt_view FOFInflector::isSingular($viewFOFInflector::pluralize($viewFOFInflector::singularize($view);
  202.         $alt_class FOFInflector::camelize($component_raw '_controller_' $alt_view);
  203.  
  204.         // Get the component's paths
  205.         $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  206.  
  207.         // Get the proper and alternate paths and file names
  208.         $file "/controllers/$view.php";
  209.         $altFile "/controllers/$alt_view.php";
  210.         $path $componentPaths['main'];
  211.         $altPath $componentPaths['alt'];
  212.  
  213.         // Try to find the proper class in the proper path
  214.  
  215.         if (file_exists($path $file))
  216.         {
  217.             @include_once $path $file;
  218.         }
  219.  
  220.         // Try to find the proper class in the alternate path
  221.  
  222.         if (!class_exists($class_name&& file_exists($altPath $file))
  223.         {
  224.             @include_once $altPath $file;
  225.         }
  226.  
  227.         // Try to find the alternate class in the proper path
  228.  
  229.         if (!class_exists($alt_class&& file_exists($path $altFile))
  230.         {
  231.             @include_once $path $altFile;
  232.         }
  233.  
  234.         // Try to find the alternate class in the alternate path
  235.  
  236.         if (!class_exists($alt_class&& file_exists($altPath $altFile))
  237.         {
  238.             @include_once $altPath $altFile;
  239.         }
  240.  
  241.         // If the alternate class exists just map the class to the alternate
  242.  
  243.         if (!class_exists($class_name&& class_exists($alt_class))
  244.         {
  245.             $this->class_alias($alt_class$class_name);
  246.         }
  247.  
  248.         // No class found? Map to FOFController
  249.         elseif (!class_exists($class_name))
  250.         {
  251.             if ($view != 'default')
  252.             {
  253.                 $defaultClass FOFInflector::camelize($component_raw '_controller_default');
  254.                 $this->class_alias($defaultClass$class_name);
  255.             }
  256.             else
  257.             {
  258.                 $this->class_alias('FOFController'$class_name);
  259.             }
  260.         }
  261.     }
  262.  
  263.     /**
  264.      * Autoload Models
  265.      *
  266.      * @param   string  $class_name  The name of the class to load
  267.      *
  268.      * @return  void 
  269.      */
  270.     public function autoload_fof_model($class_name)
  271.     {
  272.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  273.  
  274.         static $isCli null$isAdmin null;
  275.  
  276.         if (is_null($isCli&& is_null($isAdmin))
  277.         {
  278.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  279.         }
  280.  
  281.         if (strpos($class_name'Model'=== false)
  282.         {
  283.             return;
  284.         }
  285.  
  286.         // Change from camel cased into a lowercase array
  287.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  288.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  289.         $parts explode('_'$class_modified);
  290.  
  291.         // We need three parts in the name
  292.  
  293.         if (count($parts!= 3)
  294.         {
  295.             return;
  296.         }
  297.  
  298.         // We need the second part to be "model"
  299.  
  300.         if ($parts[1!= 'model')
  301.         {
  302.             return;
  303.         }
  304.  
  305.         // Get the information about this class
  306.         $component_raw  $parts[0];
  307.         $component 'com_' $parts[0];
  308.         $view $parts[2];
  309.  
  310.         // Is this an FOF 2.1 or later component?
  311.  
  312.         if (!$this->isFOFComponent($component))
  313.         {
  314.             return;
  315.         }
  316.  
  317.         // Get the alternate view and class name (opposite singular/plural name)
  318.         $alt_view FOFInflector::isSingular($viewFOFInflector::pluralize($viewFOFInflector::singularize($view);
  319.         $alt_class FOFInflector::camelize($component_raw '_model_' $alt_view);
  320.  
  321.         // Get the proper and alternate paths and file names
  322.         $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  323.  
  324.         $file "/models/$view.php";
  325.         $altFile "/models/$alt_view.php";
  326.         $path $componentPaths['main'];
  327.         $altPath $componentPaths['alt'];
  328.  
  329.         // Try to find the proper class in the proper path
  330.  
  331.         if (file_exists($path $file))
  332.         {
  333.             @include_once $path $file;
  334.         }
  335.  
  336.         // Try to find the proper class in the alternate path
  337.  
  338.         if (!class_exists($class_name&& file_exists($altPath $file))
  339.         {
  340.             @include_once $altPath $file;
  341.         }
  342.  
  343.         // Try to find the alternate class in the proper path
  344.  
  345.         if (!class_exists($alt_class&& file_exists($path $altFile))
  346.         {
  347.             @include_once $path $altFile;
  348.         }
  349.  
  350.         // Try to find the alternate class in the alternate path
  351.  
  352.         if (!class_exists($alt_class&& file_exists($altPath $altFile))
  353.         {
  354.             @include_once $altPath $altFile;
  355.         }
  356.  
  357.         // If the alternate class exists just map the class to the alternate
  358.  
  359.         if (!class_exists($class_name&& class_exists($alt_class))
  360.         {
  361.             $this->class_alias($alt_class$class_name);
  362.         }
  363.  
  364.         // No class found? Map to FOFModel
  365.         elseif (!class_exists($class_name))
  366.         {
  367.             if ($view != 'default')
  368.             {
  369.                 $defaultClass FOFInflector::camelize($component_raw '_model_default');
  370.                 $this->class_alias($defaultClass$class_name);
  371.             }
  372.             else
  373.             {
  374.                 $this->class_alias('FOFModel'$class_nametrue);
  375.             }
  376.         }
  377.     }
  378.  
  379.     /**
  380.      * Autoload Views
  381.      *
  382.      * @param   string  $class_name  The name of the class to load
  383.      *
  384.      * @return  void 
  385.      */
  386.     public function autoload_fof_view($class_name)
  387.     {
  388.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  389.  
  390.         static $isCli null$isAdmin null;
  391.  
  392.         if (is_null($isCli&& is_null($isAdmin))
  393.         {
  394.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  395.         }
  396.  
  397.         if (strpos($class_name'View'=== false)
  398.         {
  399.             return;
  400.         }
  401.  
  402.         // Change from camel cased into a lowercase array
  403.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  404.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  405.         $parts explode('_'$class_modified);
  406.  
  407.         // We need at least three parts in the name
  408.  
  409.         if (count($parts3)
  410.         {
  411.             return;
  412.         }
  413.  
  414.         // We need the second part to be "view"
  415.  
  416.         if ($parts[1!= 'view')
  417.         {
  418.             return;
  419.         }
  420.  
  421.         // Get the information about this class
  422.         $component_raw  $parts[0];
  423.         $component 'com_' $parts[0];
  424.         $view $parts[2];
  425.  
  426.         if (count($parts3)
  427.         {
  428.             $format $parts[3];
  429.         }
  430.         else
  431.         {
  432.             $input new FOFInput;
  433.             $format $input->getCmd('format''html''cmd');
  434.         }
  435.  
  436.         // Is this an FOF 2.1 or later component?
  437.  
  438.         if (!$this->isFOFComponent($component))
  439.         {
  440.             return;
  441.         }
  442.  
  443.         // Get the alternate view and class name (opposite singular/plural name)
  444.         $alt_view FOFInflector::isSingular($viewFOFInflector::pluralize($viewFOFInflector::singularize($view);
  445.         $alt_class FOFInflector::camelize($component_raw '_view_' $alt_view);
  446.  
  447.         // Get the proper and alternate paths and file names
  448.         $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  449.  
  450.         $protoFile "/models/$view";
  451.         $protoAltFile "/models/$alt_view";
  452.         $path $componentPaths['main'];
  453.         $altPath $componentPaths['alt'];
  454.  
  455.         $formats array($format);
  456.  
  457.         if ($format != 'html')
  458.         {
  459.             $formats['raw';
  460.         }
  461.  
  462.         foreach ($formats as $currentFormat)
  463.         {
  464.             $file $protoFile '.' $currentFormat '.php';
  465.             $altFile $protoAltFile '.' $currentFormat '.php';
  466.  
  467.             // Try to find the proper class in the proper path
  468.  
  469.             if (!class_exists($class_name&& file_exists($path $file))
  470.             {
  471.                 @include_once $path $file;
  472.             }
  473.  
  474.             // Try to find the proper class in the alternate path
  475.  
  476.             if (!class_exists($class_name&& file_exists($altPath $file))
  477.             {
  478.                 @include_once $altPath $file;
  479.             }
  480.  
  481.             // Try to find the alternate class in the proper path
  482.  
  483.             if (!class_exists($alt_class&& file_exists($path $altFile))
  484.             {
  485.                 @include_once $path $altFile;
  486.             }
  487.  
  488.             // Try to find the alternate class in the alternate path
  489.  
  490.             if (!class_exists($alt_class&& file_exists($altPath $altFile))
  491.             {
  492.                 @include_once $altPath $altFile;
  493.             }
  494.         }
  495.  
  496.         // If the alternate class exists just map the class to the alternate
  497.  
  498.         if (!class_exists($class_name&& class_exists($alt_class))
  499.         {
  500.             $this->class_alias($alt_class$class_name);
  501.         }
  502.  
  503.         // No class found? Map to FOFModel
  504.         elseif (!class_exists($class_name))
  505.         {
  506.             if ($view != 'default')
  507.             {
  508.                 $defaultClass FOFInflector::camelize($component_raw '_view_default');
  509.                 $this->class_alias($defaultClass$class_name);
  510.             }
  511.             else
  512.             {
  513.                 if (!file_exists(self::$fofPath '/view/' $format '.php'))
  514.                 {
  515.                     $default_class 'FOFView';
  516.                 }
  517.                 else
  518.                 {
  519.                     $default_class 'FOFView' ucfirst($format);
  520.                 }
  521.  
  522.                 $this->class_alias($default_class$class_nametrue);
  523.             }
  524.         }
  525.     }
  526.  
  527.     /**
  528.      * Autoload Tables
  529.      *
  530.      * @param   string  $class_name  The name of the class to load
  531.      *
  532.      * @return  void 
  533.      */
  534.     public function autoload_fof_table($class_name)
  535.     {
  536.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  537.  
  538.         static $isCli null$isAdmin null;
  539.  
  540.         if (is_null($isCli&& is_null($isAdmin))
  541.         {
  542.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  543.         }
  544.  
  545.         if (strpos($class_name'Table'=== false)
  546.         {
  547.             return;
  548.         }
  549.  
  550.         // Change from camel cased into a lowercase array
  551.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  552.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  553.         $parts explode('_'$class_modified);
  554.  
  555.         // We need three parts in the name
  556.  
  557.         if (count($parts!= 3)
  558.         {
  559.             return;
  560.         }
  561.  
  562.         // We need the second part to be "model"
  563.  
  564.         if ($parts[1!= 'table')
  565.         {
  566.             return;
  567.         }
  568.  
  569.         // Get the information about this class
  570.         $component_raw  $parts[0];
  571.         $component 'com_' $parts[0];
  572.         $view $parts[2];
  573.  
  574.         // Is this an FOF 2.1 or later component?
  575.  
  576.         if (!$this->isFOFComponent($component))
  577.         {
  578.             return;
  579.         }
  580.  
  581.         // Get the alternate view and class name (opposite singular/plural name)
  582.         $alt_view FOFInflector::isSingular($viewFOFInflector::pluralize($viewFOFInflector::singularize($view);
  583.         $alt_class FOFInflector::camelize($component_raw '_table_' $alt_view);
  584.  
  585.         // Get the proper and alternate paths and file names
  586.         $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  587.  
  588.         $file "/tables/$view.php";
  589.         $altFile "/tables/$alt_view.php";
  590.         $path $componentPaths['admin'];
  591.  
  592.         // Try to find the proper class in the proper path
  593.  
  594.         if (file_exists($path $file))
  595.         {
  596.             @include_once $path $file;
  597.         }
  598.  
  599.         // Try to find the alternate class in the proper path
  600.  
  601.         if (!class_exists($alt_class&& file_exists($path $altFile))
  602.         {
  603.             @include_once $path $altFile;
  604.         }
  605.  
  606.         // If the alternate class exists just map the class to the alternate
  607.  
  608.         if (!class_exists($class_name&& class_exists($alt_class))
  609.         {
  610.             $this->class_alias($alt_class$class_name);
  611.         }
  612.  
  613.         // No class found? Map to FOFModel
  614.         elseif (!class_exists($class_name))
  615.         {
  616.             if ($view != 'default')
  617.             {
  618.                 $defaultClass FOFInflector::camelize($component_raw '_table_default');
  619.                 $this->class_alias($defaultClass$class_name);
  620.             }
  621.             else
  622.             {
  623.                 $this->class_alias('FOFTable'$class_nametrue);
  624.             }
  625.         }
  626.     }
  627.  
  628.     /**
  629.      * Autoload Helpers
  630.      *
  631.      * @param   string  $class_name  The name of the class to load
  632.      *
  633.      * @return  void 
  634.      */
  635.     public function autoload_fof_helper($class_name)
  636.     {
  637.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  638.  
  639.         static $isCli null$isAdmin null;
  640.  
  641.         if (is_null($isCli&& is_null($isAdmin))
  642.         {
  643.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  644.         }
  645.  
  646.         if (strpos($class_name'Helper'=== false)
  647.         {
  648.             return;
  649.         }
  650.  
  651.         // Change from camel cased into a lowercase array
  652.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  653.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  654.         $parts explode('_'$class_modified);
  655.  
  656.         // We need three parts in the name
  657.  
  658.         if (count($parts!= 3)
  659.         {
  660.             return;
  661.         }
  662.  
  663.         // We need the second part to be "model"
  664.  
  665.         if ($parts[1!= 'helper')
  666.         {
  667.             return;
  668.         }
  669.  
  670.         // Get the information about this class
  671.         $component_raw  $parts[0];
  672.         $component 'com_' $parts[0];
  673.         $view $parts[2];
  674.  
  675.         // Is this an FOF 2.1 or later component?
  676.  
  677.         if (!$this->isFOFComponent($component))
  678.         {
  679.             return;
  680.         }
  681.  
  682.         // Get the alternate view and class name (opposite singular/plural name)
  683.         $alt_view FOFInflector::isSingular($viewFOFInflector::pluralize($viewFOFInflector::singularize($view);
  684.         $alt_class FOFInflector::camelize($component_raw '_helper_' $alt_view);
  685.  
  686.         // Get the proper and alternate paths and file names
  687.         $componentPaths FOFPlatform::getInstance()->getComponentBaseDirs($component);
  688.  
  689.         $file "/helpers/$view.php";
  690.         $altFile "/helpers/$alt_view.php";
  691.         $path $componentPaths['main'];
  692.         $altPath $componentPaths['alt'];
  693.  
  694.         // Try to find the proper class in the proper path
  695.  
  696.         if (file_exists($path $file))
  697.         {
  698.             @include_once $path $file;
  699.         }
  700.  
  701.         // Try to find the proper class in the alternate path
  702.  
  703.         if (!class_exists($class_name&& file_exists($altPath $file))
  704.         {
  705.             @include_once $altPath $file;
  706.         }
  707.  
  708.         // Try to find the alternate class in the proper path
  709.  
  710.         if (!class_exists($alt_class&& file_exists($path $altFile))
  711.         {
  712.             @include_once $path $altFile;
  713.         }
  714.  
  715.         // Try to find the alternate class in the alternate path
  716.  
  717.         if (!class_exists($alt_class&& file_exists($altPath $altFile))
  718.         {
  719.             @include_once $altPath $altFile;
  720.         }
  721.  
  722.         // If the alternate class exists just map the class to the alternate
  723.  
  724.         if (!class_exists($class_name&& class_exists($alt_class))
  725.         {
  726.             $this->class_alias($alt_class$class_name);
  727.         }
  728.     }
  729.  
  730.     /**
  731.      * Autoload Toolbars
  732.      *
  733.      * @param   string  $class_name  The name of the class to load
  734.      *
  735.      * @return  void 
  736.      */
  737.     public function autoload_fof_toolbar($class_name)
  738.     {
  739.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  740.  
  741.         static $isCli null$isAdmin null;
  742.  
  743.         if (is_null($isCli&& is_null($isAdmin))
  744.         {
  745.             list($isCli$isAdminFOFDispatcher::isCliAdmin();
  746.         }
  747.  
  748.         if (strpos($class_name'Toolbar'=== false)
  749.         {
  750.             return;
  751.         }
  752.  
  753.         // Change from camel cased into a lowercase array
  754.         $class_modified preg_replace('/(\s)+/''_'$class_name);
  755.         $class_modified strtolower(preg_replace('/(?<=\\w)([A-Z])/''_\\1'$class_modified));
  756.         $parts explode('_'$class_modified);
  757.  
  758.         // We need two parts in the name
  759.  
  760.         if (count($parts!= 2)
  761.         {
  762.             return;
  763.         }
  764.  
  765.         // We need the second part to be "model"
  766.  
  767.         if ($parts[1!= 'toolbar')
  768.         {
  769.             return;
  770.         }
  771.  
  772.         // Get the information about this class
  773.         $component_raw  $parts[0];
  774.         $component 'com_' $parts[0];
  775.  
  776.         // Get the proper and alternate paths and file names
  777.         $file "/components/$component/toolbar.php";
  778.         $path ($isAdmin || $isCliJPATH_ADMINISTRATOR JPATH_SITE;
  779.         $altPath ($isAdmin || $isCliJPATH_SITE JPATH_ADMINISTRATOR;
  780.  
  781.         // Try to find the proper class in the proper path
  782.  
  783.         if (file_exists($path $file))
  784.         {
  785.             @include_once $path $file;
  786.         }
  787.  
  788.         // Try to find the proper class in the alternate path
  789.  
  790.         if (!class_exists($class_name&& file_exists($altPath $file))
  791.         {
  792.             @include_once $altPath $file;
  793.         }
  794.  
  795.         // No class found? Map to FOFToolbar
  796.  
  797.         if (!class_exists($class_name))
  798.         {
  799.             $this->class_alias('FOFToolbar'$class_nametrue);
  800.         }
  801.     }
  802.  
  803.     /**
  804.      * Autoload Fields
  805.      *
  806.      * @param   string  $class_name  The name of the class to load
  807.      *
  808.      * @return  void 
  809.      */
  810.     public function autoload_fof_field($class_name)
  811.     {
  812.         JLog::add(__METHOD__ . "() autoloading $class_name"JLog::DEBUG'fof');
  813.  
  814.         // @todo
  815.     }
  816. }

Documentation generated on Tue, 19 Nov 2013 14:56:13 +0100 by phpDocumentor 1.4.3