Changeset 1648101
- Timestamp:
- 04/29/2017 04:35:31 PM (9 years ago)
- Location:
- wp-libre-form/tags
- Files:
-
- 1 added
- 9 edited
- 2 copied
-
1.2.2 (copied) (copied from wp-libre-form/trunk)
-
1.2.2/classes/class-cpt-wplf-form.php (modified) (29 diffs)
-
1.2.2/classes/class-cpt-wplf-submission.php (modified) (13 diffs)
-
1.2.2/classes/class-wplf-polylang.php (modified) (5 diffs)
-
1.2.2/inc/wplf-ajax.php (modified) (6 diffs)
-
1.2.2/inc/wplf-form-actions.php (modified) (1 diff)
-
1.2.2/inc/wplf-form-validation.php (modified) (5 diffs)
-
1.2.2/phpcs.xml (added)
-
1.2.2/readme.md (modified) (2 diffs)
-
1.2.2/readme.txt (modified) (1 diff)
-
1.2.2/wp-libre-form.php (modified) (4 diffs)
-
1.3 (copied) (copied from wp-libre-form/trunk)
Legend:
- Unmodified
- Added
- Removed
-
wp-libre-form/tags/1.2.2/classes/class-cpt-wplf-form.php
r1640733 r1648101 1 1 <?php 2 2 3 if ( ! class_exists('CPT_WPLF_Form') ) :3 if ( ! class_exists( 'CPT_WPLF_Form' ) ) : 4 4 5 5 class CPT_WPLF_Form { … … 26 26 add_filter( 'get_sample_permalink_html', array( $this, 'modify_permalink_html' ), 10, 2 ); 27 27 add_action( 'save_post', array( $this, 'save_cpt' ) ); 28 add_filter( 'content_save_pre' , array( $this, 'strip_form_tags' ), 10, 1 );28 add_filter( 'content_save_pre', array( $this, 'strip_form_tags' ), 10, 1 ); 29 29 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes_cpt' ) ); 30 30 add_action( 'admin_enqueue_scripts', array( $this, 'admin_post_scripts_cpt' ), 10, 1 ); … … 32 32 // edit.php view 33 33 add_filter( 'post_row_actions', array( $this, 'remove_row_actions' ), 10, 2 ); 34 add_filter( 'manage_edit-wplf-form_columns' , array( $this, 'custom_columns_cpt' ), 100, 1 );35 add_action( 'manage_posts_custom_column' , array( $this, 'custom_columns_display_cpt' ), 10, 2 );34 add_filter( 'manage_edit-wplf-form_columns', array( $this, 'custom_columns_cpt' ), 100, 1 ); 35 add_action( 'manage_posts_custom_column', array( $this, 'custom_columns_display_cpt' ), 10, 2 ); 36 36 37 37 add_filter( 'default_content', array( $this, 'default_content_cpt' ) ); … … 44 44 add_action( 'wp_enqueue_scripts', array( $this, 'maybe_enqueue_frontend_script' ) ); 45 45 46 // same default filters as the_content, but we don't want to use actual the_content for the form output46 // default filters for the_content, but we don't want to use actual the_content 47 47 add_filter( 'wplf_form', 'wptexturize' ); 48 48 add_filter( 'wplf_form', 'convert_smilies' ); 49 add_filter( 'wplf_form', 'convert_chars' );49 add_filter( 'wplf_form', 'convert_chars' ); 50 50 add_filter( 'wplf_form', 'wpautop' ); 51 51 add_filter( 'wplf_form', 'shortcode_unautop' ); … … 66 66 'search_items' => __( 'Search Forms', 'wp-libre-form' ), 67 67 'not_found' => __( 'No forms found.', 'wp-libre-form' ), 68 'not_found_in_trash' => __( 'No forms found in Trash.', 'wp-libre-form' ) 68 'not_found_in_trash' => __( 'No forms found in Trash.', 'wp-libre-form' ), 69 69 ); 70 70 71 71 $args = array( 72 'labels' => $labels,73 'public' => true,74 'publicly_queryable' => true,75 'exclude_from_search' => true,76 'show_ui' => true,77 'show_in_menu' => true,78 'menu_icon' => 'dashicons-archive',79 'query_var' => false,80 'capability_type' => 'post',81 'has_archive' => false,82 'hierarchical' => false,83 'menu_position' => null,84 'rewrite' => array(72 'labels' => $labels, 73 'public' => true, 74 'publicly_queryable' => true, 75 'exclude_from_search' => true, 76 'show_ui' => true, 77 'show_in_menu' => true, 78 'menu_icon' => 'dashicons-archive', 79 'query_var' => false, 80 'capability_type' => 'post', 81 'has_archive' => false, 82 'hierarchical' => false, 83 'menu_position' => null, 84 'rewrite' => array( 85 85 'slug' => 'libre-forms', 86 86 ), 87 'supports' => array(87 'supports' => array( 88 88 'title', 89 89 'editor', … … 102 102 $publicly_visible = $this->get_publicly_visible_state( $post_id ); 103 103 104 if( get_post_type( $post_id ) === 'wplf-form' && !$publicly_visible ) { 105 $html .= '<span>' . __( 'Permalink is for preview purposes only.', 'wp-libre-form' ) . '</span>'; 104 if ( get_post_type( $post_id ) === 'wplf-form' && ! $publicly_visible ) { 105 $html .= '<span>'; 106 $html .= __( 'Permalink is for preview purposes only.', 'wp-libre-form' ); 107 $html .= '</span>'; 106 108 } 107 109 … … 116 118 117 119 // only for this cpt 118 if ( 'wplf-form' == get_post_type( $post ) ) {120 if ( 'wplf-form' === get_post_type( $post ) ) { 119 121 return false; 120 122 } … … 130 132 131 133 // make sure we're on the correct view 132 if ( 'post-new.php' != $hook && 'post.php' != $hook ) {134 if ( 'post-new.php' !== $hook && 'post.php' !== $hook ) { 133 135 return; 134 136 } 135 137 136 138 // only for this cpt 137 if ( 'wplf-form' != $post->post_type ) {139 if ( 'wplf-form' !== $post->post_type ) { 138 140 return; 139 141 } 140 142 141 143 // enqueue the custom JS for this view 142 wp_enqueue_script( 'wplf-form-edit-js', plugins_url( 'assets/scripts/wplf-admin-form.js', dirname( __FILE__) ) );144 wp_enqueue_script( 'wplf-form-edit-js', plugins_url( 'assets/scripts/wplf-admin-form.js', dirname( __FILE__ ) ) ); 143 145 } 144 146 … … 151 153 152 154 // only on post.php screen 153 if ( 'post-new.php' != $pagenow && 'post.php' != $pagenow ) {155 if ( 'post-new.php' !== $pagenow && 'post.php' !== $pagenow ) { 154 156 return $content; 155 157 } … … 160 162 161 163 // default content starts here: 162 ?> 163 <label for="name"><?php _e( 'Please enter your name', 'wp-libre-form' ); ?></label> 164 <input type="text" name="name" id="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>"> 165 166 <label for="email"><?php _e( 'Please enter your email address', 'wp-libre-form' ); ?> <?php _e( '(required)', 'wp-libre-form' ); ?></label> 167 <input type="email" name="email" id="email" placeholder="<?php _ex( '[email protected]', 'Default placeholder email', 'wp-libre-form' ); ?>" required> 168 169 <label for="message"><?php _e( 'Write your message below', 'wp-libre-form' ); ?> <?php _e( '(required)', 'wp-libre-form' ); ?></label> 170 <textarea name="message" rows="5" id="message" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea> 171 172 <button type="submit"><?php _e( 'Submit', 'wp-libre-form' ); ?></button> 173 174 <!-- <?php _ex( 'Any valid HTML form can be used here!', 'The HTML comment at the end of the example form', 'wp-libre-form' ); ?> --> 175 <?php 164 // @codingStandardsIgnoreStart 165 ?> 166 <label for="name"><?php esc_html_e( 'Please enter your name', 'wp-libre-form' ); ?></label> 167 <input type="text" name="name" id="name" placeholder="<?php echo esc_html_x( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>"> 168 169 <label for="email"><?php echo esc_html_x( 'Please enter your email address', 'wp-libre-form' ); ?> <?php esc_html_e( '(required)', 'wp-libre-form' ); ?></label> 170 <input type="email" name="email" id="email" placeholder="<?php echo esc_html_x( '[email protected]', 'Default placeholder email', 'wp-libre-form' ); ?>" required> 171 172 <label for="message"><?php esc_html_e( 'Write your message below', 'wp-libre-form' ); ?> <?php esc_html_e( '(required)', 'wp-libre-form' ); ?></label> 173 <textarea name="message" rows="5" id="message" placeholder="<?php echo esc_html_x( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea> 174 175 <button type="submit"><?php esc_html_e( 'Submit', 'wp-libre-form' ); ?></button> 176 177 <!-- <?php echo esc_html_x( 'Any valid HTML form can be used here!', 'The HTML comment at the end of the example form', 'wp-libre-form' ); ?> --> 178 <?php 179 // @codingStandardsIgnoreEnd 176 180 $content = esc_textarea( ob_get_clean() ); 177 181 } … … 186 190 $publicly_visible = $this->get_publicly_visible_state( $post->ID ); 187 191 188 if ( $post->post_type === 'wplf-form' && !$publicly_visible )192 if ( 'wplf-form' === $post->post_type && ! $publicly_visible ) { 189 193 unset( $actions['view'] ); 194 } 190 195 191 196 return $actions; … … 211 216 */ 212 217 function custom_columns_display_cpt( $column, $post_id ) { 213 if ( 'shortcode' === $column ) {214 ?> 215 <input type="text" class="code" value='[libre-form id="<?php echo $post_id; ?>"]' readonly>216 <?php 217 } 218 if ( 'submissions' === $column ) {218 if ( 'shortcode' === $column ) { 219 ?> 220 <input type="text" class="code" value='[libre-form id="<?php echo intval( $post_id ); ?>"]' readonly> 221 <?php 222 } 223 if ( 'submissions' === $column ) { 219 224 // count number of submissions 220 225 $submissions = get_posts( array( … … 223 228 'meta_key' => '_form_id', 224 229 'meta_value' => $post_id, 230 'suppress_filters' => false, 225 231 ) ); 226 232 ?> 227 <a href="<?php echo admin_url( 'edit.php?post_type=wplf-submission&form=' . $post_id ); ?>"><?php echo count( $submissions ); ?></a> 233 <a href="<?php echo esc_url_raw( admin_url( 'edit.php?post_type=wplf-submission&form=' . $post_id ) ); ?>"> 234 <?php echo count( $submissions ); ?> 235 </a> 228 236 <?php 229 237 } … … 289 297 function metabox_shortcode( $post ) { 290 298 ?> 291 <p><input type="text" class="code" value='[libre-form id="<?php echo $post->ID; ?>"]' readonly></p>299 <p><input type="text" class="code" value='[libre-form id="<?php echo esc_attr( $post->ID ); ?>"]' readonly></p> 292 300 <?php 293 301 } … … 299 307 // get post meta 300 308 $meta = get_post_meta( $post->ID ); 301 $message = isset( $meta['_wplf_thank_you'] ) ? $meta['_wplf_thank_you'][0] : _x( 'Thank you! :)', 'Default success message', 'wp-libre-form' ); 309 $message = isset( $meta['_wplf_thank_you'] ) ? 310 $meta['_wplf_thank_you'][0] : _x( 'Thank you! :)', 'Default success message', 'wp-libre-form' ); 302 311 ?> 303 312 <p> … … 307 316 'textarea_name' => 'wplf_thank_you', 308 317 'textarea_rows' => 6, 309 'teeny' => true 318 'teeny' => true, 310 319 )); ?> 311 320 </p> … … 318 327 * Meta box callback for form fields meta box 319 328 */ 320 function metabox_form_fields( $post) {321 ?> 322 <p><?php _e('Fields marked with * are required', 'wp-libre-form'); ?></p>329 function metabox_form_fields() { 330 ?> 331 <p><?php esc_html_e( 'Fields marked with * are required', 'wp-libre-form' ); ?></p> 323 332 <div class="wplf-form-field-container"> 324 333 <!-- <div class="wplf-form-field widget-top"><div class="widget-title"><h4>name</h4></div></div> --> … … 340 349 <p> 341 350 <label for="wplf_email_copy_enabled"> 342 <input type="checkbox" <?php echo $email_enabled ? 'checked="checked"' : ''; ?> id="wplf_email_copy_enabled" name="wplf_email_copy_enabled"> 343 <?php _e( 'Send an email copy when a form is submitted?', 'wp-libre-form' ); ?> 351 <input 352 id="wplf_email_copy_enabled" 353 name="wplf_email_copy_enabled" 354 type="checkbox" 355 <?php echo $email_enabled ? 'checked="checked"' : ''; ?> 356 > 357 <?php esc_html_e( 'Send an email copy when a form is submitted?', 'wp-libre-form' ); ?> 344 358 </label> 345 359 </p> 346 <p><input type="text" name="wplf_email_copy_to" value="<?php echo esc_attr( $email_copy_to ); ?>" placeholder="<?php echo esc_attr( get_option( 'admin_email' ) ); ?>" style="width:100%;display:none"></p> 360 <p> 361 <input 362 type="text" 363 name="wplf_email_copy_to" 364 value="<?php echo esc_attr( $email_copy_to ); ?>" 365 placeholder="<?php echo esc_attr( get_option( 'admin_email' ) ); ?>" 366 style="width:100%;display:none" 367 > 368 </p> 347 369 <?php 348 370 } … … 357 379 $format = isset( $meta['_wplf_title_format'] ) ? $meta['_wplf_title_format'][0] : $default; 358 380 ?> 359 <p><?php _e('Submissions from this form will use this formatting in their title.', 'wp-libre-form'); ?></p> 360 <p><?php _e('You may use any field values enclosed in "%" markers.', 'wp-libre-form');?></p> 361 <p><input type="text" name="wplf_title_format" value="<?php echo esc_attr( $format ); ?>" placeholder="<?php echo esc_attr( $default ); ?>" class="code" style="width:100%" autocomplete="off"></p> 381 <p><?php esc_html_e( 'Submissions from this form will use this formatting in their title.', 'wp-libre-form' ); ?></p> 382 <p><?php esc_html_e( 'You may use any field values enclosed in "%" markers.', 'wp-libre-form' );?></p> 383 <p> 384 <input 385 type="text" 386 name="wplf_title_format" 387 value="<?php echo esc_attr( $format ); ?>" 388 placeholder="<?php echo esc_attr( $default ); ?>" 389 class="code" 390 style="width:100%" 391 autocomplete="off" 392 > 393 </p> 362 394 <?php 363 395 } … … 370 402 if ( ! isset( $_POST['wplf_form_meta_nonce'] ) ) { 371 403 return; 372 } 373 else if ( ! wp_verify_nonce( $_POST['wplf_form_meta_nonce'], 'wplf_form_meta' ) ) { 404 } elseif ( ! wp_verify_nonce( $_POST['wplf_form_meta_nonce'], 'wplf_form_meta' ) ) { 374 405 return; 375 406 } 376 407 377 408 // only for this cpt 378 if ( ! isset( $_POST['post_type'] ) || 'wplf-form' != $_POST['post_type'] ) {409 if ( ! isset( $_POST['post_type'] ) || 'wplf-form' !== $_POST['post_type'] ) { 379 410 return; 380 411 } … … 403 434 if ( isset( $_POST['wplf_email_copy_enabled'] ) ) { 404 435 update_post_meta( $post_id, '_wplf_email_copy_enabled', $_POST['wplf_email_copy_enabled'] === 'on' ); 405 } 406 else { 436 } else { 407 437 update_post_meta( $post_id, '_wplf_email_copy_enabled', false ); 408 438 } … … 410 440 // save email copy 411 441 if ( isset( $_POST['wplf_email_copy_to'] ) ) { 412 $email Field = $_POST['wplf_email_copy_to'];442 $email_field = $_POST['wplf_email_copy_to']; 413 443 $to = ''; 414 444 415 if ( strpos( $emailField, ",") > 0 ) {445 if ( strpos( $email_field, ',' ) > 0 ) { 416 446 // Intentional. Makes no sense if the first character is a comma, so pass it along as a single address. 417 447 // sanitize_email() should take care of the rest. 418 $email Array = explode( ",", $emailField );419 foreach ($emailArray as $email){420 $email = trim( $email);421 $email = sanitize_email( $email ) . ", ";448 $email_array = explode( ',', $email_field ); 449 foreach ( $email_array as $email ) { 450 $email = trim( $email ); 451 $email = sanitize_email( $email ) . ', '; 422 452 $to .= $email; 423 453 } 424 $to = rtrim( $to, ", " ); 454 $to = rtrim( $to, ', ' ); 455 } else { 456 $to = sanitize_email( $email_field ); 425 457 } 426 else { 427 $to = sanitize_email( $emailField ); 428 } 429 430 if( !empty( $to ) ) { 458 459 if ( ! empty( $to ) ) { 431 460 update_post_meta( $post_id, '_wplf_email_copy_to', $to ); 432 461 } else { … … 455 484 */ 456 485 function strip_form_tags( $content ) { 457 return preg_replace( '/<\/?form.*>/i', '', $content );486 return preg_replace( '/<\/?form.*>/i', '', $content ); 458 487 } 459 488 … … 462 491 * The function we display the form with 463 492 */ 464 function wplf_form( $id , $content = '', $xclass = '' ) {493 function wplf_form( $id, $content = '', $xclass = '' ) { 465 494 global $post; 466 495 467 if ( 'publish' === get_post_status( $id ) || 'true' === $_GET['preview'] ) {468 if ( empty( $content ) ) {496 if ( 'publish' === get_post_status( $id ) || 'true' === $_GET['preview'] ) { 497 if ( empty( $content ) ) { 469 498 // you can override the content via a parameter 470 499 $content = get_post( $id )->post_content; 471 500 } 472 501 473 $multipart = "";474 // check if form contains file inputs475 if(strpos($content, "type='file'") > -1 || strpos($content, "type=\"file\"") > -1){476 $multipart = "enctype='multipart/form-data'";477 }478 479 502 ob_start(); 480 503 ?> 481 <form class="libre-form libre-form-<?php echo $id . ' ' . $xclass; ?>" <?php echo $multipart; ?>> 482 <?php if( is_singular( 'wplf-form' ) && current_user_can( 'edit_post', $id ) ) { 504 <form 505 class="libre-form libre-form-<?php echo esc_attr( $id . ' ' . $xclass ); ?>" 506 <?php 507 // check if form contains file inputs 508 if ( strpos( $content, "type='file'" ) >= 0 || strpos( $content, 'type="file"' ) >= 0 ) { 509 echo "enctype='multipart/form-data'"; 510 } 511 ?> 512 > 513 <?php if ( is_singular( 'wplf-form' ) && current_user_can( 'edit_post', $id ) ) { 483 514 $publicly_visible = $this->get_publicly_visible_state( $id ); 484 if ( !$publicly_visible ) {515 if ( ! $publicly_visible ) { 485 516 ?> 486 517 <p style="background:#f5f5f5;border-left:4px solid #dc3232;padding:6px 12px;"> 487 <b style="color:#dc3232;"><?php _e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ) ?></b><br /> 488 <?php _e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ) ?> 518 <strong style="color:#dc3232;"> 519 <?php esc_html_e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ) ?> 520 </strong> 521 <br /> 522 <?php esc_html_e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ) ?> 489 523 </p> 490 524 <?php 491 525 } 492 526 } ?> 493 <?php echo apply_filters( 'wplf_form', $content ); ?> 527 <?php 528 // This is where we output the user-input form html. We allow all HTML here. Yes, even scripts. 529 // @codingStandardsIgnoreStart 530 echo apply_filters( 'wplf_form', $content ); 531 // @codingStandardsIgnoreEnd 532 ?> 494 533 <input type="hidden" name="referrer" value="<?php the_permalink(); ?>"> 495 <input type="hidden" name="_referrer_id" value="<?php e sc_attr_e( get_the_id() ) ?>">496 <input type="hidden" name="_form_id" value="<?php e sc_attr_e( $id ); ?>">534 <input type="hidden" name="_referrer_id" value="<?php echo esc_attr( get_the_id() ) ?>"> 535 <input type="hidden" name="_form_id" value="<?php echo esc_attr( $id ); ?>"> 497 536 </form> 498 537 <?php … … 515 554 wp_register_script( 516 555 'wplf-form-js', 517 plugins_url( 'assets/scripts/wplf-form.js', dirname( __FILE__) ),556 plugins_url( 'assets/scripts/wplf-form.js', dirname( __FILE__ ) ), 518 557 apply_filters( 'wplf_frontend_script_dependencies', array() ), 519 558 WPLF_VERSION, … … 521 560 ); 522 561 523 if( is_a( $post, 'WP_Post' ) && ( has_shortcode( $post->post_content, 'libre-form') || $post->post_type === 'wplf-form') ) { 524 wp_enqueue_script( 'wplf-form-js' ); 525 wp_localize_script( 'wplf-form-js', 'ajax_object', array( 526 'ajax_url' => admin_url( 'admin-ajax.php' ), 527 'ajax_credentials' => apply_filters('wplf_ajax_fetch_credentials_mode', 'same-origin') 528 ) ); 562 if ( is_a( $post, 'WP_Post' ) ) { 563 if ( has_shortcode( $post->post_content, 'libre-form' ) || $post->post_type === 'wplf-form' ) { 564 wp_enqueue_script( 'wplf-form-js' ); 565 wp_localize_script( 'wplf-form-js', 'ajax_object', array( 566 'ajax_url' => admin_url( 'admin-ajax.php' ), 567 'ajax_credentials' => apply_filters( 'wplf_ajax_fetch_credentials_mode', 'same-origin' ), 568 ) ); 569 } 529 570 } 530 571 } … … 534 575 * Shortcode for displaying a Form 535 576 */ 536 function shortcode( $attributes, $content = null) {577 function shortcode( $attributes ) { 537 578 $attributes = shortcode_atts( array( 538 579 'id' => null, … … 550 591 function use_shortcode_for_preview( $content ) { 551 592 global $post; 552 if ( isset( $post->post_type ) && $post->post_type === 'wplf-form') {593 if ( isset( $post->post_type ) && $post->post_type === 'wplf-form' ) { 553 594 return $this->wplf_form( $post->ID, $content ); 554 595 } … … 563 604 global $post; 564 605 565 if( !is_singular( 'wplf-form' ) ) 566 return; 606 if ( ! is_singular( 'wplf-form' ) ) { 607 return; 608 } 567 609 568 610 $publicly_visible = $this->get_publicly_visible_state( $post->ID ); 569 if( $publicly_visible ) 570 return; 571 572 if( !current_user_can( 'edit_post', $post->ID ) ) { 611 if ( $publicly_visible ) { 612 return; 613 } 614 615 if ( ! current_user_can( 'edit_post', $post->ID ) ) { 573 616 global $wp_query; 574 617 $wp_query->set_404(); -
wp-libre-form/tags/1.2.2/classes/class-cpt-wplf-submission.php
r1522463 r1648101 1 1 <?php 2 2 3 if ( ! class_exists('CPT_WPLF_Submission') ) :3 if ( ! class_exists( 'CPT_WPLF_Submission' ) ) : 4 4 5 5 class CPT_WPLF_Submission { … … 27 27 28 28 // edit.php view 29 add_filter( 'manage_edit-wplf-submission_columns' , array( $this, 'custom_columns_cpt' ), 100, 1);30 add_action( 'manage_posts_custom_column' , array( $this, 'custom_columns_display_cpt' ), 10, 2 );29 add_filter( 'manage_edit-wplf-submission_columns', array( $this, 'custom_columns_cpt' ), 100, 1 ); 30 add_action( 'manage_posts_custom_column', array( $this, 'custom_columns_display_cpt' ), 10, 2 ); 31 31 add_action( 'restrict_manage_posts', array( $this, 'form_filter_dropdown' ) ); 32 32 add_filter( 'pre_get_posts', array( $this, 'filter_by_form' ) ); 33 34 // add custom bulk actions 35 add_action( 'admin_notices', array( $this, 'wplf_submission_bulk_action_admin_notice' ) ); 36 add_filter( 'bulk_actions-edit-wplf-submission', array( $this, 'register_wplf_submission_bulk_actions' ) ); 37 add_filter( 'handle_bulk_actions-edit-wplf-submission', 38 array( $this, 'wplf_submission_bulk_action_handler' ), 10, 3 ); 33 39 } 34 40 … … 47 53 'search_items' => __( 'Search Submissions', 'wp-libre-form' ), 48 54 'not_found' => __( 'No submissions found.', 'wp-libre-form' ), 49 'not_found_in_trash' => __( 'No submissions found in Trash.', 'wp-libre-form' ) 55 'not_found_in_trash' => __( 'No submissions found in Trash.', 'wp-libre-form' ), 50 56 ); 51 57 … … 63 69 'hierarchical' => false, 64 70 'menu_position' => null, 65 'supports' => array( 'title', 'custom-fields' ) 71 'supports' => array( 'title', 'custom-fields' ), 66 72 ); 67 73 … … 74 80 */ 75 81 function custom_columns_display_cpt( $column, $post_id ) { 76 if ( 'referrer' === $column ) {77 if ( $referrer = get_post_meta($post_id, 'referrer', true) ) {82 if ( 'referrer' === $column ) { 83 if ( $referrer = get_post_meta( $post_id, 'referrer', true ) ) { 78 84 echo '<a href="' . esc_url_raw( $referrer ) . '">' . esc_url( $referrer ) . '</a>'; 79 85 } 80 86 } 81 if ( 'form' === $column ) {82 if ( $form_id = get_post_meta($post_id, '_form_id', true) ) {87 if ( 'form' === $column ) { 88 if ( $form_id = get_post_meta( $post_id, '_form_id', true ) ) { 83 89 $form = get_post( $form_id ); 84 echo '<a href="' . get_edit_post_link( $form_id, '' ) . '" target="_blank">' . esc_html( $form->post_title ) . '</a>'; 90 echo '<a href="' . esc_url_raw( get_edit_post_link( $form_id, '' ) ) . '" target="_blank">'; 91 echo esc_html( $form->post_title ); 92 echo '</a>'; 85 93 } 86 94 } … … 107 115 global $pagenow; 108 116 109 $allowed = array( "wplf-submission"); // show filter on these post types (currently only one?)110 $allowed = apply_filters( "wplf-dropdown-filter", $allowed);111 $post_type = get_query_var( "post_type");112 113 if ( 'edit.php' != $pagenow || !in_array($post_type, $allowed)) {117 $allowed = array( 'wplf-submission' ); // show filter on these post types (currently only one?) 118 $allowed = apply_filters( 'wplf-dropdown-filter', $allowed ); 119 $post_type = get_query_var( 'post_type' ); 120 121 if ( 'edit.php' !== $pagenow || ! in_array( $post_type, $allowed, true ) ) { 114 122 return; 115 123 } 116 124 117 $transient = get_transient( "wplf-form-filter");118 119 if ($transient){125 $transient = get_transient( 'wplf-form-filter' ); 126 127 if ( $transient ) { 120 128 $forms = $transient; 121 } 122 123 else{ 129 } else { 124 130 $forms = get_posts( array( 125 131 'post_per_page' => '-1', … … 127 133 ) ); 128 134 129 set_transient( "wplf-form-filter", $forms, 15 * MINUTE_IN_SECONDS);135 set_transient( 'wplf-form-filter', $forms, 15 * MINUTE_IN_SECONDS ); 130 136 } 131 137 … … 133 139 <label for="filter-by-form" class="screen-reader-text">Filter by form</label> 134 140 <select name="form" id="filter-by-form"> 135 <option value="0"><?php _e('All Forms', 'wp-libre-form'); ?></option> 136 <?php foreach( $forms as $form ) : ?> 137 <option value="<?php echo $form->ID; ?>" <?php echo isset( $_REQUEST['form'] ) && $_REQUEST['form'] == $form->ID ? 'selected' : ''; ?>><?php echo $form->post_title; ?></option> 141 <option value="0"><?php esc_html_e( 'All Forms', 'wp-libre-form' ); ?></option> 142 <?php foreach ( $forms as $form ) : ?> 143 <option 144 value="<?php echo intval( $form->ID ); ?>" 145 <?php echo isset( $_REQUEST['form'] ) && intval( $_REQUEST['form'] ) === $form->ID ? 'selected' : ''; ?> 146 ><?php esc_html( $form->post_title ); ?></option> 138 147 <?php endforeach; ?> 139 148 </select> … … 147 156 global $pagenow; 148 157 149 if ( 'edit.php' != $pagenow ) {158 if ( 'edit.php' !== $pagenow ) { 150 159 return $query; 151 160 } 152 161 153 if ( $query->get( 'post_type' ) != 'wplf-submission' ) {162 if ( $query->get( 'post_type' ) !== 'wplf-submission' ) { 154 163 return $query; 155 164 } 156 165 157 if ( isset( $_REQUEST['form'] ) && ! empty( $_REQUEST['form'] ) ) {166 if ( isset( $_REQUEST['form'] ) && ! empty( $_REQUEST['form'] ) ) { 158 167 $query->set( 'meta_key', '_form_id' ); 159 168 $query->set( 'meta_value', intval( $_REQUEST['form'] ) ); … … 161 170 162 171 return $query; 172 } 173 174 function register_wplf_submission_bulk_actions( $bulk_actions ) { 175 $bulk_actions['wplf_resend_copy'] = __( 'Resend email copy', 'wp-libre-form' ); 176 return $bulk_actions; 177 } 178 179 function wplf_submission_bulk_action_handler( $redirect_to, $doaction, $post_ids ) { 180 if ( $doaction !== 'wplf_resend_copy' ) { 181 return $redirect_to; 182 } 183 184 foreach ( $post_ids as $post_id ) { 185 $return = new stdClass(); 186 $return->ok = 1; 187 188 wplf_send_email_copy( $return, $post_id ); 189 } 190 191 $redirect_to = add_query_arg( 'wplf_resent', count( $post_ids ), $redirect_to ); 192 return $redirect_to; 193 } 194 195 function wplf_submission_bulk_action_admin_notice() { 196 if ( ! empty( $_REQUEST['wplf_resent'] ) ) { 197 $count = intval( $_REQUEST['wplf_resent'] ); 198 printf( 199 '<div id="wplf-submission-bulk-resend-message" class="notice notice-success"><p>' . 200 esc_html( 201 // translators: %s is number of submissions 202 _n( 'Resent email copy of %s submission.', 203 'Resent email copy of %s submissions.', 204 $count, 205 'wp-libre-form' 206 ) 207 ) . 208 '</p></div>', 209 intval( $count ) ); 210 } 163 211 } 164 212 … … 191 239 <thead> 192 240 <tr> 193 <th><strong><?php _e( 'Field', 'wp-libre-form' ); ?></strong></th>194 <th><strong><?php _e( 'Value', 'wp-libre-form' ); ?></strong></th>241 <th><strong><?php esc_html_e( 'Field', 'wp-libre-form' ); ?></strong></th> 242 <th><strong><?php esc_html_e( 'Value', 'wp-libre-form' ); ?></strong></th> 195 243 </tr> 196 244 </thead> 197 245 <tbody> 198 <?php foreach ( $fields as $field ) : ?>199 <?php if ( '_' != $field[0]) : ?>246 <?php foreach ( $fields as $field ) : ?> 247 <?php if ( '_' !== $field[0] ) : ?> 200 248 <?php 201 249 $value = $postmeta[ $field ][0]; … … 206 254 // if the field ends with '_attachment' and there is an attachment url that corresponds to the id, show a link 207 255 $attachment_suffix = '_attachment'; 208 if ( substr( $field, -strlen( $attachment_suffix ) ) === $attachment_suffix && wp_get_attachment_url( $value ) ) { 209 $link_text = __( 'View Attachment', 'wp-libre-form' ); 210 $possible_link = '<a target="_blank" href="' . get_edit_post_link( $value ) . '" style="float:right">' . $link_text . '</a>'; 256 if ( substr( $field, -strlen( $attachment_suffix ) ) === $attachment_suffix ) { 257 if ( wp_get_attachment_url( $value ) ) { 258 $link_text = __( 'View Attachment', 'wp-libre-form' ); 259 $possible_link = '<a target="_blank" href="' . get_edit_post_link( $value ) . '" style="float:right">'; 260 $possible_link .= $link_text . '</a>'; 261 } 211 262 } 212 263 … … 220 271 ?> 221 272 <tr> 222 <th><strong><?php echo $field; ?></strong> <?php echo $possible_link; ?></th>223 <?php if ( strlen( $value ) > 60 || strpos( $value, "\n" ) ) : ?>273 <th><strong><?php echo esc_html( $field ); ?></strong> <?php echo wp_kses( $possible_link ); ?></th> 274 <?php if ( strlen( $value ) > 60 || strpos( $value, "\n" ) ) : ?> 224 275 <td><textarea style="width:100%" readonly><?php echo esc_textarea( $value ); ?></textarea></td> 225 276 <?php else : ?> 226 <td><input style="width:100%" type="text" value="<?php e sc_attr_e( $value ); ?>" readonly></td>277 <td><input style="width:100%" type="text" value="<?php echo esc_attr( $value ); ?>" readonly></td> 227 278 <?php endif; ?> 228 279 </tr> -
wp-libre-form/tags/1.2.2/classes/class-wplf-polylang.php
r1538951 r1648101 1 1 <?php 2 if ( ! class_exists( 'WPLF_Polylang' ) ) {2 if ( ! class_exists( 'WPLF_Polylang' ) ) { 3 3 class WPLF_Polylang { 4 4 /** … … 21 21 private function __construct() { 22 22 add_filter( 'wplf_form', array( $this, 'render_form' ) ); 23 add_filter( 'save_post_wplf-form', array( $this, 'save_form' ), 10, 3 );24 add_action( 'after_setup_theme', array ( $this, 'register_strings') );23 add_filter( 'save_post_wplf-form', array( $this, 'save_form' ), 10, 3 ); 24 add_action( 'after_setup_theme', array( $this, 'register_strings' ) ); 25 25 26 26 $this->strings = get_option( 'wplf-translation-strings', array() ); … … 28 28 } 29 29 30 public function render_form ( $form_content ) {30 public function render_form( $form_content ) { 31 31 // Get all strings inside double curly braces. 32 32 preg_match_all( $this->regular_expression, $form_content, $matches ); 33 foreach ( $matches[0] as $match ){33 foreach ( $matches[0] as $match ) { 34 34 // match contains the braces, get rid of them. 35 $string = trim( str_replace( array( "{" , "}" ), array( "", ""), $match ) );36 $form_content = str_replace( $match, $this->translate_string ( $string ), $form_content );35 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 36 $form_content = str_replace( $match, $this->translate_string( $string ), $form_content ); 37 37 } 38 38 … … 40 40 } 41 41 42 function save_form ( $post_id, $post, $update ) { 42 function save_form( $post_id, $post, $update ) { 43 unset( $post_id, $update ); // not used here so shut up linter! 44 43 45 preg_match_all( $this->regular_expression, $post->post_content, $matches ); 44 if ( !empty( $matches ) ) {45 foreach ( $matches[0] as $match ){46 if ( ! empty( $matches ) ) { 47 foreach ( $matches[0] as $match ) { 46 48 // match contains the braces, get rid of them. 47 $string = trim( str_replace( array( "{" , "}" ), array( "", ""), $match ) );48 $this->strings[ $string] = null;49 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 50 $this->strings[ $string ] = null; 49 51 // By storing the string as the array key, we don't need to use array_unique. 50 52 } … … 54 56 } 55 57 56 public function register_strings () {57 foreach ( $this->strings as $string => $value ) {58 public function register_strings() { 59 foreach ( $this->strings as $string => $value ) { 58 60 $this->register_string( $string ); 59 61 } 60 62 } 61 63 62 public function register_string ( $string) {63 if ( function_exists( 'pll_register_string' ) ) {64 public function register_string( $string ) { 65 if ( function_exists( 'pll_register_string' ) ) { 64 66 pll_register_string( $string, $string, 'WP Libre Form' ); 65 } else {66 // Don't kill anything.67 67 } 68 68 } 69 69 70 public function translate_string ( $string ) {71 if ( function_exists( 'pll__' ) ) {70 public function translate_string( $string ) { 71 if ( function_exists( 'pll__' ) ) { 72 72 return pll__( $string ); 73 73 } else { -
wp-libre-form/tags/1.2.2/inc/wplf-ajax.php
r1522309 r1648101 1 1 <?php 2 3 2 /** 4 3 * Ajax handler for the form submissions 5 4 */ 5 6 6 add_action( 'wp_ajax_wplf_submit', 'wplf_ajax_submit_handler' ); 7 7 add_action( 'wp_ajax_nopriv_wplf_submit', 'wplf_ajax_submit_handler' ); … … 11 11 12 12 // allow user to pre-process the post fields 13 do_action( 'wplf_pre_validate_submission');13 do_action( 'wplf_pre_validate_submission' ); 14 14 15 15 // validate form fields … … 17 17 $return = apply_filters( 'wplf_validate_submission', $return ); 18 18 19 if ( $return->ok ) {19 if ( $return->ok ) { 20 20 // form existence has already been validated via filters 21 22 23 21 $form = get_post( intval( $_POST['_form_id'] ) ); 24 22 … … 29 27 $post_title = $title_format; 30 28 31 preg_match_all( '/%(.+?)%/', $post_title, $toks);32 foreach ($toks[1] as $tok) {29 preg_match_all( '/%(.+?)%/', $post_title, $toks ); 30 foreach ( $toks[1] as $tok ) { 33 31 $replace = ''; 34 if ( array_key_exists( $tok, $_POST ) ) {35 $replace = sanitize_text_field( $_POST[ $tok] );32 if ( array_key_exists( $tok, $_POST ) ) { 33 $replace = sanitize_text_field( $_POST[ $tok ] ); 36 34 } 37 $post_title = preg_replace( '/%.+?%/', $replace, $post_title, 1);35 $post_title = preg_replace( '/%.+?%/', $replace, $post_title, 1 ); 38 36 } 39 37 … … 46 44 47 45 // add submission data as meta values 48 foreach( $_POST as $key => $value ) { 49 if( !is_array($value) ) { 50 add_post_meta($post_id, $key, esc_html( $value ), true); 51 } 52 else { 53 add_post_meta($post_id, $key, esc_html( json_encode( $value ) ), true); 46 foreach ( $_POST as $key => $value ) { 47 if ( ! is_array( $value ) ) { 48 add_post_meta( $post_id, $key, esc_html( $value ), true ); 49 } else { 50 add_post_meta( $post_id, $key, esc_html( wp_json_encode( $value ) ), true ); 54 51 } 55 52 } 56 53 57 54 // handle files 58 foreach ( $_FILES as $key => $file) {55 foreach ( $_FILES as $key => $file ) { 59 56 // Is this enough security wise? 60 57 // Currenly only supports 1 file per input 61 $attach_id = media_handle_upload( $key, 0, array(), array( "test_form" => false ) ); 62 add_post_meta( $post_id, $key, wp_get_attachment_url($attach_id) ); 63 add_post_meta( $post_id, $key . "_attachment", $attach_id ); 58 $attach_id = media_handle_upload( $key, 0, array(), array( 59 'test_form' => false, 60 ) ); 61 add_post_meta( $post_id, $key, wp_get_attachment_url( $attach_id ) ); 62 add_post_meta( $post_id, $key . '_attachment', $attach_id ); 64 63 } 65 64 66 65 // save email copy address to submission meta for later use 66 $to = get_post_meta( $form->ID, '_wplf_email_copy_to', true ); 67 $to = ! empty( $to ) ? $to : get_option( 'admin_email' ); 68 add_post_meta( $post_id, '_wplf_email_copy_to', apply_filters( 'wplf_email_copy_to', $to ) ); 67 69 68 70 $return->submission_id = $post_id; … … 75 77 // allow user to attach custom actions after the submission has been received 76 78 // these could be confirmation emails, additional processing for the submission fields, e.g. 77 do_action('wplf_post_validate_submission', $return); 78 79 do_action( 'wplf_post_validate_submission', $return ); 79 80 } 80 81 -
wp-libre-form/tags/1.2.2/inc/wplf-form-actions.php
r1538409 r1648101 1 1 <?php 2 2 3 /**4 * Send a copy of the form fields email if feature is enabled5 */6 3 add_action( 'wplf_post_validate_submission', 'wplf_send_email_copy', 20 ); 7 function wplf_send_email_copy( $return ) {4 function wplf_send_email_copy( $return, $submission_id = null ) { 8 5 // do nothing if form validation failed 9 if ( ! $return->ok ) {6 if ( ! $return->ok ) { 10 7 return; 11 8 } 12 9 13 $form_id = intval( $_POST['_form_id'] ); // _form_id is already validated and we know it exists by this point 10 // _form_id is already validated and we know it exists by this point 11 $form_id = intval( ( isset( $submission_id ) ) ? 12 get_post_meta( $submission_id, '_form_id', true ) : $_POST['_form_id'] ); 13 14 14 $form_title = esc_html( get_the_title( $form_id ) ); 15 15 $form_meta = get_post_meta( $form_id ); 16 $referrer = esc_url_raw( $_POST['referrer'] );17 16 18 if( isset($form_meta['_wplf_email_copy_enabled']) && $form_meta['_wplf_email_copy_enabled'][0] ) { 19 $to = isset($form_meta['_wplf_email_copy_to']) ? $form_meta['_wplf_email_copy_to'][0] : get_option( 'admin_email' ); 20 $subject = wp_sprintf( __('New submission from %s', 'wp-libre-form'), $referrer ); 21 $content = wp_sprintf( __('Form "%s" (ID %d) was submitted with values below: ', 'wp-libre-form'), $form_title, $form_id ); 22 $content = apply_filters( 'wplf_email_copy_content_start', $content, $form_title, $form_id ). "\n\n"; 17 $referrer = esc_url_raw( ( isset( $submission_id ) ) ? 18 get_post_meta( $submission_id, 'referrer', true ) : $_POST['referrer'] ); 23 19 24 foreach( $_POST as $key => $value ) { 25 if( '_' === $key[0] ) { 20 if ( ( isset( $form_meta['_wplf_email_copy_enabled'] ) && $form_meta['_wplf_email_copy_enabled'][0] ) 21 || isset( $submission_id ) ) { 22 23 $to = $form_meta['_wplf_email_copy_to'][0]; 24 // translators: %s is email address of form submitter 25 $subject = wp_sprintf( __( 'New submission from %s', 'wp-libre-form' ), $referrer ); 26 27 if ( isset( $submission_id ) ) { 28 $to = get_post_meta( $submission_id, '_wplf_email_copy_to', true ); 29 // translators: %s is email address of form submitter 30 $subject = wp_sprintf( __( 'Submission from %s', 'wp-libre-form' ), $referrer ); 31 } 32 33 $to = empty( $to ) ? get_option( 'admin_email' ) : $to; 34 $content = wp_sprintf( 35 // translators: %1$s is form title, %2$d is form ID 36 __( 'Form "%1$s" (ID %2$d) was submitted with values below: ', 'wp-libre-form' ), $form_title, $form_id ); 37 $content = apply_filters( 'wplf_email_copy_content_start', $content, $form_title, $form_id ) . "\n\n"; 38 39 $fields = $_POST; 40 if ( isset( $submission_id ) ) { 41 $fields = get_post_meta( $submission_id ); 42 } 43 44 foreach ( $fields as $key => $value ) { 45 if ( '_' === $key[0] ) { 26 46 continue; 27 47 } 28 if ( is_array( $value ) ) { // in case input type="radio" submits an array48 if ( is_array( $value ) ) { // in case input type="radio" submits an array 29 49 $value = implode( ', ', $value ); 30 50 } 51 // @codingStandardsIgnoreStart 52 // WP coding standards don't like print_r 53 // @TODO: come up with a prettier format for default mail output 31 54 $content .= esc_html( $key ) . ': ' . esc_html( print_r( $value, true ) ) . "\n"; 55 // @codingStandardsIgnoreEnd 32 56 } 33 57 -
wp-libre-form/tags/1.2.2/inc/wplf-form-validation.php
r1522463 r1648101 7 7 function wplf_validate_form_exists( $return ) { 8 8 // skip this validation if submission has already failed 9 if ( ! $return->ok ) {9 if ( ! $return->ok ) { 10 10 return $return; 11 11 } 12 12 13 if( ! isset( $_POST['_form_id'] ) || ! is_numeric( $_POST['_form_id'] ) || 'publish' != get_post_status( $_POST['_form_id'] ) || 'wplf-form' != get_post_type( $_POST['_form_id'] ) ) { 13 if ( ! isset( $_POST['_form_id'] ) 14 || ! is_numeric( $_POST['_form_id'] ) 15 || 'publish' !== get_post_status( $_POST['_form_id'] ) 16 || 'wplf-form' !== get_post_type( $_POST['_form_id'] ) 17 ) { 14 18 $return->ok = 0; 15 $return->error = sprintf( __("Form id %d doesn't exist!", 'wp-libre-form'), intval( $_POST['_form_id'] ) ); 19 // translators: %d is form ID 20 $return->error = sprintf( __( "Form id %d doesn't exist!", 'wp-libre-form' ), intval( $_POST['_form_id'] ) ); 16 21 } 17 22 return $return; … … 25 30 function wplf_validate_required_empty( $return ) { 26 31 // skip this validation if submission has already failed 27 if ( ! $return->ok ) {32 if ( ! $return->ok ) { 28 33 return $return; 29 34 } … … 34 39 // make sure required form fields are submitted within $_POST or $_FILES arrays 35 40 $fields_empty = array(); 36 foreach ( $required as $key ) {37 if (38 ( ! array_key_exists( $key, $_POST ) && !array_key_exists( $key, $_FILES ) ) ||39 ( empty( $_POST[ $key] ) && ! ( $_FILES[$key]['size'] > 0 ) )41 foreach ( $required as $key ) { 42 if ( 43 ( ! array_key_exists( $key, $_POST ) && ! array_key_exists( $key, $_FILES ) ) || 44 ( empty( $_POST[ $key ] ) && ! ( $_FILES[ $key ]['size'] > 0 ) ) 40 45 ) { 41 46 // required field wasn't in $_POST or $_FILES … … 48 53 $return->debug = $_FILES; 49 54 50 if (! empty( $fields_empty ) ) {55 if ( ! empty( $fields_empty ) ) { 51 56 $return->ok = 0; 52 $return->error = __( 'Required fields are missing.', 'wp-libre-form');57 $return->error = __( 'Required fields are missing.', 'wp-libre-form' ); 53 58 $return->fields_empty = $fields_empty; 54 59 } … … 56 61 return $return; 57 62 } 58 -
wp-libre-form/tags/1.2.2/readme.md
r1640733 r1648101 1 1 # WP Libre Form 2 [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form)2 [](https://travis-ci.org/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) [](https://packagist.org/packages/anttiviljami/wp-libre-form) 3 3 4 4 Use standard HTML5 markup to create fully functional forms for WordPress … … 88 88 ```php 89 89 wp_enqueue_script('wplf-form-js'); 90 wp_localize_script( 'wplf-form-js', 'ajax_object', array( 90 wp_localize_script( 'wplf-form-js', 'ajax_object', array( 91 91 'ajax_url' => admin_url( 'admin-ajax.php' ), 92 92 'ajax_credentials' => apply_filters('wplf_frontend_script_credentials', 'same-origin') -
wp-libre-form/tags/1.2.2/readme.txt
r1640736 r1648101 4 4 Donate link: https://github.com/anttiviljami 5 5 Requires at least: 4.2 6 Tested up to: 4.7. 37 Stable tag: 1. 2.36 Tested up to: 4.7.4 7 Stable tag: 1.3 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
wp-libre-form/tags/1.2.2/wp-libre-form.php
r1640734 r1648101 4 4 * Plugin URI: https://github.com/anttiviljami/wp-libre-form 5 5 * Description: A minimal HTML form builder for WordPress; made for developers 6 * Version: 1. 2.36 * Version: 1.3 7 7 * Author: @anttiviljami 8 8 * Author URI: https://github.com/anttiviljami/ … … 32 32 if ( ! class_exists( 'WP_Libre_Form' ) ) : 33 33 34 define( 'WPLF_VERSION', '1. 2.3' );34 define( 'WPLF_VERSION', '1.3' ); 35 35 36 36 class WP_Libre_Form { … … 57 57 CPT_WPLF_Submission::init(); 58 58 59 add_action( 'after_setup_theme', function() { 60 if ( apply_filters( 'wplf_load_polylang', true ) ) { 61 require_once 'classes/class-wplf-polylang.php'; 62 WPLF_Polylang::init(); 63 } 64 } ); 59 add_action( 'after_setup_theme', array( $this, 'init_polylang_support' ) ); 65 60 66 61 add_action( 'plugins_loaded', array( $this, 'load_our_textdomain' ) ); … … 85 80 public static function load_our_textdomain() { 86 81 $loaded = load_plugin_textdomain( 'wp-libre-form', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); 82 if ( ! $loaded ) { 83 $loaded = load_muplugin_textdomain( 'wp-libre-form', dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); 84 } 85 } 87 86 88 if( !$loaded ) { 89 $loaded = load_muplugin_textdomain( 'wp-libre-form', dirname( plugin_basename( __FILE__ ) ) . '/lang/' ); 87 /** 88 * Enable Polylang support 89 */ 90 public function init_polylang_support() { 91 if ( apply_filters( 'wplf_load_polylang', true ) ) { 92 require_once 'classes/class-wplf-polylang.php'; 93 WPLF_Polylang::init(); 90 94 } 91 95 }
Note: See TracChangeset
for help on using the changeset viewer.