@@ -1,59 +1,59 @@ |
||
| 1 | 1 | <p> |
| 2 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('center_form') ) ?>" id="frm_center_form" value="1" <?php checked($style->post_content['center_form'], 1) ?> /> |
|
| 2 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'center_form' ) ) ?>" id="frm_center_form" value="1" <?php checked( $style->post_content['center_form'], 1 ) ?> /> |
|
| 3 | 3 | <?php _e( 'Center form on page', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will center your form on the page where it is published if the form width is less than the available width on the page.', 'formidable' ) ?>" ></span> |
| 4 | 4 | </label> |
| 5 | 5 | </p> |
| 6 | 6 | |
| 7 | 7 | <div class="field-group clearfix frm-first-row"> |
| 8 | 8 | <label><?php _e( 'Alignment', 'formidable' ) ?></label> |
| 9 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('form_align') ) ?>" id="frm_form_align"> |
|
| 10 | - <option value="left" <?php selected($style->post_content['form_align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | - <option value="right" <?php selected($style->post_content['form_align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | - <option value="center" <?php selected($style->post_content['form_align'], 'center') ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 9 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'form_align' ) ) ?>" id="frm_form_align"> |
|
| 10 | + <option value="left" <?php selected( $style->post_content['form_align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 11 | + <option value="right" <?php selected( $style->post_content['form_align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 12 | + <option value="center" <?php selected( $style->post_content['form_align'], 'center' ) ?>><?php _e( 'center', 'formidable' ) ?></option> |
|
| 13 | 13 | </select> |
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="field-group clearfix frm-first-row"> |
| 17 | 17 | <label><?php _e( 'Max Width', 'formidable' ) ?></label> |
| 18 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_width') ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_width' ) ) ?>" value="<?php echo esc_attr( $style->post_content['form_width'] ) ?>"/> |
|
| 19 | 19 | </div> |
| 20 | 20 | |
| 21 | 21 | <div class="field-group clearfix frm-first-row"> |
| 22 | 22 | <label><?php _e( 'Background', 'formidable' ) ?></label> |
| 23 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_bg_color') ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 23 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_bg_color' ) ) ?>" id="frm_fieldset_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_bg_color'] ) ?>" size="4" /> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | <div class="field-group field-group-border clearfix"> |
| 27 | 27 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 28 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset') ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 28 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset' ) ) ?>" id="frm_fieldset" value="<?php echo esc_attr( $style->post_content['fieldset'] ) ?>" size="4" /> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <div class="field-group clearfix"> |
| 32 | 32 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 33 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_color') ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 33 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_color' ) ) ?>" id="frm_fieldset_color" class="hex" value="<?php echo esc_attr( $style->post_content['fieldset_color'] ) ?>" /> |
|
| 34 | 34 | </div> |
| 35 | 35 | |
| 36 | 36 | <div class="field-group clearfix"> |
| 37 | 37 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 38 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('fieldset_padding') ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 38 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'fieldset_padding' ) ) ?>" id="frm_fieldset_padding" value="<?php echo esc_attr( $style->post_content['fieldset_padding'] ) ?>" size="4" /> |
|
| 39 | 39 | </div> |
| 40 | 40 | |
| 41 | 41 | <div id="frm_gen_font_box" class="field-group clearfix"> |
| 42 | 42 | <label><?php _e( 'Font Family', 'formidable' ) ?></label> |
| 43 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font') ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 43 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font' ) ) ?>" id="frm_font" value="<?php echo esc_attr( $style->post_content['font'] ) ?>" class="frm_full_width" /> |
|
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <div class="field-group clearfix frm-half"> |
| 47 | 47 | <label><?php _e( 'Direction', 'formidable' ) ?></label> |
| 48 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('direction') ) ?>" id="frm_direction"> |
|
| 49 | - <option value="ltr" <?php selected($style->post_content['direction'], 'ltr') ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | - <option value="rtl" <?php selected($style->post_content['direction'], 'rtl') ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 48 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'direction' ) ) ?>" id="frm_direction"> |
|
| 49 | + <option value="ltr" <?php selected( $style->post_content['direction'], 'ltr' ) ?>><?php _e( 'Left to Right', 'formidable' ) ?></option> |
|
| 50 | + <option value="rtl" <?php selected( $style->post_content['direction'], 'rtl' ) ?>><?php _e( 'Right to Left', 'formidable' ) ?></option> |
|
| 51 | 51 | </select> |
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <div class="clear"></div> |
| 55 | 55 | <p class="frm_no_bottom_margin"> |
| 56 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('important_style') ) ?>" id="frm_important_style" value="1" <?php checked($style->post_content['important_style'], 1) ?> /> |
|
| 56 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'important_style' ) ) ?>" id="frm_important_style" value="1" <?php checked( $style->post_content['important_style'], 1 ) ?> /> |
|
| 57 | 57 | <?php _e( 'Override theme styling', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'This will add !important to many of the lines in the Formidable styling to make sure it will be used.', 'formidable' ) ?>" ></span> |
| 58 | 58 | </label> |
| 59 | 59 | </p> |
@@ -121,6 +121,9 @@ |
||
| 121 | 121 | $stylesheet_urls['formidable'] = $url; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $version |
|
| 126 | + */ |
|
| 124 | 127 | private static function get_css_version( $css_key, $version ) { |
| 125 | 128 | if ( 'formidable' == $css_key ) { |
| 126 | 129 | $this_version = get_option( 'frm_last_style_update' ); |
@@ -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,31 +37,31 @@ 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 | - public static function admin_init() { |
|
| 48 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 49 | - return; |
|
| 50 | - } |
|
| 47 | + public static function admin_init() { |
|
| 48 | + if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - self::load_pro_hooks(); |
|
| 53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
| 52 | + self::load_pro_hooks(); |
|
| 53 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
| 54 | 54 | |
| 55 | - $version = FrmAppHelper::plugin_version(); |
|
| 55 | + $version = FrmAppHelper::plugin_version(); |
|
| 56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
| 57 | 57 | |
| 58 | 58 | wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
| 59 | 59 | |
| 60 | - $style = apply_filters('frm_style_head', false); |
|
| 61 | - if ( $style ) { |
|
| 60 | + $style = apply_filters('frm_style_head', false); |
|
| 61 | + if ( $style ) { |
|
| 62 | 62 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 63 | - } |
|
| 64 | - } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | public static function enqueue_css( $register = 'enqueue' ) { |
| 67 | 67 | global $frm_vars; |
@@ -143,230 +143,230 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public static function new_style( $return = '' ) { |
| 146 | - self::load_styler('default'); |
|
| 147 | - } |
|
| 146 | + self::load_styler('default'); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | 149 | public static function duplicate() { |
| 150 | 150 | self::load_styler('default'); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public static function edit( $style_id = false, $message = '' ) { |
| 154 | - if ( ! $style_id ) { |
|
| 154 | + if ( ! $style_id ) { |
|
| 155 | 155 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 156 | - if ( empty($style_id) ) { |
|
| 157 | - $style_id = 'default'; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - if ( 'default' == $style_id ) { |
|
| 162 | - $style = 'default'; |
|
| 163 | - } else { |
|
| 164 | - $frm_style = new FrmStyle($style_id); |
|
| 165 | - $style = $frm_style->get_one(); |
|
| 166 | - $style = $style->ID; |
|
| 167 | - } |
|
| 168 | - |
|
| 169 | - self::load_styler($style, $message); |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - public static function save() { |
|
| 173 | - $frm_style = new FrmStyle(); |
|
| 174 | - $message = ''; |
|
| 156 | + if ( empty($style_id) ) { |
|
| 157 | + $style_id = 'default'; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + if ( 'default' == $style_id ) { |
|
| 162 | + $style = 'default'; |
|
| 163 | + } else { |
|
| 164 | + $frm_style = new FrmStyle($style_id); |
|
| 165 | + $style = $frm_style->get_one(); |
|
| 166 | + $style = $style->ID; |
|
| 167 | + } |
|
| 168 | + |
|
| 169 | + self::load_styler($style, $message); |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + public static function save() { |
|
| 173 | + $frm_style = new FrmStyle(); |
|
| 174 | + $message = ''; |
|
| 175 | 175 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_title' ); |
| 176 | 176 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
| 177 | 177 | |
| 178 | 178 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
| 179 | - $id = $frm_style->update($post_id); |
|
| 180 | - if ( empty($post_id) && ! empty($id) ) { |
|
| 181 | - // set the post id to the new style so it will be loaded for editing |
|
| 182 | - $post_id = reset($id); |
|
| 183 | - } |
|
| 184 | - // include the CSS that includes this style |
|
| 179 | + $id = $frm_style->update($post_id); |
|
| 180 | + if ( empty($post_id) && ! empty($id) ) { |
|
| 181 | + // set the post id to the new style so it will be loaded for editing |
|
| 182 | + $post_id = reset($id); |
|
| 183 | + } |
|
| 184 | + // include the CSS that includes this style |
|
| 185 | 185 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
| 186 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 187 | - } |
|
| 186 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | - return self::edit($post_id, $message); |
|
| 190 | - } |
|
| 189 | + return self::edit($post_id, $message); |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | 192 | public static function load_styler( $style, $message = '' ) { |
| 193 | - global $frm_settings; |
|
| 193 | + global $frm_settings; |
|
| 194 | 194 | |
| 195 | - $frm_style = new FrmStyle(); |
|
| 196 | - $styles = $frm_style->get_all(); |
|
| 195 | + $frm_style = new FrmStyle(); |
|
| 196 | + $styles = $frm_style->get_all(); |
|
| 197 | 197 | |
| 198 | - if ( is_numeric($style) ) { |
|
| 199 | - $style = $styles[ $style ]; |
|
| 200 | - } else if ( 'default' == $style ) { |
|
| 201 | - $style = $frm_style->get_default_style($styles); |
|
| 202 | - } |
|
| 198 | + if ( is_numeric($style) ) { |
|
| 199 | + $style = $styles[ $style ]; |
|
| 200 | + } else if ( 'default' == $style ) { |
|
| 201 | + $style = $frm_style->get_default_style($styles); |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - self::add_meta_boxes(); |
|
| 204 | + self::add_meta_boxes(); |
|
| 205 | 205 | |
| 206 | 206 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/show.php' ); |
| 207 | - } |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | 209 | /** |
| 210 | 210 | * @param string $message |
| 211 | 211 | * @param array|object $forms |
| 212 | 212 | */ |
| 213 | 213 | private static function manage( $message = '', $forms = array() ) { |
| 214 | - $frm_style = new FrmStyle(); |
|
| 215 | - $styles = $frm_style->get_all(); |
|
| 216 | - $default_style = $frm_style->get_default_style($styles); |
|
| 214 | + $frm_style = new FrmStyle(); |
|
| 215 | + $styles = $frm_style->get_all(); |
|
| 216 | + $default_style = $frm_style->get_default_style($styles); |
|
| 217 | 217 | |
| 218 | - if ( empty($forms) ) { |
|
| 219 | - $forms = FrmForm::get_published_forms(); |
|
| 220 | - } |
|
| 218 | + if ( empty($forms) ) { |
|
| 219 | + $forms = FrmForm::get_published_forms(); |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | 222 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/manage.php' ); |
| 223 | - } |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - private static function manage_styles() { |
|
| 225 | + private static function manage_styles() { |
|
| 226 | 226 | $style_nonce = FrmAppHelper::get_post_param( 'frm_manage_style', '', 'sanitize_text_field' ); |
| 227 | 227 | if ( ! $_POST || ! isset( $_POST['style'] ) || ! wp_verify_nonce( $style_nonce, 'frm_manage_style_nonce' ) ) { |
| 228 | - return self::manage(); |
|
| 229 | - } |
|
| 228 | + return self::manage(); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - global $wpdb; |
|
| 231 | + global $wpdb; |
|
| 232 | 232 | |
| 233 | 233 | $forms = FrmForm::get_published_forms(); |
| 234 | - foreach ( $forms as $form ) { |
|
| 235 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 236 | - continue; |
|
| 237 | - } |
|
| 234 | + foreach ( $forms as $form ) { |
|
| 235 | + if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 236 | + continue; |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 239 | + $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 240 | 240 | |
| 241 | 241 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 242 | - unset($form); |
|
| 243 | - } |
|
| 242 | + unset($form); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 246 | - return self::manage($message, $forms); |
|
| 247 | - } |
|
| 245 | + $message = __( 'Your form styles have been saved.', 'formidable' ); |
|
| 246 | + return self::manage($message, $forms); |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - public static function custom_css( $message = '', $style = null ) { |
|
| 250 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 251 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 252 | - wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
| 249 | + public static function custom_css( $message = '', $style = null ) { |
|
| 250 | + wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 251 | + wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 252 | + wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
|
| 253 | 253 | |
| 254 | - if ( ! isset($style) ) { |
|
| 255 | - $frm_style = new FrmStyle(); |
|
| 256 | - $style = $frm_style->get_default_style(); |
|
| 257 | - } |
|
| 254 | + if ( ! isset($style) ) { |
|
| 255 | + $frm_style = new FrmStyle(); |
|
| 256 | + $style = $frm_style->get_default_style(); |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | 259 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php' ); |
| 260 | - } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - public static function save_css() { |
|
| 263 | - $frm_style = new FrmStyle(); |
|
| 262 | + public static function save_css() { |
|
| 263 | + $frm_style = new FrmStyle(); |
|
| 264 | 264 | |
| 265 | - $message = ''; |
|
| 265 | + $message = ''; |
|
| 266 | 266 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
| 267 | 267 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
| 268 | 268 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
| 269 | - $frm_style->update($post_id); |
|
| 270 | - $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 271 | - } |
|
| 269 | + $frm_style->update($post_id); |
|
| 270 | + $message = __( 'Your styling settings have been saved.', 'formidable' ); |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - return self::custom_css($message); |
|
| 274 | - } |
|
| 273 | + return self::custom_css($message); |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - public static function route() { |
|
| 276 | + public static function route() { |
|
| 277 | 277 | $action = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' ); |
| 278 | 278 | |
| 279 | - switch ( $action ) { |
|
| 280 | - case 'edit': |
|
| 281 | - case 'save': |
|
| 282 | - case 'manage': |
|
| 283 | - case 'manage_styles': |
|
| 284 | - case 'custom_css': |
|
| 285 | - case 'save_css': |
|
| 279 | + switch ( $action ) { |
|
| 280 | + case 'edit': |
|
| 281 | + case 'save': |
|
| 282 | + case 'manage': |
|
| 283 | + case 'manage_styles': |
|
| 284 | + case 'custom_css': |
|
| 285 | + case 'save_css': |
|
| 286 | 286 | return self::$action(); |
| 287 | - default: |
|
| 288 | - do_action( 'frm_style_action_route', $action ); |
|
| 289 | - if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 290 | - return; |
|
| 291 | - } |
|
| 287 | + default: |
|
| 288 | + do_action( 'frm_style_action_route', $action ); |
|
| 289 | + if ( apply_filters( 'frm_style_stop_action_route', false, $action ) ) { |
|
| 290 | + return; |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 294 | - return self::$action(); |
|
| 295 | - } |
|
| 293 | + if ( 'new_style' == $action || 'duplicate' == $action ) { |
|
| 294 | + return self::$action(); |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | - return self::edit(); |
|
| 298 | - } |
|
| 299 | - } |
|
| 297 | + return self::edit(); |
|
| 298 | + } |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - public static function reset_styling() { |
|
| 301 | + public static function reset_styling() { |
|
| 302 | 302 | FrmAppHelper::permission_check('frm_change_settings'); |
| 303 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 303 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 304 | 304 | |
| 305 | - $frm_style = new FrmStyle(); |
|
| 306 | - $defaults = $frm_style->get_defaults(); |
|
| 305 | + $frm_style = new FrmStyle(); |
|
| 306 | + $defaults = $frm_style->get_defaults(); |
|
| 307 | 307 | |
| 308 | - echo json_encode( $defaults ); |
|
| 309 | - wp_die(); |
|
| 310 | - } |
|
| 308 | + echo json_encode( $defaults ); |
|
| 309 | + wp_die(); |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - public static function change_styling() { |
|
| 313 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 312 | + public static function change_styling() { |
|
| 313 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 314 | 314 | |
| 315 | - $frm_style = new FrmStyle(); |
|
| 316 | - $defaults = $frm_style->get_defaults(); |
|
| 315 | + $frm_style = new FrmStyle(); |
|
| 316 | + $defaults = $frm_style->get_defaults(); |
|
| 317 | 317 | |
| 318 | - // remove the # from the colors |
|
| 319 | - foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
| 320 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 321 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 322 | - } |
|
| 323 | - } |
|
| 318 | + // remove the # from the colors |
|
| 319 | + foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
|
| 320 | + if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 321 | + $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 322 | + } |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - echo '<style type="text/css">'; |
|
| 325 | + echo '<style type="text/css">'; |
|
| 326 | 326 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 327 | - echo '</style>'; |
|
| 328 | - wp_die(); |
|
| 329 | - } |
|
| 330 | - |
|
| 331 | - private static function add_meta_boxes() { |
|
| 332 | - |
|
| 333 | - // setup meta boxes |
|
| 334 | - $meta_boxes = array( |
|
| 335 | - 'general' => __( 'General', 'formidable' ), |
|
| 336 | - 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 337 | - 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 338 | - 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 339 | - 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 340 | - 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 341 | - 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 342 | - 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 343 | - 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
| 344 | - 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
| 345 | - 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 346 | - 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 347 | - ); |
|
| 348 | - |
|
| 349 | - foreach ( $meta_boxes as $nicename => $name ) { |
|
| 327 | + echo '</style>'; |
|
| 328 | + wp_die(); |
|
| 329 | + } |
|
| 330 | + |
|
| 331 | + private static function add_meta_boxes() { |
|
| 332 | + |
|
| 333 | + // setup meta boxes |
|
| 334 | + $meta_boxes = array( |
|
| 335 | + 'general' => __( 'General', 'formidable' ), |
|
| 336 | + 'form-title' => __( 'Form Title', 'formidable' ), |
|
| 337 | + 'form-description' => __( 'Form Description', 'formidable' ), |
|
| 338 | + 'field-labels' => __( 'Field Labels', 'formidable' ), |
|
| 339 | + 'field-description' => __( 'Field Description', 'formidable' ), |
|
| 340 | + 'field-colors' => __( 'Field Colors', 'formidable' ), |
|
| 341 | + 'field-sizes' => __( 'Field Settings', 'formidable' ), |
|
| 342 | + 'check-box-radio-fields' => __( 'Check Box & Radio Fields', 'formidable' ), |
|
| 343 | + 'section-fields' => __( 'Section Fields', 'formidable' ), |
|
| 344 | + 'date-fields' => __( 'Date Fields', 'formidable' ), |
|
| 345 | + 'buttons' => __( 'Buttons', 'formidable' ), |
|
| 346 | + 'form-messages' => __( 'Form Messages', 'formidable' ), |
|
| 347 | + ); |
|
| 348 | + |
|
| 349 | + foreach ( $meta_boxes as $nicename => $name ) { |
|
| 350 | 350 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
| 351 | - unset($nicename, $name); |
|
| 352 | - } |
|
| 353 | - } |
|
| 351 | + unset($nicename, $name); |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | 354 | |
| 355 | 355 | public static function include_style_section( $atts, $sec ) { |
| 356 | - extract($atts); |
|
| 356 | + extract($atts); |
|
| 357 | 357 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
| 358 | 358 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
| 359 | - } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - public static function load_css() { |
|
| 362 | - header('Content-type: text/css'); |
|
| 361 | + public static function load_css() { |
|
| 362 | + header('Content-type: text/css'); |
|
| 363 | 363 | |
| 364 | - $frm_style = new FrmStyle(); |
|
| 365 | - $defaults = $frm_style->get_defaults(); |
|
| 364 | + $frm_style = new FrmStyle(); |
|
| 365 | + $defaults = $frm_style->get_defaults(); |
|
| 366 | 366 | |
| 367 | 367 | include( FrmAppHelper::plugin_path() . '/css/_single_theme.css.php' ); |
| 368 | - wp_die(); |
|
| 369 | - } |
|
| 368 | + wp_die(); |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | 371 | public static function load_saved_css() { |
| 372 | 372 | $css = get_transient( 'frmpro_css' ); |
@@ -375,142 +375,142 @@ discard block |
||
| 375 | 375 | wp_die(); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - /** |
|
| 379 | - * Check if the Formidable styling should be loaded, |
|
| 380 | - * then enqueue it for the footer |
|
| 381 | - * @since 2.0 |
|
| 382 | - */ |
|
| 383 | - public static function enqueue_style() { |
|
| 384 | - global $frm_vars; |
|
| 385 | - |
|
| 386 | - if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 387 | - // the CSS has already been loaded |
|
| 388 | - return; |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 392 | - if ( $frm_settings->load_style != 'none' ) { |
|
| 393 | - wp_enqueue_style( 'formidable' ); |
|
| 394 | - $frm_vars['css_loaded'] = true; |
|
| 395 | - } |
|
| 396 | - } |
|
| 397 | - |
|
| 398 | - // Get the stylesheets for the form settings page |
|
| 399 | - public static function get_style_opts() { |
|
| 400 | - $frm_style = new FrmStyle(); |
|
| 401 | - $styles = $frm_style->get_all(); |
|
| 402 | - |
|
| 403 | - return $styles; |
|
| 404 | - } |
|
| 405 | - |
|
| 406 | - public static function get_form_style( $form = 'default' ) { |
|
| 407 | - $style = FrmFormsHelper::get_form_style( $form ); |
|
| 408 | - |
|
| 409 | - if ( empty( $style ) || 1 == $style ) { |
|
| 410 | - $style = 'default'; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - $frm_style = new FrmStyle( $style ); |
|
| 414 | - return $frm_style->get_one(); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - /** |
|
| 418 | - * @param string $class |
|
| 419 | - * @param string $style |
|
| 420 | - */ |
|
| 378 | + /** |
|
| 379 | + * Check if the Formidable styling should be loaded, |
|
| 380 | + * then enqueue it for the footer |
|
| 381 | + * @since 2.0 |
|
| 382 | + */ |
|
| 383 | + public static function enqueue_style() { |
|
| 384 | + global $frm_vars; |
|
| 385 | + |
|
| 386 | + if ( isset( $frm_vars['css_loaded'] ) && $frm_vars['css_loaded'] ) { |
|
| 387 | + // the CSS has already been loaded |
|
| 388 | + return; |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 392 | + if ( $frm_settings->load_style != 'none' ) { |
|
| 393 | + wp_enqueue_style( 'formidable' ); |
|
| 394 | + $frm_vars['css_loaded'] = true; |
|
| 395 | + } |
|
| 396 | + } |
|
| 397 | + |
|
| 398 | + // Get the stylesheets for the form settings page |
|
| 399 | + public static function get_style_opts() { |
|
| 400 | + $frm_style = new FrmStyle(); |
|
| 401 | + $styles = $frm_style->get_all(); |
|
| 402 | + |
|
| 403 | + return $styles; |
|
| 404 | + } |
|
| 405 | + |
|
| 406 | + public static function get_form_style( $form = 'default' ) { |
|
| 407 | + $style = FrmFormsHelper::get_form_style( $form ); |
|
| 408 | + |
|
| 409 | + if ( empty( $style ) || 1 == $style ) { |
|
| 410 | + $style = 'default'; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + $frm_style = new FrmStyle( $style ); |
|
| 414 | + return $frm_style->get_one(); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + /** |
|
| 418 | + * @param string $class |
|
| 419 | + * @param string $style |
|
| 420 | + */ |
|
| 421 | 421 | public static function get_form_style_class( $class, $style ) { |
| 422 | - if ( 1 == $style ) { |
|
| 423 | - $style = 'default'; |
|
| 424 | - } |
|
| 422 | + if ( 1 == $style ) { |
|
| 423 | + $style = 'default'; |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | - $frm_style = new FrmStyle($style); |
|
| 427 | - $style = $frm_style->get_one(); |
|
| 426 | + $frm_style = new FrmStyle($style); |
|
| 427 | + $style = $frm_style->get_one(); |
|
| 428 | 428 | |
| 429 | - if ( $style ) { |
|
| 429 | + if ( $style ) { |
|
| 430 | 430 | $class .= ' frm_style_' . $style->post_name; |
| 431 | - } |
|
| 431 | + } |
|
| 432 | 432 | |
| 433 | - return $class; |
|
| 434 | - } |
|
| 433 | + return $class; |
|
| 434 | + } |
|
| 435 | 435 | |
| 436 | - /** |
|
| 437 | - * @param string $val |
|
| 438 | - */ |
|
| 436 | + /** |
|
| 437 | + * @param string $val |
|
| 438 | + */ |
|
| 439 | 439 | public static function get_style_val( $val, $form = 'default' ) { |
| 440 | - $style = self::get_form_style($form); |
|
| 441 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 442 | - return $style->post_content[ $val ]; |
|
| 443 | - } |
|
| 444 | - } |
|
| 440 | + $style = self::get_form_style($form); |
|
| 441 | + if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 442 | + return $style->post_content[ $val ]; |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | 446 | public static function show_entry_styles( $default_styles ) { |
| 447 | - $frm_style = new FrmStyle('default'); |
|
| 448 | - $style = $frm_style->get_one(); |
|
| 449 | - |
|
| 450 | - if ( ! $style ) { |
|
| 451 | - return $default_styles; |
|
| 452 | - } |
|
| 453 | - |
|
| 454 | - foreach ( $default_styles as $name => $val ) { |
|
| 455 | - $setting = $name; |
|
| 456 | - if ( 'border_width' == $name ) { |
|
| 457 | - $setting = 'field_border_width'; |
|
| 458 | - } else if ( 'alt_bg_color' == $name ) { |
|
| 459 | - $setting = 'bg_color_active'; |
|
| 460 | - } |
|
| 461 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 462 | - unset($name, $val); |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - return $default_styles; |
|
| 466 | - } |
|
| 447 | + $frm_style = new FrmStyle('default'); |
|
| 448 | + $style = $frm_style->get_one(); |
|
| 449 | + |
|
| 450 | + if ( ! $style ) { |
|
| 451 | + return $default_styles; |
|
| 452 | + } |
|
| 453 | + |
|
| 454 | + foreach ( $default_styles as $name => $val ) { |
|
| 455 | + $setting = $name; |
|
| 456 | + if ( 'border_width' == $name ) { |
|
| 457 | + $setting = 'field_border_width'; |
|
| 458 | + } else if ( 'alt_bg_color' == $name ) { |
|
| 459 | + $setting = 'bg_color_active'; |
|
| 460 | + } |
|
| 461 | + $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 462 | + unset($name, $val); |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + return $default_styles; |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | 468 | public static function &important_style( $important, $field ) { |
| 469 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
| 470 | - return $important; |
|
| 471 | - } |
|
| 469 | + $important = self::get_style_val('important_style', $field['form_id']); |
|
| 470 | + return $important; |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | - /** |
|
| 474 | - * Fallback for WP < 3.6 |
|
| 475 | - */ |
|
| 476 | - public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 477 | - if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 478 | - return do_accordion_sections( $screen, $context, $object ); |
|
| 479 | - } |
|
| 473 | + /** |
|
| 474 | + * Fallback for WP < 3.6 |
|
| 475 | + */ |
|
| 476 | + public static function do_accordion_sections( $screen, $context, $object ) { |
|
| 477 | + if ( function_exists( 'do_accordion_sections' ) ) { |
|
| 478 | + return do_accordion_sections( $screen, $context, $object ); |
|
| 479 | + } |
|
| 480 | 480 | |
| 481 | - global $wp_meta_boxes; |
|
| 481 | + global $wp_meta_boxes; |
|
| 482 | 482 | |
| 483 | - $screen = 'formidable_page_formidable-styles'; |
|
| 484 | - $screen = convert_to_screen( $screen ); |
|
| 483 | + $screen = 'formidable_page_formidable-styles'; |
|
| 484 | + $screen = convert_to_screen( $screen ); |
|
| 485 | 485 | |
| 486 | - $page = $screen->id; |
|
| 486 | + $page = $screen->id; |
|
| 487 | 487 | |
| 488 | - $hidden = get_hidden_meta_boxes( $screen ); |
|
| 489 | - ?> |
|
| 488 | + $hidden = get_hidden_meta_boxes( $screen ); |
|
| 489 | + ?> |
|
| 490 | 490 | <div id="side-sortables" class="accordion-container"> |
| 491 | 491 | <?php |
| 492 | - $i = 0; |
|
| 493 | - $first_open = false; |
|
| 494 | - do { |
|
| 492 | + $i = 0; |
|
| 493 | + $first_open = false; |
|
| 494 | + do { |
|
| 495 | 495 | if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
| 496 | 496 | break; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 500 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 501 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 502 | - if ( false == $box || ! $box['title'] ) { |
|
| 503 | - continue; |
|
| 499 | + foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
|
| 500 | + if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 501 | + foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 502 | + if ( false == $box || ! $box['title'] ) { |
|
| 503 | + continue; |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $i++; |
|
| 507 | - $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 506 | + $i++; |
|
| 507 | + $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
|
| 508 | 508 | |
| 509 | - if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 510 | - $first_open = true; |
|
| 511 | - } |
|
| 509 | + if ( ! $first_open && empty( $hidden_class ) ) { |
|
| 510 | + $first_open = true; |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | - ?> |
|
| 513 | + ?> |
|
| 514 | 514 | <div class="postbox <?php echo esc_attr( $box['id'] ); ?>"> |
| 515 | 515 | <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'formidable' ) ?>"><br/></div> |
| 516 | 516 | <h3 class='hndle'><span><?php echo esc_html( $box['title'] ); ?></span></h3> |
@@ -521,13 +521,13 @@ discard block |
||
| 521 | 521 | </div><!-- .accordion-section-content --> |
| 522 | 522 | </div><!-- .postbox --> |
| 523 | 523 | <?php |
| 524 | - } |
|
| 525 | - } |
|
| 526 | - } |
|
| 527 | - } while ( 0 ); |
|
| 528 | - ?> |
|
| 524 | + } |
|
| 525 | + } |
|
| 526 | + } |
|
| 527 | + } while ( 0 ); |
|
| 528 | + ?> |
|
| 529 | 529 | </div><!-- .accordion-container --> |
| 530 | 530 | <?php |
| 531 | - return $i; |
|
| 532 | - } |
|
| 531 | + return $i; |
|
| 532 | + } |
|
| 533 | 533 | } |
@@ -41,23 +41,23 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public static function menu() { |
| 44 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Styles', 'formidable' ), __( 'Styles', 'formidable' ), 'frm_change_settings', 'formidable-styles', 'FrmStylesController::route' ); |
|
| 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 | - if ( ! FrmAppHelper::is_admin_page('formidable-styles') ) { |
|
| 48 | + if ( ! FrmAppHelper::is_admin_page( 'formidable-styles' ) ) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | self::load_pro_hooks(); |
| 53 | - wp_enqueue_script('jquery-ui-datepicker'); |
|
| 53 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 54 | 54 | |
| 55 | 55 | $version = FrmAppHelper::plugin_version(); |
| 56 | 56 | wp_enqueue_script( 'jquery-frm-themepicker', FrmAppHelper::plugin_url() . '/js/jquery/jquery-ui-themepicker.js', array( 'jquery' ), $version ); |
| 57 | 57 | |
| 58 | - wp_enqueue_style( 'frm-custom-theme', admin_url('admin-ajax.php?action=frmpro_css' ) ); |
|
| 58 | + wp_enqueue_style( 'frm-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_css' ) ); |
|
| 59 | 59 | |
| 60 | - $style = apply_filters('frm_style_head', false); |
|
| 60 | + $style = apply_filters( 'frm_style_head', false ); |
|
| 61 | 61 | if ( $style ) { |
| 62 | 62 | wp_enqueue_style( 'frm-single-custom-theme', admin_url( 'admin-ajax.php?action=frmpro_load_css&flat=1' ) . '&' . http_build_query( $style->post_content ) ); |
| 63 | 63 | } |
@@ -143,17 +143,17 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public static function new_style( $return = '' ) { |
| 146 | - self::load_styler('default'); |
|
| 146 | + self::load_styler( 'default' ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public static function duplicate() { |
| 150 | - self::load_styler('default'); |
|
| 150 | + self::load_styler( 'default' ); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public static function edit( $style_id = false, $message = '' ) { |
| 154 | 154 | if ( ! $style_id ) { |
| 155 | 155 | $style_id = FrmAppHelper::get_param( 'id', '', 'get', 'absint' ); |
| 156 | - if ( empty($style_id) ) { |
|
| 156 | + if ( empty( $style_id ) ) { |
|
| 157 | 157 | $style_id = 'default'; |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | if ( 'default' == $style_id ) { |
| 162 | 162 | $style = 'default'; |
| 163 | 163 | } else { |
| 164 | - $frm_style = new FrmStyle($style_id); |
|
| 164 | + $frm_style = new FrmStyle( $style_id ); |
|
| 165 | 165 | $style = $frm_style->get_one(); |
| 166 | 166 | $style = $style->ID; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - self::load_styler($style, $message); |
|
| 169 | + self::load_styler( $style, $message ); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public static function save() { |
@@ -176,17 +176,17 @@ discard block |
||
| 176 | 176 | $style_nonce = FrmAppHelper::get_post_param( 'frm_style', '', 'sanitize_text_field' ); |
| 177 | 177 | |
| 178 | 178 | if ( $post_id !== false && wp_verify_nonce( $style_nonce, 'frm_style_nonce' ) ) { |
| 179 | - $id = $frm_style->update($post_id); |
|
| 180 | - if ( empty($post_id) && ! empty($id) ) { |
|
| 179 | + $id = $frm_style->update( $post_id ); |
|
| 180 | + if ( empty( $post_id ) && ! empty( $id ) ) { |
|
| 181 | 181 | // set the post id to the new style so it will be loaded for editing |
| 182 | - $post_id = reset($id); |
|
| 182 | + $post_id = reset( $id ); |
|
| 183 | 183 | } |
| 184 | 184 | // include the CSS that includes this style |
| 185 | 185 | echo '<link href="' . esc_url( admin_url( 'admin-ajax.php?action=frmpro_css' ) ) . '" type="text/css" rel="Stylesheet" class="frm-custom-theme" />'; |
| 186 | 186 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - return self::edit($post_id, $message); |
|
| 189 | + return self::edit( $post_id, $message ); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public static function load_styler( $style, $message = '' ) { |
@@ -195,10 +195,10 @@ discard block |
||
| 195 | 195 | $frm_style = new FrmStyle(); |
| 196 | 196 | $styles = $frm_style->get_all(); |
| 197 | 197 | |
| 198 | - if ( is_numeric($style) ) { |
|
| 199 | - $style = $styles[ $style ]; |
|
| 198 | + if ( is_numeric( $style ) ) { |
|
| 199 | + $style = $styles[$style]; |
|
| 200 | 200 | } else if ( 'default' == $style ) { |
| 201 | - $style = $frm_style->get_default_style($styles); |
|
| 201 | + $style = $frm_style->get_default_style( $styles ); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | self::add_meta_boxes(); |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | private static function manage( $message = '', $forms = array() ) { |
| 214 | 214 | $frm_style = new FrmStyle(); |
| 215 | 215 | $styles = $frm_style->get_all(); |
| 216 | - $default_style = $frm_style->get_default_style($styles); |
|
| 216 | + $default_style = $frm_style->get_default_style( $styles ); |
|
| 217 | 217 | |
| 218 | - if ( empty($forms) ) { |
|
| 218 | + if ( empty( $forms ) ) { |
|
| 219 | 219 | $forms = FrmForm::get_published_forms(); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -232,26 +232,26 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $forms = FrmForm::get_published_forms(); |
| 234 | 234 | foreach ( $forms as $form ) { |
| 235 | - if ( $_POST['style'][ $form->id ] == $_POST['prev_style'][ $form->id ] ) { |
|
| 235 | + if ( $_POST['style'][$form->id] == $_POST['prev_style'][$form->id] ) { |
|
| 236 | 236 | continue; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $form->options['custom_style'] = $_POST['style'][ $form->id ]; |
|
| 239 | + $form->options['custom_style'] = $_POST['style'][$form->id]; |
|
| 240 | 240 | |
| 241 | 241 | $wpdb->update( $wpdb->prefix . 'frm_forms', array( 'options' => maybe_serialize( $form->options ) ), array( 'id' => $form->id ) ); |
| 242 | - unset($form); |
|
| 242 | + unset( $form ); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | $message = __( 'Your form styles have been saved.', 'formidable' ); |
| 246 | - return self::manage($message, $forms); |
|
| 246 | + return self::manage( $message, $forms ); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | public static function custom_css( $message = '', $style = null ) { |
| 250 | - wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css'); |
|
| 251 | - wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7'); |
|
| 250 | + wp_enqueue_style( 'codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css' ); |
|
| 251 | + wp_enqueue_script( 'codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7' ); |
|
| 252 | 252 | wp_enqueue_script( 'codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array( 'codemirror' ), '4.7' ); |
| 253 | 253 | |
| 254 | - if ( ! isset($style) ) { |
|
| 254 | + if ( ! isset( $style ) ) { |
|
| 255 | 255 | $frm_style = new FrmStyle(); |
| 256 | 256 | $style = $frm_style->get_default_style(); |
| 257 | 257 | } |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | $post_id = FrmAppHelper::get_post_param( 'ID', false, 'sanitize_text_field' ); |
| 267 | 267 | $nonce = FrmAppHelper::get_post_param( 'frm_custom_css', '', 'sanitize_text_field' ); |
| 268 | 268 | if ( wp_verify_nonce( $nonce, 'frm_custom_css_nonce' ) ) { |
| 269 | - $frm_style->update($post_id); |
|
| 269 | + $frm_style->update( $post_id ); |
|
| 270 | 270 | $message = __( 'Your styling settings have been saved.', 'formidable' ); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - return self::custom_css($message); |
|
| 273 | + return self::custom_css( $message ); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | public static function route() { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | public static function reset_styling() { |
| 302 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 302 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 303 | 303 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 304 | 304 | |
| 305 | 305 | $frm_style = new FrmStyle(); |
@@ -317,8 +317,8 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | // remove the # from the colors |
| 319 | 319 | foreach ( $_GET['frm_style_setting']['post_content'] as $k => $v ) { |
| 320 | - if ( ! is_array($v) && strpos($v, '#') === 0 ) { |
|
| 321 | - $_GET['frm_style_setting']['post_content'][ $k ] = str_replace( '#', '', $v ); |
|
| 320 | + if ( ! is_array( $v ) && strpos( $v, '#' ) === 0 ) { |
|
| 321 | + $_GET['frm_style_setting']['post_content'][$k] = str_replace( '#', '', $v ); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -348,18 +348,18 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | foreach ( $meta_boxes as $nicename => $name ) { |
| 350 | 350 | add_meta_box( $nicename . '-style', $name, 'FrmStylesController::include_style_section', self::$screen, 'side', 'default', $nicename ); |
| 351 | - unset($nicename, $name); |
|
| 351 | + unset( $nicename, $name ); |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | public static function include_style_section( $atts, $sec ) { |
| 356 | - extract($atts); |
|
| 356 | + extract( $atts ); |
|
| 357 | 357 | $current_tab = FrmAppHelper::simple_get( 'page-tab', 'sanitize_title', 'default' ); |
| 358 | 358 | include( FrmAppHelper::plugin_path() . '/classes/views/styles/_' . $sec['args'] . '.php' ); |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | public static function load_css() { |
| 362 | - header('Content-type: text/css'); |
|
| 362 | + header( 'Content-type: text/css' ); |
|
| 363 | 363 | |
| 364 | 364 | $frm_style = new FrmStyle(); |
| 365 | 365 | $defaults = $frm_style->get_defaults(); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $style = 'default'; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - $frm_style = new FrmStyle($style); |
|
| 426 | + $frm_style = new FrmStyle( $style ); |
|
| 427 | 427 | $style = $frm_style->get_one(); |
| 428 | 428 | |
| 429 | 429 | if ( $style ) { |
@@ -437,14 +437,14 @@ discard block |
||
| 437 | 437 | * @param string $val |
| 438 | 438 | */ |
| 439 | 439 | public static function get_style_val( $val, $form = 'default' ) { |
| 440 | - $style = self::get_form_style($form); |
|
| 441 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
| 442 | - return $style->post_content[ $val ]; |
|
| 440 | + $style = self::get_form_style( $form ); |
|
| 441 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
| 442 | + return $style->post_content[$val]; |
|
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | public static function show_entry_styles( $default_styles ) { |
| 447 | - $frm_style = new FrmStyle('default'); |
|
| 447 | + $frm_style = new FrmStyle( 'default' ); |
|
| 448 | 448 | $style = $frm_style->get_one(); |
| 449 | 449 | |
| 450 | 450 | if ( ! $style ) { |
@@ -458,15 +458,15 @@ discard block |
||
| 458 | 458 | } else if ( 'alt_bg_color' == $name ) { |
| 459 | 459 | $setting = 'bg_color_active'; |
| 460 | 460 | } |
| 461 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
| 462 | - unset($name, $val); |
|
| 461 | + $default_styles[$name] = $style->post_content[$setting]; |
|
| 462 | + unset( $name, $val ); |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | return $default_styles; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | public static function &important_style( $important, $field ) { |
| 469 | - $important = self::get_style_val('important_style', $field['form_id']); |
|
| 469 | + $important = self::get_style_val( 'important_style', $field['form_id'] ); |
|
| 470 | 470 | return $important; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -492,18 +492,18 @@ discard block |
||
| 492 | 492 | $i = 0; |
| 493 | 493 | $first_open = false; |
| 494 | 494 | do { |
| 495 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[ $page ] ) || ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
| 495 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
| 496 | 496 | break; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
| 500 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
| 501 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
| 500 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
| 501 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
| 502 | 502 | if ( false == $box || ! $box['title'] ) { |
| 503 | 503 | continue; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $i++; |
|
| 506 | + $i ++; |
|
| 507 | 507 | $hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : ''; |
| 508 | 508 | |
| 509 | 509 | if ( ! $first_open && empty( $hidden_class ) ) { |
@@ -7,10 +7,10 @@ |
||
| 7 | 7 | continue; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | - if ( isset( $plugin_names[ $addon['info']['slug'] ] ) ) { |
|
| 11 | - $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[ $addon['info']['slug'] ] ); |
|
| 10 | + if ( isset( $plugin_names[$addon['info']['slug']] ) ) { |
|
| 11 | + $installed = is_dir( WP_PLUGIN_DIR . '/' . $plugin_names[$addon['info']['slug']] ); |
|
| 12 | 12 | } else { |
| 13 | - $installed = isset( $installed_addons[ $addon['info']['slug'] ] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
| 13 | + $installed = isset( $installed_addons[$addon['info']['slug']] ) || is_dir( WP_PLUGIN_DIR . '/formidable-' . $addon['info']['slug'] ); |
|
| 14 | 14 | } |
| 15 | 15 | $has_thumbnail = ! empty( $addon['info']['thumbnail'] ); |
| 16 | 16 | if ( $addon['info']['slug'] == 'formidable-pro' ) { |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | <tr> |
| 7 | 7 | <th></th> |
| 8 | 8 | <?php foreach ( $pro['pricing'] as $name => $price ) { |
| 9 | - $price_id++; |
|
| 9 | + $price_id ++; |
|
| 10 | 10 | if ( $name == 'smallbusiness' ) { |
| 11 | 11 | $name = 'Small Business'; |
| 12 | 12 | } ?> |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | <tr> |
| 51 | 51 | <th>Included AddOns</th> |
| 52 | 52 | <td>None</td> |
| 53 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Basic Addons</a></td> |
|
| 54 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Advanced Addons</a></td> |
|
| 55 | - <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com/pricing/#addon-lists') ) ?>" target="_blank">Enterprise Addons</a></td> |
|
| 53 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Basic Addons</a></td> |
|
| 54 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Advanced Addons</a></td> |
|
| 55 | + <td><a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com/pricing/#addon-lists' ) ) ?>" target="_blank">Enterprise Addons</a></td> |
|
| 56 | 56 | </tr> |
| 57 | 57 | </tbody> |
| 58 | 58 | </table> |
@@ -275,7 +275,7 @@ |
||
| 275 | 275 | return $message; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function manually_queue_update() { |
|
| 279 | - set_site_transient( 'update_plugins', null ); |
|
| 280 | - } |
|
| 278 | + public function manually_queue_update() { |
|
| 279 | + set_site_transient( 'update_plugins', null ); |
|
| 280 | + } |
|
| 281 | 281 | } |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function insert_installed_addon( $plugins ) { |
| 41 | - $plugins[ $this->plugin_slug ] = $this; |
|
| 41 | + $plugins[$this->plugin_slug] = $this; |
|
| 42 | 42 | return $plugins; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function get_addon( $plugin_slug ) { |
| 46 | 46 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
| 47 | 47 | $plugin = false; |
| 48 | - if ( isset( $plugins[ $plugin_slug ] ) ) { |
|
| 49 | - $plugin = $plugins[ $plugin_slug ]; |
|
| 48 | + if ( isset( $plugins[$plugin_slug] ) ) { |
|
| 49 | + $plugin = $plugins[$plugin_slug]; |
|
| 50 | 50 | } |
| 51 | 51 | return $plugin; |
| 52 | 52 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | public function show_license_message( $file, $plugin ) { |
| 99 | 99 | $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
| 100 | 100 | echo '<tr class="plugin-update-tr active"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">'; |
| 101 | - echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url('admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
| 101 | + echo sprintf( __( 'Your %1$s license key is missing. Please add it on the %2$slicenses page%3$s.', 'formidable' ), $this->plugin_name, '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings&t=licenses_settings' ) ) . '">', '</a>' ); |
|
| 102 | 102 | $id = sanitize_title( $plugin['Name'] ); |
| 103 | 103 | echo '<script type="text/javascript">var d = document.getElementById("' . esc_attr( $id ) . '");if ( d !== null ){ d.className = d.className + " update"; }</script>'; |
| 104 | 104 | echo '</div></td></tr>'; |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | if ( $this->is_current_version( $transient ) ) { |
| 113 | 113 | //make sure it doesn't show there is an update if plugin is up-to-date |
| 114 | - if ( isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 115 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 114 | + if ( isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 115 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 116 | 116 | } |
| 117 | - } else if ( isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) ) { |
|
| 117 | + } else if ( isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) ) { |
|
| 118 | 118 | $cache_key = 'edd_plugin_' . md5( sanitize_key( $this->license . $this->version ) . '_get_version' ); |
| 119 | 119 | $version_info = get_transient( $cache_key ); |
| 120 | 120 | if ( $version_info !== false && version_compare( $version_info->new_version, $this->version, '>' ) ) { |
| 121 | - $transient->response[ $this->plugin_folder ] = $version_info; |
|
| 121 | + $transient->response[$this->plugin_folder] = $version_info; |
|
| 122 | 122 | } else { |
| 123 | 123 | delete_transient( $cache_key ); |
| 124 | 124 | if ( ! $this->has_been_cleared() ) { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $this->manually_queue_update(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - unset( $transient->response[ $this->plugin_folder ] ); |
|
| 130 | + unset( $transient->response[$this->plugin_folder] ); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | private function is_current_version( $transient ) { |
| 138 | - if ( empty( $transient->checked ) || ! isset( $transient->checked[ $this->plugin_folder ] ) ) { |
|
| 138 | + if ( empty( $transient->checked ) || ! isset( $transient->checked[$this->plugin_folder] ) ) { |
|
| 139 | 139 | return false; |
| 140 | 140 | } |
| 141 | 141 | |
@@ -144,20 +144,20 @@ discard block |
||
| 144 | 144 | return true; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - return isset( $transient->response ) && isset( $transient->response[ $this->plugin_folder ] ) && $transient->checked[ $this->plugin_folder ] == $transient->response[ $this->plugin_folder ]->new_version; |
|
| 147 | + return isset( $transient->response ) && isset( $transient->response[$this->plugin_folder] ) && $transient->checked[$this->plugin_folder] == $transient->response[$this->plugin_folder]->new_version; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | private function has_been_cleared() { |
| 151 | 151 | $last_cleared = get_option( 'frm_last_cleared' ); |
| 152 | - return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime('-5 minutes') ) ); |
|
| 152 | + return ( $last_cleared && $last_cleared > date( 'Y-m-d H:i:s', strtotime( '-5 minutes' ) ) ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | private function cleared_plugins() { |
| 156 | - update_option( 'frm_last_cleared', date('Y-m-d H:i:s') ); |
|
| 156 | + update_option( 'frm_last_cleared', date( 'Y-m-d H:i:s' ) ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public static function activate() { |
| 160 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 160 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 161 | 161 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 162 | 162 | |
| 163 | 163 | if ( ! isset( $_POST['license'] ) || empty( $_POST['license'] ) ) { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public static function deactivate() { |
| 208 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 208 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 209 | 209 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 210 | 210 | |
| 211 | 211 | $plugin_slug = sanitize_text_field( $_POST['plugin'] ); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $message = __( 'Your License Key was invalid', 'formidable' ); |
| 257 | 257 | if ( is_wp_error( $resp ) ) { |
| 258 | - $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>'); |
|
| 258 | + $message = sprintf( __( 'You had an error communicating with Formidable Pro\'s API. %1$sClick here%2$s for more information.', 'formidable' ), '<a href="http://formidablepro.com/knowledgebase/why-cant-i-activate-formidable-pro/" target="_blank">', '</a>' ); |
|
| 259 | 259 | if ( is_wp_error( $resp ) ) { |
| 260 | 260 | $message .= ' ' . $resp->get_error_message(); |
| 261 | 261 | } |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_size') ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_size' ) ) ?>" id="frm_form_desc_size" value="<?php echo esc_attr( $style->post_content['form_desc_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_color') ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_color' ) ) ?>" id="frm_form_desc_color" class="hex" value="<?php echo esc_attr( $style->post_content['form_desc_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_top') ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_top' ) ) ?>" id="frm_form_desc_margin_top" value="<?php echo esc_attr( $style->post_content['form_desc_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('form_desc_margin_bottom') ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'form_desc_margin_bottom' ) ) ?>" id="frm_form_desc_margin_bottom" value="<?php echo esc_attr( $style->post_content['form_desc_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
@@ -1,17 +1,17 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_size') ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_size' ) ) ?>" id="frm_title_size" value="<?php echo esc_attr( $style->post_content['title_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-half frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_color') ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_color' ) ) ?>" id="frm_title_color" class="hex" value="<?php echo esc_attr( $style->post_content['title_color'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | <div class="field-group clearfix frm-half"> |
| 11 | 11 | <label><?php _e( 'Margin Top', 'formidable' ) ?></label> |
| 12 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_top') ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 12 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_top' ) ) ?>" id="frm_title_margin_top" value="<?php echo esc_attr( $style->post_content['title_margin_top'] ) ?>" size="4" /> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div class="field-group clearfix frm-half"> |
| 15 | 15 | <label><?php _e( 'Margin Bottom', 'formidable' ) ?></label> |
| 16 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('title_margin_bottom') ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 16 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'title_margin_bottom' ) ) ?>" id="frm_title_margin_bottom" value="<?php echo esc_attr( $style->post_content['title_margin_bottom'] ) ?>" size="4" /> |
|
| 17 | 17 | </div> |
@@ -181,13 +181,13 @@ |
||
| 181 | 181 | ), |
| 182 | 182 | ); |
| 183 | 183 | $random = rand( 0, count( $tips ) - 1 ); |
| 184 | - $tip = $tips[ $random ]; |
|
| 184 | + $tip = $tips[$random]; |
|
| 185 | 185 | $tip['num'] = $random; |
| 186 | 186 | return $tip; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | public static function get_random_tip( $tips ) { |
| 190 | 190 | $random = rand( 0, count( $tips ) - 1 ); |
| 191 | - return $tips[ $random ]; |
|
| 191 | + return $tips[$random]; |
|
| 192 | 192 | } |
| 193 | 193 | } |
@@ -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', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
| 13 | - } |
|
| 13 | + } |
|
| 14 | 14 | |
| 15 | 15 | private static function get_menu_position() { |
| 16 | 16 | $count = count( get_post_types( array( 'show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) ); |
@@ -19,39 +19,39 @@ discard block |
||
| 19 | 19 | return $pos; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - public static function load_wp_admin_style() { |
|
| 23 | - FrmAppHelper::load_font_style(); |
|
| 24 | - } |
|
| 22 | + public static function load_wp_admin_style() { |
|
| 23 | + FrmAppHelper::load_font_style(); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | public static function get_form_nav( $form, $show_nav = false, $title = 'show' ) { |
| 27 | - global $pagenow, $frm_vars; |
|
| 27 | + global $pagenow, $frm_vars; |
|
| 28 | 28 | |
| 29 | 29 | $show_nav = FrmAppHelper::get_param( 'show_nav', $show_nav, 'get', 'absint' ); |
| 30 | - if ( empty( $show_nav ) ) { |
|
| 31 | - return; |
|
| 32 | - } |
|
| 30 | + if ( empty( $show_nav ) ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | 34 | $current_page = isset( $_GET['page'] ) ? FrmAppHelper::simple_get( 'page', 'sanitize_title' ) : FrmAppHelper::simple_get( 'post_type', 'sanitize_title', 'None' ); |
| 35 | 35 | if ( $pagenow == 'post.php' || $pagenow == 'post-new.php' ) { |
| 36 | 36 | $current_page = 'frm_display'; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( $form ) { |
|
| 39 | + if ( $form ) { |
|
| 40 | 40 | FrmForm::maybe_get_form( $form ); |
| 41 | 41 | |
| 42 | - if ( is_object( $form ) ) { |
|
| 43 | - $id = $form->id; |
|
| 44 | - } |
|
| 45 | - } |
|
| 42 | + if ( is_object( $form ) ) { |
|
| 43 | + $id = $form->id; |
|
| 44 | + } |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - if ( ! isset( $id ) ) { |
|
| 48 | - $form = $id = false; |
|
| 49 | - } |
|
| 47 | + if ( ! isset( $id ) ) { |
|
| 48 | + $form = $id = false; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | $nav_items = self::get_form_nav_items( $id ); |
| 52 | 52 | |
| 53 | - include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
| 54 | - } |
|
| 53 | + include( FrmAppHelper::plugin_path() . '/classes/views/shared/form-nav.php' ); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | private static function get_form_nav_items( $id ) { |
| 57 | 57 | $nav_items = array( |
@@ -82,28 +82,28 @@ discard block |
||
| 82 | 82 | return $nav_items; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - // Adds a settings link to the plugins page |
|
| 86 | - public static function settings_link( $links ) { |
|
| 85 | + // Adds a settings link to the plugins page |
|
| 86 | + public static function settings_link( $links ) { |
|
| 87 | 87 | $settings = '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-settings' ) ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
| 88 | - array_unshift( $links, $settings ); |
|
| 88 | + array_unshift( $links, $settings ); |
|
| 89 | 89 | |
| 90 | - return $links; |
|
| 91 | - } |
|
| 90 | + return $links; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - public static function pro_get_started_headline() { |
|
| 93 | + public static function pro_get_started_headline() { |
|
| 94 | 94 | self::maybe_show_upgrade_bar(); |
| 95 | 95 | |
| 96 | - // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 97 | - if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 98 | - return; |
|
| 99 | - } |
|
| 96 | + // Don't display this error as we're upgrading the thing, or if the user shouldn't see the message |
|
| 97 | + if ( 'upgrade-plugin' == FrmAppHelper::simple_get( 'action', 'sanitize_title' ) || ! current_user_can( 'update_plugins' ) ) { |
|
| 98 | + return; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | 101 | if ( get_site_option( 'frmpro-authorized' ) && ! file_exists( FrmAppHelper::plugin_path() . '/pro/formidable-pro.php' ) ) { |
| 102 | - FrmAppHelper::load_admin_wide_js(); |
|
| 102 | + FrmAppHelper::load_admin_wide_js(); |
|
| 103 | 103 | |
| 104 | - // user is authorized, but running free version |
|
| 105 | - $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
| 106 | - ?> |
|
| 104 | + // user is authorized, but running free version |
|
| 105 | + $inst_install_url = 'https://formidablepro.com/knowledgebase/install-formidable-forms/'; |
|
| 106 | + ?> |
|
| 107 | 107 | <div class="error" class="frm_previous_install"> |
| 108 | 108 | <?php |
| 109 | 109 | echo wp_kses_post( apply_filters( 'frm_pro_update_msg', |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | ) ); ?> |
| 116 | 116 | </div> |
| 117 | 117 | <?php |
| 118 | - } |
|
| 119 | - } |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | private static function maybe_show_upgrade_bar() { |
| 122 | 122 | $page = FrmAppHelper::simple_get( 'page', 'sanitize_title' ); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - public static function admin_js() { |
|
| 219 | + public static function admin_js() { |
|
| 220 | 220 | $version = FrmAppHelper::plugin_version(); |
| 221 | 221 | FrmAppHelper::load_admin_wide_js( false ); |
| 222 | 222 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | 'bootstrap_tooltip', 'bootstrap-multiselect', |
| 228 | 228 | ), $version, true ); |
| 229 | 229 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 230 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 230 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 231 | 231 | |
| 232 | 232 | // load multselect js |
| 233 | 233 | wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true ); |
@@ -238,79 +238,79 @@ discard block |
||
| 238 | 238 | global $pagenow; |
| 239 | 239 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 240 | 240 | |
| 241 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 242 | - wp_enqueue_style( 'widgets' ); |
|
| 243 | - wp_enqueue_script( 'formidable' ); |
|
| 244 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 241 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 242 | + wp_enqueue_style( 'widgets' ); |
|
| 243 | + wp_enqueue_script( 'formidable' ); |
|
| 244 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 245 | 245 | FrmAppHelper::localize_script( 'admin' ); |
| 246 | 246 | |
| 247 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 247 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 248 | 248 | FrmStylesController::enqueue_css( 'admin' ); |
| 249 | - add_thickbox(); |
|
| 249 | + add_thickbox(); |
|
| 250 | 250 | |
| 251 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 251 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 252 | 252 | |
| 253 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 254 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 255 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 253 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 254 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 255 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 256 | 256 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 257 | 257 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 258 | - if ( ! $post ) { |
|
| 259 | - return; |
|
| 260 | - } |
|
| 261 | - $post_type = $post->post_type; |
|
| 262 | - } else { |
|
| 263 | - return; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - if ( $post_type == 'frm_display' ) { |
|
| 267 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 268 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 269 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 258 | + if ( ! $post ) { |
|
| 259 | + return; |
|
| 260 | + } |
|
| 261 | + $post_type = $post->post_type; |
|
| 262 | + } else { |
|
| 263 | + return; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + if ( $post_type == 'frm_display' ) { |
|
| 267 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 268 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 269 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 270 | 270 | FrmAppHelper::localize_script( 'admin' ); |
| 271 | - } |
|
| 272 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 273 | - FrmAppHelper::load_admin_wide_js(); |
|
| 274 | - } |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - public static function wp_admin_body_class( $classes ) { |
|
| 278 | - global $wp_version; |
|
| 279 | - //we need this class everywhere in the admin for the menu |
|
| 280 | - if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
| 281 | - $classes .= ' frm_38_trigger'; |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - return $classes; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - public static function load_lang() { |
|
| 288 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 289 | - } |
|
| 290 | - |
|
| 291 | - /** |
|
| 292 | - * Filter shortcodes in text widgets |
|
| 293 | - */ |
|
| 294 | - public static function widget_text_filter( $content ) { |
|
| 295 | - $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
| 296 | - return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - public static function widget_text_filter_callback( $matches ) { |
|
| 300 | - _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
| 301 | - return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - public static function front_head() { |
|
| 305 | - if ( is_multisite() ) { |
|
| 306 | - $old_db_version = get_option( 'frm_db_version' ); |
|
| 307 | - $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
| 308 | - if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
| 309 | - ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
| 310 | - self::install( $old_db_version ); |
|
| 311 | - } |
|
| 312 | - } |
|
| 313 | - } |
|
| 271 | + } |
|
| 272 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 273 | + FrmAppHelper::load_admin_wide_js(); |
|
| 274 | + } |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + public static function wp_admin_body_class( $classes ) { |
|
| 278 | + global $wp_version; |
|
| 279 | + //we need this class everywhere in the admin for the menu |
|
| 280 | + if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
| 281 | + $classes .= ' frm_38_trigger'; |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + return $classes; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + public static function load_lang() { |
|
| 288 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 289 | + } |
|
| 290 | + |
|
| 291 | + /** |
|
| 292 | + * Filter shortcodes in text widgets |
|
| 293 | + */ |
|
| 294 | + public static function widget_text_filter( $content ) { |
|
| 295 | + $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
| 296 | + return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + public static function widget_text_filter_callback( $matches ) { |
|
| 300 | + _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
| 301 | + return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + public static function front_head() { |
|
| 305 | + if ( is_multisite() ) { |
|
| 306 | + $old_db_version = get_option( 'frm_db_version' ); |
|
| 307 | + $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
| 308 | + if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
| 309 | + ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
| 310 | + self::install( $old_db_version ); |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | 315 | public static function localize_script( $location ) { |
| 316 | 316 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' ); |
@@ -370,20 +370,20 @@ discard block |
||
| 370 | 370 | wp_die(); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - public static function activation_install() { |
|
| 374 | - FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 375 | - FrmFormActionsController::actions_init(); |
|
| 376 | - self::install(); |
|
| 377 | - } |
|
| 373 | + public static function activation_install() { |
|
| 374 | + FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 375 | + FrmFormActionsController::actions_init(); |
|
| 376 | + self::install(); |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | - public static function install( $old_db_version = false ) { |
|
| 380 | - $frmdb = new FrmDb(); |
|
| 381 | - $frmdb->upgrade( $old_db_version ); |
|
| 382 | - } |
|
| 379 | + public static function install( $old_db_version = false ) { |
|
| 380 | + $frmdb = new FrmDb(); |
|
| 381 | + $frmdb->upgrade( $old_db_version ); |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | - public static function uninstall() { |
|
| 384 | + public static function uninstall() { |
|
| 385 | 385 | FrmAppHelper::permission_check('administrator'); |
| 386 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 386 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 387 | 387 | |
| 388 | 388 | $frmdb = new FrmDb(); |
| 389 | 389 | $frmdb->uninstall(); |
@@ -392,48 +392,48 @@ discard block |
||
| 392 | 392 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 393 | 393 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 394 | 394 | |
| 395 | - wp_die(); |
|
| 396 | - } |
|
| 395 | + wp_die(); |
|
| 396 | + } |
|
| 397 | 397 | |
| 398 | - public static function drop_tables( $tables ) { |
|
| 399 | - global $wpdb; |
|
| 400 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 401 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 402 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 403 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 404 | - return $tables; |
|
| 405 | - } |
|
| 398 | + public static function drop_tables( $tables ) { |
|
| 399 | + global $wpdb; |
|
| 400 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 401 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 402 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 403 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 404 | + return $tables; |
|
| 405 | + } |
|
| 406 | 406 | |
| 407 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 408 | - public static function page_route( $content ) { |
|
| 409 | - global $post; |
|
| 407 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 408 | + public static function page_route( $content ) { |
|
| 409 | + global $post; |
|
| 410 | 410 | |
| 411 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 412 | - if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
| 413 | - $content = FrmFormsController::page_preview(); |
|
| 414 | - } |
|
| 411 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 412 | + if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
| 413 | + $content = FrmFormsController::page_preview(); |
|
| 414 | + } |
|
| 415 | 415 | |
| 416 | - return $content; |
|
| 417 | - } |
|
| 416 | + return $content; |
|
| 417 | + } |
|
| 418 | 418 | |
| 419 | - public static function deauthorize() { |
|
| 419 | + public static function deauthorize() { |
|
| 420 | 420 | FrmAppHelper::permission_check('frm_change_settings'); |
| 421 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 422 | - |
|
| 423 | - delete_option( 'frmpro-credentials' ); |
|
| 424 | - delete_option( 'frmpro-authorized' ); |
|
| 425 | - delete_site_option( 'frmpro-credentials' ); |
|
| 426 | - delete_site_option( 'frmpro-authorized' ); |
|
| 427 | - wp_die(); |
|
| 428 | - } |
|
| 429 | - |
|
| 430 | - public static function get_form_shortcode( $atts ) { |
|
| 431 | - _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 432 | - return FrmFormsController::get_form_shortcode( $atts ); |
|
| 433 | - } |
|
| 434 | - |
|
| 435 | - public static function get_postbox_class() { |
|
| 436 | - _deprecated_function( __FUNCTION__, '2.0' ); |
|
| 437 | - return 'postbox-container'; |
|
| 438 | - } |
|
| 421 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 422 | + |
|
| 423 | + delete_option( 'frmpro-credentials' ); |
|
| 424 | + delete_option( 'frmpro-authorized' ); |
|
| 425 | + delete_site_option( 'frmpro-credentials' ); |
|
| 426 | + delete_site_option( 'frmpro-authorized' ); |
|
| 427 | + wp_die(); |
|
| 428 | + } |
|
| 429 | + |
|
| 430 | + public static function get_form_shortcode( $atts ) { |
|
| 431 | + _deprecated_function( __FUNCTION__, '1.07.05', 'FrmFormsController::get_form_shortcode()' ); |
|
| 432 | + return FrmFormsController::get_form_shortcode( $atts ); |
|
| 433 | + } |
|
| 434 | + |
|
| 435 | + public static function get_postbox_class() { |
|
| 436 | + _deprecated_function( __FUNCTION__, '2.0' ); |
|
| 437 | + return 'postbox-container'; |
|
| 438 | + } |
|
| 439 | 439 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | <div class="update-nag frm-update-to-pro"> |
| 136 | 136 | <?php echo FrmAppHelper::kses( $tip['tip'] ) ?> |
| 137 | 137 | <span><?php echo FrmAppHelper::kses( $tip['call'] ) ?></span> |
| 138 | - <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com?banner=1&tip=' . absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a> |
|
| 138 | + <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com?banner=1&tip=' . absint( $tip['num'] ) ) ) ?>" class="button">Upgrade to Pro</a> |
|
| 139 | 139 | </div> |
| 140 | 140 | <?php |
| 141 | 141 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | public static function uninstall() { |
| 388 | - FrmAppHelper::permission_check('administrator'); |
|
| 388 | + FrmAppHelper::permission_check( 'administrator' ); |
|
| 389 | 389 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 390 | 390 | |
| 391 | 391 | $frmdb = new FrmDb(); |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | public static function deauthorize() { |
| 423 | - FrmAppHelper::permission_check('frm_change_settings'); |
|
| 423 | + FrmAppHelper::permission_check( 'frm_change_settings' ); |
|
| 424 | 424 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 425 | 425 | |
| 426 | 426 | delete_option( 'frmpro-credentials' ); |