Completed
Branch FET-8394-move-rules-into-core (5a0f96)
by
unknown
09:47 queued 10s
created
core/EE_Config.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 *    update_espresso_config
314 314
 	 *
315 315
 	 * @access   public
316
-	 * @return   bool
316
+	 * @return   boolean|null
317 317
 	 */
318 318
 	protected function  _reset_espresso_addon_config() {
319 319
 		$this->_config_option_names = array();
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param    string                $name
382 382
 	 * @param    string                $config_class
383 383
 	 * @param    EE_Config_Base 	$config_obj
384
-	 * @param    array                 $tests_to_run
384
+	 * @param    integer[]                 $tests_to_run
385 385
 	 * @param    bool                  $display_errors
386 386
 	 * @return    bool    TRUE on success, FALSE on fail
387 387
 	 */
@@ -1442,7 +1442,7 @@  discard block
 block discarded – undo
1442 1442
 
1443 1443
 
1444 1444
 	/**
1445
-	 * @return array
1445
+	 * @return integer[]
1446 1446
 	 */
1447 1447
 	public function get_critical_pages_array() {
1448 1448
 		return array(
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
 
1456 1456
 
1457 1457
 	/**
1458
-	 * @return array
1458
+	 * @return string[]
1459 1459
 	 */
1460 1460
 	public function get_critical_pages_shortcodes_array() {
1461 1461
 		return array(
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 	 *    class constructor
1779 1779
 	 *
1780 1780
 	 * @access    public
1781
-	 * @param null $CNT_ISO
1781
+	 * @param string $CNT_ISO
1782 1782
 	 * @return \EE_Currency_Config
1783 1783
 	 */
1784 1784
 	public function __construct( $CNT_ISO = NULL ) {
Please login to merge, or discard this patch.
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	public $map_settings;
90 90
 
91 91
 	/**
92
-	*
93
-	* @deprecated
94
-	* @var EE_Gateway_Config
95
-	*/
92
+	 *
93
+	 * @deprecated
94
+	 * @var EE_Gateway_Config
95
+	 */
96 96
 	public $gateway;
97 97
 
98 98
 	/**
@@ -1562,51 +1562,51 @@  discard block
 block discarded – undo
1562 1562
 class EE_Organization_Config extends EE_Config_Base {
1563 1563
 
1564 1564
 	/**
1565
-	* @var string  $name
1566
-	* eg EE4.1
1567
-	*/
1565
+	 * @var string  $name
1566
+	 * eg EE4.1
1567
+	 */
1568 1568
 	public $name;
1569 1569
 
1570 1570
 	/**
1571
-	* @var string $address_1
1572
-	* eg 123 Onna Road
1573
-	*/
1571
+	 * @var string $address_1
1572
+	 * eg 123 Onna Road
1573
+	 */
1574 1574
 	public $address_1;
1575 1575
 
1576 1576
 	/**
1577
-	* @var string $address_2
1578
-	* eg PO Box 123
1579
-	*/
1577
+	 * @var string $address_2
1578
+	 * eg PO Box 123
1579
+	 */
1580 1580
 	public $address_2;
1581 1581
 
1582 1582
 	/**
1583
-	* @var string $city
1584
-	* eg Inna City
1585
-	*/
1583
+	 * @var string $city
1584
+	 * eg Inna City
1585
+	 */
1586 1586
 	public $city;
1587 1587
 
1588 1588
 	/**
1589
-	* @var int $STA_ID
1590
-	* eg 4
1591
-	*/
1589
+	 * @var int $STA_ID
1590
+	 * eg 4
1591
+	 */
1592 1592
 	public $STA_ID;
1593 1593
 
1594 1594
 	/**
1595
-	* @var string  $CNT_ISO
1596
-	* eg US
1597
-	*/
1595
+	 * @var string  $CNT_ISO
1596
+	 * eg US
1597
+	 */
1598 1598
 	public $CNT_ISO;
1599 1599
 
1600 1600
 	/**
1601
-	* @var string $zip
1602
-	* eg 12345  or V1A 2B3
1603
-	*/
1601
+	 * @var string $zip
1602
+	 * eg 12345  or V1A 2B3
1603
+	 */
1604 1604
 	public $zip;
1605 1605
 
1606 1606
 	/**
1607
-	* @var string  $email
1608
-	* eg [email protected]
1609
-	*/
1607
+	 * @var string  $email
1608
+	 * eg [email protected]
1609
+	 */
1610 1610
 	public $email;
1611 1611
 
1612 1612
 
@@ -1625,9 +1625,9 @@  discard block
 block discarded – undo
1625 1625
 	public $vat;
1626 1626
 
1627 1627
 	/**
1628
-	* @var string  $logo_url
1629
-	* eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1630
-	*/
1628
+	 * @var string  $logo_url
1629
+	 * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
1630
+	 */
1631 1631
 	public $logo_url;
1632 1632
 
1633 1633
 
@@ -1721,55 +1721,55 @@  discard block
 block discarded – undo
1721 1721
 class EE_Currency_Config extends EE_Config_Base {
1722 1722
 
1723 1723
 	/**
1724
-	* @var string  $code
1725
-	* eg 'US'
1726
-	*/
1724
+	 * @var string  $code
1725
+	 * eg 'US'
1726
+	 */
1727 1727
 	public $code;
1728 1728
 
1729 1729
 	/**
1730
-	* @var string $name
1731
-	* eg 'Dollar'
1732
-	*/
1730
+	 * @var string $name
1731
+	 * eg 'Dollar'
1732
+	 */
1733 1733
 	public $name;
1734 1734
 
1735 1735
 	/**
1736
-	* plural name
1737
-	* @var string $plural
1738
-	* eg 'Dollars'
1739
-	*/
1736
+	 * plural name
1737
+	 * @var string $plural
1738
+	 * eg 'Dollars'
1739
+	 */
1740 1740
 	public $plural;
1741 1741
 
1742 1742
 	/**
1743
-	* currency sign
1744
-	* @var string  $sign
1745
-	* eg '$'
1746
-	*/
1743
+	 * currency sign
1744
+	 * @var string  $sign
1745
+	 * eg '$'
1746
+	 */
1747 1747
 	public $sign;
1748 1748
 
1749 1749
 	/**
1750
-	* Whether the currency sign should come before the number or not
1751
-	* @var boolean $sign_b4
1752
-	*/
1750
+	 * Whether the currency sign should come before the number or not
1751
+	 * @var boolean $sign_b4
1752
+	 */
1753 1753
 	public $sign_b4;
1754 1754
 
1755 1755
 	/**
1756
-	* How many digits should come after the decimal place
1757
-	* @var int $dec_plc
1758
-	*/
1756
+	 * How many digits should come after the decimal place
1757
+	 * @var int $dec_plc
1758
+	 */
1759 1759
 	public $dec_plc;
1760 1760
 
1761 1761
 	/**
1762
-	* Symbol to use for decimal mark
1763
-	* @var string $dec_mrk
1764
-	* eg '.'
1765
-	*/
1762
+	 * Symbol to use for decimal mark
1763
+	 * @var string $dec_mrk
1764
+	 * eg '.'
1765
+	 */
1766 1766
 	public $dec_mrk;
1767 1767
 
1768 1768
 	/**
1769
-	* Symbol to use for thousands
1770
-	* @var string $thsnds
1771
-	* eg ','
1772
-	*/
1769
+	 * Symbol to use for thousands
1770
+	 * @var string $thsnds
1771
+	 * eg ','
1772
+	 */
1773 1773
 	public $thsnds;
1774 1774
 
1775 1775
 
@@ -1837,13 +1837,13 @@  discard block
 block discarded – undo
1837 1837
 	 * 	whether or not to show alternate payment options during the reg process if payment status is pending
1838 1838
 	 * @var boolean $show_pending_payment_options
1839 1839
 	 */
1840
-      public $show_pending_payment_options;
1840
+	  public $show_pending_payment_options;
1841 1841
 
1842 1842
 	/**
1843 1843
 	 * Whether to skip the registration confirmation page
1844 1844
 	 * @var boolean $skip_reg_confirmation
1845 1845
 	 */
1846
-      public $skip_reg_confirmation;
1846
+	  public $skip_reg_confirmation;
1847 1847
 
1848 1848
 	/**
1849 1849
 	 * an array of SPCO reg steps where:
@@ -1854,52 +1854,52 @@  discard block
 block discarded – undo
1854 1854
 	 * 			"slug" => the URL param used to trigger the reg step
1855 1855
 	 * @var array $reg_steps
1856 1856
 	 */
1857
-      public $reg_steps;
1857
+	  public $reg_steps;
1858 1858
 
1859 1859
 	/**
1860 1860
 	 * Whether registration confirmation should be the last page of SPCO
1861 1861
 	 * @var boolean $reg_confirmation_last
1862 1862
 	 */
1863
-      public $reg_confirmation_last;
1863
+	  public $reg_confirmation_last;
1864 1864
 
1865 1865
 	  /**
1866 1866
 	   * Whether or not to use ReCaptcha
1867 1867
 	   * @var boolean $use_captcha
1868 1868
 	   */
1869
-      public $use_captcha;
1869
+	  public $use_captcha;
1870 1870
 
1871 1871
 	  /**
1872 1872
 	   * ReCaptcha Theme
1873 1873
 	   * @var string $recaptcha_theme
1874 1874
 	   * 	options: 'dark	', 'light'
1875 1875
 	   */
1876
-      public $recaptcha_theme;
1876
+	  public $recaptcha_theme;
1877 1877
 
1878 1878
 	  /**
1879 1879
 	   * ReCaptcha Type
1880 1880
 	   * @var string $recaptcha_type
1881 1881
 	   * 	options: 'audio', 'image'
1882 1882
 	   */
1883
-      public $recaptcha_type;
1883
+	  public $recaptcha_type;
1884 1884
 
1885 1885
 	  /**
1886 1886
 	   * ReCaptcha language
1887 1887
 	   * @var string $recaptcha_language
1888 1888
 	   * eg 'en'
1889 1889
 	   */
1890
-      public $recaptcha_language;
1890
+	  public $recaptcha_language;
1891 1891
 
1892 1892
 	  /**
1893 1893
 	   * ReCaptcha public key
1894 1894
 	   * @var string $recaptcha_publickey
1895 1895
 	   */
1896
-      public $recaptcha_publickey;
1896
+	  public $recaptcha_publickey;
1897 1897
 
1898 1898
 	  /**
1899 1899
 	   * ReCaptcha private key
1900 1900
 	   * @var string $recaptcha_privatekey
1901 1901
 	   */
1902
-      public $recaptcha_privatekey;
1902
+	  public $recaptcha_privatekey;
1903 1903
 
1904 1904
 	/**
1905 1905
 	 * ReCaptcha width
@@ -1957,58 +1957,58 @@  discard block
 block discarded – undo
1957 1957
 class EE_Admin_Config extends EE_Config_Base {
1958 1958
 
1959 1959
 	/**
1960
-	* @var boolean $use_personnel_manager
1961
-	*/
1960
+	 * @var boolean $use_personnel_manager
1961
+	 */
1962 1962
 	public $use_personnel_manager;
1963 1963
 
1964 1964
 	/**
1965
-	* @var boolean $use_dashboard_widget
1966
-	*/
1965
+	 * @var boolean $use_dashboard_widget
1966
+	 */
1967 1967
 	public $use_dashboard_widget;
1968 1968
 
1969 1969
 	/**
1970
-	* @var int $events_in_dashboard
1971
-	*/
1970
+	 * @var int $events_in_dashboard
1971
+	 */
1972 1972
 	public $events_in_dashboard;
1973 1973
 
1974 1974
 	/**
1975
-	* @var boolean $use_event_timezones
1976
-	*/
1975
+	 * @var boolean $use_event_timezones
1976
+	 */
1977 1977
 	public $use_event_timezones;
1978 1978
 
1979 1979
 	/**
1980
-	* @var boolean $use_full_logging
1981
-	*/
1980
+	 * @var boolean $use_full_logging
1981
+	 */
1982 1982
 	public $use_full_logging;
1983 1983
 
1984 1984
 	/**
1985
-	* @var string $log_file_name
1986
-	*/
1985
+	 * @var string $log_file_name
1986
+	 */
1987 1987
 	public $log_file_name;
1988 1988
 
1989 1989
 	/**
1990
-	* @var string $debug_file_name
1991
-	*/
1990
+	 * @var string $debug_file_name
1991
+	 */
1992 1992
 	public $debug_file_name;
1993 1993
 
1994 1994
 	/**
1995
-	* @var boolean $use_remote_logging
1996
-	*/
1995
+	 * @var boolean $use_remote_logging
1996
+	 */
1997 1997
 	public $use_remote_logging;
1998 1998
 
1999 1999
 	/**
2000
-	* @var string $remote_logging_url
2001
-	*/
2000
+	 * @var string $remote_logging_url
2001
+	 */
2002 2002
 	public $remote_logging_url;
2003 2003
 
2004 2004
 	/**
2005
-	* @var boolean $show_reg_footer
2006
-	*/
2005
+	 * @var boolean $show_reg_footer
2006
+	 */
2007 2007
 	public $show_reg_footer;
2008 2008
 
2009 2009
 	/**
2010
-	* @var string $affiliate_id
2011
-	*/
2010
+	 * @var string $affiliate_id
2011
+	 */
2012 2012
 	public $affiliate_id;
2013 2013
 
2014 2014
 
@@ -2082,33 +2082,33 @@  discard block
 block discarded – undo
2082 2082
 class EE_Template_Config extends EE_Config_Base {
2083 2083
 
2084 2084
 	/**
2085
-	* @var boolean $enable_default_style
2086
-	*/
2085
+	 * @var boolean $enable_default_style
2086
+	 */
2087 2087
 	public $enable_default_style;
2088 2088
 
2089 2089
 	/**
2090
-	* @var string $custom_style_sheet
2091
-	*/
2090
+	 * @var string $custom_style_sheet
2091
+	 */
2092 2092
 	public $custom_style_sheet;
2093 2093
 
2094 2094
 	/**
2095
-	* @var boolean $display_address_in_regform
2096
-	*/
2095
+	 * @var boolean $display_address_in_regform
2096
+	 */
2097 2097
 	public $display_address_in_regform;
2098 2098
 
2099 2099
 	/**
2100
-	* @var int $display_description_on_multi_reg_page
2101
-	*/
2100
+	 * @var int $display_description_on_multi_reg_page
2101
+	 */
2102 2102
 	public $display_description_on_multi_reg_page;
2103 2103
 
2104 2104
 	/**
2105
-	* @var boolean $use_custom_templates
2106
-	*/
2105
+	 * @var boolean $use_custom_templates
2106
+	 */
2107 2107
 	public $use_custom_templates;
2108 2108
 
2109 2109
 	/**
2110
-	* @var string $current_espresso_theme
2111
-	*/
2110
+	 * @var string $current_espresso_theme
2111
+	 */
2112 2112
 	public $current_espresso_theme;
2113 2113
 
2114 2114
 
@@ -2139,78 +2139,78 @@  discard block
 block discarded – undo
2139 2139
 class EE_Map_Config extends EE_Config_Base {
2140 2140
 
2141 2141
 	/**
2142
-	* @var boolean $use_google_maps
2143
-	*/
2142
+	 * @var boolean $use_google_maps
2143
+	 */
2144 2144
 	public $use_google_maps;
2145 2145
 
2146 2146
 	/**
2147
-	* @var int $event_details_map_width
2148
-	*/
2147
+	 * @var int $event_details_map_width
2148
+	 */
2149 2149
 	public $event_details_map_width;
2150 2150
 
2151 2151
 	/**
2152
-	* @var int $event_details_map_height
2153
-	*/
2152
+	 * @var int $event_details_map_height
2153
+	 */
2154 2154
 	public $event_details_map_height;
2155 2155
 
2156 2156
 	/**
2157
-	* @var int $event_details_map_zoom
2158
-	*/
2157
+	 * @var int $event_details_map_zoom
2158
+	 */
2159 2159
 	public $event_details_map_zoom;
2160 2160
 
2161 2161
 	/**
2162
-	* @var boolean $event_details_display_nav
2163
-	*/
2162
+	 * @var boolean $event_details_display_nav
2163
+	 */
2164 2164
 	public $event_details_display_nav;
2165 2165
 
2166 2166
 	/**
2167
-	* @var boolean $event_details_nav_size
2168
-	*/
2167
+	 * @var boolean $event_details_nav_size
2168
+	 */
2169 2169
 	public $event_details_nav_size;
2170 2170
 
2171 2171
 	/**
2172
-	* @var string $event_details_control_type
2173
-	*/
2172
+	 * @var string $event_details_control_type
2173
+	 */
2174 2174
 	public $event_details_control_type;
2175 2175
 
2176 2176
 	/**
2177
-	* @var string $event_details_map_align
2178
-	*/
2177
+	 * @var string $event_details_map_align
2178
+	 */
2179 2179
 	public $event_details_map_align;
2180 2180
 
2181 2181
 	/**
2182
-	* @var int $event_list_map_width
2183
-	*/
2182
+	 * @var int $event_list_map_width
2183
+	 */
2184 2184
 	public $event_list_map_width;
2185 2185
 
2186 2186
 	/**
2187
-	* @var int $event_list_map_height
2188
-	*/
2187
+	 * @var int $event_list_map_height
2188
+	 */
2189 2189
 	public $event_list_map_height;
2190 2190
 
2191 2191
 	/**
2192
-	* @var int $event_list_map_zoom
2193
-	*/
2192
+	 * @var int $event_list_map_zoom
2193
+	 */
2194 2194
 	public $event_list_map_zoom;
2195 2195
 
2196 2196
 	/**
2197
-	* @var boolean $event_list_display_nav
2198
-	*/
2197
+	 * @var boolean $event_list_display_nav
2198
+	 */
2199 2199
 	public $event_list_display_nav;
2200 2200
 
2201 2201
 	/**
2202
-	* @var boolean $event_list_nav_size
2203
-	*/
2202
+	 * @var boolean $event_list_nav_size
2203
+	 */
2204 2204
 	public $event_list_nav_size;
2205 2205
 
2206 2206
 	/**
2207
-	* @var string $event_list_control_type
2208
-	*/
2207
+	 * @var string $event_list_control_type
2208
+	 */
2209 2209
 	public $event_list_control_type;
2210 2210
 
2211 2211
 	/**
2212
-	* @var string $event_list_map_align
2213
-	*/
2212
+	 * @var string $event_list_map_align
2213
+	 */
2214 2214
 	public $event_list_map_align;
2215 2215
 
2216 2216
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -160,7 +162,7 @@  discard block
 block discarded – undo
160 162
 		//support removing a module during a request when it previously existed
161 163
 		if( $reinstantiate ){
162 164
 			return self::instance();
163
-		}else{
165
+		} else{
164 166
 			return NULL;
165 167
 		}
166 168
 	}
@@ -1492,7 +1494,7 @@  discard block
 block discarded – undo
1492 1494
 		}
1493 1495
 		if($query_args){
1494 1496
 			return add_query_arg($query_args,$this->txn_page_url);
1495
-		}else{
1497
+		} else{
1496 1498
 			return $this->txn_page_url;
1497 1499
 		}
1498 1500
 	}
@@ -1509,7 +1511,7 @@  discard block
 block discarded – undo
1509 1511
 		}
1510 1512
 		if($query_args){
1511 1513
 			return add_query_arg($query_args,$this->thank_you_page_url);
1512
-		}else{
1514
+		} else{
1513 1515
 			return $this->thank_you_page_url;
1514 1516
 		}
1515 1517
 	}
Please login to merge, or discard this patch.
Spacing   +409 added lines, -409 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public static function instance() {
130 130
 		// check if class object is instantiated, and instantiated properly
131
-		if ( ! self::$_instance instanceof EE_Config ) {
131
+		if ( ! self::$_instance instanceof EE_Config) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,22 +145,22 @@  discard block
 block discarded – undo
145 145
 	 * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode)
146 146
 	 * @return EE_Config
147 147
 	 */
148
-	public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){
149
-		if ( $hard_reset ) {
148
+	public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) {
149
+		if ($hard_reset) {
150 150
 			self::$_instance->_config_option_names = array();
151 151
 			self::$_instance->_initialize_config();
152 152
 			self::$_instance->update_espresso_config();
153 153
 		}
154
-		if( self::$_instance instanceof EE_Config ){
154
+		if (self::$_instance instanceof EE_Config) {
155 155
 			self::$_instance->shutdown();
156 156
 		}
157 157
 		self::$_instance = NULL;
158 158
 		//we don't need to reset the static properties imo because those should
159 159
 		//only change when a module is added or removed. Currently we don't
160 160
 		//support removing a module during a request when it previously existed
161
-		if( $reinstantiate ){
161
+		if ($reinstantiate) {
162 162
 			return self::instance();
163
-		}else{
163
+		} else {
164 164
 			return NULL;
165 165
 		}
166 166
 	}
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
 	 * @return \EE_Config
175 175
 	 */
176 176
 	private function __construct() {
177
-		do_action( 'AHEE__EE_Config__construct__begin',$this );
178
-		$this->_config_option_names = get_option( 'ee_config_option_names', array() );
177
+		do_action('AHEE__EE_Config__construct__begin', $this);
178
+		$this->_config_option_names = get_option('ee_config_option_names', array());
179 179
 		// setup empty config classes
180 180
 		$this->_initialize_config();
181 181
 		// load existing EE site settings
182 182
 		$this->_load_core_config();
183 183
 		//  register shortcodes and modules
184
-		add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 );
184
+		add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999);
185 185
 		//  initialize shortcodes and modules
186
-		add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ));
186
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
187 187
 		// register widgets
188
-		add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 );
188
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
189 189
 		// shutdown
190
-		add_action( 'shutdown', array( $this, 'shutdown' ), 10 );
190
+		add_action('shutdown', array($this, 'shutdown'), 10);
191 191
 		// construct__end hook
192
-		do_action( 'AHEE__EE_Config__construct__end',$this );
192
+		do_action('AHEE__EE_Config__construct__end', $this);
193 193
 		// hardcoded hack
194 194
 		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
195 195
 	}
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * @return string current theme set.
203 203
 	 */
204 204
 	public static function get_current_theme() {
205
-		return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
205
+		return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
206 206
 	}
207 207
 
208 208
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 	private function _initialize_config() {
218 218
 		//set defaults
219 219
 
220
-		$this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', new EE_Core_Config() );
221
-		$this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', new EE_Organization_Config() );
222
-		$this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', new EE_Currency_Config() );
223
-		$this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', new EE_Registration_Config() );
224
-		$this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', new EE_Admin_Config() );
225
-		$this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', new EE_Template_Config() );
226
-		$this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', new EE_Map_Config() );
227
-		$this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', new EE_Environment_Config() );
228
-		$this->gateway =  apply_filters( 'FHEE__EE_Config___initialize_config__gateway', new EE_Gateway_Config() );
220
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', new EE_Core_Config());
221
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', new EE_Organization_Config());
222
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', new EE_Currency_Config());
223
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', new EE_Registration_Config());
224
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', new EE_Admin_Config());
225
+		$this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', new EE_Template_Config());
226
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', new EE_Map_Config());
227
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', new EE_Environment_Config());
228
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', new EE_Gateway_Config());
229 229
 		$this->addons = new stdClass();
230 230
 		// set _module_route_map
231 231
 		EE_Config::$_module_route_map = array();
@@ -247,28 +247,28 @@  discard block
 block discarded – undo
247 247
 	private function _load_core_config() {
248 248
 		$update = FALSE;
249 249
 		$this->_load_calendar_config();
250
-		$convert_from_array = array( 'addons' );
250
+		$convert_from_array = array('addons');
251 251
 		$espresso_config = $this->get_espresso_config();
252
-		foreach ( $espresso_config as $config => $settings ) {
252
+		foreach ($espresso_config as $config => $settings) {
253 253
 			// in case old settings were saved as an array
254
-			if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
255
-				$settings = $this->_migrate_old_config_data( $settings );
254
+			if (is_array($settings) && in_array($config, $convert_from_array)) {
255
+				$settings = $this->_migrate_old_config_data($settings);
256 256
 				$update = TRUE;
257 257
 			}
258
-			$config_class = is_object( $settings ) && is_object( $this->$config ) ? get_class( $this->$config ) : '';
259
-			if ( ! empty( $settings ) && $settings instanceof $config_class ) {
260
-				$this->$config = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings );
258
+			$config_class = is_object($settings) && is_object($this->$config) ? get_class($this->$config) : '';
259
+			if ( ! empty($settings) && $settings instanceof $config_class) {
260
+				$this->$config = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
261 261
 				//call configs populate method to ensure any defaults are set for empty values.
262
-				if ( method_exists( $settings, 'populate' ) ) {
262
+				if (method_exists($settings, 'populate')) {
263 263
 					$this->$config->populate();
264 264
 				}
265 265
 			}
266 266
 		}
267
-		if ( $update ) {
267
+		if ($update) {
268 268
 			$this->update_espresso_config();
269 269
 		}
270 270
 		// construct__end hook
271
-		do_action( 'AHEE__EE_Config___load_core_config__end', $this );
271
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
272 272
 	}
273 273
 
274 274
 
@@ -281,23 +281,23 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	private function _load_calendar_config() {
283 283
 		// grab array of all plugin folders and loop thru it
284
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
285
-		if ( empty( $plugins ) ) {
284
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
285
+		if (empty($plugins)) {
286 286
 				return;
287 287
 			}
288
-		foreach ( $plugins as $plugin_path ) {
288
+		foreach ($plugins as $plugin_path) {
289 289
 			// grab plugin folder name from path
290
-			$plugin = basename( $plugin_path );
290
+			$plugin = basename($plugin_path);
291 291
 			// drill down to Espresso plugins
292
-			if ( strpos( $plugin, 'espresso' ) !== FALSE || strpos( $plugin, 'Espresso' ) !== FALSE || strpos( $plugin, 'ee4' ) !== FALSE || strpos( $plugin, 'EE4' ) !== FALSE ) {
292
+			if (strpos($plugin, 'espresso') !== FALSE || strpos($plugin, 'Espresso') !== FALSE || strpos($plugin, 'ee4') !== FALSE || strpos($plugin, 'EE4') !== FALSE) {
293 293
 				// then to calendar related plugins
294
-				if ( strpos( $plugin, 'calendar' ) !== FALSE ) {
294
+				if (strpos($plugin, 'calendar') !== FALSE) {
295 295
 					// this is what we are looking for
296
-					$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
296
+					$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
297 297
 					// does it exist in this folder ?
298
-					if ( is_readable( $calendar_config )) {
298
+					if (is_readable($calendar_config)) {
299 299
 						// YEAH! let's load it
300
-						require_once( $calendar_config );
300
+						require_once($calendar_config);
301 301
 					}
302 302
 				}
303 303
 			}
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 	 * @param array  $settings
314 314
 	 * @return    stdClass
315 315
 	 */
316
-	private function _migrate_old_config_data( $settings = array() ) {
316
+	private function _migrate_old_config_data($settings = array()) {
317 317
 		// convert existing settings to an object
318 318
 		$config_array = $settings;
319 319
 		$settings = new stdClass();
320
-		foreach ( $config_array as $key => $value ){
321
-			if ( $key == 'calendar' && class_exists( 'EE_Calendar_Config' )) {
322
-				$this->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
320
+		foreach ($config_array as $key => $value) {
321
+			if ($key == 'calendar' && class_exists('EE_Calendar_Config')) {
322
+				$this->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
323 323
 //				$config_option_name = $this->_generate_config_option_name( 'addons', 'EE_Calendar' );
324 324
 //				delete_option( $config_option_name );
325 325
 //				// save calendar settings using new methods
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	public function get_espresso_config() {
348 348
 		// grab espresso configuration
349
-		return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() ));
349
+		return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array()));
350 350
 	}
351 351
 
352 352
 
@@ -359,11 +359,11 @@  discard block
 block discarded – undo
359 359
 	 * @param        $old_value
360 360
 	 * @param        $value
361 361
 	 */
362
-	public function double_check_config_comparison( $option = '', $old_value, $value ) {
362
+	public function double_check_config_comparison($option = '', $old_value, $value) {
363 363
 		// make sure we're checking the ee config
364
-		if ( $option == 'ee_config' ) {
364
+		if ($option == 'ee_config') {
365 365
 			// run a loose comparison of the old value against the new value for type and properties, but NOT exact instance like WP update_option does
366
-			if ( $value != $old_value ) {
366
+			if ($value != $old_value) {
367 367
 				// if they are NOT the same, then remove the hook, which means the subsequent update results will be based solely on the update query results
368 368
 				// the reason we do this is because, as stated above, WP update_option performs an exact instance comparison (===) on any update values passed to it
369 369
 				// this happens PRIOR to serialization and any subsequent update. If values are found to match their previous old value, then WP bails before performing any update.
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 				// HOWEVER, once the object is serialized and passed off to MySQL to update,
372 372
 				// MySQL MAY ALSO NOT perform the update because the string it sees in the db looks the same as the new one it has been passed!!!
373 373
 				// This results in the query returning an "affected rows" value of ZERO, which gets returned immediately by WP update_option and looks like an error.
374
-				remove_action( 'update_option', array( $this, 'check_config_updated' ));
374
+				remove_action('update_option', array($this, 'check_config_updated'));
375 375
 			}
376 376
 		}
377 377
 	}
@@ -386,11 +386,11 @@  discard block
 block discarded – undo
386 386
 	 */
387 387
 	protected function  _reset_espresso_addon_config() {
388 388
 		$this->_config_option_names = array();
389
-		foreach( $this->addons as $addon_name => $addon_config_obj ) {
390
-			$addon_config_obj = maybe_unserialize( $addon_config_obj );
391
-			$config_class = get_class( $addon_config_obj );
392
-			if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) {
393
-				$this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE );
389
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
390
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
391
+			$config_class = get_class($addon_config_obj);
392
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
393
+				$this->update_config('addons', $addon_name, $addon_config_obj, FALSE);
394 394
 			}
395 395
 			$this->addons->$addon_name = NULL;
396 396
 		}
@@ -406,36 +406,36 @@  discard block
 block discarded – undo
406 406
 	 * @param   bool $add_error
407 407
 	 * @return   bool
408 408
 	 */
409
-	public function  update_espresso_config( $add_success = FALSE, $add_error = TRUE ) {
409
+	public function  update_espresso_config($add_success = FALSE, $add_error = TRUE) {
410 410
 		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
411 411
 		//$clone = clone( self::$_instance );
412 412
 		//self::$_instance = NULL;
413
-		do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this );
413
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
414 414
 		$this->_reset_espresso_addon_config();
415 415
 		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional but BEFORE the actual update occurs
416
-		add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 );
416
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
417 417
 		// now update "ee_config"
418
-		$saved = update_option( 'ee_config', $this );
418
+		$saved = update_option('ee_config', $this);
419 419
 		// if not saved... check if the hook we just added still exists; if it does, it means one of two things:
420 420
 		// that update_option bailed at the ( $value === $old_value ) conditional, or...
421 421
 		// the db update query returned 0 rows affected (probably because the data  value was the same from it's perspective)
422 422
 		// so the existence of the hook means that a negative result from update_option is NOT an error, but just means no update occurred, so don't display an error to the user.
423 423
 		// BUT... if update_option returns FALSE, AND the hook is missing, then it means that something truly went wrong
424
-		$saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved;
424
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
425 425
 		// remove our action since we don't want it in the system anymore
426
-		remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 );
427
-		do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved );
426
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
427
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
428 428
 		//self::$_instance = $clone;
429 429
 		//unset( $clone );
430 430
 		// if config remains the same or was updated successfully
431
-		if ( $saved ) {
432
-			if ( $add_success ) {
433
-				EE_Error::add_success( __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
431
+		if ($saved) {
432
+			if ($add_success) {
433
+				EE_Error::add_success(__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
434 434
 			}
435 435
 			return TRUE;
436 436
 		} else {
437
-			if ( $add_error ) {
438
-				EE_Error::add_error( __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
437
+			if ($add_error) {
438
+				EE_Error::add_error(__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
439 439
 			}
440 440
 			return FALSE;
441 441
 		}
@@ -454,77 +454,77 @@  discard block
 block discarded – undo
454 454
 	 * @param    bool                  $display_errors
455 455
 	 * @return    bool    TRUE on success, FALSE on fail
456 456
 	 */
457
-	private function _verify_config_params( $section = '', $name = '', $config_class = '', $config_obj = NULL, $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), $display_errors = TRUE ) {
457
+	private function _verify_config_params($section = '', $name = '', $config_class = '', $config_obj = NULL, $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), $display_errors = TRUE) {
458 458
 		try {
459 459
 			// TEST #1 : check that section was set
460
-			if ( in_array( 1, $tests_to_run ) && empty( $section )) {
461
-				if ( $display_errors ) {
462
-					throw new EE_Error( sprintf( __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), $config_class ));
460
+			if (in_array(1, $tests_to_run) && empty($section)) {
461
+				if ($display_errors) {
462
+					throw new EE_Error(sprintf(__('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), $config_class));
463 463
 				}
464 464
 				return FALSE;
465 465
 			}
466 466
 			// TEST #2 : check that settings section exists
467
-			if ( in_array( 2, $tests_to_run ) && ! isset( $this->{$section} )) {
468
-				if ( $display_errors ) {
469
-					throw new EE_Error( sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), $section ));
467
+			if (in_array(2, $tests_to_run) && ! isset($this->{$section} )) {
468
+				if ($display_errors) {
469
+					throw new EE_Error(sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), $section));
470 470
 				}
471 471
 				return FALSE;
472 472
 			}
473 473
 			// TEST #3 : check that section is the proper format
474
-			if ( in_array( 3, $tests_to_run ) && ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass )) {
475
-				if ( $display_errors ) {
476
-					throw new EE_Error( sprintf( __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), $section ));
474
+			if (in_array(3, $tests_to_run) && ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)) {
475
+				if ($display_errors) {
476
+					throw new EE_Error(sprintf(__('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), $section));
477 477
 				}
478 478
 				return FALSE;
479 479
 			}
480 480
 			// TEST #4 : check that config section name has been set
481
-			if ( in_array( 4, $tests_to_run ) && empty( $name )) {
482
-				if ( $display_errors ) {
483
-					throw new EE_Error( __( 'No name has been provided for the specific configuration section.', 'event_espresso' ));
481
+			if (in_array(4, $tests_to_run) && empty($name)) {
482
+				if ($display_errors) {
483
+					throw new EE_Error(__('No name has been provided for the specific configuration section.', 'event_espresso'));
484 484
 				}
485 485
 				return FALSE;
486 486
 			}
487 487
 			// TEST #5 : check that a config class name has been set
488
-			if ( in_array( 5, $tests_to_run ) && empty( $config_class )) {
489
-				if ( $display_errors ) {
490
-					throw new EE_Error( __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ));
488
+			if (in_array(5, $tests_to_run) && empty($config_class)) {
489
+				if ($display_errors) {
490
+					throw new EE_Error(__('No class name has been provided for the specific configuration section.', 'event_espresso'));
491 491
 				}
492 492
 				return FALSE;
493 493
 			}
494 494
 			// TEST #6 : verify config class is accessible
495
-			if ( in_array( 6, $tests_to_run ) && ! class_exists( $config_class )) {
496
-				if ( $display_errors ) {
497
-					throw new EE_Error( sprintf( __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), $config_class ));
495
+			if (in_array(6, $tests_to_run) && ! class_exists($config_class)) {
496
+				if ($display_errors) {
497
+					throw new EE_Error(sprintf(__('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), $config_class));
498 498
 				}
499 499
 				return FALSE;
500 500
 			}
501 501
 			// TEST #7 : check that config has even been set
502
-			if ( in_array( 7, $tests_to_run )) {
503
-				if ( ! isset( $this->{$section}->{$name} )) {
504
-					if ( $display_errors ) {
505
-						throw new EE_Error( sprintf( __( 'No configuration has been set for "%s->%s".', 'event_espresso' ), $section, $name ));
502
+			if (in_array(7, $tests_to_run)) {
503
+				if ( ! isset($this->{$section}->{$name} )) {
504
+					if ($display_errors) {
505
+						throw new EE_Error(sprintf(__('No configuration has been set for "%s->%s".', 'event_espresso'), $section, $name));
506 506
 					}
507 507
 					return FALSE;
508 508
 				} else {
509 509
 					// and make sure it's not serialized
510
-					$this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} );
510
+					$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} );
511 511
 				}
512 512
 			}
513 513
 			// TEST #8 : check that config is the requested type
514
-			if ( in_array( 8, $tests_to_run ) && ! $this->{$section}->{$name} instanceof $config_class ) {
515
-				if ( $display_errors ) {
516
-					throw new EE_Error( sprintf( __( 'The configuration for "%s->%s" is not of the "%s" class.', 'event_espresso' ), $section, $name, $config_class ));
514
+			if (in_array(8, $tests_to_run) && ! $this->{$section}->{$name} instanceof $config_class) {
515
+				if ($display_errors) {
516
+					throw new EE_Error(sprintf(__('The configuration for "%s->%s" is not of the "%s" class.', 'event_espresso'), $section, $name, $config_class));
517 517
 				}
518 518
 				return FALSE;
519 519
 			}
520 520
 			// TEST #9 : verify config object
521
-			if ( in_array( 9, $tests_to_run ) && ! $config_obj instanceof EE_Config_Base ) {
522
-				if ( $display_errors ) {
523
-					throw new EE_Error( sprintf( __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), print_r( $config_obj, TRUE )));
521
+			if (in_array(9, $tests_to_run) && ! $config_obj instanceof EE_Config_Base) {
522
+				if ($display_errors) {
523
+					throw new EE_Error(sprintf(__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), print_r($config_obj, TRUE)));
524 524
 				}
525 525
 				return FALSE;
526 526
 			}
527
-		} catch( EE_Error $e ) {
527
+		} catch (EE_Error $e) {
528 528
 			$e->get_error();
529 529
 		}
530 530
 		// you have successfully run the gauntlet
@@ -541,8 +541,8 @@  discard block
 block discarded – undo
541 541
 	 * @param        string          $name
542 542
 	 * @return        string
543 543
 	 */
544
-	private function _generate_config_option_name( $section = '', $name = '' ) {
545
-		return 'ee_config-' . $section . '-' . $name;
544
+	private function _generate_config_option_name($section = '', $name = '') {
545
+		return 'ee_config-'.$section.'-'.$name;
546 546
 	}
547 547
 
548 548
 
@@ -556,8 +556,8 @@  discard block
 block discarded – undo
556 556
 	 * @param 	string $name
557 557
 	 * @return 	string
558 558
 	 */
559
-	private function _set_config_class( $config_class = '', $name = '' ) {
560
-		return ! empty( $config_class ) ? $config_class : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ))) . '_Config';
559
+	private function _set_config_class($config_class = '', $name = '') {
560
+		return ! empty($config_class) ? $config_class : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
561 561
 	}
562 562
 
563 563
 
@@ -571,34 +571,34 @@  discard block
 block discarded – undo
571 571
 	 * @param        \EE_Config_Base $config_obj
572 572
 	 * @return        \EE_Config_Base|bool
573 573
 	 */
574
-	public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = NULL ) {
574
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = NULL) {
575 575
 		// ensure config class is set to something
576
-		$config_class = $this->_set_config_class( $config_class, $name );
576
+		$config_class = $this->_set_config_class($config_class, $name);
577 577
 		// run tests 1-4, 6, and 7 to verify all config params are set and valid
578
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
578
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
579 579
 			return FALSE;
580 580
 		}
581
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
581
+		$config_option_name = $this->_generate_config_option_name($section, $name);
582 582
 		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
583
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
584
-			$this->_config_option_names[ $config_option_name ] = $config_class;
583
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
584
+			$this->_config_option_names[$config_option_name] = $config_class;
585 585
 		}
586 586
 		// verify the incoming config object but suppress errors
587
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
587
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
588 588
 			$config_obj = new $config_class();
589 589
 		}
590
-		$config_set = get_option( $config_option_name );
590
+		$config_set = get_option($config_option_name);
591 591
 
592
-		if ( $config_set ) {
593
-			$this->{$section}->{$name} = maybe_unserialize( $config_set );
592
+		if ($config_set) {
593
+			$this->{$section}->{$name} = maybe_unserialize($config_set);
594 594
 			return $this->{$section}->{$name};
595 595
 		} else {
596 596
 			// create a wp-option for this config
597
-			if ( add_option( $config_option_name, $config_obj, '', 'no' )) {
598
-				$this->{$section}->{$name} = maybe_unserialize( $config_obj );
597
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
598
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
599 599
 				return $this->{$section}->{$name};
600 600
 			} else {
601
-				EE_Error::add_error( sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ );
601
+				EE_Error::add_error(sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__);
602 602
 				return FALSE;
603 603
 			}
604 604
 		}
@@ -616,37 +616,37 @@  discard block
 block discarded – undo
616 616
 	 * @param bool                      $throw_errors
617 617
 	 * @return  bool
618 618
 	 */
619
-	public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = TRUE ) {
620
-		$config_obj = maybe_unserialize( $config_obj );
619
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = TRUE) {
620
+		$config_obj = maybe_unserialize($config_obj);
621 621
 		// get class name of the incoming object
622
-		$config_class = get_class( $config_obj );
622
+		$config_class = get_class($config_obj);
623 623
 		// run tests 1-5 and 9 to verify config
624
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) {
624
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) {
625 625
 			return FALSE;
626 626
 		}
627
-		$config_option_name = $this->_generate_config_option_name( $section, $name );
627
+		$config_option_name = $this->_generate_config_option_name($section, $name);
628 628
 		// check if config object has been added to db by seeing if config option name is in $this->_config_option_names array
629
-		if ( ! isset( $this->_config_option_names[ $config_option_name ] )) {
629
+		if ( ! isset($this->_config_option_names[$config_option_name])) {
630 630
 			// save new config to db
631
-			return $this->set_config( $section, $name, $config_class, $config_obj );
631
+			return $this->set_config($section, $name, $config_class, $config_obj);
632 632
 		} else {
633 633
 			// first check if the record already exists
634
-			$existing_config = get_option( $config_option_name );
635
-			$config_obj = serialize( $config_obj );
634
+			$existing_config = get_option($config_option_name);
635
+			$config_obj = serialize($config_obj);
636 636
 			// just return if db record is already up to date
637
-			if ( $existing_config == $config_obj ) {
637
+			if ($existing_config == $config_obj) {
638 638
 				$this->{$section}->{$name} = $config_obj;
639 639
 				return TRUE;
640
-			} else if ( update_option( $config_option_name, $config_obj )) {
640
+			} else if (update_option($config_option_name, $config_obj)) {
641 641
 				// update wp-option for this config class
642 642
 				$this->{$section}->{$name} = $config_obj;
643 643
 				return $this->update_espresso_config();
644
-			} elseif ( $throw_errors ) {
644
+			} elseif ($throw_errors) {
645 645
 				EE_Error::add_error(
646 646
 					sprintf(
647
-						__( 'The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso' ),
647
+						__('The "%s" object stored at"%s" was not successfully updated in the database.', 'event_espresso'),
648 648
 						$config_class,
649
-						'EE_Config->' . $section . '->' . $name
649
+						'EE_Config->'.$section.'->'.$name
650 650
 					),
651 651
 					__FILE__, __FUNCTION__, __LINE__
652 652
 				);
@@ -666,33 +666,33 @@  discard block
 block discarded – undo
666 666
 	 * @param 	string 	$config_class
667 667
 	 * @return 	mixed EE_Config_Base | NULL
668 668
 	 */
669
-	public function get_config( $section = '', $name = '', $config_class = '' ) {
669
+	public function get_config($section = '', $name = '', $config_class = '') {
670 670
 		// ensure config class is set to something
671
-		$config_class = $this->_set_config_class( $config_class, $name );
671
+		$config_class = $this->_set_config_class($config_class, $name);
672 672
 		// run tests 1-4, 6 and 7 to verify that all params have been set
673
-		if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) {
673
+		if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) {
674 674
 			return NULL;
675 675
 		}
676 676
 		// now test if the requested config object exists, but suppress errors
677
-		if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) {
677
+		if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) {
678 678
 			// config already exists, so pass it back
679 679
 			return $this->{$section}->{$name};
680 680
 		}
681 681
 		// load config option from db if it exists
682
-		$config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ));
682
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
683 683
 		// verify the newly retrieved config object, but suppress errors
684
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) {
684
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) {
685 685
 			// config is good, so set it and pass it back
686 686
 			$this->{$section}->{$name} = $config_obj;
687 687
 			return $this->{$section}->{$name};
688 688
 		}
689 689
 		// oops! $config_obj is not already set and does not exist in the db, so create a new one
690
-		$config_obj =$this->set_config( $section, $name, $config_class );
690
+		$config_obj = $this->set_config($section, $name, $config_class);
691 691
 		// verify the newly created config object
692
-		if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) {
692
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
693 693
 			return $this->{$section}->{$name};
694 694
 		} else {
695
-			EE_Error::add_error( sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), __FILE__, __FUNCTION__, __LINE__ );
695
+			EE_Error::add_error(sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), __FILE__, __FUNCTION__, __LINE__);
696 696
 		}
697 697
 		return NULL;
698 698
 	}
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
 	 * @param 	string 	$config_option_name
706 706
 	 * @return 	mixed EE_Config_Base | FALSE
707 707
 	 */
708
-	public function get_config_option( $config_option_name = '' ) {
708
+	public function get_config_option($config_option_name = '') {
709 709
 		// retrieve the wp-option for this config class.
710
-		return maybe_unserialize( get_option( $config_option_name ));
710
+		return maybe_unserialize(get_option($config_option_name));
711 711
 	}
712 712
 
713 713
 
@@ -720,45 +720,45 @@  discard block
 block discarded – undo
720 720
 	 * @param $page_for_posts
721 721
 	 * @return    void
722 722
 	 */
723
-	public function update_post_shortcodes( $page_for_posts = '' ) {
723
+	public function update_post_shortcodes($page_for_posts = '') {
724 724
 		// make sure page_for_posts is set
725
-		$page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts();
725
+		$page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts();
726 726
 		// critical page shortcodes that we do NOT want added to the Posts page (blog)
727 727
 		$critical_shortcodes = $this->core->get_critical_pages_shortcodes_array();
728 728
 		// allow others to mess stuff up :D
729
-		do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts );
729
+		do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts);
730 730
 		// verify that post_shortcodes is set
731
-		$this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array();
731
+		$this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array();
732 732
 		// cycle thru post_shortcodes
733
-		foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){
733
+		foreach ($this->core->post_shortcodes as $post_name => $shortcodes) {
734 734
 			// are there any shortcodes to track ?
735
-			if ( ! empty( $shortcodes )) {
735
+			if ( ! empty($shortcodes)) {
736 736
 				// loop thru list of tracked shortcodes
737
-				foreach( $shortcodes as $shortcode => $post_id ) {
737
+				foreach ($shortcodes as $shortcode => $post_id) {
738 738
 					// if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode
739
-					if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) {
739
+					if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) {
740 740
 						// then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog)
741
-						unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] );
741
+						unset($this->core->post_shortcodes[$post_name][$shortcode]);
742 742
 					}
743 743
 					// skip the posts page, because we want all shortcodes registered for it
744
-					if ( $post_name == $page_for_posts ) {
744
+					if ($post_name == $page_for_posts) {
745 745
 						continue;
746 746
 					}
747 747
 					// make sure post still exists
748
-					$post = get_post( $post_id );
749
-					if ( $post ) {
748
+					$post = get_post($post_id);
749
+					if ($post) {
750 750
 						// check that the post name matches what we have saved
751
-						if ( $post->post_name == $post_name ) {
751
+						if ($post->post_name == $post_name) {
752 752
 							// if so, then break before hitting the unset below
753 753
 							continue;
754 754
 						}
755 755
 					}
756 756
 					// we don't like missing posts around here >:(
757
-					unset( $this->core->post_shortcodes[ $post_name ] );
757
+					unset($this->core->post_shortcodes[$post_name]);
758 758
 				}
759 759
 			} else {
760 760
 				// you got no shortcodes to keep track of !
761
-				unset( $this->core->post_shortcodes[ $post_name ] );
761
+				unset($this->core->post_shortcodes[$post_name]);
762 762
 			}
763 763
 		}
764 764
 		//only show errors
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 	 *  @return 	string
778 778
 	 */
779 779
 	public static function get_page_for_posts() {
780
-		$page_for_posts = get_option( 'page_for_posts' );
781
-		if ( ! $page_for_posts ) {
780
+		$page_for_posts = get_option('page_for_posts');
781
+		if ( ! $page_for_posts) {
782 782
 			return 'posts';
783 783
 		}
784 784
 		global $wpdb;
785 785
 		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
786
-		return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ));
786
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
787 787
 	}
788 788
 
789 789
 
@@ -799,11 +799,11 @@  discard block
 block discarded – undo
799 799
 	 *  @return 	void
800 800
 	 */
801 801
 	public function register_shortcodes_and_modules() {
802
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
802
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
803 803
 			return;
804 804
 		}
805 805
 		// allow shortcodes to register with WP and to set hooks for the rest of the system
806
-		EE_Registry::instance()->shortcodes =$this->_register_shortcodes();
806
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
807 807
 		// allow modules to set hooks for the rest of the system
808 808
 		EE_Registry::instance()->modules = $this->_register_modules();
809 809
 	}
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 	 *  @return 	void
818 818
 	 */
819 819
 	public function initialize_shortcodes_and_modules() {
820
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
820
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
821 821
 			return;
822 822
 		}
823 823
 		// allow shortcodes to set hooks for the rest of the system
@@ -836,26 +836,26 @@  discard block
 block discarded – undo
836 836
 	 * 	@return void
837 837
 	 */
838 838
 	public function widgets_init() {
839
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
839
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
840 840
 			return;
841 841
 		}
842 842
 		//only init widgets on admin pages when not in complete maintenance, and
843 843
 		//on frontend when not in any maintenance mode
844
-		if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance)  || ! EE_Maintenance_Mode::instance()->level() ) {
844
+		if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) {
845 845
 			// grab list of installed widgets
846
-			$widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR );
846
+			$widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
847 847
 			// filter list of modules to register
848
-			$widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register );
848
+			$widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register);
849 849
 
850
-			if ( ! empty( $widgets_to_register ) ) {
850
+			if ( ! empty($widgets_to_register)) {
851 851
 				// cycle thru widget folders
852
-				foreach ( $widgets_to_register as $widget_path ) {
852
+				foreach ($widgets_to_register as $widget_path) {
853 853
 					// add to list of installed widget modules
854
-					EE_Config::register_ee_widget( $widget_path );
854
+					EE_Config::register_ee_widget($widget_path);
855 855
 				}
856 856
 			}
857 857
 			// filter list of installed modules
858
-			EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets );
858
+			EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets);
859 859
 		}
860 860
 	}
861 861
 
@@ -868,54 +868,54 @@  discard block
 block discarded – undo
868 868
 	 *  @param 	string 	$widget_path - full path up to and including widget folder
869 869
 	 *  @return 	void
870 870
 	 */
871
-	public static function register_ee_widget( $widget_path = NULL ) {
872
-		do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path );
871
+	public static function register_ee_widget($widget_path = NULL) {
872
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
873 873
 		$widget_ext = '.widget.php';
874 874
 		// make all separators match
875
-		$widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS );
875
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
876 876
 		// does the file path INCLUDE the actual file name as part of the path ?
877
-		if ( strpos( $widget_path, $widget_ext ) !== FALSE ) {
877
+		if (strpos($widget_path, $widget_ext) !== FALSE) {
878 878
 			// grab and shortcode file name from directory name and break apart at dots
879
-			$file_name = explode( '.', basename( $widget_path ));
879
+			$file_name = explode('.', basename($widget_path));
880 880
 			// take first segment from file name pieces and remove class prefix if it exists
881
-			$widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0];
881
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
882 882
 			// sanitize shortcode directory name
883
-			$widget = sanitize_key( $widget );
883
+			$widget = sanitize_key($widget);
884 884
 			// now we need to rebuild the shortcode path
885
-			$widget_path = explode( DS, $widget_path );
885
+			$widget_path = explode(DS, $widget_path);
886 886
 			// remove last segment
887
-			array_pop( $widget_path );
887
+			array_pop($widget_path);
888 888
 			// glue it back together
889
-			$widget_path = implode( DS, $widget_path );
889
+			$widget_path = implode(DS, $widget_path);
890 890
 		} else {
891 891
 			// grab and sanitize widget directory name
892
-			$widget = sanitize_key( basename( $widget_path ));
892
+			$widget = sanitize_key(basename($widget_path));
893 893
 		}
894 894
 		// create classname from widget directory name
895
-		$widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget )));
895
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
896 896
 		// add class prefix
897
-		$widget_class = 'EEW_' . $widget;
897
+		$widget_class = 'EEW_'.$widget;
898 898
 		// does the widget exist ?
899
-		if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) {
899
+		if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
900 900
 			$msg = sprintf(
901
-				__( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ),
901
+				__('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'),
902 902
 				$widget_class,
903
-				$widget_path . DS . $widget_class . $widget_ext
903
+				$widget_path.DS.$widget_class.$widget_ext
904 904
 			);
905
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
905
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
906 906
 			return;
907 907
 		}
908 908
 		// load the widget class file
909
-		require_once( $widget_path . DS . $widget_class . $widget_ext );
909
+		require_once($widget_path.DS.$widget_class.$widget_ext);
910 910
 		// verify that class exists
911
-		if ( ! class_exists( $widget_class )) {
912
-			$msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class );
913
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
911
+		if ( ! class_exists($widget_class)) {
912
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
913
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
914 914
 			return;
915 915
 		}
916
-		register_widget( $widget_class );
916
+		register_widget($widget_class);
917 917
 		// add to array of registered widgets
918
-		EE_Registry::instance()->widgets->$widget_class = $widget_path . DS . $widget_class . $widget_ext;
918
+		EE_Registry::instance()->widgets->$widget_class = $widget_path.DS.$widget_class.$widget_ext;
919 919
 	}
920 920
 
921 921
 
@@ -928,20 +928,20 @@  discard block
 block discarded – undo
928 928
 	 */
929 929
 	private function _register_shortcodes() {
930 930
 		// grab list of installed shortcodes
931
-		$shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR );
931
+		$shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
932 932
 		// filter list of modules to register
933
-		$shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register );
933
+		$shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register);
934 934
 
935 935
 
936
-		if ( ! empty( $shortcodes_to_register ) ) {
936
+		if ( ! empty($shortcodes_to_register)) {
937 937
 			// cycle thru shortcode folders
938
-			foreach ( $shortcodes_to_register as $shortcode_path ) {
938
+			foreach ($shortcodes_to_register as $shortcode_path) {
939 939
 				// add to list of installed shortcode modules
940
-				EE_Config::register_shortcode( $shortcode_path );
940
+				EE_Config::register_shortcode($shortcode_path);
941 941
 			}
942 942
 		}
943 943
 		// filter list of installed modules
944
-		return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes );
944
+		return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes);
945 945
 	}
946 946
 
947 947
 
@@ -953,56 +953,56 @@  discard block
 block discarded – undo
953 953
 	 *  @param 	string 		$shortcode_path - full path up to and including shortcode folder
954 954
 	 *  @return 	bool
955 955
 	 */
956
-	public static function register_shortcode( $shortcode_path = NULL ) {
957
-		do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path );
956
+	public static function register_shortcode($shortcode_path = NULL) {
957
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
958 958
 		$shortcode_ext = '.shortcode.php';
959 959
 		// make all separators match
960
-		$shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path );
960
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
961 961
 		// does the file path INCLUDE the actual file name as part of the path ?
962
-		if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) {
962
+		if (strpos($shortcode_path, $shortcode_ext) !== FALSE) {
963 963
 			// grab shortcode file name from directory name and break apart at dots
964
-			$shortcode_file = explode( '.', basename( $shortcode_path ));
964
+			$shortcode_file = explode('.', basename($shortcode_path));
965 965
 			// take first segment from file name pieces and remove class prefix if it exists
966
-			$shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0];
966
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0];
967 967
 			// sanitize shortcode directory name
968
-			$shortcode = sanitize_key( $shortcode );
968
+			$shortcode = sanitize_key($shortcode);
969 969
 			// now we need to rebuild the shortcode path
970
-			$shortcode_path = explode( DS, $shortcode_path );
970
+			$shortcode_path = explode(DS, $shortcode_path);
971 971
 			// remove last segment
972
-			array_pop( $shortcode_path );
972
+			array_pop($shortcode_path);
973 973
 			// glue it back together
974
-			$shortcode_path = implode( DS, $shortcode_path ) . DS;
974
+			$shortcode_path = implode(DS, $shortcode_path).DS;
975 975
 		} else {
976 976
 			// we need to generate the filename based off of the folder name
977 977
 			// grab and sanitize shortcode directory name
978
-			$shortcode = sanitize_key( basename( $shortcode_path ));
979
-			$shortcode_path = rtrim( $shortcode_path, DS ) . DS;
978
+			$shortcode = sanitize_key(basename($shortcode_path));
979
+			$shortcode_path = rtrim($shortcode_path, DS).DS;
980 980
 		}
981 981
 		// create classname from shortcode directory or file name
982
-		$shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode )));
982
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
983 983
 		// add class prefix
984
-		$shortcode_class = 'EES_' . $shortcode;
984
+		$shortcode_class = 'EES_'.$shortcode;
985 985
 		// does the shortcode exist ?
986
-		if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) {
986
+		if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
987 987
 			$msg = sprintf(
988
-				__( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ),
988
+				__('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'),
989 989
 				$shortcode_class,
990
-				$shortcode_path . DS . $shortcode_class . $shortcode_ext
990
+				$shortcode_path.DS.$shortcode_class.$shortcode_ext
991 991
 			);
992
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
992
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
993 993
 			return FALSE;
994 994
 		}
995 995
 		// load the shortcode class file
996
-		require_once( $shortcode_path . $shortcode_class . $shortcode_ext );
996
+		require_once($shortcode_path.$shortcode_class.$shortcode_ext);
997 997
 		// verify that class exists
998
-		if ( ! class_exists( $shortcode_class )) {
999
-			$msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class );
1000
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
998
+		if ( ! class_exists($shortcode_class)) {
999
+			$msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class);
1000
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1001 1001
 			return FALSE;
1002 1002
 		}
1003
-		$shortcode = strtoupper( $shortcode );
1003
+		$shortcode = strtoupper($shortcode);
1004 1004
 		// add to array of registered shortcodes
1005
-		EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path . $shortcode_class . $shortcode_ext;
1005
+		EE_Registry::instance()->shortcodes->$shortcode = $shortcode_path.$shortcode_class.$shortcode_ext;
1006 1006
 		return TRUE;
1007 1007
 	}
1008 1008
 
@@ -1017,23 +1017,23 @@  discard block
 block discarded – undo
1017 1017
 	 */
1018 1018
 	private function _register_modules() {
1019 1019
 		// grab list of installed modules
1020
-		$modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR );
1020
+		$modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1021 1021
 		// filter list of modules to register
1022
-		$modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register );
1022
+		$modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register);
1023 1023
 
1024 1024
 
1025
-		if ( ! empty( $modules_to_register ) ) {
1025
+		if ( ! empty($modules_to_register)) {
1026 1026
 			// loop through folders
1027
-			foreach ( $modules_to_register as $module_path ) {
1027
+			foreach ($modules_to_register as $module_path) {
1028 1028
 				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1029
-				if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) {
1029
+				if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') {
1030 1030
 					// add to list of installed modules
1031
-					EE_Config::register_module( $module_path );
1031
+					EE_Config::register_module($module_path);
1032 1032
 				}
1033 1033
 			}
1034 1034
 		}
1035 1035
 		// filter list of installed modules
1036
-		return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules );
1036
+		return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules);
1037 1037
 	}
1038 1038
 
1039 1039
 
@@ -1046,54 +1046,54 @@  discard block
 block discarded – undo
1046 1046
 	 *  @param 	string 		$module_path - full path up to and including module folder
1047 1047
 	 *  @return 	bool
1048 1048
 	 */
1049
-	public static function register_module( $module_path = NULL ) {
1050
-		do_action( 'AHEE__EE_Config__register_module__begin', $module_path );
1049
+	public static function register_module($module_path = NULL) {
1050
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1051 1051
 		$module_ext = '.module.php';
1052 1052
 		// make all separators match
1053
-		$module_path = str_replace( array( '\\', '/' ), DS, $module_path );
1053
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1054 1054
 		// does the file path INCLUDE the actual file name as part of the path ?
1055
-		if ( strpos( $module_path, $module_ext ) !== FALSE ) {
1055
+		if (strpos($module_path, $module_ext) !== FALSE) {
1056 1056
 			// grab and shortcode file name from directory name and break apart at dots
1057
-			$module_file = explode( '.', basename( $module_path ));
1057
+			$module_file = explode('.', basename($module_path));
1058 1058
 			// now we need to rebuild the shortcode path
1059
-			$module_path = explode( DS, $module_path );
1059
+			$module_path = explode(DS, $module_path);
1060 1060
 			// remove last segment
1061
-			array_pop( $module_path );
1061
+			array_pop($module_path);
1062 1062
 			// glue it back together
1063
-			$module_path = implode( DS, $module_path ) . DS;
1063
+			$module_path = implode(DS, $module_path).DS;
1064 1064
 			// take first segment from file name pieces and sanitize it
1065
-			$module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] );
1065
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1066 1066
 			// ensure class prefix is added
1067
-			$module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module;
1067
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1068 1068
 		} else {
1069 1069
 			// we need to generate the filename based off of the folder name
1070 1070
 			// grab and sanitize module name
1071
-			$module = strtolower( basename( $module_path ));
1072
-			$module = preg_replace( '/[^a-z0-9_\-]/', '', $module);
1071
+			$module = strtolower(basename($module_path));
1072
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1073 1073
 			// like trailingslashit()
1074
-			$module_path = rtrim( $module_path, DS ) . DS;
1074
+			$module_path = rtrim($module_path, DS).DS;
1075 1075
 			// create classname from module directory name
1076
-			$module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module )));
1076
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1077 1077
 			// add class prefix
1078
-			$module_class = 'EED_' . $module;
1078
+			$module_class = 'EED_'.$module;
1079 1079
 		}
1080 1080
 		// does the module exist ?
1081
-		if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) {
1082
-			$msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
1083
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1081
+		if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1082
+			$msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
1083
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1084 1084
 			return FALSE;
1085 1085
 		}
1086 1086
 		// load the module class file
1087
-		require_once( $module_path . $module_class . $module_ext );
1087
+		require_once($module_path.$module_class.$module_ext);
1088 1088
 		// verify that class exists
1089
-		if ( ! class_exists( $module_class )) {
1090
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
1091
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1089
+		if ( ! class_exists($module_class)) {
1090
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1091
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1092 1092
 			return FALSE;
1093 1093
 		}
1094 1094
 		// add to array of registered modules
1095
-		EE_Registry::instance()->modules->$module_class = $module_path . $module_class . $module_ext;
1096
-		do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class );
1095
+		EE_Registry::instance()->modules->$module_class = $module_path.$module_class.$module_ext;
1096
+		do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->$module_class);
1097 1097
 		return TRUE;
1098 1098
 	}
1099 1099
 
@@ -1107,23 +1107,23 @@  discard block
 block discarded – undo
1107 1107
 	 */
1108 1108
 	private function _initialize_shortcodes() {
1109 1109
 		// cycle thru shortcode folders
1110
-		foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) {
1110
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1111 1111
 			// add class prefix
1112
-			$shortcode_class = 'EES_' . $shortcode;
1112
+			$shortcode_class = 'EES_'.$shortcode;
1113 1113
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1114 1114
 			// which set hooks ?
1115
-			if ( is_admin() ) {
1115
+			if (is_admin()) {
1116 1116
 				// fire immediately
1117
-				call_user_func( array( $shortcode_class, 'set_hooks_admin' ));
1117
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1118 1118
 			} else {
1119 1119
 				// delay until other systems are online
1120
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' ));
1120
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks'));
1121 1121
 				// convert classname to UPPERCASE and create WP shortcode.
1122
-				$shortcode_tag = strtoupper( $shortcode );
1122
+				$shortcode_tag = strtoupper($shortcode);
1123 1123
 				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1124
-				if ( ! shortcode_exists( $shortcode_tag )) {
1124
+				if ( ! shortcode_exists($shortcode_tag)) {
1125 1125
 					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1126
-					add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ));
1126
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1127 1127
 				}
1128 1128
 			}
1129 1129
 		}
@@ -1140,15 +1140,15 @@  discard block
 block discarded – undo
1140 1140
 	 */
1141 1141
 	private function _initialize_modules() {
1142 1142
 		// cycle thru shortcode folders
1143
-		foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) {
1143
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1144 1144
 			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1145 1145
 			// which set hooks ?
1146
-			if ( is_admin() ) {
1146
+			if (is_admin()) {
1147 1147
 				// fire immediately
1148
-				call_user_func( array( $module_class, 'set_hooks_admin' ));
1148
+				call_user_func(array($module_class, 'set_hooks_admin'));
1149 1149
 			} else {
1150 1150
 				// delay until other systems are online
1151
-				add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' ));
1151
+				add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks'));
1152 1152
 			}
1153 1153
 		}
1154 1154
 	}
@@ -1166,26 +1166,26 @@  discard block
 block discarded – undo
1166 1166
 	 *  @param 	string 		$key - url param key indicating a route is being called
1167 1167
 	 *  @return 	bool
1168 1168
 	 */
1169
-	public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) {
1170
-		do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name );
1171
-		$module = str_replace( 'EED_', '', $module );
1172
-		$module_class = 'EED_' . $module;
1173
-		if ( ! isset( EE_Registry::instance()->modules->$module_class )) {
1174
-			$msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module );
1175
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1169
+	public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') {
1170
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1171
+		$module = str_replace('EED_', '', $module);
1172
+		$module_class = 'EED_'.$module;
1173
+		if ( ! isset(EE_Registry::instance()->modules->$module_class)) {
1174
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1175
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1176 1176
 			return FALSE;
1177 1177
 		}
1178
-		if ( empty( $route )) {
1179
-			$msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route );
1180
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1178
+		if (empty($route)) {
1179
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1180
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1181 1181
 			return FALSE;
1182 1182
 		}
1183
-		if ( ! method_exists ( 'EED_' . $module, $method_name )) {
1184
-			$msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route );
1185
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1183
+		if ( ! method_exists('EED_'.$module, $method_name)) {
1184
+			$msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route);
1185
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1186 1186
 			return FALSE;
1187 1187
 		}
1188
-		EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name );
1188
+		EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1189 1189
 		return TRUE;
1190 1190
 	}
1191 1191
 
@@ -1199,11 +1199,11 @@  discard block
 block discarded – undo
1199 1199
 	 *  @param 	string 		$key - url param key indicating a route is being called
1200 1200
 	 *  @return 	string
1201 1201
 	 */
1202
-	public static function get_route( $route = NULL, $key = 'ee' ) {
1203
-		do_action( 'AHEE__EE_Config__get_route__begin',$route );
1204
-		$route = apply_filters( 'FHEE__EE_Config__get_route',$route );
1205
-		if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) {
1206
-			return EE_Config::$_module_route_map[ $key ][ $route ];
1202
+	public static function get_route($route = NULL, $key = 'ee') {
1203
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1204
+		$route = apply_filters('FHEE__EE_Config__get_route', $route);
1205
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1206
+			return EE_Config::$_module_route_map[$key][$route];
1207 1207
 		}
1208 1208
 		return NULL;
1209 1209
 	}
@@ -1232,35 +1232,35 @@  discard block
 block discarded – undo
1232 1232
 	 * @param    string 		$key - url param key indicating a route is being called
1233 1233
 	 * @return    bool
1234 1234
 	 */
1235
-	public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) {
1236
-		do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward );
1237
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1238
-			$msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route );
1239
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1235
+	public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') {
1236
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1237
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1238
+			$msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route);
1239
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1240 1240
 			return FALSE;
1241 1241
 		}
1242
-		if ( empty( $forward )) {
1243
-			$msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route );
1244
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1242
+		if (empty($forward)) {
1243
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1244
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1245 1245
 			return FALSE;
1246 1246
 		}
1247
-		if ( is_array( $forward )) {
1248
-			if ( ! isset( $forward[1] )) {
1249
-				$msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route );
1250
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1247
+		if (is_array($forward)) {
1248
+			if ( ! isset($forward[1])) {
1249
+				$msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route);
1250
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1251 1251
 				return FALSE;
1252 1252
 			}
1253
-			if ( ! method_exists( $forward[0], $forward[1] )) {
1254
-				$msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route );
1255
-				EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1253
+			if ( ! method_exists($forward[0], $forward[1])) {
1254
+				$msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route);
1255
+				EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1256 1256
 				return FALSE;
1257 1257
 			}
1258
-		} else if ( ! function_exists( $forward )) {
1259
-			$msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route );
1260
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1258
+		} else if ( ! function_exists($forward)) {
1259
+			$msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route);
1260
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1261 1261
 			return FALSE;
1262 1262
 		}
1263
-		EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward;
1263
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1264 1264
 		return TRUE;
1265 1265
 	}
1266 1266
 
@@ -1275,10 +1275,10 @@  discard block
 block discarded – undo
1275 1275
 	 *  @param    string 		$key - url param key indicating a route is being called
1276 1276
 	 *  @return 	string
1277 1277
 	 */
1278
-	public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) {
1279
-		do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status );
1280
-		if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) {
1281
-			return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status );
1278
+	public static function get_forward($route = NULL, $status = 0, $key = 'ee') {
1279
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1280
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1281
+			return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status);
1282 1282
 		}
1283 1283
 		return NULL;
1284 1284
 	}
@@ -1295,19 +1295,19 @@  discard block
 block discarded – undo
1295 1295
 	 * @param    string 		$key - url param key indicating a route is being called
1296 1296
 	 * @return    bool
1297 1297
 	 */
1298
-	public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) {
1299
-		do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view );
1300
-		if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ||  empty( $route )) {
1301
-			$msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route );
1302
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1298
+	public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') {
1299
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1300
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1301
+			$msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route);
1302
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1303 1303
 			return FALSE;
1304 1304
 		}
1305
-		if ( ! is_readable( $view )) {
1306
-			$msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view );
1307
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
1305
+		if ( ! is_readable($view)) {
1306
+			$msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view);
1307
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1308 1308
 			return FALSE;
1309 1309
 		}
1310
-		EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view;
1310
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1311 1311
 		return TRUE;
1312 1312
 	}
1313 1313
 
@@ -1324,10 +1324,10 @@  discard block
 block discarded – undo
1324 1324
 	 *  @param    string 		$key - url param key indicating a route is being called
1325 1325
 	 *  @return 	string
1326 1326
 	 */
1327
-	public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) {
1328
-		do_action( 'AHEE__EE_Config__get_view__begin',$route,$status );
1329
-		if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) {
1330
-			return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status );
1327
+	public static function get_view($route = NULL, $status = 0, $key = 'ee') {
1328
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1329
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1330
+			return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status);
1331 1331
 		}
1332 1332
 		return NULL;
1333 1333
 	}
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 
1336 1336
 
1337 1337
 	public function shutdown() {
1338
-		update_option( 'ee_config_option_names', $this->_config_option_names );
1338
+		update_option('ee_config_option_names', $this->_config_option_names);
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
  * magic functions in use, except we'll allow them to magically set and get stuff...
1352 1352
  * basically, they should just be well-defined stdClasses
1353 1353
  */
1354
-class EE_Config_Base{
1354
+class EE_Config_Base {
1355 1355
 
1356 1356
 	/**
1357 1357
 	 * Utility function for escaping the value of a property and returning.
@@ -1360,13 +1360,13 @@  discard block
 block discarded – undo
1360 1360
 	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1361 1361
 	 * @throws \EE_Error
1362 1362
 	 */
1363
-	public function get_pretty( $property ) {
1364
-		if ( ! property_exists( $this, $property ) ) {
1365
-			throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) );
1363
+	public function get_pretty($property) {
1364
+		if ( ! property_exists($this, $property)) {
1365
+			throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property));
1366 1366
 		}
1367 1367
 		//just handling escaping of strings for now.
1368
-		if ( is_string( $this->$property ) ) {
1369
-			return stripslashes( $this->$property );
1368
+		if (is_string($this->$property)) {
1369
+			return stripslashes($this->$property);
1370 1370
 		}
1371 1371
 		return $this->$property;
1372 1372
 	}
@@ -1375,19 +1375,19 @@  discard block
 block discarded – undo
1375 1375
 
1376 1376
 	public function populate() {
1377 1377
 		//grab defaults via a new instance of this class.
1378
-		$class_name = get_class( $this );
1378
+		$class_name = get_class($this);
1379 1379
 		$defaults = new $class_name;
1380 1380
 
1381 1381
 		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1382 1382
 		//default from our $defaults object.
1383
-		foreach ( get_object_vars( $defaults ) as $property => $value ) {
1384
-			if ( is_null( $this->$property ) ) {
1383
+		foreach (get_object_vars($defaults) as $property => $value) {
1384
+			if (is_null($this->$property)) {
1385 1385
 				$this->$property = $value;
1386 1386
 			}
1387 1387
 		}
1388 1388
 
1389 1389
 		//cleanup
1390
-		unset( $defaults );
1390
+		unset($defaults);
1391 1391
 	}
1392 1392
 
1393 1393
 
@@ -1479,12 +1479,12 @@  discard block
 block discarded – undo
1479 1479
 	 */
1480 1480
 	public function __construct() {
1481 1481
 		$current_network_main_site = is_multisite() ? get_current_site() : NULL;
1482
-		$current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1;
1482
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1483 1483
 		// set default organization settings
1484 1484
 		$this->current_blog_id = get_current_blog_id();
1485 1485
 		$this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id;
1486
-		$this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE );
1487
-		$this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE;
1486
+		$this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE);
1487
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE;
1488 1488
 		$this->post_shortcodes = array();
1489 1489
 		$this->module_route_map = array();
1490 1490
 		$this->module_forward_map = array();
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
 		$this->event_cpt_slug = __('events', 'event_espresso');
1504 1504
 
1505 1505
 		//ueip constant check
1506
-		if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) {
1506
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1507 1507
 			$this->ee_ueip_optin = FALSE;
1508 1508
 			$this->ee_ueip_has_notified = TRUE;
1509 1509
 		}
@@ -1543,8 +1543,8 @@  discard block
 block discarded – undo
1543 1543
 	 *  @return 	string
1544 1544
 	 */
1545 1545
 	public function reg_page_url() {
1546
-		if ( ! $this->reg_page_url ) {
1547
-			$this->reg_page_url = get_permalink( $this->reg_page_id );
1546
+		if ( ! $this->reg_page_url) {
1547
+			$this->reg_page_url = get_permalink($this->reg_page_id);
1548 1548
 		}
1549 1549
 		return $this->reg_page_url;
1550 1550
 	}
@@ -1557,12 +1557,12 @@  discard block
 block discarded – undo
1557 1557
 	 *  @return 	string
1558 1558
 	 */
1559 1559
 	public function txn_page_url($query_args = array()) {
1560
-		if ( ! $this->txn_page_url ) {
1561
-			$this->txn_page_url = get_permalink( $this->txn_page_id );
1560
+		if ( ! $this->txn_page_url) {
1561
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1562 1562
 		}
1563
-		if($query_args){
1564
-			return add_query_arg($query_args,$this->txn_page_url);
1565
-		}else{
1563
+		if ($query_args) {
1564
+			return add_query_arg($query_args, $this->txn_page_url);
1565
+		} else {
1566 1566
 			return $this->txn_page_url;
1567 1567
 		}
1568 1568
 	}
@@ -1574,12 +1574,12 @@  discard block
 block discarded – undo
1574 1574
 	 *  @return 	string
1575 1575
 	 */
1576 1576
 	public function thank_you_page_url($query_args = array()) {
1577
-		if ( ! $this->thank_you_page_url ) {
1578
-			$this->thank_you_page_url = get_permalink( $this->thank_you_page_id );
1577
+		if ( ! $this->thank_you_page_url) {
1578
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1579 1579
 		}
1580
-		if($query_args){
1581
-			return add_query_arg($query_args,$this->thank_you_page_url);
1582
-		}else{
1580
+		if ($query_args) {
1581
+			return add_query_arg($query_args, $this->thank_you_page_url);
1582
+		} else {
1583 1583
 			return $this->thank_you_page_url;
1584 1584
 		}
1585 1585
 	}
@@ -1590,8 +1590,8 @@  discard block
 block discarded – undo
1590 1590
 	 *  @return 	string
1591 1591
 	 */
1592 1592
 	public function cancel_page_url() {
1593
-		if ( ! $this->cancel_page_url ) {
1594
-			$this->cancel_page_url = get_permalink( $this->cancel_page_id );
1593
+		if ( ! $this->cancel_page_url) {
1594
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1595 1595
 		}
1596 1596
 		return $this->cancel_page_url;
1597 1597
 	}
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 		//reset all url properties
1620 1620
 		$this->_reset_urls();
1621 1621
 		//return what to save to db
1622
-		return array_keys( get_object_vars( $this ) );
1622
+		return array_keys(get_object_vars($this));
1623 1623
 	}
1624 1624
 
1625 1625
 }
@@ -1851,39 +1851,39 @@  discard block
 block discarded – undo
1851 1851
 	 * @param null $CNT_ISO
1852 1852
 	 * @return \EE_Currency_Config
1853 1853
 	 */
1854
-	public function __construct( $CNT_ISO = NULL ) {
1854
+	public function __construct($CNT_ISO = NULL) {
1855 1855
 
1856 1856
 		// get country code from organization settings or use default
1857
-		$ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1857
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL;
1858 1858
 		// but override if requested
1859
-		$CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT;
1860
-		EE_Registry::instance()->load_helper( 'Activation' );
1859
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
1860
+		EE_Registry::instance()->load_helper('Activation');
1861 1861
 		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
1862
-		if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) {
1862
+		if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) {
1863 1863
 			// retrieve the country settings from the db, just in case they have been customized
1864
-			$country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO );
1865
-			if ( $country instanceof EE_Country ) {
1866
-				$this->code = $country->currency_code(); 	// currency code: USD, CAD, EUR
1867
-				$this->name = $country->currency_name_single();	// Dollar
1868
-				$this->plural = $country->currency_name_plural(); 	// Dollars
1869
-				$this->sign =  $country->currency_sign(); 			// currency sign: $
1870
-				$this->sign_b4 = $country->currency_sign_before(); 		// currency sign before or after: $TRUE  or  FALSE$
1871
-				$this->dec_plc = $country->currency_decimal_places();	// decimal places: 2 = 0.00  3 = 0.000
1872
-				$this->dec_mrk = $country->currency_decimal_mark();	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1873
-				$this->thsnds = $country->currency_thousands_separator();	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1864
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
1865
+			if ($country instanceof EE_Country) {
1866
+				$this->code = $country->currency_code(); // currency code: USD, CAD, EUR
1867
+				$this->name = $country->currency_name_single(); // Dollar
1868
+				$this->plural = $country->currency_name_plural(); // Dollars
1869
+				$this->sign = $country->currency_sign(); // currency sign: $
1870
+				$this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
1871
+				$this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
1872
+				$this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1873
+				$this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1874 1874
 			}
1875 1875
 		}
1876 1876
 		// fallback to hardcoded defaults, in case the above failed
1877
-		if ( empty( $this->code )) {
1877
+		if (empty($this->code)) {
1878 1878
 			// set default currency settings
1879
-			$this->code = 'USD'; 	// currency code: USD, CAD, EUR
1880
-			$this->name = __( 'Dollar', 'event_espresso' ); 	// Dollar
1881
-			$this->plural = __( 'Dollars', 'event_espresso' ); 	// Dollars
1882
-			$this->sign =  '$'; 	// currency sign: $
1883
-			$this->sign_b4 = TRUE; 	// currency sign before or after: $TRUE  or  FALSE$
1884
-			$this->dec_plc = 2; 	// decimal places: 2 = 0.00  3 = 0.000
1885
-			$this->dec_mrk = '.'; 	// decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1886
-			$this->thsnds = ','; 	// thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1879
+			$this->code = 'USD'; // currency code: USD, CAD, EUR
1880
+			$this->name = __('Dollar', 'event_espresso'); // Dollar
1881
+			$this->plural = __('Dollars', 'event_espresso'); // Dollars
1882
+			$this->sign = '$'; // currency sign: $
1883
+			$this->sign_b4 = TRUE; // currency sign before or after: $TRUE  or  FALSE$
1884
+			$this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
1885
+			$this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
1886
+			$this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
1887 1887
 		}
1888 1888
 	}
1889 1889
 }
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 		$this->recaptcha_publickey = NULL;
2002 2002
 		$this->recaptcha_privatekey = NULL;
2003 2003
 		$this->recaptcha_width = 500;
2004
-		add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ));
2004
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2005 2005
 
2006 2006
 	}
2007 2007
 
@@ -2011,7 +2011,7 @@  discard block
 block discarded – undo
2011 2011
 	 * @return void
2012 2012
 	 */
2013 2013
 	public function set_default_reg_status_on_EEM_Event() {
2014
-		EEM_Event::set_default_reg_status( $this->default_STS_ID );
2014
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2015 2015
 	}
2016 2016
 
2017 2017
 
@@ -2116,10 +2116,10 @@  discard block
 block discarded – undo
2116 2116
 	 * @param bool $reset
2117 2117
 	 * @return string
2118 2118
 	 */
2119
-	public function log_file_name( $reset = FALSE ) {
2120
-		if ( empty( $this->log_file_name ) || $reset ) {
2121
-			$this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt';
2122
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2119
+	public function log_file_name($reset = FALSE) {
2120
+		if (empty($this->log_file_name) || $reset) {
2121
+			$this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt';
2122
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2123 2123
 		}
2124 2124
 		return $this->log_file_name;
2125 2125
 	}
@@ -2131,10 +2131,10 @@  discard block
 block discarded – undo
2131 2131
 	 * @param bool $reset
2132 2132
 	 * @return string
2133 2133
 	 */
2134
-	public function debug_file_name( $reset = FALSE ) {
2135
-		if ( empty( $this->debug_file_name ) || $reset ) {
2136
-			$this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt';
2137
-			EE_Config::instance()->update_espresso_config( FALSE, FALSE );
2134
+	public function debug_file_name($reset = FALSE) {
2135
+		if (empty($this->debug_file_name) || $reset) {
2136
+			$this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt';
2137
+			EE_Config::instance()->update_espresso_config(FALSE, FALSE);
2138 2138
 		}
2139 2139
 		return $this->debug_file_name;
2140 2140
 	}
@@ -2295,21 +2295,21 @@  discard block
 block discarded – undo
2295 2295
 		// set default map settings
2296 2296
 		$this->use_google_maps = TRUE;
2297 2297
 		// for event details pages (reg page)
2298
-		$this->event_details_map_width = 585; 			// ee_map_width_single
2299
-		$this->event_details_map_height = 362; 			// ee_map_height_single
2300
-		$this->event_details_map_zoom = 14; 			// ee_map_zoom_single
2301
-		$this->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
2302
-		$this->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
2303
-		$this->event_details_control_type = 'default'; 		// ee_map_type_control_single
2304
-		$this->event_details_map_align = 'center'; 			// ee_map_align_single
2298
+		$this->event_details_map_width = 585; // ee_map_width_single
2299
+		$this->event_details_map_height = 362; // ee_map_height_single
2300
+		$this->event_details_map_zoom = 14; // ee_map_zoom_single
2301
+		$this->event_details_display_nav = TRUE; // ee_map_nav_display_single
2302
+		$this->event_details_nav_size = FALSE; // ee_map_nav_size_single
2303
+		$this->event_details_control_type = 'default'; // ee_map_type_control_single
2304
+		$this->event_details_map_align = 'center'; // ee_map_align_single
2305 2305
 		// for event list pages
2306
-		$this->event_list_map_width = 300; 			// ee_map_width
2307
-		$this->event_list_map_height = 185; 		// ee_map_height
2308
-		$this->event_list_map_zoom = 12; 			// ee_map_zoom
2309
-		$this->event_list_display_nav = FALSE; 		// ee_map_nav_display
2310
-		$this->event_list_nav_size = TRUE; 			// ee_map_nav_size
2311
-		$this->event_list_control_type = 'dropdown'; 		// ee_map_type_control
2312
-		$this->event_list_map_align = 'center'; 			// ee_map_align
2306
+		$this->event_list_map_width = 300; // ee_map_width
2307
+		$this->event_list_map_height = 185; // ee_map_height
2308
+		$this->event_list_map_zoom = 12; // ee_map_zoom
2309
+		$this->event_list_display_nav = FALSE; // ee_map_nav_display
2310
+		$this->event_list_nav_size = TRUE; // ee_map_nav_size
2311
+		$this->event_list_control_type = 'dropdown'; // ee_map_type_control
2312
+		$this->event_list_map_align = 'center'; // ee_map_align
2313 2313
 	}
2314 2314
 
2315 2315
 }
@@ -2320,7 +2320,7 @@  discard block
 block discarded – undo
2320 2320
 /**
2321 2321
  * stores Events_Archive settings
2322 2322
  */
2323
-class EE_Events_Archive_Config extends EE_Config_Base{
2323
+class EE_Events_Archive_Config extends EE_Config_Base {
2324 2324
 
2325 2325
 	public $display_status_banner;
2326 2326
 	public $display_description;
@@ -2334,7 +2334,7 @@  discard block
 block discarded – undo
2334 2334
 	/**
2335 2335
 	 *	class constructor
2336 2336
 	 */
2337
-	public function __construct(){
2337
+	public function __construct() {
2338 2338
 		$this->display_status_banner = 0;
2339 2339
 		$this->display_description = 1;
2340 2340
 		$this->display_ticket_selector = 0;
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 /**
2350 2350
  * Stores Event_Single_Config settings
2351 2351
  */
2352
-class EE_Event_Single_Config extends EE_Config_Base{
2352
+class EE_Event_Single_Config extends EE_Config_Base {
2353 2353
 	public $display_status_banner_single;
2354 2354
 	public $display_venue;
2355 2355
 
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 /**
2368 2368
  * Stores Ticket_Selector_Config settings
2369 2369
  */
2370
-class EE_Ticket_Selector_Config extends EE_Config_Base{
2370
+class EE_Ticket_Selector_Config extends EE_Config_Base {
2371 2371
 	public $show_ticket_sale_columns;
2372 2372
 	public $show_ticket_details;
2373 2373
 	public $show_expired_tickets;
@@ -2421,7 +2421,7 @@  discard block
 block discarded – undo
2421 2421
 	 * @return void
2422 2422
 	 */
2423 2423
 	protected function _set_php_values() {
2424
-		$this->php->max_input_vars = ini_get( 'max_input_vars' );
2424
+		$this->php->max_input_vars = ini_get('max_input_vars');
2425 2425
 		$this->php->version = phpversion();
2426 2426
 	}
2427 2427
 
@@ -2440,8 +2440,8 @@  discard block
 block discarded – undo
2440 2440
 	 *         @type string $msg 		Any message to be displayed.
2441 2441
 	 * }
2442 2442
 	 */
2443
-	public function max_input_vars_limit_check( $input_count = 0 ) {
2444
-		if ( ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) {
2443
+	public function max_input_vars_limit_check($input_count = 0) {
2444
+		if (($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) {
2445 2445
 			return  __('The number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.', 'event_espresso');
2446 2446
 		} else {
2447 2447
 			return '';
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
  * stores payment gateway info
2478 2478
  * @deprecated
2479 2479
  */
2480
-class EE_Gateway_Config extends EE_Config_Base{
2480
+class EE_Gateway_Config extends EE_Config_Base {
2481 2481
 
2482 2482
 	/**
2483 2483
 	 * Array with keys that are payment gateways slugs, and values are arrays
@@ -2499,9 +2499,9 @@  discard block
 block discarded – undo
2499 2499
 	 *	class constructor
2500 2500
 	 * @deprecated
2501 2501
 	 */
2502
-	public function __construct(){
2502
+	public function __construct() {
2503 2503
 		$this->payment_settings = array();
2504
-		$this->active_gateways = array( 'Invoice' => FALSE );
2504
+		$this->active_gateways = array('Invoice' => FALSE);
2505 2505
 	}
2506 2506
 }
2507 2507
 
Please login to merge, or discard this patch.
core/EE_Error.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 *    error_handler
90 90
 	 * @access public
91
-	 * @param $code
91
+	 * @param integer $code
92 92
 	 * @param $message
93 93
 	 * @param $file
94 94
 	 * @param $line
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	/**
190 190
 	 *    _format_error
191 191
 	 * @access private
192
-	 * @param $code
192
+	 * @param string $code
193 193
 	 * @param $message
194 194
 	 * @param $file
195 195
 	 * @param $line
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 *
937 937
 	 * @access    public
938 938
 	 * @param string $return_url
939
-	 * @return    array
939
+	 * @return    string
940 940
 	 */
941 941
 	public static function get_persistent_admin_notices( $return_url = '' ) {
942 942
 		$notices = '';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 *
962 962
 	 * @access 	public
963 963
 	 * @param 	bool $force_print
964
-	 * @return 	void
964
+	 * @return 	null|string
965 965
 	 */
966 966
 	private static function _print_scripts( $force_print = FALSE ) {
967 967
 		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3 5
 if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4 6
 	set_error_handler( array( 'EE_Error', 'error_handler' ));
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 	}
550 550
 
551 551
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
563 563
 	* 	@return 		void
564 564
 	*/
565
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
566
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
565
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
566
+		self::_add_notice('success', $msg, $file, $func, $line);
567 567
 	}
568 568
 
569 569
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
581 581
 	* 	@return 		void
582 582
 	*/
583
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
584
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
583
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
584
+		self::_add_notice('attention', $msg, $file, $func, $line);
585 585
 	}
586 586
 
587 587
 
@@ -599,12 +599,12 @@  discard block
 block discarded – undo
599 599
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
600 600
 	* 	@return 		void
601 601
 	*/
602
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
603
-		if ( empty( $msg )) {
602
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
603
+		if (empty($msg)) {
604 604
 			EE_Error::doing_it_wrong(
605
-				'EE_Error::add_' . $type . '()',
605
+				'EE_Error::add_'.$type.'()',
606 606
 				sprintf(
607
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
607
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
608 608
 					$type,
609 609
 					$file,
610 610
 					$line
@@ -612,26 +612,26 @@  discard block
 block discarded – undo
612 612
 				EVENT_ESPRESSO_VERSION
613 613
 			);
614 614
 		}
615
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
615
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
616 616
 			EE_Error::doing_it_wrong(
617 617
 				'EE_Error::add_error()',
618
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
618
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
619 619
 				EVENT_ESPRESSO_VERSION
620 620
 			);
621 621
 		}
622 622
 		// get separate user and developer messages if they exist
623
-		$msg = explode( '||', $msg );
623
+		$msg = explode('||', $msg);
624 624
 		$user_msg = $msg[0];
625
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
625
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
626 626
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
627 627
 		// add notice if message exists
628
-		if ( ! empty( $msg )) {
628
+		if ( ! empty($msg)) {
629 629
 			// get error code only on error
630
-			$error_code = $type == 'errors' ? EE_Error::generate_error_code ( $file, $func, $line ) : '';
631
-			$error_code =  ! empty( $error_code ) ? '<br/><span class="tiny-text">' . $error_code . '</span>' : '';
630
+			$error_code = $type == 'errors' ? EE_Error::generate_error_code($file, $func, $line) : '';
631
+			$error_code = ! empty($error_code) ? '<br/><span class="tiny-text">'.$error_code.'</span>' : '';
632 632
 			// add notice
633
-			self::$_espresso_notices[ $type ][] = $msg . $error_code;
634
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
633
+			self::$_espresso_notices[$type][] = $msg.$error_code;
634
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
635 635
 		}
636 636
 
637 637
 	}
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	*	@access private
686 686
 	*	@return void
687 687
 	*/
688
-	public static function reset_notices(){
688
+	public static function reset_notices() {
689 689
     	self::$_espresso_notices['success'] = FALSE;
690 690
     	self::$_espresso_notices['attention'] = FALSE;
691 691
     	self::$_espresso_notices['errors'] = FALSE;
@@ -698,14 +698,14 @@  discard block
 block discarded – undo
698 698
 	*	@access public
699 699
 	*	@return int
700 700
 	*/
701
-    public static function has_notices(){
701
+    public static function has_notices() {
702 702
 		$has_notices = 0;
703 703
 		// check for success messages
704
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
704
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
705 705
 		// check for attention messages
706
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
707 707
 		// check for error messages
708
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
709 709
 		return $has_notices;
710 710
 	}
711 711
 
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
721 721
 	* 	@return 		array
722 722
 	*/
723
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
724
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
723
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
724
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
725 725
 
726 726
 		$success_messages = '';
727 727
 		$attention_messages = '';
@@ -731,44 +731,44 @@  discard block
 block discarded – undo
731 731
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
732 732
 
733 733
 		// either save notices to the db
734
-		if ( $save_to_transient ) {
735
-			update_option( 'ee_notices', self::$_espresso_notices );
734
+		if ($save_to_transient) {
735
+			update_option('ee_notices', self::$_espresso_notices);
736 736
 			return;
737 737
 		}
738 738
 		// grab any notices that have been previously saved
739
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
740
-			foreach ( $notices as $type => $notice ) {
741
-				if ( is_array( $notice ) && ! empty( $notice )) {
739
+		if ($notices = get_option('ee_notices', FALSE)) {
740
+			foreach ($notices as $type => $notice) {
741
+				if (is_array($notice) && ! empty($notice)) {
742 742
 					// make sure that existsing notice type is an array
743
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
743
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
744 744
 					// merge stored notices with any newly created ones
745
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
745
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
746 746
 					$print_scripts = TRUE;
747 747
 				}
748 748
 			}
749 749
 			// now clear any stored notices
750
-			update_option( 'ee_notices', FALSE );
750
+			update_option('ee_notices', FALSE);
751 751
 		}
752 752
 
753 753
 		// check for success messages
754
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
754
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
755 755
 			// combine messages
756
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
756
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
757 757
 			$print_scripts = TRUE;
758 758
 		}
759 759
 
760 760
 		// check for attention messages
761
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
761
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
762 762
 			// combine messages
763
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
763
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
764 764
 			$print_scripts = TRUE;
765 765
 		}
766 766
 
767 767
 		// check for error messages
768
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
769
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
768
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
769
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
770 770
 			// combine messages
771
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
771
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
772 772
 			$print_scripts = TRUE;
773 773
 		}
774 774
 
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
783 783
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
784 784
 				//showMessage( $success_messages );
785
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
785
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
786 786
 			}
787 787
 
788 788
 			if ($attention_messages != '') {
789 789
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
790 790
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
791 791
 				//showMessage( $error_messages, TRUE );
792
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
792
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
793 793
 			}
794 794
 
795 795
 			if ($error_messages != '') {
796 796
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
797 797
 				$css_class = is_admin() ? 'error' : 'error fade-away';
798 798
 				//showMessage( $error_messages, TRUE );
799
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
799
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
800 800
 			}
801 801
 
802 802
 			$notices .= '</div>';
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 					'errors' => $error_messages
810 810
 			);
811 811
 
812
-			if ( $remove_empty ) {
812
+			if ($remove_empty) {
813 813
 				// remove empty notices
814 814
 				foreach ($notices as $type => $notice) {
815 815
 					if (empty($notice)) {
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 			}
820 820
 		}
821 821
 
822
-		if ( $print_scripts ) {
822
+		if ($print_scripts) {
823 823
 			self::_print_scripts();
824 824
 		}
825 825
 
@@ -839,17 +839,17 @@  discard block
 block discarded – undo
839 839
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840 840
 	* 	@return 		void
841 841
 	*/
842
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
843
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
844
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
842
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
843
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
844
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
845 845
 			//maybe initialize persistent_admin_notices
846
-			if ( empty( $persistent_admin_notices )) {
847
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
846
+			if (empty($persistent_admin_notices)) {
847
+				add_option('ee_pers_admin_notices', array(), '', 'no');
848 848
 			}
849
-			$pan_name = sanitize_key( $pan_name );
850
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
851
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
852
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
849
+			$pan_name = sanitize_key($pan_name);
850
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
851
+				$persistent_admin_notices[$pan_name] = $pan_message;
852
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
853 853
 			}
854 854
 		}
855 855
 	}
@@ -865,34 +865,34 @@  discard block
 block discarded – undo
865 865
 	 * @param bool          $return_immediately
866 866
 	 * @return        void
867 867
 	 */
868
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
869
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
870
-		if ( ! empty( $pan_name )) {
871
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
868
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
869
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
870
+		if ( ! empty($pan_name)) {
871
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
872 872
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
873
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
873
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
874 874
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
875
-				if ( $purge ) {
876
-					unset( $persistent_admin_notices[ $pan_name ] );
875
+				if ($purge) {
876
+					unset($persistent_admin_notices[$pan_name]);
877 877
 				} else {
878
-					$persistent_admin_notices[ $pan_name ] = NULL;
878
+					$persistent_admin_notices[$pan_name] = NULL;
879 879
 				}
880
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
881
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
880
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
881
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
882 882
 				}
883 883
 			}
884 884
 		}
885
-		if ( $return_immediately ) {
885
+		if ($return_immediately) {
886 886
 			return;
887
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
887
+		} else if (EE_Registry::instance()->REQ->ajax) {
888 888
 			// grab any notices and concatenate into string
889
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
889
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
890 890
 			exit();
891 891
 		} else {
892 892
 			// save errors to a transient to be displayed on next request (after redirect)
893
-			EE_Error::get_notices( FALSE, TRUE );
894
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
895
-			wp_safe_redirect( urldecode( $return_url ));
893
+			EE_Error::get_notices(FALSE, TRUE);
894
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
895
+			wp_safe_redirect(urldecode($return_url));
896 896
 		}
897 897
 	}
898 898
 
@@ -907,20 +907,20 @@  discard block
 block discarded – undo
907 907
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
908 908
 	 *  	@return 		string
909 909
 	 */
910
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
911
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
910
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
911
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
912 912
 			$args = array(
913 913
 				'nag_notice' => $pan_name,
914
-				'return_url' => urlencode( $return_url ),
914
+				'return_url' => urlencode($return_url),
915 915
 				'ajax_url' => WP_AJAX_URL,
916
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
916
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
917 917
 			);
918
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
918
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
919 919
 			return '
920
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
921
-				<p>' . $pan_message . '</p>
922
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
923
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
920
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
921
+				<p>' . $pan_message.'</p>
922
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
923
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
924 924
 				</a>
925 925
 				<div style="clear:both;"></div>
926 926
 			</div>';
@@ -936,17 +936,17 @@  discard block
 block discarded – undo
936 936
 	 * @param string $return_url
937 937
 	 * @return    array
938 938
 	 */
939
-	public static function get_persistent_admin_notices( $return_url = '' ) {
939
+	public static function get_persistent_admin_notices($return_url = '') {
940 940
 		$notices = '';
941 941
 		// check for persistent admin notices
942
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
942
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
943 943
 			// load scripts
944
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
945
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
946
-			wp_enqueue_script( 'ee_error_js' );
944
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
945
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
946
+			wp_enqueue_script('ee_error_js');
947 947
 			// and display notices
948
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
949
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
948
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
949
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
950 950
 			}
951 951
 		}
952 952
 		return $notices;
@@ -961,26 +961,26 @@  discard block
 block discarded – undo
961 961
 	 * @param 	bool $force_print
962 962
 	 * @return 	void
963 963
 	 */
964
-	private static function _print_scripts( $force_print = FALSE ) {
965
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
966
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
964
+	private static function _print_scripts($force_print = FALSE) {
965
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
966
+			if (wp_script_is('ee_error_js', 'enqueued')) {
967 967
 				return;
968
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
969
-				add_filter( 'FHEE_load_css', '__return_true' );
970
-				add_filter( 'FHEE_load_js', '__return_true' );
971
-				wp_enqueue_script( 'ee_error_js' );
972
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
968
+			} else if (wp_script_is('ee_error_js', 'registered')) {
969
+				add_filter('FHEE_load_css', '__return_true');
970
+				add_filter('FHEE_load_js', '__return_true');
971
+				wp_enqueue_script('ee_error_js');
972
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
973 973
 			}
974 974
 		} else {
975 975
 			return '
976 976
 <script>
977 977
 /* <![CDATA[ */
978
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
978
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
979 979
 /* ]]> */
980 980
 </script>
981
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
982
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
983
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
981
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
982
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
983
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
984 984
 ';
985 985
 
986 986
 		}
@@ -1014,11 +1014,11 @@  discard block
 block discarded – undo
1014 1014
 	*	@ param string $line
1015 1015
 	*	@ return string
1016 1016
 	*/
1017
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1018
-		$file = explode( '.', basename( $file ));
1019
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1020
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1021
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1017
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1018
+		$file = explode('.', basename($file));
1019
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1020
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1021
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1022 1022
 		return $error_code;
1023 1023
 	}
1024 1024
 
@@ -1034,38 +1034,38 @@  discard block
 block discarded – undo
1034 1034
 	*	@ param object $ex
1035 1035
 	*	@ return void
1036 1036
 	*/
1037
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1037
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1038 1038
 
1039
-		if ( ! $ex ) {
1039
+		if ( ! $ex) {
1040 1040
 			return;
1041 1041
 		}
1042 1042
 
1043
-		if ( ! $time ) {
1043
+		if ( ! $time) {
1044 1044
 			$time = time();
1045 1045
 		}
1046 1046
 
1047
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1048
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1049
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1050
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1051
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1052
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1053
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1054
-		$exception_log .= $ex['string'] . PHP_EOL;
1055
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1056
-
1057
-		EE_Registry::instance()->load_helper( 'File' );
1047
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1048
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1049
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1050
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1051
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1052
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1053
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1054
+		$exception_log .= $ex['string'].PHP_EOL;
1055
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1056
+
1057
+		EE_Registry::instance()->load_helper('File');
1058 1058
 		try {
1059
-			EEH_File::ensure_folder_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
1060
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
1061
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1062
-			if ( ! $clear ) {
1059
+			EEH_File::ensure_folder_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
1060
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
1061
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1062
+			if ( ! $clear) {
1063 1063
 				//get existing log file and append new log info
1064
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1064
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1065 1065
 			}
1066
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1067
-		} catch( EE_Error $e ){
1068
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1066
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1067
+		} catch (EE_Error $e) {
1068
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1069 1069
 			return;
1070 1070
 		}
1071 1071
 
@@ -1088,10 +1088,10 @@  discard block
 block discarded – undo
1088 1088
 	 * @param  string $version  The version of Event Espresso where the error was added
1089 1089
 	 * @return trigger_error()
1090 1090
 	 */
1091
-	public static function doing_it_wrong( $function, $message, $version ) {
1092
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1091
+	public static function doing_it_wrong($function, $message, $version) {
1092
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1093 1093
 			EE_Registry::instance()->load_helper('Debug_Tools');
1094
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version );
1094
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version);
1095 1095
 		}
1096 1096
 	}
1097 1097
 
@@ -1111,13 +1111,13 @@  discard block
 block discarded – undo
1111 1111
  */
1112 1112
 function espresso_error_enqueue_scripts() {
1113 1113
 	// js for error handling
1114
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1115
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1114
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1115
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1116 1116
 }
1117
-if ( is_admin() ) {
1118
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1117
+if (is_admin()) {
1118
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1119 1119
 } else {
1120
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1120
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1121 1121
 }
1122 1122
 
1123 1123
 
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -18,52 +18,52 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 	/**
21
-	* 	name of the file to log exceptions to
22
-	* 	@access	private
23
-    *	@var string
24
-	*/
21
+	 * 	name of the file to log exceptions to
22
+	 * 	@access	private
23
+	 *	@var string
24
+	 */
25 25
 	private static $_exception_log_file = 'espresso_error_log.txt';
26 26
 
27 27
 	/**
28
-	* 	the exception
29
-	* 	@access	private
30
-    *	@var object
31
-	*/
28
+	 * 	the exception
29
+	 * 	@access	private
30
+	 *	@var object
31
+	 */
32 32
 	private $_exception;
33 33
 
34 34
 	/**
35
-	* 	stores details for all exception
36
-	* 	@access	private
37
-    *	@var array
38
-	*/
35
+	 * 	stores details for all exception
36
+	 * 	@access	private
37
+	 *	@var array
38
+	 */
39 39
 	private static $_all_exceptions = array();
40 40
 
41 41
 	/**
42
-	* 	tracks number of errors
43
-	* 	@access	private
44
-    *	@var int
45
-	*/
42
+	 * 	tracks number of errors
43
+	 * 	@access	private
44
+	 *	@var int
45
+	 */
46 46
 	private static $_error_count = 0;
47 47
 
48 48
 	/**
49
-	* 	has JS been loaded ?
50
-	* 	@access	private
51
-    *	@var boolean
52
-	*/
49
+	 * 	has JS been loaded ?
50
+	 * 	@access	private
51
+	 *	@var boolean
52
+	 */
53 53
 	private static $_js_loaded = FALSE;
54 54
 
55 55
 	/**
56
-	* 	has shutdown action been added ?
57
-	* 	@access	private
58
-    *	@var boolean
59
-	*/
56
+	 * 	has shutdown action been added ?
57
+	 * 	@access	private
58
+	 *	@var boolean
59
+	 */
60 60
 	private static $_action_added = FALSE;
61 61
 
62 62
 	/**
63
-	* 	has shutdown action been added ?
64
-	* 	@access	private
65
-    *	@var boolean
66
-	*/
63
+	 * 	has shutdown action been added ?
64
+	 * 	@access	private
65
+	 *	@var boolean
66
+	 */
67 67
 	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
68 68
 
69 69
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 	/**
74
-	*	@override default exception handling
75
-	*	@access public
76
-	*	@echo string
77
-	*/
74
+	 *	@override default exception handling
75
+	 *	@access public
76
+	 *	@echo string
77
+	 */
78 78
 	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79 79
 		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80 80
 			parent::__construct( $message, $code );
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 	/**
176
-	*	fatal_error_handler
177
-	*	@access public
178
-	*	@return void
179
-	*/
176
+	 *	fatal_error_handler
177
+	 *	@access public
178
+	 *	@return void
179
+	 */
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182 182
 		if ( $last_error['type'] === E_ERROR ) {
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 
222 222
 
223 223
 	/**
224
-	*	_add_actions
225
-	*	@access public
226
-	*	@return void
227
-	*/
228
-    public function get_error() {
224
+	 *	_add_actions
225
+	 *	@access public
226
+	 *	@return void
227
+	 */
228
+	public function get_error() {
229 229
 
230 230
 		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
231 231
 			throw $this;
@@ -255,22 +255,22 @@  discard block
 block discarded – undo
255 255
 
256 256
 
257 257
 	/**
258
-	*	has_error
259
-	*	@access public
260
-	*	@return boolean
261
-	*/
262
-    public static function has_error(){
258
+	 *	has_error
259
+	 *	@access public
260
+	 *	@return boolean
261
+	 */
262
+	public static function has_error(){
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
266 266
 
267 267
 
268 268
 	/**
269
-	*	display_errors
270
-	*	@access public
271
-	*	@echo string
272
-	*/
273
-    public function display_errors(){
269
+	 *	display_errors
270
+	 *	@access public
271
+	 *	@echo string
272
+	 */
273
+	public function display_errors(){
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			// process trace info
343 343
 			if ( empty( $ex['trace'] )) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+				$trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
346 346
 
347 347
 			} else {
348 348
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395 395
 					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
396 396
 
397
-		              $trace_details .= '
397
+					  $trace_details .= '
398 398
 					<tr>
399 399
 						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400 400
 						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 				}
408 408
 
409
-	            $trace_details .= '
409
+				$trace_details .= '
410 410
 			 </table>
411 411
 			</div>';
412 412
 
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
 	/**
489
-	*	generate string from exception trace args
490
-	*
491
-	*	@access private
492
-	*	@ param array $arguments
493
-	*	@ return string
494
-	*/
489
+	 *	generate string from exception trace args
490
+	 *
491
+	 *	@access private
492
+	 *	@ param array $arguments
493
+	 *	@ return string
494
+	 */
495 495
 	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
496 496
 
497 497
 		$arg_string = '';
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 
536 536
 
537 537
 	/**
538
-	* 	add error message
539
-	*
540
-	*	@access public
541
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
-	* 	@return 		void
546
-	*/
538
+	 * 	add error message
539
+	 *
540
+	 *	@access public
541
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
+	 * 	@return 		void
546
+	 */
547 547
 	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548 548
 		self::_add_notice ( 'errors', $msg, $file, $func, $line );
549 549
 	}
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
 
554 554
 
555 555
 	/**
556
-	* 	add success message
557
-	*
558
-	*	@access public
559
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
560
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
561
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
562
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
563
-	* 	@return 		void
564
-	*/
556
+	 * 	add success message
557
+	 *
558
+	 *	@access public
559
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
560
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
561
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
562
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
563
+	 * 	@return 		void
564
+	 */
565 565
 	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
566 566
 		self::_add_notice ( 'success', $msg, $file, $func, $line );
567 567
 	}
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 
572 572
 
573 573
 	/**
574
-	* 	add attention message
575
-	*
576
-	*	@access public
577
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
578
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
579
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
580
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
581
-	* 	@return 		void
582
-	*/
574
+	 * 	add attention message
575
+	 *
576
+	 *	@access public
577
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
578
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
579
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
580
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
581
+	 * 	@return 		void
582
+	 */
583 583
 	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
584 584
 		self::_add_notice ( 'attention', $msg, $file, $func, $line );
585 585
 	}
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 
590 590
 
591 591
 	/**
592
-	* 	add success message
593
-	*
594
-	*	@access public
595
-	* 	@param		string		$type	whether the message is for a success or error notification
596
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
597
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
598
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
599
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
600
-	* 	@return 		void
601
-	*/
592
+	 * 	add success message
593
+	 *
594
+	 *	@access public
595
+	 * 	@param		string		$type	whether the message is for a success or error notification
596
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
597
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
598
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
599
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
600
+	 * 	@return 		void
601
+	 */
602 602
 	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
603 603
 		if ( empty( $msg )) {
604 604
 			EE_Error::doing_it_wrong(
@@ -641,11 +641,11 @@  discard block
 block discarded – undo
641 641
 
642 642
 
643 643
 	/**
644
-	* 	in some case it may be necessary to overwrite the existing success messages
645
-	*
646
-	*	@access public
647
-	* 	@return 		void
648
-	*/
644
+	 * 	in some case it may be necessary to overwrite the existing success messages
645
+	 *
646
+	 *	@access public
647
+	 * 	@return 		void
648
+	 */
649 649
 	public static function overwrite_success() {
650 650
 		self::$_espresso_notices['success'] = FALSE;
651 651
 	}
@@ -655,11 +655,11 @@  discard block
 block discarded – undo
655 655
 
656 656
 
657 657
 	/**
658
-	* 	in some case it may be necessary to overwrite the existing attention messages
659
-	*
660
-	*	@access public
661
-	* 	@return 		void
662
-	*/
658
+	 * 	in some case it may be necessary to overwrite the existing attention messages
659
+	 *
660
+	 *	@access public
661
+	 * 	@return 		void
662
+	 */
663 663
 	public static function overwrite_attention() {
664 664
 		self::$_espresso_notices['attention'] = FALSE;
665 665
 	}
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 
670 670
 
671 671
 	/**
672
-	* 	in some case it may be necessary to overwrite the existing error messages
673
-	*
674
-	*	@access public
675
-	* 	@return 		void
676
-	*/
672
+	 * 	in some case it may be necessary to overwrite the existing error messages
673
+	 *
674
+	 *	@access public
675
+	 * 	@return 		void
676
+	 */
677 677
 	public static function overwrite_errors() {
678 678
 		self::$_espresso_notices['errors'] = FALSE;
679 679
 	}
@@ -681,24 +681,24 @@  discard block
 block discarded – undo
681 681
 
682 682
 
683 683
 	/**
684
-	*	reset_notices
685
-	*	@access private
686
-	*	@return void
687
-	*/
684
+	 *	reset_notices
685
+	 *	@access private
686
+	 *	@return void
687
+	 */
688 688
 	public static function reset_notices(){
689
-    	self::$_espresso_notices['success'] = FALSE;
690
-    	self::$_espresso_notices['attention'] = FALSE;
691
-    	self::$_espresso_notices['errors'] = FALSE;
692
-    }
689
+		self::$_espresso_notices['success'] = FALSE;
690
+		self::$_espresso_notices['attention'] = FALSE;
691
+		self::$_espresso_notices['errors'] = FALSE;
692
+	}
693 693
 
694 694
 
695 695
 
696 696
 	/**
697
-	*	has_errors
698
-	*	@access public
699
-	*	@return int
700
-	*/
701
-    public static function has_notices(){
697
+	 *	has_errors
698
+	 *	@access public
699
+	 *	@return int
700
+	 */
701
+	public static function has_notices(){
702 702
 		$has_notices = 0;
703 703
 		// check for success messages
704 704
 		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
 
713 713
 
714 714
 	/**
715
-	* 	compile all error or success messages into one string
716
-	*
717
-	*	@access public
718
-	* 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
719
-	* 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
720
-	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
721
-	* 	@return 		array
722
-	*/
715
+	 * 	compile all error or success messages into one string
716
+	 *
717
+	 *	@access public
718
+	 * 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
719
+	 * 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
720
+	 * 	@param		boolean		$remove_empty		whether or not to unset empty messages
721
+	 * 	@return 		array
722
+	 */
723 723
 	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
724 724
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
725 725
 
@@ -831,14 +831,14 @@  discard block
 block discarded – undo
831 831
 
832 832
 
833 833
 	/**
834
-	* 	add_persistent_admin_notice
835
-	*
836
-	*	@access 	public
837
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
838
-	* 	@param		string	$pan_message	the message to be stored persistently until dismissed
839
-	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840
-	* 	@return 		void
841
-	*/
834
+	 * 	add_persistent_admin_notice
835
+	 *
836
+	 *	@access 	public
837
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
838
+	 * 	@param		string	$pan_message	the message to be stored persistently until dismissed
839
+	 * 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
840
+	 * 	@return 		void
841
+	 */
842 842
 	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
843 843
 		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
844 844
 			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
@@ -902,9 +902,9 @@  discard block
 block discarded – undo
902 902
 	 * 	display_persistent_admin_notices
903 903
 	 *
904 904
 	 *  	@access 	public
905
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
906
-	* 	@param		string	$pan_name	the message to be stored persistently until dismissed
907
-	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
905
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
906
+	 * 	@param		string	$pan_name	the message to be stored persistently until dismissed
907
+	 * 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
908 908
 	 *  	@return 		string
909 909
 	 */
910 910
 	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
@@ -993,11 +993,11 @@  discard block
 block discarded – undo
993 993
 
994 994
 
995 995
 	/**
996
-	* 	enqueue_error_scripts
997
-	*
998
-	*	@access public
999
-	* 	@return 		void
1000
-	*/
996
+	 * 	enqueue_error_scripts
997
+	 *
998
+	 *	@access public
999
+	 * 	@return 		void
1000
+	 */
1001 1001
 	public static function enqueue_error_scripts() {
1002 1002
 		self::_print_scripts();
1003 1003
 	}
@@ -1005,15 +1005,15 @@  discard block
 block discarded – undo
1005 1005
 
1006 1006
 
1007 1007
 	/**
1008
-	*	create error code from filepath, function name,
1009
-	*	and line number where exception or error was thrown
1010
-	*
1011
-	*	@access public
1012
-	*	@ param string $file
1013
-	*	@ param string $func
1014
-	*	@ param string $line
1015
-	*	@ return string
1016
-	*/
1008
+	 *	create error code from filepath, function name,
1009
+	 *	and line number where exception or error was thrown
1010
+	 *
1011
+	 *	@access public
1012
+	 *	@ param string $file
1013
+	 *	@ param string $func
1014
+	 *	@ param string $line
1015
+	 *	@ return string
1016
+	 */
1017 1017
 	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1018 1018
 		$file = explode( '.', basename( $file ));
1019 1019
 		$error_code = ! empty( $file[0] ) ? $file[0] : '';
@@ -1027,13 +1027,13 @@  discard block
 block discarded – undo
1027 1027
 
1028 1028
 
1029 1029
 	/**
1030
-	*	write exception details to log file
1031
-	*
1032
-	*	@access public
1033
-	*	@ param timestamp $time
1034
-	*	@ param object $ex
1035
-	*	@ return void
1036
-	*/
1030
+	 *	write exception details to log file
1031
+	 *
1032
+	 *	@access public
1033
+	 *	@ param timestamp $time
1034
+	 *	@ param object $ex
1035
+	 *	@ return void
1036
+	 */
1037 1037
 	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1038 1038
 
1039 1039
 		if ( ! $ex ) {
Please login to merge, or discard this patch.
core/EE_Maintenance_Mode.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
 	 *   returns TRUE if M-Mode is engaged and the current request is not for the admin
185 185
 	 *
186 186
 	 * @access    public
187
-	 * @return    string
187
+	 * @return    boolean
188 188
 	 */
189 189
 	public static function disable_frontend_for_maintenance() {
190 190
 		return ! is_admin() && EE_Maintenance_Mode::instance()->level() ? TRUE : FALSE;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
 	 */
49 49
 	const option_name_maintenance_mode = 'ee_maintenance_mode';
50 50
    /**
51
-     * 	EE_Maintenance_Mode Object
52
-     * 	@var EE_Maintenance_Mode $_instance
53
-	 * 	@access 	private
54
-     */
51
+    * 	EE_Maintenance_Mode Object
52
+    * 	@var EE_Maintenance_Mode $_instance
53
+    * 	@access 	private
54
+    */
55 55
 	private static $_instance = NULL;
56 56
 
57 57
 	/**
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function instance() {
75 75
 		// check if class object is instantiated
76
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) {
76
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) {
77 77
 			self::$_instance = new self();
78 78
 		}
79 79
 		return self::$_instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode)
84 84
 	 * @return EE_Maintenance_Mode
85 85
 	 */
86
-	public static function reset(){
86
+	public static function reset() {
87 87
 		self::instance()->set_maintenance_mode_if_db_old();
88 88
 		return self::instance();
89 89
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	private function __construct() {
100 100
 		// if M-Mode level 2 is engaged, we still need basic assets loaded
101
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' ));
101
+		add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode'));
102 102
 		// shut 'er down down for maintenance ?
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 999 );
103
+		add_filter('the_content', array($this, 'the_content'), 999);
104 104
 		// add powered by EE msg
105
-		add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 );
105
+		add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * retrieves the maintenance mode option value from the db
113 113
 	 * @return int
114 114
 	 */
115
-	public function real_level(){
116
-		return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance );
115
+	public function real_level() {
116
+		return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * thinks their tables are present and up-to-date).
122 122
 	 * @return boolean
123 123
 	 */
124
-	public function models_can_query(){
124
+	public function models_can_query() {
125 125
 		return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance;
126 126
 	}
127 127
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode
135 135
 	 * @return int
136 136
 	 */
137
-	public function level(){
137
+	public function level() {
138 138
 		$real_maintenance_mode_level = $this->real_level();
139 139
 		//if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend
140
-		if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
140
+		if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
141 141
 			current_user_can('administrator') && //when the user is an admin
142
-			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
142
+			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else {
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	 * Determines if we need to put EE in maintenance mode because the database needs updating
152 152
 	 * @return boolean true if DB is old and maintenance mode was triggered; false otherwise
153 153
 	 */
154
-	public function set_maintenance_mode_if_db_old(){
155
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
156
-		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
154
+	public function set_maintenance_mode_if_db_old() {
155
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
156
+		if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		}elseif ($this->level() == self::level_2_complete_maintenance) {
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162
-			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
162
+			update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance);
163 163
 			return false;
164
-		}else{
164
+		} else {
165 165
 			return false;
166 166
 		}
167 167
 	}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param int $level
172 172
 	 * @return void
173 173
 	 */
174
-	public function set_maintenance_level($level){
175
-		do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level );
174
+	public function set_maintenance_level($level) {
175
+		do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level);
176 176
 		update_option(self::option_name_maintenance_mode, intval($level));
177 177
 	}
178 178
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *  @return 	string
200 200
 	 */
201 201
 	public function load_assets_required_for_m_mode() {
202
-		if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) {
203
-			wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
202
+		if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) {
203
+			wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
204 204
 			wp_enqueue_style('espresso_default');
205
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
206
-			wp_enqueue_script( 'espresso_core' );
205
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
206
+			wp_enqueue_script('espresso_core');
207 207
 		}
208 208
 	}
209 209
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param    string $template_path
219 219
 	 * @return    string
220 220
 	 */
221
-	public static function template_include( $template_path ) {
222
-		EE_Registry::instance()->load_helper( 'Template' );
223
-		$template_located = EEH_Template::locate_template( EE_TEMPLATES . 'maintenance_mode.template.php', FALSE, FALSE );
221
+	public static function template_include($template_path) {
222
+		EE_Registry::instance()->load_helper('Template');
223
+		$template_located = EEH_Template::locate_template(EE_TEMPLATES.'maintenance_mode.template.php', FALSE, FALSE);
224 224
 		return $template_located ? $template_located : $template_path;
225 225
 	}
226 226
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param    string $the_content
236 236
 	 * @return    string
237 237
 	 */
238
-	public function the_content( $the_content ) {
238
+	public function the_content($the_content) {
239 239
 		// check if M-mode is engaged and for EE shortcode
240
-		if ( $this->level() && strpos( $the_content, '[ESPRESSO_' )) {
240
+		if ($this->level() && strpos($the_content, '[ESPRESSO_')) {
241 241
 			// this can eventually be moved to a template, or edited via admin. But for now...
242 242
 			$the_content = sprintf(
243
-				__( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ),
243
+				__('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'),
244 244
 				'<h2>',
245 245
 				'</h2><p>',
246 246
 				'</p>'
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
 		// check if M-mode is engaged and for EE shortcode
265 265
 		if (
266 266
 			$this->real_level() &&
267
-			current_user_can( 'administrator' ) &&
267
+			current_user_can('administrator') &&
268 268
 			! is_admin() &&
269
-			! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
269
+			! (defined('DOING_AJAX') && DOING_AJAX)
270 270
 			&& EE_Registry::instance()->REQ->is_espresso_page()
271 271
 		) {
272 272
 			$admin_bar_adjustment = is_admin_bar_showing() ? ' style="top:32px;"' : '';
273 273
 			printf(
274
-				__( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ),
275
-				'<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"' . $admin_bar_adjustment . '><a class="close-espresso-notice" title="',
274
+				__('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'),
275
+				'<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"'.$admin_bar_adjustment.'><a class="close-espresso-notice" title="',
276 276
 				'">&times;</a><p>',
277
-				' &raquo; <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">',
277
+				' &raquo; <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">',
278 278
 				'</a></p></div>'
279 279
 			);
280 280
 		}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 	 *		@ return void
293 293
 	 */
294 294
 	final function __destruct() {}
295
-	final function __call($a,$b) {}
295
+	final function __call($a, $b) {}
296 296
 	final function __get($a) {}
297
-	final function __set($a,$b) {}
297
+	final function __set($a, $b) {}
298 298
 	final function __isset($a) {}
299 299
 	final function __unset($a) {}
300 300
 	final function __sleep() {
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	final function __invoke() {}
306 306
 	final function __set_state() {}
307 307
 	final function __clone() {}
308
-	final static function __callStatic($a,$b) {}
308
+	final static function __callStatic($a, $b) {}
309 309
 
310 310
 }
311 311
 // End of file EE_Maintenance_Mode.core.php
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			current_user_can('administrator') && //when the user is an admin
142 142
 			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else{
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		} elseif( $this->level() == self::level_2_complete_maintenance ){
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162 162
 			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
163 163
 			return false;
164
-		}else{
164
+		} else{
165 165
 			return false;
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
core/EE_Registry.core.php 4 patches
Doc Comments   +10 added lines, -9 removed lines patch added patch discarded remove patch
@@ -214,6 +214,7 @@  discard block
 block discarded – undo
214 214
 
215 215
 	/**
216 216
 	 * @param mixed string | EED_Module $module
217
+	 * @param boolean|string $module
217 218
 	 */
218 219
 	public function add_module( $module ) {
219 220
 		if ( $module instanceof EED_Module ) {
@@ -245,7 +246,7 @@  discard block
 block discarded – undo
245 246
 	 * @param string $class_name - simple class name ie: session
246 247
 	 * @param mixed  $arguments
247 248
 	 * @param bool   $load_only
248
-	 * @return mixed
249
+	 * @return boolean
249 250
 	 */
250 251
 	public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) {
251 252
 		$core_paths = apply_filters(
@@ -269,7 +270,7 @@  discard block
 block discarded – undo
269 270
 	 * @access    public
270 271
 	 * @param string $class_name - class name for the DMS ie: EE_DMS_Core_4_2_0
271 272
 	 * @param mixed  $arguments
272
-	 * @return EE_Data_Migration_Script_Base
273
+	 * @return boolean
273 274
 	 */
274 275
 	public function load_dms ( $class_name, $arguments = array() ) {
275 276
 		// retrieve instantiated class
@@ -286,7 +287,7 @@  discard block
 block discarded – undo
286 287
 	 *	@param bool   $from_db    - some classes are instantiated from the db and thus call a different method to instantiate
287 288
 	 *	@param bool   $cache      if you don't want the class to be stored in the internal cache (non-persistent) then set this to FALSE (ie. when instantiating model objects from client in a loop)
288 289
 	 *	@param bool   $load_only      whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
289
-	 *	@return EE_Base_Class
290
+	 *	@return boolean
290 291
 	 */
291 292
 	public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
292 293
 		$paths = apply_filters('FHEE__EE_Registry__load_class__paths',array(
@@ -307,7 +308,7 @@  discard block
 block discarded – undo
307 308
 	 * @param string $class_name - simple class name ie: price
308 309
 	 * @param mixed  $arguments
309 310
 	 * @param bool   $load_only
310
-	 * @return EEH_Base
311
+	 * @return boolean
311 312
 	 */
312 313
 	public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) {
313 314
 		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) );
@@ -324,7 +325,7 @@  discard block
 block discarded – undo
324 325
 	 * @param string $class_name - simple class name ie: session
325 326
 	 * @param mixed  $arguments
326 327
 	 * @param bool   $load_only
327
-	 * @return mixed
328
+	 * @return boolean
328 329
 	 */
329 330
 	public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) {
330 331
 		$paths = array(
@@ -346,7 +347,7 @@  discard block
 block discarded – undo
346 347
 	 * @param string $class_name - simple class name ie: price
347 348
 	 * @param mixed  $arguments
348 349
 	 * @param bool   $load_only
349
-	 * @return EEM_Base
350
+	 * @return boolean
350 351
 	 */
351 352
 	public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) {
352 353
 		$paths = apply_filters('FHEE__EE_Registry__load_model__paths',array(
@@ -365,7 +366,7 @@  discard block
 block discarded – undo
365 366
 	 * @param string $class_name - simple class name ie: price
366 367
 	 * @param mixed  $arguments
367 368
 	 * @param bool   $load_only
368
-	 * @return mixed
369
+	 * @return boolean
369 370
 	 */
370 371
 	public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) {
371 372
 		$paths = array(
@@ -401,7 +402,7 @@  discard block
 block discarded – undo
401 402
 	 * @param string $type         - file type - core? class? helper? model?
402 403
 	 * @param mixed  $arguments
403 404
 	 * @param bool   $load_only
404
-	 * @return mixed
405
+	 * @return boolean
405 406
 	 */
406 407
 	public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) {
407 408
 		// retrieve instantiated class
@@ -418,7 +419,7 @@  discard block
 block discarded – undo
418 419
 	 * @param string $type         - file type - core? class? helper? model?
419 420
 	 * @param mixed  $arguments
420 421
 	 * @param bool   $load_only
421
-	 * @return EE_Addon
422
+	 * @return boolean
422 423
 	 */
423 424
 	public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) {
424 425
 		// retrieve instantiated class
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	public static function instance() {
171 171
 		// check if class object is instantiated
172
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Registry )) {
172
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Registry)) {
173 173
 			self::$_instance = new self();
174 174
 		}
175 175
 		return self::$_instance;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 	 * @return \EE_Registry
185 185
 	 */
186 186
 	private function __construct() {
187
-		$this->load_core( 'Base' );
187
+		$this->load_core('Base');
188 188
 		// class library
189 189
 		$this->LIB = new StdClass();
190 190
 		$this->addons = new StdClass();
191 191
 		$this->modules = new StdClass();
192 192
 		$this->shortcodes = new StdClass();
193 193
 		$this->widgets = new StdClass();
194
-		add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'init' ));
194
+		add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'init'));
195 195
 	}
196 196
 
197 197
 
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function init() {
206 206
 		// Get current page protocol
207
-		$protocol = isset( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
207
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
208 208
 		// Output admin-ajax.php URL with same protocol as current page
209
-		self::$i18n_js_strings['ajax_url'] = admin_url( 'admin-ajax.php', $protocol );
210
-		self::$i18n_js_strings['wp_debug'] = defined( 'WP_DEBUG' ) ? WP_DEBUG : FALSE;
209
+		self::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php', $protocol);
210
+		self::$i18n_js_strings['wp_debug'] = defined('WP_DEBUG') ? WP_DEBUG : FALSE;
211 211
 	}
212 212
 
213 213
 
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	/**
216 216
 	 * @param mixed string | EED_Module $module
217 217
 	 */
218
-	public function add_module( $module ) {
219
-		if ( $module instanceof EED_Module ) {
220
-			$module_class = get_class( $module );
218
+	public function add_module($module) {
219
+		if ($module instanceof EED_Module) {
220
+			$module_class = get_class($module);
221 221
 			$this->modules->{$module_class} = $module;
222 222
 		} else {
223
-			if ( ! class_exists( 'EE_Module_Request_Router' )) {
224
-				$this->load_core( 'Module_Request_Router' );
223
+			if ( ! class_exists('EE_Module_Request_Router')) {
224
+				$this->load_core('Module_Request_Router');
225 225
 			}
226
-			$this->modules->{$module} = EE_Module_Request_Router::module_factory( $module );
226
+			$this->modules->{$module} = EE_Module_Request_Router::module_factory($module);
227 227
 		}
228 228
 	}
229 229
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param string $module_name
234 234
 	 * @return mixed EED_Module | NULL
235 235
 	 */
236
-	public function get_module( $module_name = '' ) {
237
-		return isset( $this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL;
236
+	public function get_module($module_name = '') {
237
+		return isset($this->modules->{$module_name} ) ? $this->modules->{$module_name} : NULL;
238 238
 	}
239 239
 
240 240
 
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
 	 * @param bool   $load_only
248 248
 	 * @return mixed
249 249
 	 */
250
-	public function load_core ( $class_name, $arguments = array(), $load_only = FALSE ) {
250
+	public function load_core($class_name, $arguments = array(), $load_only = FALSE) {
251 251
 		$core_paths = apply_filters(
252 252
 			'FHEE__EE_Registry__load_core__core_paths',
253 253
 			array(
254 254
 				EE_CORE,
255 255
 				EE_ADMIN,
256 256
 				EE_CPTS,
257
-				EE_CORE . 'data_migration_scripts' . DS
257
+				EE_CORE.'data_migration_scripts'.DS
258 258
 			)
259 259
 		);
260 260
 		// retrieve instantiated class
261
-		return $this->_load( $core_paths, 'EE_' , $class_name, 'core', $arguments, FALSE, TRUE, $load_only );
261
+		return $this->_load($core_paths, 'EE_', $class_name, 'core', $arguments, FALSE, TRUE, $load_only);
262 262
 	}
263 263
 
264 264
 
@@ -271,9 +271,9 @@  discard block
 block discarded – undo
271 271
 	 * @param mixed  $arguments
272 272
 	 * @return EE_Data_Migration_Script_Base
273 273
 	 */
274
-	public function load_dms ( $class_name, $arguments = array() ) {
274
+	public function load_dms($class_name, $arguments = array()) {
275 275
 		// retrieve instantiated class
276
-		return $this->_load( EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_' , $class_name, 'dms', $arguments, FALSE, FALSE, FALSE );
276
+		return $this->_load(EE_Data_Migration_Manager::instance()->get_data_migration_script_folders(), 'EE_DMS_', $class_name, 'dms', $arguments, FALSE, FALSE, FALSE);
277 277
 	}
278 278
 
279 279
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 *	@param bool   $load_only      whether or not to just load the file and NOT instantiate, or load AND instantiate (default)
289 289
 	 *	@return EE_Base_Class
290 290
 	 */
291
-	public function load_class ( $class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
292
-		$paths = apply_filters('FHEE__EE_Registry__load_class__paths',array(
291
+	public function load_class($class_name, $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) {
292
+		$paths = apply_filters('FHEE__EE_Registry__load_class__paths', array(
293 293
 			EE_CORE,
294 294
 			EE_CLASSES,
295 295
 			EE_BUSINESS
296 296
 		));
297 297
 		// retrieve instantiated class
298
-		return $this->_load( $paths, 'EE_' , $class_name, 'class', $arguments, $from_db, $cache, $load_only );
298
+		return $this->_load($paths, 'EE_', $class_name, 'class', $arguments, $from_db, $cache, $load_only);
299 299
 	}
300 300
 
301 301
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 	 * @param bool   $load_only
310 310
 	 * @return EEH_Base
311 311
 	 */
312
-	public function load_helper ( $class_name, $arguments = array(), $load_only = TRUE ) {
313
-		$helper_paths = apply_filters( 'FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS ) );
312
+	public function load_helper($class_name, $arguments = array(), $load_only = TRUE) {
313
+		$helper_paths = apply_filters('FHEE__EE_Registry__load_helper__helper_paths', array(EE_HELPERS));
314 314
 		// retrieve instantiated class
315
-		return $this->_load( $helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only );
315
+		return $this->_load($helper_paths, 'EEH_', $class_name, 'helper', $arguments, FALSE, TRUE, $load_only);
316 316
 	}
317 317
 
318 318
 
@@ -326,16 +326,16 @@  discard block
 block discarded – undo
326 326
 	 * @param bool   $load_only
327 327
 	 * @return mixed
328 328
 	 */
329
-	public function load_lib ( $class_name, $arguments = array(), $load_only = FALSE ) {
329
+	public function load_lib($class_name, $arguments = array(), $load_only = FALSE) {
330 330
 		$paths = array(
331 331
 			EE_LIBRARIES,
332
-			EE_LIBRARIES . 'messages' . DS,
333
-			EE_LIBRARIES . 'shortcodes' . DS,
334
-			EE_LIBRARIES . 'qtips' . DS,
335
-			EE_LIBRARIES . 'payment_methods' . DS,
332
+			EE_LIBRARIES.'messages'.DS,
333
+			EE_LIBRARIES.'shortcodes'.DS,
334
+			EE_LIBRARIES.'qtips'.DS,
335
+			EE_LIBRARIES.'payment_methods'.DS,
336 336
 		);
337 337
 		// retrieve instantiated class
338
-		return $this->_load( $paths, 'EE_' , $class_name, 'lib', $arguments, FALSE, TRUE, $load_only );
338
+		return $this->_load($paths, 'EE_', $class_name, 'lib', $arguments, FALSE, TRUE, $load_only);
339 339
 	}
340 340
 
341 341
 
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 	 * @param bool   $load_only
349 349
 	 * @return EEM_Base
350 350
 	 */
351
-	public function load_model ( $class_name, $arguments = array(), $load_only = FALSE ) {
352
-		$paths = apply_filters('FHEE__EE_Registry__load_model__paths',array(
351
+	public function load_model($class_name, $arguments = array(), $load_only = FALSE) {
352
+		$paths = apply_filters('FHEE__EE_Registry__load_model__paths', array(
353 353
 			EE_MODELS,
354 354
 			EE_CORE
355 355
 		));
356 356
 		// retrieve instantiated class
357
-		return $this->_load( $paths, 'EEM_' , $class_name, 'model', $arguments, FALSE, TRUE, $load_only );
357
+		return $this->_load($paths, 'EEM_', $class_name, 'model', $arguments, FALSE, TRUE, $load_only);
358 358
 	}
359 359
 
360 360
 
@@ -367,15 +367,15 @@  discard block
 block discarded – undo
367 367
 	 * @param bool   $load_only
368 368
 	 * @return mixed
369 369
 	 */
370
-	public function load_model_class ( $class_name, $arguments = array(), $load_only = TRUE ) {
370
+	public function load_model_class($class_name, $arguments = array(), $load_only = TRUE) {
371 371
 		$paths = array(
372
-			EE_MODELS . 'fields' . DS,
373
-			EE_MODELS . 'helpers' . DS,
374
-			EE_MODELS . 'relations' . DS,
375
-			EE_MODELS . 'strategies' . DS
372
+			EE_MODELS.'fields'.DS,
373
+			EE_MODELS.'helpers'.DS,
374
+			EE_MODELS.'relations'.DS,
375
+			EE_MODELS.'strategies'.DS
376 376
 		);
377 377
 		// retrieve instantiated class
378
-		return $this->_load( $paths, 'EE_' , $class_name, '', $arguments, FALSE, TRUE, $load_only );
378
+		return $this->_load($paths, 'EE_', $class_name, '', $arguments, FALSE, TRUE, $load_only);
379 379
 	}
380 380
 
381 381
 
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 	 * @param string $model_name like Event, Attendee, Question_Group_Question, etc.
388 388
 	 * @return boolean
389 389
 	 */
390
-	public function is_model_name( $model_name ){
391
-		return isset( $this->models[ $model_name ] ) ? TRUE : FALSE;
390
+	public function is_model_name($model_name) {
391
+		return isset($this->models[$model_name]) ? TRUE : FALSE;
392 392
 	}
393 393
 
394 394
 
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 	 * @param bool   $load_only
404 404
 	 * @return mixed
405 405
 	 */
406
-	public function load_file ( $path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE ) {
406
+	public function load_file($path_to_file, $file_name, $type = '', $arguments = array(), $load_only = TRUE) {
407 407
 		// retrieve instantiated class
408
-		return $this->_load( $path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only );
408
+		return $this->_load($path_to_file, '', $file_name, $type, $arguments, FALSE, TRUE, $load_only);
409 409
 	}
410 410
 
411 411
 
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
 	 * @param bool   $load_only
421 421
 	 * @return EE_Addon
422 422
 	 */
423
-	public function load_addon ( $path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE ) {
423
+	public function load_addon($path_to_file, $class_name, $type = 'class', $arguments = array(), $load_only = FALSE) {
424 424
 		// retrieve instantiated class
425
-		return $this->_load( $path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only );
425
+		return $this->_load($path_to_file, 'addon', $class_name, $type, $arguments, FALSE, TRUE, $load_only);
426 426
 	}
427 427
 
428 428
 
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 	 * @internal param string $file_path - file path including file name
441 441
 	 * @return bool | object
442 442
 	 */
443
-	private function _load ( $file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE ) {
443
+	private function _load($file_paths = array(), $class_prefix = 'EE_', $class_name = FALSE, $type = 'class', $arguments = array(), $from_db = FALSE, $cache = TRUE, $load_only = FALSE) {
444 444
 		// strip php file extension
445
-		$class_name = str_replace( '.php', '', trim( $class_name ));
445
+		$class_name = str_replace('.php', '', trim($class_name));
446 446
 		// does the class have a prefix ?
447
-		if ( ! empty( $class_prefix ) && $class_prefix != 'addon' ) {
447
+		if ( ! empty($class_prefix) && $class_prefix != 'addon') {
448 448
 			// make sure $class_prefix is uppercase
449
-			$class_prefix = strtoupper( trim( $class_prefix ));
449
+			$class_prefix = strtoupper(trim($class_prefix));
450 450
 			// add class prefix ONCE!!!
451
-			$class_name = $class_prefix . str_replace( $class_prefix, '', $class_name );
451
+			$class_name = $class_prefix.str_replace($class_prefix, '', $class_name);
452 452
 		}
453 453
 
454 454
 		$class_abbreviations = array(
@@ -461,56 +461,56 @@  discard block
 block discarded – undo
461 461
 		);
462 462
 
463 463
 		// check if class has already been loaded, and return it if it has been
464
-		if ( isset( $class_abbreviations[ $class_name ] ) && ! is_null( $this->$class_abbreviations[ $class_name ] )) {
465
-			return $this->$class_abbreviations[ $class_name ];
466
-		} else if ( isset ( $this->{$class_name} )) {
464
+		if (isset($class_abbreviations[$class_name]) && ! is_null($this->$class_abbreviations[$class_name])) {
465
+			return $this->$class_abbreviations[$class_name];
466
+		} else if (isset ($this->{$class_name} )) {
467 467
 			return $this->{$class_name};
468
-		} else if ( isset ( $this->LIB->$class_name )) {
468
+		} else if (isset ($this->LIB->$class_name)) {
469 469
 			return $this->LIB->$class_name;
470
-		} else if ( $class_prefix == 'addon' && isset ( $this->addons->$class_name )) {
470
+		} else if ($class_prefix == 'addon' && isset ($this->addons->$class_name)) {
471 471
 			return $this->addons->$class_name;
472 472
 		}
473 473
 
474 474
 		// assume all paths lead nowhere
475 475
 		$path = FALSE;
476 476
 		// make sure $file_paths is an array
477
-		$file_paths = is_array( $file_paths ) ? $file_paths : array( $file_paths );
477
+		$file_paths = is_array($file_paths) ? $file_paths : array($file_paths);
478 478
 		// cycle thru paths
479
-		foreach ( $file_paths as $key => $file_path ) {
479
+		foreach ($file_paths as $key => $file_path) {
480 480
 			// convert all separators to proper DS, if no filepath, then use EE_CLASSES
481
-			$file_path = $file_path ? str_replace( array( '/', '\\' ), DS, $file_path ) : EE_CLASSES;
481
+			$file_path = $file_path ? str_replace(array('/', '\\'), DS, $file_path) : EE_CLASSES;
482 482
 			// prep file type
483
-			$type = ! empty( $type ) ? trim( $type, '.' ) . '.' : '';
483
+			$type = ! empty($type) ? trim($type, '.').'.' : '';
484 484
 			// build full file path
485
-			$file_paths[ $key ] = rtrim( $file_path, DS ) . DS . $class_name . '.' . $type . 'php';
485
+			$file_paths[$key] = rtrim($file_path, DS).DS.$class_name.'.'.$type.'php';
486 486
 			//does the file exist and can be read ?
487
-			if ( is_readable( $file_paths[ $key ] )) {
488
-				$path = $file_paths[ $key ];
487
+			if (is_readable($file_paths[$key])) {
488
+				$path = $file_paths[$key];
489 489
 				break;
490 490
 			}
491 491
 		}
492 492
 		// don't give up! you gotta...
493 493
 		try {
494 494
 			//does the file exist and can it be read ?
495
-			if ( ! $path ) {
495
+			if ( ! $path) {
496 496
 				// so sorry, can't find the file
497
-				throw new EE_Error (
498
-					sprintf (
499
-						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s','event_espresso'),
500
-						trim( $type, '.' ),
497
+				throw new EE_Error(
498
+					sprintf(
499
+						__('The %1$s file %2$s could not be located or is not readable due to file permissions. Please ensure that the following filepath(s) are correct: %3$s', 'event_espresso'),
500
+						trim($type, '.'),
501 501
 						$class_name,
502
-						'<br />' . implode( ',<br />', $file_paths )
502
+						'<br />'.implode(',<br />', $file_paths)
503 503
 					)
504 504
 				);
505 505
 			}
506 506
 			// get the file
507
-			require_once( $path );
507
+			require_once($path);
508 508
 			// if the class isn't already declared somewhere
509
-			if ( class_exists( $class_name, FALSE ) === FALSE ) {
509
+			if (class_exists($class_name, FALSE) === FALSE) {
510 510
 				// so sorry, not a class
511 511
 				throw new EE_Error(
512 512
 					sprintf(
513
-						__('The %s file %s does not appear to contain the %s Class.','event_espresso'),
513
+						__('The %s file %s does not appear to contain the %s Class.', 'event_espresso'),
514 514
 						$type,
515 515
 						$path,
516 516
 						$class_name
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 				);
519 519
 			}
520 520
 
521
-		} catch ( EE_Error $e ) {
521
+		} catch (EE_Error $e) {
522 522
 			$e->get_error();
523 523
 		}
524 524
 
@@ -526,38 +526,38 @@  discard block
 block discarded – undo
526 526
 		// don't give up! you gotta...
527 527
 		try {
528 528
 			// create reflection
529
-			$reflector = new ReflectionClass( $class_name );
529
+			$reflector = new ReflectionClass($class_name);
530 530
 			// instantiate the class and add to the LIB array for tracking
531 531
 			// EE_Base_Classes are instantiated via new_instance by default (models call them via new_instance_from_db)
532
-			if ( $reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only ) {
532
+			if ($reflector->getConstructor() === NULL || $reflector->isAbstract() || $load_only) {
533 533
 //				$instantiation_mode = 0;
534 534
 				// no constructor = static methods only... nothing to instantiate, loading file was enough
535 535
 				return TRUE;
536
-			} else if ( $from_db && method_exists( $class_name, 'new_instance_from_db' ) ) {
536
+			} else if ($from_db && method_exists($class_name, 'new_instance_from_db')) {
537 537
 //				$instantiation_mode = 1;
538
-				$class_obj =  call_user_func_array( array( $class_name, 'new_instance_from_db' ), $arguments );
539
-			} else if ( method_exists( $class_name, 'new_instance' ) ) {
538
+				$class_obj = call_user_func_array(array($class_name, 'new_instance_from_db'), $arguments);
539
+			} else if (method_exists($class_name, 'new_instance')) {
540 540
 //				$instantiation_mode = 2;
541
-				$class_obj =  call_user_func_array( array( $class_name, 'new_instance' ), $arguments );
542
-			} else if ( method_exists( $class_name, 'instance' )) {
541
+				$class_obj = call_user_func_array(array($class_name, 'new_instance'), $arguments);
542
+			} else if (method_exists($class_name, 'instance')) {
543 543
 //				$instantiation_mode = 3;
544
-				$class_obj =  call_user_func_array( array( $class_name, 'instance' ), $arguments );
545
-			} else if ( $reflector->isInstantiable() ) {
544
+				$class_obj = call_user_func_array(array($class_name, 'instance'), $arguments);
545
+			} else if ($reflector->isInstantiable()) {
546 546
 //				$instantiation_mode = 4;
547
-				$class_obj =  $reflector->newInstance( $arguments );
548
-			} else if ( ! $load_only ) {
547
+				$class_obj = $reflector->newInstance($arguments);
548
+			} else if ( ! $load_only) {
549 549
 				// heh ? something's not right !
550 550
 //				$instantiation_mode = 5;
551 551
 				throw new EE_Error(
552 552
 					sprintf(
553
-						__('The %s file %s could not be instantiated.','event_espresso'),
553
+						__('The %s file %s could not be instantiated.', 'event_espresso'),
554 554
 						$type,
555 555
 						$class_name
556 556
 					)
557 557
 				);
558 558
 			}
559 559
 
560
-		} catch ( EE_Error $e ) {
560
+		} catch (EE_Error $e) {
561 561
 			$e->get_error();
562 562
 		}
563 563
 
@@ -569,15 +569,15 @@  discard block
 block discarded – undo
569 569
 //	EEH_Debug_Tools::printr( $class_obj, '$class_obj  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
570 570
 
571 571
 
572
-		if ( isset( $class_obj )) {
572
+		if (isset($class_obj)) {
573 573
 			// return newly instantiated class
574
-			if ( isset( $class_abbreviations[ $class_name ] )) {
575
-				$this->$class_abbreviations[ $class_name ] = $class_obj;
576
-			} else if ( EEH_Class_Tools::has_property( $this, $class_name )) {
574
+			if (isset($class_abbreviations[$class_name])) {
575
+				$this->$class_abbreviations[$class_name] = $class_obj;
576
+			} else if (EEH_Class_Tools::has_property($this, $class_name)) {
577 577
 				$this->{$class_name} = $class_obj;
578
-			} else if ( $class_prefix == 'addon' && $cache  ) {
578
+			} else if ($class_prefix == 'addon' && $cache) {
579 579
 				$this->addons->$class_name = $class_obj;
580
-			} else if ( !$from_db && $cache  ) {
580
+			} else if ( ! $from_db && $cache) {
581 581
 				$this->LIB->$class_name = $class_obj;
582 582
 			}
583 583
 			return $class_obj;
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	 * @param $a
603 603
 	 * @param $b
604 604
 	 */
605
-	final function __call($a,$b) {}
605
+	final function __call($a, $b) {}
606 606
 
607 607
 
608 608
 
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 	 * @param $a
618 618
 	 * @param $b
619 619
 	 */
620
-	final function __set($a,$b) {}
620
+	final function __set($a, $b) {}
621 621
 
622 622
 
623 623
 
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * @param $a
658 658
 	 * @param $b
659 659
 	 */
660
-	final static function __callStatic($a,$b) {}
660
+	final static function __callStatic($a, $b) {}
661 661
 
662 662
 	/**
663 663
 	 * Gets the addon by its name/slug (not classname. For that, just
@@ -665,9 +665,9 @@  discard block
 block discarded – undo
665 665
 	 * @param string $name
666 666
 	 * @return EE_Addon
667 667
 	 */
668
-	public function get_addon_by_name( $name ){
669
-		foreach($this->addons as $addon){
670
-			if( $addon->name() == $name){
668
+	public function get_addon_by_name($name) {
669
+		foreach ($this->addons as $addon) {
670
+			if ($addon->name() == $name) {
671 671
 				return $addon;
672 672
 			}
673 673
 		}
@@ -678,10 +678,10 @@  discard block
 block discarded – undo
678 678
 	 *
679 679
 	 * @return EE_Addon[] where the KEYS are the addon's name()
680 680
 	 */
681
-	public function get_addons_by_name(){
681
+	public function get_addons_by_name() {
682 682
 		$addons = array();
683
-		foreach($this->addons as $addon){
684
-			$addons[ $addon->name() ] = $addon;
683
+		foreach ($this->addons as $addon) {
684
+			$addons[$addon->name()] = $addon;
685 685
 		}
686 686
 		return $addons;
687 687
 	}
@@ -692,14 +692,14 @@  discard block
 block discarded – undo
692 692
 	 * @param string $model_name
693 693
 	 * @return EEM_Base
694 694
 	 */
695
-	public function reset_model( $model_name ){
696
-		$model = $this->load_model( $model_name );
697
-		$model_class_name = get_class( $model );
695
+	public function reset_model($model_name) {
696
+		$model = $this->load_model($model_name);
697
+		$model_class_name = get_class($model);
698 698
 		//get that model reset it and make sure we nuke the old reference to it
699
-		if ( is_callable( array( $model_class_name, 'reset' ))) {
699
+		if (is_callable(array($model_class_name, 'reset'))) {
700 700
 			$this->LIB->$model_class_name = $model::reset();
701
-		}else{
702
-			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
701
+		} else {
702
+			throw new EE_Error(sprintf(__('Model %s does not have a method "reset"', 'event_espresso'), $model_name));
703 703
 		}
704 704
 		return $this->LIB->$model_class_name;
705 705
 	}
@@ -715,15 +715,15 @@  discard block
 block discarded – undo
715 715
 	 * currently reinstantiate the singletons at the moment)
716 716
 	 * @return EE_Registry
717 717
 	 */
718
-	public static function reset( $hard = FALSE, $reinstantiate = TRUE ){
718
+	public static function reset($hard = FALSE, $reinstantiate = TRUE) {
719 719
 		$instance = self::instance();
720 720
 		$instance->load_helper('Activation');
721 721
 		EEH_Activation::reset();
722
-		$instance->CFG = EE_Config::reset( $hard, $reinstantiate );
722
+		$instance->CFG = EE_Config::reset($hard, $reinstantiate);
723 723
 		$instance->LIB->EE_Data_Migration_Manager = EE_Data_Migration_Manager::reset();
724 724
 		$instance->LIB = new stdClass();
725
-		foreach( array_keys( $instance->non_abstract_db_models ) as $model_name ){
726
-			$instance->reset_model( $model_name );
725
+		foreach (array_keys($instance->non_abstract_db_models) as $model_name) {
726
+			$instance->reset_model($model_name);
727 727
 		}
728 728
 		return $instance;
729 729
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -698,7 +698,7 @@
 block discarded – undo
698 698
 		//get that model reset it and make sure we nuke the old reference to it
699 699
 		if ( is_callable( array( $model_class_name, 'reset' ))) {
700 700
 			$this->LIB->$model_class_name = $model::reset();
701
-		}else{
701
+		} else{
702 702
 			throw new EE_Error( sprintf( __( 'Model %s does not have a method "reset"', 'event_espresso' ), $model_name ) );
703 703
 		}
704 704
 		return $this->LIB->$model_class_name;
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,25 +11,25 @@  discard block
 block discarded – undo
11 11
 final class EE_Registry {
12 12
 
13 13
 	/**
14
-	* 	EE_Registry Object
15
-	* 	@var EE_Registry $_instance
16
-	* 	@access 	private
17
-	*/
14
+	 * 	EE_Registry Object
15
+	 * 	@var EE_Registry $_instance
16
+	 * 	@access 	private
17
+	 */
18 18
 	private static $_instance = NULL;
19 19
 
20 20
 
21 21
 	/**
22
-	* 	EE_Cart Object
23
-	* 	@access 	public
24
-	*	@var 	EE_Cart $CART
25
-	*/
22
+	 * 	EE_Cart Object
23
+	 * 	@access 	public
24
+	 *	@var 	EE_Cart $CART
25
+	 */
26 26
 	public $CART = NULL;
27 27
 
28 28
 	/**
29
-	* 	EE_Config Object
30
-	* 	@access 	public
31
-	*	@var 	EE_Config $CFG
32
-	*/
29
+	 * 	EE_Config Object
30
+	 * 	@access 	public
31
+	 *	@var 	EE_Config $CFG
32
+	 */
33 33
 	public $CFG = NULL;
34 34
 
35 35
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 
46 46
 	/**
47
-	* 	StdClass object for storing library classes in
48
-	* 	@public LIB
49
-	*/
47
+	 * 	StdClass object for storing library classes in
48
+	 * 	@public LIB
49
+	 */
50 50
 	public $LIB = NULL;
51 51
 
52 52
 	/**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	public $REQ = NULL;
58 58
 
59 59
 	/**
60
-	* 	EE_Session Object
61
-	* 	@access 	public
62
-	* 	@var 	EE_Session	 $SSN
63
-	*/
60
+	 * 	EE_Session Object
61
+	 * 	@access 	public
62
+	 * 	@var 	EE_Session	 $SSN
63
+	 */
64 64
 	public $SSN = NULL;
65 65
 
66 66
 
@@ -127,21 +127,21 @@  discard block
 block discarded – undo
127 127
 
128 128
 
129 129
 	/**
130
-	* 	$i18n_js_strings - internationalization for JS strings
131
-	*  	usage:   EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' );
132
-	*  	in js file:  var translatedString = eei18n.string_key;
133
-	*
134
-	* 	@access 	public
135
-	*	@var 	array
136
-	*/
130
+	 * 	$i18n_js_strings - internationalization for JS strings
131
+	 *  	usage:   EE_Registry::i18n_js_strings['string_key'] = __( 'string to translate.', 'event_espresso' );
132
+	 *  	in js file:  var translatedString = eei18n.string_key;
133
+	 *
134
+	 * 	@access 	public
135
+	 *	@var 	array
136
+	 */
137 137
 	public static $i18n_js_strings = array();
138 138
 
139 139
 	/**
140
-	* 	$main_file - path to espresso.php
141
-	*
142
-	* 	@access 	public
143
-	*	@var 	array
144
-	*/
140
+	 * 	$main_file - path to espresso.php
141
+	 *
142
+	 * 	@access 	public
143
+	 *	@var 	array
144
+	 */
145 145
 	public $main_file;
146 146
 
147 147
 
Please login to merge, or discard this patch.
core/EE_Request_Handler.core.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *    is_espresso_page
272 272
 	 *
273 273
 	 * @access    public
274
-	 * @param null $value
274
+	 * @param boolean $value
275 275
 	 * @return    mixed
276 276
 	 */
277 277
 	public function set_espresso_page( $value = null ) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *    setter
308 308
 	 *
309 309
 	 * @access    public
310
-	 * @param      $key
310
+	 * @param      string $key
311 311
 	 * @param      $value
312 312
 	 * @param bool $override_ee
313 313
 	 * @return    void
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 *    remove param
353 353
 	 *
354 354
 	 * @access    public
355
-	 * @param $key
355
+	 * @param string $key
356 356
 	 * @return    void
357 357
 	 */
358 358
 	public function un_set( $key ) {
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *    add_output
393 393
 	 *
394 394
 	 * @access    public
395
-	 * @param $string
395
+	 * @param string $string
396 396
 	 * @return    void
397 397
 	 */
398 398
 	public function add_output( $string ) {
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -65,18 +65,18 @@  discard block
 block discarded – undo
65 65
 	 * @param WP_Query $wp
66 66
 	 * @return \EE_Request_Handler
67 67
 	 */
68
-	public function __construct( $wp = null ) {
68
+	public function __construct($wp = null) {
69 69
 		//if somebody forgot to provide us with WP, that's ok because its global
70
-		if( ! $wp){
70
+		if ( ! $wp) {
71 71
 			global $wp;
72 72
 		}
73 73
 		// grab request vars
74 74
 		$this->_params = $_REQUEST;
75 75
 		// AJAX ???
76
-		$this->ajax = defined( 'DOING_AJAX' ) ? true : false;
77
-		$this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false;
78
-		$this->set_request_vars( $wp );
79
-		do_action( 'AHEE__EE_Request_Handler__construct__complete' );
76
+		$this->ajax = defined('DOING_AJAX') ? true : false;
77
+		$this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false;
78
+		$this->set_request_vars($wp);
79
+		do_action('AHEE__EE_Request_Handler__construct__complete');
80 80
 	}
81 81
 
82 82
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 * @param WP_Query $wp
89 89
 	 * @return void
90 90
 	 */
91
-	public function set_request_vars( $wp = null ) {
92
-		if ( ! is_admin() ) {
91
+	public function set_request_vars($wp = null) {
92
+		if ( ! is_admin()) {
93 93
 			// set request post_id
94
-			$this->set( 'post_id', $this->get_post_id_from_request( $wp ));
94
+			$this->set('post_id', $this->get_post_id_from_request($wp));
95 95
 			// set request post name
96
-			$this->set( 'post_name', $this->get_post_name_from_request( $wp ));
96
+			$this->set('post_name', $this->get_post_name_from_request($wp));
97 97
 			// set request post_type
98
-			$this->set( 'post_type', $this->get_post_type_from_request( $wp ));
98
+			$this->set('post_type', $this->get_post_type_from_request($wp));
99 99
 			// true or false ? is this page being used by EE ?
100 100
 			$this->set_espresso_page();
101 101
 		}
@@ -110,20 +110,20 @@  discard block
 block discarded – undo
110 110
 	 * @param WP_Query $wp
111 111
 	 * @return int
112 112
 	 */
113
-	public function get_post_id_from_request( $wp = null ) {
114
-		if( ! $wp){
113
+	public function get_post_id_from_request($wp = null) {
114
+		if ( ! $wp) {
115 115
 			global $wp;
116 116
 		}
117 117
 		$post_id = null;
118
-		if ( isset( $wp->query_vars['p'] )) {
118
+		if (isset($wp->query_vars['p'])) {
119 119
 			$post_id = $wp->query_vars['p'];
120 120
 		}
121
-		if ( ! $post_id && isset( $wp->query_vars['page_id'] )) {
121
+		if ( ! $post_id && isset($wp->query_vars['page_id'])) {
122 122
 			$post_id = $wp->query_vars['page_id'];
123 123
 		}
124
-		if ( ! $post_id && isset( $wp->request )) {
125
-			if ( is_numeric( basename( $wp->request ))) {
126
-				$post_id = basename( $wp->request );
124
+		if ( ! $post_id && isset($wp->request)) {
125
+			if (is_numeric(basename($wp->request))) {
126
+				$post_id = basename($wp->request);
127 127
 			}
128 128
 		}
129 129
 		return $post_id;
@@ -138,35 +138,35 @@  discard block
 block discarded – undo
138 138
 	 * @param WP_Query $wp
139 139
 	 * @return string
140 140
 	 */
141
-	public function get_post_name_from_request( $wp = null ) {
142
-		if( ! $wp){
141
+	public function get_post_name_from_request($wp = null) {
142
+		if ( ! $wp) {
143 143
 			global $wp;
144 144
 		}
145 145
 		$post_name = null;
146
-		if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) {
146
+		if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) {
147 147
 			$post_name = $wp->query_vars['name'];
148 148
 		}
149
-		if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) {
149
+		if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) {
150 150
 			$post_name = $wp->query_vars['pagename'];
151 151
 		}
152
-		if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) {
153
-			$possible_post_name = basename( $wp->request );
154
-			if ( ! is_numeric( $possible_post_name )) {
152
+		if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) {
153
+			$possible_post_name = basename($wp->request);
154
+			if ( ! is_numeric($possible_post_name)) {
155 155
 				/** @type WPDB $wpdb */
156 156
 				global $wpdb;
157
-				$SQL = 'SELECT ID from ' . $wpdb->posts . ' WHERE post_status="publish" AND post_name=%d';
158
-				$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name ));
159
-				if ( $possible_post_name ) {
157
+				$SQL = 'SELECT ID from '.$wpdb->posts.' WHERE post_status="publish" AND post_name=%d';
158
+				$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
159
+				if ($possible_post_name) {
160 160
 					$post_name = $possible_post_name;
161 161
 				}
162 162
 			}
163 163
 		}
164
-		if ( ! $post_name && $this->get( 'post_id' )) {
164
+		if ( ! $post_name && $this->get('post_id')) {
165 165
 			/** @type WPDB $wpdb */
166 166
 			global $wpdb;
167
-			$SQL = 'SELECT post_name from ' . $wpdb->posts . ' WHERE post_status="publish" AND ID=%d';
168
-			$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' )));
169
-			if( $possible_post_name ) {
167
+			$SQL = 'SELECT post_name from '.$wpdb->posts.' WHERE post_status="publish" AND ID=%d';
168
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id')));
169
+			if ($possible_post_name) {
170 170
 				$post_name = $possible_post_name;
171 171
 			}
172 172
 		}
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 	 * @param WP_Query $wp
183 183
 	 * @return mixed
184 184
 	 */
185
-	public function get_post_type_from_request( $wp = null ) {
186
-		if( ! $wp){
185
+	public function get_post_type_from_request($wp = null) {
186
+		if ( ! $wp) {
187 187
 			global $wp;
188 188
 		}
189
-		return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null;
189
+		return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null;
190 190
 	}
191 191
 
192 192
 
@@ -199,41 +199,41 @@  discard block
 block discarded – undo
199 199
 	public function test_for_espresso_page() {
200 200
 		global $wp;
201 201
 		/** @type EE_CPT_Strategy $EE_CPT_Strategy */
202
-		$EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' );
202
+		$EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy');
203 203
 		$espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies();
204
-		if ( is_array( $espresso_CPT_taxonomies ) ) {
205
-			foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) {
206
-				if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) {
204
+		if (is_array($espresso_CPT_taxonomies)) {
205
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) {
206
+				if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) {
207 207
 					return true;
208 208
 				}
209 209
 			}
210 210
 		}
211 211
 		// load espresso CPT endpoints
212 212
 		$espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints();
213
-		$post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints );
214
-		$post_types = (array)$this->get( 'post_type' );
215
-		foreach ( $post_types as $post_type ) {
213
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
214
+		$post_types = (array) $this->get('post_type');
215
+		foreach ($post_types as $post_type) {
216 216
 			// was a post name passed ?
217
-			if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) {
217
+			if (isset($post_type_CPT_endpoints[$post_type])) {
218 218
 				// kk we know this is an espresso page, but is it a specific post ?
219
-				if ( ! $this->get( 'post_name' ) ) {
219
+				if ( ! $this->get('post_name')) {
220 220
 					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
221
-					$post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null;
221
+					$post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null;
222 222
 					// if the post type matches on of our then set the endpoint
223
-					if ( $post_name ) {
224
-						$this->set( 'post_name', $post_name );
223
+					if ($post_name) {
224
+						$this->set('post_name', $post_name);
225 225
 					}
226 226
 				}
227 227
 				return true;
228 228
 			}
229 229
 		}
230
-		if ( $this->get( 'post_name' )) {
230
+		if ($this->get('post_name')) {
231 231
 			// load all pages using espresso shortcodes
232
-			$post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
232
+			$post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
233 233
 			// make sure core pages are included
234
-			$espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes );
234
+			$espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes);
235 235
 			// was a post name passed ?
236
-			if (  isset( $espresso_pages[ $this->get( 'post_name' ) ] )) {
236
+			if (isset($espresso_pages[$this->get('post_name')])) {
237 237
 				 return true;
238 238
 			}
239 239
 		}
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @param null $value
250 250
 	 * @return    mixed
251 251
 	 */
252
-	public function set_espresso_page( $value = null ) {
252
+	public function set_espresso_page($value = null) {
253 253
 		$value = $value ? $value : $this->test_for_espresso_page();
254 254
 		$this->_params['is_espresso_page'] = $value;
255 255
 	}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 *  @return 	mixed
264 264
 	 */
265 265
 	public function is_espresso_page() {
266
-		return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false;
266
+		return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false;
267 267
 	}
268 268
 
269 269
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 * @param bool $override_ee
288 288
 	 * @return    void
289 289
 	 */
290
-	public function set( $key, $value, $override_ee = false ) {
290
+	public function set($key, $value, $override_ee = false) {
291 291
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
292
-		if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) {
293
-			$this->_params[ $key ] = $value;
292
+		if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) {
293
+			$this->_params[$key] = $value;
294 294
 		}
295 295
 	}
296 296
 
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * @param null $default
305 305
 	 * @return    mixed
306 306
 	 */
307
-	public function get( $key, $default = null ) {
308
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
307
+	public function get($key, $default = null) {
308
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
309 309
 	}
310 310
 
311 311
 
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param $key
318 318
 	 * @return    boolean
319 319
 	 */
320
-	public function is_set( $key ) {
321
-		return isset( $this->_params[ $key ] ) ? true : false;
320
+	public function is_set($key) {
321
+		return isset($this->_params[$key]) ? true : false;
322 322
 	}
323 323
 
324 324
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * @param $key
331 331
 	 * @return    void
332 332
 	 */
333
-	public function un_set( $key ) {
334
-		unset( $this->_params[ $key ] );
333
+	public function un_set($key) {
334
+		unset($this->_params[$key]);
335 335
 	}
336 336
 
337 337
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 	 * @param $value
345 345
 	 * @return    void
346 346
 	 */
347
-	public function set_notice( $key, $value ) {
348
-		$this->_notice[ $key ] = $value;
347
+	public function set_notice($key, $value) {
348
+		$this->_notice[$key] = $value;
349 349
 	}
350 350
 
351 351
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	 * @param $key
358 358
 	 * @return    mixed
359 359
 	 */
360
-	public function get_notice( $key ) {
361
-		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null;
360
+	public function get_notice($key) {
361
+		return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
362 362
 	}
363 363
 
364 364
 
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 * @param $string
371 371
 	 * @return    void
372 372
 	 */
373
-	public function add_output( $string ) {
373
+	public function add_output($string) {
374 374
 		$this->_output .= $string;
375 375
 	}
376 376
 
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 	 * @param $item
393 393
 	 * @param $key
394 394
 	 */
395
-	function sanitize_text_field_for_array_walk( &$item, &$key ) {
396
-		$item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item );
395
+	function sanitize_text_field_for_array_walk(&$item, &$key) {
396
+		$item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item);
397 397
 	}
398 398
 
399 399
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 * @param $b
404 404
 	 * @return bool
405 405
 	 */
406
-	public function __set($a,$b) { return false; }
406
+	public function __set($a, $b) { return false; }
407 407
 
408 408
 
409 409
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/EE_Session.core.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 /**
337 337
 	  * retrieve session data
338 338
 	  * @access    public
339
-	  * @param null $key
339
+	  * @param string|null $key
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	  * set session data
361 361
 	  * @access 	public
362 362
 	  * @param 	array $data
363
-	  * @return 	TRUE on success, FALSE on fail
363
+	  * @return 	boolean on success, FALSE on fail
364 364
 	  */
365 365
 	public function set_session_data( $data ) {
366 366
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 /**
391 391
 	  * @initiate session
392 392
 	  * @access   private
393
-	  * @return TRUE on success, FALSE on fail
393
+	  * @return boolean on success, FALSE on fail
394 394
 	  * @throws \EE_Error
395 395
 	  */
396 396
 	private function _espresso_session() {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	  * @update session data  prior to saving to the db
522 522
 	  * @access public
523 523
 	  * @param bool $new_session
524
-	  * @return TRUE on success, FALSE on fail
524
+	  * @return boolean on success, FALSE on fail
525 525
 	  */
526 526
 	public function update( $new_session = FALSE ) {
527 527
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	  * @access public
792 792
 	  * @param array $data_to_reset
793 793
 	  * @param bool  $show_all_notices
794
-	  * @return TRUE on success, FALSE on fail
794
+	  * @return boolean on success, FALSE on fail
795 795
 	  */
796 796
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
797 797
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,11 +137,11 @@
 block discarded – undo
137 137
 
138 138
 
139 139
 	/**
140
-	* 	private constructor to prevent direct creation
141
-	* 	@Constructor
142
-	* 	@access private
143
-	* 	@return EE_Session
144
-	*/
140
+	 * 	private constructor to prevent direct creation
141
+	 * 	@Constructor
142
+	 * 	@access private
143
+	 * 	@return EE_Session
144
+	 */
145 145
 	private function __construct() {
146 146
 
147 147
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, ''); /**
3 3
  *
4 4
  * Event Espresso
5 5
  *
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	  * array for defining default session vars
105 105
 	  * @var array
106 106
 	  */
107
-	 private $_default_session_vars = array (
107
+	 private $_default_session_vars = array(
108 108
 		'id' => NULL,
109 109
 		'user_id' => NULL,
110 110
 		'ip_address' => NULL,
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 *		@access public
127 127
 	 *		@return EE_Session
128 128
 	 */
129
-	public static function instance ( ) {
129
+	public static function instance( ) {
130 130
 		// check if class object is instantiated
131
-		if ( ! self::$_instance instanceof EE_Session ) {
131
+		if ( ! self::$_instance instanceof EE_Session) {
132 132
 			self::$_instance = new self();
133 133
 		}
134 134
 		return self::$_instance;
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 	private function __construct() {
146 146
 
147 147
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
148
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
148
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
149 149
 			return NULL;
150 150
 		}
151
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
152
-		define( 'ESPRESSO_SESSION', TRUE );
151
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
152
+		define('ESPRESSO_SESSION', TRUE);
153 153
 		// default session lifespan in seconds
154 154
 		$this->_lifespan = apply_filters(
155 155
 			'FHEE__EE_Session__construct___lifespan',
@@ -162,35 +162,35 @@  discard block
 block discarded – undo
162 162
 		 * 		}
163 163
 		 */
164 164
 		// retrieve session options from db
165
-		$session_settings = get_option( 'ee_session_settings' );
166
-		if ( $session_settings !== FALSE ) {
165
+		$session_settings = get_option('ee_session_settings');
166
+		if ($session_settings !== FALSE) {
167 167
 			// cycle though existing session options
168
-			foreach ( $session_settings as $var_name => $session_setting ) {
168
+			foreach ($session_settings as $var_name => $session_setting) {
169 169
 				// set values for class properties
170
-				$var_name = '_' . $var_name;
170
+				$var_name = '_'.$var_name;
171 171
 				$this->{$var_name} = $session_setting;
172 172
 			}
173 173
 		}
174 174
 		// are we using encryption?
175
-		if ( $this->_use_encryption ) {
175
+		if ($this->_use_encryption) {
176 176
 			// instantiate the class object making all properties and methods accessible via $this->encryption ex: $this->encryption->encrypt();
177
-			$this->encryption = EE_Registry::instance()->load_core( 'Encryption' );
177
+			$this->encryption = EE_Registry::instance()->load_core('Encryption');
178 178
 		}
179 179
 		// filter hook allows outside functions/classes/plugins to change default empty cart
180
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
181
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
180
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
181
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
182 182
 		// apply default session vars
183 183
 		$this->_set_defaults();
184 184
 		// check for existing session and retrieve it from db
185
-		if ( ! $this->_espresso_session() ) {
185
+		if ( ! $this->_espresso_session()) {
186 186
 			// or just start a new one
187 187
 			$this->_create_espresso_session();
188 188
 		}
189 189
 		// check request for 'clear_session' param
190
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
190
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
191 191
 		// once everything is all said and done,
192
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
193
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
192
+		add_action('shutdown', array($this, 'update'), 100);
193
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
194 194
 
195 195
 	}
196 196
 
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	private function _set_defaults() {
224 224
 		// set some defaults
225
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
226
-			if ( is_array( $default_var )) {
227
-				$this->_session_data[ $key ] = array();
225
+		foreach ($this->_default_session_vars as $key => $default_var) {
226
+			if (is_array($default_var)) {
227
+				$this->_session_data[$key] = array();
228 228
 			} else {
229
-				$this->_session_data[ $key ] = '';
229
+				$this->_session_data[$key] = '';
230 230
 			}
231 231
 		}
232 232
 	}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	  * @param \EE_Cart $cart
249 249
 	  * @return bool
250 250
 	  */
251
-	 public function set_cart( EE_Cart $cart ) {
251
+	 public function set_cart(EE_Cart $cart) {
252 252
 		 $this->_session_data['cart'] = $cart;
253 253
 		 return TRUE;
254 254
 	 }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	  * @return \EE_Cart
269 269
 	  */
270 270
 	 public function cart() {
271
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
271
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
272 272
 	 }
273 273
 
274 274
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	  * @param \EE_Checkout $checkout
278 278
 	  * @return bool
279 279
 	  */
280
-	 public function set_checkout( EE_Checkout $checkout ) {
280
+	 public function set_checkout(EE_Checkout $checkout) {
281 281
 		 $this->_session_data['checkout'] = $checkout;
282 282
 		 return TRUE;
283 283
 	 }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	  * @return \EE_Checkout
298 298
 	  */
299 299
 	 public function checkout() {
300
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
300
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
301 301
 	 }
302 302
 
303 303
 
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	  * @param \EE_Transaction $transaction
307 307
 	  * @return bool
308 308
 	  */
309
-	 public function set_transaction( EE_Transaction $transaction ) {
309
+	 public function set_transaction(EE_Transaction $transaction) {
310 310
 		 // first remove the session from the transaction before we save the transaction in the session
311
-		 $transaction->set_txn_session_data( NULL );
311
+		 $transaction->set_txn_session_data(NULL);
312 312
 		 $this->_session_data['transaction'] = $transaction;
313 313
 		 return TRUE;
314 314
 	 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	  * @return \EE_Transaction
329 329
 	  */
330 330
 	 public function transaction() {
331
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
331
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
332 332
 	 }
333 333
 
334 334
 
@@ -340,16 +340,16 @@  discard block
 block discarded – undo
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
343
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
344
-		if ( $reset_cache ) {
343
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
344
+		if ($reset_cache) {
345 345
 			$this->reset_cart();
346 346
 			$this->reset_checkout();
347 347
 			$this->reset_transaction();
348 348
 		}
349
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350
-		 if ( ! empty( $key ))  {
351
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
349
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
350
+		 if ( ! empty($key)) {
351
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
352
+		} else {
353 353
 			return $this->_session_data;
354 354
 		}
355 355
 	}
@@ -362,22 +362,22 @@  discard block
 block discarded – undo
362 362
 	  * @param 	array $data
363 363
 	  * @return 	TRUE on success, FALSE on fail
364 364
 	  */
365
-	public function set_session_data( $data ) {
365
+	public function set_session_data($data) {
366 366
 
367
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
367
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
368 368
 
369 369
 		// nothing ??? bad data ??? go home!
370
-		if ( empty( $data ) || ! is_array( $data )) {
371
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
370
+		if (empty($data) || ! is_array($data)) {
371
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
372 372
 			return FALSE;
373 373
 		}
374 374
 
375
-		foreach ( $data as $key =>$value ) {
376
-			if ( isset( $this->_default_session_vars[ $key ] )) {
377
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
375
+		foreach ($data as $key =>$value) {
376
+			if (isset($this->_default_session_vars[$key])) {
377
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
378 378
 				return FALSE;
379 379
 			} else {
380
-				$this->_session_data[ $key ] = $value;
380
+				$this->_session_data[$key] = $value;
381 381
 			}
382 382
 		}
383 383
 
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 	  * @throws \EE_Error
395 395
 	  */
396 396
 	private function _espresso_session() {
397
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
397
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
398 398
 		// check that session has started
399
-		if ( session_id() === '' ) {
399
+		if (session_id() === '') {
400 400
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
401 401
 			session_start();
402 402
 		}
@@ -405,42 +405,42 @@  discard block
 block discarded – undo
405 405
 		// and the visitors IP
406 406
 		$this->_ip_address = $this->_visitor_ip();
407 407
 		// set the "user agent"
408
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
408
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
409 409
 		// now let's retrieve what's in the db
410 410
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
411
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
412
-		if ( $session_data ) {
413
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
414
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
415
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
411
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
412
+		if ($session_data) {
413
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
414
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
415
+				if ($hash_check && $hash_check !== md5($session_data)) {
416 416
 					EE_Error::add_error(
417 417
 						sprintf(
418
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
419
-							EE_Session::session_id_prefix . $this->_sid
418
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
419
+							EE_Session::session_id_prefix.$this->_sid
420 420
 						),
421 421
 						__FILE__, __FUNCTION__, __LINE__
422 422
 					);
423 423
 				}
424 424
 			}
425 425
 			// un-encrypt the data
426
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
426
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
427 427
 			// unserialize
428
-			$session_data = maybe_unserialize( $session_data );
428
+			$session_data = maybe_unserialize($session_data);
429 429
 			// just a check to make sure the session array is indeed an array
430
-			if ( ! is_array( $session_data ) ) {
430
+			if ( ! is_array($session_data)) {
431 431
 				// no?!?! then something is wrong
432 432
 				return FALSE;
433 433
 			}
434 434
 			// get the current time in UTC
435
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
435
+			$this->_time = isset($this->_time) ? $this->_time : time();
436 436
 			// and reset the session expiration
437
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
437
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
438 438
 
439 439
 		} else {
440 440
 			// set initial site access time and the session expiration
441 441
 			$this->_set_init_access_and_expiration();
442 442
 			// set referer
443
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
443
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
444 444
 			// no previous session = go back and create one (on top of the data above)
445 445
 			return FALSE;
446 446
 		}
@@ -448,21 +448,21 @@  discard block
 block discarded – undo
448 448
 		// have we met before???
449 449
 		// let's compare our stored session details with the current visitor
450 450
 		// first the ip address
451
-		if ( $session_data['ip_address'] != $this->_ip_address ) {
451
+		if ($session_data['ip_address'] != $this->_ip_address) {
452 452
 			return FALSE;
453 453
 		}
454 454
 		// now the user agent
455
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
455
+		if ($session_data['user_agent'] != $this->_user_agent) {
456 456
 			return FALSE;
457 457
 		}
458 458
 		// wait a minute... how old are you?
459
-		if ( $this->_time > $this->_expiration ) {
459
+		if ($this->_time > $this->_expiration) {
460 460
 			// yer too old fer me!
461 461
 			// wipe out everything that isn't a default session datum
462
-			$this->clear_session( __CLASS__, __FUNCTION__ );
462
+			$this->clear_session(__CLASS__, __FUNCTION__);
463 463
 		}
464 464
 		// make event espresso session data available to plugin
465
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
465
+		$this->_session_data = array_merge($this->_session_data, $session_data);
466 466
 		return TRUE;
467 467
 
468 468
 	}
@@ -480,24 +480,24 @@  discard block
 block discarded – undo
480 480
 	  */
481 481
 	protected function _generate_session_id() {
482 482
 		// was session id salt already saved to db ?
483
-		if ( empty( $this->_sid_salt ) ) {
483
+		if (empty($this->_sid_salt)) {
484 484
 			// no?  then maybe use WP defined constant
485
-			if ( defined( 'AUTH_SALT' ) ) {
485
+			if (defined('AUTH_SALT')) {
486 486
 				$this->_sid_salt = AUTH_SALT;
487 487
 			}
488 488
 			// if salt doesn't exist or is too short
489
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
489
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
490 490
 				// create a new one
491
-				$this->_sid_salt = wp_generate_password( 64 );
491
+				$this->_sid_salt = wp_generate_password(64);
492 492
 			}
493 493
 			// and save it as a permanent session setting
494
-			$session_settings = get_option( 'ee_session_settings' );
494
+			$session_settings = get_option('ee_session_settings');
495 495
 			$session_settings['sid_salt'] = $this->_sid_salt;
496
-			update_option( 'ee_session_settings', $session_settings );
496
+			update_option('ee_session_settings', $session_settings);
497 497
 		}
498 498
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
499
-		$session_id = isset( $_REQUEST[ 'EESID' ] ) ? sanitize_text_field( $_REQUEST[ 'EESID' ] ) : md5( session_id() . $this->_sid_salt );
500
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
499
+		$session_id = isset($_REQUEST['EESID']) ? sanitize_text_field($_REQUEST['EESID']) : md5(session_id().$this->_sid_salt);
500
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
501 501
 	}
502 502
 
503 503
 
@@ -523,20 +523,20 @@  discard block
 block discarded – undo
523 523
 	  * @param bool $new_session
524 524
 	  * @return TRUE on success, FALSE on fail
525 525
 	  */
526
-	public function update( $new_session = FALSE ) {
527
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
528
-		$this->_session_data = isset( $this->_session_data )
529
-			&& is_array( $this->_session_data )
530
-			&& isset( $this->_session_data['id'])
526
+	public function update($new_session = FALSE) {
527
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
528
+		$this->_session_data = isset($this->_session_data)
529
+			&& is_array($this->_session_data)
530
+			&& isset($this->_session_data['id'])
531 531
 			? $this->_session_data
532 532
 			: NULL;
533
-		if ( empty( $this->_session_data )) {
533
+		if (empty($this->_session_data)) {
534 534
 			$this->_set_defaults();
535 535
 		}
536 536
 		$session_data = array();
537
-		foreach ( $this->_session_data as $key => $value ) {
537
+		foreach ($this->_session_data as $key => $value) {
538 538
 
539
-			switch( $key ) {
539
+			switch ($key) {
540 540
 
541 541
 				case 'id' :
542 542
 					// session ID
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 				break;
555 555
 
556 556
 				case 'init_access' :
557
-					$session_data['init_access'] = absint( $value );
557
+					$session_data['init_access'] = absint($value);
558 558
 				break;
559 559
 
560 560
 				case 'last_access' :
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 
565 565
 				case 'expiration' :
566 566
 					// when the session expires
567
-					$session_data['expiration'] = ! empty( $this->_expiration )
567
+					$session_data['expiration'] = ! empty($this->_expiration)
568 568
 						? $this->_expiration
569 569
 						: $session_data['init_access'] + $this->_lifespan;
570 570
 				break;
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 
577 577
 				case 'pages_visited' :
578 578
 					$page_visit = $this->_get_page_visit();
579
-					if ( $page_visit ) {
579
+					if ($page_visit) {
580 580
 						// set pages visited where the first will be the http referrer
581
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
581
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
582 582
 						// we'll only save the last 10 page visits.
583
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
583
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
584 584
 					}
585 585
 				break;
586 586
 
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 
595 595
 		$this->_session_data = $session_data;
596 596
 		// creating a new session does not require saving to the db just yet
597
-		if ( ! $new_session ) {
597
+		if ( ! $new_session) {
598 598
 			// ready? let's save
599
-			if ( $this->_save_session_to_db() ) {
599
+			if ($this->_save_session_to_db()) {
600 600
 				return TRUE;
601 601
 			} else {
602 602
 				return FALSE;
@@ -617,9 +617,9 @@  discard block
 block discarded – undo
617 617
 	 * 	@return bool
618 618
 	 */
619 619
 	private function _create_espresso_session( ) {
620
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
620
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
621 621
 		// use the update function for now with $new_session arg set to TRUE
622
-		return  $this->update( TRUE ) ? TRUE : FALSE;
622
+		return  $this->update(TRUE) ? TRUE : FALSE;
623 623
 	}
624 624
 
625 625
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * 	@return string
634 634
 	 */
635 635
 	private function _save_session_to_db() {
636
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
636
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
637 637
 		if (
638 638
 			! EE_Registry::instance()->REQ instanceof EE_Request_Handler
639 639
 			|| ! (
@@ -644,15 +644,15 @@  discard block
 block discarded – undo
644 644
 			return FALSE;
645 645
 		}
646 646
 		// first serialize all of our session data
647
-		$session_data = serialize( $this->_session_data );
647
+		$session_data = serialize($this->_session_data);
648 648
 		// encrypt it if we are using encryption
649
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
649
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
650 650
 		// maybe save hash check
651
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
652
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
651
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
652
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
653 653
 		}
654 654
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
655
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
655
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
656 656
 	}
657 657
 
658 658
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	 *	@return string
669 669
 	 */
670 670
 	private function _visitor_ip() {
671
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
671
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
672 672
 		$visitor_ip = '0.0.0.0';
673 673
 		$server_keys = array(
674 674
 			'HTTP_CLIENT_IP',
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
 			'HTTP_FORWARDED',
680 680
 			'REMOTE_ADDR'
681 681
 		);
682
-		foreach ( $server_keys as $key ){
683
-			if ( isset( $_SERVER[ $key ] )) {
684
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
685
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
682
+		foreach ($server_keys as $key) {
683
+			if (isset($_SERVER[$key])) {
684
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
685
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
686 686
 						$visitor_ip = $ip;
687 687
 					}
688 688
 				}
@@ -702,47 +702,47 @@  discard block
 block discarded – undo
702 702
 	 */
703 703
 	public function _get_page_visit() {
704 704
 
705
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
705
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
706 706
 //		echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.'  ( line no: ' . __LINE__ . ' )</h3>';
707
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
707
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
708 708
 
709 709
 		// check for request url
710
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
710
+		if (isset($_SERVER['REQUEST_URI'])) {
711 711
 
712
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
712
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
713 713
 
714
-			$ru_bits = explode( '?', $request_uri );
714
+			$ru_bits = explode('?', $request_uri);
715 715
 			$request_uri = $ru_bits[0];
716 716
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
717 717
 
718 718
 			// check for and grab host as well
719
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
720
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
719
+			if (isset($_SERVER['HTTP_HOST'])) {
720
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
721 721
 			} else {
722 722
 				$http_host = '';
723 723
 			}
724 724
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
725 725
 
726 726
 			// check for page_id in SERVER REQUEST
727
-			if ( isset( $_REQUEST['page_id'] )) {
727
+			if (isset($_REQUEST['page_id'])) {
728 728
 				// rebuild $e_reg without any of the extra parameters
729
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
729
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
730 730
 			} else {
731 731
 				$page_id = '?';
732 732
 			}
733 733
 			// check for $e_reg in SERVER REQUEST
734
-			if ( isset( $_REQUEST['ee'] )) {
734
+			if (isset($_REQUEST['ee'])) {
735 735
 				// rebuild $e_reg without any of the extra parameters
736
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
736
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
737 737
 			} else {
738 738
 				$e_reg = '';
739 739
 			}
740 740
 
741
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
741
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
742 742
 
743 743
 		}
744 744
 
745
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
745
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
746 746
 
747 747
 	}
748 748
 
@@ -771,14 +771,14 @@  discard block
 block discarded – undo
771 771
 	  * @param string $function
772 772
 	  * @return void
773 773
 	  */
774
-	public function clear_session( $class = '', $function = '' ) {
774
+	public function clear_session($class = '', $function = '') {
775 775
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
776
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
776
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
777 777
 		$this->reset_cart();
778 778
 		$this->reset_checkout();
779 779
 		$this->reset_transaction();
780 780
 		// wipe out everything that isn't a default session datum
781
-		$this->reset_data( array_keys( $this->_session_data ));
781
+		$this->reset_data(array_keys($this->_session_data));
782 782
 		// reset initial site access time and the session expiration
783 783
 		$this->_set_init_access_and_expiration();
784 784
 		$this->_save_session_to_db();
@@ -793,42 +793,42 @@  discard block
 block discarded – undo
793 793
 	  * @param bool  $show_all_notices
794 794
 	  * @return TRUE on success, FALSE on fail
795 795
 	  */
796
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
796
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
797 797
 		// if $data_to_reset is not in an array, then put it in one
798
-		if ( ! is_array( $data_to_reset ) ) {
799
-			$data_to_reset = array ( $data_to_reset );
798
+		if ( ! is_array($data_to_reset)) {
799
+			$data_to_reset = array($data_to_reset);
800 800
 		}
801 801
 		// nothing ??? go home!
802
-		if ( empty( $data_to_reset )) {
803
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
802
+		if (empty($data_to_reset)) {
803
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
804 804
 			return FALSE;
805 805
 		}
806 806
 		$return_value = TRUE;
807 807
 		// since $data_to_reset is an array, cycle through the values
808
-		foreach ( $data_to_reset as $reset ) {
808
+		foreach ($data_to_reset as $reset) {
809 809
 
810 810
 			// first check to make sure it is a valid session var
811
-			if ( isset( $this->_session_data[ $reset ] )) {
811
+			if (isset($this->_session_data[$reset])) {
812 812
 				// then check to make sure it is not a default var
813
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
813
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
814 814
 					// remove session var
815
-					unset( $this->_session_data[ $reset ] );
816
-					if ( $show_all_notices ) {
817
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
815
+					unset($this->_session_data[$reset]);
816
+					if ($show_all_notices) {
817
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
818 818
 					}
819
-					$return_value = !isset($return_value) ? TRUE : $return_value;
819
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
820 820
 
821 821
 				} else {
822 822
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
823
-					if ( $show_all_notices ) {
824
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
823
+					if ($show_all_notices) {
824
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
825 825
 					}
826 826
 					$return_value = FALSE;
827 827
 				}
828 828
 
829
-			} else if ( $show_all_notices ) {
829
+			} else if ($show_all_notices) {
830 830
 				// oops! that session var does not exist!
831
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
831
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
832 832
 				$return_value = FALSE;
833 833
 			}
834 834
 
@@ -849,8 +849,8 @@  discard block
 block discarded – undo
849 849
 	 *   @return	 string
850 850
 	 */
851 851
 	public function wp_loaded() {
852
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
853
-			$this->clear_session( __CLASS__, __FUNCTION__ );
852
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
853
+			$this->clear_session(__CLASS__, __FUNCTION__);
854 854
 		}
855 855
 	}
856 856
 
@@ -875,24 +875,24 @@  discard block
 block discarded – undo
875 875
 	  */
876 876
 	 public function garbage_collection() {
877 877
 		 // only perform during regular requests
878
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
878
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
879 879
 			 /** @type WPDB $wpdb */
880 880
 			 global $wpdb;
881 881
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
882 882
 			 $expiration = time();
883
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
883
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
884 884
 			 // filter the query limit. Set to 0 to turn off garbage collection
885
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
885
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
886 886
 			 // non-zero LIMIT means take out the trash
887
-			 if ( $expired_session_transient_delete_query_limit ) {
887
+			 if ($expired_session_transient_delete_query_limit) {
888 888
 				 //array of transient keys that require garbage collection
889 889
 				 $session_keys = array(
890 890
 					 EE_Session::session_id_prefix,
891 891
 					 EE_Session::hash_check_prefix,
892 892
 				 );
893
-				 foreach ( $session_keys as $session_key ) {
894
-					 $session_key = str_replace( '_', '\_', $session_key );
895
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
893
+				 foreach ($session_keys as $session_key) {
894
+					 $session_key = str_replace('_', '\_', $session_key);
895
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
896 896
 					 $SQL = "
897 897
 					SELECT option_name
898 898
 					FROM {$wpdb->options}
@@ -902,28 +902,28 @@  discard block
 block discarded – undo
902 902
 					OR option_value > {$too_far_in_the_the_future} )
903 903
 					LIMIT {$expired_session_transient_delete_query_limit}
904 904
 				";
905
-					 $expired_sessions = $wpdb->get_col( $SQL );
905
+					 $expired_sessions = $wpdb->get_col($SQL);
906 906
 					 // valid results?
907
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
907
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
908 908
 						 // format array of results into something usable within the actual DELETE query's IN clause
909 909
 						 $expired = array();
910
-						 foreach ( $expired_sessions as $expired_session ) {
911
-							 $expired[ ] = "'" . $expired_session . "'";
912
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
910
+						 foreach ($expired_sessions as $expired_session) {
911
+							 $expired[] = "'".$expired_session."'";
912
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
913 913
 						 }
914
-						 $expired = implode( ', ', $expired );
914
+						 $expired = implode(', ', $expired);
915 915
 						 $SQL = "
916 916
 						DELETE FROM {$wpdb->options}
917 917
 						WHERE option_name
918 918
 						IN ( $expired );
919 919
 					 ";
920
-						 $results = $wpdb->query( $SQL );
920
+						 $results = $wpdb->query($SQL);
921 921
 						 // if something went wrong, then notify the admin
922
-						 if ( $results instanceof WP_Error && is_admin() ) {
923
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
922
+						 if ($results instanceof WP_Error && is_admin()) {
923
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
924 924
 						 }
925 925
 					 }
926
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
926
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
927 927
 				 }
928 928
 			 }
929 929
 		 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
3 5
  *
4 6
  * Event Espresso
@@ -349,7 +351,7 @@  discard block
 block discarded – undo
349 351
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350 352
 		 if ( ! empty( $key ))  {
351 353
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
354
+		} else  {
353 355
 			return $this->_session_data;
354 356
 		}
355 357
 	}
Please login to merge, or discard this patch.
core/EE_System.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -613,7 +613,7 @@
 block discarded – undo
613 613
 	 * so that it will be done when migrations are finished
614 614
 	 * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
615 615
 	 *		however,
616
-	 * @param boolean $verify_db_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
616
+	 * @param boolean $verify_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
617 617
 	 * so we prefer to only do it when necessary
618 618
 	 * @return void
619 619
 	 */
Please login to merge, or discard this patch.
Spacing   +300 added lines, -300 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public static function instance() {
91 91
 		// check if class object is instantiated, and instantiated properly
92
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof  EE_System )) {
92
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof  EE_System)) {
93 93
 			self::$_instance = new self();
94 94
 		}
95 95
 		return self::$_instance;
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * resets the instance and returns it
99 99
 	 * @return EE_System
100 100
 	 */
101
-	public static function reset(){
101
+	public static function reset() {
102 102
 		self::$_instance->_req_type = NULL;
103 103
 		//we need to reset the migration manager in order for it to detect DMSs properly
104 104
 		EE_Data_Migration_Manager::reset();
105 105
 		//make sure none of the old hooks are left hanging around
106
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
106
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
107 107
 		self::instance()->detect_activations_or_upgrades();
108 108
 		self::instance()->perform_activations_upgrades_and_migrations();
109 109
 		return self::instance();
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @return \EE_System
125 125
 	 */
126 126
 	private function __construct() {
127
-		do_action( 'AHEE__EE_System__construct__begin',$this );
127
+		do_action('AHEE__EE_System__construct__begin', $this);
128 128
 		// check required WP version
129
-		if ( ! $this->_minimum_wp_version_required() ) {
130
-			unset( $_GET['activate'] );
131
-			add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 );
129
+		if ( ! $this->_minimum_wp_version_required()) {
130
+			unset($_GET['activate']);
131
+			add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1);
132 132
 			return;
133 133
 		}
134 134
 		// check required PHP version
135
-		if ( ! $this->_minimum_php_version_required() ) {
136
-			unset( $_GET['activate'] );
137
-			add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 );
135
+		if ( ! $this->_minimum_php_version_required()) {
136
+			unset($_GET['activate']);
137
+			add_action('admin_notices', array($this, 'minimum_php_version_error'), 1);
138 138
 			return;
139 139
 		}
140 140
 		// check recommended WP version
141
-		if ( ! $this->_minimum_wp_version_recommended() ) {
141
+		if ( ! $this->_minimum_wp_version_recommended()) {
142 142
 			$this->_display_minimum_recommended_wp_version_notice();
143 143
 		}
144 144
 		// check recommended PHP version
145
-		if ( ! $this->_minimum_php_version_recommended() ) {
145
+		if ( ! $this->_minimum_php_version_recommended()) {
146 146
 			$this->_display_minimum_recommended_php_version_notice();
147 147
 		}
148 148
 		$this->display_alpha_banner_warning();
@@ -151,35 +151,35 @@  discard block
 block discarded – undo
151 151
 		// workarounds for PHP < 5.3
152 152
 		$this->_load_class_tools();
153 153
 		// load a few helper files
154
-		EE_Registry::instance()->load_helper( 'File' );
155
-		EE_Registry::instance()->load_helper( 'Autoloader', array(), FALSE );
156
-		require_once EE_CORE . 'EE_Deprecated.core.php';
154
+		EE_Registry::instance()->load_helper('File');
155
+		EE_Registry::instance()->load_helper('Autoloader', array(), FALSE);
156
+		require_once EE_CORE.'EE_Deprecated.core.php';
157 157
 		// load interfaces
158
-		require_once EE_CORE . 'EEI_Interfaces.php';
159
-		require_once EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php';
158
+		require_once EE_CORE.'EEI_Interfaces.php';
159
+		require_once EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php';
160 160
 		// WP cron jobs
161
-		EE_Registry::instance()->load_core( 'Cron_Tasks' );
161
+		EE_Registry::instance()->load_core('Cron_Tasks');
162 162
 
163 163
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
164
-		add_action( 'plugins_loaded', array( $this, 'load_espresso_addons' ), 1 );
164
+		add_action('plugins_loaded', array($this, 'load_espresso_addons'), 1);
165 165
 		// when an ee addon is activated, we want to call the core hook(s) again
166 166
 		// because the newly-activated addon didn't get a chance to run at all
167
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
167
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
168 168
 		// detect whether install or upgrade
169
-		add_action( 'plugins_loaded', array( $this, 'detect_activations_or_upgrades' ), 3 );
169
+		add_action('plugins_loaded', array($this, 'detect_activations_or_upgrades'), 3);
170 170
 		// load EE_Config, EE_Textdomain, etc
171
-		add_action( 'plugins_loaded', array( $this, 'load_core_configuration' ), 5 );
171
+		add_action('plugins_loaded', array($this, 'load_core_configuration'), 5);
172 172
 		// load EE_Config, EE_Textdomain, etc
173
-		add_action( 'plugins_loaded', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
173
+		add_action('plugins_loaded', array($this, 'register_shortcodes_modules_and_widgets'), 7);
174 174
 		// you wanna get going? I wanna get going... let's get going!
175
-		add_action( 'plugins_loaded', array( $this, 'brew_espresso' ), 9 );
175
+		add_action('plugins_loaded', array($this, 'brew_espresso'), 9);
176 176
 
177 177
 		//other housekeeping
178 178
 		//exclude EE critical pages from wp_list_pages
179
-		add_filter('wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages'), 10 );
179
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
180 180
 		// ALL EE Addons should use the following hook point to attach their initial setup too
181 181
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
182
-		do_action( 'AHEE__EE_System__construct__complete', $this );
182
+		do_action('AHEE__EE_System__construct__complete', $this);
183 183
 	}
184 184
 
185 185
 
@@ -194,22 +194,22 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	public function display_alpha_banner_warning() {
196 196
 		// skip AJAX requests
197
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
197
+		if (defined('DOING_AJAX') && DOING_AJAX) {
198 198
 			return;
199 199
 		}
200 200
 		// skip stable releases
201
-		if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) {
201
+		if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) {
202 202
 			return;
203 203
 		}
204 204
 		// post release candidate warning
205
-		if ( is_admin() ) {
206
-			add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 );
205
+		if (is_admin()) {
206
+			add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999);
207 207
 		} else {
208 208
 			// site admin has authorized use of non-stable release candidate for production
209
-			if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) {
209
+			if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
210 210
 				return;
211 211
 			}
212
-			add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 );
212
+			add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10);
213 213
 		}
214 214
 	}
215 215
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	public function alpha_banner_admin_notice() {
226 226
 		EE_Error::add_attention(
227 227
 			sprintf(
228
-				__( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ),
228
+				__('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'),
229 229
 				'<strong>',
230 230
 				'</strong>'
231 231
 			),
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function alpha_banner_warning_notice() {
246 246
 		global $pagenow;
247
-		if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) {
247
+		if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
248 248
 			return;
249 249
 		}
250 250
 		printf(
251
-			__( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ),
251
+			__('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'),
252 252
 			'<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>',
253 253
 			'<strong>',
254 254
 			'</strong>',
@@ -265,9 +265,9 @@  discard block
 block discarded – undo
265 265
 	 * @param string $min_version
266 266
 	 * @return boolean
267 267
 	 */
268
-	private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) {
268
+	private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) {
269 269
 		global $wp_version;
270
-		return version_compare( $wp_version, $min_version, '>=' ) ? TRUE : FALSE;
270
+		return version_compare($wp_version, $min_version, '>=') ? TRUE : FALSE;
271 271
 	}
272 272
 
273 273
 	/**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * 	@return boolean
278 278
 	 */
279 279
 	private function _minimum_wp_version_required() {
280
-		return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED );
280
+		return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED);
281 281
 	}
282 282
 
283 283
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * 	@return boolean
288 288
 	 */
289 289
 	private function _minimum_wp_version_recommended() {
290
-		return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED );
290
+		return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED);
291 291
 	}
292 292
 
293 293
 
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
 	 * @param string $min_version
300 300
 	 * @return boolean
301 301
 	 */
302
-	private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) {
303
-		return version_compare( PHP_VERSION, $min_version, '>=' ) ? TRUE : FALSE;
302
+	private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) {
303
+		return version_compare(PHP_VERSION, $min_version, '>=') ? TRUE : FALSE;
304 304
 	}
305 305
 
306 306
 	/**
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 * 	@return boolean
311 311
 	 */
312 312
 	private function _minimum_php_version_required() {
313
-		return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED );
313
+		return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED);
314 314
 	}
315 315
 
316 316
 	/**
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	 * 	@return boolean
321 321
 	 */
322 322
 	private function _minimum_php_version_recommended() {
323
-		return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED );
323
+		return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED);
324 324
 	}
325 325
 
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 		<p>
338 338
 		<?php
339 339
 		printf(
340
-			__( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
340
+			__('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
341 341
 			EE_MIN_WP_VER_REQUIRED,
342 342
 			$wp_version,
343 343
 			'<br/>',
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		</p>
348 348
 		</div>
349 349
 		<?php
350
-		EE_System::deactivate_plugin( EE_PLUGIN_BASENAME );
350
+		EE_System::deactivate_plugin(EE_PLUGIN_BASENAME);
351 351
 	}
352 352
 
353 353
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		<p>
364 364
 		<?php
365 365
 		printf(
366
-			__( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
366
+			__('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
367 367
 			EE_MIN_PHP_VER_REQUIRED,
368 368
 			PHP_VERSION,
369 369
 			'<br/>',
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 		</p>
374 374
 		</div>
375 375
 		<?php
376
-		deactivate_plugins( EE_PLUGIN_BASENAME );
376
+		deactivate_plugins(EE_PLUGIN_BASENAME);
377 377
 	}
378 378
 
379 379
 
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 	private function _display_minimum_recommended_wp_version_notice() {
388 388
 		global $wp_version;
389 389
 		EE_Error::add_persistent_admin_notice(
390
-			'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended',
390
+			'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended',
391 391
 			sprintf(
392
-				__( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ),
392
+				__('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'),
393 393
 				EE_MIN_WP_VER_RECOMMENDED,
394 394
 				$wp_version,
395 395
 				'<br/>',
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	private function _display_minimum_recommended_php_version_notice() {
410 410
 		EE_Error::add_persistent_admin_notice(
411
-			'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended',
411
+			'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended',
412 412
 			sprintf(
413
-				__( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ),
413
+				__('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'),
414 414
 				EE_MIN_PHP_VER_RECOMMENDED,
415 415
 				PHP_VERSION,
416 416
 				'<br/>',
@@ -428,12 +428,12 @@  discard block
 block discarded – undo
428 428
 	 * 	@return void
429 429
 	 */
430 430
 	private function _load_registry() {
431
-		if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) {
432
-			require_once( EE_CORE . 'EE_Registry.core.php' );
431
+		if (is_readable(EE_CORE.'EE_Registry.core.php')) {
432
+			require_once(EE_CORE.'EE_Registry.core.php');
433 433
 		} else {
434
-			$msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' );
435
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
436
-			wp_die( EE_Error::get_notices() );
434
+			$msg = __('The EE_Registry core class could not be loaded.', 'event_espresso');
435
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
436
+			wp_die(EE_Error::get_notices());
437 437
 		}
438 438
 	}
439 439
 
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
 	 * 	@return void
446 446
 	 */
447 447
 	private function _load_class_tools() {
448
-		if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
449
-			require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
448
+		if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
449
+			require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
450 450
 		} else {
451
-			$msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' );
452
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
451
+			$msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso');
452
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
453 453
 		}
454 454
 	}
455 455
 
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
 	public function load_espresso_addons() {
467 467
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
468 468
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
469
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
469
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
470 470
 		//load and setup EE_Capabilities
471
-		EE_Registry::instance()->load_core( 'Capabilities' );
472
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
471
+		EE_Registry::instance()->load_core('Capabilities');
472
+		do_action('AHEE__EE_System__load_espresso_addons');
473 473
 	}
474 474
 
475 475
 
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 	 * Checks for activation or upgrade of core first; then also checks if any registered
478 478
 	 * addons have been activated or upgraded
479 479
 	 */
480
-	public function detect_activations_or_upgrades(){
480
+	public function detect_activations_or_upgrades() {
481 481
 		//first off: let's make sure to handle core
482 482
 		$this->detect_if_activation_or_upgrade();
483
-		foreach(EE_Registry::instance()->addons as $addon){
483
+		foreach (EE_Registry::instance()->addons as $addon) {
484 484
 			//detect teh request type for that addon
485 485
 			$addon->detect_activation_or_upgrade();
486 486
 		}
@@ -498,44 +498,44 @@  discard block
 block discarded – undo
498 498
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
499 499
 
500 500
 		// load M-Mode class
501
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
501
+		EE_Registry::instance()->load_core('Maintenance_Mode');
502 502
 		// check if db has been updated, or if its a brand-new installation
503 503
 
504 504
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
505
-		$request_type =  $this->detect_req_type($espresso_db_update);
505
+		$request_type = $this->detect_req_type($espresso_db_update);
506 506
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
507
-		if( $request_type != EE_System::req_type_normal){
507
+		if ($request_type != EE_System::req_type_normal) {
508 508
 			EE_Registry::instance()->load_helper('Activation');
509 509
 		}
510 510
 
511
-		switch($request_type){
511
+		switch ($request_type) {
512 512
 			case EE_System::req_type_new_activation:
513
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
514
-				$this->_handle_core_version_change( $espresso_db_update );
513
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
514
+				$this->_handle_core_version_change($espresso_db_update);
515 515
 				break;
516 516
 			case EE_System::req_type_reactivation:
517
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
518
-				$this->_handle_core_version_change( $espresso_db_update );
517
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
518
+				$this->_handle_core_version_change($espresso_db_update);
519 519
 				break;
520 520
 			case EE_System::req_type_upgrade:
521
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
521
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
522 522
 				//migrations may be required now that we've upgraded
523 523
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
524
-				$this->_handle_core_version_change( $espresso_db_update );
524
+				$this->_handle_core_version_change($espresso_db_update);
525 525
 //				echo "done upgrade";die;
526 526
 				break;
527 527
 			case EE_System::req_type_downgrade:
528
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
528
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
529 529
 				//its possible migrations are no longer required
530 530
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
531
-				$this->_handle_core_version_change( $espresso_db_update );
531
+				$this->_handle_core_version_change($espresso_db_update);
532 532
 				break;
533 533
 			case EE_System::req_type_normal:
534 534
 			default:
535 535
 //				$this->_maybe_redirect_to_ee_about();
536 536
 				break;
537 537
 		}
538
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
538
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
539 539
 	}
540 540
 
541 541
 	/**
@@ -543,10 +543,10 @@  discard block
 block discarded – undo
543 543
 	 * initializing the database later during the request
544 544
 	 * @param array $espresso_db_update
545 545
 	 */
546
-	protected function _handle_core_version_change( $espresso_db_update ){
547
-		$this->update_list_of_installed_versions( $espresso_db_update );
546
+	protected function _handle_core_version_change($espresso_db_update) {
547
+		$this->update_list_of_installed_versions($espresso_db_update);
548 548
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
549
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
549
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
550 550
 	}
551 551
 
552 552
 
@@ -561,44 +561,44 @@  discard block
 block discarded – undo
561 561
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
562 562
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
563 563
 	 */
564
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
565
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
566
-		if( ! $espresso_db_update){
567
-			$espresso_db_update = get_option( 'espresso_db_update' );
564
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
565
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
566
+		if ( ! $espresso_db_update) {
567
+			$espresso_db_update = get_option('espresso_db_update');
568 568
 		}
569 569
 		// check that option is an array
570
-		if( ! is_array( $espresso_db_update )) {
570
+		if ( ! is_array($espresso_db_update)) {
571 571
 			// if option is FALSE, then it never existed
572
-			if ( $espresso_db_update === FALSE ) {
572
+			if ($espresso_db_update === FALSE) {
573 573
 				// make $espresso_db_update an array and save option with autoload OFF
574
-				$espresso_db_update =  array();
575
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
574
+				$espresso_db_update = array();
575
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
576 576
 			} else {
577 577
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
578
-				$espresso_db_update =  array( $espresso_db_update=>array() );
579
-				update_option( 'espresso_db_update', $espresso_db_update );
578
+				$espresso_db_update = array($espresso_db_update=>array());
579
+				update_option('espresso_db_update', $espresso_db_update);
580 580
 			}
581
-		}else{
581
+		} else {
582 582
 			$corrected_db_update = array();
583 583
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
585
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
584
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
585
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
586 586
 					//the key is an int, and the value IS NOT an array
587 587
 					//so it must be numerically-indexed, where values are versions installed...
588 588
 					//fix it!
589 589
 					$version_string = $should_be_array;
590 590
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
591
+				} else {
592 592
 					//ok it checks out
593 593
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 594
 				}
595 595
 			}
596 596
 			$espresso_db_update = $corrected_db_update;
597
-			update_option( 'espresso_db_update', $espresso_db_update );
597
+			update_option('espresso_db_update', $espresso_db_update);
598 598
 
599 599
 		}
600 600
 
601
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
601
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
602 602
 		return $espresso_db_update;
603 603
 	}
604 604
 
@@ -617,27 +617,27 @@  discard block
 block discarded – undo
617 617
 	 * so we prefer to only do it when necessary
618 618
 	 * @return void
619 619
 	 */
620
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
620
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
621 621
 		$request_type = $this->detect_req_type();
622 622
 		//only initialize system if we're not in maintenance mode.
623
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
624
-			update_option( 'ee_flush_rewrite_rules', TRUE );
623
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
624
+			update_option('ee_flush_rewrite_rules', TRUE);
625 625
 			EEH_Activation::system_initialization();
626
-			if( $verify_schema ) {
626
+			if ($verify_schema) {
627 627
 				EEH_Activation::initialize_db_and_folders();
628 628
 			}
629 629
 			EEH_Activation::initialize_db_content();
630
-			if( $initialize_addons_too ) {
630
+			if ($initialize_addons_too) {
631 631
 				//foreach registered addon, make sure its db is up-to-date too
632
-				foreach(EE_Registry::instance()->addons as $addon){
632
+				foreach (EE_Registry::instance()->addons as $addon) {
633 633
 					$addon->initialize_db_if_no_migrations_required();
634 634
 				}
635 635
 			}
636
-		}else{
637
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
636
+		} else {
637
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
638 638
 		}
639
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
640
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
639
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
640
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
641 641
 		}
642 642
 	}
643 643
 
@@ -649,16 +649,16 @@  discard block
 block discarded – undo
649 649
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
650 650
 	 * @return 	boolean success as to whether or not this option was changed
651 651
 	 */
652
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
653
-		if( ! $version_history ) {
652
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
653
+		if ( ! $version_history) {
654 654
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
655 655
 		}
656
-		if( $current_version_to_add == NULL){
656
+		if ($current_version_to_add == NULL) {
657 657
 			$current_version_to_add = espresso_version();
658 658
 		}
659
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
659
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
660 660
 		// re-save
661
-		return update_option( 'espresso_db_update', $version_history );
661
+		return update_option('espresso_db_update', $version_history);
662 662
 	}
663 663
 
664 664
 
@@ -675,10 +675,10 @@  discard block
 block discarded – undo
675 675
 	 *                            but still know if this is a new install or not
676 676
 	 * @return int one of the constants on EE_System::req_type_
677 677
 	 */
678
-	public function detect_req_type( $espresso_db_update = NULL ){
679
-		if ( $this->_req_type === NULL ){
680
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
681
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
678
+	public function detect_req_type($espresso_db_update = NULL) {
679
+		if ($this->_req_type === NULL) {
680
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
681
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
682 682
 		}
683 683
 		return $this->_req_type;
684 684
 	}
@@ -694,39 +694,39 @@  discard block
 block discarded – undo
694 694
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
695 695
 	 * @return int one of the constants on EE_System::req_type_*
696 696
 	 */
697
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
698
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
699
-		if( $activation_history_for_addon ){
697
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
698
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
699
+		if ($activation_history_for_addon) {
700 700
 			//it exists, so this isn't a completely new install
701 701
 			//check if this version already in that list of previously installed versions
702
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
702
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
703 703
 				//it a version we haven't seen before
704
-				if( $version_is_higher === 1 ){
704
+				if ($version_is_higher === 1) {
705 705
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
706
+				} else {
707 707
 					$req_type = EE_System::req_type_downgrade;
708 708
 				}
709
-				delete_option( $activation_indicator_option_name );
709
+				delete_option($activation_indicator_option_name);
710 710
 			} else {
711 711
 				// its not an update. maybe a reactivation?
712
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
713
-					if ( $version_is_higher === -1 ){
712
+				if (get_option($activation_indicator_option_name, FALSE)) {
713
+					if ($version_is_higher === -1) {
714 714
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
715
+					}elseif ($version_is_higher === 0) {
716 716
 						//we've seen this version before, but it's an activation. must be a reactivation
717 717
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
718
+					} else {//$version_is_higher === 1
719 719
 						$req_type = EE_System::req_type_upgrade;
720 720
 					}
721
-					delete_option( $activation_indicator_option_name );
721
+					delete_option($activation_indicator_option_name);
722 722
 				} else {
723 723
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724
-					if ( $version_is_higher === -1 ){
724
+					if ($version_is_higher === -1) {
725 725
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
726
+					}elseif ($version_is_higher === 0) {
727 727
 						//we've seen this version before and it's not an activation. its normal request
728 728
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
729
+					} else {//$version_is_higher === 1
730 730
 						$req_type = EE_System::req_type_upgrade;
731 731
 					}
732 732
 				}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		} else {
735 735
 			//brand new install
736 736
 			$req_type = EE_System::req_type_new_activation;
737
-			delete_option( $activation_indicator_option_name );
737
+			delete_option($activation_indicator_option_name);
738 738
 		}
739 739
 		return $req_type;
740 740
 	}
@@ -752,30 +752,30 @@  discard block
 block discarded – undo
752 752
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
753 753
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
754 754
 	 */
755
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
755
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
756 756
 		//find the most recently-activated version
757 757
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
758 758
 		$most_recently_active_version = '0.0.0.dev.000';
759
-		if( is_array( $activation_history_for_addon ) ){
760
-			foreach( $activation_history_for_addon as $version => $times_activated ){
759
+		if (is_array($activation_history_for_addon)) {
760
+			foreach ($activation_history_for_addon as $version => $times_activated) {
761 761
 				//check there is a record of when this version was activated. Otherwise,
762 762
 				//mark it as unknown
763
-				if( ! $times_activated ){
764
-					$times_activated = array( 'unknown-date');
763
+				if ( ! $times_activated) {
764
+					$times_activated = array('unknown-date');
765 765
 				}
766
-				if( is_string( $times_activated ) ){
767
-					$times_activated = array( $times_activated );
766
+				if (is_string($times_activated)) {
767
+					$times_activated = array($times_activated);
768 768
 				}
769
-				foreach( $times_activated as $an_activation ){
770
-					if( $an_activation != 'unknown-date' &&
771
-							$an_activation > $most_recently_active_version_activation  ){
769
+				foreach ($times_activated as $an_activation) {
770
+					if ($an_activation != 'unknown-date' &&
771
+							$an_activation > $most_recently_active_version_activation) {
772 772
 						$most_recently_active_version = $version;
773 773
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
774 774
 					}
775 775
 				}
776 776
 			}
777 777
 		}
778
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
778
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
779 779
 	}
780 780
 
781 781
 
@@ -785,20 +785,20 @@  discard block
 block discarded – undo
785 785
 	 * @return void
786 786
 	 */
787 787
 	public function redirect_to_about_ee() {
788
-		$notices = EE_Error::get_notices( FALSE );
788
+		$notices = EE_Error::get_notices(FALSE);
789 789
 		//if current user is an admin and it's not an ajax request
790
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
791
-			$query_params =  array( 'page' => 'espresso_about' );
790
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
791
+			$query_params = array('page' => 'espresso_about');
792 792
 
793
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
793
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
794 794
 			    $query_params['new_activation'] = TRUE;
795 795
 			}
796 796
 
797
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
797
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
798 798
 			    $query_params['reactivation'] = TRUE;
799 799
 			}
800
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
801
-			wp_safe_redirect( $url );
800
+			$url = add_query_arg($query_params, admin_url('admin.php'));
801
+			wp_safe_redirect($url);
802 802
 			exit();
803 803
 		}
804 804
 	}
@@ -809,31 +809,31 @@  discard block
 block discarded – undo
809 809
 	 *
810 810
 	 * @return void
811 811
 	 */
812
-	public function load_core_configuration(){
813
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
812
+	public function load_core_configuration() {
813
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
814 814
 		// load and setup EE_Config and EE_Network_Config
815
-		EE_Registry::instance()->load_core( 'Config' );
816
-		EE_Registry::instance()->load_core( 'Network_Config' );
815
+		EE_Registry::instance()->load_core('Config');
816
+		EE_Registry::instance()->load_core('Network_Config');
817 817
 		// setup autoloaders
818
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
818
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
819 819
 		//load textdomain
820 820
 		EE_Load_Textdomain::load_textdomain();
821 821
 		// enable logging?
822
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
823
-			EE_Registry::instance()->load_core( 'Log' );
822
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
823
+			EE_Registry::instance()->load_core('Log');
824 824
 		}
825 825
 		// check for activation errors
826
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
827
-		if ( $activation_errors ) {
828
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
829
-			update_option( 'ee_plugin_activation_errors', FALSE );
826
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
827
+		if ($activation_errors) {
828
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
829
+			update_option('ee_plugin_activation_errors', FALSE);
830 830
 		}
831 831
 		// get model names
832 832
 		$this->_parse_model_names();
833 833
 
834 834
 		//load caf stuff a chance to play during the activation process too.
835 835
 		$this->_maybe_brew_regular();
836
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
836
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
837 837
 	}
838 838
 
839 839
 
@@ -842,23 +842,23 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return void
844 844
 	 */
845
-	private function _parse_model_names(){
845
+	private function _parse_model_names() {
846 846
 		//get all the files in the EE_MODELS folder that end in .model.php
847
-		$models = glob( EE_MODELS.'*.model.php');
847
+		$models = glob(EE_MODELS.'*.model.php');
848 848
 		$model_names = array();
849 849
 		$non_abstract_db_models = array();
850
-		foreach( $models as $model ){
850
+		foreach ($models as $model) {
851 851
 			// get model classname
852
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
853
-			$shortname = str_replace( 'EEM_', '', $classname );
852
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
853
+			$shortname = str_replace('EEM_', '', $classname);
854 854
 			$reflectionClass = new ReflectionClass($classname);
855
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
855
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
856 856
 				$non_abstract_db_models[$shortname] = $classname;
857 857
 			}
858
-			$model_names[ $shortname ] = $classname;
858
+			$model_names[$shortname] = $classname;
859 859
 		}
860
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
861
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
860
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
861
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
862 862
 	}
863 863
 
864 864
 
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 	 * @return void
869 869
 	 */
870 870
 	private function _maybe_brew_regular() {
871
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
872
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
871
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
872
+			require_once EE_CAFF_PATH.'brewing_regular.php';
873 873
 		}
874 874
 	}
875 875
 
@@ -884,9 +884,9 @@  discard block
 block discarded – undo
884 884
 	* @return void
885 885
 	*/
886 886
 	public function register_shortcodes_modules_and_widgets() {
887
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
887
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
888 888
 		// check for addons using old hookpoint
889
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
889
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
890 890
 			$this->_incompatible_addon_error();
891 891
 		}
892 892
 	}
@@ -900,19 +900,19 @@  discard block
 block discarded – undo
900 900
 	*/
901 901
 	private function _incompatible_addon_error() {
902 902
 		// get array of classes hooking into here
903
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
904
-		if ( ! empty( $class_names )) {
905
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
903
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
904
+		if ( ! empty($class_names)) {
905
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
906 906
 			$msg .= '<ul>';
907
-			foreach ( $class_names as $class_name ) {
908
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
907
+			foreach ($class_names as $class_name) {
908
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
909 909
 			}
910 910
 			$msg .= '</ul>';
911
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
911
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
912 912
 			// save list of incompatible addons to wp-options for later use
913
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
914
-			if ( is_admin() ) {
915
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
913
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
914
+			if (is_admin()) {
915
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
916 916
 			}
917 917
 		}
918 918
 	}
@@ -928,25 +928,25 @@  discard block
 block discarded – undo
928 928
 	 *
929 929
 	 * @return void
930 930
 	 */
931
-	public function brew_espresso(){
932
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
931
+	public function brew_espresso() {
932
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
933 933
 		// load some final core systems
934
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
935
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
936
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
937
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
938
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
939
-		add_action( 'init', array( $this, 'initialize' ), 10 );
940
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
941
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
942
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
943
-
944
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
934
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
935
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
936
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
937
+		add_action('init', array($this, 'load_controllers'), 7);
938
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
939
+		add_action('init', array($this, 'initialize'), 10);
940
+		add_action('init', array($this, 'initialize_last'), 100);
941
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
942
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
943
+
944
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
945 945
 			// pew pew pew
946
-			EE_Registry::instance()->load_core( 'PUE' );
947
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
946
+			EE_Registry::instance()->load_core('PUE');
947
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
948 948
 		}
949
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
949
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
950 950
 	}
951 951
 
952 952
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 	 */
961 961
 	public function set_hooks_for_core() {
962 962
 		$this->_deactivate_incompatible_addons();
963
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
963
+		do_action('AHEE__EE_System__set_hooks_for_core');
964 964
 	}
965 965
 
966 966
 
@@ -969,15 +969,15 @@  discard block
 block discarded – undo
969 969
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
970 970
 	 * deactivates any addons considered incompatible with the current version of EE
971 971
 	 */
972
-	private function _deactivate_incompatible_addons(){
973
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
974
-		if ( ! empty( $incompatible_addons )) {
975
-			$active_plugins = get_option( 'active_plugins', array() );
976
-			foreach ( $active_plugins as $active_plugin ) {
977
-				foreach ( $incompatible_addons as $incompatible_addon ) {
978
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
979
-						unset( $_GET['activate'] );
980
-						EE_System::deactivate_plugin( $active_plugin );
972
+	private function _deactivate_incompatible_addons() {
973
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
974
+		if ( ! empty($incompatible_addons)) {
975
+			$active_plugins = get_option('active_plugins', array());
976
+			foreach ($active_plugins as $active_plugin) {
977
+				foreach ($incompatible_addons as $incompatible_addon) {
978
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
979
+						unset($_GET['activate']);
980
+						EE_System::deactivate_plugin($active_plugin);
981 981
 					}
982 982
 				}
983 983
 			}
@@ -994,11 +994,11 @@  discard block
 block discarded – undo
994 994
 	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
995 995
 	 * @return    void
996 996
 	 */
997
-	public static function deactivate_plugin( $plugin_basename = '' ) {
998
-		if ( ! function_exists( 'deactivate_plugins' )) {
999
-			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
997
+	public static function deactivate_plugin($plugin_basename = '') {
998
+		if ( ! function_exists('deactivate_plugins')) {
999
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
1000 1000
 		}
1001
-		deactivate_plugins( $plugin_basename );
1001
+		deactivate_plugins($plugin_basename);
1002 1002
 	}
1003 1003
 
1004 1004
 
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	 *  	@return 	void
1011 1011
 	 */
1012 1012
 	public function perform_activations_upgrades_and_migrations() {
1013
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
1013
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
1014 1014
 	}
1015 1015
 
1016 1016
 
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 //		EEM_Datetime::instance()->show_next_x_db_queries();
1027 1027
 //		$ds = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time($e->ID(),false);
1028 1028
 //
1029
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
1029
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
1030 1030
 		// register Custom Post Types
1031
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
1031
+		EE_Registry::instance()->load_core('Register_CPTs');
1032 1032
 //		EE_Registry::instance()->load_core( 'Session' );
1033
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
1033
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
1034 1034
 	}
1035 1035
 
1036 1036
 
@@ -1045,16 +1045,16 @@  discard block
 block discarded – undo
1045 1045
 	* @return void
1046 1046
 	*/
1047 1047
 	public function load_controllers() {
1048
-		do_action( 'AHEE__EE_System__load_controllers__start' );
1048
+		do_action('AHEE__EE_System__load_controllers__start');
1049 1049
 		// let's get it started
1050
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
1051
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
1052
-			EE_Registry::instance()->load_core( 'Front_Controller' );
1053
-		} else if ( ! EE_FRONT_AJAX ) {
1054
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
1055
-			EE_Registry::instance()->load_core( 'Admin' );
1050
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
1051
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
1052
+			EE_Registry::instance()->load_core('Front_Controller');
1053
+		} else if ( ! EE_FRONT_AJAX) {
1054
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
1055
+			EE_Registry::instance()->load_core('Admin');
1056 1056
 		}
1057
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
1057
+		do_action('AHEE__EE_System__load_controllers__complete');
1058 1058
 	}
1059 1059
 
1060 1060
 
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	* @return void
1069 1069
 	*/
1070 1070
 	public function core_loaded_and_ready() {
1071
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1072
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1071
+		do_action('AHEE__EE_System__core_loaded_and_ready');
1072
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
1073 1073
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
1074
-		EE_Registry::instance()->load_core( 'Session' );
1074
+		EE_Registry::instance()->load_core('Session');
1075 1075
 	}
1076 1076
 
1077 1077
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	* @return void
1086 1086
 	*/
1087 1087
 	public function initialize() {
1088
-		do_action( 'AHEE__EE_System__initialize' );
1088
+		do_action('AHEE__EE_System__initialize');
1089 1089
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
1090 1090
 	}
1091 1091
 
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 	* @return void
1101 1101
 	*/
1102 1102
 	public function initialize_last() {
1103
-		do_action( 'AHEE__EE_System__initialize_last' );
1103
+		do_action('AHEE__EE_System__initialize_last');
1104 1104
 	}
1105 1105
 
1106 1106
 
@@ -1132,21 +1132,21 @@  discard block
 block discarded – undo
1132 1132
 	*/
1133 1133
 	public static function do_not_cache() {
1134 1134
 		// set no cache constants
1135
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
1136
-			define( 'DONOTCACHEPAGE', true );
1135
+		if ( ! defined('DONOTCACHEPAGE')) {
1136
+			define('DONOTCACHEPAGE', true);
1137 1137
 		}
1138
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
1139
-			define( 'DONOTCACHCEOBJECT', true );
1138
+		if ( ! defined('DONOTCACHCEOBJECT')) {
1139
+			define('DONOTCACHCEOBJECT', true);
1140 1140
 		}
1141
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
1142
-			define( 'DONOTCACHEDB', true );
1141
+		if ( ! defined('DONOTCACHEDB')) {
1142
+			define('DONOTCACHEDB', true);
1143 1143
 		}
1144 1144
 		// add no cache headers
1145
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
1145
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
1146 1146
 		// plus a little extra for nginx
1147
-		add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 );
1147
+		add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1);
1148 1148
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
1149
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
1149
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
1150 1150
 	}
1151 1151
 
1152 1152
 
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 	 * @param $headers
1159 1159
 	 * @return    array
1160 1160
 	 */
1161
-	public static function nocache_headers_nginx ( $headers ) {
1161
+	public static function nocache_headers_nginx($headers) {
1162 1162
 		$headers['X-Accel-Expires'] = 0;
1163 1163
 		return $headers;
1164 1164
 	}
@@ -1184,15 +1184,15 @@  discard block
 block discarded – undo
1184 1184
 	 * @param $admin_bar
1185 1185
 	 * @return    void
1186 1186
 	 */
1187
-	public function espresso_toolbar_items( $admin_bar ) {
1187
+	public function espresso_toolbar_items($admin_bar) {
1188 1188
 
1189 1189
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
1190
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
1190
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
1191 1191
 			return;
1192 1192
 		}
1193 1193
 
1194
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1195
-		EE_Registry::instance()->load_helper( 'URL' );
1194
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1195
+		EE_Registry::instance()->load_helper('URL');
1196 1196
 		$menu_class = 'espresso_menu_item_class';
1197 1197
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
1198 1198
 		//because they're only defined in each of their respective constructors
@@ -1203,20 +1203,20 @@  discard block
 block discarded – undo
1203 1203
 		//Top Level
1204 1204
 		$admin_bar->add_menu(array(
1205 1205
 				'id' => 'espresso-toolbar',
1206
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
1206
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
1207 1207
 				'href' => $events_admin_url,
1208 1208
 				'meta' => array(
1209 1209
 						'title' => __('Event Espresso', 'event_espresso'),
1210
-						'class' => $menu_class . 'first'
1210
+						'class' => $menu_class.'first'
1211 1211
 				),
1212 1212
 		));
1213 1213
 
1214 1214
 		//Events
1215
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
1215
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
1216 1216
 			$admin_bar->add_menu(array(
1217 1217
 					'id' => 'espresso-toolbar-events',
1218 1218
 					'parent' => 'espresso-toolbar',
1219
-					'title' => __( 'Events', 'event_espresso' ),
1219
+					'title' => __('Events', 'event_espresso'),
1220 1220
 					'href' => $events_admin_url,
1221 1221
 					'meta' => array(
1222 1222
 							'title' => __('Events', 'event_espresso'),
@@ -1227,13 +1227,13 @@  discard block
 block discarded – undo
1227 1227
 		}
1228 1228
 
1229 1229
 
1230
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
1230
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
1231 1231
 			//Events Add New
1232 1232
 			$admin_bar->add_menu(array(
1233 1233
 					'id' => 'espresso-toolbar-events-new',
1234 1234
 					'parent' => 'espresso-toolbar-events',
1235 1235
 					'title' => __('Add New', 'event_espresso'),
1236
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
1236
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
1237 1237
 					'meta' => array(
1238 1238
 							'title' => __('Add New', 'event_espresso'),
1239 1239
 							'target' => '',
@@ -1243,11 +1243,11 @@  discard block
 block discarded – undo
1243 1243
 		}
1244 1244
 
1245 1245
 		//Events View
1246
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1246
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1247 1247
 			$admin_bar->add_menu(array(
1248 1248
 					'id' => 'espresso-toolbar-events-view',
1249 1249
 					'parent' => 'espresso-toolbar-events',
1250
-					'title' => __( 'View', 'event_espresso' ),
1250
+					'title' => __('View', 'event_espresso'),
1251 1251
 					'href' => $events_admin_url,
1252 1252
 					'meta' => array(
1253 1253
 							'title' => __('View', 'event_espresso'),
@@ -1257,12 +1257,12 @@  discard block
 block discarded – undo
1257 1257
 			));
1258 1258
 		}
1259 1259
 
1260
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1260
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1261 1261
 			//Events View All
1262 1262
 			$admin_bar->add_menu(array(
1263 1263
 					'id' => 'espresso-toolbar-events-all',
1264 1264
 					'parent' => 'espresso-toolbar-events-view',
1265
-					'title' => __( 'All', 'event_espresso' ),
1265
+					'title' => __('All', 'event_espresso'),
1266 1266
 					'href' => $events_admin_url,
1267 1267
 					'meta' => array(
1268 1268
 							'title' => __('All', 'event_espresso'),
@@ -1273,13 +1273,13 @@  discard block
 block discarded – undo
1273 1273
 		}
1274 1274
 
1275 1275
 
1276
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1276
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1277 1277
 			//Events View Today
1278 1278
 			$admin_bar->add_menu(array(
1279 1279
 					'id' => 'espresso-toolbar-events-today',
1280 1280
 					'parent' => 'espresso-toolbar-events-view',
1281 1281
 					'title' => __('Today', 'event_espresso'),
1282
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1282
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1283 1283
 					'meta' => array(
1284 1284
 							'title' => __('Today', 'event_espresso'),
1285 1285
 							'target' => '',
@@ -1289,13 +1289,13 @@  discard block
 block discarded – undo
1289 1289
 		}
1290 1290
 
1291 1291
 
1292
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1292
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1293 1293
 			//Events View This Month
1294 1294
 			$admin_bar->add_menu(array(
1295 1295
 					'id' => 'espresso-toolbar-events-month',
1296 1296
 					'parent' => 'espresso-toolbar-events-view',
1297
-					'title' => __( 'This Month', 'event_espresso'),
1298
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1297
+					'title' => __('This Month', 'event_espresso'),
1298
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1299 1299
 					'meta' => array(
1300 1300
 							'title' => __('This Month', 'event_espresso'),
1301 1301
 							'target' => '',
@@ -1305,11 +1305,11 @@  discard block
 block discarded – undo
1305 1305
 		}
1306 1306
 
1307 1307
 		//Registration Overview
1308
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1308
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1309 1309
 			$admin_bar->add_menu(array(
1310 1310
 					'id' => 'espresso-toolbar-registrations',
1311 1311
 					'parent' => 'espresso-toolbar',
1312
-					'title' => __( 'Registrations', 'event_espresso' ),
1312
+					'title' => __('Registrations', 'event_espresso'),
1313 1313
 					'href' => $reg_admin_url,
1314 1314
 					'meta' => array(
1315 1315
 							'title' => __('Registrations', 'event_espresso'),
@@ -1320,12 +1320,12 @@  discard block
 block discarded – undo
1320 1320
 		}
1321 1321
 
1322 1322
 		//Registration Overview Today
1323
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1323
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1324 1324
 			$admin_bar->add_menu(array(
1325 1325
 					'id' => 'espresso-toolbar-registrations-today',
1326 1326
 					'parent' => 'espresso-toolbar-registrations',
1327
-					'title' => __( 'Today', 'event_espresso'),
1328
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1327
+					'title' => __('Today', 'event_espresso'),
1328
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1329 1329
 					'meta' => array(
1330 1330
 							'title' => __('Today', 'event_espresso'),
1331 1331
 							'target' => '',
@@ -1335,14 +1335,14 @@  discard block
 block discarded – undo
1335 1335
 		}
1336 1336
 
1337 1337
 		//Registration Overview Today Completed
1338
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1338
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1339 1339
 			$admin_bar->add_menu(array(
1340 1340
 					'id' => 'espresso-toolbar-registrations-today-approved',
1341 1341
 					'parent' => 'espresso-toolbar-registrations-today',
1342
-					'title' => __( 'Approved', 'event_espresso' ),
1343
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1342
+					'title' => __('Approved', 'event_espresso'),
1343
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1344 1344
 					'meta' => array(
1345
-							'title' => __('Approved', 'event_espresso' ),
1345
+							'title' => __('Approved', 'event_espresso'),
1346 1346
 							'target' => '',
1347 1347
 							'class' => $menu_class
1348 1348
 					),
@@ -1350,14 +1350,14 @@  discard block
 block discarded – undo
1350 1350
 		}
1351 1351
 
1352 1352
 		//Registration Overview Today Pending\
1353
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1353
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1354 1354
 			$admin_bar->add_menu(array(
1355 1355
 					'id' => 'espresso-toolbar-registrations-today-pending',
1356 1356
 					'parent' => 'espresso-toolbar-registrations-today',
1357
-					'title' => __( 'Pending', 'event_espresso' ),
1358
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1357
+					'title' => __('Pending', 'event_espresso'),
1358
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1359 1359
 					'meta' => array(
1360
-							'title' => __('Pending Payment', 'event_espresso' ),
1360
+							'title' => __('Pending Payment', 'event_espresso'),
1361 1361
 							'target' => '',
1362 1362
 							'class' => $menu_class
1363 1363
 					),
@@ -1365,14 +1365,14 @@  discard block
 block discarded – undo
1365 1365
 		}
1366 1366
 
1367 1367
 		//Registration Overview Today Incomplete
1368
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1368
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1369 1369
 			$admin_bar->add_menu(array(
1370 1370
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1371 1371
 					'parent' => 'espresso-toolbar-registrations-today',
1372
-					'title' => __( 'Not Approved', 'event_espresso' ),
1373
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1372
+					'title' => __('Not Approved', 'event_espresso'),
1373
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1374 1374
 					'meta' => array(
1375
-							'title' => __('Not Approved', 'event_espresso' ),
1375
+							'title' => __('Not Approved', 'event_espresso'),
1376 1376
 							'target' => '',
1377 1377
 							'class' => $menu_class
1378 1378
 					),
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
 		}
1381 1381
 
1382 1382
 		//Registration Overview Today Incomplete
1383
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1384 1384
 			$admin_bar->add_menu(array(
1385 1385
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1386 1386
 					'parent' => 'espresso-toolbar-registrations-today',
1387
-					'title' => __( 'Cancelled', 'event_espresso'),
1388
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1387
+					'title' => __('Cancelled', 'event_espresso'),
1388
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1389 1389
 					'meta' => array(
1390 1390
 							'title' => __('Cancelled', 'event_espresso'),
1391 1391
 							'target' => '',
@@ -1395,12 +1395,12 @@  discard block
 block discarded – undo
1395 1395
 		}
1396 1396
 
1397 1397
 		//Registration Overview This Month
1398
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1398
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1399 1399
 			$admin_bar->add_menu(array(
1400 1400
 					'id' => 'espresso-toolbar-registrations-month',
1401 1401
 					'parent' => 'espresso-toolbar-registrations',
1402
-					'title' => __( 'This Month', 'event_espresso' ),
1403
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1402
+					'title' => __('This Month', 'event_espresso'),
1403
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1404 1404
 					'meta' => array(
1405 1405
 							'title' => __('This Month', 'event_espresso'),
1406 1406
 							'target' => '',
@@ -1410,12 +1410,12 @@  discard block
 block discarded – undo
1410 1410
 		}
1411 1411
 
1412 1412
 		//Registration Overview This Month Approved
1413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1414 1414
 			$admin_bar->add_menu(array(
1415 1415
 					'id' => 'espresso-toolbar-registrations-month-approved',
1416 1416
 					'parent' => 'espresso-toolbar-registrations-month',
1417
-					'title' => __( 'Approved', 'event_espresso' ),
1418
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1417
+					'title' => __('Approved', 'event_espresso'),
1418
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1419 1419
 					'meta' => array(
1420 1420
 							'title' => __('Approved', 'event_espresso'),
1421 1421
 							'target' => '',
@@ -1425,12 +1425,12 @@  discard block
 block discarded – undo
1425 1425
 		}
1426 1426
 
1427 1427
 		//Registration Overview This Month Pending
1428
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1428
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1429 1429
 			$admin_bar->add_menu(array(
1430 1430
 					'id' => 'espresso-toolbar-registrations-month-pending',
1431 1431
 					'parent' => 'espresso-toolbar-registrations-month',
1432
-					'title' => __( 'Pending', 'event_espresso'),
1433
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1432
+					'title' => __('Pending', 'event_espresso'),
1433
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1434 1434
 					'meta' => array(
1435 1435
 							'title' => __('Pending', 'event_espresso'),
1436 1436
 							'target' => '',
@@ -1440,14 +1440,14 @@  discard block
 block discarded – undo
1440 1440
 		}
1441 1441
 
1442 1442
 		//Registration Overview This Month Not Approved
1443
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1443
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1444 1444
 			$admin_bar->add_menu(array(
1445 1445
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1446 1446
 					'parent' => 'espresso-toolbar-registrations-month',
1447
-					'title' => __( 'Not Approved', 'event_espresso'),
1448
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1447
+					'title' => __('Not Approved', 'event_espresso'),
1448
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1449 1449
 					'meta' => array(
1450
-							'title' => __('Not Approved', 'event_espresso' ),
1450
+							'title' => __('Not Approved', 'event_espresso'),
1451 1451
 							'target' => '',
1452 1452
 							'class' => $menu_class
1453 1453
 					),
@@ -1456,12 +1456,12 @@  discard block
 block discarded – undo
1456 1456
 
1457 1457
 
1458 1458
 		//Registration Overview This Month Cancelled
1459
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1459
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1460 1460
 			$admin_bar->add_menu(array(
1461 1461
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1462 1462
 					'parent' => 'espresso-toolbar-registrations-month',
1463 1463
 					'title' => __('Cancelled', 'event_espresso'),
1464
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1464
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1465 1465
 					'meta' => array(
1466 1466
 							'title' => __('Cancelled', 'event_espresso'),
1467 1467
 							'target' => '',
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1483 1483
 	 * @return array
1484 1484
 	 */
1485
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1486
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1485
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1486
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1487 1487
 	}
1488 1488
 
1489 1489
 
@@ -1503,11 +1503,11 @@  discard block
 block discarded – undo
1503 1503
 	 */
1504 1504
 	public function wp_enqueue_scripts() {
1505 1505
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1506
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1506
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1507 1507
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1508
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1508
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1509 1509
 				// register jQuery Validate
1510
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1510
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1511 1511
 			}
1512 1512
 		}
1513 1513
 	}
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -578,7 +580,7 @@  discard block
 block discarded – undo
578 580
 				$espresso_db_update =  array( $espresso_db_update=>array() );
579 581
 				update_option( 'espresso_db_update', $espresso_db_update );
580 582
 			}
581
-		}else{
583
+		} else{
582 584
 			$corrected_db_update = array();
583 585
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584 586
 			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
@@ -588,7 +590,7 @@  discard block
 block discarded – undo
588 590
 					//fix it!
589 591
 					$version_string = $should_be_array;
590 592
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
593
+				} else{
592 594
 					//ok it checks out
593 595
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 596
 				}
@@ -633,7 +635,7 @@  discard block
 block discarded – undo
633 635
 					$addon->initialize_db_if_no_migrations_required();
634 636
 				}
635 637
 			}
636
-		}else{
638
+		} else{
637 639
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
638 640
 		}
639 641
 		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
 				//it a version we haven't seen before
704 706
 				if( $version_is_higher === 1 ){
705 707
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
708
+				} else{
707 709
 					$req_type = EE_System::req_type_downgrade;
708 710
 				}
709 711
 				delete_option( $activation_indicator_option_name );
@@ -712,10 +714,10 @@  discard block
 block discarded – undo
712 714
 				if( get_option( $activation_indicator_option_name, FALSE ) ){
713 715
 					if ( $version_is_higher === -1 ){
714 716
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
717
+					} elseif( $version_is_higher === 0 ){
716 718
 						//we've seen this version before, but it's an activation. must be a reactivation
717 719
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
720
+					} else{//$version_is_higher === 1
719 721
 						$req_type = EE_System::req_type_upgrade;
720 722
 					}
721 723
 					delete_option( $activation_indicator_option_name );
@@ -723,10 +725,10 @@  discard block
 block discarded – undo
723 725
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724 726
 					if ( $version_is_higher === -1 ){
725 727
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
728
+					} elseif( $version_is_higher === 0 ){
727 729
 						//we've seen this version before and it's not an activation. its normal request
728 730
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
731
+					} else{//$version_is_higher === 1
730 732
 						$req_type = EE_System::req_type_upgrade;
731 733
 					}
732 734
 				}
Please login to merge, or discard this patch.
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 
469 469
 
470 470
 	/**
471
-	* load_espresso_addons
472
-	*
473
-	* allow addons to load first so that they can set hooks for running DMS's, etc
474
-	*
475
-	* @access public
476
-	* @return void
477
-	*/
471
+	 * load_espresso_addons
472
+	 *
473
+	 * allow addons to load first so that they can set hooks for running DMS's, etc
474
+	 *
475
+	 * @access public
476
+	 * @return void
477
+	 */
478 478
 	public function load_espresso_addons() {
479 479
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
480 480
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 	}
500 500
 	/**
501
-	* detect_if_activation_or_upgrade
502
-	*
503
-	* Takes care of detecting whether this is a brand new install or code upgrade,
504
-	* and either setting up the DB or setting up maintenance mode etc.
505
-	*
506
-	* @access private
507
-	* @return void
508
-	*/
501
+	 * detect_if_activation_or_upgrade
502
+	 *
503
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
504
+	 * and either setting up the DB or setting up maintenance mode etc.
505
+	 *
506
+	 * @access private
507
+	 * @return void
508
+	 */
509 509
 	public function detect_if_activation_or_upgrade() {
510 510
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
511 511
 
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 			$query_params =  array( 'page' => 'espresso_about' );
804 804
 
805 805
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
806
-			    $query_params['new_activation'] = TRUE;
806
+				$query_params['new_activation'] = TRUE;
807 807
 			}
808 808
 
809 809
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
810
-			    $query_params['reactivation'] = TRUE;
810
+				$query_params['reactivation'] = TRUE;
811 811
 			}
812 812
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
813 813
 			wp_safe_redirect( $url );
@@ -888,13 +888,13 @@  discard block
 block discarded – undo
888 888
 
889 889
 
890 890
 	/**
891
-	* register_shortcodes_modules_and_widgets
892
-	*
893
-	* generate lists of shortcodes and modules, then verify paths and classes
894
-	*
895
-	* @access public
896
-	* @return void
897
-	*/
891
+	 * register_shortcodes_modules_and_widgets
892
+	 *
893
+	 * generate lists of shortcodes and modules, then verify paths and classes
894
+	 *
895
+	 * @access public
896
+	 * @return void
897
+	 */
898 898
 	public function register_shortcodes_modules_and_widgets() {
899 899
 		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
900 900
 		// check for addons using old hookpoint
@@ -905,11 +905,11 @@  discard block
 block discarded – undo
905 905
 
906 906
 
907 907
 	/**
908
-	* _incompatible_addon_error
909
-	*
910
-	* @access public
911
-	* @return void
912
-	*/
908
+	 * _incompatible_addon_error
909
+	 *
910
+	 * @access public
911
+	 * @return void
912
+	 */
913 913
 	private function _incompatible_addon_error() {
914 914
 		// get array of classes hooking into here
915 915
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -1048,14 +1048,14 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 
1050 1050
 	/**
1051
-	* load_controllers
1052
-	*
1053
-	* this is the best place to load any additional controllers that needs access to EE core.
1054
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
-	*
1056
-	* @access public
1057
-	* @return void
1058
-	*/
1051
+	 * load_controllers
1052
+	 *
1053
+	 * this is the best place to load any additional controllers that needs access to EE core.
1054
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
1055
+	 *
1056
+	 * @access public
1057
+	 * @return void
1058
+	 */
1059 1059
 	public function load_controllers() {
1060 1060
 		do_action( 'AHEE__EE_System__load_controllers__start' );
1061 1061
 		// let's get it started
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
 	/**
1075
-	* core_loaded_and_ready
1076
-	*
1077
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
-	*
1079
-	* @access public
1080
-	* @return void
1081
-	*/
1075
+	 * core_loaded_and_ready
1076
+	 *
1077
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
1078
+	 *
1079
+	 * @access public
1080
+	 * @return void
1081
+	 */
1082 1082
 	public function core_loaded_and_ready() {
1083 1083
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
1084 1084
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -1089,13 +1089,13 @@  discard block
 block discarded – undo
1089 1089
 
1090 1090
 
1091 1091
 	/**
1092
-	* initialize
1093
-	*
1094
-	* this is the best place to begin initializing client code
1095
-	*
1096
-	* @access public
1097
-	* @return void
1098
-	*/
1092
+	 * initialize
1093
+	 *
1094
+	 * this is the best place to begin initializing client code
1095
+	 *
1096
+	 * @access public
1097
+	 * @return void
1098
+	 */
1099 1099
 	public function initialize() {
1100 1100
 		do_action( 'AHEE__EE_System__initialize' );
1101 1101
 //		EE_Cron_Tasks::check_for_abandoned_transactions( 802 );
@@ -1104,13 +1104,13 @@  discard block
 block discarded – undo
1104 1104
 
1105 1105
 
1106 1106
 	/**
1107
-	* initialize_last
1108
-	*
1109
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
-	*
1111
-	* @access public
1112
-	* @return void
1113
-	*/
1107
+	 * initialize_last
1108
+	 *
1109
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
1110
+	 *
1111
+	 * @access public
1112
+	 * @return void
1113
+	 */
1114 1114
 	public function initialize_last() {
1115 1115
 		do_action( 'AHEE__EE_System__initialize_last' );
1116 1116
 	}
@@ -1119,14 +1119,14 @@  discard block
 block discarded – undo
1119 1119
 
1120 1120
 
1121 1121
 	/**
1122
-	* set_hooks_for_shortcodes_modules_and_addons
1123
-	*
1124
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
-	* this happens at the very beginning of the wp_loaded hookpoint
1126
-	*
1127
-	* @access public
1128
-	* @return void
1129
-	*/
1122
+	 * set_hooks_for_shortcodes_modules_and_addons
1123
+	 *
1124
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
1125
+	 * this happens at the very beginning of the wp_loaded hookpoint
1126
+	 *
1127
+	 * @access public
1128
+	 * @return void
1129
+	 */
1130 1130
 	public function set_hooks_for_shortcodes_modules_and_addons() {
1131 1131
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
1132 1132
 	}
@@ -1135,13 +1135,13 @@  discard block
 block discarded – undo
1135 1135
 
1136 1136
 
1137 1137
 	/**
1138
-	* do_not_cache
1139
-	*
1140
-	* sets no cache headers and defines no cache constants for WP plugins
1141
-	*
1142
-	* @access public
1143
-	* @return void
1144
-	*/
1138
+	 * do_not_cache
1139
+	 *
1140
+	 * sets no cache headers and defines no cache constants for WP plugins
1141
+	 *
1142
+	 * @access public
1143
+	 * @return void
1144
+	 */
1145 1145
 	public static function do_not_cache() {
1146 1146
 		// set no cache constants
1147 1147
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -630,6 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * 	@access public
631 631
 	 * 	@static
632 632
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
633
+	 * @param string $table_name
633 634
 	 * 	@return array of database column names
634 635
 	 */
635 636
 	public static function get_fields_on_table( $table_name = NULL ) {
@@ -699,7 +700,7 @@  discard block
 block discarded – undo
699 700
 	 * @access public
700 701
 	 * @static
701 702
 	 * @throws EE_Error
702
-	 * @return boolean success (whether database is setup properly or not)
703
+	 * @return false|null success (whether database is setup properly or not)
703 704
 	 */
704 705
 	public static function create_database_tables() {
705 706
 		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
Please login to merge, or discard this patch.
Braces   +17 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -125,15 +127,15 @@  discard block
 block discarded – undo
125 127
 		);
126 128
 		if( $which_to_include === 'all' ) {
127 129
 			//leave as-is
128
-		}elseif( $which_to_include === 'old' ) {
130
+		} elseif( $which_to_include === 'old' ) {
129 131
 			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
130 132
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
131 133
 			});
132
-		}elseif( $which_to_include === 'current' ) {
134
+		} elseif( $which_to_include === 'current' ) {
133 135
 			$cron_tasks = array_filter( $cron_tasks );
134
-		}elseif( WP_DEBUG ) {
136
+		} elseif( WP_DEBUG ) {
135 137
 			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
136
-		}else{
138
+		} else{
137 139
 			//leave as-is
138 140
 		}
139 141
 		return $cron_tasks;
@@ -386,7 +388,7 @@  discard block
 block discarded – undo
386 388
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
387 389
 		if($post_id){
388 390
 			return get_post($post_id);
389
-		}else{
391
+		} else{
390 392
 			return NULL;
391 393
 		}
392 394
 
@@ -552,7 +554,7 @@  discard block
 block discarded – undo
552 554
 		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
553 555
 			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
554 556
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
555
-			}else{
557
+			} else{
556 558
 				//so we should be more cautious rather than just dropping tables so easily
557 559
 				EE_Error::add_persistent_admin_notice(
558 560
 						'bad_table_' . $wp_table_name . '_detected',
@@ -715,13 +717,13 @@  discard block
 block discarded – undo
715 717
 					foreach( $current_data_migration_script->get_errors() as $error ){
716 718
 						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
717 719
 					}
718
-				}else{
720
+				} else{
719 721
 					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
720 722
 				}
721 723
 				return FALSE;
722 724
 			}
723 725
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
724
-		}else{
726
+		} else{
725 727
 			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
726 728
 			return FALSE;
727 729
 		}
@@ -1010,7 +1012,7 @@  discard block
 block discarded – undo
1010 1012
 		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1011 1013
 			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1012 1014
 			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1013
-		}else{
1015
+		} else{
1014 1016
 			EEM_Payment_Method::instance()->verify_button_urls();
1015 1017
 		}
1016 1018
 	}
@@ -1159,7 +1161,9 @@  discard block
 block discarded – undo
1159 1161
 		//do an initial loop to determine if we need to continue
1160 1162
 		$def_ms = array();
1161 1163
 		foreach ( $default_messengers as $msgr ) {
1162
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1164
+			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) {
1165
+				continue;
1166
+			}
1163 1167
 			$def_ms[] = $msgr;
1164 1168
 		}
1165 1169
 
@@ -1485,7 +1489,7 @@  discard block
 block discarded – undo
1485 1489
 				if( ! delete_option( $option_name ) ){
1486 1490
 					$undeleted_options[] = $option_name;
1487 1491
 				}
1488
-			}else{
1492
+			} else{
1489 1493
 				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1490 1494
 				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1491 1495
 					if( ! delete_option( $option_name_from_wildcard ) ){
@@ -1551,7 +1555,7 @@  discard block
 block discarded – undo
1551 1555
 		$EZSQL_ERROR = $ezsql_error_cache;
1552 1556
 		if( empty( $new_error ) ){
1553 1557
 			return TRUE;
1554
-		}else{
1558
+		} else{
1555 1559
 			return FALSE;
1556 1560
 		}
1557 1561
 	}
Please login to merge, or discard this patch.
Spacing   +316 added lines, -316 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * be called on plugin activation and reactivation
64 64
 	 * @return boolean success, whether the database and folders are setup properly
65 65
 	 */
66
-	public static function initialize_db_and_folders(){
66
+	public static function initialize_db_and_folders() {
67 67
 		$good_filesystem = EEH_Activation::create_upload_directories();
68 68
 		$good_db = EEH_Activation::create_database_tables();
69 69
 		return $good_filesystem && $good_db;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 * upon activation of a new plugin, reactivation, and at the end
78 78
 	 * of running migration scripts
79 79
 	 */
80
-	public static function initialize_db_content(){
80
+	public static function initialize_db_content() {
81 81
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
82
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
82
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
83 83
 			return;
84 84
 		}
85 85
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		EEH_Activation::remove_cron_tasks();
97 97
 		EEH_Activation::create_cron_tasks();
98 98
 		//also, check for CAF default db content
99
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
99
+		do_action('AHEE__EEH_Activation__initialize_db_content');
100 100
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
101 101
 		//which users really won't care about on initial activation
102 102
 		EE_Error::overwrite_success();
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @return array
115 115
 	 * @throws \EE_Error
116 116
 	 */
117
-	public static function get_cron_tasks( $which_to_include ) {
117
+	public static function get_cron_tasks($which_to_include) {
118 118
 		$cron_tasks = apply_filters(
119 119
 			'FHEE__EEH_Activation__get_cron_tasks',
120 120
 			array(
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 //				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions' => EEH_Activation::cron_task_no_longer_in_use, actually this is still in use
123 123
 			)
124 124
 		);
125
-		if( $which_to_include === 'all' ) {
125
+		if ($which_to_include === 'all') {
126 126
 			//leave as-is
127
-		}elseif( $which_to_include === 'old' ) {
128
-			$cron_tasks = array_filter( $cron_tasks, function ( $value ) {
127
+		}elseif ($which_to_include === 'old') {
128
+			$cron_tasks = array_filter($cron_tasks, function($value) {
129 129
 				return $value === EEH_Activation::cron_task_no_longer_in_use;
130 130
 			});
131
-		}elseif( $which_to_include === 'current' ) {
132
-			$cron_tasks = array_filter( $cron_tasks );
133
-		}elseif( WP_DEBUG ) {
134
-			throw new EE_Error( sprintf( __( 'Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso' ), $which_to_include ) );
135
-		}else{
131
+		}elseif ($which_to_include === 'current') {
132
+			$cron_tasks = array_filter($cron_tasks);
133
+		}elseif (WP_DEBUG) {
134
+			throw new EE_Error(sprintf(__('Invalidate argument of "%1$s" passed to EEH_Activation::get_cron_tasks. Valid values are "all", "old" and "current".', 'event_espresso'), $which_to_include));
135
+		} else {
136 136
 			//leave as-is
137 137
 		}
138 138
 		return $cron_tasks;
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public static function create_cron_tasks() {
145 145
 
146
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
147
-			if( ! wp_next_scheduled( $hook_name ) ) {
148
-				wp_schedule_event( time(), $frequency, $hook_name );
146
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
147
+			if ( ! wp_next_scheduled($hook_name)) {
148
+				wp_schedule_event(time(), $frequency, $hook_name);
149 149
 			}
150 150
 		}
151 151
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * Remove the currently-existing and now-removed cron tasks.
156 156
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
157 157
 	 */
158
-	public static function remove_cron_tasks( $remove_all = true ) {
158
+	public static function remove_cron_tasks($remove_all = true) {
159 159
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
160
-		foreach( EEH_Activation::get_cron_tasks( $cron_tasks_to_remove ) as $hook_name => $frequency ) {
161
-			while( $scheduled_time = wp_next_scheduled( $hook_name ) ) {
162
-				wp_unschedule_event( $scheduled_time, $hook_name );
160
+		foreach (EEH_Activation::get_cron_tasks($cron_tasks_to_remove) as $hook_name => $frequency) {
161
+			while ($scheduled_time = wp_next_scheduled($hook_name)) {
162
+				wp_unschedule_event($scheduled_time, $hook_name);
163 163
 			}
164 164
 		}
165 165
 	}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public static function CPT_initialization() {
178 178
 		// register Custom Post Types
179
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
179
+		EE_Registry::instance()->load_core('Register_CPTs');
180 180
 		flush_rewrite_rules();
181 181
 	}
182 182
 
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public static function deactivate_event_espresso() {
194 194
 		// check permissions
195
-		if ( current_user_can( 'activate_plugins' )) {
196
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
195
+		if (current_user_can('activate_plugins')) {
196
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
197 197
 		}
198 198
 	}
199 199
 
@@ -215,79 +215,79 @@  discard block
 block discarded – undo
215 215
 		$critical_pages = array(
216 216
 			array(
217 217
 				'id' =>'reg_page_id',
218
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
218
+				'name' => __('Registration Checkout', 'event_espresso'),
219 219
 				'post' => NULL,
220 220
 				'code' => 'ESPRESSO_CHECKOUT'
221 221
 			),
222 222
 			array(
223 223
 				'id' => 'txn_page_id',
224
-				'name' => __( 'Transactions', 'event_espresso' ),
224
+				'name' => __('Transactions', 'event_espresso'),
225 225
 				'post' => NULL,
226 226
 				'code' => 'ESPRESSO_TXN_PAGE'
227 227
 			),
228 228
 			array(
229 229
 				'id' => 'thank_you_page_id',
230
-				'name' => __( 'Thank You', 'event_espresso' ),
230
+				'name' => __('Thank You', 'event_espresso'),
231 231
 				'post' => NULL,
232 232
 				'code' => 'ESPRESSO_THANK_YOU'
233 233
 			),
234 234
 			array(
235 235
 				'id' => 'cancel_page_id',
236
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
236
+				'name' => __('Registration Cancelled', 'event_espresso'),
237 237
 				'post' => NULL,
238 238
 				'code' => 'ESPRESSO_CANCELLED'
239 239
 			),
240 240
 		);
241 241
 
242
-		foreach ( $critical_pages as $critical_page ) {
242
+		foreach ($critical_pages as $critical_page) {
243 243
 			// is critical page ID set in config ?
244
-			if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) {
244
+			if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) {
245 245
 				// attempt to find post by ID
246
-				$critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] );
246
+				$critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']);
247 247
 			}
248 248
 			// no dice?
249
-			if ( $critical_page['post'] == NULL ) {
249
+			if ($critical_page['post'] == NULL) {
250 250
 				// attempt to find post by title
251
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
251
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
252 252
 				// still nothing?
253
-				if ( $critical_page['post'] == NULL ) {
254
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
253
+				if ($critical_page['post'] == NULL) {
254
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
255 255
 					// REALLY? Still nothing ??!?!?
256
-					if ( $critical_page['post'] == NULL ) {
257
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
258
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
256
+					if ($critical_page['post'] == NULL) {
257
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
258
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
259 259
 						break;
260 260
 					}
261 261
 				}
262 262
 			}
263 263
 			// track post_shortcodes
264
-			if ( $critical_page['post'] ) {
265
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
264
+			if ($critical_page['post']) {
265
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
266 266
 			}
267 267
 			// check that Post ID matches critical page ID in config
268
-			if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) {
268
+			if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) {
269 269
 				//update Config with post ID
270 270
 				EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID;
271
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
272
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
273
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
271
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
272
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
273
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
274 274
 				}
275 275
 			}
276 276
 
277
-			$critical_page_problem =  ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem;
277
+			$critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem;
278 278
 
279 279
 		}
280 280
 
281
-		if ( $critical_page_problem ) {
281
+		if ($critical_page_problem) {
282 282
 			$msg = sprintf(
283
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
284
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
283
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
284
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
285 285
 			);
286
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
286
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
287 287
 		}
288 288
 
289
-		if ( EE_Error::has_notices() ) {
290
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
289
+		if (EE_Error::has_notices()) {
290
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
291 291
 		}
292 292
 
293 293
 	}
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 	 * parameter to the shortcode
301 301
 	 * @return WP_Post or NULl
302 302
 	 */
303
-	public static function get_page_by_ee_shortcode($ee_shortcode){
303
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
304 304
 		global $wpdb;
305 305
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
306 306
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
307
-		if($post_id){
307
+		if ($post_id) {
308 308
 			return get_post($post_id);
309
-		}else{
309
+		} else {
310 310
 			return NULL;
311 311
 		}
312 312
 
@@ -323,32 +323,32 @@  discard block
 block discarded – undo
323 323
 	 * @param array $critical_page
324 324
 	 * @return array
325 325
 	 */
326
-	public static function create_critical_page( $critical_page ) {
326
+	public static function create_critical_page($critical_page) {
327 327
 
328 328
 		$post_args = array(
329 329
 			'post_title' => $critical_page['name'],
330 330
 			'post_status' => 'publish',
331 331
 			'post_type' => 'page',
332 332
 			'comment_status' => 'closed',
333
-			'post_content' => '[' . $critical_page['code'] . ']'
333
+			'post_content' => '['.$critical_page['code'].']'
334 334
 		);
335 335
 
336
-		$post_id = wp_insert_post( $post_args );
337
-		if ( ! $post_id ) {
336
+		$post_id = wp_insert_post($post_args);
337
+		if ( ! $post_id) {
338 338
 			$msg = sprintf(
339
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
339
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
340 340
 				$critical_page['name']
341 341
 			);
342
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
342
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
343 343
 			return $critical_page;
344 344
 		}
345 345
 		// get newly created post's details
346
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
346
+		if ( ! $critical_page['post'] = get_post($post_id)) {
347 347
 			$msg = sprintf(
348
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
348
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
349 349
 				$critical_page['name']
350 350
 			);
351
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
351
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
352 352
 		}
353 353
 
354 354
 		return $critical_page;
@@ -367,34 +367,34 @@  discard block
 block discarded – undo
367 367
 	 * @param array $critical_page
368 368
 	 * @return void
369 369
 	 */
370
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
370
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
371 371
 		// check the goods
372
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
372
+		if ( ! $critical_page['post'] instanceof WP_Post) {
373 373
 			$msg = sprintf(
374
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
374
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
375 375
 				$critical_page['name']
376 376
 			);
377
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
377
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
378 378
 			return;
379 379
 		}
380 380
 		// map shortcode to post
381
-		EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
381
+		EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
382 382
 		// and make sure it's NOT added to the WP "Posts Page"
383 383
 		// name of the WP Posts Page
384 384
 		$posts_page = EE_Registry::instance()->CFG->get_page_for_posts();
385
-		if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) {
386
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
385
+		if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) {
386
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]);
387 387
 		}
388
-		if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) {
389
-			unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] );
388
+		if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) {
389
+			unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]);
390 390
 		}
391 391
 		// update post_shortcode CFG
392
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
392
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
393 393
 			$msg = sprintf(
394
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
394
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
395 395
 				$critical_page['name']
396 396
 			);
397
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
397
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
398 398
 		}
399 399
 	}
400 400
 
@@ -412,24 +412,24 @@  discard block
 block discarded – undo
412 412
 	public static function get_default_creator_id() {
413 413
 		global $wpdb;
414 414
 
415
-		if ( ! empty( self::$_default_creator_id ) ) {
415
+		if ( ! empty(self::$_default_creator_id)) {
416 416
 			return self::$_default_creator_id;
417 417
 		}/**/
418 418
 
419
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
419
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
420 420
 
421 421
 		//let's allow pre_filtering for early exits by altenative methods for getting id.  We check for truthy result and if so then exit early.
422
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
423
-		if ( $pre_filtered_id !== false ) {
422
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
423
+		if ($pre_filtered_id !== false) {
424 424
 			return (int) $pre_filtered_id;
425 425
 		}
426 426
 
427
-		$capabilities_key = $wpdb->prefix . 'capabilities';
428
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
429
-		$user_id = $wpdb->get_var( $query );
430
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
431
-		 if ( $user_id && intval( $user_id ) ) {
432
-		 	self::$_default_creator_id =  intval( $user_id );
427
+		$capabilities_key = $wpdb->prefix.'capabilities';
428
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
429
+		$user_id = $wpdb->get_var($query);
430
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
431
+		 if ($user_id && intval($user_id)) {
432
+		 	self::$_default_creator_id = intval($user_id);
433 433
 		 	return self::$_default_creator_id;
434 434
 		 } else {
435 435
 		 	return NULL;
@@ -456,27 +456,27 @@  discard block
 block discarded – undo
456 456
 	 * 	@return void
457 457
 	 * @throws EE_Error if there are database errors
458 458
 	 */
459
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ',$drop_table_if_pre_existed = false ) {
459
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_table_if_pre_existed = false) {
460 460
 //		echo "create table $table_name ". ($drop_table_if_pre_existed? 'but first nuke preexisting one' : 'or update it if it exists') . "<br>";//die;
461
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
461
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
462 462
 			return;
463 463
 		}
464
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
465
-		if ( ! function_exists( 'dbDelta' )) {
466
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
464
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
465
+		if ( ! function_exists('dbDelta')) {
466
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
467 467
 		}
468 468
 		/** @var WPDB $wpdb */
469 469
 		global $wpdb;
470
-		$wp_table_name = $wpdb->prefix . $table_name;
470
+		$wp_table_name = $wpdb->prefix.$table_name;
471 471
 		//		if(in_array(EE_System::instance()->detect_req_type(),array(EE_System::req_type_new_activation,  EE_System::req_t) )
472
-		if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){
473
-			if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
472
+		if ($drop_table_if_pre_existed && EEH_Activation::table_exists($wp_table_name)) {
473
+			if (defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
474 474
 				$wpdb->query("DROP TABLE IF EXISTS $wp_table_name ");
475
-			}else{
475
+			} else {
476 476
 				//so we should be more cautious rather than just dropping tables so easily
477 477
 				EE_Error::add_persistent_admin_notice(
478
-						'bad_table_' . $wp_table_name . '_detected',
479
-						sprintf( __( 'Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
478
+						'bad_table_'.$wp_table_name.'_detected',
479
+						sprintf(__('Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
480 480
 								$wp_table_name,
481 481
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
482 482
 								'<b>wp-config.php</b>',
@@ -485,25 +485,25 @@  discard block
 block discarded – undo
485 485
 			}
486 486
 		}
487 487
 // does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
488
-if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
488
+if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
489 489
 	$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
490 490
 	//get $wpdb to echo errors, but buffer them. This way at least WE know an error
491 491
 	//happened. And then we can choose to tell the end user
492
-	$old_show_errors_policy = $wpdb->show_errors( TRUE );
493
-	$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
492
+	$old_show_errors_policy = $wpdb->show_errors(TRUE);
493
+	$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
494 494
 	ob_start();
495
-	dbDelta( $SQL );
495
+	dbDelta($SQL);
496 496
 	$output = ob_get_contents();
497 497
 	ob_end_clean();
498
-	$wpdb->show_errors( $old_show_errors_policy );
499
-	$wpdb->suppress_errors( $old_error_suppression_policy );
500
-	if( ! empty( $output ) ){
501
-		throw new EE_Error( $output	);
498
+	$wpdb->show_errors($old_show_errors_policy);
499
+	$wpdb->suppress_errors($old_error_suppression_policy);
500
+	if ( ! empty($output)) {
501
+		throw new EE_Error($output);
502 502
 	}
503 503
 } else {
504 504
 	throw new EE_Error(
505 505
 		sprintf(
506
-			__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
506
+			__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
507 507
 			'<br />',
508 508
 			$sql
509 509
 		)
@@ -525,15 +525,15 @@  discard block
 block discarded – undo
525 525
 	 * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)'
526 526
 	 * @return bool|int
527 527
 	 */
528
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
529
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
528
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
529
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
530 530
 			return FALSE;
531 531
 		}
532 532
 		global $wpdb;
533
-		$full_table_name=$wpdb->prefix.$table_name;
533
+		$full_table_name = $wpdb->prefix.$table_name;
534 534
 		$fields = self::get_fields_on_table($table_name);
535
-		if (!in_array($column_name, $fields)){
536
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
535
+		if ( ! in_array($column_name, $fields)) {
536
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
537 537
 			//echo "alter query:$alter_query";
538 538
 			return $wpdb->query($alter_query);
539 539
 		}
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
553 553
 	 * 	@return array of database column names
554 554
 	 */
555
-	public static function get_fields_on_table( $table_name = NULL ) {
555
+	public static function get_fields_on_table($table_name = NULL) {
556 556
 		global $wpdb;
557
-		$table_name=$wpdb->prefix.$table_name;
558
-		if ( ! empty( $table_name )) {
557
+		$table_name = $wpdb->prefix.$table_name;
558
+		if ( ! empty($table_name)) {
559 559
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
560 560
 			if ($columns !== FALSE) {
561 561
 				$field_array = array();
562
-				foreach($columns as $column ){
563
-					$field_array[] = $column->Field;;
562
+				foreach ($columns as $column) {
563
+					$field_array[] = $column->Field; ;
564 564
 				}
565 565
 				return $field_array;
566 566
 			}
@@ -578,10 +578,10 @@  discard block
 block discarded – undo
578 578
 	 * @param string $table_name
579 579
 	 * @return bool | int
580 580
 	 */
581
-	public static function delete_unused_db_table( $table_name ) {
581
+	public static function delete_unused_db_table($table_name) {
582 582
 		global $wpdb;
583
-		$table_name = strpos( $table_name, $wpdb->prefix ) === FALSE ? $wpdb->prefix . $table_name : $table_name;
584
-		return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
583
+		$table_name = strpos($table_name, $wpdb->prefix) === FALSE ? $wpdb->prefix.$table_name : $table_name;
584
+		return $wpdb->query("DROP TABLE IF EXISTS $table_name");
585 585
 	}
586 586
 
587 587
 
@@ -595,18 +595,18 @@  discard block
 block discarded – undo
595 595
 	 * @param string $index_name
596 596
 	 * @return bool | int
597 597
 	 */
598
-	public static function drop_index( $table_name, $index_name ) {
599
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
598
+	public static function drop_index($table_name, $index_name) {
599
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
600 600
 			return FALSE;
601 601
 		}
602 602
 		global $wpdb;
603
-		$table_name_with_prefix = $wpdb->prefix . $table_name ;
603
+		$table_name_with_prefix = $wpdb->prefix.$table_name;
604 604
 		$index_exists_query = "SHOW INDEX FROM $table_name_with_prefix WHERE Key_name = '$index_name'";
605 605
 		if (
606
-			$wpdb->get_var( "SHOW TABLES LIKE '$table_name_with_prefix'" ) == $wpdb->prefix . $table_name
607
-			&& $wpdb->get_var( $index_exists_query ) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
606
+			$wpdb->get_var("SHOW TABLES LIKE '$table_name_with_prefix'") == $wpdb->prefix.$table_name
607
+			&& $wpdb->get_var($index_exists_query) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name
608 608
 		) {
609
-			return $wpdb->query( "ALTER TABLE $table_name_with_prefix DROP INDEX $index_name" );
609
+			return $wpdb->query("ALTER TABLE $table_name_with_prefix DROP INDEX $index_name");
610 610
 		}
611 611
 		return TRUE;
612 612
 	}
@@ -622,27 +622,27 @@  discard block
 block discarded – undo
622 622
 	 * @return boolean success (whether database is setup properly or not)
623 623
 	 */
624 624
 	public static function create_database_tables() {
625
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
625
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
626 626
 		//find the migration script that sets the database to be compatible with the code
627 627
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
628
-		if( $dms_name ){
629
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
630
-			$current_data_migration_script->set_migrating( FALSE );
628
+		if ($dms_name) {
629
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
630
+			$current_data_migration_script->set_migrating(FALSE);
631 631
 			$current_data_migration_script->schema_changes_before_migration();
632 632
 			$current_data_migration_script->schema_changes_after_migration();
633
-			if( $current_data_migration_script->get_errors() ){
634
-				if( WP_DEBUG ){
635
-					foreach( $current_data_migration_script->get_errors() as $error ){
636
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
633
+			if ($current_data_migration_script->get_errors()) {
634
+				if (WP_DEBUG) {
635
+					foreach ($current_data_migration_script->get_errors() as $error) {
636
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
637 637
 					}
638
-				}else{
639
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
638
+				} else {
639
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
640 640
 				}
641 641
 				return FALSE;
642 642
 			}
643 643
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
644
-		}else{
645
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
644
+		} else {
645
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
646 646
 			return FALSE;
647 647
 		}
648 648
 	}
@@ -661,26 +661,26 @@  discard block
 block discarded – undo
661 661
 	public static function initialize_system_questions() {
662 662
 		// QUESTION GROUPS
663 663
 		global $wpdb;
664
-		$SQL = 'SELECT QSG_system FROM ' . $wpdb->prefix . 'esp_question_group WHERE QSG_system != 0';
664
+		$SQL = 'SELECT QSG_system FROM '.$wpdb->prefix.'esp_question_group WHERE QSG_system != 0';
665 665
 		// what we have
666
-		$question_groups = $wpdb->get_col( $SQL );
666
+		$question_groups = $wpdb->get_col($SQL);
667 667
 		// check the response
668
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
668
+		$question_groups = is_array($question_groups) ? $question_groups : array();
669 669
 		// what we should have
670
-		$QSG_systems = array( 1, 2 );
670
+		$QSG_systems = array(1, 2);
671 671
 		// loop thru what we should have and compare to what we have
672
-		foreach ( $QSG_systems as $QSG_system ) {
672
+		foreach ($QSG_systems as $QSG_system) {
673 673
 			// reset values array
674 674
 			$QSG_values = array();
675 675
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
676
-			if ( ! in_array( "$QSG_system", $question_groups )) {
676
+			if ( ! in_array("$QSG_system", $question_groups)) {
677 677
 				// add it
678
-				switch ( $QSG_system ) {
678
+				switch ($QSG_system) {
679 679
 
680 680
 					case 1:
681 681
 							$QSG_values = array(
682
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
683
-									'QSG_identifier' => 'personal-information-' . time(),
682
+									'QSG_name' => __('Personal Information', 'event_espresso'),
683
+									'QSG_identifier' => 'personal-information-'.time(),
684 684
 									'QSG_desc' => '',
685 685
 									'QSG_order' => 1,
686 686
 									'QSG_show_group_name' => 1,
@@ -692,8 +692,8 @@  discard block
 block discarded – undo
692 692
 
693 693
 					case 2:
694 694
 							$QSG_values = array(
695
-									'QSG_name' => __( 'Address Information','event_espresso' ),
696
-									'QSG_identifier' => 'address-information-' . time(),
695
+									'QSG_name' => __('Address Information', 'event_espresso'),
696
+									'QSG_identifier' => 'address-information-'.time(),
697 697
 									'QSG_desc' => '',
698 698
 									'QSG_order' => 2,
699 699
 									'QSG_show_group_name' => 1,
@@ -705,14 +705,14 @@  discard block
 block discarded – undo
705 705
 
706 706
 				}
707 707
 				// make sure we have some values before inserting them
708
-				if ( ! empty( $QSG_values )) {
708
+				if ( ! empty($QSG_values)) {
709 709
 					// insert system question
710 710
 					$wpdb->insert(
711
-						$wpdb->prefix . 'esp_question_group',
711
+						$wpdb->prefix.'esp_question_group',
712 712
 						$QSG_values,
713
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
713
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
714 714
 					);
715
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
715
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
716 716
 				}
717 717
 			}
718 718
 		}
@@ -721,9 +721,9 @@  discard block
 block discarded – undo
721 721
 
722 722
 		// QUESTIONS
723 723
 		global $wpdb;
724
-		$SQL = 'SELECT QST_system FROM ' . $wpdb->prefix . "esp_question WHERE QST_system != ''";
724
+		$SQL = 'SELECT QST_system FROM '.$wpdb->prefix."esp_question WHERE QST_system != ''";
725 725
 		// what we have
726
-		$questions = $wpdb->get_col( $SQL );
726
+		$questions = $wpdb->get_col($SQL);
727 727
 		// what we should have
728 728
 		$QST_systems = array(
729 729
 			'fname',
@@ -740,22 +740,22 @@  discard block
 block discarded – undo
740 740
 		$order_for_group_1 = 1;
741 741
 		$order_for_group_2 = 1;
742 742
 		// loop thru what we should have and compare to what we have
743
-		foreach ( $QST_systems as $QST_system ) {
743
+		foreach ($QST_systems as $QST_system) {
744 744
 			// reset values array
745 745
 			$QST_values = array();
746 746
 			// if we don't have what we should have
747
-			if ( ! in_array( $QST_system, $questions )) {
747
+			if ( ! in_array($QST_system, $questions)) {
748 748
 				// add it
749
-				switch ( $QST_system ) {
749
+				switch ($QST_system) {
750 750
 
751 751
 					case 'fname':
752 752
 							$QST_values = array(
753
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
754
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
753
+									'QST_display_text' => __('First Name', 'event_espresso'),
754
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
755 755
 									'QST_system' => 'fname',
756 756
 									'QST_type' => 'TEXT',
757 757
 									'QST_required' => 1,
758
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
758
+									'QST_required_text' => __('This field is required', 'event_espresso'),
759 759
 									'QST_order' => 1,
760 760
 									'QST_admin_only' => 0,
761 761
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -765,12 +765,12 @@  discard block
 block discarded – undo
765 765
 
766 766
 					case 'lname':
767 767
 							$QST_values = array(
768
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
769
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
768
+									'QST_display_text' => __('Last Name', 'event_espresso'),
769
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
770 770
 									'QST_system' => 'lname',
771 771
 									'QST_type' => 'TEXT',
772 772
 									'QST_required' => 1,
773
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
773
+									'QST_required_text' => __('This field is required', 'event_espresso'),
774 774
 									'QST_order' => 2,
775 775
 									'QST_admin_only' => 0,
776 776
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -780,12 +780,12 @@  discard block
 block discarded – undo
780 780
 
781 781
 					case 'email':
782 782
 							$QST_values = array(
783
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
784
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
783
+									'QST_display_text' => __('Email Address', 'event_espresso'),
784
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
785 785
 									'QST_system' => 'email',
786 786
 									'QST_type' => 'TEXT',
787 787
 									'QST_required' => 1,
788
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
788
+									'QST_required_text' => __('This field is required', 'event_espresso'),
789 789
 									'QST_order' => 3,
790 790
 									'QST_admin_only' => 0,
791 791
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -795,12 +795,12 @@  discard block
 block discarded – undo
795 795
 
796 796
 					case 'address':
797 797
 							$QST_values = array(
798
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
799
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
798
+									'QST_display_text' => __('Address', 'event_espresso'),
799
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
800 800
 									'QST_system' => 'address',
801 801
 									'QST_type' => 'TEXT',
802 802
 									'QST_required' => 0,
803
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
803
+									'QST_required_text' => __('This field is required', 'event_espresso'),
804 804
 									'QST_order' => 4,
805 805
 									'QST_admin_only' => 0,
806 806
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -810,12 +810,12 @@  discard block
 block discarded – undo
810 810
 
811 811
 					case 'address2':
812 812
 							$QST_values = array(
813
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
814
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
813
+									'QST_display_text' => __('Address2', 'event_espresso'),
814
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
815 815
 									'QST_system' => 'address2',
816 816
 									'QST_type' => 'TEXT',
817 817
 									'QST_required' => 0,
818
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
818
+									'QST_required_text' => __('This field is required', 'event_espresso'),
819 819
 									'QST_order' => 5,
820 820
 									'QST_admin_only' => 0,
821 821
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -825,12 +825,12 @@  discard block
 block discarded – undo
825 825
 
826 826
 					case 'city':
827 827
 							$QST_values = array(
828
-									'QST_display_text' => __( 'City', 'event_espresso' ),
829
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
828
+									'QST_display_text' => __('City', 'event_espresso'),
829
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
830 830
 									'QST_system' => 'city',
831 831
 									'QST_type' => 'TEXT',
832 832
 									'QST_required' => 0,
833
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
833
+									'QST_required_text' => __('This field is required', 'event_espresso'),
834 834
 									'QST_order' => 6,
835 835
 									'QST_admin_only' => 0,
836 836
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -840,12 +840,12 @@  discard block
 block discarded – undo
840 840
 
841 841
 					case 'state':
842 842
 							$QST_values = array(
843
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
844
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
843
+									'QST_display_text' => __('State/Province', 'event_espresso'),
844
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
845 845
 									'QST_system' => 'state',
846 846
 									'QST_type' => 'STATE',
847 847
 									'QST_required' => 0,
848
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
848
+									'QST_required_text' => __('This field is required', 'event_espresso'),
849 849
 									'QST_order' => 7,
850 850
 									'QST_admin_only' => 0,
851 851
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -855,12 +855,12 @@  discard block
 block discarded – undo
855 855
 
856 856
 					case 'country' :
857 857
 							$QST_values = array(
858
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
859
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
858
+									'QST_display_text' => __('Country', 'event_espresso'),
859
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
860 860
 									'QST_system' => 'country',
861 861
 									'QST_type' => 'COUNTRY',
862 862
 									'QST_required' => 0,
863
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
863
+									'QST_required_text' => __('This field is required', 'event_espresso'),
864 864
 									'QST_order' => 8,
865 865
 									'QST_admin_only' => 0,
866 866
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -870,12 +870,12 @@  discard block
 block discarded – undo
870 870
 
871 871
 					case 'zip':
872 872
 							$QST_values = array(
873
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
874
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
873
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
874
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
875 875
 									'QST_system' => 'zip',
876 876
 									'QST_type' => 'TEXT',
877 877
 									'QST_required' => 0,
878
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
878
+									'QST_required_text' => __('This field is required', 'event_espresso'),
879 879
 									'QST_order' => 9,
880 880
 									'QST_admin_only' => 0,
881 881
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -885,12 +885,12 @@  discard block
 block discarded – undo
885 885
 
886 886
 					case 'phone':
887 887
 							$QST_values = array(
888
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
889
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
888
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
889
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
890 890
 									'QST_system' => 'phone',
891 891
 									'QST_type' => 'TEXT',
892 892
 									'QST_required' => 0,
893
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
893
+									'QST_required_text' => __('This field is required', 'event_espresso'),
894 894
 									'QST_order' => 10,
895 895
 									'QST_admin_only' => 0,
896 896
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -899,22 +899,22 @@  discard block
 block discarded – undo
899 899
 						break;
900 900
 
901 901
 				}
902
-				if ( ! empty( $QST_values )) {
902
+				if ( ! empty($QST_values)) {
903 903
 					// insert system question
904 904
 					$wpdb->insert(
905
-						$wpdb->prefix . 'esp_question',
905
+						$wpdb->prefix.'esp_question',
906 906
 						$QST_values,
907
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
907
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
908 908
 					);
909 909
 					$QST_ID = $wpdb->insert_id;
910 910
 
911 911
 					// QUESTION GROUP QUESTIONS
912
-					$QSG_ID = in_array( $QST_system, array('fname','lname','email')) ? 1 : 2;
912
+					$QSG_ID = in_array($QST_system, array('fname', 'lname', 'email')) ? 1 : 2;
913 913
 					// add system questions to groups
914 914
 					$wpdb->insert(
915
-						$wpdb->prefix . 'esp_question_group_question',
916
-						array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ),
917
-						array( '%d', '%d','%d' )
915
+						$wpdb->prefix.'esp_question_group_question',
916
+						array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++),
917
+						array('%d', '%d', '%d')
918 918
 					);
919 919
 				}
920 920
 			}
@@ -926,11 +926,11 @@  discard block
 block discarded – undo
926 926
 	 * Makes sure the default payment method (Invoice) is active.
927 927
 	 * This used to be done automatically as part of constructing the old gateways config
928 928
 	 */
929
-	public static function insert_default_payment_methods(){
930
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
931
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
932
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
933
-		}else{
929
+	public static function insert_default_payment_methods() {
930
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
931
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
932
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
933
+		} else {
934 934
 			EEM_Payment_Method::instance()->verify_button_urls();
935 935
 		}
936 936
 	}
@@ -946,12 +946,12 @@  discard block
 block discarded – undo
946 946
 
947 947
 		global $wpdb;
948 948
 
949
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
949
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
950 950
 
951
-			$SQL = "DELETE FROM " . EEM_Status::instance()->table() . " WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
951
+			$SQL = "DELETE FROM ".EEM_Status::instance()->table()." WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );";
952 952
 			$wpdb->query($SQL);
953 953
 
954
-			$SQL = "INSERT INTO " . EEM_Status::instance()->table() . "
954
+			$SQL = "INSERT INTO ".EEM_Status::instance()->table()."
955 955
 					(STS_ID, STS_code, STS_type, STS_can_edit, STS_desc, STS_open) VALUES
956 956
 					('ACT', 'ACTIVE', 'event', 0, NULL, 1),
957 957
 					('NAC', 'NOT_ACTIVE', 'event', 0, NULL, 0),
@@ -1010,26 +1010,26 @@  discard block
 block discarded – undo
1010 1010
 	 * 	@return boolean success of verifying upload directories exist
1011 1011
 	 */
1012 1012
 	public static function create_upload_directories() {
1013
-		EE_Registry::instance()->load_helper( 'File' );
1013
+		EE_Registry::instance()->load_helper('File');
1014 1014
 		// Create the required folders
1015 1015
 		$folders = array(
1016 1016
 				EVENT_ESPRESSO_UPLOAD_DIR,
1017 1017
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1018 1018
 				EVENT_ESPRESSO_GATEWAY_DIR,
1019
-				EVENT_ESPRESSO_UPLOAD_DIR . '/logs/',
1020
-				EVENT_ESPRESSO_UPLOAD_DIR . '/css/',
1021
-				EVENT_ESPRESSO_UPLOAD_DIR . '/tickets/'
1019
+				EVENT_ESPRESSO_UPLOAD_DIR.'/logs/',
1020
+				EVENT_ESPRESSO_UPLOAD_DIR.'/css/',
1021
+				EVENT_ESPRESSO_UPLOAD_DIR.'/tickets/'
1022 1022
 		);
1023
-		foreach ( $folders as $folder ) {
1023
+		foreach ($folders as $folder) {
1024 1024
 			try {
1025
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1026
-				@ chmod( $folder, 0755 );
1027
-			} catch( EE_Error $e ){
1025
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1026
+				@ chmod($folder, 0755);
1027
+			} catch (EE_Error $e) {
1028 1028
 				EE_Error::add_error(
1029 1029
 					sprintf(
1030
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1030
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1031 1031
 						$folder,
1032
-						'<br />' . $e->getMessage()
1032
+						'<br />'.$e->getMessage()
1033 1033
 					),
1034 1034
 					__FILE__, __FUNCTION__, __LINE__
1035 1035
 				);
@@ -1055,16 +1055,16 @@  discard block
 block discarded – undo
1055 1055
 		$settings = $installed_messengers = $default_messengers = array();
1056 1056
 
1057 1057
 		//include our helper
1058
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1058
+		EE_Registry::instance()->load_helper('MSG_Template');
1059 1059
 
1060 1060
 		//get all installed messenger objects
1061 1061
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1062 1062
 
1063 1063
 		//let's setup the $installed messengers in an array AND the messengers that are set to be activated on install.
1064
-		foreach ( $installed['messengers'] as $msgr ) {
1065
-			if ( $msgr instanceof EE_messenger ) {
1064
+		foreach ($installed['messengers'] as $msgr) {
1065
+			if ($msgr instanceof EE_messenger) {
1066 1066
 				$installed_messengers[$msgr->name] = $msgr;
1067
-				if ( $msgr->activate_on_install ) {
1067
+				if ($msgr->activate_on_install) {
1068 1068
 					$default_messengers[] = $msgr->name;
1069 1069
 				}
1070 1070
 			}
@@ -1074,36 +1074,36 @@  discard block
 block discarded – undo
1074 1074
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1075 1075
 
1076 1076
 		//things that have already been activated before
1077
-		$has_activated = get_option( 'ee_has_activated_messenger' );
1077
+		$has_activated = get_option('ee_has_activated_messenger');
1078 1078
 
1079 1079
 		//do an initial loop to determine if we need to continue
1080 1080
 		$def_ms = array();
1081
-		foreach ( $default_messengers as $msgr ) {
1082
-			if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue;
1081
+		foreach ($default_messengers as $msgr) {
1082
+			if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue;
1083 1083
 			$def_ms[] = $msgr;
1084 1084
 		}
1085 1085
 
1086 1086
 		//setup the $installed_mts in an array
1087
-		foreach ( $installed['message_types'] as $imt ) {
1088
-			if ( $imt instanceof EE_message_type ) {
1087
+		foreach ($installed['message_types'] as $imt) {
1088
+			if ($imt instanceof EE_message_type) {
1089 1089
 				$installed_mts[$imt->name] = $imt;
1090 1090
 			}
1091 1091
 		}
1092 1092
 
1093 1093
 		//loop through default array for default messengers (if present)
1094
-		if ( ! empty( $def_ms ) ) {
1095
-			foreach ( $def_ms as $messenger ) {
1094
+		if ( ! empty($def_ms)) {
1095
+			foreach ($def_ms as $messenger) {
1096 1096
 				//all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger.
1097
-				if ( ! isset( $installed_messengers[$messenger] )) {
1097
+				if ( ! isset($installed_messengers[$messenger])) {
1098 1098
 					continue;
1099 1099
 				}
1100 1100
 				/** @var EE_messenger[] $installed_messengers  */
1101 1101
 				$default_mts = $installed_messengers[$messenger]->get_default_message_types();
1102 1102
 				$active_messengers[$messenger]['obj'] = $installed_messengers[$messenger];
1103
-				foreach ( $default_mts as $index => $mt ) {
1103
+				foreach ($default_mts as $index => $mt) {
1104 1104
 					//is there an installed_mt matching the default string?  If not then nothing to do here.
1105
-					if ( ! isset( $installed_mts[$mt] ) ) {
1106
-						unset( $default_mts[$index] );
1105
+					if ( ! isset($installed_mts[$mt])) {
1106
+						unset($default_mts[$index]);
1107 1107
 						continue;
1108 1108
 					}
1109 1109
 
@@ -1112,41 +1112,41 @@  discard block
 block discarded – undo
1112 1112
 					/** @var EE_message_type[] $installed_mts */
1113 1113
 					$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1114 1114
 					$settings = array();
1115
-					if ( is_array( $settings_fields ) ) {
1116
-						foreach ( $settings_fields as $field => $values ) {
1117
-							if ( isset( $values['default'] ) ) {
1115
+					if (is_array($settings_fields)) {
1116
+						foreach ($settings_fields as $field => $values) {
1117
+							if (isset($values['default'])) {
1118 1118
 								$settings[$field] = $values['default'];
1119 1119
 							}
1120 1120
 						}
1121 1121
 					}
1122 1122
 
1123
-					$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1123
+					$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1124 1124
 					$has_activated[$messenger][] = $mt;
1125 1125
 				}
1126 1126
 
1127 1127
 				//setup any initial settings for the messenger
1128 1128
 				$msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields();
1129 1129
 
1130
-				if ( !empty( $msgr_settings ) ) {
1131
-					foreach ( $msgr_settings as $field => $value ) {
1130
+				if ( ! empty($msgr_settings)) {
1131
+					foreach ($msgr_settings as $field => $value) {
1132 1132
 						$active_messengers[$messenger]['settings'][$field] = $value;
1133 1133
 					}
1134 1134
 				}
1135 1135
 
1136 1136
 				//now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate.
1137
-				EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1137
+				EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1138 1138
 
1139 1139
 				//let's generate all the templates but only if the messenger has default_mts (otherwise its just activated).
1140
-				if ( !empty( $default_mts ) ) {
1141
-					$success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE );
1140
+				if ( ! empty($default_mts)) {
1141
+					$success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE);
1142 1142
 				}
1143 1143
 			}
1144 1144
 		} //end check for empty( $def_ms )
1145 1145
 
1146 1146
 		//still need to see if there are any message types to activate for active messengers
1147
-		foreach ( $active_messengers as $messenger => $settings ) {
1147
+		foreach ($active_messengers as $messenger => $settings) {
1148 1148
 			$msg_obj = $settings['obj'];
1149
-			if ( ! $msg_obj instanceof EE_messenger ) {
1149
+			if ( ! $msg_obj instanceof EE_messenger) {
1150 1150
 				continue;
1151 1151
 			}
1152 1152
 
@@ -1154,45 +1154,45 @@  discard block
 block discarded – undo
1154 1154
 			$new_default_mts = array();
1155 1155
 
1156 1156
 			//loop through each default mt reported by the messenger and make sure its set in its active db entry.
1157
-			foreach( $all_default_mts as $index => $mt ) {
1157
+			foreach ($all_default_mts as $index => $mt) {
1158 1158
 				//already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated).
1159
-				if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) ||  EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) {
1159
+				if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) {
1160 1160
 					continue;
1161 1161
 				}
1162 1162
 
1163 1163
 				//is there an installed_mt matching the default string?  If not then nothing to do here.
1164
-				if ( ! isset( $installed_mts[$mt] ) ) {
1165
-					unset( $all_default_mts[$mt] );
1164
+				if ( ! isset($installed_mts[$mt])) {
1165
+					unset($all_default_mts[$mt]);
1166 1166
 					continue;
1167 1167
 				}
1168 1168
 
1169 1169
 				$settings_fields = $installed_mts[$mt]->get_admin_settings_fields();
1170 1170
 				$settings = array();
1171
-				if ( is_array( $settings_fields ) ) {
1172
-					foreach ( $settings_fields as $field => $values ) {
1173
-						if ( isset( $values['default'] ) ) {
1171
+				if (is_array($settings_fields)) {
1172
+					foreach ($settings_fields as $field => $values) {
1173
+						if (isset($values['default'])) {
1174 1174
 							$settings[$field] = $values['default'];
1175 1175
 						}
1176 1176
 					}
1177 1177
 				}
1178 1178
 
1179
-				$active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings;
1179
+				$active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings;
1180 1180
 				$new_default_mts[] = $mt;
1181 1181
 				$has_activated[$messenger][] = $mt;
1182 1182
 			}
1183 1183
 
1184 1184
 
1185
-			if ( ! empty( $new_default_mts ) ) {
1186
-				$success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE );
1185
+			if ( ! empty($new_default_mts)) {
1186
+				$success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE);
1187 1187
 			}
1188 1188
 
1189 1189
 		}
1190 1190
 
1191 1191
 		//now let's save the settings for this messenger!
1192
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1192
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1193 1193
 
1194 1194
 		//update $has_activated record
1195
-		update_option( 'ee_has_activated_messenger', $has_activated );
1195
+		update_option('ee_has_activated_messenger', $has_activated);
1196 1196
 
1197 1197
 		//that's it!
1198 1198
 		return $success;
@@ -1212,47 +1212,47 @@  discard block
 block discarded – undo
1212 1212
 	 */
1213 1213
 	public static function validate_messages_system() {
1214 1214
 		//include our helper
1215
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
1215
+		EE_Registry::instance()->load_helper('MSG_Template');
1216 1216
 
1217 1217
 		//get active and installed  messengers/message types.
1218 1218
 		$active_messengers = EEH_MSG_Template::get_active_messengers_in_db();
1219 1219
 		$installed = EEH_MSG_Template::get_installed_message_objects();
1220 1220
 		$installed_messengers = $installed_mts = array();
1221 1221
 		//set up the arrays so they can be handled easier.
1222
-		foreach( $installed['messengers'] as $im ) {
1223
-			if ( $im instanceof EE_messenger ) {
1222
+		foreach ($installed['messengers'] as $im) {
1223
+			if ($im instanceof EE_messenger) {
1224 1224
 				$installed_messengers[$im->name] = $im;
1225 1225
 			}
1226 1226
 		}
1227
-		foreach( $installed['message_types'] as $imt ) {
1228
-			if ( $imt instanceof EE_message_type ) {
1227
+		foreach ($installed['message_types'] as $imt) {
1228
+			if ($imt instanceof EE_message_type) {
1229 1229
 				$installed_mts[$imt->name] = $imt;
1230 1230
 			}
1231 1231
 		}
1232 1232
 
1233 1233
 		//now let's loop through the active array and validate
1234
-		foreach( $active_messengers as $messenger => $active_details ) {
1234
+		foreach ($active_messengers as $messenger => $active_details) {
1235 1235
 			//first let's see if this messenger is installed.
1236
-			if ( ! isset( $installed_messengers[$messenger] ) ) {
1236
+			if ( ! isset($installed_messengers[$messenger])) {
1237 1237
 				//not set so let's just remove from actives and make sure templates are inactive.
1238
-				unset( $active_messengers[$messenger] );
1239
-				EEH_MSG_Template::update_to_inactive( $messenger );
1238
+				unset($active_messengers[$messenger]);
1239
+				EEH_MSG_Template::update_to_inactive($messenger);
1240 1240
 				continue;
1241 1241
 			}
1242 1242
 
1243 1243
 			//messenger is active, so let's just make sure that any active message types not installed are deactivated.
1244
-			$mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array();
1245
-			foreach ( $mts as $mt_name => $mt ) {
1246
-				if ( ! isset( $installed_mts[$mt_name] )  ) {
1247
-					unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] );
1248
-					EEH_MSG_Template::update_to_inactive( $messenger, $mt_name );
1244
+			$mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array();
1245
+			foreach ($mts as $mt_name => $mt) {
1246
+				if ( ! isset($installed_mts[$mt_name])) {
1247
+					unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]);
1248
+					EEH_MSG_Template::update_to_inactive($messenger, $mt_name);
1249 1249
 				}
1250 1250
 			}
1251 1251
 		}
1252 1252
 
1253 1253
 		//all done! let's update the active_messengers.
1254
-		EEH_MSG_Template::update_active_messengers_in_db( $active_messengers );
1255
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1254
+		EEH_MSG_Template::update_active_messengers_in_db($active_messengers);
1255
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1256 1256
 		return;
1257 1257
 	}
1258 1258
 
@@ -1266,12 +1266,12 @@  discard block
 block discarded – undo
1266 1266
 	 * 	@static
1267 1267
 	 * 	@return void
1268 1268
 	 */
1269
-	public static function create_no_ticket_prices_array(){
1269
+	public static function create_no_ticket_prices_array() {
1270 1270
 		// this creates an array for tracking events that have no active ticket prices created
1271 1271
 		// this allows us to warn admins of the situation so that it can be corrected
1272
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1273
-		if ( ! $espresso_no_ticket_prices ) {
1274
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1272
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1273
+		if ( ! $espresso_no_ticket_prices) {
1274
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1275 1275
 		}
1276 1276
 	}
1277 1277
 
@@ -1293,24 +1293,24 @@  discard block
 block discarded – undo
1293 1293
 	 * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/
1294 1294
 	 * @global wpdb $wpdb
1295 1295
 	 */
1296
-	public static function delete_all_espresso_cpt_data(){
1296
+	public static function delete_all_espresso_cpt_data() {
1297 1297
 		global $wpdb;
1298 1298
 		//get all the CPT post_types
1299 1299
 		$ee_post_types = array();
1300
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1301
-			if ( method_exists( $model_name, 'instance' )) {
1302
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1303
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1304
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1300
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1301
+			if (method_exists($model_name, 'instance')) {
1302
+				$model_obj = call_user_func(array($model_name, 'instance'));
1303
+				if ($model_obj instanceof EEM_CPT_Base) {
1304
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1305 1305
 				}
1306 1306
 			}
1307 1307
 		}
1308 1308
 		//get all our CPTs
1309
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1309
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1310 1310
 		$cpt_ids = $wpdb->get_col($query);
1311 1311
 		//delete each post meta and term relations too
1312
-		foreach($cpt_ids as $post_id){
1313
-			wp_delete_post($post_id,true);
1312
+		foreach ($cpt_ids as $post_id) {
1313
+			wp_delete_post($post_id, true);
1314 1314
 		}
1315 1315
 	}
1316 1316
 
@@ -1324,18 +1324,18 @@  discard block
 block discarded – undo
1324 1324
 	 * @param bool $remove_all
1325 1325
 	 * @return void
1326 1326
 	 */
1327
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1327
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1328 1328
 		global $wpdb;
1329 1329
 		$undeleted_tables = array();
1330 1330
 
1331 1331
 		// load registry
1332
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1333
-			if ( method_exists( $model_name, 'instance' )) {
1334
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1335
-				if ( $model_obj instanceof EEM_Base ) {
1336
-					foreach ( $model_obj->get_tables() as $table ) {
1337
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1338
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1332
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1333
+			if (method_exists($model_name, 'instance')) {
1334
+				$model_obj = call_user_func(array($model_name, 'instance'));
1335
+				if ($model_obj instanceof EEM_Base) {
1336
+					foreach ($model_obj->get_tables() as $table) {
1337
+						if (strpos($table->get_table_name(), 'esp_')) {
1338
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1339 1339
 								case false :
1340 1340
 									$undeleted_tables[] = $table->get_table_name();
1341 1341
 								break;
@@ -1360,8 +1360,8 @@  discard block
 block discarded – undo
1360 1360
 			'wp_esp_promotion_rule',
1361 1361
 			'wp_esp_rule'
1362 1362
 		);
1363
-		foreach( $tables_without_models as $table ){
1364
-			EEH_Activation::delete_unused_db_table( $table );
1363
+		foreach ($tables_without_models as $table) {
1364
+			EEH_Activation::delete_unused_db_table($table);
1365 1365
 		}
1366 1366
 
1367 1367
 
@@ -1399,51 +1399,51 @@  discard block
 block discarded – undo
1399 1399
 		);
1400 1400
 
1401 1401
 		$undeleted_options = array();
1402
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1402
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1403 1403
 
1404
-			if( $no_wildcard ){
1405
-				if( ! delete_option( $option_name ) ){
1404
+			if ($no_wildcard) {
1405
+				if ( ! delete_option($option_name)) {
1406 1406
 					$undeleted_options[] = $option_name;
1407 1407
 				}
1408
-			}else{
1409
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1410
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1411
-					if( ! delete_option( $option_name_from_wildcard ) ){
1408
+			} else {
1409
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1410
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1411
+					if ( ! delete_option($option_name_from_wildcard)) {
1412 1412
 						$undeleted_options[] = $option_name_from_wildcard;
1413 1413
 					}
1414 1414
 				}
1415 1415
 			}
1416 1416
 		}
1417 1417
 
1418
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1418
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1419 1419
 			$db_update_sans_ee4 = array();
1420
-			foreach($espresso_db_update as $version => $times_activated){
1421
-				if( $version[0] =='3'){//if its NON EE4
1420
+			foreach ($espresso_db_update as $version => $times_activated) {
1421
+				if ($version[0] == '3') {//if its NON EE4
1422 1422
 					$db_update_sans_ee4[$version] = $times_activated;
1423 1423
 				}
1424 1424
 			}
1425
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1425
+			update_option('espresso_db_update', $db_update_sans_ee4);
1426 1426
 		}
1427 1427
 
1428 1428
 		$errors = '';
1429
-		if ( ! empty( $undeleted_tables )) {
1429
+		if ( ! empty($undeleted_tables)) {
1430 1430
 			$errors .= sprintf(
1431
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1431
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1432 1432
 				'<br/>',
1433
-				implode( ',<br/>', $undeleted_tables )
1433
+				implode(',<br/>', $undeleted_tables)
1434 1434
 			);
1435 1435
 		}
1436
-		if ( ! empty( $undeleted_options )) {
1437
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1436
+		if ( ! empty($undeleted_options)) {
1437
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1438 1438
 			$errors .= sprintf(
1439
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1439
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1440 1440
 				'<br/>',
1441
-				implode( ',<br/>', $undeleted_options )
1441
+				implode(',<br/>', $undeleted_options)
1442 1442
 			);
1443 1443
 
1444 1444
 		}
1445
-		if ( $errors != '' ) {
1446
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1445
+		if ($errors != '') {
1446
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1447 1447
 		}
1448 1448
 	}
1449 1449
 
@@ -1453,25 +1453,25 @@  discard block
 block discarded – undo
1453 1453
 	 * @param string $table_name with or without $wpdb->prefix
1454 1454
 	 * @return boolean
1455 1455
 	 */
1456
-	public static function table_exists( $table_name ){
1456
+	public static function table_exists($table_name) {
1457 1457
 		global $wpdb, $EZSQL_ERROR;
1458
-		if(strpos($table_name, $wpdb->prefix) !== 0){
1458
+		if (strpos($table_name, $wpdb->prefix) !== 0) {
1459 1459
 			$table_name = $wpdb->prefix.$table_name;
1460 1460
 		}
1461 1461
 		//ignore if this causes an sql error
1462 1462
 		$old_error = $wpdb->last_error;
1463 1463
 		$old_suppress_errors = $wpdb->suppress_errors();
1464
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1464
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1465 1465
 		$ezsql_error_cache = $EZSQL_ERROR;
1466
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1467
-		$wpdb->show_errors( $old_show_errors_value );
1468
-		$wpdb->suppress_errors( $old_suppress_errors );
1466
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1467
+		$wpdb->show_errors($old_show_errors_value);
1468
+		$wpdb->suppress_errors($old_suppress_errors);
1469 1469
 		$new_error = $wpdb->last_error;
1470 1470
 		$wpdb->last_error = $old_error;
1471 1471
 		$EZSQL_ERROR = $ezsql_error_cache;
1472
-		if( empty( $new_error ) ){
1472
+		if (empty($new_error)) {
1473 1473
 			return TRUE;
1474
-		}else{
1474
+		} else {
1475 1475
 			return FALSE;
1476 1476
 		}
1477 1477
 	}
@@ -1479,7 +1479,7 @@  discard block
 block discarded – undo
1479 1479
 	/**
1480 1480
 	 * Resets the cache on EEH_Activation
1481 1481
 	 */
1482
-	public static function reset(){
1482
+	public static function reset() {
1483 1483
 		self::$_default_creator_id = NULL;
1484 1484
 		self::$_initialized_db_content_already_in_this_request = false;
1485 1485
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
 	 *
205 205
 	 * @access    private
206 206
 	 * @param string $sort
207
-	 * @return    array
207
+	 * @return    string
208 208
 	 */
209 209
 	private static function _sort( $sort = 'ASC' ) {
210 210
 		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function add_query_filters() {
87 87
 		//add query filters
88
-		add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 );
88
+		add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param \WP_Query $WP_Query
98 98
 	 * @return bool
99 99
 	 */
100
-	public static function apply_query_filters( WP_Query $WP_Query ) {
101
-		return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) ||  apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false;
100
+	public static function apply_query_filters(WP_Query $WP_Query) {
101
+		return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false;
102 102
 	}
103 103
 
104 104
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 * @access    public
109 109
 	 * @param \WP_Query $WP_Query
110 110
 	 */
111
-	public static function filter_query_parts( WP_Query $WP_Query ) {
111
+	public static function filter_query_parts(WP_Query $WP_Query) {
112 112
 		//ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in.
113
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) {
113
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) {
114 114
 			// build event list query
115
-			add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 );
116
-			add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 );
117
-			add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 );
118
-			add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 );
119
-			add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 );
115
+			add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2);
116
+			add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2);
117
+			add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2);
118
+			add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2);
119
+			add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2);
120 120
 		}
121 121
 	}
122 122
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 * @param string $orderby
132 132
 	 * @param string $sort
133 133
 	 */
134
-	public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) {
134
+	public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') {
135 135
 		self::$_query_params = array();
136
-		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month );
137
-		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category );
138
-		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired );
139
-		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby );
140
-		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort );
136
+		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month);
137
+		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category);
138
+		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired);
139
+		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby);
140
+		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort);
141 141
 	}
142 142
 
143 143
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param string $month
150 150
 	 * @return    string
151 151
 	 */
152
-	private static function _display_month( $month = '' ) {
153
-		return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month;
152
+	private static function _display_month($month = '') {
153
+		return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month;
154 154
 	}
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $category
163 163
 	 * @return    string
164 164
 	 */
165
-	private static function _event_category_slug( $category = '' ) {
166
-		return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category;
165
+	private static function _event_category_slug($category = '') {
166
+		return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category;
167 167
 	}
168 168
 
169 169
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $show_expired
176 176
 	 * @return    boolean
177 177
 	 */
178
-	private static function _show_expired( $show_expired = FALSE ) {
178
+	private static function _show_expired($show_expired = FALSE) {
179 179
 		// override default expired option if set via filter
180
-		$_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired;
181
-		return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN );
180
+		$_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired;
181
+		return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN);
182 182
 	}
183 183
 
184 184
 
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param    string $orderby
191 191
 	 * @return    array
192 192
 	 */
193
-	private static function _orderby( $orderby = 'start_date' ) {
194
-		$event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby;
195
-		$event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby );
196
-		$event_query_orderby = array_map( 'trim', $event_query_orderby );
193
+	private static function _orderby($orderby = 'start_date') {
194
+		$event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby;
195
+		$event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby);
196
+		$event_query_orderby = array_map('trim', $event_query_orderby);
197 197
 		return $event_query_orderby;
198 198
 	}
199 199
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 * @param string $sort
207 207
 	 * @return    array
208 208
 	 */
209
-	private static function _sort( $sort = 'ASC' ) {
210
-		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
211
-		return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC';
209
+	private static function _sort($sort = 'ASC') {
210
+		$sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort;
211
+		return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC';
212 212
 	}
213 213
 
214 214
 
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return array   array of clauses
223 223
 	 */
224
-	public static function posts_clauses( $clauses, WP_Query $wp_query ) {
225
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
224
+	public static function posts_clauses($clauses, WP_Query $wp_query) {
225
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
226 226
 			$clauses['distinct'] = "DISTINCT";
227 227
 		}
228 228
 		return $clauses;
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 	 * @param WP_Query $wp_query
239 239
 	 * @return    string
240 240
 	 */
241
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
242
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
241
+	public static function posts_fields($SQL, WP_Query $wp_query) {
242
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
243 243
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
244
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
244
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
245 245
 		}
246 246
 		return $SQL;
247 247
 	}
@@ -256,29 +256,29 @@  discard block
 block discarded – undo
256 256
 	 * @internal  param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
257 257
 	 * @return    string
258 258
 	 */
259
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
260
-		$SQL= '';
261
-		foreach( (array)$orderby_params as $orderby ) {
262
-			switch ( $orderby ) {
259
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
260
+		$SQL = '';
261
+		foreach ((array) $orderby_params as $orderby) {
262
+			switch ($orderby) {
263 263
 
264 264
 				case 'ticket_start' :
265
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
265
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
266 266
 					break;
267 267
 
268 268
 				case 'ticket_end' :
269
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
269
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
270 270
 					break;
271 271
 
272 272
 				case 'venue_title' :
273
-					$SQL .= ', Venue.post_title AS venue_title' ;
273
+					$SQL .= ', Venue.post_title AS venue_title';
274 274
 					break;
275 275
 
276 276
 				case 'city' :
277
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
277
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
278 278
 					break;
279 279
 
280 280
 				case 'state' :
281
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
281
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
282 282
 					break;
283 283
 
284 284
 			}
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
 	 * @param WP_Query $wp_query
297 297
 	 * @return    string
298 298
 	 */
299
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
300
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
299
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
300
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
301 301
 			// Category
302
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
304
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
302
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
304
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
305 305
 		}
306 306
 		return $SQL;
307 307
 	}
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 	 * @param    boolean $show_expired if TRUE, then displayed past events
317 317
 	 * @return string
318 318
 	 */
319
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
320
-		if ( ! $show_expired ) {
321
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
322
-			if ( strpos( $SQL, $join ) === FALSE ) {
323
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
319
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
320
+		if ( ! $show_expired) {
321
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
322
+			if (strpos($SQL, $join) === FALSE) {
323
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
324 324
 			}
325 325
 		}
326 326
 		return $SQL;
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
337 337
 	 * @return 	string
338 338
 	 */
339
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
340
-		if ( ! empty( $join_terms ) ) {
339
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
340
+		if ( ! empty($join_terms)) {
341 341
 			global $wpdb;
342 342
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -357,25 +357,25 @@  discard block
 block discarded – undo
357 357
 	 * @param 	array $orderby_params
358 358
 	 * @return 	string
359 359
 	 */
360
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
361
-		foreach ( (array)$orderby_params as $orderby ) {
362
-			switch ( $orderby ) {
360
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
361
+		foreach ((array) $orderby_params as $orderby) {
362
+			switch ($orderby) {
363 363
 				case 'ticket_start' :
364 364
 				case 'ticket_end' :
365
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
366
-					$SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )';
365
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
366
+					$SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )';
367 367
 					break;
368 368
 				case 'venue_title' :
369 369
 				case 'city' :
370
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
370
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
371 371
 					break;
372 372
 				case 'state' :
373
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
374
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
373
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
374
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
375 375
 					break;
376 376
 				case 'start_date' :
377 377
 				default :
378
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
378
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
379 379
 					break;
380 380
 
381 381
 			}
@@ -393,11 +393,11 @@  discard block
 block discarded – undo
393 393
 	 * @param string $join
394 394
 	 * @return string
395 395
 	 */
396
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
397
-		if ( ! empty( $join )) {
398
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
399
-			if ( strpos( $SQL, $join ) === FALSE ) {
400
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
396
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
397
+		if ( ! empty($join)) {
398
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
399
+			if (strpos($SQL, $join) === FALSE) {
400
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
401 401
 			}
402 402
 		}
403 403
 		return '';
@@ -412,13 +412,13 @@  discard block
 block discarded – undo
412 412
 	 * @param string $SQL
413 413
 	 * @return string
414 414
 	 */
415
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
415
+	protected static function _posts_join_for_event_venue($SQL = '') {
416 416
 		// Event Venue table name
417 417
 		$event_venue_table = EEM_Event_Venue::instance()->table();
418 418
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
419
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
419
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
420 420
 		// don't add joins if they have already been added
421
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
421
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
422 422
 			// Venue table name
423 423
 			$venue_table = EEM_Venue::instance()->table();
424 424
 			// Venue table pk
@@ -431,10 +431,10 @@  discard block
 block discarded – undo
431 431
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
432 432
 			// generate JOIN clause for: Venue <=> Venue Meta
433 433
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
434
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
434
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
435 435
 			return $venue_SQL;
436 436
 		}
437
-		unset( $event_venue_table, $event_to_event_venue_join );
437
+		unset($event_venue_table, $event_to_event_venue_join);
438 438
 		return '';
439 439
 	}
440 440
 
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 	 * @param string $SQL
448 448
 	 * @return string
449 449
 	 */
450
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
450
+	protected static function _posts_join_for_venue_state($SQL = '') {
451 451
 		// Venue Meta table name
452 452
 		$venue_meta_table = EEM_Venue::instance()->second_table();
453 453
 		// State table name
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
 		// State table pk
456 456
 		$state_table_pk = EEM_State::instance()->primary_key_name();
457 457
 		// verify vars
458
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
458
+		if ($venue_meta_table && $state_table && $state_table_pk) {
459 459
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
460 460
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
461 461
 			// don't add join if it has already been added
462
-			if ( strpos( $SQL, $join ) === FALSE ) {
463
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
462
+			if (strpos($SQL, $join) === FALSE) {
463
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
464 464
 				return " LEFT JOIN $state_table ON ( $join )";
465 465
 			}
466 466
 		}
467
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
467
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
468 468
 		return '';
469 469
 	}
470 470
 
@@ -478,14 +478,14 @@  discard block
 block discarded – undo
478 478
 	 * @param WP_Query $wp_query
479 479
 	 * @return    string
480 480
 	 */
481
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
482
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
481
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
482
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
483 483
 			// Show Expired ?
484
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
484
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
485 485
 			// Category
486
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
486
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
487 487
 			// Start Date
488
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
488
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
489 489
 		}
490 490
 		return $SQL;
491 491
 	}
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	 * @param    boolean $show_expired if TRUE, then displayed past events
500 500
 	 * @return    string
501 501
 	 */
502
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
503
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
502
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
503
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
504 504
 	}
505 505
 
506 506
 
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 	 * @param    boolean $event_category_slug
513 513
 	 * @return    string
514 514
 	 */
515
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
515
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
516 516
 		global $wpdb;
517
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
517
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
518 518
 	}
519 519
 
520 520
 
@@ -526,13 +526,13 @@  discard block
 block discarded – undo
526 526
 	 * @param    boolean $month
527 527
 	 * @return    string
528 528
 	 */
529
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
529
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
530 530
 		$SQL = '';
531
-		if ( ! empty( $month ) ) {
531
+		if ( ! empty($month)) {
532 532
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
533
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
533
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
534 534
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
535
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
535
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
536 536
 		}
537 537
 		return $SQL;
538 538
 	}
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 	 * @param WP_Query $wp_query
548 548
 	 * @return    string
549 549
 	 */
550
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
551
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
552
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
550
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
551
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
552
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
553 553
 		}
554 554
 		return $SQL;
555 555
 	}
@@ -580,63 +580,63 @@  discard block
 block discarded – undo
580 580
 	 * @param string     $sort
581 581
 	 * @return string
582 582
 	 */
583
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
583
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
584 584
 		global $wpdb;
585 585
 		$SQL = '';
586 586
 		$counter = 0;
587 587
 		//make sure 'orderby' is set in query params
588
-		if ( ! isset( self::$_query_params['orderby'] )) {
588
+		if ( ! isset(self::$_query_params['orderby'])) {
589 589
 			self::$_query_params['orderby'] = array();
590 590
 		}
591 591
 		// loop thru $orderby_params (type cast as array)
592
-		foreach ( (array)$orderby_params as $orderby ) {
592
+		foreach ((array) $orderby_params as $orderby) {
593 593
 			// check if we have already added this param
594
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
594
+			if (isset(self::$_query_params['orderby'][$orderby])) {
595 595
 				// if so then remove from the $orderby_params so that the count() method below is accurate
596
-				unset( $orderby_params[ $orderby ] );
596
+				unset($orderby_params[$orderby]);
597 597
 				// then bump ahead to the next param
598 598
 				continue;
599 599
 			}
600 600
 			// this will ad a comma depending on whether this is the first or last param
601
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
601
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
602 602
 			// ok what's we dealing with?
603
-			switch ( $orderby ) {
603
+			switch ($orderby) {
604 604
 				case 'id' :
605 605
 				case 'ID' :
606
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
606
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
607 607
 					break;
608 608
 				case 'end_date' :
609
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
609
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
610 610
 					break;
611 611
 				case 'event_name' :
612
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
612
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
613 613
 					break;
614 614
 				case 'category_slug' :
615
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
615
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
616 616
 					break;
617 617
 				case 'ticket_start' :
618
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
618
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
619 619
 					break;
620 620
 				case 'ticket_end' :
621
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
621
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
622 622
 					break;
623 623
 				case 'venue_title' :
624
-					$SQL .= $glue . 'venue_title ' . $sort;
624
+					$SQL .= $glue.'venue_title '.$sort;
625 625
 					break;
626 626
 				case 'city' :
627
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
627
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
628 628
 					break;
629 629
 				case 'state' :
630
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
630
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
631 631
 					break;
632 632
 				case 'start_date' :
633 633
 				default :
634
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_start ' . $sort;
634
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_start '.$sort;
635 635
 					break;
636 636
 			}
637 637
 			// add to array of orderby params that have been added
638
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
639
-			$counter ++;
638
+			self::$_query_params['orderby'][$orderby] = TRUE;
639
+			$counter++;
640 640
 		}
641 641
 		return $SQL;
642 642
 	}
Please login to merge, or discard this patch.