Plugin Directory

Changeset 2031437


Ignore:
Timestamp:
02/15/2019 01:35:14 PM (7 years ago)
Author:
infracontentools
Message:

Added token generation button

Location:
wp-contentools/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • wp-contentools/trunk/admin/class-contentools-admin.php

    r1953422 r2031437  
    9797         */
    9898
     99        wp_enqueue_script( $this->plugin_name."-md5", plugin_dir_url( __FILE__ ) . 'js/md5.js', array( 'jquery' ), $this->version, false );
    99100        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/contentools-admin.js', array( 'jquery' ), $this->version, false );
    100101
  • wp-contentools/trunk/admin/js/contentools-admin.js

    r1917656 r2031437  
    2828     * Although scripts in the WordPress core, Plugins and Themes may be
    2929     * practising this, we should strive to set a better example in our own work.
    30      */
     30    */
     31
     32    function generateHash(s){
     33        return rstr2b64(hex_md5(hex_md5(s)));
     34    }
     35
     36    $(document).on('click', '#contentools-generate-token', function(){
     37        var random = Math.random(11111111111111111111,99999999999999999999);
     38        var d = new Date();
     39        var token = "";
     40        token = token.concat(
     41            random, d.getHours(), d.getMinutes(),
     42            d.getSeconds(), d.getHours(), random,
     43            d.getMinutes(), d.getDay(), d.getSeconds(),
     44            random
     45        );
     46        $('#contentools-token').val(generateHash(token))
     47    });
     48
     49    $(document).on('click', '#contentools-clear-token', function(){
     50        $('#contentools-token').val("")
     51    });
    3152
    3253})( jQuery );
  • wp-contentools/trunk/admin/partials/contentools-admin-display.php

    r1953422 r2031437  
    3232    <tr class="<?php echo $this->plugin_name; ?>-token-wrap">
    3333        <th scope="row"><label for="<?php echo $this->plugin_name; ?>-token"><?php _e( 'Integration Token', $this->plugin_name ); ?></label></th>
    34         <td><input type="text" name="<?php echo $this->plugin_name; ?>[token]" id="<?php echo $this->plugin_name; ?>-token" value="<?php if(!empty($options['token'])) esc_attr_e($options['token']); ?>" class="regular-text" /></td>
    35     </tr>
     34        <td>
     35            <input
     36                readonly="true"
     37                type="text"
     38                name="<?php echo $this->plugin_name; ?>[token]"
     39                id="<?php echo $this->plugin_name; ?>-token"
     40                value="<?php if(!empty($options['token'])) esc_attr_e($options['token']); ?>"
     41                class="regular-text; form-input"
     42                style="width:400px; height:28px;" />
     43            <input
     44                type="button"
     45                name="<?php echo $this->plugin_name; ?>[generate-token]"
     46                id="<?php echo $this->plugin_name; ?>-generate-token"
     47                class="button"
     48                value="Generate Token" />
     49            <input
     50                type="button"
     51                name="<?php echo $this->plugin_name; ?>[clear-token]"
     52                id="<?php echo $this->plugin_name; ?>-clear-token"
     53                class="button"
     54                value="Clear Token" />
     55        </td>
     56    </tr>
    3657</table>
    3758
  • wp-contentools/trunk/contentools.php

    r1953426 r2031437  
    1717 * Plugin URI:        https://github.com/contentools/wordpress-plugin/
    1818 * Description:       This plugin enables the integration between the Contentools Platform and Wordpress.
    19  * Version:           3.0.4
     19 * Version:           3.0.5
    2020 * Author:            Contentools
    2121 * Author URI:        https://contentools.com/
    2222 * License:           GPL-2.0+
    23  * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     23 * License URI:       https://www.gnu.org/licenses/gpl-2.0.txt
    2424 * Text Domain:       contentools
    2525 * Domain Path:       /languages
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'PLUGIN_NAME_VERSION', '3.0.4' );
     38define( 'PLUGIN_NAME_VERSION', '3.0.5' );
    3939
    4040/**
  • wp-contentools/trunk/readme.txt

    r1953426 r2031437  
    55Requires at least: 4.6
    66Tested up to: 4.9.6
    7 Stable tag: 3.0.4
     7Stable tag: 3.0.5
    88Requires PHP: 5.6
    99License: GPLv2 or later
     
    5151
    5252== Changelog ==
     53= 3.0.5 =
     54* Token auto generated
     55
    5356= 3.0.4 =
    5457* HTTPS update
Note: See TracChangeset for help on using the changeset viewer.