Changeset 1734198
- Timestamp:
- 09/22/2017 10:17:31 AM (9 years ago)
- Location:
- wp-libre-form
- Files:
-
- 24 edited
- 1 copied
-
tags/1.2.3 (copied) (copied from wp-libre-form/trunk)
-
tags/1.2.3/assets/scripts/wplf-form.js (modified) (1 diff)
-
tags/1.2.3/classes/class-cpt-wplf-form.php (modified) (6 diffs)
-
tags/1.2.3/classes/class-cpt-wplf-submission.php (modified) (2 diffs)
-
tags/1.2.3/classes/class-wplf-polylang.php (modified) (3 diffs)
-
tags/1.2.3/inc/wplf-ajax.php (modified) (2 diffs)
-
tags/1.2.3/inc/wplf-form-actions.php (modified) (2 diffs)
-
tags/1.2.3/phpcs.xml (modified) (2 diffs)
-
tags/1.2.3/readme.md (modified) (2 diffs)
-
tags/1.2.3/readme.txt (modified) (1 diff)
-
tags/1.2.3/vendor/composer/ClassLoader.php (modified) (6 diffs)
-
tags/1.2.3/vendor/composer/LICENSE (modified) (1 diff)
-
tags/1.2.3/wp-libre-form.php (modified) (3 diffs)
-
trunk/assets/scripts/wplf-form.js (modified) (1 diff)
-
trunk/classes/class-cpt-wplf-form.php (modified) (6 diffs)
-
trunk/classes/class-cpt-wplf-submission.php (modified) (2 diffs)
-
trunk/classes/class-wplf-polylang.php (modified) (3 diffs)
-
trunk/inc/wplf-ajax.php (modified) (2 diffs)
-
trunk/inc/wplf-form-actions.php (modified) (2 diffs)
-
trunk/phpcs.xml (modified) (2 diffs)
-
trunk/readme.md (modified) (2 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/vendor/composer/ClassLoader.php (modified) (6 diffs)
-
trunk/vendor/composer/LICENSE (modified) (1 diff)
-
trunk/wp-libre-form.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-libre-form/tags/1.2.3/assets/scripts/wplf-form.js
r1652323 r1734198 16 16 var form = e.target; 17 17 var data = new FormData(form); 18 19 // Pass language if it exists. 20 ajax_object.lang && data.append('lang', ajax_object.lang); 21 18 22 // add class to enable css changes to indicate ajax loading 19 23 form.classList.add("sending"); -
wp-libre-form/tags/1.2.3/classes/class-cpt-wplf-form.php
r1652323 r1734198 19 19 * Hook our actions, filters and such 20 20 */ 21 p rivatefunction __construct() {21 public function __construct() { 22 22 // init custom post type 23 23 add_action( 'init', array( $this, 'register_cpt' ) ); … … 386 386 ?> 387 387 <p><?php esc_html_e( 'Submissions from this form will use this formatting in their title.', 'wp-libre-form' ); ?></p> 388 <p><?php esc_html_e( 'You may use any field values enclosed in "%" markers.', 'wp-libre-form' ); ?></p>388 <p><?php esc_html_e( 'You may use any field values enclosed in "%" markers.', 'wp-libre-form' ); ?></p> 389 389 <p> 390 390 <input … … 424 424 // save success message 425 425 if ( isset( $_POST['wplf_thank_you'] ) ) { 426 update_post_meta( $post_id, '_wplf_thank_you', wp_kses_post( $_POST['wplf_thank_you'] ) ); 426 $success = wp_kses_post( $_POST['wplf_thank_you'] ); 427 $success = apply_filters( 'wplf_save_success_message', $success, $post_id ); 428 update_post_meta( $post_id, '_wplf_thank_you', $success ); 427 429 } 428 430 … … 541 543 <p style="background:#f5f5f5;border-left:4px solid #dc3232;padding:6px 12px;"> 542 544 <strong style="color:#dc3232;"> 543 <?php esc_html_e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ) ?>545 <?php esc_html_e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ); ?> 544 546 </strong> 545 547 <br /> 546 <?php esc_html_e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ) ?>548 <?php esc_html_e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ); ?> 547 549 </p> 548 550 <?php endif; ?> … … 555 557 ?> 556 558 <input type="hidden" name="referrer" value="<?php the_permalink(); ?>"> 557 <input type="hidden" name="_referrer_id" value="<?php echo esc_attr( get_the_id() ) ?>">559 <input type="hidden" name="_referrer_id" value="<?php echo esc_attr( get_the_id() ); ?>"> 558 560 <input type="hidden" name="_form_id" value="<?php echo esc_attr( $id ); ?>"> 559 561 </form> … … 588 590 589 591 // add dynamic variables to the script's scope 590 wp_localize_script( 'wplf-form-js', 'ajax_object', a rray(592 wp_localize_script( 'wplf-form-js', 'ajax_object', apply_filters( 'wplf_ajax_object', array( 591 593 'ajax_url' => admin_url( 'admin-ajax.php' ), 592 594 'ajax_credentials' => apply_filters( 'wplf_ajax_fetch_credentials_mode', 'same-origin' ), 593 ) ) ;595 ) ) ); 594 596 } 595 597 -
wp-libre-form/tags/1.2.3/classes/class-cpt-wplf-submission.php
r1648110 r1734198 19 19 * Hook our actions, filters and such 20 20 */ 21 p rivatefunction __construct() {21 public function __construct() { 22 22 // init custom post type 23 23 add_action( 'init', array( $this, 'register_cpt' ) ); … … 264 264 // Show a link if the field corresponds to a URL 265 265 // assume values starting with '/' are root relative URLs and should be handled as links 266 $value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL ); 266 $value_is_url = false; 267 if ( strlen( $value ) > 0 ) { 268 $value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL ); 269 } 267 270 if ( $value_is_url ) { 268 271 $link_text = __( 'Open Link', 'wp-libre-form' ); -
wp-libre-form/tags/1.2.3/classes/class-wplf-polylang.php
r1648100 r1734198 2 2 if ( ! class_exists( 'WPLF_Polylang' ) ) { 3 3 class WPLF_Polylang { 4 /** 5 * CPT for the forms 6 */ 4 7 5 public static $instance; 8 6 protected $regular_expression = "/{{[^{}\n]+}}/"; … … 19 17 * Hook our actions, filters and such 20 18 */ 21 p rivatefunction __construct() {19 public function __construct() { 22 20 add_filter( 'wplf_form', array( $this, 'render_form' ) ); 23 21 add_filter( 'save_post_wplf-form', array( $this, 'save_form' ), 10, 3 ); 24 22 add_action( 'after_setup_theme', array( $this, 'register_strings' ) ); 23 24 // Earlier than default. User probably wants to filter the translated message. 25 add_action( 'wplf_success_message', array( $this, 'render_success_message' ), 9 ); 26 add_action( 'wplf_save_success_message', array( $this, 'save_success_message' ) ); 27 add_action( 'wplf_ajax_object', array( $this, 'ajax_object' ) ); 25 28 26 29 $this->strings = get_option( 'wplf-translation-strings', array() ); … … 56 59 } 57 60 61 public function render_success_message( $message ) { 62 // Get all strings inside double curly braces. 63 preg_match_all( $this->regular_expression, $message, $matches ); 64 foreach ( $matches[0] as $match ) { 65 // match contains the braces, get rid of them. 66 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 67 $message = str_replace( $match, $this->translate_string( $string ), $message ); 68 } 69 70 return $message; 71 } 72 73 public function save_success_message( $message ) { 74 preg_match_all( $this->regular_expression, $message, $matches ); 75 if ( ! empty( $matches ) ) { 76 foreach ( $matches[0] as $match ) { 77 // match contains the braces, get rid of them. 78 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 79 $this->strings[ $string ] = null; 80 // By storing the string as the array key, we don't need to use array_unique. 81 } 82 } 83 84 update_option( 'wplf-translation-strings', $this->strings ); // Let's be optimistic. 85 86 return $message; 87 } 88 89 public function ajax_object( $array ) { 90 $array['lang'] = pll_current_language(); 91 return $array; 92 } 93 58 94 public function register_strings() { 59 95 foreach ( $this->strings as $string => $value ) { -
wp-libre-form/tags/1.2.3/inc/wplf-ajax.php
r1652323 r1734198 66 66 'test_form' => false, 67 67 ) ); 68 add_post_meta( $post_id, $key, wp_get_attachment_url( $attach_id ) ); 69 add_post_meta( $post_id, $key . '_attachment', $attach_id ); 68 69 if ( ! is_wp_error( $attach_id ) ) { 70 add_post_meta( $post_id, $key, wp_get_attachment_url( $attach_id ) ); 71 add_post_meta( $post_id, $key . '_attachment', $attach_id ); 72 } 70 73 } 71 74 … … 79 82 $return->form_id = $form->ID; 80 83 84 $success = get_post_meta( $form->ID, '_wplf_thank_you', true ); 85 $success = apply_filters( "wplf_{$form->post_name}_success_message", $success ); 86 $success = apply_filters( "wplf_{$form->ID}_success_message", $success ); 87 $success = apply_filters( 'wplf_success_message', $success ); 88 81 89 // return the success message for the form 82 $return->success = apply_filters( 'the_content', get_post_meta( $form->ID, '_wplf_thank_you', true ) );90 $return->success = $success; 83 91 84 92 // allow user to attach custom actions after the submission has been received -
wp-libre-form/tags/1.2.3/inc/wplf-form-actions.php
r1652323 r1734198 75 75 $content = apply_filters( "wplf_{$form->post_name}_email_copy_content", $content ); 76 76 $headers = apply_filters( "wplf_{$form->post_name}_email_copy_headers", $headers ); 77 $attachments = apply_filters( "wplf_{$form->post_name}_email_copy_attachments", $attachment );77 $attachments = apply_filters( "wplf_{$form->post_name}_email_copy_attachments", $attachments ); 78 78 79 79 // form ID specific filters … … 82 82 $content = apply_filters( "wplf_{$form->ID}_email_copy_content", $content ); 83 83 $headers = apply_filters( "wplf_{$form->ID}_email_copy_headers", $headers ); 84 $attachments = apply_filters( "wplf_{$form->ID}_email_copy_attachments", $attachment );84 $attachments = apply_filters( "wplf_{$form->ID}_email_copy_attachments", $attachments ); 85 85 86 86 wp_mail( $to, $subject, $content, $headers, $attachments ); -
wp-libre-form/tags/1.2.3/phpcs.xml
r1648100 r1734198 101 101 <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" /> 102 102 103 <!-- <?php doesn't have to be on its own line --> 104 <exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" /> 105 <exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" /> 106 107 <!-- Squiz.PHP.EmbeddedPhp.ContentBeforeEnd --> 108 <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" /> 109 103 110 <!-- These indentation rules are just wrong :) --> 104 111 <exclude name="PEAR.Functions.FunctionCallSignature.Indent" /> … … 119 126 <exclude name="WordPress.Files.FileName.InvalidClassFileName" /> 120 127 128 <!-- This one is just weird. --> 129 <exclude name="WordPress.Arrays.ArrayIndentation" /> 130 121 131 </rule> 122 132 </ruleset> -
wp-libre-form/tags/1.2.3/readme.md
r1652323 r1734198 138 138 add_action( 'wplf_post_validate_submission', 'my_email_thankyou' ); 139 139 function my_email_thankyou( $return ) { 140 // recipient details from submission 140 141 $name = sanitize_text_field( $_POST['name'] ); 141 142 $email = sanitize_email( $_POST['email'] ); 142 $to = "\"$name\" <$email>"; 143 144 // email subject 143 145 $subject = __( 'Thank You For Submitting A Form' ); 144 $content = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name ); 145 wp_mail( $to, $subject, $content ); 146 147 // text body of email 148 $body = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name ); 149 150 // send the email 151 wp_mail( $email, $subject, $body ); 146 152 } 147 153 ``` … … 159 165 160 166 These callbacks are executed in the order they appear. 167 168 To avoid running your JavaScript too early, add `wplf-form-js` to your enqueue dependencies: 169 ```php 170 wp_enqueue_script( "themejs", "/path/to/theme.js", array( "wplf-form-js" ), ... ); 171 ``` 172 Otherwise you might run into errors like "Cannot read property 'push' of undefined". 161 173 162 174 ## Multilingual -
wp-libre-form/tags/1.2.3/readme.txt
r1652327 r1734198 5 5 Requires at least: 4.2 6 6 Tested up to: 4.7.4 7 Stable tag: 1.4 7 Stable tag: 1.4.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
wp-libre-form/tags/1.2.3/vendor/composer/ClassLoader.php
r1538409 r1734198 56 56 private $classMapAuthoritative = false; 57 57 private $missingClasses = array(); 58 private $apcuPrefix; 58 59 59 60 public function getPrefixes() … … 273 274 274 275 /** 276 * APCu prefix to use to cache found/not-found classes, if the extension is enabled. 277 * 278 * @param string|null $apcuPrefix 279 */ 280 public function setApcuPrefix($apcuPrefix) 281 { 282 $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; 283 } 284 285 /** 286 * The APCu prefix in use, or null if APCu caching is not enabled. 287 * 288 * @return string|null 289 */ 290 public function getApcuPrefix() 291 { 292 return $this->apcuPrefix; 293 } 294 295 /** 275 296 * Registers this instance as an autoloader. 276 297 * … … 314 335 public function findFile($class) 315 336 { 316 // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731317 if ('\\' == $class[0]) {318 $class = substr($class, 1);319 }320 321 337 // class map lookup 322 338 if (isset($this->classMap[$class])) { … … 326 342 return false; 327 343 } 344 if (null !== $this->apcuPrefix) { 345 $file = apcu_fetch($this->apcuPrefix.$class, $hit); 346 if ($hit) { 347 return $file; 348 } 349 } 328 350 329 351 $file = $this->findFileWithExtension($class, '.php'); … … 334 356 } 335 357 358 if (null !== $this->apcuPrefix) { 359 apcu_add($this->apcuPrefix.$class, $file); 360 } 361 336 362 if (false === $file) { 337 363 // Remember that this class does not exist. … … 349 375 $first = $class[0]; 350 376 if (isset($this->prefixLengthsPsr4[$first])) { 351 foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { 352 if (0 === strpos($class, $prefix)) { 353 foreach ($this->prefixDirsPsr4[$prefix] as $dir) { 377 $subPath = $class; 378 while (false !== $lastPos = strrpos($subPath, '\\')) { 379 $subPath = substr($subPath, 0, $lastPos); 380 $search = $subPath.'\\'; 381 if (isset($this->prefixDirsPsr4[$search])) { 382 foreach ($this->prefixDirsPsr4[$search] as $dir) { 383 $length = $this->prefixLengthsPsr4[$first][$search]; 354 384 if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { 355 385 return $file; -
wp-libre-form/tags/1.2.3/vendor/composer/LICENSE
r1450039 r1734198 1 1 2 Copyright (c) 2016Nils Adermann, Jordi Boggiano2 Copyright (c) Nils Adermann, Jordi Boggiano 3 3 4 4 Permission is hereby granted, free of charge, to any person obtaining a copy -
wp-libre-form/tags/1.2.3/wp-libre-form.php
r1652323 r1734198 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.4 6 * Version: 1.4.1 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.4 ' );34 define( 'WPLF_VERSION', '1.4.1' ); 35 35 36 36 class WP_Libre_Form { … … 89 89 */ 90 90 public function init_polylang_support() { 91 if ( apply_filters( 'wplf_load_polylang', true ) ) {91 if ( apply_filters( 'wplf_load_polylang', true ) && class_exists( 'Polylang' ) ) { 92 92 require_once 'classes/class-wplf-polylang.php'; 93 93 WPLF_Polylang::init(); -
wp-libre-form/trunk/assets/scripts/wplf-form.js
r1652323 r1734198 16 16 var form = e.target; 17 17 var data = new FormData(form); 18 19 // Pass language if it exists. 20 ajax_object.lang && data.append('lang', ajax_object.lang); 21 18 22 // add class to enable css changes to indicate ajax loading 19 23 form.classList.add("sending"); -
wp-libre-form/trunk/classes/class-cpt-wplf-form.php
r1652323 r1734198 19 19 * Hook our actions, filters and such 20 20 */ 21 p rivatefunction __construct() {21 public function __construct() { 22 22 // init custom post type 23 23 add_action( 'init', array( $this, 'register_cpt' ) ); … … 386 386 ?> 387 387 <p><?php esc_html_e( 'Submissions from this form will use this formatting in their title.', 'wp-libre-form' ); ?></p> 388 <p><?php esc_html_e( 'You may use any field values enclosed in "%" markers.', 'wp-libre-form' ); ?></p>388 <p><?php esc_html_e( 'You may use any field values enclosed in "%" markers.', 'wp-libre-form' ); ?></p> 389 389 <p> 390 390 <input … … 424 424 // save success message 425 425 if ( isset( $_POST['wplf_thank_you'] ) ) { 426 update_post_meta( $post_id, '_wplf_thank_you', wp_kses_post( $_POST['wplf_thank_you'] ) ); 426 $success = wp_kses_post( $_POST['wplf_thank_you'] ); 427 $success = apply_filters( 'wplf_save_success_message', $success, $post_id ); 428 update_post_meta( $post_id, '_wplf_thank_you', $success ); 427 429 } 428 430 … … 541 543 <p style="background:#f5f5f5;border-left:4px solid #dc3232;padding:6px 12px;"> 542 544 <strong style="color:#dc3232;"> 543 <?php esc_html_e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ) ?>545 <?php esc_html_e( 'This form preview URL is not public and cannot be shared.', 'wp-libre-form' ); ?> 544 546 </strong> 545 547 <br /> 546 <?php esc_html_e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ) ?>548 <?php esc_html_e( 'Non-logged in visitors will see a 404 error page instead.', 'wp-libre-form' ); ?> 547 549 </p> 548 550 <?php endif; ?> … … 555 557 ?> 556 558 <input type="hidden" name="referrer" value="<?php the_permalink(); ?>"> 557 <input type="hidden" name="_referrer_id" value="<?php echo esc_attr( get_the_id() ) ?>">559 <input type="hidden" name="_referrer_id" value="<?php echo esc_attr( get_the_id() ); ?>"> 558 560 <input type="hidden" name="_form_id" value="<?php echo esc_attr( $id ); ?>"> 559 561 </form> … … 588 590 589 591 // add dynamic variables to the script's scope 590 wp_localize_script( 'wplf-form-js', 'ajax_object', a rray(592 wp_localize_script( 'wplf-form-js', 'ajax_object', apply_filters( 'wplf_ajax_object', array( 591 593 'ajax_url' => admin_url( 'admin-ajax.php' ), 592 594 'ajax_credentials' => apply_filters( 'wplf_ajax_fetch_credentials_mode', 'same-origin' ), 593 ) ) ;595 ) ) ); 594 596 } 595 597 -
wp-libre-form/trunk/classes/class-cpt-wplf-submission.php
r1648110 r1734198 19 19 * Hook our actions, filters and such 20 20 */ 21 p rivatefunction __construct() {21 public function __construct() { 22 22 // init custom post type 23 23 add_action( 'init', array( $this, 'register_cpt' ) ); … … 264 264 // Show a link if the field corresponds to a URL 265 265 // assume values starting with '/' are root relative URLs and should be handled as links 266 $value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL ); 266 $value_is_url = false; 267 if ( strlen( $value ) > 0 ) { 268 $value_is_url = $value[0] === '/' ? true : filter_var( $value, FILTER_VALIDATE_URL ); 269 } 267 270 if ( $value_is_url ) { 268 271 $link_text = __( 'Open Link', 'wp-libre-form' ); -
wp-libre-form/trunk/classes/class-wplf-polylang.php
r1648100 r1734198 2 2 if ( ! class_exists( 'WPLF_Polylang' ) ) { 3 3 class WPLF_Polylang { 4 /** 5 * CPT for the forms 6 */ 4 7 5 public static $instance; 8 6 protected $regular_expression = "/{{[^{}\n]+}}/"; … … 19 17 * Hook our actions, filters and such 20 18 */ 21 p rivatefunction __construct() {19 public function __construct() { 22 20 add_filter( 'wplf_form', array( $this, 'render_form' ) ); 23 21 add_filter( 'save_post_wplf-form', array( $this, 'save_form' ), 10, 3 ); 24 22 add_action( 'after_setup_theme', array( $this, 'register_strings' ) ); 23 24 // Earlier than default. User probably wants to filter the translated message. 25 add_action( 'wplf_success_message', array( $this, 'render_success_message' ), 9 ); 26 add_action( 'wplf_save_success_message', array( $this, 'save_success_message' ) ); 27 add_action( 'wplf_ajax_object', array( $this, 'ajax_object' ) ); 25 28 26 29 $this->strings = get_option( 'wplf-translation-strings', array() ); … … 56 59 } 57 60 61 public function render_success_message( $message ) { 62 // Get all strings inside double curly braces. 63 preg_match_all( $this->regular_expression, $message, $matches ); 64 foreach ( $matches[0] as $match ) { 65 // match contains the braces, get rid of them. 66 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 67 $message = str_replace( $match, $this->translate_string( $string ), $message ); 68 } 69 70 return $message; 71 } 72 73 public function save_success_message( $message ) { 74 preg_match_all( $this->regular_expression, $message, $matches ); 75 if ( ! empty( $matches ) ) { 76 foreach ( $matches[0] as $match ) { 77 // match contains the braces, get rid of them. 78 $string = trim( str_replace( array( '{', '}' ), array( '', '' ), $match ) ); 79 $this->strings[ $string ] = null; 80 // By storing the string as the array key, we don't need to use array_unique. 81 } 82 } 83 84 update_option( 'wplf-translation-strings', $this->strings ); // Let's be optimistic. 85 86 return $message; 87 } 88 89 public function ajax_object( $array ) { 90 $array['lang'] = pll_current_language(); 91 return $array; 92 } 93 58 94 public function register_strings() { 59 95 foreach ( $this->strings as $string => $value ) { -
wp-libre-form/trunk/inc/wplf-ajax.php
r1652323 r1734198 66 66 'test_form' => false, 67 67 ) ); 68 add_post_meta( $post_id, $key, wp_get_attachment_url( $attach_id ) ); 69 add_post_meta( $post_id, $key . '_attachment', $attach_id ); 68 69 if ( ! is_wp_error( $attach_id ) ) { 70 add_post_meta( $post_id, $key, wp_get_attachment_url( $attach_id ) ); 71 add_post_meta( $post_id, $key . '_attachment', $attach_id ); 72 } 70 73 } 71 74 … … 79 82 $return->form_id = $form->ID; 80 83 84 $success = get_post_meta( $form->ID, '_wplf_thank_you', true ); 85 $success = apply_filters( "wplf_{$form->post_name}_success_message", $success ); 86 $success = apply_filters( "wplf_{$form->ID}_success_message", $success ); 87 $success = apply_filters( 'wplf_success_message', $success ); 88 81 89 // return the success message for the form 82 $return->success = apply_filters( 'the_content', get_post_meta( $form->ID, '_wplf_thank_you', true ) );90 $return->success = $success; 83 91 84 92 // allow user to attach custom actions after the submission has been received -
wp-libre-form/trunk/inc/wplf-form-actions.php
r1652323 r1734198 75 75 $content = apply_filters( "wplf_{$form->post_name}_email_copy_content", $content ); 76 76 $headers = apply_filters( "wplf_{$form->post_name}_email_copy_headers", $headers ); 77 $attachments = apply_filters( "wplf_{$form->post_name}_email_copy_attachments", $attachment );77 $attachments = apply_filters( "wplf_{$form->post_name}_email_copy_attachments", $attachments ); 78 78 79 79 // form ID specific filters … … 82 82 $content = apply_filters( "wplf_{$form->ID}_email_copy_content", $content ); 83 83 $headers = apply_filters( "wplf_{$form->ID}_email_copy_headers", $headers ); 84 $attachments = apply_filters( "wplf_{$form->ID}_email_copy_attachments", $attachment );84 $attachments = apply_filters( "wplf_{$form->ID}_email_copy_attachments", $attachments ); 85 85 86 86 wp_mail( $to, $subject, $content, $headers, $attachments ); -
wp-libre-form/trunk/phpcs.xml
r1648100 r1734198 101 101 <exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" /> 102 102 103 <!-- <?php doesn't have to be on its own line --> 104 <exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" /> 105 <exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" /> 106 107 <!-- Squiz.PHP.EmbeddedPhp.ContentBeforeEnd --> 108 <exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" /> 109 103 110 <!-- These indentation rules are just wrong :) --> 104 111 <exclude name="PEAR.Functions.FunctionCallSignature.Indent" /> … … 119 126 <exclude name="WordPress.Files.FileName.InvalidClassFileName" /> 120 127 128 <!-- This one is just weird. --> 129 <exclude name="WordPress.Arrays.ArrayIndentation" /> 130 121 131 </rule> 122 132 </ruleset> -
wp-libre-form/trunk/readme.md
r1652323 r1734198 138 138 add_action( 'wplf_post_validate_submission', 'my_email_thankyou' ); 139 139 function my_email_thankyou( $return ) { 140 // recipient details from submission 140 141 $name = sanitize_text_field( $_POST['name'] ); 141 142 $email = sanitize_email( $_POST['email'] ); 142 $to = "\"$name\" <$email>"; 143 144 // email subject 143 145 $subject = __( 'Thank You For Submitting A Form' ); 144 $content = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name ); 145 wp_mail( $to, $subject, $content ); 146 147 // text body of email 148 $body = wp_sprintf( __('Thanks, %s for clicking Submit on this glorious HTML5 Form!'), $name ); 149 150 // send the email 151 wp_mail( $email, $subject, $body ); 146 152 } 147 153 ``` … … 159 165 160 166 These callbacks are executed in the order they appear. 167 168 To avoid running your JavaScript too early, add `wplf-form-js` to your enqueue dependencies: 169 ```php 170 wp_enqueue_script( "themejs", "/path/to/theme.js", array( "wplf-form-js" ), ... ); 171 ``` 172 Otherwise you might run into errors like "Cannot read property 'push' of undefined". 161 173 162 174 ## Multilingual -
wp-libre-form/trunk/readme.txt
r1652327 r1734198 5 5 Requires at least: 4.2 6 6 Tested up to: 4.7.4 7 Stable tag: 1.4 7 Stable tag: 1.4.1 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html -
wp-libre-form/trunk/vendor/composer/ClassLoader.php
r1538409 r1734198 56 56 private $classMapAuthoritative = false; 57 57 private $missingClasses = array(); 58 private $apcuPrefix; 58 59 59 60 public function getPrefixes() … … 273 274 274 275 /** 276 * APCu prefix to use to cache found/not-found classes, if the extension is enabled. 277 * 278 * @param string|null $apcuPrefix 279 */ 280 public function setApcuPrefix($apcuPrefix) 281 { 282 $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; 283 } 284 285 /** 286 * The APCu prefix in use, or null if APCu caching is not enabled. 287 * 288 * @return string|null 289 */ 290 public function getApcuPrefix() 291 { 292 return $this->apcuPrefix; 293 } 294 295 /** 275 296 * Registers this instance as an autoloader. 276 297 * … … 314 335 public function findFile($class) 315 336 { 316 // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731317 if ('\\' == $class[0]) {318 $class = substr($class, 1);319 }320 321 337 // class map lookup 322 338 if (isset($this->classMap[$class])) { … … 326 342 return false; 327 343 } 344 if (null !== $this->apcuPrefix) { 345 $file = apcu_fetch($this->apcuPrefix.$class, $hit); 346 if ($hit) { 347 return $file; 348 } 349 } 328 350 329 351 $file = $this->findFileWithExtension($class, '.php'); … … 334 356 } 335 357 358 if (null !== $this->apcuPrefix) { 359 apcu_add($this->apcuPrefix.$class, $file); 360 } 361 336 362 if (false === $file) { 337 363 // Remember that this class does not exist. … … 349 375 $first = $class[0]; 350 376 if (isset($this->prefixLengthsPsr4[$first])) { 351 foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { 352 if (0 === strpos($class, $prefix)) { 353 foreach ($this->prefixDirsPsr4[$prefix] as $dir) { 377 $subPath = $class; 378 while (false !== $lastPos = strrpos($subPath, '\\')) { 379 $subPath = substr($subPath, 0, $lastPos); 380 $search = $subPath.'\\'; 381 if (isset($this->prefixDirsPsr4[$search])) { 382 foreach ($this->prefixDirsPsr4[$search] as $dir) { 383 $length = $this->prefixLengthsPsr4[$first][$search]; 354 384 if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { 355 385 return $file; -
wp-libre-form/trunk/vendor/composer/LICENSE
r1450039 r1734198 1 1 2 Copyright (c) 2016Nils Adermann, Jordi Boggiano2 Copyright (c) Nils Adermann, Jordi Boggiano 3 3 4 4 Permission is hereby granted, free of charge, to any person obtaining a copy -
wp-libre-form/trunk/wp-libre-form.php
r1652323 r1734198 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.4 6 * Version: 1.4.1 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.4 ' );34 define( 'WPLF_VERSION', '1.4.1' ); 35 35 36 36 class WP_Libre_Form { … … 89 89 */ 90 90 public function init_polylang_support() { 91 if ( apply_filters( 'wplf_load_polylang', true ) ) {91 if ( apply_filters( 'wplf_load_polylang', true ) && class_exists( 'Polylang' ) ) { 92 92 require_once 'classes/class-wplf-polylang.php'; 93 93 WPLF_Polylang::init();
Note: See TracChangeset
for help on using the changeset viewer.