CRM-15978 remove redundant test_mode check
[civicrm-core.git] / CRM / Core / Region.php
index 8ba4f7faa2fed5a124fdd4aa8e69bd6de547aba4..7868cee23813384dcd91f33f40ccb39a2d88c6d8 100644 (file)
@@ -7,7 +7,7 @@ class CRM_Core_Region {
   static private $_instances = NULL;
 
   /**
-   * Obtain the content for a given region
+   * Obtain the content for a given region.
    *
    * @param string $name
    * @param bool $autocreate
@@ -15,7 +15,7 @@ class CRM_Core_Region {
    * @return CRM_Core_Region
    */
   public static function &instance($name, $autocreate = TRUE) {
-    if ( $autocreate && ! isset( self::$_instances[$name] ) ) {
+    if ($autocreate && !isset(self::$_instances[$name])) {
       self::$_instances[$name] = new CRM_Core_Region($name);
     }
     return self::$_instances[$name];
@@ -48,7 +48,7 @@ class CRM_Core_Region {
   public function __construct($name) {
     // Templates injected into regions should normally be file names, but sometimes inline notation is handy.
     require_once 'CRM/Core/Smarty/resources/String.php';
-    civicrm_smarty_register_string_resource( );
+    civicrm_smarty_register_string_resource();
 
     $this->_name = $name;
     $this->_snippets = array();
@@ -64,7 +64,7 @@ class CRM_Core_Region {
   }
 
   /**
-   * Add a snippet of content to a region
+   * Add a snippet of content to a region.
    *
    * @code
    * CRM_Core_Region::instance('page-header')->add(array(
@@ -84,7 +84,7 @@ class CRM_Core_Region {
    * Note: This function does not perform any extra encoding of markup, script code, or etc. If
    * you're passing in user-data, you must clean it yourself.
    *
-   * @param $snippet
+   * @param array $snippet
    *   Array; keys:.
    *   - type: string (auto-detected for markup, template, callback, script, scriptUrl, jquery, style, styleUrl)
    *   - name: string, optional
@@ -146,7 +146,7 @@ class CRM_Core_Region {
   }
 
   /**
-   * Render all the snippets in a region
+   * Render all the snippets in a region.
    *
    * @param string $default
    *   HTML, the initial content of the region.
@@ -219,8 +219,8 @@ class CRM_Core_Region {
 
         default:
           require_once 'CRM/Core/Error.php';
-          CRM_Core_Error::fatal( ts( 'Snippet type %1 is unrecognized',
-                     array( 1 => $snippet['type'] ) ) );
+          CRM_Core_Error::fatal(ts('Snippet type %1 is unrecognized',
+            array(1 => $snippet['type'])));
       }
     }
     return $html;
@@ -233,59 +233,64 @@ class CRM_Core_Region {
    * @return int
    */
   public static function _cmpSnippet($a, $b) {
-    if ($a['weight'] < $b['weight']) { return -1;
+    if ($a['weight'] < $b['weight']) {
+      return -1;
     }
-    if ($a['weight'] > $b['weight']) { return 1;
+    if ($a['weight'] > $b['weight']) {
+      return 1;
     }
     // fallback to name sort; don't really want to do this, but it makes results more stable
-    if ($a['name'] < $b['name']) { return -1;
+    if ($a['name'] < $b['name']) {
+      return -1;
     }
-    if ($a['name'] > $b['name']) { return 1;
+    if ($a['name'] > $b['name']) {
+      return 1;
     }
     return 0;
   }
 
   /**
-   * Add block of static HTML to a region
+   * Add block of static HTML to a region.
    *
    * @param string $markup
    *   HTML.
    *
-  public function addMarkup($markup) {
-  return $this->add(array(
-  'type' => 'markup',
-  'markup' => $markup,
-  ));
-  }
-
-  /**
-   * Add a Smarty template file to a region
+   * public function addMarkup($markup) {
+   * return $this->add(array(
+   * 'type' => 'markup',
+   * 'markup' => $markup,
+   * ));
+   * }
+   *
+   * /**
+   * Add a Smarty template file to a region.
    *
    * Note: File is not evaluated until the page is rendered
    *
    * @param string $template
    *   Path to the Smarty template file.
    *
-  public function addTemplate($template) {
-  return $this->add(array(
-  'type' => 'template',
-  'template' => $template,
-  ));
-  }
-
-  /**
-   * Use a callback function to extend a region
+   * public function addTemplate($template) {
+   * return $this->add(array(
+   * 'type' => 'template',
+   * 'template' => $template,
+   * ));
+   * }
+   *
+   * /**
+   * Use a callback function to extend a region.
    *
    * @param mixed $callback
    * @param array $arguments
    *   Optional, array of parameters for callback; if omitted, the default arguments are ($snippetSpec, $html).
    *
-  public function addCallback($callback, $arguments = FALSE) {
-  return $this->add(array(
-  'type' => 'callback',
-  'callback' => $callback,
-  'arguments' => $arguments,
-  ));
-  }
-  */
+   * public function addCallback($callback, $arguments = FALSE) {
+   * return $this->add(array(
+   * 'type' => 'callback',
+   * 'callback' => $callback,
+   * 'arguments' => $arguments,
+   * ));
+   * }
+   */
+
 }