| @@ -28,11 +28,10 @@ | ||
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * @var string |
| 31 | 31 | * @since 2.04 |
| 32 | - * @since 5.0.16 Changed scope from `private` to `protected`. | |
| 33 | 32 | */ |
| 34 | - protected $direction = 'ltr'; | |
| 33 | + private $direction = 'ltr'; | |
| 35 | 34 | |
| 36 | 35 | /** |
| 37 | 36 | * @var bool |
| 38 | 37 | * @since 2.04 |
| @@ -41,28 +40,18 @@ | ||
| 41 | 40 | |
| 42 | 41 | /** |
| 43 | 42 | * @var string |
| 44 | 43 | * @since 2.04 |
| 45 | - * @since 5.0.16 Changed scope from `private` to `protected`. | |
| 46 | 44 | */ |
| 47 | - protected $table_style = ''; | |
| 45 | + private $table_style = ''; | |
| 48 | 46 | |
| 49 | 47 | /** |
| 50 | 48 | * @var string |
| 51 | 49 | * @since 2.04 |
| 52 | - * @since 5.0.16 Changed scope from `private` to `protected`. | |
| 53 | 50 | */ |
| 54 | - protected $td_style = ''; | |
| 51 | + private $td_style = ''; | |
| 55 | 52 | |
| 56 | 53 | /** |
| 57 | - * Used to add a class in tables. Set in Pro. | |
| 58 | - * | |
| 59 | - * @var bool | |
| 60 | - * @since 5.4.2 | |
| 61 | - */ | |
| 62 | - public $is_child = false; | |
| 63 | - | |
| 64 | - /** | |
| 65 | 54 | * FrmTableHTMLGenerator constructor. |
| 66 | 55 | * |
| 67 | 56 | * @param string $type |
| 68 | 57 | * @param array $atts |
| @@ -82,9 +71,8 @@ | ||
| 82 | 71 | * |
| 83 | 72 | * @since 2.04 |
| 84 | 73 | * |
| 85 | 74 | * @param array $atts |
| 86 | - * @return void | |
| 87 | 75 | */ |
| 88 | 76 | private function init_style_settings( $atts ) { |
| 89 | 77 | $style_settings = array( |
| 90 | 78 | 'border_color' => 'dddddd', |
| @@ -114,9 +102,8 @@ | ||
| 114 | 102 | * |
| 115 | 103 | * @since 2.04 |
| 116 | 104 | * |
| 117 | 105 | * @param array $atts |
| 118 | - * @return void | |
| 119 | 106 | */ |
| 120 | 107 | private function init_use_inline_style( $atts ) { |
| 121 | 108 | if ( isset( $atts['inline_style'] ) && ! $atts['inline_style'] ) { |
| 122 | 109 | $this->use_inline_style = false; |
| @@ -128,9 +115,8 @@ | ||
| 128 | 115 | * |
| 129 | 116 | * @since 2.04 |
| 130 | 117 | * |
| 131 | 118 | * @param array $atts |
| 132 | - * @return void | |
| 133 | 119 | */ |
| 134 | 120 | private function init_direction( $atts ) { |
| 135 | 121 | if ( isset( $atts['direction'] ) && $atts['direction'] === 'rtl' ) { |
| 136 | 122 | $this->direction = 'rtl'; |
| @@ -140,9 +126,8 @@ | ||
| 140 | 126 | /** |
| 141 | 127 | * Set the table_style property |
| 142 | 128 | * |
| 143 | 129 | * @since 2.04 |
| 144 | - * @return void | |
| 145 | 130 | */ |
| 146 | 131 | private function init_table_style() { |
| 147 | 132 | if ( $this->use_inline_style === true ) { |
| 148 | 133 | |
| @@ -159,9 +144,8 @@ | ||
| 159 | 144 | /** |
| 160 | 145 | * Set the td_style property |
| 161 | 146 | * |
| 162 | 147 | * @since 2.04 |
| 163 | - * @return void | |
| 164 | 148 | */ |
| 165 | 149 | private function init_td_style() { |
| 166 | 150 | if ( $this->use_inline_style === true ) { |
| 167 | 151 | |
| @@ -197,10 +181,10 @@ | ||
| 197 | 181 | */ |
| 198 | 182 | private function get_color_markup( $color_markup ) { |
| 199 | 183 | $color_markup = trim( $color_markup ); |
| 200 | 184 | |
| 201 | - // Check if each character in string is valid hex digit | |
| 202 | - if ( FrmAppHelper::ctype_xdigit( $color_markup ) ) { | |
| 185 | + //check if each character in string is valid hex digit | |
| 186 | + if ( ctype_xdigit( $color_markup ) ) { | |
| 203 | 187 | $color_markup = '#' . $color_markup; |
| 204 | 188 | } |
| 205 | 189 | |
| 206 | 190 | return $color_markup; |
| @@ -220,13 +204,12 @@ | ||
| 220 | 204 | /** |
| 221 | 205 | * Get the table row style |
| 222 | 206 | * |
| 223 | 207 | * @since 2.04 |
| 224 | - * @since 5.0.16 Changed scope from `private` to `protected`. | |
| 225 | 208 | * |
| 226 | 209 | * @return string |
| 227 | 210 | */ |
| 228 | - protected function tr_style() { | |
| 211 | + private function tr_style() { | |
| 229 | 212 | |
| 230 | 213 | if ( $this->type === 'shortcode' ) { |
| 231 | 214 | $tr_style = ' style="[frm-alt-color]"'; |
| 232 | 215 | } elseif ( $this->use_inline_style ) { |
| @@ -241,13 +224,10 @@ | ||
| 241 | 224 | /** |
| 242 | 225 | * Switch the odd property from true to false or false to true |
| 243 | 226 | * |
| 244 | 227 | * @since 2.04 |
| 245 | - * @since 5.0.16 Changed scope from `private` to `protected`. | |
| 246 | - * | |
| 247 | - * @return void | |
| 248 | 228 | */ |
| 249 | - protected function switch_odd() { | |
| 229 | + private function switch_odd() { | |
| 250 | 230 | if ( $this->type !== 'shortcode' ) { |
| 251 | 231 | $this->odd = ! $this->odd; |
| 252 | 232 | } |
| 253 | 233 | } |
| @@ -278,16 +258,18 @@ | ||
| 278 | 258 | * Generate a two cell row for an HTML table |
| 279 | 259 | * |
| 280 | 260 | * @since 2.04 |
| 281 | 261 | * |
| 282 | - * @param string $label The label. | |
| 283 | - * @param string $value The value. | |
| 262 | + * @param string $label | |
| 263 | + * @param string $value | |
| 284 | 264 | * |
| 285 | 265 | * @return string |
| 286 | 266 | */ |
| 287 | 267 | public function generate_two_cell_table_row( $label, $value ) { |
| 288 | 268 | $row = '<tr' . $this->tr_style(); |
| 289 | - $row .= $this->add_row_class( $value === '' ); | |
| 269 | + if ( $value === '' ) { | |
| 270 | + $row .= ' class="frm-empty-row"'; | |
| 271 | + } | |
| 290 | 272 | $row .= '>'; |
| 291 | 273 | |
| 292 | 274 | $label = '<th' . $this->td_style . '>' . wp_kses_post( $label ) . '</th>'; |
| 293 | 275 | $value = '<td' . $this->td_style . '>' . wp_kses_post( $value ) . '</td>'; |
| @@ -316,11 +298,9 @@ | ||
| 316 | 298 | * |
| 317 | 299 | * @return string |
| 318 | 300 | */ |
| 319 | 301 | public function generate_single_cell_table_row( $value ) { |
| 320 | - $row = '<tr' . $this->tr_style(); | |
| 321 | - $row .= $this->add_row_class(); | |
| 322 | - $row .= '>'; | |
| 302 | + $row = '<tr' . $this->tr_style() . '>'; | |
| 323 | 303 | $row .= '<td colspan="2"' . $this->td_style . '>' . $value . '</td>'; |
| 324 | 304 | $row .= '</tr>' . "\r\n"; |
| 325 | 305 | |
| 326 | 306 | $this->switch_odd(); |
| @@ -325,30 +305,6 @@ | ||
| 325 | 305 | |
| 326 | 306 | $this->switch_odd(); |
| 327 | 307 | |
| 328 | 308 | return $row; |
| 329 | - } | |
| 330 | - | |
| 331 | - /** | |
| 332 | - * Add classes to the tr. | |
| 333 | - * | |
| 334 | - * @since 5.4.2 | |
| 335 | - * | |
| 336 | - * @param bool $empty If the value in the row is blank. | |
| 337 | - * | |
| 338 | - * @return string | |
| 339 | - */ | |
| 340 | - protected function add_row_class( $empty = false ) { | |
| 341 | - $class = ''; | |
| 342 | - if ( $empty ) { | |
| 343 | - // Only add this class on two cell rows. | |
| 344 | - $class .= ' frm-empty-row'; | |
| 345 | - } | |
| 346 | - if ( $this->is_child ) { | |
| 347 | - $class .= ' frm-child-row'; | |
| 348 | - } | |
| 349 | - if ( $class ) { | |
| 350 | - $class = ' class="' . trim( $class ) . '"'; | |
| 351 | - } | |
| 352 | - return $class; | |
| 353 | 309 | } |
| 354 | 310 | } |