Merge pull request #5760 from sudhabisht/SMSissue
[civicrm-core.git] / CRM / Core / Action.php
index 01560b7b4d40803da9a8c6b64704673fe3933086..25cac391052f5e04c923776b80d915eab26c3adc 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.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * The core concept of the system is an action performed on an object. Typically this will be a "data model" object
@@ -31,7 +31,7 @@
  * and similar across all objects (thus providing both reuse and standards)
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -42,7 +42,6 @@ class CRM_Core_Action {
    * constant from CRM_Core_Form for various modes.
    *
    * @var integer const
-   *
    */
   const
     NONE = 0,
@@ -64,9 +63,9 @@ class CRM_Core_Action {
     RENEW = 32768,
     DETACH = 65536,
     REVERT = 131072,
-    CLOSE        =  262144,
-    REOPEN       =  524288,
-    MAX_ACTION   = 1048575;
+    CLOSE = 262144,
+    REOPEN = 524288,
+    MAX_ACTION = 1048575;
 
   //make sure MAX_ACTION = 2^n - 1 ( n = total number of actions )
 
@@ -75,9 +74,7 @@ class CRM_Core_Action {
    * bit manipulation operations so we can perform multiple
    * actions on the same object if needed
    *
-   * @var array $_names  type of variable name to action constant
-   *
-   * @static
+   * @var array $_names type of variable name to action constant
    *
    */
   static $_names = array(
@@ -96,25 +93,25 @@ class CRM_Core_Action {
     'renew' => self::RENEW,
     'detach' => self::DETACH,
     'revert' => self::REVERT,
-                           'close'         => self::CLOSE,
-                           'reopen'        => self::REOPEN,
+    'close' => self::CLOSE,
+    'reopen' => self::REOPEN,
   );
 
   /**
    * The flipped version of the names array, initialized when used
    *
    * @var array
-   * @static
    */
   static $_description;
 
   /**
-   * Called by the request object to translate a string into a mask
+   * Called by the request object to translate a string into a mask.
    *
-   * @param string $str the action to be resolved
+   * @param string $str
+   *   The action to be resolved.
    *
-   * @return int the action mask corresponding to the input string
-   * @static
+   * @return int
+   *   the action mask corresponding to the input string
    */
   public static function resolve($str) {
     $action = 0;
@@ -129,11 +126,11 @@ class CRM_Core_Action {
    * Given a string or an array of strings, determine the bitmask
    * for this set of actions
    *
-   * @param mixed $item either a single string or an array of strings
-   *
-   * @return int the action mask corresponding to the input args
-   * @static
+   * @param mixed $item
+   *   Either a single string or an array of strings.
    *
+   * @return int
+   *   the action mask corresponding to the input args
    */
   public static function map($item) {
     $mask = 0;
@@ -150,13 +147,13 @@ class CRM_Core_Action {
   }
 
   /**
-   * Given a string determine the bitmask for this specific string
-   *
-   * @param string $item the input action to process
+   * Given a string determine the bitmask for this specific string.
    *
-   * @return int the action mask corresponding to the input string
-   * @static
+   * @param string $item
+   *   The input action to process.
    *
+   * @return int
+   *   the action mask corresponding to the input string
    */
   public static function mapItem($item) {
     $mask = CRM_Utils_Array::value(trim($item), self::$_names);
@@ -167,11 +164,11 @@ class CRM_Core_Action {
    *
    * Given an action mask, find the corresponding description
    *
-   * @param int $mask the action mask
-   *
-   * @return string the corresponding action description
-   * @static
+   * @param int $mask
+   *   The action mask.
    *
+   * @return string
+   *   the corresponding action description
    */
   public static function description($mask) {
     if (!isset($_description)) {
@@ -185,20 +182,26 @@ class CRM_Core_Action {
    * Given a set of links and a mask, return the html action string for
    * the links associated with the mask
    *
-   * @param array $links the set of link items
-   * @param int $mask the mask to be used. a null mask means all items
-   * @param array $values the array of values for parameter substitution in the link items
-   * @param string $extraULName enclosed extra links in this UL.
-   * @param boolean $enclosedAllInSingleUL force to enclosed all links in single UL.
+   * @param array $links
+   *   The set of link items.
+   * @param int $mask
+   *   The mask to be used. a null mask means all items.
+   * @param array $values
+   *   The array of values for parameter substitution in the link items.
+   * @param string $extraULName
+   *   Enclosed extra links in this UL.
+   * @param bool $enclosedAllInSingleUL
+   *   Force to enclosed all links in single UL.
    *
    * @param null $op
    * @param null $objectName
    * @param int $objectId
    *
-   * @return string       the html string
-   * @static
+   * @return string
+   *   the html string
    */
-  static function formLink($links,
+  public static function formLink(
+    $links,
     $mask,
     $values,
     $extraULName = 'more',
@@ -268,7 +271,6 @@ class CRM_Core_Action {
       }
     }
 
-
     $mainLinks = $url;
     if ($enclosedAllInSingleUL) {
       $allLinks = '';
@@ -301,11 +303,13 @@ class CRM_Core_Action {
    * Given a string and an array of values, substitute the real values
    * in the placeholder in the str in the CiviCRM format
    *
-   * @param string $str    the string to be replaced
-   * @param array  $values the array of values for parameter substitution in the str
+   * @param string $str
+   *   The string to be replaced.
+   * @param array $values
+   *   The array of values for parameter substitution in the str.
    *
-   * @return string        the substituted string
-   * @static
+   * @return string
+   *   the substituted string
    */
   public static function &replace(&$str, &$values) {
     foreach ($values as $n => $v) {
@@ -317,10 +321,8 @@ class CRM_Core_Action {
   /**
    * Get the mask for a permission (view, edit or null)
    *
-   * @param string the permission
-   *
-   * @return int   the mask for the above permission
-   * @static
+   * @return int
+   *   the mask for the above permission
    */
   public static function mask($permissions) {
     $mask = NULL;
@@ -342,5 +344,5 @@ class CRM_Core_Action {
 
     return $mask;
   }
-}
 
+}