[cleanup] Remove deprecated pattern &CRM_Core_Config::singleton()
[civicrm-core.git] / CRM / Utils / System / Base.php
index c2978ecf942ea80f2eb1682310491d556de86f6f..a83754f7cf651899b056af88dabdec84f2a8089e 100644 (file)
@@ -11,44 +11,44 @@ abstract class CRM_Utils_System_Base {
    * 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
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is Drupal.
    */
-  var $is_drupal = FALSE;
+  public $is_drupal = FALSE;
 
   /**
    * Deprecated property to check if this is a joomla 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
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is Joomla!.
    */
-  var $is_joomla = FALSE;
+  public $is_joomla = FALSE;
 
   /**
    * deprecated property to check if this is a wordpress 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
    *
-   * @deprecated
    * @var bool
+   * @deprecated
    *   TRUE, if the CMS is WordPress.
    */
-  var $is_wordpress = FALSE;
+  public $is_wordpress = FALSE;
 
   /**
    * Does this CMS / UF support a CMS specific logging mechanism?
-   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    * @var bool
+   * @todo - we should think about offering up logging mechanisms in a way that is also extensible by extensions
    */
-  var $supports_UF_Logging = FALSE;
+  public $supports_UF_Logging = FALSE;
 
   /**
    * @var bool
    *   TRUE, if the CMS allows CMS forms to be extended by hooks.
    */
-  var $supports_form_extensions = FALSE;
+  public $supports_form_extensions = FALSE;
 
   public function initialize() {
     if (\CRM_Utils_System::isSSL()) {
@@ -56,6 +56,8 @@ abstract class CRM_Utils_System_Base {
     }
   }
 
+  abstract public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE, $realPath = NULL);
+
   /**
    * Append an additional breadcrumb tag to the existing breadcrumb.
    *
@@ -244,7 +246,7 @@ abstract class CRM_Utils_System_Base {
         if ($region = CRM_Core_Region::instance('html-header', FALSE)) {
           CRM_Utils_System::addHTMLHead($region->render(''));
         }
-        print theme('maintenance_page', array('content' => $content));
+        print theme('maintenance_page', ['content' => $content]);
         exit();
       }
       // TODO: Figure out why D7 returns but everyone else prints
@@ -252,10 +254,9 @@ abstract class CRM_Utils_System_Base {
     }
     $out = $content;
 
-    $config = &CRM_Core_Config::singleton();
     if (
       !$print &&
-      $config->userFramework == 'WordPress'
+      CRM_Core_Config::singleton()->userFramework == 'WordPress'
     ) {
       if (!function_exists('is_admin')) {
         throw new \Exception('Function "is_admin()" is missing, even though WordPress is the user framework.');
@@ -422,7 +423,7 @@ abstract class CRM_Utils_System_Base {
    * @return string
    *   loginURL for the current CMS
    */
-  public abstract function getLoginURL($destination = '');
+  abstract public function getLoginURL($destination = '');
 
   /**
    * Get the login destination string.
@@ -581,7 +582,7 @@ abstract class CRM_Utils_System_Base {
   public function getDefaultSiteSettings($dir) {
     $config = CRM_Core_Config::singleton();
     $url = $config->userFrameworkBaseURL;
-    return array($url, NULL, NULL);
+    return [$url, NULL, NULL];
   }
 
   /**
@@ -618,10 +619,10 @@ abstract class CRM_Utils_System_Base {
       throw new CRM_Core_Exception("Failed to locate default file storage ($config->userFramework)");
     }
 
-    return array(
+    return [
       'url' => $filesURL,
       'path' => CRM_Utils_File::baseFilePath(),
-    );
+    ];
   }
 
   /**
@@ -678,10 +679,10 @@ abstract class CRM_Utils_System_Base {
       $userFrameworkResourceURL = NULL;
     }
 
-    return array(
+    return [
       'url' => CRM_Utils_File::addTrailingSlash($userFrameworkResourceURL),
       'path' => CRM_Utils_File::addTrailingSlash($civicrm_root),
-    );
+    ];
   }
 
   /**
@@ -694,7 +695,7 @@ abstract class CRM_Utils_System_Base {
    *
    * FIXME: Document values accepted/required by $params
    */
-  public function userLoginFinalize($params = array()) {
+  public function userLoginFinalize($params = []) {
   }
 
   /**
@@ -708,7 +709,6 @@ abstract class CRM_Utils_System_Base {
     }
   }
 
-
   /**
    * Get timezone from CMS.
    *
@@ -789,14 +789,14 @@ abstract class CRM_Utils_System_Base {
    *   - name (ie the system user name.
    */
   public function getUser($contactID) {
-    $ufMatch = civicrm_api3('UFMatch', 'getsingle', array(
+    $ufMatch = civicrm_api3('UFMatch', 'getsingle', [
       'contact_id' => $contactID,
       'domain_id' => CRM_Core_Config::domainID(),
-    ));
-    return array(
+    ]);
+    return [
       'id' => $ufMatch['uf_id'],
       'name' => $ufMatch['uf_name'],
-    );
+    ];
   }
 
   /**
@@ -869,7 +869,7 @@ abstract class CRM_Utils_System_Base {
    *   [CRM_Core_Module]
    */
   public function getModules() {
-    return array();
+    return [];
   }
 
   /**
@@ -913,9 +913,9 @@ abstract class CRM_Utils_System_Base {
   /**
    * Append to coreResourcesList.
    *
-   * @param array $list
+   * @param \Civi\Core\Event\GenericHookEvent $e
    */
-  public function appendCoreResources(&$list) {
+  public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) {
   }
 
   /**
@@ -934,7 +934,7 @@ abstract class CRM_Utils_System_Base {
    */
   public function synchronizeUsers() {
     throw new Exception('CMS user creation not supported for this framework');
-    return array();
+    return [];
   }
 
 }