Completed
Branch BUG/countries-page-typo (d4bde3)
by
unknown
17:16 queued 08:30
created
core/db_models/EEM_Country.model.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -11,112 +11,112 @@
 block discarded – undo
11 11
 class EEM_Country extends EEM_Base
12 12
 {
13 13
 
14
-    // private instance of the Attendee object
15
-    protected static $_instance = null;
16
-    // array of all countries
17
-    private static $_all_countries = false;
18
-    // array of all active countries
19
-    private static $_active_countries = false;
14
+	// private instance of the Attendee object
15
+	protected static $_instance = null;
16
+	// array of all countries
17
+	private static $_all_countries = false;
18
+	// array of all active countries
19
+	private static $_active_countries = false;
20 20
 
21 21
 
22 22
 
23
-    /**
24
-     * Resets the country
25
-     * @return EEM_Country
26
-     */
27
-    public static function reset($timezone = null)
28
-    {
29
-        self::$_active_countries = null;
30
-        self::$_all_countries = null;
31
-        return parent::reset($timezone);
32
-    }
23
+	/**
24
+	 * Resets the country
25
+	 * @return EEM_Country
26
+	 */
27
+	public static function reset($timezone = null)
28
+	{
29
+		self::$_active_countries = null;
30
+		self::$_all_countries = null;
31
+		return parent::reset($timezone);
32
+	}
33 33
 
34
-    protected function __construct($timezone = null)
35
-    {
36
-        $this->singular_item = esc_html__('Country', 'event_espresso');
37
-        $this->plural_item = esc_html__('Countries', 'event_espresso');
34
+	protected function __construct($timezone = null)
35
+	{
36
+		$this->singular_item = esc_html__('Country', 'event_espresso');
37
+		$this->plural_item = esc_html__('Countries', 'event_espresso');
38 38
 
39 39
 
40
-        $this->_tables = array(
41
-            'Country'=> new EE_Primary_Table('esp_country', 'CNT_ISO')
42
-        );
43
-        $this->_fields = array(
44
-            'Country'=>array(
45
-                'CNT_active' => new EE_Boolean_Field('CNT_active', esc_html__('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46
-                'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', esc_html__('Country ISO Code', 'event_espresso')),
47
-                'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', esc_html__('Country ISO3 Code', 'event_espresso'), false, ''),
48
-                'RGN_ID'=>new EE_Integer_Field('RGN_ID', esc_html__('Region ID', 'event_espresso'), false, 0),// should be a foreign key, but no region table exists yet
49
-                'CNT_name'=>new EE_Plain_Text_Field('CNT_name', esc_html__('Country Name', 'event_espresso'), false, ''),
50
-                'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', esc_html__('Country Currency Code', 'event_espresso'), false),
51
-                'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', esc_html__('Currency Name Singular', 'event_espresso'), false),
52
-                'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', esc_html__('Currency Name Plural', 'event_espresso'), false),
53
-                'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', esc_html__('Currency Sign', 'event_espresso'), false),
54
-                'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', esc_html__('Currency Sign Before Number', 'event_espresso'), false, true),
55
-                'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', esc_html__('Currency Decimal Places', 'event_espresso'), false, 2),
56
-                'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', esc_html__('Currency Decimal Mark', 'event_espresso'), false, '.'),
57
-                'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', esc_html__('Currency Thousands Separator', 'event_espresso'), false, ','),
58
-                'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', esc_html__('Country Telephone Code', 'event_espresso'), false, ''),
59
-                'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', esc_html__('Country is Member of EU', 'event_espresso'), false, false)
60
-            ));
61
-        $this->_model_relations = array(
62
-            'Attendee'=>new EE_Has_Many_Relation(),
63
-            'State'=>new EE_Has_Many_Relation(),
64
-            'Venue'=>new EE_Has_Many_Relation(),
65
-        );
66
-        // only anyone to view, but only those with the default role can do anything
67
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
40
+		$this->_tables = array(
41
+			'Country'=> new EE_Primary_Table('esp_country', 'CNT_ISO')
42
+		);
43
+		$this->_fields = array(
44
+			'Country'=>array(
45
+				'CNT_active' => new EE_Boolean_Field('CNT_active', esc_html__('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', esc_html__('Country ISO Code', 'event_espresso')),
47
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', esc_html__('Country ISO3 Code', 'event_espresso'), false, ''),
48
+				'RGN_ID'=>new EE_Integer_Field('RGN_ID', esc_html__('Region ID', 'event_espresso'), false, 0),// should be a foreign key, but no region table exists yet
49
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', esc_html__('Country Name', 'event_espresso'), false, ''),
50
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', esc_html__('Country Currency Code', 'event_espresso'), false),
51
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', esc_html__('Currency Name Singular', 'event_espresso'), false),
52
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', esc_html__('Currency Name Plural', 'event_espresso'), false),
53
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', esc_html__('Currency Sign', 'event_espresso'), false),
54
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', esc_html__('Currency Sign Before Number', 'event_espresso'), false, true),
55
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', esc_html__('Currency Decimal Places', 'event_espresso'), false, 2),
56
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', esc_html__('Currency Decimal Mark', 'event_espresso'), false, '.'),
57
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', esc_html__('Currency Thousands Separator', 'event_espresso'), false, ','),
58
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', esc_html__('Country Telephone Code', 'event_espresso'), false, ''),
59
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', esc_html__('Country is Member of EU', 'event_espresso'), false, false)
60
+			));
61
+		$this->_model_relations = array(
62
+			'Attendee'=>new EE_Has_Many_Relation(),
63
+			'State'=>new EE_Has_Many_Relation(),
64
+			'Venue'=>new EE_Has_Many_Relation(),
65
+		);
66
+		// only anyone to view, but only those with the default role can do anything
67
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
68 68
 
69
-        parent::__construct($timezone);
70
-    }
69
+		parent::__construct($timezone);
70
+	}
71 71
 
72 72
 
73 73
 
74 74
 
75
-    /**
76
-    *       _get_countries
77
-    *
78
-    *       @access     public
79
-    *       @return         array
80
-    */
81
-    public function get_all_countries()
82
-    {
83
-        if (! self::$_all_countries) {
84
-            self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
85
-        }
86
-        return self::$_all_countries;
87
-    }
75
+	/**
76
+	 *       _get_countries
77
+	 *
78
+	 *       @access     public
79
+	 *       @return         array
80
+	 */
81
+	public function get_all_countries()
82
+	{
83
+		if (! self::$_all_countries) {
84
+			self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
85
+		}
86
+		return self::$_all_countries;
87
+	}
88 88
 
89
-    /**
90
-    *       _get_countries
91
-    *       Gets and caches the list of active countries. If you know the list of active countries
92
-    *       has changed during this request, first use EEM_Country::reset() to flush the cache
93
-    *       @access     public
94
-    *       @return         array
95
-    */
96
-    public function get_all_active_countries()
97
-    {
98
-        if (! self::$_active_countries) {
99
-            self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
100
-        }
101
-        return self::$_active_countries;
102
-    }
89
+	/**
90
+	 *       _get_countries
91
+	 *       Gets and caches the list of active countries. If you know the list of active countries
92
+	 *       has changed during this request, first use EEM_Country::reset() to flush the cache
93
+	 *       @access     public
94
+	 *       @return         array
95
+	 */
96
+	public function get_all_active_countries()
97
+	{
98
+		if (! self::$_active_countries) {
99
+			self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
100
+		}
101
+		return self::$_active_countries;
102
+	}
103 103
 
104
-    /**
105
-     * Gets the country's name by its ISO
106
-     * @param string $country_ISO
107
-     * @return string
108
-     */
109
-    public function get_country_name_by_ISO($country_ISO)
110
-    {
111
-        if (isset(self::$_all_countries[ $country_ISO ]) &&
112
-                self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
-            return self::$_all_countries[ $country_ISO ]->name();
114
-        }
115
-        $names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
116
-        if (is_array($names) && ! empty($names)) {
117
-            return reset($names);
118
-        } else {
119
-            return '';
120
-        }
121
-    }
104
+	/**
105
+	 * Gets the country's name by its ISO
106
+	 * @param string $country_ISO
107
+	 * @return string
108
+	 */
109
+	public function get_country_name_by_ISO($country_ISO)
110
+	{
111
+		if (isset(self::$_all_countries[ $country_ISO ]) &&
112
+				self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
+			return self::$_all_countries[ $country_ISO ]->name();
114
+		}
115
+		$names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
116
+		if (is_array($names) && ! empty($names)) {
117
+			return reset($names);
118
+		} else {
119
+			return '';
120
+		}
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                 'CNT_active' => new EE_Boolean_Field('CNT_active', esc_html__('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
46 46
                 'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', esc_html__('Country ISO Code', 'event_espresso')),
47 47
                 'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', esc_html__('Country ISO3 Code', 'event_espresso'), false, ''),
48
-                'RGN_ID'=>new EE_Integer_Field('RGN_ID', esc_html__('Region ID', 'event_espresso'), false, 0),// should be a foreign key, but no region table exists yet
48
+                'RGN_ID'=>new EE_Integer_Field('RGN_ID', esc_html__('Region ID', 'event_espresso'), false, 0), // should be a foreign key, but no region table exists yet
49 49
                 'CNT_name'=>new EE_Plain_Text_Field('CNT_name', esc_html__('Country Name', 'event_espresso'), false, ''),
50 50
                 'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', esc_html__('Country Currency Code', 'event_espresso'), false),
51 51
                 'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', esc_html__('Currency Name Singular', 'event_espresso'), false),
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             'Venue'=>new EE_Has_Many_Relation(),
65 65
         );
66 66
         // only anyone to view, but only those with the default role can do anything
67
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
67
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
68 68
 
69 69
         parent::__construct($timezone);
70 70
     }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
     */
81 81
     public function get_all_countries()
82 82
     {
83
-        if (! self::$_all_countries) {
84
-            self::$_all_countries = $this->get_all(array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
83
+        if ( ! self::$_all_countries) {
84
+            self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
85 85
         }
86 86
         return self::$_all_countries;
87 87
     }
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     */
96 96
     public function get_all_active_countries()
97 97
     {
98
-        if (! self::$_active_countries) {
99
-            self::$_active_countries =  $this->get_all(array( array( 'CNT_active' => true ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
98
+        if ( ! self::$_active_countries) {
99
+            self::$_active_countries = $this->get_all(array(array('CNT_active' => true), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
100 100
         }
101 101
         return self::$_active_countries;
102 102
     }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function get_country_name_by_ISO($country_ISO)
110 110
     {
111
-        if (isset(self::$_all_countries[ $country_ISO ]) &&
112
-                self::$_all_countries[ $country_ISO ] instanceof EE_Country ) {
113
-            return self::$_all_countries[ $country_ISO ]->name();
111
+        if (isset(self::$_all_countries[$country_ISO]) &&
112
+                self::$_all_countries[$country_ISO] instanceof EE_Country) {
113
+            return self::$_all_countries[$country_ISO]->name();
114 114
         }
115
-        $names = $this->get_col(array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name');
115
+        $names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
116 116
         if (is_array($names) && ! empty($names)) {
117 117
             return reset($names);
118 118
         } else {
Please login to merge, or discard this patch.