Merge pull request #5513 from mallezie/contact-select-file-16178
[civicrm-core.git] / CRM / Utils / System.php
index 7500f357cffcc3ad87d00e145b29192a0f34dece..112a9e1a0a905ecf8d0f0899adcdc385776d619d 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -183,7 +183,7 @@ class CRM_Utils_System {
    *
    * @return string
    */
-  static function theme(
+  public static function theme(
     &$content,
     $print = FALSE,
     $maintenance = FALSE
@@ -229,7 +229,7 @@ class CRM_Utils_System {
    * @return string
    *   An HTML string containing a link to the given path.
    */
-  static function url(
+  public static function url(
     $path = NULL,
     $query = NULL,
     $absolute = FALSE,
@@ -261,7 +261,7 @@ class CRM_Utils_System {
    *
    * @return string
    */
-  static function href(
+  public static function href(
     $text, $path = NULL, $query = NULL, $absolute = TRUE,
     $fragment = NULL, $htmlize = TRUE, $frontend = FALSE, $forceBackend = FALSE
   ) {
@@ -285,7 +285,9 @@ class CRM_Utils_System {
     return $config->userSystem->logout();
   }
 
-  // this is a very drupal specific function for now
+  /**
+   * this is a very drupal specific function for now.
+   */
   public static function updateCategories() {
     $config = CRM_Core_Config::singleton();
     if ($config->userSystem->is_drupal) {
@@ -425,7 +427,7 @@ class CRM_Utils_System {
    * @param string $message
    *   (optional) The message to provide in the body of the redirect page.
    */
-  static function jsRedirect(
+  public static function jsRedirect(
     $url = NULL,
     $title = NULL,
     $message = NULL
@@ -487,7 +489,7 @@ class CRM_Utils_System {
   }
 
   /**
-   * Determine the post URL for a form
+   * Determine the post URL for a form.
    *
    * @param $action
    *   The default action if one is pre-specified.
@@ -797,7 +799,7 @@ class CRM_Utils_System {
    * @param bool $output
    * @param string $disposition
    */
-  static function download(
+  public static function download(
     $name, $mimeType, &$buffer,
     $ext = NULL,
     $output = TRUE,
@@ -1170,7 +1172,7 @@ class CRM_Utils_System {
     }
   }
 
-  /*
+  /**
    * Get logged in user's IP address.
    *
    * Get IP address from HTTP REMOTE_ADDR header. If the CMS is Drupal then use
@@ -1183,11 +1185,6 @@ class CRM_Utils_System {
    * @return string
    *   IP address of logged in user.
    */
-  /**
-   * @param bool $strictIPV4
-   *
-   * @return mixed|string
-   */
   public static function ipAddress($strictIPV4 = TRUE) {
     $address = CRM_Utils_Array::value('REMOTE_ADDR', $_SERVER);
 
@@ -1303,13 +1300,13 @@ class CRM_Utils_System {
    * @param array $params
    *   An array of parameters (see CRM_Utils_System::docURL2 method for names)
    *
-   * @return string
+   * @return void|string
    *   URL or link to documentation page, based on provided parameters.
    */
   public static function docURL($params) {
 
     if (!isset($params['page'])) {
-      return;
+      return NULL;
     }
 
     if (CRM_Utils_Array::value('resource', $params) == 'wiki') {
@@ -1345,7 +1342,7 @@ class CRM_Utils_System {
   }
 
   /**
-   * Get the locale set in the hosting CMS
+   * Get the locale set in the hosting CMS.
    *
    * @return string
    *   The used locale or null for none.
@@ -1467,15 +1464,12 @@ class CRM_Utils_System {
     CRM_ACL_BAO_Cache::resetCache();
 
     // reset various static arrays used here
-    CRM_Contact_BAO_Contact::$_importableFields =
-    CRM_Contact_BAO_Contact::$_exportableFields =
-    CRM_Contribute_BAO_Contribution::$_importableFields =
-    CRM_Contribute_BAO_Contribution::$_exportableFields =
-    CRM_Pledge_BAO_Pledge::$_exportableFields =
-    CRM_Contribute_BAO_Query::$_contributionFields =
-    CRM_Core_BAO_CustomField::$_importFields =
-    CRM_Core_BAO_Cache::$_cache =
-    CRM_Core_DAO::$_dbColumnValueCache = NULL;
+    CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields
+      = CRM_Contribute_BAO_Contribution::$_importableFields
+        = CRM_Contribute_BAO_Contribution::$_exportableFields
+          = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields
+            = CRM_Core_BAO_CustomField::$_importFields
+              = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;
 
     CRM_Core_OptionGroup::flushAll();
     CRM_Utils_PseudoConstant::flushAll();
@@ -1645,7 +1639,7 @@ class CRM_Utils_System {
    * @return string
    *   , formatted url.
    */
-  static function languageNegotiationURL(
+  public static function languageNegotiationURL(
     $url,
     $addLanguagePart = TRUE,
     $removeLanguagePart = FALSE
@@ -1667,7 +1661,7 @@ class CRM_Utils_System {
    *   (optional) Sent by contribution/event reg/profile pages which uses a id
    *   specific extra file name if present.
    */
-  static function appendTPLFile(
+  public static function appendTPLFile(
     $fileName,
     &$content,
     $overideFileName = NULL
@@ -1828,22 +1822,22 @@ class CRM_Utils_System {
   }
 
   /**
-   * Determine the standard URL for viewing or editing the specified link
+   * Determine the standard URL for viewing or editing the specified link.
    *
    * This function delegates the decision-making to (a) the hook system and
    * (b) the BAO system.
    *
    * @param array $crudLinkSpec
    *   With keys:.
-   *  - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
-   *  - entity_table: string, eg "civicrm_contact"
-   *  - entity_id: int
+   *   - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
+   *   - entity_table: string, eg "civicrm_contact"
+   *   - entity_id: int
    * @return array|NULL
    *   NULL if unavailable, or an array. array has keys:
-   *  - path: string
-   *  - query: array
-   *  - title: string
-   *  - url: string
+   *   - path: string
+   *   - query: array
+   *   - title: string
+   *   - url: string
    */
   public static function createDefaultCrudLink($crudLinkSpec) {
     $crudLinkSpec['action'] = CRM_Utils_Array::value('action', $crudLinkSpec, CRM_Core_Action::VIEW);
@@ -1878,4 +1872,5 @@ class CRM_Utils_System {
 
     return NULL;
   }
+
 }