Plugin Directory

Changeset 1211874


Ignore:
Timestamp:
08/03/2015 02:44:29 PM (11 years ago)
Author:
markusklems
Message:

Added customization features for labels and texts.

Location:
cloudwok-file-upload/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cloudwok-file-upload/trunk/cloudwok.php

    r1201910 r1211874  
    44Plugin URI: http://www.cloudwok.com
    55Description: CloudWok enables you to let your website visitors upload files directly into a Dropbox, Google Drive, Amazon S3, Box.com, or other cloud storage folder that you own.
    6 Version: 0.3.3
     6Version: 0.3.4
    77Author: CloudWok
    88Author Email: [email protected]
     
    4141            'show_form_input_name' => True,
    4242            'show_form_input_email' => True,
    43             'show_powered_by_link' => False
     43            'show_powered_by_link' => False,
     44            'label_add_files_btn' => '',
     45            'label_send_msg_btn' => '',
     46            'label_dropzone' => '',
     47            'label_send_msg_placeholder' => '',
     48            'label_send_email_placeholder' => '',
     49            'label_send_firstname_placeholder' => '',
     50            'label_send_lastname_placeholder' => ''
    4451        ), $atts )
    4552    );
     
    5158    $show_form_input_email = ' data-show-email="n"';
    5259    $show_powered_by_link = ' data-pby="n"';
     60
     61    // customize labels and texts
     62    $customizeDropzone = '';
     63    $customizeMessages = '';
    5364
    5465    if(array_key_exists('show_uploads', $atts) && $atts['show_uploads'] == "True") {
     
    6980    if(array_key_exists('show_powered_by_link', $atts) && $atts['show_powered_by_link'] == "True") {
    7081        $show_powered_by_link = 'data-pby="y"';
     82    }
     83
     84    // custom labels
     85    if(array_key_exists('label_add_files_btn', $atts) || array_key_exists('label_dropzone', $atts)) {
     86        $customizeDropzone = 'document.querySelector( ".cloudwok-embed .cloudwok-dropzone").addEventListener("DOMNodeInserted", customizeDropzone, false);
     87        function customizeDropzone(e) {
     88          if(e.target && e.target.nodeName == "DIV") {
     89                ';
     90        if(array_key_exists('label_add_files_btn', $atts)) {
     91            $customizeDropzone = $customizeDropzone . 'document.querySelector(".cloudwok-embed .dropzone span.lead > .fileinput-button > span" ).innerHTML = "' . $atts['label_add_files_btn'] . '";';
     92        }
     93        if(array_key_exists('label_dropzone', $atts)) {
     94            $customizeDropzone = $customizeDropzone . 'document.querySelector(".cloudwok-embed .dropzone span.lead > strong" ).innerHTML = "' . $atts['label_dropzone'] . '";';
     95        }
     96        $customizeDropzone = $customizeDropzone . '
     97      }}';
     98    }
     99    if(array_key_exists('label_send_msg_btn', $atts) || array_key_exists('label_send_msg_placeholder', $atts)) {
     100        $customizeMessages = 'document.querySelector( ".cloudwok-embed .cloudwok-upload-message").addEventListener("DOMNodeInserted", customizeMessages, false);
     101        function customizeMessages(e) {
     102            if(e.target && e.target.nodeName == "DIV") {';
     103        if(array_key_exists('label_send_msg_btn', $atts)) {
     104            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed .cloudwok-upload-message .btn-start-upload" ).innerHTML = "<i class=\'fa fa-send\'></i> ' . $atts['label_send_msg_btn'] . '";';
     105        }
     106        if(array_key_exists('label_send_msg_placeholder', $atts)) {
     107            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed .cloudwok-upload-message > form > fieldset > div.form-group > div > textarea" ).innerHTML = "' . $atts['label_send_msg_placeholder'] . '";';
     108        }
     109        if(array_key_exists('label_send_msg_placeholder', $atts)) {
     110            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed .cloudwok-upload-message > form > fieldset > div.form-group > div > textarea" ).placeholder = "' . $atts['label_send_msg_placeholder'] . '";';
     111        }
     112        if(array_key_exists('label_send_email_placeholder', $atts)) {
     113            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed input[name=from]").placeholder = "' . $atts['label_send_email_placeholder'] . '";';
     114        }
     115        if(array_key_exists('label_send_firstname_placeholder', $atts)) {
     116            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed input[name=from_firstname]").placeholder = "' . $atts['label_send_firstname_placeholder'] . '";';
     117        }
     118        if(array_key_exists('label_send_lastname_placeholder', $atts)) {
     119            $customizeMessages = $customizeMessages . 'document.querySelector(".cloudwok-embed input[name=from_lastname]" ).placeholder = "' . $atts['label_send_lastname_placeholder'] . '";';
     120        }
     121        $customizeMessages = $customizeMessages . '
     122      }}';
    71123    }
    72124
     
    92144      window.attachEvent("onload", loader);
    93145    })(window, document);
    94   </script>';
     146
     147    ' . $customizeDropzone . '
     148
     149    ' . $customizeMessages . '
     150    </script>
     151    ';
    95152    return $to_return;
    96153}
  • cloudwok-file-upload/trunk/readme.txt

    r1202157 r1211874  
    44Tags: upload, file upload, dropbox, google drive, microsoft onedrive, box, s3, facebook, upload form, feedback
    55Requires at least: 3.0.0
    6 Tested up to: 4.2.2
    7 Stable tag: 0.3.3
     6Tested up to: 4.2.3
     7Stable tag: 0.3.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    9292== Changelog ==
    9393
     94= 0.3.4 =
     95Added feature to customize labels and texts (see here: https://wordpress.org/support/topic/custom-text-translation). This will likely be replaced in future versions by a central customization admin page.
    9496= 0.3.3 =
    9597Added new features to optionally show first name, last name, and e-mail address as input fields of the message form. Use it for example like this: `[cloudwok wok_id="YOUR_WOK_ID" show_form="True" show_form_input_name="True"]`
Note: See TracChangeset for help on using the changeset viewer.