@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | public $id = 0; // the id of the post |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * @param int|string $id The id of the stylsheet or 'default' |
|
| 7 | + * @param integer $id The id of the stylsheet or 'default' |
|
| 8 | 8 | */ |
| 9 | 9 | public function __construct( $id = 0 ) { |
| 10 | 10 | $this->id = $id; |
@@ -103,6 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @since 3.01.01 |
| 106 | + * @param string $setting |
|
| 106 | 107 | */ |
| 107 | 108 | private function is_color( $setting ) { |
| 108 | 109 | $extra_colors = array( 'error_bg', 'error_border', 'error_text' ); |
@@ -143,6 +144,9 @@ discard block |
||
| 143 | 144 | set_transient( 'frmpro_css', $css ); |
| 144 | 145 | } |
| 145 | 146 | |
| 147 | + /** |
|
| 148 | + * @param string $filename |
|
| 149 | + */ |
|
| 146 | 150 | private function get_css_content( $filename ) { |
| 147 | 151 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
| 148 | 152 | |
@@ -7,46 +7,46 @@ discard block |
||
| 7 | 7 | * @param int|string $id The id of the stylsheet or 'default' |
| 8 | 8 | */ |
| 9 | 9 | public function __construct( $id = 0 ) { |
| 10 | - $this->id = $id; |
|
| 11 | - } |
|
| 10 | + $this->id = $id; |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function get_new() { |
|
| 13 | + public function get_new() { |
|
| 14 | 14 | $this->id = 0; |
| 15 | 15 | |
| 16 | - $max_slug_value = 2147483647; |
|
| 17 | - $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
| 16 | + $max_slug_value = 2147483647; |
|
| 17 | + $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
| 18 | 18 | $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); |
| 19 | 19 | |
| 20 | - $style = array( |
|
| 21 | - 'post_type' => FrmStylesController::$post_type, |
|
| 22 | - 'ID' => '', |
|
| 23 | - 'post_title' => __( 'New Style', 'formidable' ), |
|
| 24 | - 'post_name' => $key, |
|
| 25 | - 'post_content' => $this->get_defaults(), |
|
| 26 | - 'menu_order' => '', |
|
| 27 | - 'post_status' => 'publish', |
|
| 28 | - ); |
|
| 20 | + $style = array( |
|
| 21 | + 'post_type' => FrmStylesController::$post_type, |
|
| 22 | + 'ID' => '', |
|
| 23 | + 'post_title' => __( 'New Style', 'formidable' ), |
|
| 24 | + 'post_name' => $key, |
|
| 25 | + 'post_content' => $this->get_defaults(), |
|
| 26 | + 'menu_order' => '', |
|
| 27 | + 'post_status' => 'publish', |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | - return (object) $style; |
|
| 31 | - } |
|
| 30 | + return (object) $style; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | public function save( $settings ) { |
| 34 | 34 | return FrmDb::save_settings( $settings, 'frm_styles' ); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | public function duplicate( $id ) { |
| 38 | - // duplicating is a pro feature |
|
| 39 | - } |
|
| 38 | + // duplicating is a pro feature |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function update( $id = 'default' ) { |
|
| 41 | + public function update( $id = 'default' ) { |
|
| 42 | 42 | $all_instances = $this->get_all(); |
| 43 | 43 | |
| 44 | 44 | if ( empty( $id ) ) { |
| 45 | - $new_style = (array) $this->get_new(); |
|
| 46 | - $all_instances[] = $new_style; |
|
| 45 | + $new_style = (array) $this->get_new(); |
|
| 46 | + $all_instances[] = $new_style; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $action_ids = array(); |
|
| 49 | + $action_ids = array(); |
|
| 50 | 50 | |
| 51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
| 52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance ); |
@@ -55,28 +55,28 @@ discard block |
||
| 55 | 55 | $all_instances[ $number ] = $new_instance; |
| 56 | 56 | |
| 57 | 57 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 58 | - // this style was set to default, so remove default setting on previous default style |
|
| 59 | - $new_instance['menu_order'] = 0; |
|
| 58 | + // this style was set to default, so remove default setting on previous default style |
|
| 59 | + $new_instance['menu_order'] = 0; |
|
| 60 | 60 | $action_ids[] = $this->save( $new_instance ); |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - // don't continue if not saving this style |
|
| 64 | - continue; |
|
| 63 | + // don't continue if not saving this style |
|
| 64 | + continue; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
| 68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
| 69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
| 70 | - $new_instance['post_status'] = 'publish'; |
|
| 70 | + $new_instance['post_status'] = 'publish'; |
|
| 71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
| 72 | 72 | |
| 73 | 73 | if ( empty( $id ) ) { |
| 74 | - $new_instance['post_name'] = $new_instance['post_title']; |
|
| 75 | - } |
|
| 74 | + $new_instance['post_name'] = $new_instance['post_title']; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $default_settings = $this->get_defaults(); |
|
| 77 | + $default_settings = $this->get_defaults(); |
|
| 78 | 78 | |
| 79 | - foreach ( $default_settings as $setting => $default ) { |
|
| 79 | + foreach ( $default_settings as $setting => $default ) { |
|
| 80 | 80 | if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
| 81 | 81 | $new_instance['post_content'][ $setting ] = $default; |
| 82 | 82 | } |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
| 86 | 86 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
| 87 | 87 | $new_instance['post_content'][ $setting ] = 0; |
| 88 | - } else if ( $setting == 'font' ) { |
|
| 89 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 90 | - } |
|
| 91 | - } |
|
| 88 | + } else if ( $setting == 'font' ) { |
|
| 89 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | $all_instances[ $number ] = $new_instance; |
| 94 | 94 | |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | return array_filter( $settings, array( $this, 'is_color' ) ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Create static css file |
|
| 123 | - */ |
|
| 121 | + /** |
|
| 122 | + * Create static css file |
|
| 123 | + */ |
|
| 124 | 124 | public function save_settings() { |
| 125 | 125 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
| 126 | 126 | update_option( 'frm_last_style_update', date( 'njGi' ) ); |
| 127 | 127 | |
| 128 | 128 | if ( ! is_file( $filename ) ) { |
| 129 | - return; |
|
| 130 | - } |
|
| 129 | + return; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | $this->clear_cache(); |
| 133 | 133 | |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | $saving = true; |
| 150 | 150 | $frm_style = $this; |
| 151 | 151 | |
| 152 | - ob_start(); |
|
| 153 | - include( $filename ); |
|
| 152 | + ob_start(); |
|
| 153 | + include( $filename ); |
|
| 154 | 154 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
| 155 | - ob_end_clean(); |
|
| 155 | + ob_end_clean(); |
|
| 156 | 156 | |
| 157 | 157 | return $css; |
| 158 | 158 | } |
@@ -173,83 +173,83 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | public function destroy( $id ) { |
| 175 | 175 | return wp_delete_post( $id ); |
| 176 | - } |
|
| 177 | - |
|
| 178 | - public function get_one() { |
|
| 179 | - if ( 'default' == $this->id ) { |
|
| 180 | - $style = $this->get_default_style(); |
|
| 181 | - if ( $style ) { |
|
| 182 | - $this->id = $style->ID; |
|
| 183 | - } else { |
|
| 184 | - $this->id = 0; |
|
| 185 | - } |
|
| 186 | - return $style; |
|
| 187 | - } |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + public function get_one() { |
|
| 179 | + if ( 'default' == $this->id ) { |
|
| 180 | + $style = $this->get_default_style(); |
|
| 181 | + if ( $style ) { |
|
| 182 | + $this->id = $style->ID; |
|
| 183 | + } else { |
|
| 184 | + $this->id = 0; |
|
| 185 | + } |
|
| 186 | + return $style; |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | $style = get_post( $this->id ); |
| 190 | 190 | |
| 191 | - if ( ! $style ) { |
|
| 192 | - return $style; |
|
| 193 | - } |
|
| 191 | + if ( ! $style ) { |
|
| 192 | + return $style; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
| 196 | 196 | |
| 197 | - $default_values = $this->get_defaults(); |
|
| 197 | + $default_values = $this->get_defaults(); |
|
| 198 | 198 | |
| 199 | 199 | // fill default values |
| 200 | 200 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 201 | 201 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 202 | 202 | |
| 203 | - return $style; |
|
| 204 | - } |
|
| 203 | + return $style; |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
| 207 | - $post_atts = array( |
|
| 206 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
| 207 | + $post_atts = array( |
|
| 208 | 208 | 'post_type' => FrmStylesController::$post_type, |
| 209 | 209 | 'post_status' => 'publish', |
| 210 | 210 | 'numberposts' => $limit, |
| 211 | 211 | 'orderby' => $orderby, |
| 212 | 212 | 'order' => $order, |
| 213 | - ); |
|
| 213 | + ); |
|
| 214 | 214 | |
| 215 | 215 | $temp_styles = FrmDb::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' ); |
| 216 | 216 | |
| 217 | 217 | if ( empty( $temp_styles ) ) { |
| 218 | - global $wpdb; |
|
| 219 | - // make sure there wasn't a conflict with the query |
|
| 218 | + global $wpdb; |
|
| 219 | + // make sure there wasn't a conflict with the query |
|
| 220 | 220 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
| 221 | 221 | $temp_styles = FrmDb::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); |
| 222 | 222 | |
| 223 | 223 | if ( empty( $temp_styles ) ) { |
| 224 | - // create a new style if there are none |
|
| 225 | - $new = $this->get_new(); |
|
| 224 | + // create a new style if there are none |
|
| 225 | + $new = $this->get_new(); |
|
| 226 | 226 | $new->post_title = __( 'Formidable Style', 'formidable' ); |
| 227 | 227 | $new->post_name = $new->post_title; |
| 228 | - $new->menu_order = 1; |
|
| 228 | + $new->menu_order = 1; |
|
| 229 | 229 | $new = $this->save( (array) $new ); |
| 230 | 230 | $this->update( 'default' ); |
| 231 | 231 | |
| 232 | - $post_atts['include'] = $new; |
|
| 233 | - |
|
| 234 | - $temp_styles = get_posts( $post_atts ); |
|
| 235 | - } |
|
| 236 | - } |
|
| 232 | + $post_atts['include'] = $new; |
|
| 237 | 233 | |
| 238 | - $default_values = $this->get_defaults(); |
|
| 239 | - $default_style = false; |
|
| 234 | + $temp_styles = get_posts( $post_atts ); |
|
| 235 | + } |
|
| 236 | + } |
|
| 240 | 237 | |
| 241 | - $styles = array(); |
|
| 242 | - foreach ( $temp_styles as $style ) { |
|
| 243 | - $this->id = $style->ID; |
|
| 244 | - if ( $style->menu_order ) { |
|
| 245 | - if ( $default_style ) { |
|
| 246 | - // only return one default |
|
| 247 | - $style->menu_order = 0; |
|
| 248 | - } else { |
|
| 249 | - // check for a default style |
|
| 250 | - $default_style = $style->ID; |
|
| 251 | - } |
|
| 252 | - } |
|
| 238 | + $default_values = $this->get_defaults(); |
|
| 239 | + $default_style = false; |
|
| 240 | + |
|
| 241 | + $styles = array(); |
|
| 242 | + foreach ( $temp_styles as $style ) { |
|
| 243 | + $this->id = $style->ID; |
|
| 244 | + if ( $style->menu_order ) { |
|
| 245 | + if ( $default_style ) { |
|
| 246 | + // only return one default |
|
| 247 | + $style->menu_order = 0; |
|
| 248 | + } else { |
|
| 249 | + // check for a default style |
|
| 250 | + $default_style = $style->ID; |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | 254 | $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
| 255 | 255 | |
@@ -258,183 +258,183 @@ discard block |
||
| 258 | 258 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 259 | 259 | |
| 260 | 260 | $styles[ $style->ID ] = $style; |
| 261 | - } |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - if ( ! $default_style ) { |
|
| 263 | + if ( ! $default_style ) { |
|
| 264 | 264 | $default_style = reset( $styles ); |
| 265 | 265 | $styles[ $default_style->ID ]->menu_order = 1; |
| 266 | - } |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - return $styles; |
|
| 269 | - } |
|
| 268 | + return $styles; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | public function get_default_style( $styles = null ) { |
| 272 | 272 | if ( ! isset( $styles ) ) { |
| 273 | 273 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
| 274 | - } |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - foreach ( $styles as $style ) { |
|
| 277 | - if ( $style->menu_order ) { |
|
| 278 | - return $style; |
|
| 279 | - } |
|
| 280 | - } |
|
| 281 | - } |
|
| 276 | + foreach ( $styles as $style ) { |
|
| 277 | + if ( $style->menu_order ) { |
|
| 278 | + return $style; |
|
| 279 | + } |
|
| 280 | + } |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | 283 | public function override_defaults( $settings ) { |
| 284 | 284 | if ( ! is_array( $settings ) ) { |
| 285 | - return $settings; |
|
| 286 | - } |
|
| 285 | + return $settings; |
|
| 286 | + } |
|
| 287 | 287 | |
| 288 | 288 | $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
| 289 | 289 | |
| 290 | 290 | if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
| 291 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
| 292 | - $settings['form_desc_color'] = $settings['description_color']; |
|
| 293 | - $settings['title_color'] = $settings['label_color']; |
|
| 294 | - } |
|
| 291 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
| 292 | + $settings['form_desc_color'] = $settings['description_color']; |
|
| 293 | + $settings['title_color'] = $settings['label_color']; |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | 296 | if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
| 297 | - $settings['section_color'] = $settings['label_color']; |
|
| 298 | - $settings['section_border_color'] = $settings['border_color']; |
|
| 299 | - } |
|
| 297 | + $settings['section_color'] = $settings['label_color']; |
|
| 298 | + $settings['section_border_color'] = $settings['border_color']; |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | 301 | if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
| 302 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
| 303 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
| 304 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
| 302 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
| 303 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
| 304 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
| 305 | 305 | |
| 306 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
| 307 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
| 308 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
| 309 | - } |
|
| 306 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
| 307 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
| 308 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | - return $settings; |
|
| 311 | + return $settings; |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | public function get_defaults() { |
| 315 | - return array( |
|
| 316 | - 'theme_css' => 'ui-lightness', |
|
| 317 | - 'theme_name' => 'UI Lightness', |
|
| 315 | + return array( |
|
| 316 | + 'theme_css' => 'ui-lightness', |
|
| 317 | + 'theme_name' => 'UI Lightness', |
|
| 318 | 318 | |
| 319 | 319 | 'center_form' => '', |
| 320 | - 'form_width' => '100%', |
|
| 321 | - 'form_align' => 'left', |
|
| 322 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
| 323 | - 'fieldset' => '0px', |
|
| 324 | - 'fieldset_color' => '000000', |
|
| 325 | - 'fieldset_padding' => '0 0 15px 0', |
|
| 326 | - 'fieldset_bg_color' => '', |
|
| 327 | - |
|
| 328 | - 'title_size' => '20px', |
|
| 329 | - 'title_color' => '444444', |
|
| 320 | + 'form_width' => '100%', |
|
| 321 | + 'form_align' => 'left', |
|
| 322 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
| 323 | + 'fieldset' => '0px', |
|
| 324 | + 'fieldset_color' => '000000', |
|
| 325 | + 'fieldset_padding' => '0 0 15px 0', |
|
| 326 | + 'fieldset_bg_color' => '', |
|
| 327 | + |
|
| 328 | + 'title_size' => '20px', |
|
| 329 | + 'title_color' => '444444', |
|
| 330 | 330 | 'title_margin_top' => '10px', |
| 331 | 331 | 'title_margin_bottom' => '10px', |
| 332 | - 'form_desc_size' => '14px', |
|
| 333 | - 'form_desc_color' => '666666', |
|
| 332 | + 'form_desc_size' => '14px', |
|
| 333 | + 'form_desc_color' => '666666', |
|
| 334 | 334 | 'form_desc_margin_top' => '10px', |
| 335 | 335 | 'form_desc_margin_bottom' => '25px', |
| 336 | 336 | |
| 337 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
| 338 | - 'font_size' => '14px', |
|
| 339 | - 'label_color' => '444444', |
|
| 340 | - 'weight' => 'bold', |
|
| 341 | - 'position' => 'none', |
|
| 342 | - 'align' => 'left', |
|
| 343 | - 'width' => '150px', |
|
| 344 | - 'required_color' => 'B94A48', |
|
| 345 | - 'required_weight' => 'bold', |
|
| 346 | - 'label_padding' => '0 0 3px 0', |
|
| 347 | - |
|
| 348 | - 'description_font_size' => '12px', |
|
| 349 | - 'description_color' => '666666', |
|
| 350 | - 'description_weight' => 'normal', |
|
| 351 | - 'description_style' => 'normal', |
|
| 352 | - 'description_align' => 'left', |
|
| 337 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
| 338 | + 'font_size' => '14px', |
|
| 339 | + 'label_color' => '444444', |
|
| 340 | + 'weight' => 'bold', |
|
| 341 | + 'position' => 'none', |
|
| 342 | + 'align' => 'left', |
|
| 343 | + 'width' => '150px', |
|
| 344 | + 'required_color' => 'B94A48', |
|
| 345 | + 'required_weight' => 'bold', |
|
| 346 | + 'label_padding' => '0 0 3px 0', |
|
| 347 | + |
|
| 348 | + 'description_font_size' => '12px', |
|
| 349 | + 'description_color' => '666666', |
|
| 350 | + 'description_weight' => 'normal', |
|
| 351 | + 'description_style' => 'normal', |
|
| 352 | + 'description_align' => 'left', |
|
| 353 | 353 | 'description_margin' => '0', |
| 354 | 354 | |
| 355 | - 'field_font_size' => '14px', |
|
| 356 | - 'field_height' => '32px', |
|
| 357 | - 'line_height' => 'normal', |
|
| 358 | - 'field_width' => '100%', |
|
| 359 | - 'auto_width' => false, |
|
| 360 | - 'field_pad' => '6px 10px', |
|
| 361 | - 'field_margin' => '20px', |
|
| 355 | + 'field_font_size' => '14px', |
|
| 356 | + 'field_height' => '32px', |
|
| 357 | + 'line_height' => 'normal', |
|
| 358 | + 'field_width' => '100%', |
|
| 359 | + 'auto_width' => false, |
|
| 360 | + 'field_pad' => '6px 10px', |
|
| 361 | + 'field_margin' => '20px', |
|
| 362 | 362 | 'field_weight' => 'normal', |
| 363 | - 'text_color' => '555555', |
|
| 364 | - //'border_color_hv' => 'cccccc', |
|
| 365 | - 'border_color' => 'cccccc', |
|
| 366 | - 'field_border_width' => '1px', |
|
| 367 | - 'field_border_style' => 'solid', |
|
| 368 | - |
|
| 369 | - 'bg_color' => 'ffffff', |
|
| 370 | - //'bg_color_hv' => 'ffffff', |
|
| 363 | + 'text_color' => '555555', |
|
| 364 | + //'border_color_hv' => 'cccccc', |
|
| 365 | + 'border_color' => 'cccccc', |
|
| 366 | + 'field_border_width' => '1px', |
|
| 367 | + 'field_border_style' => 'solid', |
|
| 368 | + |
|
| 369 | + 'bg_color' => 'ffffff', |
|
| 370 | + //'bg_color_hv' => 'ffffff', |
|
| 371 | 371 | 'remove_box_shadow' => '', |
| 372 | - 'bg_color_active' => 'ffffff', |
|
| 372 | + 'bg_color_active' => 'ffffff', |
|
| 373 | 373 | 'border_color_active' => '66afe9', |
| 374 | 374 | 'remove_box_shadow_active' => '', |
| 375 | - 'text_color_error' => '444444', |
|
| 376 | - 'bg_color_error' => 'ffffff', |
|
| 375 | + 'text_color_error' => '444444', |
|
| 376 | + 'bg_color_error' => 'ffffff', |
|
| 377 | 377 | 'border_color_error' => 'B94A48', |
| 378 | 378 | 'border_width_error' => '1px', |
| 379 | 379 | 'border_style_error' => 'solid', |
| 380 | - 'bg_color_disabled' => 'ffffff', |
|
| 381 | - 'border_color_disabled' => 'E5E5E5', |
|
| 382 | - 'text_color_disabled' => 'A1A1A1', |
|
| 383 | - |
|
| 384 | - 'radio_align' => 'block', |
|
| 385 | - 'check_align' => 'block', |
|
| 386 | - 'check_font_size' => '13px', |
|
| 387 | - 'check_label_color' => '444444', |
|
| 388 | - 'check_weight' => 'normal', |
|
| 389 | - |
|
| 390 | - 'section_font_size' => '18px', |
|
| 391 | - 'section_color' => '444444', |
|
| 392 | - 'section_weight' => 'bold', |
|
| 393 | - 'section_pad' => '15px 0 3px 0', |
|
| 394 | - 'section_mar_top' => '15px', |
|
| 380 | + 'bg_color_disabled' => 'ffffff', |
|
| 381 | + 'border_color_disabled' => 'E5E5E5', |
|
| 382 | + 'text_color_disabled' => 'A1A1A1', |
|
| 383 | + |
|
| 384 | + 'radio_align' => 'block', |
|
| 385 | + 'check_align' => 'block', |
|
| 386 | + 'check_font_size' => '13px', |
|
| 387 | + 'check_label_color' => '444444', |
|
| 388 | + 'check_weight' => 'normal', |
|
| 389 | + |
|
| 390 | + 'section_font_size' => '18px', |
|
| 391 | + 'section_color' => '444444', |
|
| 392 | + 'section_weight' => 'bold', |
|
| 393 | + 'section_pad' => '15px 0 3px 0', |
|
| 394 | + 'section_mar_top' => '15px', |
|
| 395 | 395 | 'section_mar_bottom' => '12px', |
| 396 | - 'section_bg_color' => '', |
|
| 397 | - 'section_border_color' => 'e8e8e8', |
|
| 398 | - 'section_border_width' => '2px', |
|
| 399 | - 'section_border_style' => 'solid', |
|
| 400 | - 'section_border_loc' => '-top', |
|
| 401 | - 'collapse_icon' => '6', |
|
| 402 | - 'collapse_pos' => 'after', |
|
| 403 | - 'repeat_icon' => '1', |
|
| 404 | - |
|
| 405 | - 'submit_style' => false, |
|
| 406 | - 'submit_font_size' => '14px', |
|
| 407 | - 'submit_width' => 'auto', |
|
| 408 | - 'submit_height' => 'auto', |
|
| 409 | - 'submit_bg_color' => 'ffffff', |
|
| 410 | - 'submit_border_color' => 'cccccc', |
|
| 411 | - 'submit_border_width' => '1px', |
|
| 412 | - 'submit_text_color' => '444444', |
|
| 413 | - 'submit_weight' => 'normal', |
|
| 414 | - 'submit_border_radius' => '4px', |
|
| 415 | - 'submit_bg_img' => '', |
|
| 416 | - 'submit_margin' => '10px', |
|
| 417 | - 'submit_padding' => '6px 11px', |
|
| 418 | - 'submit_shadow_color' => 'eeeeee', |
|
| 419 | - 'submit_hover_bg_color' => 'efefef', |
|
| 420 | - 'submit_hover_color' => '444444', |
|
| 421 | - 'submit_hover_border_color' => 'cccccc', |
|
| 422 | - 'submit_active_bg_color' => 'efefef', |
|
| 423 | - 'submit_active_color' => '444444', |
|
| 424 | - 'submit_active_border_color' => 'cccccc', |
|
| 425 | - |
|
| 426 | - 'border_radius' => '4px', |
|
| 427 | - 'error_bg' => 'F2DEDE', |
|
| 428 | - 'error_border' => 'EBCCD1', |
|
| 429 | - 'error_text' => 'B94A48', |
|
| 430 | - 'error_font_size' => '14px', |
|
| 431 | - |
|
| 432 | - 'success_bg_color' => 'DFF0D8', |
|
| 433 | - 'success_border_color' => 'D6E9C6', |
|
| 434 | - 'success_text_color' => '468847', |
|
| 435 | - 'success_font_size' => '14px', |
|
| 436 | - |
|
| 437 | - 'important_style' => false, |
|
| 396 | + 'section_bg_color' => '', |
|
| 397 | + 'section_border_color' => 'e8e8e8', |
|
| 398 | + 'section_border_width' => '2px', |
|
| 399 | + 'section_border_style' => 'solid', |
|
| 400 | + 'section_border_loc' => '-top', |
|
| 401 | + 'collapse_icon' => '6', |
|
| 402 | + 'collapse_pos' => 'after', |
|
| 403 | + 'repeat_icon' => '1', |
|
| 404 | + |
|
| 405 | + 'submit_style' => false, |
|
| 406 | + 'submit_font_size' => '14px', |
|
| 407 | + 'submit_width' => 'auto', |
|
| 408 | + 'submit_height' => 'auto', |
|
| 409 | + 'submit_bg_color' => 'ffffff', |
|
| 410 | + 'submit_border_color' => 'cccccc', |
|
| 411 | + 'submit_border_width' => '1px', |
|
| 412 | + 'submit_text_color' => '444444', |
|
| 413 | + 'submit_weight' => 'normal', |
|
| 414 | + 'submit_border_radius' => '4px', |
|
| 415 | + 'submit_bg_img' => '', |
|
| 416 | + 'submit_margin' => '10px', |
|
| 417 | + 'submit_padding' => '6px 11px', |
|
| 418 | + 'submit_shadow_color' => 'eeeeee', |
|
| 419 | + 'submit_hover_bg_color' => 'efefef', |
|
| 420 | + 'submit_hover_color' => '444444', |
|
| 421 | + 'submit_hover_border_color' => 'cccccc', |
|
| 422 | + 'submit_active_bg_color' => 'efefef', |
|
| 423 | + 'submit_active_color' => '444444', |
|
| 424 | + 'submit_active_border_color' => 'cccccc', |
|
| 425 | + |
|
| 426 | + 'border_radius' => '4px', |
|
| 427 | + 'error_bg' => 'F2DEDE', |
|
| 428 | + 'error_border' => 'EBCCD1', |
|
| 429 | + 'error_text' => 'B94A48', |
|
| 430 | + 'error_font_size' => '14px', |
|
| 431 | + |
|
| 432 | + 'success_bg_color' => 'DFF0D8', |
|
| 433 | + 'success_border_color' => 'D6E9C6', |
|
| 434 | + 'success_text_color' => '468847', |
|
| 435 | + 'success_font_size' => '14px', |
|
| 436 | + |
|
| 437 | + 'important_style' => false, |
|
| 438 | 438 | |
| 439 | 439 | 'progress_bg_color' => 'dddddd', |
| 440 | 440 | 'progress_active_color' => 'ffffff', |
@@ -444,9 +444,9 @@ discard block |
||
| 444 | 444 | 'progress_border_size' => '2px', |
| 445 | 445 | 'progress_size' => '30px', |
| 446 | 446 | |
| 447 | - 'custom_css' => '', |
|
| 448 | - ); |
|
| 449 | - } |
|
| 447 | + 'custom_css' => '', |
|
| 448 | + ); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | 451 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
| 452 | 452 | return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']'; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance ); |
| 53 | 53 | $this->id = $new_instance['ID']; |
| 54 | 54 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
| 55 | - $all_instances[ $number ] = $new_instance; |
|
| 55 | + $all_instances[$number] = $new_instance; |
|
| 56 | 56 | |
| 57 | 57 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 58 | 58 | // this style was set to default, so remove default setting on previous default style |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
| 68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
| 69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
| 70 | - $new_instance['post_status'] = 'publish'; |
|
| 70 | + $new_instance['post_status'] = 'publish'; |
|
| 71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
| 72 | 72 | |
| 73 | 73 | if ( empty( $id ) ) { |
@@ -77,20 +77,20 @@ discard block |
||
| 77 | 77 | $default_settings = $this->get_defaults(); |
| 78 | 78 | |
| 79 | 79 | foreach ( $default_settings as $setting => $default ) { |
| 80 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 81 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 80 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 81 | + $new_instance['post_content'][$setting] = $default; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ( $this->is_color( $setting ) ) { |
| 85 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
| 86 | - } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 87 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 85 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
| 86 | + } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 87 | + $new_instance['post_content'][$setting] = 0; |
|
| 88 | 88 | } else if ( $setting == 'font' ) { |
| 89 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 89 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $all_instances[ $number ] = $new_instance; |
|
| 93 | + $all_instances[$number] = $new_instance; |
|
| 94 | 94 | |
| 95 | 95 | $action_ids[] = $this->save( $new_instance ); |
| 96 | 96 | |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 258 | 258 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 259 | 259 | |
| 260 | - $styles[ $style->ID ] = $style; |
|
| 260 | + $styles[$style->ID] = $style; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if ( ! $default_style ) { |
| 264 | 264 | $default_style = reset( $styles ); |
| 265 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 265 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return $styles; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | '-' => 'down', |
| 198 | 198 | '+' => 'up', |
| 199 | 199 | ); |
| 200 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 200 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 201 | 201 | } else { |
| 202 | 202 | //frm_minus1_icon |
| 203 | 203 | $key = str_replace( 'p', '', $key ); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | '-' => 'minus', |
| 206 | 206 | '+' => 'plus', |
| 207 | 207 | ); |
| 208 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 208 | + $class = 'frm_' . $plus[$icon]; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( $key ) { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ?> |
| 226 | 226 | <select name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" id="frm_<?php echo esc_attr( $name ); ?>" class="frm_icon_font frm_multiselect hide-if-js"> |
| 227 | 227 | <?php foreach ( $icons as $key => $icon ) { ?> |
| 228 | - <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[ $name ], $key ) ?>> |
|
| 228 | + <option value="<?php echo esc_attr( $key ) ?>" <?php selected( $style->post_content[$name], $key ) ?>> |
|
| 229 | 229 | <?php echo '' . $icon['+'] . '; ' . $icon['-'] . ';'; ?> |
| 230 | 230 | </option> |
| 231 | 231 | <?php } ?> |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | <div class="btn-group hide-if-no-js" id="frm_<?php echo esc_attr( $name ) ?>_select"> |
| 235 | 235 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 236 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ) ?>"></i> |
|
| 237 | - <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ) ?>"></i> |
|
| 236 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '+', $type ) ) ?>"></i> |
|
| 237 | + <i class="frm_icon_font <?php echo esc_attr( self::icon_key_to_class( $style->post_content[$name], '-', $type ) ) ?>"></i> |
|
| 238 | 238 | <b class="caret"></b> |
| 239 | 239 | </button> |
| 240 | 240 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @since 2.3 |
| 272 | 272 | */ |
| 273 | 273 | public static function adjust_brightness( $hex, $steps ) { |
| 274 | - $steps = max( -255, min( 255, $steps ) ); |
|
| 274 | + $steps = max( - 255, min( 255, $steps ) ); |
|
| 275 | 275 | |
| 276 | 276 | // Normalize into a six character long hex string |
| 277 | 277 | $hex = str_replace( '#', '', $hex ); |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 324 | 324 | foreach ( $checkbox_opts as $opt ) { |
| 325 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 326 | - $settings[ $opt ] = 0; |
|
| 325 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 326 | + $settings[$opt] = 0; |
|
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $css = ''; |
| 343 | 343 | } |
| 344 | 344 | foreach ( $opts as $opt ) { |
| 345 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 345 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
@@ -1,21 +1,21 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmStylesController { |
| 4 | - public static $post_type = 'frm_styles'; |
|
| 5 | - public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | - |
|
| 7 | - public static function load_pro_hooks() { |
|
| 8 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | - FrmProStylesController::load_pro_hooks(); |
|
| 10 | - } |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public static function register_post_types() { |
|
| 14 | - register_post_type( self::$post_type, array( |
|
| 15 | - 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | - 'public' => false, |
|
| 17 | - 'show_ui' => false, |
|
| 18 | - 'capability_type' => 'page', |
|
| 4 | + public static $post_type = 'frm_styles'; |
|
| 5 | + public static $screen = 'formidable_page_formidable-styles'; |
|
| 6 | + |
|
| 7 | + public static function load_pro_hooks() { |
|
| 8 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 9 | + FrmProStylesController::load_pro_hooks(); |
|
| 10 | + } |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public static function register_post_types() { |
|
| 14 | + register_post_type( self::$post_type, array( |
|
| 15 | + 'label' => __( 'Styles', 'formidable' ), |
|
| 16 | + 'public' => false, |
|
| 17 | + 'show_ui' => false, |
|
| 18 | + 'capability_type' => 'page', |
|
| 19 | 19 | 'capabilities' => array( |
| 20 | 20 | 'edit_post' => 'frm_change_settings', |
| 21 | 21 | 'edit_posts' => 'frm_change_settings', |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | 'delete_posts' => 'frm_change_settings', |
| 26 | 26 | 'read_private_posts' => 'read_private_posts', |
| 27 | 27 | ), |
| 28 | - 'supports' => array( |
|
| 28 | + 'supports' => array( |
|
| 29 | 29 | 'title', |
| 30 | - ), |
|
| 31 | - 'has_archive' => false, |
|
| 32 | - 'labels' => array( |
|
| 30 | + ), |
|
| 31 | + 'has_archive' => false, |
|
| 32 | + 'labels' => array( |
|
| 33 | 33 | 'name' => __( 'Styles', 'formidable' ), |
| 34 | 34 | 'singular_name' => __( 'Style', 'formidable' ), |
| 35 | 35 | 'menu_name' => __( 'Style', 'formidable' ), |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | 'add_new_item' => __( 'Create a New Style', 'formidable' ), |
| 38 | 38 | 'edit_item' => __( 'Edit Style', 'formidable' ), |
| 39 | 39 | ), |
| 40 | - ) ); |
|
| 41 | - } |
|
| 40 | + ) ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - public static function menu() { |
|
| 43 | + public static function menu() { |
|
| 44 | 44 | add_submenu_page( 'formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
| 45 | - } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | public static function admin_init() { |
| 48 | 48 | if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - self::load_pro_hooks(); |
|
| 52 | + self::load_pro_hooks(); |
|
| 53 | 53 | |
| 54 | 54 | $style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 55 | 55 | if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) { |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 61 | 61 | |
| 62 | - $version = FrmAppHelper::plugin_version(); |
|
| 62 | + $version = FrmAppHelper::plugin_version(); |
|
| 63 | 63 | $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; |
| 64 | 64 | wp_enqueue_style( 'wp-color-picker' ); |
| 65 | 65 | |
| 66 | 66 | wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
| 67 | 67 | |
| 68 | 68 | $style = apply_filters( 'frm_style_head', false ); |
| 69 | - if ( $style ) { |
|
| 69 | + if ( $style ) { |
|
| 70 | 70 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 71 | - } |
|
| 72 | - } |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | public static function enqueue_css( $register = 'enqueue' ) { |
| 75 | 75 | global $frm_vars; |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | public static function load_styler( $style, $message = '' ) { |
| 229 | - global $frm_settings; |
|
| 229 | + global $frm_settings; |
|
| 230 | 230 | |
| 231 | - $frm_style = new FrmStyle(); |
|
| 232 | - $styles = $frm_style->get_all(); |
|
| 231 | + $frm_style = new FrmStyle(); |
|
| 232 | + $styles = $frm_style->get_all(); |
|
| 233 | 233 | |
| 234 | 234 | if ( is_numeric( $style ) ) { |
| 235 | 235 | $style = $styles[ $style ]; |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | $style = $frm_style->get_default_style( $styles ); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - self::add_meta_boxes(); |
|
| 240 | + self::add_meta_boxes(); |
|
| 241 | 241 | |
| 242 | 242 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
| 243 | - } |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @param string $message |
@@ -258,31 +258,31 @@ discard block |
||
| 258 | 258 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - private static function manage_styles() { |
|
| 261 | + private static function manage_styles() { |
|
| 262 | 262 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
| 263 | 263 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
| 264 | - return self::manage(); |
|
| 265 | - } |
|
| 264 | + return self::manage(); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - global $wpdb; |
|
| 267 | + global $wpdb; |
|
| 268 | 268 | |
| 269 | 269 | $forms = FrmForm::get_published_forms(); |
| 270 | - foreach ( $forms as $form ) { |
|
| 271 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 272 | - continue; |
|
| 273 | - } |
|
| 270 | + foreach ( $forms as $form ) { |
|
| 271 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 272 | + continue; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 275 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 276 | 276 | |
| 277 | 277 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 278 | 278 | unset( $form ); |
| 279 | - } |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 281 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 282 | 282 | return self::manage( $message, $forms ); |
| 283 | - } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - public static function custom_css( $message = '', $style = null ) { |
|
| 285 | + public static function custom_css( $message = '', $style = null ) { |
|
| 286 | 286 | if ( function_exists( 'wp_enqueue_code_editor' ) ) { |
| 287 | 287 | $id = 'frm_codemirror_box'; |
| 288 | 288 | $settings = wp_enqueue_code_editor( array( |
@@ -322,41 +322,41 @@ discard block |
||
| 322 | 322 | return self::custom_css( $message ); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - public static function route() { |
|
| 325 | + public static function route() { |
|
| 326 | 326 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 327 | 327 | |
| 328 | - switch ( $action ) { |
|
| 329 | - case 'edit': |
|
| 330 | - case 'save': |
|
| 331 | - case 'manage': |
|
| 332 | - case 'manage_styles': |
|
| 333 | - case 'custom_css': |
|
| 334 | - case 'save_css': |
|
| 328 | + switch ( $action ) { |
|
| 329 | + case 'edit': |
|
| 330 | + case 'save': |
|
| 331 | + case 'manage': |
|
| 332 | + case 'manage_styles': |
|
| 333 | + case 'custom_css': |
|
| 334 | + case 'save_css': |
|
| 335 | 335 | return self::$action(); |
| 336 | - default: |
|
| 337 | - do_action( 'frm_style_action_route', $action ); |
|
| 338 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 339 | - return; |
|
| 340 | - } |
|
| 336 | + default: |
|
| 337 | + do_action( 'frm_style_action_route', $action ); |
|
| 338 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 339 | + return; |
|
| 340 | + } |
|
| 341 | 341 | |
| 342 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 343 | - return self::$action(); |
|
| 344 | - } |
|
| 342 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 343 | + return self::$action(); |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - return self::edit(); |
|
| 347 | - } |
|
| 348 | - } |
|
| 346 | + return self::edit(); |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | 349 | |
| 350 | - public static function reset_styling() { |
|
| 350 | + public static function reset_styling() { |
|
| 351 | 351 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 352 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 352 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 353 | 353 | |
| 354 | - $frm_style = new FrmStyle(); |
|
| 355 | - $defaults = $frm_style->get_defaults(); |
|
| 354 | + $frm_style = new FrmStyle(); |
|
| 355 | + $defaults = $frm_style->get_defaults(); |
|
| 356 | 356 | |
| 357 | - echo json_encode( $defaults ); |
|
| 358 | - wp_die(); |
|
| 359 | - } |
|
| 357 | + echo json_encode( $defaults ); |
|
| 358 | + wp_die(); |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | 361 | public static function change_styling() { |
| 362 | 362 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
@@ -371,21 +371,21 @@ discard block |
||
| 371 | 371 | wp_die(); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - private static function add_meta_boxes() { |
|
| 375 | - |
|
| 376 | - // setup meta boxes |
|
| 377 | - $meta_boxes = array( |
|
| 378 | - 'general' => __( 'General', 'formidable' ), |
|
| 379 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 380 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 381 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 382 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 383 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 384 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 385 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 386 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 387 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 388 | - ); |
|
| 374 | + private static function add_meta_boxes() { |
|
| 375 | + |
|
| 376 | + // setup meta boxes |
|
| 377 | + $meta_boxes = array( |
|
| 378 | + 'general' => __( 'General', 'formidable' ), |
|
| 379 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 380 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 381 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 382 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 383 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 384 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 385 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 386 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 387 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 388 | + ); |
|
| 389 | 389 | |
| 390 | 390 | /** |
| 391 | 391 | * Add custom boxes to the styling settings |
@@ -417,18 +417,18 @@ discard block |
||
| 417 | 417 | $file_name = apply_filters( 'frm_style_settings_' . $sec['args'], $file_name ); |
| 418 | 418 | |
| 419 | 419 | include( $file_name ); |
| 420 | - } |
|
| 420 | + } |
|
| 421 | 421 | |
| 422 | - public static function load_css() { |
|
| 422 | + public static function load_css() { |
|
| 423 | 423 | header( 'Content-type: text/css' ); |
| 424 | 424 | |
| 425 | - $frm_style = new FrmStyle(); |
|
| 426 | - $defaults = $frm_style->get_defaults(); |
|
| 425 | + $frm_style = new FrmStyle(); |
|
| 426 | + $defaults = $frm_style->get_defaults(); |
|
| 427 | 427 | $style = ''; |
| 428 | 428 | |
| 429 | 429 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 430 | - wp_die(); |
|
| 431 | - } |
|
| 430 | + wp_die(); |
|
| 431 | + } |
|
| 432 | 432 | |
| 433 | 433 | public static function load_saved_css() { |
| 434 | 434 | $css = get_transient( 'frmpro_css' ); |
@@ -437,49 +437,49 @@ discard block |
||
| 437 | 437 | wp_die(); |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - /** |
|
| 441 | - * Check if the Formidable styling should be loaded, |
|
| 442 | - * then enqueue it for the footer |
|
| 443 | - * @since 2.0 |
|
| 444 | - */ |
|
| 445 | - public static function enqueue_style() { |
|
| 446 | - global $frm_vars; |
|
| 447 | - |
|
| 448 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 449 | - // the CSS has already been loaded |
|
| 450 | - return; |
|
| 451 | - } |
|
| 452 | - |
|
| 453 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 454 | - if ( $frm_settings->load_style != 'none' ) { |
|
| 455 | - wp_enqueue_style( 'formidable' ); |
|
| 456 | - $frm_vars['css_loaded'] = true; |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - // Get the stylesheets for the form settings page |
|
| 461 | - public static function get_style_opts() { |
|
| 462 | - $frm_style = new FrmStyle(); |
|
| 463 | - $styles = $frm_style->get_all(); |
|
| 464 | - |
|
| 465 | - return $styles; |
|
| 466 | - } |
|
| 467 | - |
|
| 468 | - public static function get_form_style( $form = 'default' ) { |
|
| 469 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
| 470 | - |
|
| 471 | - if ( empty( $style ) || 1 == $style ) { |
|
| 472 | - $style = 'default'; |
|
| 473 | - } |
|
| 474 | - |
|
| 475 | - $frm_style = new FrmStyle( $style ); |
|
| 476 | - return $frm_style->get_one(); |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - /** |
|
| 480 | - * @param string $class |
|
| 481 | - * @param string $style |
|
| 482 | - */ |
|
| 440 | + /** |
|
| 441 | + * Check if the Formidable styling should be loaded, |
|
| 442 | + * then enqueue it for the footer |
|
| 443 | + * @since 2.0 |
|
| 444 | + */ |
|
| 445 | + public static function enqueue_style() { |
|
| 446 | + global $frm_vars; |
|
| 447 | + |
|
| 448 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 449 | + // the CSS has already been loaded |
|
| 450 | + return; |
|
| 451 | + } |
|
| 452 | + |
|
| 453 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 454 | + if ( $frm_settings->load_style != 'none' ) { |
|
| 455 | + wp_enqueue_style( 'formidable' ); |
|
| 456 | + $frm_vars['css_loaded'] = true; |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + // Get the stylesheets for the form settings page |
|
| 461 | + public static function get_style_opts() { |
|
| 462 | + $frm_style = new FrmStyle(); |
|
| 463 | + $styles = $frm_style->get_all(); |
|
| 464 | + |
|
| 465 | + return $styles; |
|
| 466 | + } |
|
| 467 | + |
|
| 468 | + public static function get_form_style( $form = 'default' ) { |
|
| 469 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
| 470 | + |
|
| 471 | + if ( empty( $style ) || 1 == $style ) { |
|
| 472 | + $style = 'default'; |
|
| 473 | + } |
|
| 474 | + |
|
| 475 | + $frm_style = new FrmStyle( $style ); |
|
| 476 | + return $frm_style->get_one(); |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + /** |
|
| 480 | + * @param string $class |
|
| 481 | + * @param string $style |
|
| 482 | + */ |
|
| 483 | 483 | public static function get_form_style_class( $class, $style ) { |
| 484 | 484 | if ( 1 == $style ) { |
| 485 | 485 | $style = 'default'; |
@@ -509,9 +509,9 @@ discard block |
||
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
| 512 | - /** |
|
| 513 | - * @param string $val |
|
| 514 | - */ |
|
| 512 | + /** |
|
| 513 | + * @param string $val |
|
| 514 | + */ |
|
| 515 | 515 | public static function get_style_val( $val, $form = 'default' ) { |
| 516 | 516 | $style = self::get_form_style( $form ); |
| 517 | 517 | if ( $style && isset( $style->post_content[ $val ] ) ) { |
@@ -521,72 +521,72 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | public static function show_entry_styles( $default_styles ) { |
| 523 | 523 | $frm_style = new FrmStyle( 'default' ); |
| 524 | - $style = $frm_style->get_one(); |
|
| 525 | - |
|
| 526 | - if ( ! $style ) { |
|
| 527 | - return $default_styles; |
|
| 528 | - } |
|
| 529 | - |
|
| 530 | - foreach ( $default_styles as $name => $val ) { |
|
| 531 | - $setting = $name; |
|
| 532 | - if ( 'border_width' == $name ) { |
|
| 533 | - $setting = 'field_border_width'; |
|
| 534 | - } else if ( 'alt_bg_color' == $name ) { |
|
| 535 | - $setting = 'bg_color_active'; |
|
| 536 | - } |
|
| 537 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 524 | + $style = $frm_style->get_one(); |
|
| 525 | + |
|
| 526 | + if ( ! $style ) { |
|
| 527 | + return $default_styles; |
|
| 528 | + } |
|
| 529 | + |
|
| 530 | + foreach ( $default_styles as $name => $val ) { |
|
| 531 | + $setting = $name; |
|
| 532 | + if ( 'border_width' == $name ) { |
|
| 533 | + $setting = 'field_border_width'; |
|
| 534 | + } else if ( 'alt_bg_color' == $name ) { |
|
| 535 | + $setting = 'bg_color_active'; |
|
| 536 | + } |
|
| 537 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 538 | 538 | unset( $name, $val ); |
| 539 | - } |
|
| 539 | + } |
|
| 540 | 540 | |
| 541 | - return $default_styles; |
|
| 542 | - } |
|
| 541 | + return $default_styles; |
|
| 542 | + } |
|
| 543 | 543 | |
| 544 | 544 | public static function &important_style( $important, $field ) { |
| 545 | 545 | $important = self::get_style_val( 'important_style', $field['form_id'] ); |
| 546 | - return $important; |
|
| 547 | - } |
|
| 546 | + return $important; |
|
| 547 | + } |
|
| 548 | 548 | |
| 549 | - /** |
|
| 550 | - * Fallback for WP < 3.6 |
|
| 551 | - */ |
|
| 552 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 553 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 554 | - return do_accordion_sections( $screen, $context, $object ); |
|
| 555 | - } |
|
| 549 | + /** |
|
| 550 | + * Fallback for WP < 3.6 |
|
| 551 | + */ |
|
| 552 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 553 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 554 | + return do_accordion_sections( $screen, $context, $object ); |
|
| 555 | + } |
|
| 556 | 556 | |
| 557 | - global $wp_meta_boxes; |
|
| 557 | + global $wp_meta_boxes; |
|
| 558 | 558 | |
| 559 | - $screen = 'formidable_page_formidable-styles'; |
|
| 560 | - $screen = convert_to_screen( $screen ); |
|
| 559 | + $screen = 'formidable_page_formidable-styles'; |
|
| 560 | + $screen = convert_to_screen( $screen ); |
|
| 561 | 561 | |
| 562 | - $page = $screen->id; |
|
| 562 | + $page = $screen->id; |
|
| 563 | 563 | |
| 564 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
| 565 | - ?> |
|
| 564 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
| 565 | + ?> |
|
| 566 | 566 | <div id="side-sortables" class="accordion-container"> |
| 567 | 567 | <?php |
| 568 | - $i = 0; |
|
| 569 | - $first_open = false; |
|
| 570 | - do { |
|
| 568 | + $i = 0; |
|
| 569 | + $first_open = false; |
|
| 570 | + do { |
|
| 571 | 571 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 572 | 572 | break; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 576 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 577 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 578 | - if ( false == $box || ! $box['title'] ) { |
|
| 579 | - continue; |
|
| 575 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 576 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 577 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 578 | + if ( false == $box || ! $box['title'] ) { |
|
| 579 | + continue; |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - $i++; |
|
| 583 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 582 | + $i++; |
|
| 583 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 584 | 584 | |
| 585 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 586 | - $first_open = true; |
|
| 587 | - } |
|
| 585 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 586 | + $first_open = true; |
|
| 587 | + } |
|
| 588 | 588 | |
| 589 | - ?> |
|
| 589 | + ?> |
|
| 590 | 590 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
| 591 | 591 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ); ?>"><br/></div> |
| 592 | 592 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -597,13 +597,13 @@ discard block |
||
| 597 | 597 | </div><!-- .accordion-section-content --> |
| 598 | 598 | </div><!-- .postbox --> |
| 599 | 599 | <?php |
| 600 | - } |
|
| 601 | - } |
|
| 602 | - } |
|
| 603 | - } while ( 0 ); |
|
| 604 | - ?> |
|
| 600 | + } |
|
| 601 | + } |
|
| 602 | + } |
|
| 603 | + } while ( 0 ); |
|
| 604 | + ?> |
|
| 605 | 605 | </div><!-- .accordion-container --> |
| 606 | 606 | <?php |
| 607 | - return $i; |
|
| 608 | - } |
|
| 607 | + return $i; |
|
| 608 | + } |
|
| 609 | 609 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $styles = $frm_style->get_all(); |
| 233 | 233 | |
| 234 | 234 | if ( is_numeric( $style ) ) { |
| 235 | - $style = $styles[ $style ]; |
|
| 235 | + $style = $styles[$style]; |
|
| 236 | 236 | } elseif ( 'default' == $style ) { |
| 237 | 237 | $style = $frm_style->get_default_style( $styles ); |
| 238 | 238 | } |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $forms = FrmForm::get_published_forms(); |
| 270 | 270 | foreach ( $forms as $form ) { |
| 271 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 271 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
| 272 | 272 | continue; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 275 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
| 276 | 276 | |
| 277 | 277 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 278 | 278 | unset( $form ); |
@@ -514,8 +514,8 @@ discard block |
||
| 514 | 514 | */ |
| 515 | 515 | public static function get_style_val( $val, $form = 'default' ) { |
| 516 | 516 | $style = self::get_form_style( $form ); |
| 517 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 518 | - return $style->post_content[ $val ]; |
|
| 517 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
| 518 | + return $style->post_content[$val]; |
|
| 519 | 519 | } |
| 520 | 520 | } |
| 521 | 521 | |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | } else if ( 'alt_bg_color' == $name ) { |
| 535 | 535 | $setting = 'bg_color_active'; |
| 536 | 536 | } |
| 537 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 537 | + $default_styles[$name] = $style->post_content[$setting]; |
|
| 538 | 538 | unset( $name, $val ); |
| 539 | 539 | } |
| 540 | 540 | |
@@ -568,18 +568,18 @@ discard block |
||
| 568 | 568 | $i = 0; |
| 569 | 569 | $first_open = false; |
| 570 | 570 | do { |
| 571 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
| 571 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
| 572 | 572 | break; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
| 576 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 577 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 576 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
| 577 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
| 578 | 578 | if ( false == $box || ! $box['title'] ) { |
| 579 | 579 | continue; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - $i++; |
|
| 582 | + $i ++; |
|
| 583 | 583 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
| 584 | 584 | |
| 585 | 585 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -3,14 +3,14 @@ discard block |
||
| 3 | 3 | class FrmAppController { |
| 4 | 4 | |
| 5 | 5 | public static function menu() { |
| 6 | - FrmAppHelper::maybe_add_permissions(); |
|
| 7 | - if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
| 8 | - return; |
|
| 9 | - } |
|
| 6 | + FrmAppHelper::maybe_add_permissions(); |
|
| 7 | + if ( ! current_user_can( 'frm_view_forms' ) ) { |
|
| 8 | + return; |
|
| 9 | + } |
|
| 10 | 10 | |
| 11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
| 12 | 12 | add_menu_page( 'Formidable', $menu_name, 'frm_view_forms', 'formidable', 'FrmFormsController::route', '', self::get_menu_position() ); |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | 15 | private static function get_menu_position() { |
| 16 | 16 | $count = count( get_post_types( array( |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | return $is_white_page; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public static function load_wp_admin_style() { |
|
| 50 | - FrmAppHelper::load_font_style(); |
|
| 51 | - } |
|
| 49 | + public static function load_wp_admin_style() { |
|
| 50 | + FrmAppHelper::load_font_style(); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 54 | 54 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 55 | - if ( empty( $show_nav ) || ! $form ) { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 55 | + if ( empty( $show_nav ) || ! $form ) { |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | FrmForm::maybe_get_form( $form ); |
| 60 | 60 | if ( ! is_object( $form ) ) { |
@@ -115,21 +115,21 @@ discard block |
||
| 115 | 115 | return $nav_items; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - // Adds a settings link to the plugins page |
|
| 119 | - public static function settings_link( $links ) { |
|
| 118 | + // Adds a settings link to the plugins page |
|
| 119 | + public static function settings_link( $links ) { |
|
| 120 | 120 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable' ) ) . '">' . __( 'Build a Form', 'formidable' ) . '</a>'; |
| 121 | - array_unshift( $links, $settings ); |
|
| 121 | + array_unshift( $links, $settings ); |
|
| 122 | 122 | |
| 123 | - return $links; |
|
| 124 | - } |
|
| 123 | + return $links; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - public static function pro_get_started_headline() { |
|
| 126 | + public static function pro_get_started_headline() { |
|
| 127 | 127 | self::maybe_show_upgrade_bar(); |
| 128 | 128 | |
| 129 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 130 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 131 | - return; |
|
| 132 | - } |
|
| 129 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 130 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | 134 | $pro_installed = is_dir( WP_PLUGIN_DIR . '/formidable-pro' ); |
| 135 | 135 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } else { |
| 145 | 145 | $inst_install_url = 'https://formidableforms.com/knowledgebase/install-formidable-forms/'; |
| 146 | 146 | } |
| 147 | - ?> |
|
| 147 | + ?> |
|
| 148 | 148 | <div class="error" class="frm_previous_install"> |
| 149 | 149 | <?php |
| 150 | 150 | echo apply_filters( 'frm_pro_update_msg', |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | ?> |
| 158 | 158 | </div> |
| 159 | 159 | <?php |
| 160 | - } |
|
| 161 | - } |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | private static function maybe_show_upgrade_bar() { |
| 164 | 164 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - public static function admin_js() { |
|
| 290 | + public static function admin_js() { |
|
| 291 | 291 | $version = FrmAppHelper::plugin_version(); |
| 292 | 292 | FrmAppHelper::load_admin_wide_js( false ); |
| 293 | 293 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | wp_register_script( 'formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', $dependecies, $version, true ); |
| 310 | 310 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 311 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 311 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 312 | 312 | wp_register_style( 'formidable-grids', FrmAppHelper::plugin_url() . '/css/frm_grids.css', array(), $version ); |
| 313 | 313 | |
| 314 | 314 | // load multselect js |
@@ -320,49 +320,49 @@ discard block |
||
| 320 | 320 | global $pagenow; |
| 321 | 321 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 322 | 322 | |
| 323 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 324 | - wp_enqueue_style( 'widgets' ); |
|
| 325 | - wp_enqueue_script( 'formidable' ); |
|
| 326 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 323 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 324 | + wp_enqueue_style( 'widgets' ); |
|
| 325 | + wp_enqueue_script( 'formidable' ); |
|
| 326 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 327 | 327 | FrmAppHelper::localize_script( 'admin' ); |
| 328 | 328 | |
| 329 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 329 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 330 | 330 | if ( 'formidable-styles' !== $page ) { |
| 331 | 331 | wp_enqueue_style( 'formidable-grids' ); |
| 332 | 332 | wp_enqueue_style( 'formidable-dropzone' ); |
| 333 | 333 | add_thickbox(); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 336 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 337 | 337 | |
| 338 | 338 | do_action( 'frm_enqueue_builder_scripts' ); |
| 339 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 340 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 341 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 339 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 340 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 341 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 342 | 342 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 343 | 343 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 344 | - if ( ! $post ) { |
|
| 345 | - return; |
|
| 346 | - } |
|
| 347 | - $post_type = $post->post_type; |
|
| 348 | - } else { |
|
| 349 | - return; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - if ( $post_type == 'frm_display' ) { |
|
| 353 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 354 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 355 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 344 | + if ( ! $post ) { |
|
| 345 | + return; |
|
| 346 | + } |
|
| 347 | + $post_type = $post->post_type; |
|
| 348 | + } else { |
|
| 349 | + return; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + if ( $post_type == 'frm_display' ) { |
|
| 353 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 354 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 355 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 356 | 356 | FrmAppHelper::localize_script( 'admin' ); |
| 357 | - } |
|
| 358 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 359 | - FrmAppHelper::load_admin_wide_js(); |
|
| 360 | - } |
|
| 361 | - } |
|
| 357 | + } |
|
| 358 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 359 | + FrmAppHelper::load_admin_wide_js(); |
|
| 360 | + } |
|
| 361 | + } |
|
| 362 | 362 | |
| 363 | - public static function load_lang() { |
|
| 364 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 365 | - } |
|
| 363 | + public static function load_lang() { |
|
| 364 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 365 | + } |
|
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | 368 | * Filter shortcodes in text widgets |
@@ -466,21 +466,21 @@ discard block |
||
| 466 | 466 | * @deprecated 3.0.04 |
| 467 | 467 | * @codeCoverageIgnore |
| 468 | 468 | */ |
| 469 | - public static function activation_install() { |
|
| 469 | + public static function activation_install() { |
|
| 470 | 470 | _deprecated_function( __METHOD__, '3.0.04', 'FrmAppController::install' ); |
| 471 | - FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 472 | - FrmFormActionsController::actions_init(); |
|
| 473 | - self::install(); |
|
| 474 | - } |
|
| 471 | + FrmDb::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 472 | + FrmFormActionsController::actions_init(); |
|
| 473 | + self::install(); |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - public static function install() { |
|
| 477 | - $frmdb = new FrmMigrate(); |
|
| 478 | - $frmdb->upgrade(); |
|
| 479 | - } |
|
| 476 | + public static function install() { |
|
| 477 | + $frmdb = new FrmMigrate(); |
|
| 478 | + $frmdb->upgrade(); |
|
| 479 | + } |
|
| 480 | 480 | |
| 481 | - public static function uninstall() { |
|
| 481 | + public static function uninstall() { |
|
| 482 | 482 | FrmAppHelper::permission_check( 'administrator' ); |
| 483 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 483 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 484 | 484 | |
| 485 | 485 | $frmdb = new FrmMigrate(); |
| 486 | 486 | $frmdb->uninstall(); |
@@ -489,17 +489,17 @@ discard block |
||
| 489 | 489 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 490 | 490 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 491 | 491 | |
| 492 | - wp_die(); |
|
| 493 | - } |
|
| 492 | + wp_die(); |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | - public static function drop_tables( $tables ) { |
|
| 496 | - global $wpdb; |
|
| 497 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 498 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 499 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 500 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 501 | - return $tables; |
|
| 502 | - } |
|
| 495 | + public static function drop_tables( $tables ) { |
|
| 496 | + global $wpdb; |
|
| 497 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 498 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 499 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 500 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 501 | + return $tables; |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | 504 | /** |
| 505 | 505 | * Routes for wordpress pages -- we're just replacing content |
@@ -518,16 +518,16 @@ discard block |
||
| 518 | 518 | return $content; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - public static function deauthorize() { |
|
| 521 | + public static function deauthorize() { |
|
| 522 | 522 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 523 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 523 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 524 | 524 | |
| 525 | - delete_option( 'frmpro-credentials' ); |
|
| 526 | - delete_option( 'frmpro-authorized' ); |
|
| 527 | - delete_site_option( 'frmpro-credentials' ); |
|
| 528 | - delete_site_option( 'frmpro-authorized' ); |
|
| 529 | - wp_die(); |
|
| 530 | - } |
|
| 525 | + delete_option( 'frmpro-credentials' ); |
|
| 526 | + delete_option( 'frmpro-authorized' ); |
|
| 527 | + delete_site_option( 'frmpro-credentials' ); |
|
| 528 | + delete_site_option( 'frmpro-authorized' ); |
|
| 529 | + wp_die(); |
|
| 530 | + } |
|
| 531 | 531 | |
| 532 | 532 | public static function set_footer_text( $text ) { |
| 533 | 533 | if ( FrmAppHelper::is_formidable_admin() ) { |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | * @deprecated 1.07.05 |
| 549 | 549 | * @codeCoverageIgnore |
| 550 | 550 | */ |
| 551 | - public static function get_form_shortcode( $atts ) { |
|
| 552 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 553 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
| 554 | - } |
|
| 551 | + public static function get_form_shortcode( $atts ) { |
|
| 552 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 553 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
| 554 | + } |
|
| 555 | 555 | } |