Plugin Directory

Changeset 2604494


Ignore:
Timestamp:
09/24/2021 03:46:31 PM (4 years ago)
Author:
aspiesoft
Message:

updated settings

Location:
aspiesoft-auto-embed/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • aspiesoft-auto-embed/trunk/aspiesoft-auto-embed.php

    r2598834 r2604494  
    44*/
    55/*
    6 Plugin Name: Auto Embed (YouTube, Facebook, PDF, Image)
     6Plugin Name: Auto Embed (YouTube, Facebook, PDF, Image, And More)
    77Plugin URI: https://github.com/AspieSoft/aspiesoft-auto-embed
    88Description: Easily Embed Dynamic Lazy Loading Youtube Videos Simply By Pasting The Url.
    9 Version: 1.4.5
     9Version: 1.4.6
    1010Author: AspieSoft
    1111Author URI: https://www.aspiesoft.com
  • aspiesoft-auto-embed/trunk/assets/settings.js

    r2582309 r2604494  
    5959    }
    6060
     61
    6162    let valueAttr = '';
    6263    if(value && type !== 'bool'){
     64      if(value.startsWith('[') && value.endsWith(']')){
     65        try{
     66          value = JSON.parse(value.replace(/\\([\\"])/g, '$1')).join('\n').trim();
     67        }catch(e){}
     68      }
     69
    6370      value = value.replace(/\\?"/g, '\\"');
    6471      valueAttr = ' value="'+value+'"';
     
    6774    let defValueAttr = '';
    6875    if(defaultValue && type !== 'bool'){
     76      if(defaultValue.startsWith('[') && defaultValue.endsWith(']')) {
     77        try {
     78          defaultValue = JSON.parse(defaultValue.replace(/\\([\\"])/g, '$1')).join('\n').trim();
     79        } catch(e) {}
     80      }
     81
    6982      defaultValue = defaultValue.replace(/\\?"/g, '\\"');
    7083      defValueAttr = ' placeholder="'+defaultValue+'"';
     
    92105
    93106      let origValue = '';
    94       if(value !== ''){origValue = ' origValue="'+value+'"';}
    95       return '<textarea name="'+name+'"'+valueAttr+defValueAttr+origValue+style+'></textarea>';
     107      if(value !== '') {origValue = ' origValue="' + value + '"';}
     108
     109      if(value === defaultValue){value = '';}
     110
     111      return '<textarea type="' + inputType + '" name="' + name + '"' + defValueAttr + origValue + style + '>' + value.replace(/<\/textarea>/g, '')+'\n' +'</textarea>';
    96112
    97113    }else if(inputType === 'select' && optionsList){
     
    267283        //let origValue = $(this).attr('origValue');
    268284        let defaultValue = optionsList[name]['default'];
     285
     286        if(elmTag === 'textarea') {
     287          defaultValue = defaultValue.split(/\r?\n/).filter(val => val.trim() !== '');
     288          if(!defaultValue.length) {
     289            defaultValue = '';
     290          } else {
     291            defaultValue = JSON.stringify(defaultValue);
     292          }
     293        }
    269294
    270295        if(elmType === 'checkbox'){
     
    400425      elmTag = elmTag.toLowerCase();
    401426      if(elmType){elmType = elmType.toLowerCase();}else{elmType = '';}
    402      
     427
    403428      // don't run for hidden, button, and submit input types
    404429      if(elmTag === 'input' && (elmType === 'hidden' || elmType === 'button' || elmType === 'submit')){
     
    463488      let value = $(this).val();
    464489      let origValue = $(this).attr('origValue');
     490
     491      if(elmTag === 'textarea'){
     492        value = value.split(/\r?\n/).filter(val => val.trim() !== '');
     493        if(!value.length){
     494          value = '';
     495        }else{
     496          value = JSON.stringify(value);
     497        }
     498
     499        origValue = origValue.split(/\r?\n/).filter(val => val.trim() !== '');
     500        if(!origValue.length) {
     501          origValue = '';
     502        } else {
     503          origValue = JSON.stringify(origValue);
     504        }
     505
     506        if($(this).attr('placeholder') === value){
     507          value = '';
     508        }
     509
     510        if($(this).attr('placeholder') !== origValue) {
     511          origValue = 'null';
     512        }
     513      }
    465514
    466515      // add value to builder
  • aspiesoft-auto-embed/trunk/readme.txt

    r2598834 r2604494  
    1 === Auto YouTube Embed ===
     1=== Auto Embed (YouTube, Facebook, PDF, Image, And More) ===
    22Contributors: AspieSoft
    3 Tags: youtube, embed, auto, pdf, image, img, webP, dynamic, simple, lazy-load, css
     3Tags: youtube, embed, auto, pdf, image, img, webP, dynamic, simple, lazy-load, css, facebook
    44Requires at least: 3.0.1
    55Tested up to: 5.8
    6 Stable tag: 1.4.5
     6Stable tag: 1.4.6
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
  • aspiesoft-auto-embed/trunk/src/assets/0settings.php

    r2596457 r2604494  
    7171      // only embed shortcode
    7272      if ($options['get']('ytOnlyEmbedShortcode', false, true)) {
    73         $this->opts['requireAttrs'] = array('yt-auto-embed');
     73        $this->opts['requireAttrs'] = array('aspiesoft-auto-embed');
    7474      }
    7575
     
    8181
    8282      $includeDomains = $options['get']('includeDomains');
    83       if ($includeDomains !== 'example.com') {
    84         $this->opts['includeDomains'] = explode('\n', $includeDomains);
     83      if ($includeDomains && $includeDomains !== 'example.com') {
     84        if(str_starts_with($includeDomains, '[') && str_ends_with($includeDomains, ']')){
     85          try{
     86            $this->opts['includeDomains'] = json_decode(preg_replace('/\\([\\"])/', '$1', $includeDomains));
     87          }catch(Exception $e){}
     88        }else{
     89          $this->opts['includeDomains'] = explode('\n', $includeDomains);
     90        }
    8591      }
    8692
  • aspiesoft-auto-embed/trunk/src/main.php

    r2590553 r2604494  
    144144
    145145      if(self::$options['get']('ytOnlyEmbedShortcode', false, true)){
    146         $result .= ' yt-auto-embed';
     146        $result .= ' aspiesoft-auto-embed';
    147147      }
    148148
  • aspiesoft-auto-embed/trunk/src/settings.php

    r2596457 r2604494  
    5656        'disableWpEmbed' => array('label' => 'Disable Wp-Embed', 'default' => 'false', 'form' => '[check][label][br]', 'type' => 'bool'),
    5757        'enableEditorAutoUrl' => array('label' => 'Automatically Make URLs Clickable In Page Editor', 'default' => 'false', 'form' => '[check][label][br][br]', 'type' => 'bool'),
     58       
    5859        'overrideIframes' => array('label' => 'Override Compatable Iframes Including WP-Embed Iframes', 'default' => 'false', 'form' => '[check][label][br][br]', 'type' => 'bool'),
     60        'ytOnlyEmbedShortcode' => array('label' => 'Only Embed Shortcodes', 'default' => 'false', 'form' => '[check][label][br][br]', 'type' => 'bool'),
    5961
    6062        'altShortcode_default' => array('label' => 'Alternate Shortcode Name', 'default' => '', 'form' => '[label][text][br]'),
     
    8284        'embedAuto' => array('label' => 'Auto Play', 'default' => 'false', 'form' => '[check][label]', 'type' => 'bool'),
    8385        'embedMute' => array('label' => 'Mute', 'default' => 'false', 'form' => '[check][label][br]', 'type' => 'bool'),
    84 
    85         'ytOnlyEmbedShortcode' => array('label' => 'Only Embed Shortcodes', 'default' => 'false', 'form' => '[check][label][br]', 'type' => 'bool'),
    8686
    8787      );
Note: See TracChangeset for help on using the changeset viewer.