Plugin Directory

Changeset 2348765


Ignore:
Timestamp:
07/30/2020 01:29:59 AM (6 years ago)
Author:
zekinah
Message:

Updates to newer version

Location:
zone-redirect
Files:
73 added
7 edited

Legend:

Unmodified
Added
Removed
  • zone-redirect/trunk/admin/class-zone-redirect-admin.php

    r2327225 r2348765  
    8585        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/zone-redirect-admin.js', array( 'jquery' ), $this->version, false );
    8686        wp_enqueue_script('jquery');
     87        wp_enqueue_script('media-upload');
     88        wp_enqueue_media();
    8789        /* Bootstrap 4 JS */
    8890        wp_enqueue_script('zone-redirect-bootstrap-js', plugin_dir_url(__FILE__) . 'js/bootstrap/bootstrap.min.js', array('jquery'), $this->version);
  • zone-redirect/trunk/admin/js/zone-redirect-admin.js

    r2324856 r2348765  
    1515            ]
    1616        });
    17         /** Initiate Functions */
    18         updateLinkInfo();
    19         showUpload();
    2017     });
    2118
    22      function updateLinkInfo() {
    23         $('.btn-link-update').on('click', function (event) {
    24             $.ajax({
    25                 url: redirectsettingsAjax.ajax_url,
    26                 type: 'POST',
    27                 data: {
    28                     'action': 'load_link_info',
    29                     'link_edit_id': $(this).data('link_edit_id'),
    30                     'link_edit_from': $(this).data('link_edit_from'),
    31                     'link_edit_to': $(this).data('link_edit_to'),
    32                     'link_edit_type': $(this).data('link_edit_type'),
    33                     '_ajax_nonce': redirectsettingsAjax.ajax_nonce,
    34                 },
    35                 success: function (data) {
    36                     $('.container-link-info').empty();
    37                     $('.container-link-info').append(data);
    38                 },
    39                 error: function (errorThrown) {
    40                     console.log(errorThrown);
    41                 }
    42             });
     19    $('.btn-link-update').on('click', function (event) {
     20        $.ajax({
     21            url: redirectsettingsAjax.ajax_url,
     22            type: 'POST',
     23            data: {
     24                'action': 'load_link_info',
     25                'link_edit_id': $(this).data('link_edit_id'),
     26                'link_edit_from': $(this).data('link_edit_from'),
     27                'link_edit_to': $(this).data('link_edit_to'),
     28                'link_edit_type': $(this).data('link_edit_type'),
     29                '_ajax_nonce': redirectsettingsAjax.ajax_nonce,
     30            },
     31            success: function (data) {
     32                $('.container-link-info').empty();
     33                $('.container-link-info').append(data);
     34            },
     35            error: function (errorThrown) {
     36                console.log(errorThrown);
     37            }
    4338        });
    44     }
    45 
    46     /** Init the Upload media module */
    47     function showUpload(){
    48         $('#btn-upload').on('click', function (event) {
    49             var formfield = $('#selected_file').attr('name');
    50             tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    51             return false;
     39    });
     40   
     41    $(document).on('click', '#btn-upload', function (e) {
     42        e.preventDefault();
     43        var $button = $(this);
     44        var file_frame = wp.media.frames.file_frame = wp.media({
     45           title: 'Select or upload image',
     46           library: {
     47              type: 'csv'
     48           },
     49           button: {
     50              text: 'Select'
     51           },
     52           multiple: false  // Set to true to allow multiple files to be selected
    5253        });
    53     }
    54 
    55     /** Transfer file to input box */
    56     window.send_to_editor = function (html) {
    57         var url = "";
    58         url = $(html).attr('href');
    59         $('#selected_file').val(url);
    60         tb_remove();
    61         blur_file_upload_field();
    62     }
    63 
    64     /** Filter if the file has csv extenstion */
    65     function blur_file_upload_field() {
    66         var file_upload_url = $('#selected_file').val();
    67         let find = file_upload_url.lastIndexOf(".");
    68         var extension = file_upload_url.substr(find);
    69         if (extension !== '.csv') {
    70             errorNotif('Invalid Extension');
    71             $('#selected_file').val('');
    72             return;
    73         }
    74     }
    75 
    76     /** Init Filtering */
    77     $('#selected_file').blur(function () {
    78         blur_file_upload_field();
    79     });
     54        file_frame.on('select', function () {
     55           var attachment = file_frame.state().get('selection').first().toJSON();
     56           $('#selected_file').val(attachment.url);
     57        });
     58        file_frame.open();
     59     });
    8060
    8161    /** EXECUTE NOTIFICATIONS */
  • zone-redirect/trunk/admin/view/tabs/tab-setup.php

    r2327225 r2348765  
    1212 * @subpackage Zone_Redirect/admin/partials
    1313 */
    14 $zn_form_nonce = wp_create_nonce('zn_form_nonce');
    1514?>
    1615<h3 class="zone-title-short">Setup</h3>
     
    2221                <div class="form-group">
    2322                    <label><strong>Select Input File:</strong></label>
    24                     <?php
    25                     $selected_file = sanitize_text_field($_POST['selected_file']);
    26                     $selectedFile = isset($selected_file) ? $selected_file : null; ?>
    27                     <input name="selected_file" id="selected_file" type="text" size="70" value="<?=$selectedFile?>"/>
    28                     <button id="btn-upload" type="button" class="button-primary btn-upload btn-zn-primary pull-r">Upload</button>
    29                     <br><?php _e( 'File must end with a .csv extension.'); ?>
     23                    <div class="input-group">
     24                        <div class="custom-file">
     25                            <input name="selected_file" id="selected_file" type="text" size="70" readonly/>
     26                        </div>
     27                        <div class="input-group-append">
     28                            <button id="btn-upload" type="button" class="button-primary btn-upload btn-zn-primary pull-r">Upload</button>
     29                        </div>
     30                    </div>
     31                    <?php _e( 'File must end with a .csv extension.'); ?>
    3032                </div>
    3133                <div class="form-group">
    3234                    <label><strong>Select Starting Row:</strong></label>
    33                     <input id="zn_start_row" name="zn_start_row" type="number" min="0" value="1"/>
    34                     <br><?php _e( 'Defaults to row 1 (top row) of .csv file.'); ?>
     35                    <input id="zn_start_row" name="zn_start_row" type="number" min="2" value="2"/>
     36                    <br><?php _e( 'Defaults to row 2 (top row) of .csv file. To avoid the column title to be added.'); ?>
    3537                </div>
    3638                <div class="form-group">
    3739                    <label><strong>Update exisiting data:</strong></label>
    38                     <input class="form-check-input zn_update_data" id="zn_update_data" data-nonce="<?= $zn_form_nonce ?>" type="checkbox" name="zn_update_data" data-toggle="toggle">
     40                    <input class="form-check-input zn_update_data" id="zn_update_data" type="checkbox" name="zn_update_data" data-toggle="toggle">
    3941                    <br><?php _e( 'Will update exisiting database rows when a duplicated primary key is encountered. Defaults to all rows inserted as new rows.'); ?>
    4042                </div>
  • zone-redirect/trunk/includes/class-zone-redirect.php

    r2327225 r2348765  
    7676            $this->version = ZONE_REDIRECT_VERSION;
    7777        } else {
    78             $this->version = '1.0.4';
     78            $this->version = '1.0.5';
    7979        }
    8080        $this->plugin_name = 'zone-redirect';
  • zone-redirect/trunk/model/Config.php

    r2327225 r2348765  
    5656            $this->version = ZONE_REDIRECT_VERSION;
    5757        } else {
    58             $this->version = '1.0.4';
     58            $this->version = '1.0.5';
    5959        }
    6060        $this->plugin_name = 'zone-redirect';
  • zone-redirect/trunk/readme.txt

    r2327225 r2348765  
    5757
    5858== Changelog ==
     59= v1.0.5 =
     60* Refactor the Importing Data.
    5961
    6062= v1.0.4 =
  • zone-redirect/trunk/zone-redirect.php

    r2327225 r2348765  
    1717 * Plugin URI:        https://github.com/zekinah/Zone-Redirect
    1818 * Description:       This plugin helps you manage and create 301 & 302 redirects for your WordPress site to improve SEO and visitor experience. With a user-friendly interface, Zone Redirect is easy to install and configure.
    19  * Version:           1.0.4
     19 * Version:           1.0.5
    2020 * Author:            Zekinah Lecaros
    2121 * Author URI:        https://github.com/zekinah
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'ZONE_REDIRECT_VERSION', '1.0.4' );
     38define( 'ZONE_REDIRECT_VERSION', '1.0.5' );
    3939
    4040/**
Note: See TracChangeset for help on using the changeset viewer.