@@ -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 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 12 | - add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
| 13 | - } |
|
| 11 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 12 | + add_menu_page( 'Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', self::get_menu_position() ); |
|
| 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' ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public static function admin_js() { |
|
| 218 | + public static function admin_js() { |
|
| 219 | 219 | $version = FrmAppHelper::plugin_version(); |
| 220 | 220 | FrmAppHelper::load_admin_wide_js( false ); |
| 221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | 'bootstrap_tooltip', 'bootstrap-multiselect', |
| 227 | 227 | ), $version, true ); |
| 228 | 228 | wp_register_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version ); |
| 229 | - wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 229 | + wp_register_script( 'bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array( 'jquery' ), '3.3.4' ); |
|
| 230 | 230 | |
| 231 | 231 | // load multselect js |
| 232 | 232 | wp_register_script( 'bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array( 'jquery', 'bootstrap_tooltip' ), '0.9.8', true ); |
@@ -237,78 +237,78 @@ discard block |
||
| 237 | 237 | global $pagenow; |
| 238 | 238 | if ( strpos( $page, 'formidable' ) === 0 || ( $pagenow == 'edit.php' && $post_type == 'frm_display' ) ) { |
| 239 | 239 | |
| 240 | - wp_enqueue_script( 'admin-widgets' ); |
|
| 241 | - wp_enqueue_style( 'widgets' ); |
|
| 242 | - wp_enqueue_script( 'formidable' ); |
|
| 243 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 240 | + wp_enqueue_script( 'admin-widgets' ); |
|
| 241 | + wp_enqueue_style( 'widgets' ); |
|
| 242 | + wp_enqueue_script( 'formidable' ); |
|
| 243 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 244 | 244 | FrmAppHelper::localize_script( 'admin' ); |
| 245 | 245 | |
| 246 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 247 | - add_thickbox(); |
|
| 246 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 247 | + add_thickbox(); |
|
| 248 | 248 | |
| 249 | - wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 249 | + wp_register_script( 'formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array( 'jquery' ), '2.3.0' ); |
|
| 250 | 250 | |
| 251 | - } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 252 | - if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 253 | - $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 251 | + } else if ( $pagenow == 'post.php' || ( $pagenow == 'post-new.php' && $post_type == 'frm_display' ) ) { |
|
| 252 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
| 253 | + $post_type = sanitize_title( $_REQUEST['post_type'] ); |
|
| 254 | 254 | } else if ( isset( $_REQUEST['post'] ) && absint( $_REQUEST['post'] ) ) { |
| 255 | 255 | $post = get_post( absint( $_REQUEST['post'] ) ); |
| 256 | - if ( ! $post ) { |
|
| 257 | - return; |
|
| 258 | - } |
|
| 259 | - $post_type = $post->post_type; |
|
| 260 | - } else { |
|
| 261 | - return; |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - if ( $post_type == 'frm_display' ) { |
|
| 265 | - wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 266 | - wp_enqueue_script( 'formidable_admin' ); |
|
| 267 | - wp_enqueue_style( 'formidable-admin' ); |
|
| 256 | + if ( ! $post ) { |
|
| 257 | + return; |
|
| 258 | + } |
|
| 259 | + $post_type = $post->post_type; |
|
| 260 | + } else { |
|
| 261 | + return; |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + if ( $post_type == 'frm_display' ) { |
|
| 265 | + wp_enqueue_script( 'jquery-ui-draggable' ); |
|
| 266 | + wp_enqueue_script( 'formidable_admin' ); |
|
| 267 | + wp_enqueue_style( 'formidable-admin' ); |
|
| 268 | 268 | FrmAppHelper::localize_script( 'admin' ); |
| 269 | - } |
|
| 270 | - } else if ( $pagenow == 'widgets.php' ) { |
|
| 271 | - FrmAppHelper::load_admin_wide_js(); |
|
| 272 | - } |
|
| 273 | - } |
|
| 274 | - |
|
| 275 | - public static function wp_admin_body_class( $classes ) { |
|
| 276 | - global $wp_version; |
|
| 277 | - //we need this class everywhere in the admin for the menu |
|
| 278 | - if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
| 279 | - $classes .= ' frm_38_trigger'; |
|
| 280 | - } |
|
| 281 | - |
|
| 282 | - return $classes; |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - public static function load_lang() { |
|
| 286 | - load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - /** |
|
| 290 | - * Filter shortcodes in text widgets |
|
| 291 | - */ |
|
| 292 | - public static function widget_text_filter( $content ) { |
|
| 293 | - $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
| 294 | - return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - public static function widget_text_filter_callback( $matches ) { |
|
| 298 | - _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
| 299 | - return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - public static function front_head() { |
|
| 303 | - if ( is_multisite() ) { |
|
| 304 | - $old_db_version = get_option( 'frm_db_version' ); |
|
| 305 | - $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
| 306 | - if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
| 307 | - ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
| 308 | - self::install( $old_db_version ); |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - } |
|
| 269 | + } |
|
| 270 | + } else if ( $pagenow == 'widgets.php' ) { |
|
| 271 | + FrmAppHelper::load_admin_wide_js(); |
|
| 272 | + } |
|
| 273 | + } |
|
| 274 | + |
|
| 275 | + public static function wp_admin_body_class( $classes ) { |
|
| 276 | + global $wp_version; |
|
| 277 | + //we need this class everywhere in the admin for the menu |
|
| 278 | + if ( version_compare( $wp_version, '3.7.2', '>' ) ) { |
|
| 279 | + $classes .= ' frm_38_trigger'; |
|
| 280 | + } |
|
| 281 | + |
|
| 282 | + return $classes; |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + public static function load_lang() { |
|
| 286 | + load_plugin_textdomain( 'formidable', false, FrmAppHelper::plugin_folder() . '/languages/' ); |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + /** |
|
| 290 | + * Filter shortcodes in text widgets |
|
| 291 | + */ |
|
| 292 | + public static function widget_text_filter( $content ) { |
|
| 293 | + $regex = '/\[\s*(formidable|display-frm-data|frm-stats|frm-graph|frm-entry-links|formresults|frm-search)\s+.*\]/'; |
|
| 294 | + return preg_replace_callback( $regex, 'FrmAppHelper::widget_text_filter_callback', $content ); |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + public static function widget_text_filter_callback( $matches ) { |
|
| 298 | + _deprecated_function( __FUNCTION__, '2.0', 'FrmAppHelper::widget_text_filter_callback' ); |
|
| 299 | + return FrmAppHelper::widget_text_filter_callback( $matches ); |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + public static function front_head() { |
|
| 303 | + if ( is_multisite() ) { |
|
| 304 | + $old_db_version = get_option( 'frm_db_version' ); |
|
| 305 | + $pro_db_version = FrmAppHelper::pro_is_installed() ? get_option( 'frmpro_db_version' ) : false; |
|
| 306 | + if ( ( (int) $old_db_version < (int) FrmAppHelper::$db_version ) || |
|
| 307 | + ( FrmAppHelper::pro_is_installed() && (int) $pro_db_version < (int) FrmAppHelper::$pro_db_version ) ) { |
|
| 308 | + self::install( $old_db_version ); |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | 313 | public static function localize_script( $location ) { |
| 314 | 314 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmAppHelper::localize_script' ); |
@@ -368,72 +368,72 @@ discard block |
||
| 368 | 368 | wp_die(); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - public static function activation_install() { |
|
| 372 | - FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 373 | - FrmFormActionsController::actions_init(); |
|
| 374 | - self::install(); |
|
| 375 | - } |
|
| 371 | + public static function activation_install() { |
|
| 372 | + FrmAppHelper::delete_cache_and_transient( 'frm_plugin_version' ); |
|
| 373 | + FrmFormActionsController::actions_init(); |
|
| 374 | + self::install(); |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | - public static function install( $old_db_version = false ) { |
|
| 378 | - $frmdb = new FrmDb(); |
|
| 379 | - $frmdb->upgrade( $old_db_version ); |
|
| 380 | - } |
|
| 377 | + public static function install( $old_db_version = false ) { |
|
| 378 | + $frmdb = new FrmDb(); |
|
| 379 | + $frmdb->upgrade( $old_db_version ); |
|
| 380 | + } |
|
| 381 | 381 | |
| 382 | - public static function uninstall() { |
|
| 383 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 382 | + public static function uninstall() { |
|
| 383 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 384 | 384 | |
| 385 | - if ( current_user_can( 'administrator' ) ) { |
|
| 386 | - $frmdb = new FrmDb(); |
|
| 387 | - $frmdb->uninstall(); |
|
| 385 | + if ( current_user_can( 'administrator' ) ) { |
|
| 386 | + $frmdb = new FrmDb(); |
|
| 387 | + $frmdb->uninstall(); |
|
| 388 | 388 | |
| 389 | 389 | //disable the plugin and redirect after uninstall so the tables don't get added right back |
| 390 | 390 | deactivate_plugins( FrmAppHelper::plugin_folder() . '/formidable.php', false, false ); |
| 391 | 391 | echo esc_url_raw( admin_url( 'plugins.php?deactivate=true' ) ); |
| 392 | - } else { |
|
| 393 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 394 | - wp_die( $frm_settings->admin_permission ); |
|
| 395 | - } |
|
| 396 | - wp_die(); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - public static function drop_tables( $tables ) { |
|
| 400 | - global $wpdb; |
|
| 401 | - $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 402 | - $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 403 | - $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 404 | - $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 405 | - return $tables; |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 409 | - public static function page_route( $content ) { |
|
| 410 | - global $post; |
|
| 411 | - |
|
| 412 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 413 | - if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
| 414 | - $content = FrmFormsController::page_preview(); |
|
| 415 | - } |
|
| 416 | - |
|
| 417 | - return $content; |
|
| 418 | - } |
|
| 419 | - |
|
| 420 | - public static function deauthorize() { |
|
| 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 | - } |
|
| 392 | + } else { |
|
| 393 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 394 | + wp_die( $frm_settings->admin_permission ); |
|
| 395 | + } |
|
| 396 | + wp_die(); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + public static function drop_tables( $tables ) { |
|
| 400 | + global $wpdb; |
|
| 401 | + $tables[] = $wpdb->prefix . 'frm_fields'; |
|
| 402 | + $tables[] = $wpdb->prefix . 'frm_forms'; |
|
| 403 | + $tables[] = $wpdb->prefix . 'frm_items'; |
|
| 404 | + $tables[] = $wpdb->prefix . 'frm_item_metas'; |
|
| 405 | + return $tables; |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + // Routes for wordpress pages -- we're just replacing content here folks. |
|
| 409 | + public static function page_route( $content ) { |
|
| 410 | + global $post; |
|
| 411 | + |
|
| 412 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 413 | + if ( $post && $post->ID == $frm_settings->preview_page_id && isset( $_GET['form'] ) ) { |
|
| 414 | + $content = FrmFormsController::page_preview(); |
|
| 415 | + } |
|
| 416 | + |
|
| 417 | + return $content; |
|
| 418 | + } |
|
| 419 | + |
|
| 420 | + public static function deauthorize() { |
|
| 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 | } |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | if ( ! empty( $affiliate ) ) { |
| 133 | 133 | ?> |
| 134 | 134 | <div class="update-nag frm-update-to-pro"> |
| 135 | - Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url('https://formidablepro.com') ) ?>" class="button">Upgrade to Pro</a> |
|
| 135 | + Looking for more options to get professional results? <span>Take your forms to the next level.</span> <a href="<?php echo esc_url( FrmAppHelper::make_affiliate_url( 'https://formidablepro.com' ) ) ?>" class="button">Upgrade to Pro</a> |
|
| 136 | 136 | </div> |
| 137 | 137 | <?php |
| 138 | 138 | } |
@@ -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,16 +144,16 @@ 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() { |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | $message = __( 'Your License Key was invalid', 'formidable' ); |
| 255 | 255 | if ( is_wp_error( $resp ) ) { |
| 256 | - $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>'); |
|
| 256 | + $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>' ); |
|
| 257 | 257 | if ( is_wp_error( $resp ) ) { |
| 258 | - $message .= ' '. $resp->get_error_message(); |
|
| 258 | + $message .= ' ' . $resp->get_error_message(); |
|
| 259 | 259 | } |
| 260 | 260 | } else if ( $body == 'error' || is_wp_error( $body ) ) { |
| 261 | 261 | $message = __( 'You had an HTTP error connecting to Formidable Pro\'s API', 'formidable' ); |
@@ -268,14 +268,14 @@ discard block |
||
| 268 | 268 | $message = $json_res; |
| 269 | 269 | } |
| 270 | 270 | } else if ( isset( $resp['response'] ) && isset( $resp['response']['code'] ) ) { |
| 271 | - $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] .' '. $resp['body'] ); |
|
| 271 | + $message = sprintf( __( 'There was a %1$s error: %2$s', 'formidable' ), $resp['response']['code'], $resp['response']['message'] . ' ' . $resp['body'] ); |
|
| 272 | 272 | } |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return $message; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - public function manually_queue_update(){ |
|
| 278 | + public function manually_queue_update() { |
|
| 279 | 279 | set_site_transient( 'update_plugins', null ); |
| 280 | 280 | } |
| 281 | 281 | } |