@@ -6,45 +6,45 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class EE_Index |
| 8 | 8 | { |
| 9 | - protected $_name; |
|
| 10 | - protected $_field_names; |
|
| 11 | - protected $_model_name; |
|
| 12 | - public function __construct($fields) |
|
| 13 | - { |
|
| 14 | - $this->_field_names = $fields; |
|
| 15 | - } |
|
| 16 | - public function _construct_finalize($name, $model_name) |
|
| 17 | - { |
|
| 18 | - $this->_name = $name; |
|
| 19 | - $this->_model_name = $model_name; |
|
| 20 | - } |
|
| 21 | - public function field_names() |
|
| 22 | - { |
|
| 23 | - return $this->_field_names; |
|
| 24 | - } |
|
| 25 | - /** |
|
| 26 | - * Internally used by get_this_model() and get_other_model() |
|
| 27 | - * @param string $model_name like Event, Question_Group, etc. omit the EEM_ |
|
| 28 | - * @return EEM_Base |
|
| 29 | - */ |
|
| 30 | - protected function _get_model($model_name) |
|
| 31 | - { |
|
| 32 | - $modelInstance=call_user_func("EEM_".$model_name."::instance"); |
|
| 33 | - return $modelInstance; |
|
| 34 | - } |
|
| 35 | - /** |
|
| 36 | - * Gets all the fields for this index |
|
| 37 | - * @return EE_Model_Field_Base[] |
|
| 38 | - */ |
|
| 39 | - public function fields() |
|
| 40 | - { |
|
| 41 | - $fields = array(); |
|
| 42 | - $model = $this->_get_model($this->_model_name); |
|
| 43 | - foreach ($model->field_settings() as $field_name => $field_obj) { |
|
| 44 | - if (in_array($field_name, $this->field_names())) { |
|
| 45 | - $fields[ $field_name ] = $field_obj; |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - return $fields; |
|
| 49 | - } |
|
| 9 | + protected $_name; |
|
| 10 | + protected $_field_names; |
|
| 11 | + protected $_model_name; |
|
| 12 | + public function __construct($fields) |
|
| 13 | + { |
|
| 14 | + $this->_field_names = $fields; |
|
| 15 | + } |
|
| 16 | + public function _construct_finalize($name, $model_name) |
|
| 17 | + { |
|
| 18 | + $this->_name = $name; |
|
| 19 | + $this->_model_name = $model_name; |
|
| 20 | + } |
|
| 21 | + public function field_names() |
|
| 22 | + { |
|
| 23 | + return $this->_field_names; |
|
| 24 | + } |
|
| 25 | + /** |
|
| 26 | + * Internally used by get_this_model() and get_other_model() |
|
| 27 | + * @param string $model_name like Event, Question_Group, etc. omit the EEM_ |
|
| 28 | + * @return EEM_Base |
|
| 29 | + */ |
|
| 30 | + protected function _get_model($model_name) |
|
| 31 | + { |
|
| 32 | + $modelInstance=call_user_func("EEM_".$model_name."::instance"); |
|
| 33 | + return $modelInstance; |
|
| 34 | + } |
|
| 35 | + /** |
|
| 36 | + * Gets all the fields for this index |
|
| 37 | + * @return EE_Model_Field_Base[] |
|
| 38 | + */ |
|
| 39 | + public function fields() |
|
| 40 | + { |
|
| 41 | + $fields = array(); |
|
| 42 | + $model = $this->_get_model($this->_model_name); |
|
| 43 | + foreach ($model->field_settings() as $field_name => $field_obj) { |
|
| 44 | + if (in_array($field_name, $this->field_names())) { |
|
| 45 | + $fields[ $field_name ] = $field_obj; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + return $fields; |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | protected function _get_model($model_name) |
| 31 | 31 | { |
| 32 | - $modelInstance=call_user_func("EEM_".$model_name."::instance"); |
|
| 32 | + $modelInstance = call_user_func("EEM_".$model_name."::instance"); |
|
| 33 | 33 | return $modelInstance; |
| 34 | 34 | } |
| 35 | 35 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $model = $this->_get_model($this->_model_name); |
| 43 | 43 | foreach ($model->field_settings() as $field_name => $field_obj) { |
| 44 | 44 | if (in_array($field_name, $this->field_names())) { |
| 45 | - $fields[ $field_name ] = $field_obj; |
|
| 45 | + $fields[$field_name] = $field_obj; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | return $fields; |
@@ -9,164 +9,164 @@ |
||
| 9 | 9 | abstract class EE_Table_Base |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * This holds the table_name without the table prefix. |
|
| 14 | - * |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - public $_table_name; |
|
| 18 | - |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * This holds what is used as the alias for the table in queries. |
|
| 22 | - * |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 25 | - public $_table_alias; |
|
| 26 | - |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Table's private key column |
|
| 30 | - * |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 33 | - protected $_pk_column; |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Whether this table is a global table (in multisite) or specific to site. |
|
| 38 | - * |
|
| 39 | - * @var bool |
|
| 40 | - */ |
|
| 41 | - protected $_global; |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @global wpdb $wpdb |
|
| 47 | - * @param string $table_name with or without wpdb prefix |
|
| 48 | - * @param string $pk_column |
|
| 49 | - * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite |
|
| 50 | - * install, or whether each site on a multisite install has a copy of this table |
|
| 51 | - */ |
|
| 52 | - public function __construct($table_name, $pk_column, $global = false) |
|
| 53 | - { |
|
| 54 | - $this->_global = $global; |
|
| 55 | - $prefix = $this->get_table_prefix(); |
|
| 56 | - // if they added the prefix, let's remove it because we delay adding the prefix until right when its needed. |
|
| 57 | - if (strpos($table_name, $prefix) === 0) { |
|
| 58 | - $table_name = ltrim($table_name, $prefix); |
|
| 59 | - } |
|
| 60 | - $this->_table_name = $table_name; |
|
| 61 | - $this->_pk_column = $pk_column; |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * This returns the table prefix for the current model state. |
|
| 68 | - * |
|
| 69 | - * @global wpdb $wpdb |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public function get_table_prefix() |
|
| 73 | - { |
|
| 74 | - global $wpdb; |
|
| 75 | - if ($this->_global) { |
|
| 76 | - $prefix = $wpdb->base_prefix; |
|
| 77 | - } else { |
|
| 78 | - $prefix = $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id()); |
|
| 79 | - } |
|
| 80 | - return $prefix; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Used to set the table_alias property |
|
| 87 | - * |
|
| 88 | - * @param string $table_alias |
|
| 89 | - */ |
|
| 90 | - public function _construct_finalize_with_alias($table_alias) |
|
| 91 | - { |
|
| 92 | - $this->_table_alias = $table_alias; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Returns the fully qualified table name for the database (includes the table prefix current for the blog). |
|
| 99 | - * |
|
| 100 | - * @return string |
|
| 101 | - */ |
|
| 102 | - public function get_table_name() |
|
| 103 | - { |
|
| 104 | - return $this->get_table_prefix() . $this->_table_name; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Provides what is currently set as the alias for the table to be used in queries. |
|
| 111 | - * |
|
| 112 | - * @return string |
|
| 113 | - * @throws EE_Error |
|
| 114 | - */ |
|
| 115 | - public function get_table_alias() |
|
| 116 | - { |
|
| 117 | - if (! $this->_table_alias) { |
|
| 118 | - throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?"); |
|
| 119 | - } |
|
| 120 | - return $this->_table_alias; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * @return string name of column of PK |
|
| 127 | - */ |
|
| 128 | - public function get_pk_column() |
|
| 129 | - { |
|
| 130 | - return $this->_pk_column; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * returns a string with the table alias, a period, and the private key's column. |
|
| 137 | - * |
|
| 138 | - * @return string |
|
| 139 | - */ |
|
| 140 | - public function get_fully_qualified_pk_column() |
|
| 141 | - { |
|
| 142 | - $sql = $this->get_table_alias() . "." . $this->get_pk_column(); |
|
| 143 | - return $sql; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * returns the special sql for a inner select with a limit. |
|
| 150 | - * |
|
| 151 | - * @return string SQL select |
|
| 152 | - */ |
|
| 153 | - public function get_select_join_limit($limit) |
|
| 154 | - { |
|
| 155 | - $limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit; |
|
| 156 | - $SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias; |
|
| 157 | - return $SQL; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Returns whether or not htis is a global table (ie, on multisite there's |
|
| 164 | - * only one of these tables, on the main blog) |
|
| 165 | - * |
|
| 166 | - * @return boolean |
|
| 167 | - */ |
|
| 168 | - public function is_global() |
|
| 169 | - { |
|
| 170 | - return $this->_global; |
|
| 171 | - } |
|
| 12 | + /** |
|
| 13 | + * This holds the table_name without the table prefix. |
|
| 14 | + * |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + public $_table_name; |
|
| 18 | + |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * This holds what is used as the alias for the table in queries. |
|
| 22 | + * |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | + public $_table_alias; |
|
| 26 | + |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Table's private key column |
|
| 30 | + * |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | + protected $_pk_column; |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Whether this table is a global table (in multisite) or specific to site. |
|
| 38 | + * |
|
| 39 | + * @var bool |
|
| 40 | + */ |
|
| 41 | + protected $_global; |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @global wpdb $wpdb |
|
| 47 | + * @param string $table_name with or without wpdb prefix |
|
| 48 | + * @param string $pk_column |
|
| 49 | + * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite |
|
| 50 | + * install, or whether each site on a multisite install has a copy of this table |
|
| 51 | + */ |
|
| 52 | + public function __construct($table_name, $pk_column, $global = false) |
|
| 53 | + { |
|
| 54 | + $this->_global = $global; |
|
| 55 | + $prefix = $this->get_table_prefix(); |
|
| 56 | + // if they added the prefix, let's remove it because we delay adding the prefix until right when its needed. |
|
| 57 | + if (strpos($table_name, $prefix) === 0) { |
|
| 58 | + $table_name = ltrim($table_name, $prefix); |
|
| 59 | + } |
|
| 60 | + $this->_table_name = $table_name; |
|
| 61 | + $this->_pk_column = $pk_column; |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * This returns the table prefix for the current model state. |
|
| 68 | + * |
|
| 69 | + * @global wpdb $wpdb |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public function get_table_prefix() |
|
| 73 | + { |
|
| 74 | + global $wpdb; |
|
| 75 | + if ($this->_global) { |
|
| 76 | + $prefix = $wpdb->base_prefix; |
|
| 77 | + } else { |
|
| 78 | + $prefix = $wpdb->get_blog_prefix(EEM_Base::get_model_query_blog_id()); |
|
| 79 | + } |
|
| 80 | + return $prefix; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Used to set the table_alias property |
|
| 87 | + * |
|
| 88 | + * @param string $table_alias |
|
| 89 | + */ |
|
| 90 | + public function _construct_finalize_with_alias($table_alias) |
|
| 91 | + { |
|
| 92 | + $this->_table_alias = $table_alias; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Returns the fully qualified table name for the database (includes the table prefix current for the blog). |
|
| 99 | + * |
|
| 100 | + * @return string |
|
| 101 | + */ |
|
| 102 | + public function get_table_name() |
|
| 103 | + { |
|
| 104 | + return $this->get_table_prefix() . $this->_table_name; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Provides what is currently set as the alias for the table to be used in queries. |
|
| 111 | + * |
|
| 112 | + * @return string |
|
| 113 | + * @throws EE_Error |
|
| 114 | + */ |
|
| 115 | + public function get_table_alias() |
|
| 116 | + { |
|
| 117 | + if (! $this->_table_alias) { |
|
| 118 | + throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?"); |
|
| 119 | + } |
|
| 120 | + return $this->_table_alias; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * @return string name of column of PK |
|
| 127 | + */ |
|
| 128 | + public function get_pk_column() |
|
| 129 | + { |
|
| 130 | + return $this->_pk_column; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * returns a string with the table alias, a period, and the private key's column. |
|
| 137 | + * |
|
| 138 | + * @return string |
|
| 139 | + */ |
|
| 140 | + public function get_fully_qualified_pk_column() |
|
| 141 | + { |
|
| 142 | + $sql = $this->get_table_alias() . "." . $this->get_pk_column(); |
|
| 143 | + return $sql; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * returns the special sql for a inner select with a limit. |
|
| 150 | + * |
|
| 151 | + * @return string SQL select |
|
| 152 | + */ |
|
| 153 | + public function get_select_join_limit($limit) |
|
| 154 | + { |
|
| 155 | + $limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit; |
|
| 156 | + $SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias; |
|
| 157 | + return $SQL; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Returns whether or not htis is a global table (ie, on multisite there's |
|
| 164 | + * only one of these tables, on the main blog) |
|
| 165 | + * |
|
| 166 | + * @return boolean |
|
| 167 | + */ |
|
| 168 | + public function is_global() |
|
| 169 | + { |
|
| 170 | + return $this->_global; |
|
| 171 | + } |
|
| 172 | 172 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function get_table_name() |
| 103 | 103 | { |
| 104 | - return $this->get_table_prefix() . $this->_table_name; |
|
| 104 | + return $this->get_table_prefix().$this->_table_name; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function get_table_alias() |
| 116 | 116 | { |
| 117 | - if (! $this->_table_alias) { |
|
| 117 | + if ( ! $this->_table_alias) { |
|
| 118 | 118 | throw new EE_Error("You must call _construct_finalize_with_alias before using the EE_Table_Base. Did you forget to call parent::__construct at the end of your EEMerimental_Base child's __construct?"); |
| 119 | 119 | } |
| 120 | 120 | return $this->_table_alias; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function get_fully_qualified_pk_column() |
| 141 | 141 | { |
| 142 | - $sql = $this->get_table_alias() . "." . $this->get_pk_column(); |
|
| 142 | + $sql = $this->get_table_alias().".".$this->get_pk_column(); |
|
| 143 | 143 | return $sql; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function get_select_join_limit($limit) |
| 154 | 154 | { |
| 155 | - $limit = is_array($limit) ? 'LIMIT ' . implode(',', array_map('intval', $limit)) : 'LIMIT ' . (int) $limit; |
|
| 156 | - $SQL = SP . '(SELECT * FROM ' . $this->_table_name . SP . $limit . ') AS ' . $this->_table_alias; |
|
| 155 | + $limit = is_array($limit) ? 'LIMIT '.implode(',', array_map('intval', $limit)) : 'LIMIT '.(int) $limit; |
|
| 156 | + $SQL = SP.'(SELECT * FROM '.$this->_table_name.SP.$limit.') AS '.$this->_table_alias; |
|
| 157 | 157 | return $SQL; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -6,5 +6,5 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class EE_Unique_Index extends EE_Index |
| 8 | 8 | { |
| 9 | - // yep, actually the same as index right now |
|
| 9 | + // yep, actually the same as index right now |
|
| 10 | 10 | } |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | class EE_Primary_Table extends EE_Table_Base |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * |
|
| 12 | - * @global type $wpdb |
|
| 13 | - * @param string $table_name with or without wpdb prefix |
|
| 14 | - * @param string $pk_column name of primary key column |
|
| 15 | - * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install, |
|
| 16 | - * or whether each site on a multisite install has a copy of this table |
|
| 17 | - */ |
|
| 18 | - public function __construct($table_name, $pk_column = null, $global = false) |
|
| 19 | - { |
|
| 20 | - parent::__construct($table_name, $pk_column, $global); |
|
| 21 | - } |
|
| 22 | - /** |
|
| 23 | - * Gets SQL for this table and assigning it an alias. Eg " wp_esp_attendee AS Attendee " |
|
| 24 | - * @return string |
|
| 25 | - */ |
|
| 26 | - public function get_table_sql() |
|
| 27 | - { |
|
| 28 | - return " ".$this->get_table_name()." AS ".$this->get_table_alias()." "; |
|
| 29 | - } |
|
| 10 | + /** |
|
| 11 | + * |
|
| 12 | + * @global type $wpdb |
|
| 13 | + * @param string $table_name with or without wpdb prefix |
|
| 14 | + * @param string $pk_column name of primary key column |
|
| 15 | + * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install, |
|
| 16 | + * or whether each site on a multisite install has a copy of this table |
|
| 17 | + */ |
|
| 18 | + public function __construct($table_name, $pk_column = null, $global = false) |
|
| 19 | + { |
|
| 20 | + parent::__construct($table_name, $pk_column, $global); |
|
| 21 | + } |
|
| 22 | + /** |
|
| 23 | + * Gets SQL for this table and assigning it an alias. Eg " wp_esp_attendee AS Attendee " |
|
| 24 | + * @return string |
|
| 25 | + */ |
|
| 26 | + public function get_table_sql() |
|
| 27 | + { |
|
| 28 | + return " ".$this->get_table_name()." AS ".$this->get_table_alias()." "; |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -8,153 +8,153 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class EE_Model_Parser |
| 10 | 10 | { |
| 11 | - const table_alias_model_relation_chain_separator = '__'; |
|
| 12 | - const table_alias_model_relation_chain_prefix_end = '___'; |
|
| 13 | - /** |
|
| 14 | - * Adds a period onto the front and end of the string. This often helps in searching. |
|
| 15 | - * For example, if we want to find the model name "Event", it can be tricky when the following are possible |
|
| 16 | - * "","Event.EVT_ID","Event","Event_Venue.Venue.VNU_ID",etc. It's easier to look for ".Event." in |
|
| 17 | - * "..",".Event.EVT_ID.", ".Event.", and ".Event_Venue.Venue.VNU_ID", especially when the last example should NOT |
|
| 18 | - * be found because the "Event" model isn't mentioned- it's just a string that has a model name that coincidentally |
|
| 19 | - * has it as a substring |
|
| 20 | - * @param string $string_to_pad |
|
| 21 | - * @return string |
|
| 22 | - */ |
|
| 23 | - public static function pad_with_periods($string_to_pad) |
|
| 24 | - { |
|
| 25 | - return ".".$string_to_pad."."; |
|
| 26 | - } |
|
| 27 | - /** |
|
| 28 | - * Basically undoes _pad_with_periods |
|
| 29 | - * @param string $string_to_trim |
|
| 30 | - * @return string |
|
| 31 | - */ |
|
| 32 | - public static function trim_periods($string_to_trim) |
|
| 33 | - { |
|
| 34 | - return trim($string_to_trim, '.'); |
|
| 35 | - } |
|
| 11 | + const table_alias_model_relation_chain_separator = '__'; |
|
| 12 | + const table_alias_model_relation_chain_prefix_end = '___'; |
|
| 13 | + /** |
|
| 14 | + * Adds a period onto the front and end of the string. This often helps in searching. |
|
| 15 | + * For example, if we want to find the model name "Event", it can be tricky when the following are possible |
|
| 16 | + * "","Event.EVT_ID","Event","Event_Venue.Venue.VNU_ID",etc. It's easier to look for ".Event." in |
|
| 17 | + * "..",".Event.EVT_ID.", ".Event.", and ".Event_Venue.Venue.VNU_ID", especially when the last example should NOT |
|
| 18 | + * be found because the "Event" model isn't mentioned- it's just a string that has a model name that coincidentally |
|
| 19 | + * has it as a substring |
|
| 20 | + * @param string $string_to_pad |
|
| 21 | + * @return string |
|
| 22 | + */ |
|
| 23 | + public static function pad_with_periods($string_to_pad) |
|
| 24 | + { |
|
| 25 | + return ".".$string_to_pad."."; |
|
| 26 | + } |
|
| 27 | + /** |
|
| 28 | + * Basically undoes _pad_with_periods |
|
| 29 | + * @param string $string_to_trim |
|
| 30 | + * @return string |
|
| 31 | + */ |
|
| 32 | + public static function trim_periods($string_to_trim) |
|
| 33 | + { |
|
| 34 | + return trim($string_to_trim, '.'); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Gets the calculated table's alias |
|
| 41 | - * @param string $model_relation_chain or query param |
|
| 42 | - * @param $this_model_name |
|
| 43 | - * @return string which can be added onto table aliases to make them unique |
|
| 44 | - */ |
|
| 45 | - public static function extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this_model_name) |
|
| 46 | - { |
|
| 47 | - // eg $model_relation_chain = 'Venue.Event_Venue.Event.Registration", and $this_model_name = 'Event' |
|
| 48 | - $model_relation_chain = self::pad_with_periods($model_relation_chain); |
|
| 49 | - $this_model_name = self::pad_with_periods($this_model_name); |
|
| 50 | - // eg '.Venue.Event_Venue.Event.Registration." and '.Event.' |
|
| 51 | - // remove this model name and everything afterwards |
|
| 52 | - $pos_of_model_name = strpos($model_relation_chain, $this_model_name); |
|
| 53 | - $model_relation_chain = substr($model_relation_chain, 0, $pos_of_model_name); |
|
| 54 | - // eg '.Venue.Event_Venue.' |
|
| 55 | - // trim periods |
|
| 56 | - $model_relation_chain = self::trim_periods($model_relation_chain); |
|
| 57 | - // eg 'Venue.Event_Venue' |
|
| 58 | - // replace periods with double-underscores |
|
| 59 | - $model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain); |
|
| 60 | - // eg 'Venue__Event_Venue' |
|
| 61 | - if ($model_relation_chain !='') { |
|
| 62 | - $model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end; |
|
| 63 | - } |
|
| 64 | - // eg 'Venue_Event_Venue___' |
|
| 65 | - return $model_relation_chain; |
|
| 66 | - } |
|
| 67 | - /** |
|
| 68 | - * Gets the table's alias (without prefix or anything) |
|
| 69 | - * @param string $table_alias_with_model_relation_chain_prefix which CAN have a table alias model relation chain prefix (or not) |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public static function remove_table_alias_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix) |
|
| 73 | - { |
|
| 74 | - // does this actually have a table alias model relation chain prefix? |
|
| 75 | - $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end); |
|
| 76 | - if ($pos !== false) { |
|
| 77 | - // yes |
|
| 78 | - // find that triple underscore and remove it and everything before it |
|
| 79 | - $table_alias = substr($table_alias_with_model_relation_chain_prefix, $pos + strlen(self::table_alias_model_relation_chain_prefix_end)); |
|
| 80 | - } else { |
|
| 81 | - $table_alias = $table_alias_with_model_relation_chain_prefix; |
|
| 82 | - } |
|
| 83 | - return $table_alias; |
|
| 84 | - } |
|
| 85 | - /** |
|
| 86 | - * Gets the table alias model relation chain prefix from the table alias already containing it |
|
| 87 | - * @param string $table_alias_with_model_relation_chain_prefix |
|
| 88 | - * @return string |
|
| 89 | - */ |
|
| 90 | - public static function get_prefix_from_table_alias_with_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix) |
|
| 91 | - { |
|
| 92 | - // does this actually have a table alias model relation chain prefix? |
|
| 93 | - $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end); |
|
| 94 | - if ($pos !== false) { |
|
| 95 | - // yes |
|
| 96 | - // find that triple underscore and remove it and everything before it |
|
| 97 | - $prefix = substr($table_alias_with_model_relation_chain_prefix, 0, $pos + strlen(self::table_alias_model_relation_chain_prefix_end)); |
|
| 98 | - } else { |
|
| 99 | - $prefix = ''; |
|
| 100 | - } |
|
| 101 | - return $prefix; |
|
| 102 | - } |
|
| 39 | + /** |
|
| 40 | + * Gets the calculated table's alias |
|
| 41 | + * @param string $model_relation_chain or query param |
|
| 42 | + * @param $this_model_name |
|
| 43 | + * @return string which can be added onto table aliases to make them unique |
|
| 44 | + */ |
|
| 45 | + public static function extract_table_alias_model_relation_chain_prefix($model_relation_chain, $this_model_name) |
|
| 46 | + { |
|
| 47 | + // eg $model_relation_chain = 'Venue.Event_Venue.Event.Registration", and $this_model_name = 'Event' |
|
| 48 | + $model_relation_chain = self::pad_with_periods($model_relation_chain); |
|
| 49 | + $this_model_name = self::pad_with_periods($this_model_name); |
|
| 50 | + // eg '.Venue.Event_Venue.Event.Registration." and '.Event.' |
|
| 51 | + // remove this model name and everything afterwards |
|
| 52 | + $pos_of_model_name = strpos($model_relation_chain, $this_model_name); |
|
| 53 | + $model_relation_chain = substr($model_relation_chain, 0, $pos_of_model_name); |
|
| 54 | + // eg '.Venue.Event_Venue.' |
|
| 55 | + // trim periods |
|
| 56 | + $model_relation_chain = self::trim_periods($model_relation_chain); |
|
| 57 | + // eg 'Venue.Event_Venue' |
|
| 58 | + // replace periods with double-underscores |
|
| 59 | + $model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain); |
|
| 60 | + // eg 'Venue__Event_Venue' |
|
| 61 | + if ($model_relation_chain !='') { |
|
| 62 | + $model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end; |
|
| 63 | + } |
|
| 64 | + // eg 'Venue_Event_Venue___' |
|
| 65 | + return $model_relation_chain; |
|
| 66 | + } |
|
| 67 | + /** |
|
| 68 | + * Gets the table's alias (without prefix or anything) |
|
| 69 | + * @param string $table_alias_with_model_relation_chain_prefix which CAN have a table alias model relation chain prefix (or not) |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public static function remove_table_alias_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix) |
|
| 73 | + { |
|
| 74 | + // does this actually have a table alias model relation chain prefix? |
|
| 75 | + $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end); |
|
| 76 | + if ($pos !== false) { |
|
| 77 | + // yes |
|
| 78 | + // find that triple underscore and remove it and everything before it |
|
| 79 | + $table_alias = substr($table_alias_with_model_relation_chain_prefix, $pos + strlen(self::table_alias_model_relation_chain_prefix_end)); |
|
| 80 | + } else { |
|
| 81 | + $table_alias = $table_alias_with_model_relation_chain_prefix; |
|
| 82 | + } |
|
| 83 | + return $table_alias; |
|
| 84 | + } |
|
| 85 | + /** |
|
| 86 | + * Gets the table alias model relation chain prefix from the table alias already containing it |
|
| 87 | + * @param string $table_alias_with_model_relation_chain_prefix |
|
| 88 | + * @return string |
|
| 89 | + */ |
|
| 90 | + public static function get_prefix_from_table_alias_with_model_relation_chain_prefix($table_alias_with_model_relation_chain_prefix) |
|
| 91 | + { |
|
| 92 | + // does this actually have a table alias model relation chain prefix? |
|
| 93 | + $pos = strpos($table_alias_with_model_relation_chain_prefix, self::table_alias_model_relation_chain_prefix_end); |
|
| 94 | + if ($pos !== false) { |
|
| 95 | + // yes |
|
| 96 | + // find that triple underscore and remove it and everything before it |
|
| 97 | + $prefix = substr($table_alias_with_model_relation_chain_prefix, 0, $pos + strlen(self::table_alias_model_relation_chain_prefix_end)); |
|
| 98 | + } else { |
|
| 99 | + $prefix = ''; |
|
| 100 | + } |
|
| 101 | + return $prefix; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Gets the table alias model relation chain prefix (ie, what can be prepended onto |
|
| 106 | - * EE_Model_Field::get_qualified_column() to get the proper column name for that field |
|
| 107 | - * in a specific query) from teh query param (eg 'Registration.Event.EVT_ID'). |
|
| 108 | - * |
|
| 109 | - * @param string $model_name of the model on which the related query param was found to be belong |
|
| 110 | - * @param string $original_query_param |
|
| 111 | - * @return string |
|
| 112 | - */ |
|
| 113 | - public static function extract_table_alias_model_relation_chain_from_query_param($model_name, $original_query_param) |
|
| 114 | - { |
|
| 115 | - $relation_chain = self::extract_model_relation_chain($model_name, $original_query_param); |
|
| 116 | - $table_alias_with_model_relation_chain_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($relation_chain, $model_name); |
|
| 117 | - return $table_alias_with_model_relation_chain_prefix; |
|
| 118 | - } |
|
| 119 | - /** |
|
| 120 | - * Gets the model relation chain to $model_name from the $original_query_param. |
|
| 121 | - * Eg, if $model_name were 'Payment', and $original_query_param were 'Registration.Transaction.Payment.PAY_ID', |
|
| 122 | - * this would return 'Registration.Transaction.Payment'. Also if the query param were 'Registration.Transaction.Payment' |
|
| 123 | - * and $model_name were 'Payment', it should return 'Registration.Transaction.Payment' |
|
| 124 | - * @param string $model_name |
|
| 125 | - * @param string $original_query_param |
|
| 126 | - * @return string |
|
| 127 | - */ |
|
| 128 | - public static function extract_model_relation_chain($model_name, $original_query_param) |
|
| 129 | - { |
|
| 130 | - // prefix and postfix both with a period, as this facilitates searching |
|
| 131 | - $model_name = EE_Model_Parser::pad_with_periods($model_name); |
|
| 132 | - $original_query_param = EE_Model_Parser::pad_with_periods($original_query_param); |
|
| 133 | - $pos_of_model_string = strpos($original_query_param, $model_name); |
|
| 134 | - // eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like |
|
| 135 | - // "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string |
|
| 136 | - // "Registration.Transaction.Payment" |
|
| 137 | - $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name)); |
|
| 138 | - return EE_Model_Parser::trim_periods($model_relation_chain); |
|
| 139 | - } |
|
| 104 | + /** |
|
| 105 | + * Gets the table alias model relation chain prefix (ie, what can be prepended onto |
|
| 106 | + * EE_Model_Field::get_qualified_column() to get the proper column name for that field |
|
| 107 | + * in a specific query) from teh query param (eg 'Registration.Event.EVT_ID'). |
|
| 108 | + * |
|
| 109 | + * @param string $model_name of the model on which the related query param was found to be belong |
|
| 110 | + * @param string $original_query_param |
|
| 111 | + * @return string |
|
| 112 | + */ |
|
| 113 | + public static function extract_table_alias_model_relation_chain_from_query_param($model_name, $original_query_param) |
|
| 114 | + { |
|
| 115 | + $relation_chain = self::extract_model_relation_chain($model_name, $original_query_param); |
|
| 116 | + $table_alias_with_model_relation_chain_prefix = EE_Model_Parser::extract_table_alias_model_relation_chain_prefix($relation_chain, $model_name); |
|
| 117 | + return $table_alias_with_model_relation_chain_prefix; |
|
| 118 | + } |
|
| 119 | + /** |
|
| 120 | + * Gets the model relation chain to $model_name from the $original_query_param. |
|
| 121 | + * Eg, if $model_name were 'Payment', and $original_query_param were 'Registration.Transaction.Payment.PAY_ID', |
|
| 122 | + * this would return 'Registration.Transaction.Payment'. Also if the query param were 'Registration.Transaction.Payment' |
|
| 123 | + * and $model_name were 'Payment', it should return 'Registration.Transaction.Payment' |
|
| 124 | + * @param string $model_name |
|
| 125 | + * @param string $original_query_param |
|
| 126 | + * @return string |
|
| 127 | + */ |
|
| 128 | + public static function extract_model_relation_chain($model_name, $original_query_param) |
|
| 129 | + { |
|
| 130 | + // prefix and postfix both with a period, as this facilitates searching |
|
| 131 | + $model_name = EE_Model_Parser::pad_with_periods($model_name); |
|
| 132 | + $original_query_param = EE_Model_Parser::pad_with_periods($original_query_param); |
|
| 133 | + $pos_of_model_string = strpos($original_query_param, $model_name); |
|
| 134 | + // eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like |
|
| 135 | + // "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string |
|
| 136 | + // "Registration.Transaction.Payment" |
|
| 137 | + $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name)); |
|
| 138 | + return EE_Model_Parser::trim_periods($model_relation_chain); |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Replaces the specified model in teh model relation chain with teh join model. |
|
| 143 | - * Eg EE_Model_Parser::replace_model_name_with_join_model_name_in_model_relation_chain( |
|
| 144 | - * "Ticket", "Datetime_Ticket", "Datetime.Ticket" ) will return |
|
| 145 | - * "Datetime.Datetime_Ticket" which can be used to find the table alias model relation chain prefix |
|
| 146 | - * using EE_Model_Parser::extract_table_alias_model_relation_chain_prefix |
|
| 147 | - * @param string $model_name |
|
| 148 | - * @param string $join_model_name |
|
| 149 | - * @param string $model_relation_chain |
|
| 150 | - * @return string |
|
| 151 | - */ |
|
| 152 | - public static function replace_model_name_with_join_model_name_in_model_relation_chain($model_name, $join_model_name, $model_relation_chain) |
|
| 153 | - { |
|
| 154 | - $model_name = EE_Model_Parser::pad_with_periods($model_name); |
|
| 155 | - $join_model_name = EE_Model_Parser::pad_with_periods($join_model_name); |
|
| 156 | - $model_relation_chain = EE_Model_Parser::pad_with_periods($model_relation_chain); |
|
| 157 | - $replaced_with_periods = str_replace($model_name, $join_model_name, $model_relation_chain); |
|
| 158 | - return EE_Model_Parser::trim_periods($replaced_with_periods); |
|
| 159 | - } |
|
| 141 | + /** |
|
| 142 | + * Replaces the specified model in teh model relation chain with teh join model. |
|
| 143 | + * Eg EE_Model_Parser::replace_model_name_with_join_model_name_in_model_relation_chain( |
|
| 144 | + * "Ticket", "Datetime_Ticket", "Datetime.Ticket" ) will return |
|
| 145 | + * "Datetime.Datetime_Ticket" which can be used to find the table alias model relation chain prefix |
|
| 146 | + * using EE_Model_Parser::extract_table_alias_model_relation_chain_prefix |
|
| 147 | + * @param string $model_name |
|
| 148 | + * @param string $join_model_name |
|
| 149 | + * @param string $model_relation_chain |
|
| 150 | + * @return string |
|
| 151 | + */ |
|
| 152 | + public static function replace_model_name_with_join_model_name_in_model_relation_chain($model_name, $join_model_name, $model_relation_chain) |
|
| 153 | + { |
|
| 154 | + $model_name = EE_Model_Parser::pad_with_periods($model_name); |
|
| 155 | + $join_model_name = EE_Model_Parser::pad_with_periods($join_model_name); |
|
| 156 | + $model_relation_chain = EE_Model_Parser::pad_with_periods($model_relation_chain); |
|
| 157 | + $replaced_with_periods = str_replace($model_name, $join_model_name, $model_relation_chain); |
|
| 158 | + return EE_Model_Parser::trim_periods($replaced_with_periods); |
|
| 159 | + } |
|
| 160 | 160 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // replace periods with double-underscores |
| 59 | 59 | $model_relation_chain = str_replace(".", self::table_alias_model_relation_chain_separator, $model_relation_chain); |
| 60 | 60 | // eg 'Venue__Event_Venue' |
| 61 | - if ($model_relation_chain !='') { |
|
| 61 | + if ($model_relation_chain != '') { |
|
| 62 | 62 | $model_relation_chain = $model_relation_chain.self::table_alias_model_relation_chain_prefix_end; |
| 63 | 63 | } |
| 64 | 64 | // eg 'Venue_Event_Venue___' |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | // eg, if we're looking for the model relation chain from Event to Payment, the original query param is probably something like |
| 135 | 135 | // "Registration.Transaction.Payment.PAY_ID", $pos_of_model_string points to the 'P' or Payment. We want the string |
| 136 | 136 | // "Registration.Transaction.Payment" |
| 137 | - $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string+strlen($model_name)); |
|
| 137 | + $model_relation_chain = substr($original_query_param, 0, $pos_of_model_string + strlen($model_name)); |
|
| 138 | 138 | return EE_Model_Parser::trim_periods($model_relation_chain); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -6,5 +6,5 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class EE_Primary_Key_Index extends EE_Unique_Index |
| 8 | 8 | { |
| 9 | - // yep, actually the same as unique index right now |
|
| 9 | + // yep, actually the same as unique index right now |
|
| 10 | 10 | } |
@@ -13,27 +13,27 @@ |
||
| 13 | 13 | { |
| 14 | 14 | |
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * @deprecated |
|
| 18 | - * @param EE_Request $request |
|
| 19 | - * @param EE_Response $response |
|
| 20 | - * @return EE_Response |
|
| 21 | - */ |
|
| 22 | - public function handle_request(EE_Request $request, EE_Response $response) |
|
| 23 | - { |
|
| 24 | - EE_Error::doing_it_wrong( |
|
| 25 | - __METHOD__, |
|
| 26 | - sprintf( |
|
| 27 | - esc_html__( |
|
| 28 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 29 | - 'event_espresso' |
|
| 30 | - ), |
|
| 31 | - 'EventEspresso\core\services\request\middleware\DetectLogin', |
|
| 32 | - '\core\services\request', |
|
| 33 | - 'EventEspresso\core\services\request' |
|
| 34 | - ), |
|
| 35 | - '4.9.52' |
|
| 36 | - ); |
|
| 37 | - return $response; |
|
| 38 | - } |
|
| 16 | + /** |
|
| 17 | + * @deprecated |
|
| 18 | + * @param EE_Request $request |
|
| 19 | + * @param EE_Response $response |
|
| 20 | + * @return EE_Response |
|
| 21 | + */ |
|
| 22 | + public function handle_request(EE_Request $request, EE_Response $response) |
|
| 23 | + { |
|
| 24 | + EE_Error::doing_it_wrong( |
|
| 25 | + __METHOD__, |
|
| 26 | + sprintf( |
|
| 27 | + esc_html__( |
|
| 28 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 29 | + 'event_espresso' |
|
| 30 | + ), |
|
| 31 | + 'EventEspresso\core\services\request\middleware\DetectLogin', |
|
| 32 | + '\core\services\request', |
|
| 33 | + 'EventEspresso\core\services\request' |
|
| 34 | + ), |
|
| 35 | + '4.9.52' |
|
| 36 | + ); |
|
| 37 | + return $response; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -17,75 +17,75 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @deprecated |
|
| 22 | - * @param EE_Request $request |
|
| 23 | - * @param EE_Response $response |
|
| 24 | - * @return EE_Response |
|
| 25 | - */ |
|
| 26 | - public function handle_request(EE_Request $request, EE_Response $response) |
|
| 27 | - { |
|
| 28 | - EE_Error::doing_it_wrong( |
|
| 29 | - __METHOD__, |
|
| 30 | - sprintf( |
|
| 31 | - esc_html__( |
|
| 32 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 33 | - 'event_espresso' |
|
| 34 | - ), |
|
| 35 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions', |
|
| 36 | - '\core\services\request', |
|
| 37 | - 'EventEspresso\core\services\request' |
|
| 38 | - ), |
|
| 39 | - '4.9.52' |
|
| 40 | - ); |
|
| 41 | - return $response; |
|
| 42 | - } |
|
| 20 | + /** |
|
| 21 | + * @deprecated |
|
| 22 | + * @param EE_Request $request |
|
| 23 | + * @param EE_Response $response |
|
| 24 | + * @return EE_Response |
|
| 25 | + */ |
|
| 26 | + public function handle_request(EE_Request $request, EE_Response $response) |
|
| 27 | + { |
|
| 28 | + EE_Error::doing_it_wrong( |
|
| 29 | + __METHOD__, |
|
| 30 | + sprintf( |
|
| 31 | + esc_html__( |
|
| 32 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 33 | + 'event_espresso' |
|
| 34 | + ), |
|
| 35 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions', |
|
| 36 | + '\core\services\request', |
|
| 37 | + 'EventEspresso\core\services\request' |
|
| 38 | + ), |
|
| 39 | + '4.9.52' |
|
| 40 | + ); |
|
| 41 | + return $response; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @deprecated |
|
| 47 | - * @param string $version_to_check |
|
| 48 | - * @param string $operator |
|
| 49 | - * @return bool |
|
| 50 | - */ |
|
| 51 | - public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
| 52 | - { |
|
| 53 | - EE_Error::doing_it_wrong( |
|
| 54 | - __METHOD__, |
|
| 55 | - sprintf( |
|
| 56 | - esc_html__( |
|
| 57 | - 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 58 | - 'event_espresso' |
|
| 59 | - ), |
|
| 60 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions::compareWordPressVersion()', |
|
| 61 | - '\core\services\request', |
|
| 62 | - 'EventEspresso\core\services\request' |
|
| 63 | - ), |
|
| 64 | - '4.9.52', |
|
| 65 | - '5.0.0' |
|
| 66 | - ); |
|
| 67 | - return RecommendedVersions::compareWordPressVersion($version_to_check, $operator); |
|
| 68 | - } |
|
| 45 | + /** |
|
| 46 | + * @deprecated |
|
| 47 | + * @param string $version_to_check |
|
| 48 | + * @param string $operator |
|
| 49 | + * @return bool |
|
| 50 | + */ |
|
| 51 | + public static function check_wp_version($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
| 52 | + { |
|
| 53 | + EE_Error::doing_it_wrong( |
|
| 54 | + __METHOD__, |
|
| 55 | + sprintf( |
|
| 56 | + esc_html__( |
|
| 57 | + 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 58 | + 'event_espresso' |
|
| 59 | + ), |
|
| 60 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions::compareWordPressVersion()', |
|
| 61 | + '\core\services\request', |
|
| 62 | + 'EventEspresso\core\services\request' |
|
| 63 | + ), |
|
| 64 | + '4.9.52', |
|
| 65 | + '5.0.0' |
|
| 66 | + ); |
|
| 67 | + return RecommendedVersions::compareWordPressVersion($version_to_check, $operator); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @deprecated |
|
| 73 | - * @return void |
|
| 74 | - */ |
|
| 75 | - public function minimum_wp_version_error() |
|
| 76 | - { |
|
| 77 | - EE_Error::doing_it_wrong( |
|
| 78 | - __METHOD__, |
|
| 79 | - sprintf( |
|
| 80 | - esc_html__( |
|
| 81 | - 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 82 | - 'event_espresso' |
|
| 83 | - ), |
|
| 84 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions::minimumWpVersionError()', |
|
| 85 | - '\core\services\request', |
|
| 86 | - 'EventEspresso\core\services\request' |
|
| 87 | - ), |
|
| 88 | - '4.9.52' |
|
| 89 | - ); |
|
| 90 | - } |
|
| 71 | + /** |
|
| 72 | + * @deprecated |
|
| 73 | + * @return void |
|
| 74 | + */ |
|
| 75 | + public function minimum_wp_version_error() |
|
| 76 | + { |
|
| 77 | + EE_Error::doing_it_wrong( |
|
| 78 | + __METHOD__, |
|
| 79 | + sprintf( |
|
| 80 | + esc_html__( |
|
| 81 | + 'This method is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 82 | + 'event_espresso' |
|
| 83 | + ), |
|
| 84 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions::minimumWpVersionError()', |
|
| 85 | + '\core\services\request', |
|
| 86 | + 'EventEspresso\core\services\request' |
|
| 87 | + ), |
|
| 88 | + '4.9.52' |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -20,27 +20,27 @@ |
||
| 20 | 20 | abstract class EE_Middleware implements EEI_Request_Decorator |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @deprecated |
|
| 25 | - * @param EE_Request $request |
|
| 26 | - * @param EE_Response $response |
|
| 27 | - * @return EE_Response |
|
| 28 | - */ |
|
| 29 | - protected function process_request_stack(EE_Request $request, EE_Response $response) |
|
| 30 | - { |
|
| 31 | - EE_Error::doing_it_wrong( |
|
| 32 | - __METHOD__, |
|
| 33 | - sprintf( |
|
| 34 | - esc_html__( |
|
| 35 | - 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 36 | - 'event_espresso' |
|
| 37 | - ), |
|
| 38 | - 'EventEspresso\core\services\request\middleware\Middleware', |
|
| 39 | - '\core\services\request', |
|
| 40 | - 'EventEspresso\core\services\request' |
|
| 41 | - ), |
|
| 42 | - '4.9.52' |
|
| 43 | - ); |
|
| 44 | - return $response; |
|
| 45 | - } |
|
| 23 | + /** |
|
| 24 | + * @deprecated |
|
| 25 | + * @param EE_Request $request |
|
| 26 | + * @param EE_Response $response |
|
| 27 | + * @return EE_Response |
|
| 28 | + */ |
|
| 29 | + protected function process_request_stack(EE_Request $request, EE_Response $response) |
|
| 30 | + { |
|
| 31 | + EE_Error::doing_it_wrong( |
|
| 32 | + __METHOD__, |
|
| 33 | + sprintf( |
|
| 34 | + esc_html__( |
|
| 35 | + 'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace', |
|
| 36 | + 'event_espresso' |
|
| 37 | + ), |
|
| 38 | + 'EventEspresso\core\services\request\middleware\Middleware', |
|
| 39 | + '\core\services\request', |
|
| 40 | + 'EventEspresso\core\services\request' |
|
| 41 | + ), |
|
| 42 | + '4.9.52' |
|
| 43 | + ); |
|
| 44 | + return $response; |
|
| 45 | + } |
|
| 46 | 46 | } |