Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/application/application.php

Documentation is available at application.php

  1. <?php
  2. /**
  3. @version        $Id: application.php 6760 2007-03-03 02:50:10Z Jinx $
  4. @package        Joomla.Framework
  5. @subpackage    Application
  6. @copyright    Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
  7. @license        GNU/GPL, see LICENSE.php
  8. *  Joomla! is free software. This version may have been modified pursuant
  9. *  to the GNU General Public License, and as distributed it includes or
  10. *  is derivative of works licensed under the GNU General Public License or
  11. *  other free or open source software licenses.
  12. *  See COPYRIGHT.php for copyright notices and details.
  13. */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE'or die();
  17.  
  18. // Include library dependencies
  19. jimport('joomla.application.plugin.*');
  20.  
  21. /**
  22. * Base class for a Joomla! application.
  23. *
  24. * Acts as a Factory class for application specific objects and provides many
  25. * supporting API functions. Derived clases should supply the execute() and dispaly()
  26. * functions.
  27. *
  28. @abstract
  29. @package        Joomla.Framework
  30. @subpackage    Application
  31. @since        1.5
  32. */
  33.  
  34. class JApplication extends JObject
  35. {
  36.     /**
  37.      * The client identifier.
  38.      *
  39.      * @var integer 
  40.      * @access protected
  41.      * @since 1.5
  42.      */
  43.     var $_clientId = null;
  44.  
  45.  
  46.     /**
  47.      * The router object
  48.      *
  49.      * @var object  JRouter object
  50.      * @access protected
  51.      */
  52.     var $_router = null;
  53.  
  54.     /**
  55.      * The application message queue.
  56.      *
  57.      * @var array 
  58.      * @access protected
  59.      */
  60.     var $_messageQueue = array();
  61.  
  62.     /**
  63.     * Class constructor.
  64.     *
  65.     * @param integer    A client identifier.
  66.     */
  67.     function __construct$clientId )
  68.     {
  69.         $this->_clientId = $clientId;
  70.         $this->set'requestTime'date('Y-m-d H:i'time()) );
  71.     }
  72.  
  73.     /**
  74.     * Initialise the application.
  75.     *
  76.     * @param    array An optional associative array of configuration settings.
  77.     * @access public
  78.     */
  79.     function initialise($options array())
  80.     {
  81.         //Set the language in the class
  82.         $conf =JFactory::getConfig();
  83.         $conf->setValue('config.language'$options['language']);
  84.  
  85.         //set language debug -> lazy load it later
  86.         $lang =JFactory::getLanguage();
  87.         $lang->setDebug($this->getCfg('debug_lang'));
  88.  
  89.         //define date formats
  90.         define('DATE_FORMAT_LC' JText::_('DATE_FORMAT_LC' ));
  91.         define('DATE_FORMAT_LC2'JText::_('DATE_FORMAT_LC2'));
  92.         define('DATE_FORMAT_LC3'JText::_('DATE_FORMAT_LC3'));
  93.         define('DATE_FORMAT_LC4'JText::_('DATE_FORMAT_LC4'));
  94.  
  95.         // create the backward compatible language value for old 3PD components
  96.         if($conf->getValue('config.legacy')) {
  97.             $GLOBALS['mosConfig_lang'$lang->getBackwardLang();
  98.         }
  99.  
  100.         //create the router -> lazy load it later
  101.         $this->_createRouter();
  102.     }
  103.  
  104.     /**
  105.     * Route the applicaiton.
  106.     *
  107.     * Routing is the process of examining the request environment to determine which
  108.     * which component should receive the request. This component optional parameters
  109.     * are then set in the request object to be processed when the application is being
  110.     * dispatched
  111.     *
  112.     * @abstract
  113.     * @access public
  114.     */
  115.     function route()
  116.      {
  117.         // get the full request URI
  118.         $uri  =JURI::getInstance();
  119.  
  120.         $router =$this->getRouter();
  121.         $router->parse($uri->toString());
  122.      }
  123.  
  124.      /**
  125.     * Dispatch the applicaiton.
  126.     *
  127.     * Dispatching is the process of pulling the option from the request object and
  128.     * mapping them to a component. If the component do not exist, it handles
  129.     * determining a default component to dispatch
  130.     *
  131.     * @abstract
  132.     * @access public
  133.     */
  134.      function dispatch()
  135.      {
  136.  
  137.      }
  138.  
  139.     /**
  140.     * Render the application.
  141.     *
  142.     * Rendering is the process of rendering the application into the JResponse buffer
  143.     *
  144.     * @abstract
  145.     * @access public
  146.     */
  147.     function render()
  148.     {
  149.  
  150.     }
  151.  
  152.     /**
  153.     * Exit the application.
  154.     *
  155.     * @access    public
  156.     * @param    int    Exit code
  157.     */
  158.     function close$code )
  159.     {
  160.         $session =JFactory::getSession();
  161.         $session->close();
  162.         exit($code);
  163.     }
  164.  
  165.     /**
  166.      * Redirect to another URL.
  167.      *
  168.      * Optionally enqueues a message in the system message queue (which will be displayed
  169.      * the next time a page is loaded) using the enqueueMessage method. If the headers have
  170.      * not been sent the redirect will be accomplished using a "301 Moved Permanently"
  171.      * code in the header pointing to the new location. If the headers have already been
  172.      * sent this will be accomplished using a JavaScript statement.
  173.      *
  174.      * @access    public
  175.      * @param    string    $url    The URL to redirect to.
  176.      * @param    string    $msg    An optional message to display on redirect.
  177.      * @param    string  $msgType An optional message type.
  178.      * @return    none; calls exit().
  179.      * @since    1.5
  180.      * @see        JApplication::enqueueMessage()
  181.      */
  182.     function redirect$url$msg=''$msgType='message' )
  183.     {
  184.         // check for relative internal links
  185.         if (preg_match'#^index[2]?.php#'$url )) {
  186.             $url JURI::base($url;
  187.         }
  188.  
  189.         // If the message exists, enqueue it
  190.         if (trim$msg )) {
  191.             $this->enqueueMessage($msg$msgType);
  192.         }
  193.  
  194.         // Persist messages if they exist
  195.         if (count($this->_messageQueue))
  196.         {
  197.             $session =JFactory::getSession();
  198.             $session->set('application.queue'$this->_messageQueue);
  199.         }
  200.  
  201.         /*
  202.          * If the headers have been sent, then we cannot send an additional location header
  203.          * so we will output a javascript redirect statement.
  204.          */
  205.         if (headers_sent()) {
  206.             echo "<script>document.location.href='$url';</script>\n";
  207.         else {
  208.             //@ob_end_clean(); // clear output buffer
  209.             header'HTTP/1.1 301 Moved Permanently' );
  210.             header'Location: ' $url );
  211.         }
  212.         $this->close();
  213.     }
  214.  
  215.     /**
  216.      * Enqueue a system message.
  217.      *
  218.      * @access    public
  219.      * @param    string     $msg     The message to enqueue.
  220.      * @param    string    $type    The message type.
  221.      * @return    void 
  222.      * @since    1.5
  223.      */
  224.     function enqueueMessage$msg$type 'message' )
  225.     {
  226.         // For empty queue, if messages exists in the session, enqueue them first
  227.         if (!count($this->_messageQueue))
  228.         {
  229.             $session =JFactory::getSession();
  230.             $sessionQueue $session->get('application.queue');
  231.             if (count($sessionQueue)) {
  232.                 $this->_messageQueue = $sessionQueue;
  233.                 $session->set('application.queue'null);
  234.             }
  235.         }
  236.         // Enqueue the message
  237.         $this->_messageQueue[array('message' => $msg'type' => strtolower($type));
  238.     }
  239.  
  240.     /**
  241.      * Get the system message queue.
  242.      *
  243.      * @access    public
  244.      * @return    The system message queue.
  245.      * @since    1.5
  246.      */
  247.     function getMessageQueue()
  248.     {
  249.         // For empty queue, if messages exists in the session, enqueue them
  250.         if (!count($this->_messageQueue))
  251.         {
  252.             $session =JFactory::getSession();
  253.             $sessionQueue $session->get('application.queue');
  254.             if (count($sessionQueue)) {
  255.                 $this->_messageQueue = $sessionQueue;
  256.                 $session->set('application.queue'null);
  257.             }
  258.         }
  259.         return $this->_messageQueue;
  260.     }
  261.  
  262.      /**
  263.      * Gets a configuration value.
  264.      *
  265.      * @access public
  266.      * @param string    The name of the value to get.
  267.      * @return The user state.
  268.      * @example application/japplication-getcfg.php Getting a configuration value
  269.      */
  270.     function getCfg$varname )
  271.     {
  272.         $config =JFactory::getConfig();
  273.         return $config->getValue('config.' $varname);
  274.     }
  275.  
  276.     /**
  277.      * Gets a user state.
  278.      *
  279.      * @access public
  280.      * @param string The path of the state.
  281.      * @return mixed The user state.
  282.      */
  283.     function getUserState$key )
  284.     {
  285.         $session    =JFactory::getSession();
  286.         $registry    =$session->get('registry');
  287.         if(!is_null($registry)) {
  288.             return $registry->getValue($key);
  289.         }
  290.         return null;
  291.     }
  292.  
  293.     /**
  294.     * Sets the value of a user state variable.
  295.     *
  296.     * @access public
  297.     * @param string    The path of the state.
  298.     * @param string    The value of the variable.
  299.     * @return mixed The previous state, if one existed.
  300.     */
  301.     function setUserState$key$value )
  302.     {
  303.         $session    =JFactory::getSession();
  304.         $registry    =$session->get('registry');
  305.         if(!is_null($registry)) {
  306.             return $registry->setValue($key$value);
  307.         }
  308.         return null;
  309.     }
  310.  
  311.     /**
  312.      * Gets the value of a user state variable.
  313.      *
  314.      * @access public
  315.      * @param string The key of the user state variable.
  316.      * @param string The name of the variable passed in a request.
  317.      * @param string The default value for the variable if not found. Optional.
  318.      * @return The request user state.
  319.      */
  320.     function getUserStateFromRequest$key$request$default null )
  321.     {
  322.         //Force namespace
  323.         $key 'request.' $key;
  324.  
  325.         $old_state $this->getUserState$key );
  326.         $cur_state (!is_null($old_state)) $old_state $default;
  327.         $new_state JRequest::getVar$request$cur_state );
  328.         $this->setUserState$key$new_state );
  329.  
  330.         return $new_state;
  331.     }
  332.  
  333.     /**
  334.      * Registers a handler to a particular event group.
  335.      *
  336.      * @static
  337.      * @param string The event name.
  338.      * @param mixed The handler, a function or an instance of a event object.
  339.      * @return void 
  340.      * @since 1.5
  341.      */
  342.     function registerEvent($event$handler)
  343.     {
  344.         $dispatcher =JEventDispatcher::getInstance();
  345.         $dispatcher->register($event$handler);
  346.     }
  347.  
  348.     /**
  349.      * Calls all handlers associated with an event group.
  350.      *
  351.      * @static
  352.      * @param string The event name.
  353.      * @param array An array of arguments.
  354.      * @return array An array of results from each function call.
  355.      * @since 1.5
  356.      */
  357.     function triggerEvent($event$args=null)
  358.     {
  359.         $dispatcher =JEventDispatcher::getInstance();
  360.         return $dispatcher->trigger($event$args);
  361.     }
  362.  
  363.     /**
  364.      * Login authentication function.
  365.      *
  366.      * Username and encoded password are passed the the onLoginUser event which
  367.      * is responsible for the user validation. A successful validation updates
  368.      * the current session record with the users details.
  369.      *
  370.      * Username and encoded password are sent as credentials (along with other
  371.      * possibilities) to each observer (JAuthenticatePlugin) for user
  372.      * validation.  Successful validation will update the current session with
  373.      * the user details.
  374.      *
  375.      * @param string     The username.
  376.      * @param string     The password.
  377.      * @param boolean      True, if the user login needs to be remembered by the application.
  378.      * @return boolean     True on success.
  379.      * @access public
  380.      * @since 1.5
  381.      */
  382.     function login($username$password$remember)
  383.     {
  384.         /*if (empty($username))  {
  385.             return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_LOGIN_USERNAME'));
  386.         }
  387.  
  388.         if(empty($password)) {
  389.             return JError::raiseWarning('SOME_ERROR_CODE', JText::_('E_LOGIN_PASSWORD'));
  390.         }*/
  391.  
  392.         // Build the credentials array
  393.         $credentials['username'$username;
  394.         $credentials['password'$password;
  395.  
  396.         // Get the global JAuthenticate object
  397.         jimport'joomla.user.authenticate');
  398.         $authenticate JAuthenticate::getInstance();
  399.         $response     $authenticate->authenticate($username$password);
  400.  
  401.         if (is_a($response'JAuthenticateResponse'))
  402.         {
  403.             // Import the user plugin group
  404.             JPluginHelper::importPlugin('user');
  405.  
  406.             // OK, the credentials are authenticated.  Lets fire the onLogin event
  407.             $results $this->triggerEvent('onLoginUser'array((array)$response$remember));
  408.  
  409.             /*
  410.              * If any of the user plugins did not successfully
  411.              * complete the login routine then the whole method fails.  Any
  412.              * errors raised should be done in the plugin as this provides the
  413.              * ability to provide much more information about why the routine
  414.              * may have failed.
  415.              */
  416.             //TODO :: need to handle error reporting here
  417.             if (!in_array(false$resultstrue)) {
  418.                 return true;
  419.             }
  420.         }
  421.         return JError::raiseWarning('SOME_ERROR_CODE'JText::_('E_LOGIN_AUTHENTICATE'));
  422.     }
  423.  
  424.     /**
  425.     * Logout authentication function.
  426.     *
  427.     * Passed the current user information to the onLogoutUser event and reverts the current
  428.     * session record back to 'anonymous' parameters.
  429.     *
  430.     * @access public
  431.     */
  432.     function logout()
  433.     {
  434.         // Initialize variables
  435.         $retval false;
  436.  
  437.         // Get a user object from the JApplication
  438.         $user &JFactory::getUser();
  439.  
  440.         // Hit the user last visit field
  441.         $user->setLastVisit();
  442.  
  443.         // Build the credentials array
  444.         $parameters['username'$user->get('username');
  445.         $parameters['id']         $user->get('id');
  446.  
  447.         // Import the user plugin group
  448.         JPluginHelper::importPlugin('user');
  449.  
  450.         // OK, the credentials are built. Lets fire the onLogout event
  451.         $results $this->triggerEvent('onLogoutUser'array($parameters));
  452.  
  453.         /*
  454.          * If any of the authentication plugins did not successfully complete
  455.          * the logout routine then the whole method fails.  Any errors raised
  456.          * should be done in the plugin as this provides the ability to provide
  457.          * much more information about why the routine may have failed.
  458.          */
  459.         if (!in_array(false$resultstrue)) {
  460.             $retval true;
  461.         }
  462.  
  463.         return $retval;
  464.     }
  465.  
  466.     /**
  467.      * Load the user session.
  468.      *
  469.      * @access public
  470.      * @param string The session's name.
  471.      */
  472.     function loadSession($name)
  473.     {
  474.         $session =$this->_createSession($name);
  475.  
  476.         // Set user specific editor
  477.         $user   =JFactory::getUser();
  478.         $editor $user->getParam('editor'$this->getCfg('editor'));
  479.  
  480.         $config =JFactory::getConfig();
  481.         $config->setValue('config.editor'$editor);
  482.     }
  483.  
  484.     /**
  485.      * Load the configuration
  486.      *
  487.      * @access public
  488.      * @param string    The path to the configuration file
  489.      * @param string    The type of the configuration file
  490.      * @since 1.5
  491.      */
  492.     function loadConfiguration($file)
  493.     {
  494.         $config =$this->_createConfiguration($file);
  495.  
  496.         // Set the database debug
  497.         $db =JFactory::getDBO();
  498.         $db->debug$config->debug_db );
  499.     }
  500.  
  501.     /**
  502.      * Gets the name of the current template.
  503.      *
  504.      * @return string 
  505.      */
  506.     function getTemplate()
  507.     {
  508.         return '_system';
  509.     }
  510.  
  511.     /**
  512.      * Return a reference to the JRouter object.
  513.      *
  514.      * @access public
  515.      * @return object JRouter. 
  516.      * @since 1.5
  517.      */
  518.     function &getRouter()
  519.     {
  520.         return $this->_router;
  521.     }
  522.  
  523.     /**
  524.      * Create the configuration registry
  525.      *
  526.      * @access private
  527.      * @param string $file     The path to the configuration file
  528.      *  return object JConfig
  529.      */
  530.     function &_createConfiguration($file)
  531.     {
  532.         jimport'joomla.registry.registry' );
  533.  
  534.         require_once$file );
  535.  
  536.         // Create the JConfig object
  537.         $config new JConfig();
  538.  
  539.         // Get the global configuration object
  540.         $registry =JFactory::getConfig();
  541.  
  542.         // Load the configuration values into the registry
  543.         $registry->loadObject($config);
  544.  
  545.         return $config;
  546.     }
  547.  
  548.     /**
  549.      * Create the user session.
  550.      *
  551.      * Old sessions are flushed based on the configuration value for the cookie
  552.      * lifetime. If an existing session, then the last access time is updated.
  553.      * If a new session, a session id is generated and a record is created in
  554.      * the #__sessions table.
  555.      *
  556.      * @access    private
  557.      * @param    string The sessions name.
  558.      * @return    object JSession on success. May call exit() on database error.
  559.      * @since    1.5
  560.      */
  561.     function &_createSession$name )
  562.     {
  563.         $options array();
  564.         $options['name'$name;
  565.  
  566.         $session =JFactory::getSession($options);
  567.  
  568.         $storage JTable::getInstance('session');
  569.         $storage->purge($session->getExpire(60);
  570.  
  571.         // Session exists and is not expired, update time in session table
  572.         if ($storage->load($session->getId())) {
  573.             $storage->update();
  574.             return $session;
  575.         }
  576.  
  577.         //Session doesn't exist yet, initalise and store it in the session table
  578.         $session->set('registry'new JRegistry('session'));
  579.         $session->set('user'    new JUser());
  580.  
  581.         if (!$storage->insert$session->getId()$this->getClientId())) {
  582.             die$storage->getError());
  583.         }
  584.  
  585.         //TODO::Fix remember me (harden and move out of function)
  586.         //$usercookie = JRequest::getVar( 'usercookie', null, 'COOKIE' );
  587.         //if ($usercookie) {
  588.             // Remember me cookie exists. Login with usercookie info.
  589.         //    $this->login( $usercookie['username'], $usercookie['password'] );
  590.         //}
  591.  
  592.         return $session;
  593.     }
  594.  
  595.     /**
  596.      * Create a JRouter object
  597.      *
  598.      * @access private
  599.      * @return object JRouter. 
  600.      * @since 1.5
  601.      */
  602.     function &_createRouter()
  603.     {
  604.         //Load the pathway object
  605.         jimport'joomla.application.router' );
  606.  
  607.         $options array();
  608.  
  609.         // Get routing mode
  610.         $options['mode'$this->getCfg('sef');
  611.         if($this->getCfg('sef_rewrite')) {
  612.             $options['mode'2;
  613.         }
  614.  
  615.         // Create a JRouter object
  616.         $this->_router = JRouter::getInstance($options);
  617.  
  618.         return $this->_router;
  619.     }
  620.  
  621.     /**
  622.      * Gets the client id of the current running application.
  623.      *
  624.      * @access    public
  625.      * @return    int A client identifier.
  626.      * @since        1.5
  627.      */
  628.     function getClientId)
  629.     {
  630.         return $this->_clientId;
  631.     }
  632.  
  633.     /**
  634.      * Is admin interface?
  635.      *
  636.      * @access    public
  637.      * @return    boolean        True if this application is administrator.
  638.      * @since    1.0.2
  639.      */
  640.     function isAdmin()
  641.     {
  642.         return ($this->_clientId == 1);
  643.     }
  644.  
  645.     /**
  646.      * Is site interface?
  647.      *
  648.      * @access    public
  649.      * @return    boolean        True if this application is site.
  650.      * @since    1.5
  651.      */
  652.     function isSite()
  653.     {
  654.         return ($this->_clientId == 0);
  655.     }
  656.  
  657.     /**
  658.      * Deprecated functions
  659.      */
  660.  
  661.      /**
  662.      * Deprecated, use JPathWay->addItem() method instead.
  663.      *
  664.      * @since 1.0
  665.      * @deprecated As of version 1.5
  666.      * @see JPathWay::addItem()
  667.      */
  668.     function appendPathWay$name$link null )
  669.     {
  670.         /*
  671.          * To provide backward compatability if no second parameter is set
  672.          * set it to null
  673.          */
  674.         if ($link == null{
  675.             $link '';
  676.         }
  677.  
  678.         // Add item to the pathway object
  679.         if ($this->_pathway->addItem($name$link)) {
  680.             return true;
  681.         }
  682.  
  683.         return false;
  684.   }
  685.  
  686.     /**
  687.      * Deprecated, use JPathWay->getPathWayNames() method instead.
  688.      *
  689.      * @since 1.0
  690.      * @deprecated As of version 1.5
  691.      * @see JPathWay::getPathWayNames()
  692.      */
  693.     function getCustomPathWay()
  694.     {
  695.         return $this->_pathway->getPathWayNames();
  696.     }
  697.  
  698.     /**
  699.      * Deprecated, use JDocument->get( 'head' ) instead.
  700.      *
  701.      * @since 1.0
  702.      * @deprecated As of version 1.5
  703.      * @see JDocument
  704.      * @see JObject::get()
  705.      */
  706.     function getHead()
  707.     {
  708.         $document=JFactory::getDocument();
  709.         return $document->get('head');
  710.     }
  711.  
  712.     /**
  713.      * Deprecated, use JDocument->setMetaData instead.
  714.      *
  715.      * @since 1.0
  716.      * @deprecated As of version 1.5
  717.      * @param string Name of the metadata tag
  718.      * @param string Content of the metadata tag
  719.      * @param string Deprecated, ignored
  720.      * @param string Deprecated, ignored
  721.      * @see JDocument::setMetaData()
  722.      */
  723.     function addMetaTag$name$content$prepend ''$append '' )
  724.     {
  725.         $document=JFactory::getDocument();
  726.         $document->setMetadata($name$content);
  727.     }
  728.  
  729.     /**
  730.      * Deprecated, use JDocument->setMetaData instead.
  731.      *
  732.      * @since 1.0
  733.      * @deprecated As of version 1.5
  734.          * @param string Name of the metadata tag
  735.          * @param string Content of the metadata tag
  736.      * @see JDocument::setMetaData()
  737.      */
  738.     function appendMetaTag$name$content )
  739.     {
  740.         $this->addMetaTag($name$content);
  741.     }
  742.  
  743.     /**
  744.      * Deprecated, use JDocument->setMetaData instead
  745.      *
  746.      * @since 1.0
  747.      * @deprecated As of version 1.5
  748.          * @param string Name of the metadata tag
  749.          * @param string Content of the metadata tag
  750.      * @see JDocument::setMetaData()
  751.      */
  752.     function prependMetaTag$name$content )
  753.     {
  754.         $this->addMetaTag($name$content);
  755.     }
  756.  
  757.     /**
  758.      * Deprecated, use JDocument->addCustomTag instead (only when document type is HTML).
  759.      *
  760.      * @since 1.0
  761.      * @deprecated As of version 1.5
  762.      * @param string Valid HTML
  763.      * @see JDocumentHTML::addCustomTag()
  764.      */
  765.     function addCustomHeadTag$html )
  766.     {
  767.         $document=JFactory::getDocument();
  768.         if($document->getType(== 'html'{
  769.             $document->addCustomTag($html);
  770.         }
  771.     }
  772.  
  773.     /**
  774.      * Deprecated.
  775.      *
  776.      * @since 1.0
  777.      * @deprecated As of version 1.5
  778.      */
  779.     function getBlogSectionCount)
  780.     {
  781.         $menus &JMenu::getInstance();
  782.         return count($menus->getItems('type''content_blog_section'));
  783.     }
  784.  
  785.     /**
  786.      * Deprecated.
  787.      *
  788.      * @since 1.0
  789.      * @deprecated As of version 1.5
  790.      */
  791.     function getBlogCategoryCount)
  792.     {
  793.         $menus &JMenu::getInstance();
  794.         return count($menus->getItems('type''content_blog_category'));
  795.     }
  796.  
  797.     /**
  798.      * Deprecated.
  799.      *
  800.      * @since 1.0
  801.      * @deprecated As of version 1.5
  802.      */
  803.     function getGlobalBlogSectionCount)
  804.     {
  805.         $menus &JMenu::getInstance();
  806.         return count($menus->getItems('type''content_blog_section'));
  807.     }
  808.  
  809.     /**
  810.      * Deprecated.
  811.      *
  812.      * @since 1.0
  813.      * @deprecated As of version 1.5
  814.      */
  815.     function getStaticContentCount)
  816.     {
  817.         $menus &JMenu::getInstance();
  818.         return count($menus->getItems('type''content_typed'));
  819.     }
  820.  
  821.     /**
  822.      * Deprecated.
  823.      *
  824.      * @since 1.0
  825.      * @deprecated As of version 1.5
  826.      */
  827.     function getContentItemLinkCount)
  828.     {
  829.         $menus &JMenu::getInstance();
  830.         return count($menus->getItems('type''content_item_link'));
  831.     }
  832.  
  833.     /**
  834.      * Deprecated, use JApplicationHelper::getPath instead.
  835.      *
  836.      * @since 1.0
  837.      * @deprecated As of version 1.5
  838.      * @see JApplicationHelper::getPath()
  839.      */
  840.     function getPath($varname$user_option null)
  841.     {
  842.         jimport('joomla.application.helper');
  843.         return JApplicationHelper::getPath ($varname$user_option);
  844.     }
  845.  
  846.     /**
  847.      * Deprecated, use JURI::base() instead.
  848.      *
  849.      * @since 1.0
  850.      * @deprecated As of version 1.5
  851.      * @see JURI::base()
  852.      */
  853.     function getBasePath($client=0$addTrailingSlash true)
  854.     {
  855.         return JURI::base();
  856.     }
  857.  
  858.     /**
  859.      * Deprecated, use JFactory::getUser instead.
  860.      *
  861.      * @since 1.0
  862.      * @deprecated As of version 1.5
  863.      * @see JFactory::getUser()
  864.      */
  865.     function &getUser()
  866.     {
  867.         $user =JFactory::getUser();
  868.         return $user;
  869.     }
  870.  
  871.     /**
  872.      * Deprecated, use JContentHelper::getItemid instead.
  873.      *
  874.      * @since 1.0
  875.      * @deprecated As of version 1.5
  876.      * @see JContentHelper::getItemid()
  877.      */
  878.     function getItemid$id )
  879.     {
  880.         require_once JPATH_SITE '/components/com_content/helpers/content.php';
  881.  
  882.         // Load the article data to know what section/category it is in.
  883.         $article =JTable::getInstance('content');
  884.         $article->load($id);
  885.  
  886.         return JContentHelper::getItemid($id$article->catid$article->sectionid);
  887.     }
  888. }

Documentation generated on Mon, 05 Mar 2007 20:52:14 +0000 by phpDocumentor 1.3.1