@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getType() |
| 95 | 95 | { |
| 96 | - if (!$this->type) { |
|
| 96 | + if ( ! $this->type) { |
|
| 97 | 97 | $this->type = $this->determineType(); |
| 98 | 98 | } |
| 99 | 99 | return $this->type; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | protected function determineType() |
| 107 | 107 | { |
| 108 | - if (!$this->getTmpFile()) { |
|
| 108 | + if ( ! $this->getTmpFile()) { |
|
| 109 | 109 | return ''; |
| 110 | 110 | } |
| 111 | 111 | $finfo = new finfo(FILEINFO_MIME_TYPE); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function getExtension() |
| 121 | 121 | { |
| 122 | - if (!$this->extension) { |
|
| 122 | + if ( ! $this->extension) { |
|
| 123 | 123 | $this->extension = $this->determineExtension(); |
| 124 | 124 | } |
| 125 | 125 | return $this->extension; |
@@ -19,164 +19,164 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class FileSubmission implements FileSubmissionInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var string original name on the client machine |
|
| 24 | - */ |
|
| 25 | - protected $name; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var string mime type |
|
| 29 | - */ |
|
| 30 | - protected $type; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var string file extension |
|
| 34 | - */ |
|
| 35 | - protected $extension; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var int in bytes |
|
| 39 | - */ |
|
| 40 | - protected $size; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @var string local filepath to the temporary file |
|
| 44 | - */ |
|
| 45 | - protected $tmp_file; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * @var int one of UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE or other values |
|
| 49 | - * although those aren't expected. |
|
| 50 | - */ |
|
| 51 | - protected $error_code; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * FileSubmission constructor. |
|
| 55 | - * @param $name |
|
| 56 | - * @param $tmp_file |
|
| 57 | - * @param $size |
|
| 58 | - * @param null $error_code |
|
| 59 | - * @throws InvalidArgumentException |
|
| 60 | - */ |
|
| 61 | - public function __construct($name, $tmp_file, $size, $error_code = null) |
|
| 62 | - { |
|
| 63 | - $this->name = basename($name); |
|
| 64 | - $scheme = parse_url($tmp_file, PHP_URL_SCHEME); |
|
| 65 | - if (in_array($scheme, ['http', 'https'])) { |
|
| 66 | - // Wait a minute- just local filepaths please, no URL schemes allowed! |
|
| 67 | - throw new InvalidArgumentException( |
|
| 68 | - sprintf( |
|
| 69 | - // @codingStandardsIgnoreStart |
|
| 70 | - esc_html__('The scheme ("%1$s") on the temporary file ("%2$s") indicates is located elsewhere, that’s not ok!', 'event_espresso'), |
|
| 71 | - // @codingStandardsIgnoreEnd |
|
| 72 | - $scheme, |
|
| 73 | - $tmp_file |
|
| 74 | - ) |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - $this->tmp_file = (string) $tmp_file; |
|
| 78 | - $this->size = (int) $size; |
|
| 79 | - $this->error_code = (int) $error_code; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @return string |
|
| 84 | - */ |
|
| 85 | - public function getName() |
|
| 86 | - { |
|
| 87 | - return $this->name; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Gets the file's mime type |
|
| 92 | - * @return string |
|
| 93 | - */ |
|
| 94 | - public function getType() |
|
| 95 | - { |
|
| 96 | - if (!$this->type) { |
|
| 97 | - $this->type = $this->determineType(); |
|
| 98 | - } |
|
| 99 | - return $this->type; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @since 4.9.80.p |
|
| 104 | - * @return string |
|
| 105 | - */ |
|
| 106 | - protected function determineType() |
|
| 107 | - { |
|
| 108 | - if (!$this->getTmpFile()) { |
|
| 109 | - return ''; |
|
| 110 | - } |
|
| 111 | - $finfo = new finfo(FILEINFO_MIME_TYPE); |
|
| 112 | - return $finfo->file($this->getTmpFile()); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Gets the file's extension. |
|
| 117 | - * @since 4.9.80.p |
|
| 118 | - * @return string |
|
| 119 | - */ |
|
| 120 | - public function getExtension() |
|
| 121 | - { |
|
| 122 | - if (!$this->extension) { |
|
| 123 | - $this->extension = $this->determineExtension(); |
|
| 124 | - } |
|
| 125 | - return $this->extension; |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Determine's the file's extension given the temporary file. |
|
| 130 | - * @since 4.9.80.p |
|
| 131 | - * @return string |
|
| 132 | - */ |
|
| 133 | - protected function determineExtension() |
|
| 134 | - { |
|
| 135 | - $position_of_period = strrpos($this->getName(), '.'); |
|
| 136 | - if ($position_of_period === false) { |
|
| 137 | - return ''; |
|
| 138 | - } |
|
| 139 | - return mb_substr( |
|
| 140 | - $this->getName(), |
|
| 141 | - $position_of_period + 1 |
|
| 142 | - ); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * Gets the size of the file |
|
| 147 | - * @return int |
|
| 148 | - */ |
|
| 149 | - public function getSize() |
|
| 150 | - { |
|
| 151 | - return $this->size; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Gets the path to the temporary file which was uploaded. |
|
| 156 | - * @return string |
|
| 157 | - */ |
|
| 158 | - public function getTmpFile() |
|
| 159 | - { |
|
| 160 | - return $this->tmp_file; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @since 4.9.80.p |
|
| 165 | - * @return string |
|
| 166 | - */ |
|
| 167 | - public function __toString() |
|
| 168 | - { |
|
| 169 | - return $this->getName(); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * Gets the error code PHP reported for the file upload. |
|
| 174 | - * @return string |
|
| 175 | - */ |
|
| 176 | - public function getErrorCode() |
|
| 177 | - { |
|
| 178 | - return $this->error_code; |
|
| 179 | - } |
|
| 22 | + /** |
|
| 23 | + * @var string original name on the client machine |
|
| 24 | + */ |
|
| 25 | + protected $name; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var string mime type |
|
| 29 | + */ |
|
| 30 | + protected $type; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var string file extension |
|
| 34 | + */ |
|
| 35 | + protected $extension; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var int in bytes |
|
| 39 | + */ |
|
| 40 | + protected $size; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @var string local filepath to the temporary file |
|
| 44 | + */ |
|
| 45 | + protected $tmp_file; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * @var int one of UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE, UPLOAD_ERR_INI_SIZE, UPLOAD_ERR_FORM_SIZE or other values |
|
| 49 | + * although those aren't expected. |
|
| 50 | + */ |
|
| 51 | + protected $error_code; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * FileSubmission constructor. |
|
| 55 | + * @param $name |
|
| 56 | + * @param $tmp_file |
|
| 57 | + * @param $size |
|
| 58 | + * @param null $error_code |
|
| 59 | + * @throws InvalidArgumentException |
|
| 60 | + */ |
|
| 61 | + public function __construct($name, $tmp_file, $size, $error_code = null) |
|
| 62 | + { |
|
| 63 | + $this->name = basename($name); |
|
| 64 | + $scheme = parse_url($tmp_file, PHP_URL_SCHEME); |
|
| 65 | + if (in_array($scheme, ['http', 'https'])) { |
|
| 66 | + // Wait a minute- just local filepaths please, no URL schemes allowed! |
|
| 67 | + throw new InvalidArgumentException( |
|
| 68 | + sprintf( |
|
| 69 | + // @codingStandardsIgnoreStart |
|
| 70 | + esc_html__('The scheme ("%1$s") on the temporary file ("%2$s") indicates is located elsewhere, that’s not ok!', 'event_espresso'), |
|
| 71 | + // @codingStandardsIgnoreEnd |
|
| 72 | + $scheme, |
|
| 73 | + $tmp_file |
|
| 74 | + ) |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + $this->tmp_file = (string) $tmp_file; |
|
| 78 | + $this->size = (int) $size; |
|
| 79 | + $this->error_code = (int) $error_code; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @return string |
|
| 84 | + */ |
|
| 85 | + public function getName() |
|
| 86 | + { |
|
| 87 | + return $this->name; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Gets the file's mime type |
|
| 92 | + * @return string |
|
| 93 | + */ |
|
| 94 | + public function getType() |
|
| 95 | + { |
|
| 96 | + if (!$this->type) { |
|
| 97 | + $this->type = $this->determineType(); |
|
| 98 | + } |
|
| 99 | + return $this->type; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @since 4.9.80.p |
|
| 104 | + * @return string |
|
| 105 | + */ |
|
| 106 | + protected function determineType() |
|
| 107 | + { |
|
| 108 | + if (!$this->getTmpFile()) { |
|
| 109 | + return ''; |
|
| 110 | + } |
|
| 111 | + $finfo = new finfo(FILEINFO_MIME_TYPE); |
|
| 112 | + return $finfo->file($this->getTmpFile()); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Gets the file's extension. |
|
| 117 | + * @since 4.9.80.p |
|
| 118 | + * @return string |
|
| 119 | + */ |
|
| 120 | + public function getExtension() |
|
| 121 | + { |
|
| 122 | + if (!$this->extension) { |
|
| 123 | + $this->extension = $this->determineExtension(); |
|
| 124 | + } |
|
| 125 | + return $this->extension; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Determine's the file's extension given the temporary file. |
|
| 130 | + * @since 4.9.80.p |
|
| 131 | + * @return string |
|
| 132 | + */ |
|
| 133 | + protected function determineExtension() |
|
| 134 | + { |
|
| 135 | + $position_of_period = strrpos($this->getName(), '.'); |
|
| 136 | + if ($position_of_period === false) { |
|
| 137 | + return ''; |
|
| 138 | + } |
|
| 139 | + return mb_substr( |
|
| 140 | + $this->getName(), |
|
| 141 | + $position_of_period + 1 |
|
| 142 | + ); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * Gets the size of the file |
|
| 147 | + * @return int |
|
| 148 | + */ |
|
| 149 | + public function getSize() |
|
| 150 | + { |
|
| 151 | + return $this->size; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Gets the path to the temporary file which was uploaded. |
|
| 156 | + * @return string |
|
| 157 | + */ |
|
| 158 | + public function getTmpFile() |
|
| 159 | + { |
|
| 160 | + return $this->tmp_file; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @since 4.9.80.p |
|
| 165 | + * @return string |
|
| 166 | + */ |
|
| 167 | + public function __toString() |
|
| 168 | + { |
|
| 169 | + return $this->getName(); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * Gets the error code PHP reported for the file upload. |
|
| 174 | + * @return string |
|
| 175 | + */ |
|
| 176 | + public function getErrorCode() |
|
| 177 | + { |
|
| 178 | + return $this->error_code; |
|
| 179 | + } |
|
| 180 | 180 | } |
| 181 | 181 | // End of file FileSubmission.php |
| 182 | 182 | // Location: EventEspresso\core\services\request\files/FileSubmission.php |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
| 43 | 43 | wp_deregister_script('select2'); |
| 44 | 44 | wp_deregister_style('select2'); |
| 45 | - wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
| 46 | - wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 47 | - wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
| 48 | - wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 45 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
| 46 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 47 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true); |
|
| 48 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | public function get_other_js_data($other_js_data = array()) |
| 75 | 75 | { |
| 76 | 76 | $other_js_data = parent::get_other_js_data($other_js_data); |
| 77 | - if (! isset($other_js_data['select2s'])) { |
|
| 77 | + if ( ! isset($other_js_data['select2s'])) { |
|
| 78 | 78 | $other_js_data['select2s'] = array(); |
| 79 | 79 | } |
| 80 | - $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
| 80 | + $other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args(); |
|
| 81 | 81 | return $other_js_data; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -15,80 +15,80 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * Arguments that will be passed into the select2 javascript constructor |
|
| 20 | - * @var array |
|
| 21 | - */ |
|
| 22 | - protected $_select2_js_args = array(); |
|
| 18 | + /** |
|
| 19 | + * Arguments that will be passed into the select2 javascript constructor |
|
| 20 | + * @var array |
|
| 21 | + */ |
|
| 22 | + protected $_select2_js_args = array(); |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * |
|
| 26 | - * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
|
| 27 | - * to pass into the select2 js/html input. See https://select2.github.io |
|
| 28 | - */ |
|
| 29 | - public function __construct($select2_js_args = array()) |
|
| 30 | - { |
|
| 31 | - $this->_select2_js_args = $select2_js_args; |
|
| 32 | - parent::__construct(); |
|
| 33 | - } |
|
| 24 | + /** |
|
| 25 | + * |
|
| 26 | + * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
|
| 27 | + * to pass into the select2 js/html input. See https://select2.github.io |
|
| 28 | + */ |
|
| 29 | + public function __construct($select2_js_args = array()) |
|
| 30 | + { |
|
| 31 | + $this->_select2_js_args = $select2_js_args; |
|
| 32 | + parent::__construct(); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * enqueues the select2 initializing js (which depends on the select2 js) and |
|
| 37 | - * the select2 css |
|
| 38 | - */ |
|
| 39 | - public function enqueue_js() |
|
| 40 | - { |
|
| 41 | - // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
|
| 42 | - // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
|
| 43 | - wp_deregister_script('select2'); |
|
| 44 | - wp_deregister_style('select2'); |
|
| 45 | - wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
| 46 | - wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 47 | - wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
| 48 | - wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 49 | - } |
|
| 35 | + /** |
|
| 36 | + * enqueues the select2 initializing js (which depends on the select2 js) and |
|
| 37 | + * the select2 css |
|
| 38 | + */ |
|
| 39 | + public function enqueue_js() |
|
| 40 | + { |
|
| 41 | + // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
|
| 42 | + // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
|
| 43 | + wp_deregister_script('select2'); |
|
| 44 | + wp_deregister_style('select2'); |
|
| 45 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true); |
|
| 46 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 47 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true); |
|
| 48 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Gets the javascript args which will be localized and passed into the select2 js/html input |
|
| 53 | - * @return array |
|
| 54 | - */ |
|
| 55 | - public function get_js_args() |
|
| 56 | - { |
|
| 57 | - return $this->_select2_js_args; |
|
| 58 | - } |
|
| 51 | + /** |
|
| 52 | + * Gets the javascript args which will be localized and passed into the select2 js/html input |
|
| 53 | + * @return array |
|
| 54 | + */ |
|
| 55 | + public function get_js_args() |
|
| 56 | + { |
|
| 57 | + return $this->_select2_js_args; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * Sets the exact js args which will be passed into the select2 js/html input |
|
| 62 | - * @param array $js_args |
|
| 63 | - */ |
|
| 64 | - public function set_js_args($js_args) |
|
| 65 | - { |
|
| 66 | - $this->_select2_js_args = $js_args; |
|
| 67 | - } |
|
| 60 | + /** |
|
| 61 | + * Sets the exact js args which will be passed into the select2 js/html input |
|
| 62 | + * @param array $js_args |
|
| 63 | + */ |
|
| 64 | + public function set_js_args($js_args) |
|
| 65 | + { |
|
| 66 | + $this->_select2_js_args = $js_args; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Adds select2 data for localization |
|
| 71 | - * @param array $other_js_data |
|
| 72 | - * @return array |
|
| 73 | - */ |
|
| 74 | - public function get_other_js_data($other_js_data = array()) |
|
| 75 | - { |
|
| 76 | - $other_js_data = parent::get_other_js_data($other_js_data); |
|
| 77 | - if (! isset($other_js_data['select2s'])) { |
|
| 78 | - $other_js_data['select2s'] = array(); |
|
| 79 | - } |
|
| 80 | - $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
| 81 | - return $other_js_data; |
|
| 82 | - } |
|
| 69 | + /** |
|
| 70 | + * Adds select2 data for localization |
|
| 71 | + * @param array $other_js_data |
|
| 72 | + * @return array |
|
| 73 | + */ |
|
| 74 | + public function get_other_js_data($other_js_data = array()) |
|
| 75 | + { |
|
| 76 | + $other_js_data = parent::get_other_js_data($other_js_data); |
|
| 77 | + if (! isset($other_js_data['select2s'])) { |
|
| 78 | + $other_js_data['select2s'] = array(); |
|
| 79 | + } |
|
| 80 | + $other_js_data['select2s'][ $this->_input->html_id() ] = $this->get_js_args(); |
|
| 81 | + return $other_js_data; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * Overrides standard attributes array to add the CSS class "ee-select2" |
|
| 86 | - * @return array |
|
| 87 | - */ |
|
| 88 | - protected function _standard_attributes_array() |
|
| 89 | - { |
|
| 90 | - $standard_attributes = parent::_standard_attributes_array(); |
|
| 91 | - $standard_attributes['class'] .= ' ee-select2'; |
|
| 92 | - return $standard_attributes; |
|
| 93 | - } |
|
| 84 | + /** |
|
| 85 | + * Overrides standard attributes array to add the CSS class "ee-select2" |
|
| 86 | + * @return array |
|
| 87 | + */ |
|
| 88 | + protected function _standard_attributes_array() |
|
| 89 | + { |
|
| 90 | + $standard_attributes = parent::_standard_attributes_array(); |
|
| 91 | + $standard_attributes['class'] .= ' ee-select2'; |
|
| 92 | + return $standard_attributes; |
|
| 93 | + } |
|
| 94 | 94 | } |
@@ -10,11 +10,11 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | class EE_File_Input_Display_Strategy extends EE_Text_Input_Display_Strategy |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * Override's parent to just set the type. May someday support other arguments. |
|
| 15 | - */ |
|
| 16 | - public function __construct() |
|
| 17 | - { |
|
| 18 | - parent::__construct('file'); |
|
| 19 | - } |
|
| 13 | + /** |
|
| 14 | + * Override's parent to just set the type. May someday support other arguments. |
|
| 15 | + */ |
|
| 16 | + public function __construct() |
|
| 17 | + { |
|
| 18 | + parent::__construct('file'); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
| 56 | 56 | implode(', ', $this->allowed_file_extensions) |
| 57 | 57 | ), |
| 58 | - '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
| 58 | + '~.*\.('.implode('|', $this->allowed_file_extensions).')$~' |
|
| 59 | 59 | ) |
| 60 | 60 | ); |
| 61 | 61 | parent::__construct($options); |
@@ -19,86 +19,86 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class EE_File_Input extends EE_Form_Input_Base |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var array |
|
| 24 | - */ |
|
| 25 | - protected $allowed_file_extensions; |
|
| 22 | + /** |
|
| 23 | + * @var array |
|
| 24 | + */ |
|
| 25 | + protected $allowed_file_extensions; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var array |
|
| 29 | - */ |
|
| 30 | - protected $allowed_mime_types; |
|
| 27 | + /** |
|
| 28 | + * @var array |
|
| 29 | + */ |
|
| 30 | + protected $allowed_mime_types; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @param array $options |
|
| 34 | - * @throws InvalidArgumentException |
|
| 35 | - */ |
|
| 36 | - public function __construct($options = array()) |
|
| 37 | - { |
|
| 38 | - if (isset($options['allowed_file_extensions'])) { |
|
| 39 | - $this->allowed_file_extensions = (array) $options['allowed_file_extensions']; |
|
| 40 | - } else { |
|
| 41 | - $this->allowed_file_extensions = ['csv']; |
|
| 42 | - } |
|
| 43 | - if (isset($options['allowed_mime_types'])) { |
|
| 44 | - $this->allowed_mime_types = (array) $options['allowed_file_extensions']; |
|
| 45 | - } else { |
|
| 46 | - $this->allowed_mime_types = ['text/csv']; |
|
| 47 | - } |
|
| 32 | + /** |
|
| 33 | + * @param array $options |
|
| 34 | + * @throws InvalidArgumentException |
|
| 35 | + */ |
|
| 36 | + public function __construct($options = array()) |
|
| 37 | + { |
|
| 38 | + if (isset($options['allowed_file_extensions'])) { |
|
| 39 | + $this->allowed_file_extensions = (array) $options['allowed_file_extensions']; |
|
| 40 | + } else { |
|
| 41 | + $this->allowed_file_extensions = ['csv']; |
|
| 42 | + } |
|
| 43 | + if (isset($options['allowed_mime_types'])) { |
|
| 44 | + $this->allowed_mime_types = (array) $options['allowed_file_extensions']; |
|
| 45 | + } else { |
|
| 46 | + $this->allowed_mime_types = ['text/csv']; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - $this->_set_display_strategy(new EE_File_Input_Display_Strategy()); |
|
| 50 | - $this->_set_normalization_strategy(new EE_File_Normalization()); |
|
| 51 | - $this->add_validation_strategy( |
|
| 52 | - new EE_Text_Validation_Strategy( |
|
| 53 | - sprintf( |
|
| 54 | - // translators: %1$s is a list of allowed file extensions. |
|
| 55 | - esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
|
| 56 | - implode(', ', $this->allowed_file_extensions) |
|
| 57 | - ), |
|
| 58 | - '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
| 59 | - ) |
|
| 60 | - ); |
|
| 61 | - parent::__construct($options); |
|
| 49 | + $this->_set_display_strategy(new EE_File_Input_Display_Strategy()); |
|
| 50 | + $this->_set_normalization_strategy(new EE_File_Normalization()); |
|
| 51 | + $this->add_validation_strategy( |
|
| 52 | + new EE_Text_Validation_Strategy( |
|
| 53 | + sprintf( |
|
| 54 | + // translators: %1$s is a list of allowed file extensions. |
|
| 55 | + esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'), |
|
| 56 | + implode(', ', $this->allowed_file_extensions) |
|
| 57 | + ), |
|
| 58 | + '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~' |
|
| 59 | + ) |
|
| 60 | + ); |
|
| 61 | + parent::__construct($options); |
|
| 62 | 62 | |
| 63 | 63 | // It would be great to add this HTML attribute, but jQuery validate chokes on it. |
| 64 | - $this->set_other_html_attributes( |
|
| 65 | - $this->other_html_attributes() |
|
| 66 | - . ' extension="' |
|
| 67 | - . implode( |
|
| 68 | - ',', |
|
| 69 | - $this->allowed_file_extensions |
|
| 70 | - ) |
|
| 71 | - . '"' |
|
| 72 | - ); |
|
| 73 | - } |
|
| 64 | + $this->set_other_html_attributes( |
|
| 65 | + $this->other_html_attributes() |
|
| 66 | + . ' extension="' |
|
| 67 | + . implode( |
|
| 68 | + ',', |
|
| 69 | + $this->allowed_file_extensions |
|
| 70 | + ) |
|
| 71 | + . '"' |
|
| 72 | + ); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for |
|
| 77 | - * this input. |
|
| 78 | - * @since 4.9.80.p |
|
| 79 | - * @param array $req_data |
|
| 80 | - * @return FileSubmissionInterface |
|
| 81 | - * @throws InvalidArgumentException |
|
| 82 | - * @throws InvalidDataTypeException |
|
| 83 | - * @throws InvalidInterfaceException |
|
| 84 | - */ |
|
| 85 | - public function find_form_data_for_this_section($req_data) |
|
| 86 | - { |
|
| 87 | - // ignore $req_data. Files are in the files data handler. |
|
| 88 | - $fileDataHandler = LoaderFactory::getLoader()->getShared( |
|
| 89 | - 'EventEspresso\core\services\request\files\FilesDataHandler' |
|
| 90 | - ); |
|
| 91 | - return $fileDataHandler->getFileObject($this->html_name()); |
|
| 92 | - } |
|
| 75 | + /** |
|
| 76 | + * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for |
|
| 77 | + * this input. |
|
| 78 | + * @since 4.9.80.p |
|
| 79 | + * @param array $req_data |
|
| 80 | + * @return FileSubmissionInterface |
|
| 81 | + * @throws InvalidArgumentException |
|
| 82 | + * @throws InvalidDataTypeException |
|
| 83 | + * @throws InvalidInterfaceException |
|
| 84 | + */ |
|
| 85 | + public function find_form_data_for_this_section($req_data) |
|
| 86 | + { |
|
| 87 | + // ignore $req_data. Files are in the files data handler. |
|
| 88 | + $fileDataHandler = LoaderFactory::getLoader()->getShared( |
|
| 89 | + 'EventEspresso\core\services\request\files\FilesDataHandler' |
|
| 90 | + ); |
|
| 91 | + return $fileDataHandler->getFileObject($this->html_name()); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Don't transform the file submission object into a string, thanks. |
|
| 96 | - * |
|
| 97 | - * @param string $value |
|
| 98 | - * @return null|string |
|
| 99 | - */ |
|
| 100 | - protected function _sanitize($value) |
|
| 101 | - { |
|
| 102 | - return $value; |
|
| 103 | - } |
|
| 94 | + /** |
|
| 95 | + * Don't transform the file submission object into a string, thanks. |
|
| 96 | + * |
|
| 97 | + * @param string $value |
|
| 98 | + * @return null|string |
|
| 99 | + */ |
|
| 100 | + protected function _sanitize($value) |
|
| 101 | + { |
|
| 102 | + return $value; |
|
| 103 | + } |
|
| 104 | 104 | } |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | public function column_id($item) |
| 73 | 73 | { |
| 74 | 74 | $content = $item->get('term_id'); |
| 75 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
| 75 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->get_first_related('Term')->get( |
|
| 76 | 76 | 'name' |
| 77 | - ) . '</span>'; |
|
| 77 | + ).'</span>'; |
|
| 78 | 78 | return $content; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -97,29 +97,29 @@ discard block |
||
| 97 | 97 | $term_name = $item->get_first_related('Term')->get('name'); |
| 98 | 98 | |
| 99 | 99 | $actions = array( |
| 100 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
| 100 | + 'edit' => '<a href="'.$edit_link.'" aria-label="'.sprintf( |
|
| 101 | 101 | /* translators: The name of the venue category */ |
| 102 | 102 | esc_attr__( |
| 103 | 103 | 'Edit Category (%s)', |
| 104 | 104 | 'event_espresso' |
| 105 | 105 | ), |
| 106 | 106 | $term_name |
| 107 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
| 107 | + ).'">'.esc_html__('Edit', 'event_espresso').'</a>', |
|
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | 110 | |
| 111 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
| 111 | + $actions['delete'] = '<a href="'.$delete_link.'" aria-label="'.sprintf( |
|
| 112 | 112 | /* translators: The name of the venue category */ |
| 113 | 113 | esc_attr__( |
| 114 | 114 | 'Delete Category (%s)', |
| 115 | 115 | 'event_espresso' |
| 116 | 116 | ), |
| 117 | 117 | $term_name |
| 118 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
| 118 | + ).'">'.esc_html__('Delete', 'event_espresso').'</a>'; |
|
| 119 | 119 | |
| 120 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
| 120 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get( |
|
| 121 | 121 | 'name' |
| 122 | - ) . '</a></strong>'; |
|
| 122 | + ).'</a></strong>'; |
|
| 123 | 123 | $content .= $this->row_actions($actions); |
| 124 | 124 | return $content; |
| 125 | 125 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | public function column_shortcode($item) |
| 129 | 129 | { |
| 130 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
| 130 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
| 131 | 131 | return $content; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | 'category' => $item->get_first_related('Term')->ID(), |
| 140 | 140 | ); |
| 141 | 141 | $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
| 142 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
| 142 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
| 143 | 143 | return $content; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -15,129 +15,129 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | class Venue_Categories_Admin_List_Table extends EE_Admin_List_Table |
| 17 | 17 | { |
| 18 | - protected function _setup_data() |
|
| 19 | - { |
|
| 20 | - $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
| 21 | - $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - protected function _set_properties() |
|
| 26 | - { |
|
| 27 | - $this->_wp_list_args = array( |
|
| 28 | - 'singular' => esc_html__('venue category', 'event_espresso'), |
|
| 29 | - 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
| 30 | - 'ajax' => true, // for now, |
|
| 31 | - 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 32 | - ); |
|
| 33 | - |
|
| 34 | - $this->_columns = array( |
|
| 35 | - 'cb' => '<input type="checkbox" />', |
|
| 36 | - 'id' => esc_html__('ID', 'event_espresso'), |
|
| 37 | - 'name' => esc_html__('Name', 'event_espresso'), |
|
| 38 | - 'count' => esc_html__('Venues', 'event_espresso'), |
|
| 39 | - ); |
|
| 40 | - |
|
| 41 | - $this->_sortable_columns = array( |
|
| 42 | - 'id' => array('Term.term_id' => true), |
|
| 43 | - 'name' => array('Term.slug' => false), |
|
| 44 | - 'count' => array('term_count' => false), |
|
| 45 | - ); |
|
| 46 | - |
|
| 47 | - $this->_hidden_columns = array(); |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - |
|
| 51 | - // not needed |
|
| 52 | - protected function _get_table_filters() |
|
| 53 | - { |
|
| 54 | - return array(); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - protected function _add_view_counts() |
|
| 59 | - { |
|
| 60 | - $this->_views['all']['count'] = $this->_all_data_count; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - public function column_cb($item) |
|
| 65 | - { |
|
| 66 | - return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - |
|
| 70 | - public function column_id($item) |
|
| 71 | - { |
|
| 72 | - $content = $item->get('term_id'); |
|
| 73 | - $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
| 74 | - 'name' |
|
| 75 | - ) . '</span>'; |
|
| 76 | - return $content; |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - public function column_name($item) |
|
| 81 | - { |
|
| 82 | - $edit_query_args = array( |
|
| 83 | - 'action' => 'edit_category', |
|
| 84 | - 'VEN_CAT_ID' => $item->get('term_id'), |
|
| 85 | - ); |
|
| 86 | - |
|
| 87 | - $delete_query_args = array( |
|
| 88 | - 'action' => 'delete_category', |
|
| 89 | - 'VEN_CAT_ID' => $item->get('term_id'), |
|
| 90 | - ); |
|
| 91 | - |
|
| 92 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
| 93 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
| 94 | - |
|
| 95 | - $term_name = $item->get_first_related('Term')->get('name'); |
|
| 96 | - |
|
| 97 | - $actions = array( |
|
| 98 | - 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
| 99 | - /* translators: The name of the venue category */ |
|
| 100 | - esc_attr__( |
|
| 101 | - 'Edit Category (%s)', |
|
| 102 | - 'event_espresso' |
|
| 103 | - ), |
|
| 104 | - $term_name |
|
| 105 | - ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
| 106 | - ); |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
| 110 | - /* translators: The name of the venue category */ |
|
| 111 | - esc_attr__( |
|
| 112 | - 'Delete Category (%s)', |
|
| 113 | - 'event_espresso' |
|
| 114 | - ), |
|
| 115 | - $term_name |
|
| 116 | - ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
| 117 | - |
|
| 118 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
| 119 | - 'name' |
|
| 120 | - ) . '</a></strong>'; |
|
| 121 | - $content .= $this->row_actions($actions); |
|
| 122 | - return $content; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - |
|
| 126 | - public function column_shortcode($item) |
|
| 127 | - { |
|
| 128 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
| 129 | - return $content; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - public function column_count($item) |
|
| 134 | - { |
|
| 135 | - $e_args = array( |
|
| 136 | - 'action' => 'default', |
|
| 137 | - 'category' => $item->get_first_related('Term')->ID(), |
|
| 138 | - ); |
|
| 139 | - $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
| 140 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
| 141 | - return $content; |
|
| 142 | - } |
|
| 18 | + protected function _setup_data() |
|
| 19 | + { |
|
| 20 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
| 21 | + $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, true); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + protected function _set_properties() |
|
| 26 | + { |
|
| 27 | + $this->_wp_list_args = array( |
|
| 28 | + 'singular' => esc_html__('venue category', 'event_espresso'), |
|
| 29 | + 'plural' => esc_html__('venue categories', 'event_espresso'), |
|
| 30 | + 'ajax' => true, // for now, |
|
| 31 | + 'screen' => $this->_admin_page->get_current_screen()->id, |
|
| 32 | + ); |
|
| 33 | + |
|
| 34 | + $this->_columns = array( |
|
| 35 | + 'cb' => '<input type="checkbox" />', |
|
| 36 | + 'id' => esc_html__('ID', 'event_espresso'), |
|
| 37 | + 'name' => esc_html__('Name', 'event_espresso'), |
|
| 38 | + 'count' => esc_html__('Venues', 'event_espresso'), |
|
| 39 | + ); |
|
| 40 | + |
|
| 41 | + $this->_sortable_columns = array( |
|
| 42 | + 'id' => array('Term.term_id' => true), |
|
| 43 | + 'name' => array('Term.slug' => false), |
|
| 44 | + 'count' => array('term_count' => false), |
|
| 45 | + ); |
|
| 46 | + |
|
| 47 | + $this->_hidden_columns = array(); |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + |
|
| 51 | + // not needed |
|
| 52 | + protected function _get_table_filters() |
|
| 53 | + { |
|
| 54 | + return array(); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + protected function _add_view_counts() |
|
| 59 | + { |
|
| 60 | + $this->_views['all']['count'] = $this->_all_data_count; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + public function column_cb($item) |
|
| 65 | + { |
|
| 66 | + return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + |
|
| 70 | + public function column_id($item) |
|
| 71 | + { |
|
| 72 | + $content = $item->get('term_id'); |
|
| 73 | + $content .= ' <span class="show-on-mobile-view-only">' . $item->get_first_related('Term')->get( |
|
| 74 | + 'name' |
|
| 75 | + ) . '</span>'; |
|
| 76 | + return $content; |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + public function column_name($item) |
|
| 81 | + { |
|
| 82 | + $edit_query_args = array( |
|
| 83 | + 'action' => 'edit_category', |
|
| 84 | + 'VEN_CAT_ID' => $item->get('term_id'), |
|
| 85 | + ); |
|
| 86 | + |
|
| 87 | + $delete_query_args = array( |
|
| 88 | + 'action' => 'delete_category', |
|
| 89 | + 'VEN_CAT_ID' => $item->get('term_id'), |
|
| 90 | + ); |
|
| 91 | + |
|
| 92 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
| 93 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
| 94 | + |
|
| 95 | + $term_name = $item->get_first_related('Term')->get('name'); |
|
| 96 | + |
|
| 97 | + $actions = array( |
|
| 98 | + 'edit' => '<a href="' . $edit_link . '" aria-label="' . sprintf( |
|
| 99 | + /* translators: The name of the venue category */ |
|
| 100 | + esc_attr__( |
|
| 101 | + 'Edit Category (%s)', |
|
| 102 | + 'event_espresso' |
|
| 103 | + ), |
|
| 104 | + $term_name |
|
| 105 | + ) . '">' . esc_html__('Edit', 'event_espresso') . '</a>', |
|
| 106 | + ); |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + $actions['delete'] = '<a href="' . $delete_link . '" aria-label="' . sprintf( |
|
| 110 | + /* translators: The name of the venue category */ |
|
| 111 | + esc_attr__( |
|
| 112 | + 'Delete Category (%s)', |
|
| 113 | + 'event_espresso' |
|
| 114 | + ), |
|
| 115 | + $term_name |
|
| 116 | + ) . '">' . esc_html__('Delete', 'event_espresso') . '</a>'; |
|
| 117 | + |
|
| 118 | + $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get( |
|
| 119 | + 'name' |
|
| 120 | + ) . '</a></strong>'; |
|
| 121 | + $content .= $this->row_actions($actions); |
|
| 122 | + return $content; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + |
|
| 126 | + public function column_shortcode($item) |
|
| 127 | + { |
|
| 128 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
| 129 | + return $content; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + public function column_count($item) |
|
| 134 | + { |
|
| 135 | + $e_args = array( |
|
| 136 | + 'action' => 'default', |
|
| 137 | + 'category' => $item->get_first_related('Term')->ID(), |
|
| 138 | + ); |
|
| 139 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
| 140 | + $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
| 141 | + return $content; |
|
| 142 | + } |
|
| 143 | 143 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | { |
| 71 | 71 | global $wpdb; |
| 72 | 72 | $start_at_record = $this->count_records_migrated(); |
| 73 | - $query = "SELECT {$this->select_expression} FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare( |
|
| 73 | + $query = "SELECT {$this->select_expression} FROM {$this->_old_table} {$this->_extra_where_sql} ".$wpdb->prepare( |
|
| 74 | 74 | "LIMIT %d, %d", |
| 75 | 75 | $start_at_record, |
| 76 | 76 | $limit |
@@ -15,89 +15,89 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | abstract class EE_Data_Migration_Script_Stage_Table extends EE_Data_Migration_Script_Stage |
| 17 | 17 | { |
| 18 | - protected $_old_table; |
|
| 18 | + protected $_old_table; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string The columns to select. May be overridden for children. |
|
| 22 | - */ |
|
| 23 | - protected $select_expression = '*'; |
|
| 20 | + /** |
|
| 21 | + * @var string The columns to select. May be overridden for children. |
|
| 22 | + */ |
|
| 23 | + protected $select_expression = '*'; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Set in the constructor to add this sql to both the counting query in |
|
| 27 | - * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and |
|
| 28 | - * EE_Data_Migration_Script_Stage_Table::_get_rows(). |
|
| 29 | - * Eg "where column_name like '%some_value%'" |
|
| 30 | - * |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 33 | - protected $_extra_where_sql; |
|
| 25 | + /** |
|
| 26 | + * Set in the constructor to add this sql to both the counting query in |
|
| 27 | + * EE_Data_Migration_Script_Stage_Table::_count_records_to_migrate() and |
|
| 28 | + * EE_Data_Migration_Script_Stage_Table::_get_rows(). |
|
| 29 | + * Eg "where column_name like '%some_value%'" |
|
| 30 | + * |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | + protected $_extra_where_sql; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
| 38 | - * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
| 39 | - * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
| 40 | - * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
| 41 | - * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
| 42 | - * very least we MUST report/return 50 items migrated) |
|
| 43 | - * |
|
| 44 | - * @param int $num_items |
|
| 45 | - * @return int number of items ACTUALLY migrated |
|
| 46 | - */ |
|
| 47 | - public function _migration_step($num_items = 50) |
|
| 48 | - { |
|
| 49 | - $rows = $this->_get_rows($num_items); |
|
| 50 | - $items_actually_migrated = 0; |
|
| 51 | - foreach ($rows as $old_row) { |
|
| 52 | - $this->_migrate_old_row($old_row); |
|
| 53 | - $items_actually_migrated++; |
|
| 54 | - } |
|
| 55 | - if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
| 56 | - $this->set_completed(); |
|
| 57 | - } |
|
| 58 | - return $items_actually_migrated; |
|
| 59 | - } |
|
| 36 | + /** |
|
| 37 | + * IMPORTANT: if an error is encountered, or everything is finished, this stage should update its status property |
|
| 38 | + * accordingly. Note: it should not alter the count of items migrated. That is done in the public function that |
|
| 39 | + * calls this. IMPORTANT: The count of items migrated should ONLY be less than $num_items_to_migrate when it's the |
|
| 40 | + * last migration step, otherwise it should always return $num_items_to_migrate. (Eg, if we're migrating attendees |
|
| 41 | + * rows from the database, and $num_items_to_migrate is set to 50, then we SHOULD actually migrate 50 rows,but at |
|
| 42 | + * very least we MUST report/return 50 items migrated) |
|
| 43 | + * |
|
| 44 | + * @param int $num_items |
|
| 45 | + * @return int number of items ACTUALLY migrated |
|
| 46 | + */ |
|
| 47 | + public function _migration_step($num_items = 50) |
|
| 48 | + { |
|
| 49 | + $rows = $this->_get_rows($num_items); |
|
| 50 | + $items_actually_migrated = 0; |
|
| 51 | + foreach ($rows as $old_row) { |
|
| 52 | + $this->_migrate_old_row($old_row); |
|
| 53 | + $items_actually_migrated++; |
|
| 54 | + } |
|
| 55 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
| 56 | + $this->set_completed(); |
|
| 57 | + } |
|
| 58 | + return $items_actually_migrated; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Gets the rows for each migration stage from the old table |
|
| 63 | - * |
|
| 64 | - * @global wpdb $wpdb |
|
| 65 | - * @param int $limit |
|
| 66 | - * @return array of arrays like $wpdb->get_results($sql, ARRAY_A) |
|
| 67 | - */ |
|
| 68 | - protected function _get_rows($limit) |
|
| 69 | - { |
|
| 70 | - global $wpdb; |
|
| 71 | - $start_at_record = $this->count_records_migrated(); |
|
| 72 | - $query = "SELECT {$this->select_expression} FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare( |
|
| 73 | - "LIMIT %d, %d", |
|
| 74 | - $start_at_record, |
|
| 75 | - $limit |
|
| 76 | - ); |
|
| 77 | - return $wpdb->get_results($query, ARRAY_A); |
|
| 78 | - } |
|
| 61 | + /** |
|
| 62 | + * Gets the rows for each migration stage from the old table |
|
| 63 | + * |
|
| 64 | + * @global wpdb $wpdb |
|
| 65 | + * @param int $limit |
|
| 66 | + * @return array of arrays like $wpdb->get_results($sql, ARRAY_A) |
|
| 67 | + */ |
|
| 68 | + protected function _get_rows($limit) |
|
| 69 | + { |
|
| 70 | + global $wpdb; |
|
| 71 | + $start_at_record = $this->count_records_migrated(); |
|
| 72 | + $query = "SELECT {$this->select_expression} FROM {$this->_old_table} {$this->_extra_where_sql} " . $wpdb->prepare( |
|
| 73 | + "LIMIT %d, %d", |
|
| 74 | + $start_at_record, |
|
| 75 | + $limit |
|
| 76 | + ); |
|
| 77 | + return $wpdb->get_results($query, ARRAY_A); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Counts the records to migrate; the public version may cache it |
|
| 83 | - * |
|
| 84 | - * @return int |
|
| 85 | - */ |
|
| 86 | - public function _count_records_to_migrate() |
|
| 87 | - { |
|
| 88 | - global $wpdb; |
|
| 89 | - $query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}"; |
|
| 90 | - $count = $wpdb->get_var($query); |
|
| 91 | - return $count; |
|
| 92 | - } |
|
| 81 | + /** |
|
| 82 | + * Counts the records to migrate; the public version may cache it |
|
| 83 | + * |
|
| 84 | + * @return int |
|
| 85 | + */ |
|
| 86 | + public function _count_records_to_migrate() |
|
| 87 | + { |
|
| 88 | + global $wpdb; |
|
| 89 | + $query = "SELECT COUNT(*) FROM {$this->_old_table} {$this->_extra_where_sql}"; |
|
| 90 | + $count = $wpdb->get_var($query); |
|
| 91 | + return $count; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * takes care of migrating this particular row from the OLD table to whatever its |
|
| 96 | - * representation is in the new database. If there are errors, use $this->add_error to log them. If there is a |
|
| 97 | - * fatal error which prevents all future migrations, throw an exception describing it |
|
| 98 | - * |
|
| 99 | - * @param array $old_row an associative array where keys are column names and values are their values. |
|
| 100 | - * @return null |
|
| 101 | - */ |
|
| 102 | - abstract protected function _migrate_old_row($old_row); |
|
| 94 | + /** |
|
| 95 | + * takes care of migrating this particular row from the OLD table to whatever its |
|
| 96 | + * representation is in the new database. If there are errors, use $this->add_error to log them. If there is a |
|
| 97 | + * fatal error which prevents all future migrations, throw an exception describing it |
|
| 98 | + * |
|
| 99 | + * @param array $old_row an associative array where keys are column names and values are their values. |
|
| 100 | + * @return null |
|
| 101 | + */ |
|
| 102 | + abstract protected function _migrate_old_row($old_row); |
|
| 103 | 103 | } |
@@ -67,19 +67,19 @@ discard block |
||
| 67 | 67 | $html = ''; |
| 68 | 68 | // layout_form_begin |
| 69 | 69 | $html .= apply_filters( |
| 70 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(), |
|
| 70 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(), |
|
| 71 | 71 | $this->layout_form_begin(), |
| 72 | 72 | $this->_form_section |
| 73 | 73 | ); |
| 74 | 74 | // layout_form_loop |
| 75 | 75 | $html .= apply_filters( |
| 76 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(), |
|
| 76 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(), |
|
| 77 | 77 | $this->layout_form_loop(), |
| 78 | 78 | $this->_form_section |
| 79 | 79 | ); |
| 80 | 80 | // layout_form_end |
| 81 | 81 | $html .= apply_filters( |
| 82 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(), |
|
| 82 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(), |
|
| 83 | 83 | $this->layout_form_end(), |
| 84 | 84 | $this->_form_section |
| 85 | 85 | ); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if ($subsection instanceof EE_Form_Input_Base) { |
| 101 | 101 | $html .= apply_filters( |
| 102 | 102 | 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' |
| 103 | - . $name . '__in_' . $this->_form_section->name(), |
|
| 103 | + . $name.'__in_'.$this->_form_section->name(), |
|
| 104 | 104 | $this->layout_input($subsection), |
| 105 | 105 | $this->_form_section, |
| 106 | 106 | $subsection |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } elseif ($subsection instanceof EE_Form_Section_Base) { |
| 109 | 109 | $html .= apply_filters( |
| 110 | 110 | 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' |
| 111 | - . $name . '__in_' . $this->_form_section->name(), |
|
| 111 | + . $name.'__in_'.$this->_form_section->name(), |
|
| 112 | 112 | $this->layout_subsection($subsection), |
| 113 | 113 | $this->_form_section, |
| 114 | 114 | $subsection |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | return ''; |
| 178 | 178 | } |
| 179 | 179 | $class = $input->required() |
| 180 | - ? 'ee-required-label ' . $input->html_label_class() |
|
| 180 | + ? 'ee-required-label '.$input->html_label_class() |
|
| 181 | 181 | : $input->html_label_class(); |
| 182 | 182 | $label_text = $input->required() |
| 183 | - ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' |
|
| 183 | + ? $input->html_label_text().'<span class="ee-asterisk">*</span>' |
|
| 184 | 184 | : $input->html_label_text(); |
| 185 | 185 | return '<label id="' |
| 186 | 186 | . $input->html_label_id() |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | . $class |
| 189 | 189 | . '" style="' |
| 190 | 190 | . $input->html_label_style() |
| 191 | - . '" for="' . $input->html_id() |
|
| 191 | + . '" for="'.$input->html_id() |
|
| 192 | 192 | . '">' |
| 193 | 193 | . $label_text |
| 194 | 194 | . '</label>'; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | // get all the errors on THIS form section (errors which aren't |
| 211 | 211 | // for specific inputs, but instead for the entire form section) |
| 212 | 212 | foreach ($this->_form_section->get_validation_errors() as $error) { |
| 213 | - $html .= $error->getMessage() . '<br>'; |
|
| 213 | + $html .= $error->getMessage().'<br>'; |
|
| 214 | 214 | } |
| 215 | 215 | $html .= '</div>'; |
| 216 | 216 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function display_help_text($input) |
| 256 | 256 | { |
| 257 | - $help_text = $input->html_help_text(); |
|
| 257 | + $help_text = $input->html_help_text(); |
|
| 258 | 258 | if ($help_text !== '' && $help_text !== null) { |
| 259 | 259 | $tag = is_admin() ? 'p' : 'span'; |
| 260 | 260 | return '<' |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | { |
| 287 | 287 | // replace dashes and spaces with underscores |
| 288 | 288 | $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id()); |
| 289 | - do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section); |
|
| 289 | + do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section); |
|
| 290 | 290 | $html = (string) apply_filters( |
| 291 | - 'AFEE__Form_Section_Layout__' . $hook_name . '__html', |
|
| 291 | + 'AFEE__Form_Section_Layout__'.$hook_name.'__html', |
|
| 292 | 292 | $html, |
| 293 | 293 | $this->_form_section |
| 294 | 294 | ); |
| 295 | - $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->'; |
|
| 296 | - $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->'; |
|
| 295 | + $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->'; |
|
| 296 | + $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->'; |
|
| 297 | 297 | return $html; |
| 298 | 298 | } |
| 299 | 299 | } |
@@ -11,287 +11,287 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | abstract class EE_Form_Section_Layout_Base |
| 13 | 13 | { |
| 14 | - /** |
|
| 15 | - * Form section to lay out |
|
| 16 | - * |
|
| 17 | - * @var EE_Form_Section_Proper |
|
| 18 | - */ |
|
| 19 | - protected $_form_section; |
|
| 20 | - |
|
| 21 | - |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * __construct |
|
| 25 | - */ |
|
| 26 | - public function __construct() |
|
| 27 | - { |
|
| 28 | - } |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * The form section on which this strategy is to perform |
|
| 34 | - * |
|
| 35 | - * @param EE_Form_Section_Proper $form |
|
| 36 | - */ |
|
| 37 | - public function _construct_finalize(EE_Form_Section_Proper $form) |
|
| 38 | - { |
|
| 39 | - $this->_form_section = $form; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @return EE_Form_Section_Proper |
|
| 46 | - */ |
|
| 47 | - public function form_section() |
|
| 48 | - { |
|
| 49 | - return $this->_form_section; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Also has teh side effect of enqueuing any needed JS and CSS for |
|
| 56 | - * this form. |
|
| 57 | - * Creates all the HTML necessary for displaying this form, its inputs, and |
|
| 58 | - * proper subsections. |
|
| 59 | - * Returns the HTML |
|
| 60 | - * |
|
| 61 | - * @return string HTML for displaying |
|
| 62 | - * @throws EE_Error |
|
| 63 | - */ |
|
| 64 | - public function layout_form() |
|
| 65 | - { |
|
| 66 | - $html = ''; |
|
| 67 | - // layout_form_begin |
|
| 68 | - $html .= apply_filters( |
|
| 69 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(), |
|
| 70 | - $this->layout_form_begin(), |
|
| 71 | - $this->_form_section |
|
| 72 | - ); |
|
| 73 | - // layout_form_loop |
|
| 74 | - $html .= apply_filters( |
|
| 75 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(), |
|
| 76 | - $this->layout_form_loop(), |
|
| 77 | - $this->_form_section |
|
| 78 | - ); |
|
| 79 | - // layout_form_end |
|
| 80 | - $html .= apply_filters( |
|
| 81 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(), |
|
| 82 | - $this->layout_form_end(), |
|
| 83 | - $this->_form_section |
|
| 84 | - ); |
|
| 85 | - return $this->add_form_section_hooks_and_filters($html); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @return string |
|
| 92 | - * @throws EE_Error |
|
| 93 | - */ |
|
| 94 | - public function layout_form_loop() |
|
| 95 | - { |
|
| 96 | - $html = ''; |
|
| 97 | - foreach ($this->_form_section->subsections() as $name => $subsection) { |
|
| 98 | - if ($subsection instanceof EE_Form_Input_Base) { |
|
| 99 | - $html .= apply_filters( |
|
| 100 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' |
|
| 101 | - . $name . '__in_' . $this->_form_section->name(), |
|
| 102 | - $this->layout_input($subsection), |
|
| 103 | - $this->_form_section, |
|
| 104 | - $subsection |
|
| 105 | - ); |
|
| 106 | - } elseif ($subsection instanceof EE_Form_Section_Base) { |
|
| 107 | - $html .= apply_filters( |
|
| 108 | - 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' |
|
| 109 | - . $name . '__in_' . $this->_form_section->name(), |
|
| 110 | - $this->layout_subsection($subsection), |
|
| 111 | - $this->_form_section, |
|
| 112 | - $subsection |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - return $html; |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
|
| 123 | - * |
|
| 124 | - * @return string |
|
| 125 | - */ |
|
| 126 | - abstract public function layout_form_begin(); |
|
| 127 | - |
|
| 128 | - |
|
| 129 | - |
|
| 130 | - /** |
|
| 131 | - * Should be used to end the form section (eg a /table tag, or a /div tag, etc.) |
|
| 132 | - * |
|
| 133 | - * @return string |
|
| 134 | - */ |
|
| 135 | - abstract public function layout_form_end(); |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Should be used internally by layout_form() to lay out each input (eg, if this layout |
|
| 141 | - * is putting each input in a row of its own, this should probably be called by a |
|
| 142 | - * foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop. |
|
| 143 | - * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely |
|
| 144 | - * customize the form's layout, but would like to make use of it for laying out |
|
| 145 | - * 'easy-to-layout' inputs |
|
| 146 | - * |
|
| 147 | - * @param EE_Form_Input_Base $input |
|
| 148 | - * @return string html |
|
| 149 | - */ |
|
| 150 | - abstract public function layout_input($input); |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - |
|
| 154 | - /** |
|
| 155 | - * Similar to layout_input(), should be used internally by layout_form() within a |
|
| 156 | - * loop to lay out each proper subsection. Unlike layout_input(), however, it is assumed |
|
| 157 | - * that the proper subsection will lay out its container, label, etc on its own. |
|
| 158 | - * |
|
| 159 | - * @param EE_Form_Section_Base $subsection |
|
| 160 | - * @return string html |
|
| 161 | - */ |
|
| 162 | - abstract public function layout_subsection($subsection); |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * Gets the HTML for the label tag and its contents for the input |
|
| 167 | - * |
|
| 168 | - * @param EE_Form_Input_Base $input |
|
| 169 | - * @return string |
|
| 170 | - * @throws EE_Error |
|
| 171 | - */ |
|
| 172 | - public function display_label($input) |
|
| 173 | - { |
|
| 174 | - if ($input->get_display_strategy() instanceof EE_Hidden_Display_Strategy) { |
|
| 175 | - return ''; |
|
| 176 | - } |
|
| 177 | - $class = $input->required() |
|
| 178 | - ? 'ee-required-label ' . $input->html_label_class() |
|
| 179 | - : $input->html_label_class(); |
|
| 180 | - $label_text = $input->required() |
|
| 181 | - ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' |
|
| 182 | - : $input->html_label_text(); |
|
| 183 | - return '<label id="' |
|
| 184 | - . $input->html_label_id() |
|
| 185 | - . '" class="' |
|
| 186 | - . $class |
|
| 187 | - . '" style="' |
|
| 188 | - . $input->html_label_style() |
|
| 189 | - . '" for="' . $input->html_id() |
|
| 190 | - . '">' |
|
| 191 | - . $label_text |
|
| 192 | - . '</label>'; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Gets the HTML for all the form's form-wide errors (ie, errors which |
|
| 199 | - * are not for specific inputs. E.g., if two inputs somehow disagree, |
|
| 200 | - * those errors would probably be on the form section, not one of its inputs) |
|
| 201 | - * @return string |
|
| 202 | - */ |
|
| 203 | - public function display_form_wide_errors() |
|
| 204 | - { |
|
| 205 | - $html = ''; |
|
| 206 | - if ($this->_form_section->get_validation_errors()) { |
|
| 207 | - $html .= "<div class='ee-form-wide-errors'>"; |
|
| 208 | - // get all the errors on THIS form section (errors which aren't |
|
| 209 | - // for specific inputs, but instead for the entire form section) |
|
| 210 | - foreach ($this->_form_section->get_validation_errors() as $error) { |
|
| 211 | - $html .= $error->getMessage() . '<br>'; |
|
| 212 | - } |
|
| 213 | - $html .= '</div>'; |
|
| 214 | - } |
|
| 215 | - return apply_filters( |
|
| 216 | - 'FHEE__EE_Form_Section_Layout_Base__display_form_wide_errors', |
|
| 217 | - $html, |
|
| 218 | - $this |
|
| 219 | - ); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - |
|
| 223 | - /** |
|
| 224 | - * returns the HTML for the server-side validation errors for the specified input |
|
| 225 | - * Note that if JS is enabled, it should remove these and instead |
|
| 226 | - * populate the form's errors in the jquery validate fashion |
|
| 227 | - * using the localized data provided to the JS |
|
| 228 | - * |
|
| 229 | - * @param EE_Form_Input_Base $input |
|
| 230 | - * @return string |
|
| 231 | - * @throws EE_Error |
|
| 232 | - */ |
|
| 233 | - public function display_errors($input) |
|
| 234 | - { |
|
| 235 | - if ($input->get_validation_errors()) { |
|
| 236 | - return "<label id='" |
|
| 237 | - . $input->html_id() |
|
| 238 | - . "-error' class='error' for='{$input->html_name()}'>" |
|
| 239 | - . $input->get_validation_error_string() |
|
| 240 | - . '</label>'; |
|
| 241 | - } |
|
| 242 | - return ''; |
|
| 243 | - } |
|
| 244 | - |
|
| 245 | - |
|
| 246 | - /** |
|
| 247 | - * Displays the help span for the specified input |
|
| 248 | - * |
|
| 249 | - * @param EE_Form_Input_Base $input |
|
| 250 | - * @return string |
|
| 251 | - * @throws EE_Error |
|
| 252 | - */ |
|
| 253 | - public function display_help_text($input) |
|
| 254 | - { |
|
| 255 | - $help_text = $input->html_help_text(); |
|
| 256 | - if ($help_text !== '' && $help_text !== null) { |
|
| 257 | - $tag = is_admin() ? 'p' : 'span'; |
|
| 258 | - return '<' |
|
| 259 | - . $tag |
|
| 260 | - . ' id="' |
|
| 261 | - . $input->html_id() |
|
| 262 | - . '-help" class="' |
|
| 263 | - . $input->html_help_class() |
|
| 264 | - . '" style="' |
|
| 265 | - . $input->html_help_style() |
|
| 266 | - . '">' |
|
| 267 | - . $help_text |
|
| 268 | - . '</' |
|
| 269 | - . $tag |
|
| 270 | - . '>'; |
|
| 271 | - } |
|
| 272 | - return ''; |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - |
|
| 276 | - /** |
|
| 277 | - * Does an action and hook onto the end of teh form |
|
| 278 | - * |
|
| 279 | - * @param string $html |
|
| 280 | - * @return string |
|
| 281 | - * @throws EE_Error |
|
| 282 | - */ |
|
| 283 | - public function add_form_section_hooks_and_filters($html) |
|
| 284 | - { |
|
| 285 | - // replace dashes and spaces with underscores |
|
| 286 | - $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id()); |
|
| 287 | - do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section); |
|
| 288 | - $html = (string) apply_filters( |
|
| 289 | - 'AFEE__Form_Section_Layout__' . $hook_name . '__html', |
|
| 290 | - $html, |
|
| 291 | - $this->_form_section |
|
| 292 | - ); |
|
| 293 | - $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->'; |
|
| 294 | - $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->'; |
|
| 295 | - return $html; |
|
| 296 | - } |
|
| 14 | + /** |
|
| 15 | + * Form section to lay out |
|
| 16 | + * |
|
| 17 | + * @var EE_Form_Section_Proper |
|
| 18 | + */ |
|
| 19 | + protected $_form_section; |
|
| 20 | + |
|
| 21 | + |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * __construct |
|
| 25 | + */ |
|
| 26 | + public function __construct() |
|
| 27 | + { |
|
| 28 | + } |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * The form section on which this strategy is to perform |
|
| 34 | + * |
|
| 35 | + * @param EE_Form_Section_Proper $form |
|
| 36 | + */ |
|
| 37 | + public function _construct_finalize(EE_Form_Section_Proper $form) |
|
| 38 | + { |
|
| 39 | + $this->_form_section = $form; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @return EE_Form_Section_Proper |
|
| 46 | + */ |
|
| 47 | + public function form_section() |
|
| 48 | + { |
|
| 49 | + return $this->_form_section; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Also has teh side effect of enqueuing any needed JS and CSS for |
|
| 56 | + * this form. |
|
| 57 | + * Creates all the HTML necessary for displaying this form, its inputs, and |
|
| 58 | + * proper subsections. |
|
| 59 | + * Returns the HTML |
|
| 60 | + * |
|
| 61 | + * @return string HTML for displaying |
|
| 62 | + * @throws EE_Error |
|
| 63 | + */ |
|
| 64 | + public function layout_form() |
|
| 65 | + { |
|
| 66 | + $html = ''; |
|
| 67 | + // layout_form_begin |
|
| 68 | + $html .= apply_filters( |
|
| 69 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(), |
|
| 70 | + $this->layout_form_begin(), |
|
| 71 | + $this->_form_section |
|
| 72 | + ); |
|
| 73 | + // layout_form_loop |
|
| 74 | + $html .= apply_filters( |
|
| 75 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(), |
|
| 76 | + $this->layout_form_loop(), |
|
| 77 | + $this->_form_section |
|
| 78 | + ); |
|
| 79 | + // layout_form_end |
|
| 80 | + $html .= apply_filters( |
|
| 81 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(), |
|
| 82 | + $this->layout_form_end(), |
|
| 83 | + $this->_form_section |
|
| 84 | + ); |
|
| 85 | + return $this->add_form_section_hooks_and_filters($html); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @return string |
|
| 92 | + * @throws EE_Error |
|
| 93 | + */ |
|
| 94 | + public function layout_form_loop() |
|
| 95 | + { |
|
| 96 | + $html = ''; |
|
| 97 | + foreach ($this->_form_section->subsections() as $name => $subsection) { |
|
| 98 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
| 99 | + $html .= apply_filters( |
|
| 100 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_' |
|
| 101 | + . $name . '__in_' . $this->_form_section->name(), |
|
| 102 | + $this->layout_input($subsection), |
|
| 103 | + $this->_form_section, |
|
| 104 | + $subsection |
|
| 105 | + ); |
|
| 106 | + } elseif ($subsection instanceof EE_Form_Section_Base) { |
|
| 107 | + $html .= apply_filters( |
|
| 108 | + 'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_' |
|
| 109 | + . $name . '__in_' . $this->_form_section->name(), |
|
| 110 | + $this->layout_subsection($subsection), |
|
| 111 | + $this->_form_section, |
|
| 112 | + $subsection |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + return $html; |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
|
| 123 | + * |
|
| 124 | + * @return string |
|
| 125 | + */ |
|
| 126 | + abstract public function layout_form_begin(); |
|
| 127 | + |
|
| 128 | + |
|
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * Should be used to end the form section (eg a /table tag, or a /div tag, etc.) |
|
| 132 | + * |
|
| 133 | + * @return string |
|
| 134 | + */ |
|
| 135 | + abstract public function layout_form_end(); |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Should be used internally by layout_form() to lay out each input (eg, if this layout |
|
| 141 | + * is putting each input in a row of its own, this should probably be called by a |
|
| 142 | + * foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop. |
|
| 143 | + * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely |
|
| 144 | + * customize the form's layout, but would like to make use of it for laying out |
|
| 145 | + * 'easy-to-layout' inputs |
|
| 146 | + * |
|
| 147 | + * @param EE_Form_Input_Base $input |
|
| 148 | + * @return string html |
|
| 149 | + */ |
|
| 150 | + abstract public function layout_input($input); |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + |
|
| 154 | + /** |
|
| 155 | + * Similar to layout_input(), should be used internally by layout_form() within a |
|
| 156 | + * loop to lay out each proper subsection. Unlike layout_input(), however, it is assumed |
|
| 157 | + * that the proper subsection will lay out its container, label, etc on its own. |
|
| 158 | + * |
|
| 159 | + * @param EE_Form_Section_Base $subsection |
|
| 160 | + * @return string html |
|
| 161 | + */ |
|
| 162 | + abstract public function layout_subsection($subsection); |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * Gets the HTML for the label tag and its contents for the input |
|
| 167 | + * |
|
| 168 | + * @param EE_Form_Input_Base $input |
|
| 169 | + * @return string |
|
| 170 | + * @throws EE_Error |
|
| 171 | + */ |
|
| 172 | + public function display_label($input) |
|
| 173 | + { |
|
| 174 | + if ($input->get_display_strategy() instanceof EE_Hidden_Display_Strategy) { |
|
| 175 | + return ''; |
|
| 176 | + } |
|
| 177 | + $class = $input->required() |
|
| 178 | + ? 'ee-required-label ' . $input->html_label_class() |
|
| 179 | + : $input->html_label_class(); |
|
| 180 | + $label_text = $input->required() |
|
| 181 | + ? $input->html_label_text() . '<span class="ee-asterisk">*</span>' |
|
| 182 | + : $input->html_label_text(); |
|
| 183 | + return '<label id="' |
|
| 184 | + . $input->html_label_id() |
|
| 185 | + . '" class="' |
|
| 186 | + . $class |
|
| 187 | + . '" style="' |
|
| 188 | + . $input->html_label_style() |
|
| 189 | + . '" for="' . $input->html_id() |
|
| 190 | + . '">' |
|
| 191 | + . $label_text |
|
| 192 | + . '</label>'; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Gets the HTML for all the form's form-wide errors (ie, errors which |
|
| 199 | + * are not for specific inputs. E.g., if two inputs somehow disagree, |
|
| 200 | + * those errors would probably be on the form section, not one of its inputs) |
|
| 201 | + * @return string |
|
| 202 | + */ |
|
| 203 | + public function display_form_wide_errors() |
|
| 204 | + { |
|
| 205 | + $html = ''; |
|
| 206 | + if ($this->_form_section->get_validation_errors()) { |
|
| 207 | + $html .= "<div class='ee-form-wide-errors'>"; |
|
| 208 | + // get all the errors on THIS form section (errors which aren't |
|
| 209 | + // for specific inputs, but instead for the entire form section) |
|
| 210 | + foreach ($this->_form_section->get_validation_errors() as $error) { |
|
| 211 | + $html .= $error->getMessage() . '<br>'; |
|
| 212 | + } |
|
| 213 | + $html .= '</div>'; |
|
| 214 | + } |
|
| 215 | + return apply_filters( |
|
| 216 | + 'FHEE__EE_Form_Section_Layout_Base__display_form_wide_errors', |
|
| 217 | + $html, |
|
| 218 | + $this |
|
| 219 | + ); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + |
|
| 223 | + /** |
|
| 224 | + * returns the HTML for the server-side validation errors for the specified input |
|
| 225 | + * Note that if JS is enabled, it should remove these and instead |
|
| 226 | + * populate the form's errors in the jquery validate fashion |
|
| 227 | + * using the localized data provided to the JS |
|
| 228 | + * |
|
| 229 | + * @param EE_Form_Input_Base $input |
|
| 230 | + * @return string |
|
| 231 | + * @throws EE_Error |
|
| 232 | + */ |
|
| 233 | + public function display_errors($input) |
|
| 234 | + { |
|
| 235 | + if ($input->get_validation_errors()) { |
|
| 236 | + return "<label id='" |
|
| 237 | + . $input->html_id() |
|
| 238 | + . "-error' class='error' for='{$input->html_name()}'>" |
|
| 239 | + . $input->get_validation_error_string() |
|
| 240 | + . '</label>'; |
|
| 241 | + } |
|
| 242 | + return ''; |
|
| 243 | + } |
|
| 244 | + |
|
| 245 | + |
|
| 246 | + /** |
|
| 247 | + * Displays the help span for the specified input |
|
| 248 | + * |
|
| 249 | + * @param EE_Form_Input_Base $input |
|
| 250 | + * @return string |
|
| 251 | + * @throws EE_Error |
|
| 252 | + */ |
|
| 253 | + public function display_help_text($input) |
|
| 254 | + { |
|
| 255 | + $help_text = $input->html_help_text(); |
|
| 256 | + if ($help_text !== '' && $help_text !== null) { |
|
| 257 | + $tag = is_admin() ? 'p' : 'span'; |
|
| 258 | + return '<' |
|
| 259 | + . $tag |
|
| 260 | + . ' id="' |
|
| 261 | + . $input->html_id() |
|
| 262 | + . '-help" class="' |
|
| 263 | + . $input->html_help_class() |
|
| 264 | + . '" style="' |
|
| 265 | + . $input->html_help_style() |
|
| 266 | + . '">' |
|
| 267 | + . $help_text |
|
| 268 | + . '</' |
|
| 269 | + . $tag |
|
| 270 | + . '>'; |
|
| 271 | + } |
|
| 272 | + return ''; |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + |
|
| 276 | + /** |
|
| 277 | + * Does an action and hook onto the end of teh form |
|
| 278 | + * |
|
| 279 | + * @param string $html |
|
| 280 | + * @return string |
|
| 281 | + * @throws EE_Error |
|
| 282 | + */ |
|
| 283 | + public function add_form_section_hooks_and_filters($html) |
|
| 284 | + { |
|
| 285 | + // replace dashes and spaces with underscores |
|
| 286 | + $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id()); |
|
| 287 | + do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section); |
|
| 288 | + $html = (string) apply_filters( |
|
| 289 | + 'AFEE__Form_Section_Layout__' . $hook_name . '__html', |
|
| 290 | + $html, |
|
| 291 | + $this->_form_section |
|
| 292 | + ); |
|
| 293 | + $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->'; |
|
| 294 | + $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->'; |
|
| 295 | + return $html; |
|
| 296 | + } |
|
| 297 | 297 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | public function verify(CommandInterface $command) |
| 32 | 32 | { |
| 33 | 33 | $expected = str_replace('CommandHandler', 'Command', get_class($this)); |
| 34 | - if (! $command instanceof $expected) { |
|
| 34 | + if ( ! $command instanceof $expected) { |
|
| 35 | 35 | throw new InvalidEntityException($command, $expected); |
| 36 | 36 | } |
| 37 | 37 | return $this; |
@@ -14,26 +14,26 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | abstract class CommandHandler implements CommandHandlerInterface |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Verifies the Command class matches the Handler class |
|
| 19 | - * by simply removing "Handler" from the Command class and then comparing. |
|
| 20 | - * IF the Command Handler has been changed via CommandHandlerManager::addCommandHandler, |
|
| 21 | - * or via the filter in CommandHandlerManager::getCommandHandler(), |
|
| 22 | - * then this method MUST be overridden in the new Command Handler class. |
|
| 23 | - * PLZ NOTE: that it also needs to return itself ($this) |
|
| 24 | - * because the CommandBus utilizes method chaining. |
|
| 25 | - * |
|
| 26 | - * @param CommandInterface $command |
|
| 27 | - * @return CommandHandler |
|
| 28 | - * @throws InvalidEntityException |
|
| 29 | - * @since 4.9.80.p |
|
| 30 | - */ |
|
| 31 | - public function verify(CommandInterface $command) |
|
| 32 | - { |
|
| 33 | - $expected = str_replace('CommandHandler', 'Command', get_class($this)); |
|
| 34 | - if (! $command instanceof $expected) { |
|
| 35 | - throw new InvalidEntityException($command, $expected); |
|
| 36 | - } |
|
| 37 | - return $this; |
|
| 38 | - } |
|
| 17 | + /** |
|
| 18 | + * Verifies the Command class matches the Handler class |
|
| 19 | + * by simply removing "Handler" from the Command class and then comparing. |
|
| 20 | + * IF the Command Handler has been changed via CommandHandlerManager::addCommandHandler, |
|
| 21 | + * or via the filter in CommandHandlerManager::getCommandHandler(), |
|
| 22 | + * then this method MUST be overridden in the new Command Handler class. |
|
| 23 | + * PLZ NOTE: that it also needs to return itself ($this) |
|
| 24 | + * because the CommandBus utilizes method chaining. |
|
| 25 | + * |
|
| 26 | + * @param CommandInterface $command |
|
| 27 | + * @return CommandHandler |
|
| 28 | + * @throws InvalidEntityException |
|
| 29 | + * @since 4.9.80.p |
|
| 30 | + */ |
|
| 31 | + public function verify(CommandInterface $command) |
|
| 32 | + { |
|
| 33 | + $expected = str_replace('CommandHandler', 'Command', get_class($this)); |
|
| 34 | + if (! $command instanceof $expected) { |
|
| 35 | + throw new InvalidEntityException($command, $expected); |
|
| 36 | + } |
|
| 37 | + return $this; |
|
| 38 | + } |
|
| 39 | 39 | } |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | // unfortunately, this needs to be done upon INCLUSION of this file, |
| 16 | 16 | // instead of construction, because it only gets constructed on first page load |
| 17 | 17 | // (all other times it gets resurrected from a wordpress option) |
| 18 | -$stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
|
| 18 | +$stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*'); |
|
| 19 | 19 | $class_to_filepath = array(); |
| 20 | 20 | foreach ($stages as $filepath) { |
| 21 | 21 | $matches = array(); |
| 22 | 22 | preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
| 23 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 23 | + $class_to_filepath[$matches[1]] = $filepath; |
|
| 24 | 24 | } |
| 25 | 25 | // give addons a chance to autoload their stages too |
| 26 | 26 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | ) |
| 77 | 77 | ) { |
| 78 | 78 | return true; |
| 79 | - } elseif (! $version_string) { |
|
| 79 | + } elseif ( ! $version_string) { |
|
| 80 | 80 | // no version string provided... this must be pre 4.3 |
| 81 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 81 | + return false; // changed mind. dont want people thinking they should migrate yet because they cant |
|
| 82 | 82 | } else { |
| 83 | 83 | return false; |
| 84 | 84 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function schema_changes_before_migration() |
| 93 | 93 | { |
| 94 | 94 | // relies on 4.1's EEH_Activation::create_table |
| 95 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 95 | + require_once(EE_HELPERS.'EEH_Activation.helper.php'); |
|
| 96 | 96 | $table_name = 'esp_answer'; |
| 97 | 97 | $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
| 98 | 98 | REG_ID int(10) unsigned NOT NULL, |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | $stages = glob(EE_CORE . 'data_migration_scripts/4_7_0_stages/*'); |
| 11 | 11 | $class_to_filepath = array(); |
| 12 | 12 | foreach ($stages as $filepath) { |
| 13 | - $matches = array(); |
|
| 14 | - preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 15 | - $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 13 | + $matches = array(); |
|
| 14 | + preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches); |
|
| 15 | + $class_to_filepath[ $matches[1] ] = $filepath; |
|
| 16 | 16 | } |
| 17 | 17 | // give addons a chance to autoload their stages too |
| 18 | 18 | $class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath); |
@@ -34,72 +34,72 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base |
| 36 | 36 | { |
| 37 | - /** |
|
| 38 | - * return EE_DMS_Core_4_7_0 |
|
| 39 | - * |
|
| 40 | - * @param TableManager $table_manager |
|
| 41 | - * @param TableAnalysis $table_analysis |
|
| 42 | - */ |
|
| 43 | - public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 44 | - { |
|
| 45 | - $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
| 46 | - $this->_priority = 10; |
|
| 47 | - $this->_migration_stages = array( |
|
| 48 | - new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
| 49 | - new EE_DMS_4_7_0_Registration_Payments(), |
|
| 50 | - ); |
|
| 51 | - parent::__construct($table_manager, $table_analysis); |
|
| 52 | - } |
|
| 37 | + /** |
|
| 38 | + * return EE_DMS_Core_4_7_0 |
|
| 39 | + * |
|
| 40 | + * @param TableManager $table_manager |
|
| 41 | + * @param TableAnalysis $table_analysis |
|
| 42 | + */ |
|
| 43 | + public function __construct(TableManager $table_manager = null, TableAnalysis $table_analysis = null) |
|
| 44 | + { |
|
| 45 | + $this->_pretty_name = esc_html__("Data Update to Event Espresso 4.7.0", "event_espresso"); |
|
| 46 | + $this->_priority = 10; |
|
| 47 | + $this->_migration_stages = array( |
|
| 48 | + new EE_DMS_4_7_0_Add_Taxes_To_REG_Final_Price(), |
|
| 49 | + new EE_DMS_4_7_0_Registration_Payments(), |
|
| 50 | + ); |
|
| 51 | + parent::__construct($table_manager, $table_analysis); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @param array $version_array |
|
| 58 | - * @return bool |
|
| 59 | - */ |
|
| 60 | - public function can_migrate_from_version($version_array) |
|
| 61 | - { |
|
| 62 | - $version_string = $version_array['Core']; |
|
| 63 | - if ( |
|
| 64 | - ( |
|
| 65 | - version_compare($version_string, '4.7.0.decaf', '<') |
|
| 66 | - && version_compare($version_string, '4.6.0.decaf', '>=') |
|
| 67 | - ) |
|
| 68 | - || ( |
|
| 69 | - version_compare($version_string, '4.7.0.decaf', '>=') |
|
| 70 | - && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
| 71 | - && $this->_get_table_analysis()->tableExists('esp_registration') |
|
| 72 | - ) |
|
| 73 | - ) { |
|
| 74 | - return true; |
|
| 75 | - } elseif (! $version_string) { |
|
| 76 | - // no version string provided... this must be pre 4.3 |
|
| 77 | - return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 78 | - } else { |
|
| 79 | - return false; |
|
| 80 | - } |
|
| 81 | - } |
|
| 56 | + /** |
|
| 57 | + * @param array $version_array |
|
| 58 | + * @return bool |
|
| 59 | + */ |
|
| 60 | + public function can_migrate_from_version($version_array) |
|
| 61 | + { |
|
| 62 | + $version_string = $version_array['Core']; |
|
| 63 | + if ( |
|
| 64 | + ( |
|
| 65 | + version_compare($version_string, '4.7.0.decaf', '<') |
|
| 66 | + && version_compare($version_string, '4.6.0.decaf', '>=') |
|
| 67 | + ) |
|
| 68 | + || ( |
|
| 69 | + version_compare($version_string, '4.7.0.decaf', '>=') |
|
| 70 | + && ! $this->_get_table_analysis()->tableExists('esp_registration_payment') |
|
| 71 | + && $this->_get_table_analysis()->tableExists('esp_registration') |
|
| 72 | + ) |
|
| 73 | + ) { |
|
| 74 | + return true; |
|
| 75 | + } elseif (! $version_string) { |
|
| 76 | + // no version string provided... this must be pre 4.3 |
|
| 77 | + return false;// changed mind. dont want people thinking they should migrate yet because they cant |
|
| 78 | + } else { |
|
| 79 | + return false; |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * @return bool |
|
| 87 | - */ |
|
| 88 | - public function schema_changes_before_migration() |
|
| 89 | - { |
|
| 90 | - // relies on 4.1's EEH_Activation::create_table |
|
| 91 | - require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 92 | - $table_name = 'esp_answer'; |
|
| 93 | - $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 85 | + /** |
|
| 86 | + * @return bool |
|
| 87 | + */ |
|
| 88 | + public function schema_changes_before_migration() |
|
| 89 | + { |
|
| 90 | + // relies on 4.1's EEH_Activation::create_table |
|
| 91 | + require_once(EE_HELPERS . 'EEH_Activation.helper.php'); |
|
| 92 | + $table_name = 'esp_answer'; |
|
| 93 | + $sql = " ANS_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 94 | 94 | REG_ID int(10) unsigned NOT NULL, |
| 95 | 95 | QST_ID int(10) unsigned NOT NULL, |
| 96 | 96 | ANS_value text NOT NULL, |
| 97 | 97 | PRIMARY KEY (ANS_ID), |
| 98 | 98 | KEY REG_ID (REG_ID), |
| 99 | 99 | KEY QST_ID (QST_ID)"; |
| 100 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 101 | - $table_name = 'esp_attendee_meta'; |
|
| 102 | - $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 100 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 101 | + $table_name = 'esp_attendee_meta'; |
|
| 102 | + $sql = "ATTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 103 | 103 | ATT_ID bigint(20) unsigned NOT NULL, |
| 104 | 104 | ATT_fname varchar(45) NOT NULL, |
| 105 | 105 | ATT_lname varchar(45) NOT NULL, |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | KEY ATT_email (ATT_email(191)), |
| 117 | 117 | KEY ATT_lname (ATT_lname), |
| 118 | 118 | KEY ATT_fname (ATT_fname)"; |
| 119 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 120 | - $table_name = 'esp_country'; |
|
| 121 | - $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 119 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 120 | + $table_name = 'esp_country'; |
|
| 121 | + $sql = "CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
|
| 122 | 122 | CNT_ISO3 varchar(3) COLLATE utf8_bin NOT NULL, |
| 123 | 123 | RGN_ID tinyint(3) unsigned DEFAULT NULL, |
| 124 | 124 | CNT_name varchar(45) COLLATE utf8_bin NOT NULL, |
@@ -134,25 +134,25 @@ discard block |
||
| 134 | 134 | CNT_is_EU tinyint(1) DEFAULT '0', |
| 135 | 135 | CNT_active tinyint(1) DEFAULT '0', |
| 136 | 136 | PRIMARY KEY (CNT_ISO)"; |
| 137 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 138 | - $table_name = 'esp_currency'; |
|
| 139 | - $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
| 137 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 138 | + $table_name = 'esp_currency'; |
|
| 139 | + $sql = "CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
|
| 140 | 140 | CUR_single varchar(45) COLLATE utf8_bin DEFAULT 'dollar', |
| 141 | 141 | CUR_plural varchar(45) COLLATE utf8_bin DEFAULT 'dollars', |
| 142 | 142 | CUR_sign varchar(45) COLLATE utf8_bin DEFAULT '$', |
| 143 | 143 | CUR_dec_plc varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '2', |
| 144 | 144 | CUR_active tinyint(1) DEFAULT '0', |
| 145 | 145 | PRIMARY KEY (CUR_code)"; |
| 146 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 147 | - $table_name = 'esp_currency_payment_method'; |
|
| 148 | - $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 146 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 147 | + $table_name = 'esp_currency_payment_method'; |
|
| 148 | + $sql = "CPM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 149 | 149 | CUR_code varchar(6) COLLATE utf8_bin NOT NULL, |
| 150 | 150 | PMD_ID int(11) NOT NULL, |
| 151 | 151 | PRIMARY KEY (CPM_ID), |
| 152 | 152 | KEY PMD_ID (PMD_ID)"; |
| 153 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 154 | - $table_name = 'esp_datetime'; |
|
| 155 | - $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 153 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 154 | + $table_name = 'esp_datetime'; |
|
| 155 | + $sql = "DTT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 156 | 156 | EVT_ID bigint(20) unsigned NOT NULL, |
| 157 | 157 | DTT_name varchar(255) NOT NULL DEFAULT '', |
| 158 | 158 | DTT_description text NOT NULL, |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | KEY DTT_EVT_start (DTT_EVT_start), |
| 169 | 169 | KEY EVT_ID (EVT_ID), |
| 170 | 170 | KEY DTT_is_primary (DTT_is_primary)"; |
| 171 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 172 | - $table_name = 'esp_event_meta'; |
|
| 173 | - $sql = " |
|
| 171 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 172 | + $table_name = 'esp_event_meta'; |
|
| 173 | + $sql = " |
|
| 174 | 174 | EVTM_ID int(10) NOT NULL AUTO_INCREMENT, |
| 175 | 175 | EVT_ID bigint(20) unsigned NOT NULL, |
| 176 | 176 | EVT_display_desc tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -186,34 +186,34 @@ discard block |
||
| 186 | 186 | EVT_donations tinyint(1) NULL, |
| 187 | 187 | PRIMARY KEY (EVTM_ID), |
| 188 | 188 | KEY EVT_ID (EVT_ID)"; |
| 189 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 190 | - $table_name = 'esp_event_question_group'; |
|
| 191 | - $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 189 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 190 | + $table_name = 'esp_event_question_group'; |
|
| 191 | + $sql = "EQG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 192 | 192 | EVT_ID bigint(20) unsigned NOT NULL, |
| 193 | 193 | QSG_ID int(10) unsigned NOT NULL, |
| 194 | 194 | EQG_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 195 | 195 | PRIMARY KEY (EQG_ID), |
| 196 | 196 | KEY EVT_ID (EVT_ID), |
| 197 | 197 | KEY QSG_ID (QSG_ID)"; |
| 198 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 199 | - $table_name = 'esp_event_venue'; |
|
| 200 | - $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 198 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 199 | + $table_name = 'esp_event_venue'; |
|
| 200 | + $sql = "EVV_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 201 | 201 | EVT_ID bigint(20) unsigned NOT NULL, |
| 202 | 202 | VNU_ID bigint(20) unsigned NOT NULL, |
| 203 | 203 | EVV_primary tinyint(1) unsigned NOT NULL DEFAULT 0, |
| 204 | 204 | PRIMARY KEY (EVV_ID)"; |
| 205 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 206 | - $table_name = 'esp_extra_meta'; |
|
| 207 | - $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 205 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 206 | + $table_name = 'esp_extra_meta'; |
|
| 207 | + $sql = "EXM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 208 | 208 | OBJ_ID int(11) DEFAULT NULL, |
| 209 | 209 | EXM_type varchar(45) DEFAULT NULL, |
| 210 | 210 | EXM_key varchar(45) DEFAULT NULL, |
| 211 | 211 | EXM_value text, |
| 212 | 212 | PRIMARY KEY (EXM_ID), |
| 213 | 213 | KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))"; |
| 214 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 215 | - $table_name = 'esp_line_item'; |
|
| 216 | - $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 214 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 215 | + $table_name = 'esp_line_item'; |
|
| 216 | + $sql = "LIN_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 217 | 217 | LIN_code varchar(245) NOT NULL DEFAULT '', |
| 218 | 218 | TXN_ID int(11) DEFAULT NULL, |
| 219 | 219 | LIN_name varchar(245) NOT NULL DEFAULT '', |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | PRIMARY KEY (LIN_ID), |
| 232 | 232 | KEY LIN_code (LIN_code(191)), |
| 233 | 233 | KEY TXN_ID (TXN_ID)"; |
| 234 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 235 | - $table_name = 'esp_log'; |
|
| 236 | - $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 234 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 235 | + $table_name = 'esp_log'; |
|
| 236 | + $sql = "LOG_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 237 | 237 | LOG_time datetime DEFAULT NULL, |
| 238 | 238 | OBJ_ID varchar(45) DEFAULT NULL, |
| 239 | 239 | OBJ_type varchar(45) DEFAULT NULL, |
@@ -244,18 +244,18 @@ discard block |
||
| 244 | 244 | KEY LOG_time (LOG_time), |
| 245 | 245 | KEY OBJ (OBJ_type,OBJ_ID), |
| 246 | 246 | KEY LOG_type (LOG_type)"; |
| 247 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 248 | - $table_name = 'esp_message_template'; |
|
| 249 | - $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 247 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 248 | + $table_name = 'esp_message_template'; |
|
| 249 | + $sql = "MTP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 250 | 250 | GRP_ID int(10) unsigned NOT NULL, |
| 251 | 251 | MTP_context varchar(50) NOT NULL, |
| 252 | 252 | MTP_template_field varchar(30) NOT NULL, |
| 253 | 253 | MTP_content text NOT NULL, |
| 254 | 254 | PRIMARY KEY (MTP_ID), |
| 255 | 255 | KEY GRP_ID (GRP_ID)"; |
| 256 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 257 | - $table_name = 'esp_message_template_group'; |
|
| 258 | - $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 256 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 257 | + $table_name = 'esp_message_template_group'; |
|
| 258 | + $sql = "GRP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 259 | 259 | MTP_user_id int(10) NOT NULL DEFAULT '1', |
| 260 | 260 | MTP_name varchar(245) NOT NULL DEFAULT '', |
| 261 | 261 | MTP_description varchar(245) NOT NULL DEFAULT '', |
@@ -267,17 +267,17 @@ discard block |
||
| 267 | 267 | MTP_is_active tinyint(1) NOT NULL DEFAULT '1', |
| 268 | 268 | PRIMARY KEY (GRP_ID), |
| 269 | 269 | KEY MTP_user_id (MTP_user_id)"; |
| 270 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 271 | - $table_name = 'esp_event_message_template'; |
|
| 272 | - $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 270 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 271 | + $table_name = 'esp_event_message_template'; |
|
| 272 | + $sql = "EMT_ID bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
|
| 273 | 273 | EVT_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 274 | 274 | GRP_ID int(10) unsigned NOT NULL DEFAULT 0, |
| 275 | 275 | PRIMARY KEY (EMT_ID), |
| 276 | 276 | KEY EVT_ID (EVT_ID), |
| 277 | 277 | KEY GRP_ID (GRP_ID)"; |
| 278 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 279 | - $table_name = 'esp_payment'; |
|
| 280 | - $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 278 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 279 | + $table_name = 'esp_payment'; |
|
| 280 | + $sql = "PAY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 281 | 281 | TXN_ID int(10) unsigned DEFAULT NULL, |
| 282 | 282 | STS_ID varchar(3) COLLATE utf8_bin DEFAULT NULL, |
| 283 | 283 | PAY_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | PRIMARY KEY (PAY_ID), |
| 295 | 295 | KEY PAY_timestamp (PAY_timestamp), |
| 296 | 296 | KEY TXN_ID (TXN_ID)"; |
| 297 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 298 | - $table_name = 'esp_payment_method'; |
|
| 299 | - $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 297 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 298 | + $table_name = 'esp_payment_method'; |
|
| 299 | + $sql = "PMD_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 300 | 300 | PMD_type varchar(124) DEFAULT NULL, |
| 301 | 301 | PMD_name varchar(255) DEFAULT NULL, |
| 302 | 302 | PMD_desc text, |
@@ -312,32 +312,32 @@ discard block |
||
| 312 | 312 | PRIMARY KEY (PMD_ID), |
| 313 | 313 | UNIQUE KEY PMD_slug_UNIQUE (PMD_slug), |
| 314 | 314 | KEY PMD_type (PMD_type)"; |
| 315 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 316 | - $table_name = "esp_ticket_price"; |
|
| 317 | - $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 315 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 316 | + $table_name = "esp_ticket_price"; |
|
| 317 | + $sql = "TKP_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 318 | 318 | TKT_ID int(10) unsigned NOT NULL, |
| 319 | 319 | PRC_ID int(10) unsigned NOT NULL, |
| 320 | 320 | PRIMARY KEY (TKP_ID), |
| 321 | 321 | KEY TKT_ID (TKT_ID), |
| 322 | 322 | KEY PRC_ID (PRC_ID)"; |
| 323 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 324 | - $table_name = "esp_datetime_ticket"; |
|
| 325 | - $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 323 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 324 | + $table_name = "esp_datetime_ticket"; |
|
| 325 | + $sql = "DTK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 326 | 326 | DTT_ID int(10) unsigned NOT NULL, |
| 327 | 327 | TKT_ID int(10) unsigned NOT NULL, |
| 328 | 328 | PRIMARY KEY (DTK_ID), |
| 329 | 329 | KEY DTT_ID (DTT_ID), |
| 330 | 330 | KEY TKT_ID (TKT_ID)"; |
| 331 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | - $table_name = "esp_ticket_template"; |
|
| 333 | - $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 331 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 332 | + $table_name = "esp_ticket_template"; |
|
| 333 | + $sql = "TTM_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 334 | 334 | TTM_name varchar(45) NOT NULL, |
| 335 | 335 | TTM_description text, |
| 336 | 336 | TTM_file varchar(45), |
| 337 | 337 | PRIMARY KEY (TTM_ID)"; |
| 338 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 339 | - $table_name = 'esp_question'; |
|
| 340 | - $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 338 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 339 | + $table_name = 'esp_question'; |
|
| 340 | + $sql = 'QST_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 341 | 341 | QST_display_text text NOT NULL, |
| 342 | 342 | QST_admin_label varchar(255) NOT NULL, |
| 343 | 343 | QST_system varchar(25) DEFAULT NULL, |
@@ -350,18 +350,18 @@ discard block |
||
| 350 | 350 | QST_deleted tinyint(2) unsigned NOT NULL DEFAULT 0, |
| 351 | 351 | PRIMARY KEY (QST_ID), |
| 352 | 352 | KEY QST_order (QST_order)'; |
| 353 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 354 | - $table_name = 'esp_question_group_question'; |
|
| 355 | - $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 353 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 354 | + $table_name = 'esp_question_group_question'; |
|
| 355 | + $sql = "QGQ_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 356 | 356 | QSG_ID int(10) unsigned NOT NULL, |
| 357 | 357 | QST_ID int(10) unsigned NOT NULL, |
| 358 | 358 | QGQ_order int(10) unsigned NOT NULL DEFAULT 0, |
| 359 | 359 | PRIMARY KEY (QGQ_ID), |
| 360 | 360 | KEY QST_ID (QST_ID), |
| 361 | 361 | KEY QSG_ID_order (QSG_ID, QGQ_order)"; |
| 362 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 363 | - $table_name = 'esp_question_option'; |
|
| 364 | - $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 362 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 363 | + $table_name = 'esp_question_option'; |
|
| 364 | + $sql = "QSO_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 365 | 365 | QSO_value varchar(255) NOT NULL, |
| 366 | 366 | QSO_desc text NOT NULL, |
| 367 | 367 | QST_ID int(10) unsigned NOT NULL, |
@@ -370,9 +370,9 @@ discard block |
||
| 370 | 370 | PRIMARY KEY (QSO_ID), |
| 371 | 371 | KEY QST_ID (QST_ID), |
| 372 | 372 | KEY QSO_order (QSO_order)"; |
| 373 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 374 | - $table_name = 'esp_registration'; |
|
| 375 | - $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 373 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 374 | + $table_name = 'esp_registration'; |
|
| 375 | + $sql = "REG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 376 | 376 | EVT_ID bigint(20) unsigned NOT NULL, |
| 377 | 377 | ATT_ID bigint(20) unsigned NOT NULL, |
| 378 | 378 | TXN_ID int(10) unsigned NOT NULL, |
@@ -396,18 +396,18 @@ discard block |
||
| 396 | 396 | KEY TKT_ID (TKT_ID), |
| 397 | 397 | KEY EVT_ID (EVT_ID), |
| 398 | 398 | KEY STS_ID (STS_ID)"; |
| 399 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 400 | - $table_name = 'esp_registration_payment'; |
|
| 401 | - $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 399 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 400 | + $table_name = 'esp_registration_payment'; |
|
| 401 | + $sql = "RPY_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 402 | 402 | REG_ID int(10) unsigned NOT NULL, |
| 403 | 403 | PAY_ID int(10) unsigned NULL, |
| 404 | 404 | RPY_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
| 405 | 405 | PRIMARY KEY (RPY_ID), |
| 406 | 406 | KEY REG_ID (REG_ID), |
| 407 | 407 | KEY PAY_ID (PAY_ID)"; |
| 408 | - $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 409 | - $table_name = 'esp_checkin'; |
|
| 410 | - $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 408 | + $this->_table_is_new_in_this_version($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 409 | + $table_name = 'esp_checkin'; |
|
| 410 | + $sql = "CHK_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 411 | 411 | REG_ID int(10) unsigned NOT NULL, |
| 412 | 412 | DTT_ID int(10) unsigned NOT NULL, |
| 413 | 413 | CHK_in tinyint(1) unsigned NOT NULL DEFAULT 1, |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | PRIMARY KEY (CHK_ID), |
| 416 | 416 | KEY REG_ID (REG_ID), |
| 417 | 417 | KEY DTT_ID (DTT_ID)"; |
| 418 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 419 | - $table_name = 'esp_state'; |
|
| 420 | - $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 418 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 419 | + $table_name = 'esp_state'; |
|
| 420 | + $sql = "STA_ID smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
|
| 421 | 421 | CNT_ISO varchar(2) COLLATE utf8_bin NOT NULL, |
| 422 | 422 | STA_abbrev varchar(24) COLLATE utf8_bin NOT NULL, |
| 423 | 423 | STA_name varchar(100) COLLATE utf8_bin NOT NULL, |
@@ -425,9 +425,9 @@ discard block |
||
| 425 | 425 | PRIMARY KEY (STA_ID), |
| 426 | 426 | KEY STA_abbrev (STA_abbrev), |
| 427 | 427 | KEY CNT_ISO (CNT_ISO)"; |
| 428 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 429 | - $table_name = 'esp_status'; |
|
| 430 | - $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 428 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 429 | + $table_name = 'esp_status'; |
|
| 430 | + $sql = "STS_ID varchar(3) COLLATE utf8_bin NOT NULL, |
|
| 431 | 431 | STS_code varchar(45) COLLATE utf8_bin NOT NULL, |
| 432 | 432 | STS_type set('event','registration','transaction','payment','email') COLLATE utf8_bin NOT NULL, |
| 433 | 433 | STS_can_edit tinyint(1) NOT NULL DEFAULT 0, |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | STS_open tinyint(1) NOT NULL DEFAULT 1, |
| 436 | 436 | UNIQUE KEY STS_ID_UNIQUE (STS_ID), |
| 437 | 437 | KEY STS_type (STS_type)"; |
| 438 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 439 | - $table_name = 'esp_transaction'; |
|
| 440 | - $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 438 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 439 | + $table_name = 'esp_transaction'; |
|
| 440 | + $sql = "TXN_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 441 | 441 | TXN_timestamp datetime NOT NULL DEFAULT '0000-00-00 00:00:00', |
| 442 | 442 | TXN_total decimal(10,3) DEFAULT '0.00', |
| 443 | 443 | TXN_paid decimal(10,3) NOT NULL DEFAULT '0.00', |
@@ -449,9 +449,9 @@ discard block |
||
| 449 | 449 | PRIMARY KEY (TXN_ID), |
| 450 | 450 | KEY TXN_timestamp (TXN_timestamp), |
| 451 | 451 | KEY STS_ID (STS_ID)"; |
| 452 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 453 | - $table_name = 'esp_venue_meta'; |
|
| 454 | - $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 452 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 453 | + $table_name = 'esp_venue_meta'; |
|
| 454 | + $sql = "VNUM_ID int(11) NOT NULL AUTO_INCREMENT, |
|
| 455 | 455 | VNU_ID bigint(20) unsigned NOT NULL DEFAULT 0, |
| 456 | 456 | VNU_address varchar(255) DEFAULT NULL, |
| 457 | 457 | VNU_address2 varchar(255) DEFAULT NULL, |
@@ -470,10 +470,10 @@ discard block |
||
| 470 | 470 | KEY VNU_ID (VNU_ID), |
| 471 | 471 | KEY STA_ID (STA_ID), |
| 472 | 472 | KEY CNT_ISO (CNT_ISO)"; |
| 473 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 474 | - // modified tables |
|
| 475 | - $table_name = "esp_price"; |
|
| 476 | - $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 473 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 474 | + // modified tables |
|
| 475 | + $table_name = "esp_price"; |
|
| 476 | + $sql = "PRC_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 477 | 477 | PRT_ID tinyint(3) unsigned NOT NULL, |
| 478 | 478 | PRC_amount decimal(10,3) NOT NULL DEFAULT '0.00', |
| 479 | 479 | PRC_name varchar(245) NOT NULL, |
@@ -486,9 +486,9 @@ discard block |
||
| 486 | 486 | PRC_parent int(10) unsigned DEFAULT 0, |
| 487 | 487 | PRIMARY KEY (PRC_ID), |
| 488 | 488 | KEY PRT_ID (PRT_ID)"; |
| 489 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 490 | - $table_name = "esp_price_type"; |
|
| 491 | - $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 489 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 490 | + $table_name = "esp_price_type"; |
|
| 491 | + $sql = "PRT_ID tinyint(3) unsigned NOT NULL AUTO_INCREMENT, |
|
| 492 | 492 | PRT_name varchar(45) NOT NULL, |
| 493 | 493 | PBT_ID tinyint(3) unsigned NOT NULL DEFAULT '1', |
| 494 | 494 | PRT_is_percent tinyint(1) NOT NULL DEFAULT '0', |
@@ -497,9 +497,9 @@ discard block |
||
| 497 | 497 | PRT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 498 | 498 | UNIQUE KEY PRT_name_UNIQUE (PRT_name), |
| 499 | 499 | PRIMARY KEY (PRT_ID)"; |
| 500 | - $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 501 | - $table_name = "esp_ticket"; |
|
| 502 | - $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 500 | + $this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB '); |
|
| 501 | + $table_name = "esp_ticket"; |
|
| 502 | + $sql = "TKT_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 503 | 503 | TTM_ID int(10) unsigned NOT NULL, |
| 504 | 504 | TKT_name varchar(245) NOT NULL DEFAULT '', |
| 505 | 505 | TKT_description text NOT NULL, |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | TKT_deleted tinyint(1) NOT NULL DEFAULT '0', |
| 522 | 522 | PRIMARY KEY (TKT_ID), |
| 523 | 523 | KEY TKT_start_date (TKT_start_date)"; |
| 524 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 525 | - $table_name = 'esp_question_group'; |
|
| 526 | - $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 524 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 525 | + $table_name = 'esp_question_group'; |
|
| 526 | + $sql = 'QSG_ID int(10) unsigned NOT NULL AUTO_INCREMENT, |
|
| 527 | 527 | QSG_name varchar(255) NOT NULL, |
| 528 | 528 | QSG_identifier varchar(100) NOT NULL, |
| 529 | 529 | QSG_desc text NULL, |
@@ -536,38 +536,38 @@ discard block |
||
| 536 | 536 | PRIMARY KEY (QSG_ID), |
| 537 | 537 | UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier), |
| 538 | 538 | KEY QSG_order (QSG_order)'; |
| 539 | - $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 540 | - /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
| 541 | - $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 542 | - // (because many need to convert old string states to foreign keys into the states table) |
|
| 543 | - $script_4_1_defaults->insert_default_states(); |
|
| 544 | - $script_4_1_defaults->insert_default_countries(); |
|
| 545 | - /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
| 546 | - $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
| 547 | - $script_4_5_defaults->insert_default_price_types(); |
|
| 548 | - $script_4_5_defaults->insert_default_prices(); |
|
| 549 | - $script_4_5_defaults->insert_default_tickets(); |
|
| 550 | - /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
| 551 | - $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
| 552 | - $script_4_6_defaults->add_default_admin_only_payments(); |
|
| 553 | - $script_4_6_defaults->insert_default_currencies(); |
|
| 554 | - return true; |
|
| 555 | - } |
|
| 539 | + $this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB'); |
|
| 540 | + /** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */ |
|
| 541 | + $script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0'); |
|
| 542 | + // (because many need to convert old string states to foreign keys into the states table) |
|
| 543 | + $script_4_1_defaults->insert_default_states(); |
|
| 544 | + $script_4_1_defaults->insert_default_countries(); |
|
| 545 | + /** @var EE_DMS_Core_4_5_0 $script_4_5_defaults */ |
|
| 546 | + $script_4_5_defaults = EE_Registry::instance()->load_dms('Core_4_5_0'); |
|
| 547 | + $script_4_5_defaults->insert_default_price_types(); |
|
| 548 | + $script_4_5_defaults->insert_default_prices(); |
|
| 549 | + $script_4_5_defaults->insert_default_tickets(); |
|
| 550 | + /** @var EE_DMS_Core_4_6_0 $script_4_6_defaults */ |
|
| 551 | + $script_4_6_defaults = EE_Registry::instance()->load_dms('Core_4_6_0'); |
|
| 552 | + $script_4_6_defaults->add_default_admin_only_payments(); |
|
| 553 | + $script_4_6_defaults->insert_default_currencies(); |
|
| 554 | + return true; |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | 557 | |
| 558 | 558 | |
| 559 | - /** |
|
| 560 | - * @return boolean |
|
| 561 | - */ |
|
| 562 | - public function schema_changes_after_migration() |
|
| 563 | - { |
|
| 564 | - return true; |
|
| 565 | - } |
|
| 559 | + /** |
|
| 560 | + * @return boolean |
|
| 561 | + */ |
|
| 562 | + public function schema_changes_after_migration() |
|
| 563 | + { |
|
| 564 | + return true; |
|
| 565 | + } |
|
| 566 | 566 | |
| 567 | 567 | |
| 568 | 568 | |
| 569 | - public function migration_page_hooks() |
|
| 570 | - { |
|
| 571 | - } |
|
| 569 | + public function migration_page_hooks() |
|
| 570 | + { |
|
| 571 | + } |
|
| 572 | 572 | } |
| 573 | 573 | // end of file: /core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php |