| @@ -1,12 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | - die( 'You are not allowed to call this page directly.' ); | |
| 4 | -} | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * A class for the field value selector |
| 8 | - * Used in field conditional logic, action conditional logic, Mailchimp action, etc. | |
| 5 | + * Used in field conditional logic, action conditional logic, MailChimp action, etc. | |
| 9 | 6 | * |
| 10 | 7 | * @since 2.03.05 |
| 11 | 8 | */ |
| 12 | 9 | class FrmFieldValueSelector { |
| @@ -38,8 +35,9 @@ | ||
| 38 | 35 | * @since 2.03.05 |
| 39 | 36 | */ |
| 40 | 37 | protected $options = array(); |
| 41 | 38 | |
| 39 | + | |
| 42 | 40 | /** |
| 43 | 41 | * @var string |
| 44 | 42 | * |
| 45 | 43 | * @since 2.03.05 |
| @@ -101,10 +99,8 @@ | ||
| 101 | 99 | /** |
| 102 | 100 | * Set the db_row property |
| 103 | 101 | * |
| 104 | 102 | * @since 2.03.05 |
| 105 | - * | |
| 106 | - * @return void | |
| 107 | 103 | */ |
| 108 | 104 | private function set_db_row() { |
| 109 | 105 | $where = array( |
| 110 | 106 | 'id' => $this->field_id, |
| @@ -120,10 +116,8 @@ | ||
| 120 | 116 | /** |
| 121 | 117 | * Set the field_key property |
| 122 | 118 | * |
| 123 | 119 | * @since 2.03.05 |
| 124 | - * | |
| 125 | - * @return void | |
| 126 | 120 | */ |
| 127 | 121 | private function set_field_key() { |
| 128 | 122 | $this->field_key = $this->db_row->field_key; |
| 129 | 123 | } |
| @@ -131,10 +125,8 @@ | ||
| 131 | 125 | /** |
| 132 | 126 | * Set the field_settings property |
| 133 | 127 | * |
| 134 | 128 | * @since 2.03.05 |
| 135 | - * | |
| 136 | - * @return void | |
| 137 | 129 | */ |
| 138 | 130 | protected function set_field_settings() { |
| 139 | 131 | // Leave as null for free version |
| 140 | 132 | } |
| @@ -142,13 +134,11 @@ | ||
| 142 | 134 | /** |
| 143 | 135 | * Set the options property |
| 144 | 136 | * |
| 145 | 137 | * @since 2.03.05 |
| 146 | - * | |
| 147 | - * @return void | |
| 148 | 138 | */ |
| 149 | 139 | protected function set_options() { |
| 150 | - $field_obj = FrmFieldFactory::get_field_object( $this->db_row ); | |
| 140 | + $field_obj = FrmFieldFactory::get_field_object( $this->db_row ); | |
| 151 | 141 | $this->options = $field_obj->get_options( array() ); |
| 152 | 142 | } |
| 153 | 143 | |
| 154 | 144 | /** |
| @@ -156,10 +146,8 @@ | ||
| 156 | 146 | * |
| 157 | 147 | * @since 2.03.05 |
| 158 | 148 | * |
| 159 | 149 | * @param array $args |
| 160 | - * | |
| 161 | - * @return void | |
| 162 | 150 | */ |
| 163 | 151 | protected function set_html_name( $args ) { |
| 164 | 152 | if ( isset( $args['html_name'] ) ) { |
| 165 | 153 | $this->html_name = (string) $args['html_name']; |
| @@ -171,10 +159,8 @@ | ||
| 171 | 159 | * |
| 172 | 160 | * @since 2.03.05 |
| 173 | 161 | * |
| 174 | 162 | * @param array $args |
| 175 | - * | |
| 176 | - * @return void | |
| 177 | 163 | */ |
| 178 | 164 | protected function set_value( $args ) { |
| 179 | 165 | if ( isset( $args['value'] ) ) { |
| 180 | 166 | $this->value = (string) $args['value']; |
| @@ -186,10 +172,8 @@ | ||
| 186 | 172 | * |
| 187 | 173 | * @since 2.03.05 |
| 188 | 174 | * |
| 189 | 175 | * @param array $args |
| 190 | - * | |
| 191 | - * @return void | |
| 192 | 176 | */ |
| 193 | 177 | protected function set_source( $args ) { |
| 194 | 178 | if ( isset( $args['source'] ) ) { |
| 195 | 179 | $this->source = (string) $args['source']; |
| @@ -221,10 +205,8 @@ | ||
| 221 | 205 | /** |
| 222 | 206 | * Display the field value selector (dropdown or text field) |
| 223 | 207 | * |
| 224 | 208 | * @since 2.03.05 |
| 225 | - * | |
| 226 | - * @return void | |
| 227 | 209 | */ |
| 228 | 210 | public function display() { |
| 229 | 211 | if ( $this->has_options() ) { |
| 230 | 212 | $this->display_dropdown(); |
| @@ -236,10 +218,8 @@ | ||
| 236 | 218 | /** |
| 237 | 219 | * Print the field value text box |
| 238 | 220 | * |
| 239 | 221 | * @since 2.03.05 |
| 240 | - * | |
| 241 | - * @return void | |
| 242 | 222 | */ |
| 243 | 223 | public function display_text_box() { |
| 244 | 224 | echo '<input type="text" name="' . esc_attr( $this->html_name ) . '" value="' . esc_attr( trim( $this->value ) ) . '" />'; |
| 245 | 225 | } |
| @@ -247,10 +227,8 @@ | ||
| 247 | 227 | /** |
| 248 | 228 | * Display the field value selector |
| 249 | 229 | * |
| 250 | 230 | * @since 2.03.05 |
| 251 | - * | |
| 252 | - * @return void | |
| 253 | 231 | */ |
| 254 | 232 | protected function display_dropdown() { |
| 255 | 233 | echo '<select name="' . esc_attr( $this->html_name ) . '">'; |
| 256 | 234 | echo '<option value="">' . esc_attr( $this->blank_option_label ) . '</option>'; |