Source for file users.php

Documentation is available at users.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_users
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Users Html Helper
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. abstract class JHtmlUsers
  20. {
  21.     public static function value($value)
  22.     {
  23.         if (is_string($value))
  24.         {
  25.             $value trim($value);
  26.         }
  27.         if (empty($value))
  28.         {
  29.             return JText::_('COM_USERS_PROFILE_VALUE_NOT_FOUND');
  30.         }
  31.  
  32.         elseif (!is_array($value))
  33.         {
  34.             return htmlspecialchars($value);
  35.         }
  36.     }
  37.  
  38.     public static function spacer($value)
  39.     {
  40.         return '';
  41.     }
  42.  
  43.     public static function helpsite($value)
  44.     {
  45.         if (empty($value))
  46.         {
  47.             return static::value($value);
  48.         }
  49.         else
  50.         {
  51.             $pathToXml JPATH_ADMINISTRATOR '/help/helpsites.xml';
  52.  
  53.             $text $value;
  54.             if (!empty($pathToXml&& $xml simplexml_load_file($pathToXml))
  55.             {
  56.                 foreach ($xml->sites->site as $site)
  57.                 {
  58.                     if ((string) $site->attributes()->url == $value)
  59.                     {
  60.                         $text = (string) $site;
  61.                         break;
  62.                     }
  63.                 }
  64.             }
  65.  
  66.             $value htmlspecialchars($value);
  67.             if (substr($value04== "http")
  68.             {
  69.                 return '<a href="' $value '">' $text '</a>';
  70.             }
  71.             else
  72.             {
  73.                 return '<a href="http://' $value '">' $text '</a>';
  74.             }
  75.         }
  76.     }
  77.  
  78.     public static function templatestyle($value)
  79.     {
  80.         if (empty($value))
  81.         {
  82.             return static::value($value);
  83.         }
  84.         else
  85.         {
  86.             $db JFactory::getDbo();
  87.             $query $db->getQuery(true)
  88.                 ->select('title')
  89.                 ->from('#__template_styles')
  90.                 ->where('id = ' $db->quote($value));
  91.             $db->setQuery($query);
  92.             $title $db->loadResult();
  93.             if ($title)
  94.             {
  95.                 return htmlspecialchars($title);
  96.             }
  97.             else
  98.             {
  99.                 return static::value('');
  100.             }
  101.         }
  102.     }
  103.  
  104.     public static function admin_language($value)
  105.     {
  106.         if (empty($value))
  107.         {
  108.             return static::value($value);
  109.         }
  110.         else
  111.         {
  112.             $path JLanguage::getLanguagePath(JPATH_ADMINISTRATOR$value);
  113.             $file "$value.xml";
  114.  
  115.             $result null;
  116.             if (is_file("$path/$file"))
  117.             {
  118.                 $result JLanguage::parseXMLLanguageFile("$path/$file");
  119.             }
  120.  
  121.             if ($result)
  122.             {
  123.                 return htmlspecialchars($result['name']);
  124.             }
  125.             else
  126.             {
  127.                 return static::value('');
  128.             }
  129.         }
  130.     }
  131.  
  132.     public static function language($value)
  133.     {
  134.         if (empty($value))
  135.         {
  136.             return static::value($value);
  137.         }
  138.         else
  139.         {
  140.             $path JLanguage::getLanguagePath(JPATH_SITE$value);
  141.             $file "$value.xml";
  142.  
  143.             $result null;
  144.             if (is_file("$path/$file"))
  145.             {
  146.                 $result JLanguage::parseXMLLanguageFile("$path/$file");
  147.             }
  148.  
  149.             if ($result)
  150.             {
  151.                 return htmlspecialchars($result['name']);
  152.             }
  153.             else
  154.             {
  155.                 return static::value('');
  156.             }
  157.         }
  158.     }
  159.  
  160.     public static function editor($value)
  161.     {
  162.         if (empty($value))
  163.         {
  164.             return static::value($value);
  165.         }
  166.         else
  167.         {
  168.             $db JFactory::getDbo();
  169.             $lang JFactory::getLanguage();
  170.             $query $db->getQuery(true)
  171.                 ->select('name')
  172.                 ->from('#__extensions')
  173.                 ->where('element = ' $db->quote($value))
  174.                 ->where('folder = ' $db->quote('editors'));
  175.             $db->setQuery($query);
  176.             $title $db->loadResult();
  177.             if ($title)
  178.             {
  179.                 $lang->load("plg_editors_$value.sys"JPATH_ADMINISTRATORnullfalsetrue)
  180.                     || $lang->load("plg_editors_$value.sys"JPATH_PLUGINS '/editors/' $valuenullfalsetrue);
  181.                 $lang->load($title '.sys');
  182.                 return JText::_($title);
  183.             }
  184.             else
  185.             {
  186.                 return static::value('');
  187.             }
  188.         }
  189.     }
  190. }

Documentation generated on Tue, 19 Nov 2013 15:16:42 +0100 by phpDocumentor 1.4.3