Plugin Directory

Changeset 1538409


Ignore:
Timestamp:
11/22/2016 02:06:26 PM (9 years ago)
Author:
Zuige
Message:

Release version 1.2

Location:
wp-libre-form
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wp-libre-form/tags/1.2/assets/scripts/wplf-form.js

    r1522309 r1538409  
    1414window.wplf = {
    1515  successCallbacks: [],
    16   errorCallbacks: []
    17 };
     16  errorCallbacks: [],
     17  attach: function(form){
     18    // form is a selector
     19    if (typeof form == 'string')
     20      form = document.querySelectorAll(form);
    1821
    19 document.addEventListener("DOMContentLoaded", function(){
    20   [].forEach.call(document.querySelectorAll(".libre-form"), function(form){
     22    // form is an array of elements or a node list
     23    if (form.constructor === Array || form.constructor === NodeList){
     24      [].forEach.call(form, function(form){
     25        window.wplf.attach(form);
     26      });
     27      return;
     28    }
    2129
    2230    form.addEventListener("submit", function(e){
     
    92100    });
    93101
    94   });
     102  }
     103}
     104
     105document.addEventListener("DOMContentLoaded", function(){
     106  [].forEach.call(document.querySelectorAll(".libre-form"), wplf.attach);
    95107});
    96108})();
  • wp-libre-form/tags/1.2/classes/class-cpt-wplf-form.php

    r1522426 r1538409  
    162162?>
    163163<label for="name"><?php _e( 'Please enter your name', 'wp-libre-form' ); ?></label>
    164 <input type="text" name="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
     164<input type="text" name="name" id="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
    165165
    166166<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" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
     167<input type="email" name="email" id="email" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
    168168
    169169<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" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
     170<textarea name="message" rows="5" id="message" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
    171171
    172172<button type="submit"><?php _e( 'Submit', 'wp-libre-form' ); ?></button>
  • wp-libre-form/tags/1.2/inc/wplf-form-actions.php

    r1522309 r1538409  
    2626        continue;
    2727      }
     28      if( is_array( $value ) ) { // in case input type="radio" submits an array
     29        $value = implode( ', ', $value );
     30      }
    2831      $content .= esc_html( $key ) . ': ' . esc_html( print_r( $value, true ) ) . "\n";
    2932    }
  • wp-libre-form/tags/1.2/readme.md

    r1522426 r1538409  
    186186}
    187187```
     188
     189### Multilingual
     190
     191You can create multilingual forms using Polylang. WPLF will register and automatically fetch the translation when you use special template tags.
     192
     193Example:
     194```html
     195<input type="text" placeholder="{{ Test string  }}" name="test">
     196```
     197
     198You can also disable this feature, and create your own middleware for WPML, if you'd like.
     199
     200```php
     201add_filter( 'wplf_load_polylang' , function() {
     202  return false;
     203} );
     204```
  • wp-libre-form/tags/1.2/readme.txt

    r1522463 r1538409  
    55Requires at least: 4.2
    66Tested up to: 4.6.1
    7 Stable tag: 1.1.2
     7Stable tag: 1.2
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • wp-libre-form/tags/1.2/vendor/autoload.php

    r1450039 r1538409  
    33// autoload.php @generated by Composer
    44
    5 require_once __DIR__ . '/composer' . '/autoload_real.php';
     5require_once __DIR__ . '/composer/autoload_real.php';
    66
    77return ComposerAutoloaderInit07db012aabccf1e5cc16ff54e8f0754a::getLoader();
  • wp-libre-form/tags/1.2/vendor/composer/ClassLoader.php

    r1450039 r1538409  
    5454    private $useIncludePath = false;
    5555    private $classMap = array();
    56 
    5756    private $classMapAuthoritative = false;
     57    private $missingClasses = array();
    5858
    5959    public function getPrefixes()
     
    323323            return $this->classMap[$class];
    324324        }
    325         if ($this->classMapAuthoritative) {
     325        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
    326326            return false;
    327327        }
     
    330330
    331331        // Search for Hack files if we are running on HHVM
    332         if ($file === null && defined('HHVM_VERSION')) {
     332        if (false === $file && defined('HHVM_VERSION')) {
    333333            $file = $this->findFileWithExtension($class, '.hh');
    334334        }
    335335
    336         if ($file === null) {
     336        if (false === $file) {
    337337            // Remember that this class does not exist.
    338             return $this->classMap[$class] = false;
     338            $this->missingClasses[$class] = true;
    339339        }
    340340
     
    400400            return $file;
    401401        }
     402
     403        return false;
    402404    }
    403405}
  • wp-libre-form/tags/1.2/wp-libre-form.php

    r1522463 r1538409  
    44 * Plugin URI: https://github.com/anttiviljami/wp-libre-form
    55 * Description: A minimal HTML form builder for WordPress; made for developers
    6  * Version: 1.1.2
     6 * Version: 1.2
    77 * Author: @anttiviljami
    88 * Author URI: https://github.com/anttiviljami/
     
    3232if ( ! class_exists( 'WP_Libre_Form' ) ) :
    3333
    34 define( 'WPLF_VERSION', '1.1.2' );
     34define( 'WPLF_VERSION', '1.2' );
    3535
    3636class WP_Libre_Form {
     
    5656    CPT_WPLF_Form::init();
    5757    CPT_WPLF_Submission::init();
     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    } );
    5865
    5966    add_action( 'plugins_loaded', array( $this, 'load_our_textdomain' ) );
  • wp-libre-form/trunk/assets/scripts/wplf-form.js

    r1522309 r1538409  
    1414window.wplf = {
    1515  successCallbacks: [],
    16   errorCallbacks: []
    17 };
     16  errorCallbacks: [],
     17  attach: function(form){
     18    // form is a selector
     19    if (typeof form == 'string')
     20      form = document.querySelectorAll(form);
    1821
    19 document.addEventListener("DOMContentLoaded", function(){
    20   [].forEach.call(document.querySelectorAll(".libre-form"), function(form){
     22    // form is an array of elements or a node list
     23    if (form.constructor === Array || form.constructor === NodeList){
     24      [].forEach.call(form, function(form){
     25        window.wplf.attach(form);
     26      });
     27      return;
     28    }
    2129
    2230    form.addEventListener("submit", function(e){
     
    92100    });
    93101
    94   });
     102  }
     103}
     104
     105document.addEventListener("DOMContentLoaded", function(){
     106  [].forEach.call(document.querySelectorAll(".libre-form"), wplf.attach);
    95107});
    96108})();
  • wp-libre-form/trunk/classes/class-cpt-wplf-form.php

    r1522426 r1538409  
    162162?>
    163163<label for="name"><?php _e( 'Please enter your name', 'wp-libre-form' ); ?></label>
    164 <input type="text" name="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
     164<input type="text" name="name" id="name" placeholder="<?php _ex( 'John Doe', 'Default placeholder name', 'wp-libre-form' ); ?>">
    165165
    166166<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" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
     167<input type="email" name="email" id="email" placeholder="<?php _ex( 'example@email.com', 'Default placeholder email', 'wp-libre-form' ); ?>" required>
    168168
    169169<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" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
     170<textarea name="message" rows="5" id="message" placeholder="<?php _ex( 'I wanted to ask about...', 'Default placeholder message', 'wp-libre-form' ); ?>" required></textarea>
    171171
    172172<button type="submit"><?php _e( 'Submit', 'wp-libre-form' ); ?></button>
  • wp-libre-form/trunk/inc/wplf-form-actions.php

    r1522309 r1538409  
    2626        continue;
    2727      }
     28      if( is_array( $value ) ) { // in case input type="radio" submits an array
     29        $value = implode( ', ', $value );
     30      }
    2831      $content .= esc_html( $key ) . ': ' . esc_html( print_r( $value, true ) ) . "\n";
    2932    }
  • wp-libre-form/trunk/readme.md

    r1522426 r1538409  
    186186}
    187187```
     188
     189### Multilingual
     190
     191You can create multilingual forms using Polylang. WPLF will register and automatically fetch the translation when you use special template tags.
     192
     193Example:
     194```html
     195<input type="text" placeholder="{{ Test string  }}" name="test">
     196```
     197
     198You can also disable this feature, and create your own middleware for WPML, if you'd like.
     199
     200```php
     201add_filter( 'wplf_load_polylang' , function() {
     202  return false;
     203} );
     204```
  • wp-libre-form/trunk/readme.txt

    r1522463 r1538409  
    55Requires at least: 4.2
    66Tested up to: 4.6.1
    7 Stable tag: 1.1.2
     7Stable tag: 1.2
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
  • wp-libre-form/trunk/vendor/autoload.php

    r1450039 r1538409  
    33// autoload.php @generated by Composer
    44
    5 require_once __DIR__ . '/composer' . '/autoload_real.php';
     5require_once __DIR__ . '/composer/autoload_real.php';
    66
    77return ComposerAutoloaderInit07db012aabccf1e5cc16ff54e8f0754a::getLoader();
  • wp-libre-form/trunk/vendor/composer/ClassLoader.php

    r1450039 r1538409  
    5454    private $useIncludePath = false;
    5555    private $classMap = array();
    56 
    5756    private $classMapAuthoritative = false;
     57    private $missingClasses = array();
    5858
    5959    public function getPrefixes()
     
    323323            return $this->classMap[$class];
    324324        }
    325         if ($this->classMapAuthoritative) {
     325        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
    326326            return false;
    327327        }
     
    330330
    331331        // Search for Hack files if we are running on HHVM
    332         if ($file === null && defined('HHVM_VERSION')) {
     332        if (false === $file && defined('HHVM_VERSION')) {
    333333            $file = $this->findFileWithExtension($class, '.hh');
    334334        }
    335335
    336         if ($file === null) {
     336        if (false === $file) {
    337337            // Remember that this class does not exist.
    338             return $this->classMap[$class] = false;
     338            $this->missingClasses[$class] = true;
    339339        }
    340340
     
    400400            return $file;
    401401        }
     402
     403        return false;
    402404    }
    403405}
  • wp-libre-form/trunk/wp-libre-form.php

    r1522463 r1538409  
    44 * Plugin URI: https://github.com/anttiviljami/wp-libre-form
    55 * Description: A minimal HTML form builder for WordPress; made for developers
    6  * Version: 1.1.2
     6 * Version: 1.2
    77 * Author: @anttiviljami
    88 * Author URI: https://github.com/anttiviljami/
     
    3232if ( ! class_exists( 'WP_Libre_Form' ) ) :
    3333
    34 define( 'WPLF_VERSION', '1.1.2' );
     34define( 'WPLF_VERSION', '1.2' );
    3535
    3636class WP_Libre_Form {
     
    5656    CPT_WPLF_Form::init();
    5757    CPT_WPLF_Submission::init();
     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    } );
    5865
    5966    add_action( 'plugins_loaded', array( $this, 'load_our_textdomain' ) );
Note: See TracChangeset for help on using the changeset viewer.