INFRA-132 - Docblock @param and @return tag fixes
[civicrm-core.git] / CRM / Utils / System / Joomla.php
index 8471667dc87d08456a0cd60983c70ad957c0ed36..ad04fd5206ffff499cb5db8987664242544c18eb 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -38,9 +38,8 @@
  */
 class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
-   *
    */
-  function __construct() {
+  public function __construct() {
     /**
      * deprecated property to check if this is a drupal install. The correct method is to have functions on the UF classes for all UF specific
      * functions and leave the codebase oblivious to the type of CMS
@@ -53,20 +52,20 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Create a user of Joomla.
    *
-   * @param array  $params associated array
-   * @param string $mail email id for cms user
-   *
-   * @return uid if user exists, false otherwise
+   * @param array $params
+   * @param string $mail
+   *   Email id for cms user.
    *
-   * @access public
+   * @return int|bool
+   *   uid if user exists, false otherwise
    */
-  function createUser(&$params, $mail) {
+  public function createUser(&$params, $mail) {
     $baseDir = JPATH_SITE;
     require_once $baseDir . '/components/com_users/models/registration.php';
 
     $userParams = JComponentHelper::getParams('com_users');
-    $model      = new UsersModelRegistration();
-    $ufID       = NULL;
+    $model = new UsersModelRegistration();
+    $ufID = NULL;
 
     // get the default usertype
     $userType = $userParams->get('new_usertype');
@@ -85,11 +84,11 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     }
 
     // Prepare the values for a new Joomla user.
-    $values              = array();
-    $values['name']      = $fullname;
-    $values['username']  = trim($params['cms_name']);
+    $values = array();
+    $values['name'] = $fullname;
+    $values['username'] = trim($params['cms_name']);
     $values['password1'] = $values['password2'] = $params['cms_pass'];
-    $values['email1']    = $values['email2'] = trim($params[$mail]);
+    $values['email1'] = $values['email2'] = trim($params[$mail]);
 
     $lang = JFactory::getLanguage();
     $lang->load('com_users', $baseDir);
@@ -103,10 +102,10 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    *  Change user name in host CMS
    *
-   *  @param integer $ufID User ID in CMS
-   *  @param string $ufName User name
+   * @param int $ufID
+   * @param string $ufName User name
    */
-  function updateCMSName($ufID, $ufName) {
+  public function updateCMSName($ufID, $ufName) {
     $ufID = CRM_Utils_Type::escape($ufID, 'Integer');
     $ufName = CRM_Utils_Type::escape($ufName, 'String');
 
@@ -122,17 +121,20 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Check if username and email exists in the drupal db
    *
-   * @param array $params array of name and mail values
-   * @param array $errors array of errors
-   * @param string $emailName  field label for the 'email'
+   * @param array $params
+   *   Array of name and mail values.
+   * @param array $errors
+   *   Array of errors.
+   * @param string $emailName
+   *   Field label for the 'email'.
    *
    * @return void
    */
-  function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
+  public function checkUserNameEmailExists(&$params, &$errors, $emailName = 'email') {
     $config = CRM_Core_Config::singleton();
 
-    $dao   = new CRM_Core_DAO();
-    $name  = $dao->escape(CRM_Utils_Array::value('name', $params));
+    $dao = new CRM_Core_DAO();
+    $name = $dao->escape(CRM_Utils_Array::value('name', $params));
     $email = $dao->escape(CRM_Utils_Array::value('mail', $params));
     //don't allow the special characters and min. username length is two
     //regex \\ to match a single backslash would become '/\\\\/'
@@ -141,7 +143,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
       $errors['cms_name'] = ts('Your username contains invalid characters or is too short');
     }
 
-
     $JUserTable = &JTable::getInstance('User', 'JTable');
 
     $db = $JUserTable->getDbo();
@@ -177,13 +178,13 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Sets the title of the page
    *
-   * @param string $title title to set
+   * @param string $title
+   *   Title to set.
    * @param string $pageTitle
    *
    * @return void
-   * @access public
    */
-  function setTitle($title, $pageTitle = NULL) {
+  public function setTitle($title, $pageTitle = NULL) {
     if (!$pageTitle) {
       $pageTitle = $title;
     }
@@ -206,9 +207,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @internal param string $url
    *
    * @return void
-   * @access public
    */
-  function appendBreadCrumb($breadCrumbs) {
+  public function appendBreadCrumb($breadCrumbs) {
     $template = CRM_Core_Smarty::singleton();
     $bc = $template->get_template_vars('breadcrumb');
 
@@ -238,9 +238,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @internal param string $bc the new breadcrumb to be appended
    *
    * @return void
-   * @access public
    */
-  function resetBreadCrumb() {
+  public function resetBreadCrumb() {
     return;
   }
 
@@ -252,9 +251,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @internal param string $head the new string to be appended
    *
    * @return void
-   * @access public
    */
-  static function addHTMLHead($string = NULL) {
+  public static function addHTMLHead($string = NULL) {
     if ($string) {
       $document = JFactory::getDocument();
       $document->addCustomTag($string);
@@ -264,14 +262,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Add a script file
    *
-   * @param $url: string, absolute path to file
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $url : string, absolute path to file
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addScriptUrl($url, $region) {
     return FALSE;
@@ -280,14 +279,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Add an inline script
    *
-   * @param $code: string, javascript code
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $code : string, javascript code
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addScript($code, $region) {
     return FALSE;
@@ -296,14 +296,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Add a css file
    *
-   * @param $url: string, absolute path to file
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $url : string, absolute path to file
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addStyleUrl($url, $region) {
     if ($region == 'html-header') {
@@ -317,14 +318,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Add an inline style
    *
-   * @param $code: string, css code
-   * @param $region string, location within the document: 'html-header', 'page-header', 'page-footer'
+   * @param $code : string, css code
+   * @param string $region
+   *   location within the document: 'html-header', 'page-header', 'page-footer'.
    *
    * Note: This function is not to be called directly
    * @see CRM_Core_Region::render()
    *
-   * @return bool TRUE if we support this operation in this CMS, FALSE otherwise
-   * @access public
+   * @return bool
+   *   TRUE if we support this operation in this CMS, FALSE otherwise
    */
   public function addStyle($code, $region) {
     if ($region == 'html-header') {
@@ -338,29 +340,36 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Generate an internal CiviCRM URL
    *
-   * @param $path     string   The path being linked to, such as "civicrm/add"
-   * @param $query    string   A query string to append to the link.
-   * @param $absolute boolean  Whether to force the output to be an absolute link (beginning with http:).
+   * @param string $path
+   *   The path being linked to, such as "civicrm/add".
+   * @param string $query
+   *   A query string to append to the link.
+   * @param bool $absolute
+   *   Whether to force the output to be an absolute link (beginning with http:).
    *                           Useful for links that will be displayed outside the site, such as in an
    *                           RSS feed.
-   * @param $fragment string   A fragment identifier (named anchor) to append to the link.
-   * @param $htmlize  boolean  whether to convert to html eqivalant
-   * @param $frontend boolean  a gross joomla hack
+   * @param string $fragment
+   *   A fragment identifier (named anchor) to append to the link.
+   * @param bool $htmlize
+   *   whether to convert to html eqivalant.
+   * @param bool $frontend
+   *   a gross joomla hack.
    *
    * @param bool $forceBackend
    *
-   * @return string            an HTML string containing a link to the given path.
-   * @access public
+   * @return string
+   *   an HTML string containing a link to the given path.
    */
-  function url($path = NULL, $query = NULL, $absolute = TRUE,
+  function url(
+    $path = NULL, $query = NULL, $absolute = TRUE,
     $fragment = NULL, $htmlize = TRUE,
     $frontend = FALSE, $forceBackend = FALSE
   ) {
-    $config    = CRM_Core_Config::singleton();
+    $config = CRM_Core_Config::singleton();
     $separator = $htmlize ? '&amp;' : '&';
-    $Itemid    = '';
-    $script    = '';
-    $path      = CRM_Utils_String::stripPathChars($path);
+    $Itemid = '';
+    $script = '';
+    $path = CRM_Utils_String::stripPathChars($path);
 
     if ($config->userFrameworkFrontend) {
       $script = 'index.php';
@@ -398,7 +407,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     elseif ($forceBackend) {
       if (defined('JVERSION')) {
         $joomlaVersion = JVERSION;
-      } else {
+      }
+      else {
         $jversion = new JVersion;
         $joomlaVersion = $jversion->getShortVersion();
       }
@@ -416,7 +426,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * @return void
    * access public
    */
-  function mapConfigToSSL() {
+  public function mapConfigToSSL() {
     // dont need to do anything, let CMS handle their own switch to SSL
     return;
   }
@@ -424,12 +434,13 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Figure out the post url for the form
    *
-   * @param $action the default action if one is pre-specified
+   * @param $action
+   *   The default action if one is pre-specified.
    *
-   * @return string the url to post the form
-   * @access public
+   * @return string
+   *   the url to post the form
    */
-  function postURL($action) {
+  public function postURL($action) {
     if (!empty($action)) {
       return $action;
     }
@@ -442,12 +453,12 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Set the email address of the user
    *
-   * @param object $user handle to the user object
+   * @param object $user
+   *   Handle to the user object.
    *
    * @return void
-   * @access public
    */
-  function setEmail(&$user) {
+  public function setEmail(&$user) {
     global $database;
     $query = "SELECT email FROM #__users WHERE id='$user->id'";
     $database->setQuery($query);
@@ -457,16 +468,17 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Authenticate the user against the joomla db
    *
-   * @param string $name     the user name
-   * @param string $password the password for the above user name
-   * @param $loadCMSBootstrap boolean load cms bootstrap?
+   * @param string $name
+   *   The user name.
+   * @param string $password
+   *   The password for the above user name.
+   * @param bool $loadCMSBootstrap
+   *   load cms bootstrap?.
    *
-   * @return mixed false if no auth
-   *               array(
-      contactID, ufID, unique string ) if success
-   * @access public
+   * @return array|bool
+   *   [contactID, ufID, uniqueString] if success else false if no auth
    */
-  function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
+  public function authenticate($name, $password, $loadCMSBootstrap = FALSE) {
     require_once 'DB.php';
 
     $config = CRM_Core_Config::singleton();
@@ -503,7 +515,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     }
 
     $joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
-    if ( !defined('JVERSION') ) {
+    if (!defined('JVERSION')) {
       require $joomlaBase . '/libraries/cms/version/version.php';
       $jversion = new JVersion;
       define('JVERSION', $jversion->getShortVersion());
@@ -514,8 +526,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
       $dbId = $row->id;
       $dbEmail = $row->email;
 
-      if ( version_compare(JVERSION, '2.5.18', 'lt') ||
-        ( version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt') )
+      if (version_compare(JVERSION, '2.5.18', 'lt') ||
+        (version_compare(JVERSION, '3.0', 'ge') && version_compare(JVERSION, '3.2.1', 'lt'))
       ) {
         // now check password
         if (strpos($dbPassword, ':') === FALSE) {
@@ -532,10 +544,12 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
         }
       }
       else {
-        if (!JUserHelper::verifyPassword($password, $dbPassword, $dbId)) return FALSE;
+        if (!JUserHelper::verifyPassword($password, $dbPassword, $dbId)) {
+          return FALSE;
+        }
 
         //include additional files required by Joomla 3.2.1+
-        if ( version_compare(JVERSION, '3.2.1', 'ge') ) {
+        if (version_compare(JVERSION, '3.2.1', 'ge')) {
           require_once $joomlaBase . '/libraries/cms/application/helper.php';
           require_once $joomlaBase . '/libraries/cms/application/cms.php';
           require_once $joomlaBase . '/libraries/cms/application/administrator.php';
@@ -556,13 +570,12 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Set a init session with user object
    *
-   * @param array $data  array with user specific data
-   *
-   * @access public
+   * @param array $data
+   *   Array with user specific data.
    */
-  function setUserSession($data) {
+  public function setUserSession($data) {
     list($userID, $ufID) = $data;
-    $user = new JUser( $ufID );
+    $user = new JUser($ufID);
     $session = JFactory::getSession();
     $session->set('user', $user);
 
@@ -572,11 +585,10 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Set a message in the UF to display to a user
    *
-   * @param string $message  the message to set
-   *
-   * @access public
+   * @param string $message
+   *   The message to set.
    */
-  function setMessage($message) {
+  public function setMessage($message) {
     return;
   }
 
@@ -585,15 +597,15 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    *
    * @return bool
    */
-  function loadUser($user) {
+  public function loadUser($user) {
     return TRUE;
   }
 
-  function permissionDenied() {
+  public function permissionDenied() {
     CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
   }
 
-  function logout() {
+  public function logout() {
     session_destroy();
     header("Location:index.php");
   }
@@ -601,9 +613,10 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Get the locale set in the hosting CMS
    *
-   * @return string  the used locale or null for none
+   * @return string
+   *   the used locale or null for none
    */
-  function getUFLocale() {
+  public function getUFLocale() {
     if (defined('_JEXEC')) {
       $conf = JFactory::getConfig();
       $locale = $conf->get('language');
@@ -615,7 +628,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * @return string
    */
-  function getVersion() {
+  public function getVersion() {
     if (class_exists('JVersion')) {
       $version = new JVersion;
       return $version->getShortVersion();
@@ -628,21 +641,23 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Load joomla bootstrap
    *
-   * @param $params array with uid or name and password
-   * @param $loadUser boolean load cms user?
+   * @param array $params
+   *   with uid or name and password.
+   * @param bool $loadUser
+   *   load cms user?.
    * @param bool|\throw $throwError throw error on failure?
    * @param null $realPath
    * @param bool $loadDefines
    *
    * @return bool
    */
-  function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL, $loadDefines = TRUE) {
+  public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError = TRUE, $realPath = NULL, $loadDefines = TRUE) {
     // Setup the base path related constant.
     $joomlaBase = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))));
 
     // load BootStrap here if needed
     // We are a valid Joomla entry point.
-    if ( ! defined( '_JEXEC' ) && $loadDefines ) {
+    if (!defined('_JEXEC') && $loadDefines) {
       define('_JEXEC', 1);
       define('DS', DIRECTORY_SEPARATOR);
       define('JPATH_BASE', $joomlaBase . '/administrator');
@@ -658,13 +673,13 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     require $joomlaBase . '/configuration.php';
 
     // Files may be in different places depending on Joomla version
-    if ( !defined('JVERSION') ) {
+    if (!defined('JVERSION')) {
       require $joomlaBase . '/libraries/cms/version/version.php';
       $jversion = new JVersion;
       define('JVERSION', $jversion->getShortVersion());
     }
 
-    if( version_compare(JVERSION, '3.0', 'lt') ) {
+    if (version_compare(JVERSION, '3.0', 'lt')) {
       require $joomlaBase . '/libraries/joomla/environment/uri.php';
       require $joomlaBase . '/libraries/joomla/application/component/helper.php';
     }
@@ -685,7 +700,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Check is user logged in.
    *
-   * @return boolean true/false.
+   * @return boolean
    */
   public function isUserLoggedIn() {
     $user = JFactory::getUser();
@@ -695,7 +710,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Get currently logged in user uf id.
    *
-   * @return int logged in user uf id.
+   * @return int
+   *   logged in user uf id.
    */
   public function getLoggedInUfID() {
     $user = JFactory::getUser();
@@ -705,41 +721,47 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Get currently logged in user unique identifier - this tends to be the email address or user name.
    *
-   * @return string $userID logged in user unique identifier
+   * @return string
+   *   logged in user unique identifier
    */
-  function getLoggedInUniqueIdentifier() {
+  public function getLoggedInUniqueIdentifier() {
     $user = JFactory::getUser();
     return $this->getUniqueIdentifierFromUserObject($user);
   }
+
   /**
    * Get User ID from UserFramework system (Joomla)
-   * @param object $user object as described by the CMS
-   * @return mixed <NULL, number>
+   * @param object $user
+   *   Object as described by the CMS.
+   * @return mixed
+   *   <NULL, number>
    */
-  function getUserIDFromUserObject($user) {
+  public function getUserIDFromUserObject($user) {
     return !empty($user->id) ? $user->id : NULL;
   }
 
   /**
    * Get Unique Identifier from UserFramework system (CMS)
-   * @param object $user object as described by the User Framework
-   * @return mixed $uniqueIdentifer Unique identifier from the user Framework system
-   *
+   * @param object $user
+   *   Object as described by the User Framework.
+   * @return mixed
+   *   $uniqueIdentifer Unique identifier from the user Framework system
    */
-  function getUniqueIdentifierFromUserObject($user) {
+  public function getUniqueIdentifierFromUserObject($user) {
     return ($user->guest) ? NULL : $user->email;
   }
 
   /**
    * Get a list of all installed modules, including enabled and disabled ones
    *
-   * @return array CRM_Core_Module
+   * @return array
+   *   CRM_Core_Module
    */
-  function getModules() {
+  public function getModules() {
     $result = array();
 
     $db = JFactory::getDbo();
-    $query = $db->getQuery(true);
+    $query = $db->getQuery(TRUE);
     $query->select('type, folder, element, enabled')
       ->from('#__extensions')
       ->where('type =' . $db->Quote('plugin'));
@@ -756,9 +778,11 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
   /**
    * Get user login URL for hosting CMS (method declared in each CMS system class)
    *
-   * @param string $destination - if present, add destination to querystring (works for Drupal only)
+   * @param string $destination
+   *   If present, add destination to querystring (works for Drupal only).
    *
-   * @return string - loginURL for the current CMS
+   * @return string
+   *   loginURL for the current CMS
    * @static
    */
   public function getLoginURL($destination = '') {
@@ -768,8 +792,8 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     $loginURL .= 'index.php?option=com_users&view=login';
 
     //CRM-14872 append destination
-    if ( !empty($destination) ) {
-      $loginURL .= '&return='.urlencode(base64_encode($destination));
+    if (!empty($destination)) {
+      $loginURL .= '&return=' . urlencode(base64_encode($destination));
     }
     return $loginURL;
   }
@@ -802,7 +826,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
     $destination = NULL;
     if ($args) {
       // append destination so user is returned to form they came from after login
-      $args = 'reset=1'.$args;
+      $args = 'reset=1' . $args;
       $destination = CRM_Utils_System::url(CRM_Utils_System::currentPath(), $args, TRUE, NULL, TRUE, TRUE);
     }
 
@@ -814,12 +838,13 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    *
    * @param $dir
    *
-   * @return array array
+   * @return array
+   *   array
    * - $url, (Joomla - non admin url)
    * - $siteName,
    * - $siteRoot
    */
-  function getDefaultSiteSettings($dir){
+  public function getDefaultSiteSettings($dir) {
     $config = CRM_Core_Config::singleton();
     $url = preg_replace(
       '|/administrator|',
@@ -836,11 +861,12 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
 
   /**
    * Get Url to view user record
-   * @param integer $contactID Contact ID
+   * @param int $contactID
+   *   Contact ID.
    *
    * @return string
    */
-  function getUserRecordUrl($contactID) {
+  public function getUserRecordUrl($contactID) {
     $uid = CRM_Core_BAO_UFMatch::getUFId($contactID);
     $userRecordUrl = NULL;
     // if logged in user is super user, then he can view other users joomla profile
@@ -856,7 +882,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * Is the current user permitted to add a user
    * @return bool
    */
-  function checkPermissionAddUser() {
+  public function checkPermissionAddUser() {
     if (JFactory::getUser()->authorise('core.create', 'com_users')) {
       return TRUE;
     }
@@ -866,17 +892,23 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    * Output code from error function
    * @param string $content
    */
-  function outputError($content) {
+  public function outputError($content) {
     if (class_exists('JErrorPage')) {
       $error = new Exception($content);
       JErrorPage::render($error);
     }
-    else if (class_exists('JError')) {
+    elseif (class_exists('JError')) {
       JError::raiseError('CiviCRM-001', $content);
     }
     else {
       parent::outputError($content);
     }
   }
-}
 
+  /**
+   * Append to coreResourcesList
+   */
+  public function appendCoreResources(&$list) {
+    $list[] = 'js/crm.joomla.js';
+  }
+}