Plugin Directory

Changeset 2582309


Ignore:
Timestamp:
08/12/2021 09:42:54 PM (5 years ago)
Author:
aspiesoft
Message:

added facebook page embed

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

Legend:

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

    r2582254 r2582309  
    44*/
    55/*
    6 Plugin Name: Auto Embed (YouTube, PDF, Image)
     6Plugin Name: Auto Embed (YouTube, Facebook, PDF, Image)
    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.2.2
     9Version: 1.3
    1010Author: AspieSoft
    1111Author URI: https://www.aspiesoft.com
     
    106106      $pluginData = get_plugin_data(__FILE__);
    107107      $this->plugin = array(
    108         'name' => sanitize_text_field($pluginData['Name']),
     108        'name' => preg_replace('/\s*\(.*?\)/', '', sanitize_text_field($pluginData['Name'])),
    109109        'setting' => str_replace('-', '', ucwords(sanitize_text_field($pluginData['TextDomain']), '-')),
    110110        'slug' => sanitize_text_field($pluginData['TextDomain']),
  • aspiesoft-auto-embed/trunk/assets/settings.css

    r2582254 r2582309  
    1616  width: 100%;
    1717  box-shadow: 0 0 2px #121212;
     18  z-index: 10000;
    1819}
    1920
  • aspiesoft-auto-embed/trunk/assets/settings.js

    r2582254 r2582309  
    171171
    172172      let valueIndex = 0;
    173       let html = option['form'].replace(/\[(\w+)(?:\{([\w\-:;]+)\}|)\]/g, function(_, inputType, inputStyle){
     173      let html = option['form'].replace(/(!|)\[(.*?)\]\((.*?)\)/g, function(_, emb, name, url){
     174        if(emb !== ''){
     175          return `<img src="${url}" alt="${name}">`;
     176        }
     177        return `<a href="${url}">${name}</a>`;
     178      }).replace(/\[(\/?\w+)(?:\{([\w\-:;]+)\}|)\]/g, function(_, inputType, inputStyle){
    174179        let style = '';
    175180        if(inputStyle){
     
    179184          inputType = 'text';
    180185        }
     186
    181187        if(inputType === 'br'){
    182188          return '<br'+style+'>';
    183         }
    184         if(inputType === 'hr'){
     189        }else if(inputType === 'hr'){
    185190          return '<hr'+style+'>';
    186191        }
     192
     193        if(inputType.match(/^h[1-6]$/)){
     194          return inputType.replace(/^h([1-6])$/, '<h$1'+style+'>');
     195        }else if(inputType.match(/^\/h[1-6]$/)){
     196          return inputType.replace(/^\/h([1-6])$/, '</h$1>');
     197        }
     198
    187199        if(inputType === 'label'){
    188200          return '<label for="'+name+'"'+style+'>'+label+'</label>';
  • aspiesoft-auto-embed/trunk/readme.txt

    r2582254 r2582309  
    44Requires at least: 3.0.1
    55Tested up to: 5.8
    6 Stable tag: 1.2.2
     6Stable tag: 1.3
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
  • aspiesoft-auto-embed/trunk/src/assets/0settings.php

    r2582254 r2582309  
    5353        ),
    5454
     55        'fb' => array(
     56          'width' => $options['get']('fbWidth'),
     57          'min-width' => $options['get']('fbWidthMin'),
     58          'max-width' => $options['get']('fbWidthMax'),
     59          'ratio' => $options['get']('fbRatio'),
     60        ),
     61
    5562      );
    5663
  • aspiesoft-auto-embed/trunk/src/assets/embed.js

    r2582254 r2582309  
    4242    pdf: null, // {width, min-width, max-width, ratio}
    4343    img: null, // {width, min-width, max-width, ratio}
     44    fb: null, // {width, min-width, max-width, ratio}
    4445  };
    4546
     
    243244        iframe = $('<div class="aspiesoft-embed" doing-init-animation'+attrs+styles+'><iframe class="aspiesoft-embed-content" style="opacity: 0;" src="'+data.url+'" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>').insertAfter(elm);
    244245      }else if(data.embedType === 'embed'){
    245         iframe = $('<div class="aspiesoft-embed" doing-init-animation'+attrs+styles+'><iframe class="aspiesoft-embed-content" style="opacity: 0;" src="'+data.url+'" frameborder="0" allowfullscreen></iframe></div>').insertAfter(elm);
     246        iframe = $('<div class="aspiesoft-embed" doing-init-animation'+attrs+styles+'><iframe class="aspiesoft-embed-content" style="opacity: 0;" src="'+data.url+'" frameborder="0" allowfullscreen allow="encrypted-media" allowtransparency="true"></iframe></div>').insertAfter(elm);
    246247        iframe.css('border-radius', '5px');
    247248      }else if(data.embedType === 'image'){
     
    321322      query = queryObj(query);
    322323      queryObject = query;
     324      if(page){
     325        page = page.replace(/\\/g, '/').replace(/\/$/, '');
     326      }else{
     327        page = '';
     328      }
    323329      if(domain === 'youtu.be'){
    324330        embedType = 'video';
     
    385391          return;
    386392        }
     393      }else if(domain === 'facebook.com'){
     394        if(page.includes('video')){
     395          //todo: embed facebook video
     396          url = false;
     397          return;
     398        }
     399
     400        let href;
     401        if(page === 'plugins/page' || page === 'plugins/page.php'){
     402          href = query.href;
     403        }else{
     404          page = page.split('/');
     405          if(page[0] === 'page'){
     406            href = `https%3A%2F%2Fwww.facebook.com%2F${page[1].toString().replace(/[^\w_\-$\.]/g, '')}%2F`;
     407          }else{
     408            href = `https%3A%2F%2Fwww.facebook.com%2F${page[0].replace(/[^\w_\-$\.]/g, '')}%2F`;
     409          }
     410        }
     411
     412        url = `https://www.facebook.com/plugins/page.php?href=${href}&tabs=timeline&width=500&height=800&small_header=true&adapt_container_width=true&hide_cover=false&show_facepile=false&appId`;
     413        embedType = 'embed';
     414        exactType = 'fb';
     415        return;
    387416      }else if(!domain || domain.trim() === '' || domain === window.location.hostname || window.location.hostname.endsWith(domain)){
    388417        // if local
     
    422451        }
    423452      }
    424     }
    425     return query;
     453      return query;
     454    }
     455    return {};
    426456  }
    427457
  • aspiesoft-auto-embed/trunk/src/settings.php

    r2582254 r2582309  
    4242
    4343
    44         'pdfWidth' => array('label' => 'Width', 'default' => '100', 'form' => '[br][hr][br]PDF[br][label][number{width:80px;}]%[br]', 'format' => '%s%'),
     44        'fbWidth' => array('label' => 'Width', 'default' => '100', 'form' => '[br][hr][h2]Facebook[/h2][br][label][number{width:80px;}]%[br]', 'format' => '%s%'),
     45        'fbWidthMin' => array('label' => 'Min Width', 'default' => '300', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
     46        'fbWidthMax' => array('label' => 'Max Width', 'default' => '500', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
     47        'fbRatio' => array('label' => 'Ratio', 'default' => array(5, 8), 'form' => '[label][number{width:60px;}]:[number{width:60px;}][br][br]', 'format' => '%s:%s'),
     48
     49        'pdfWidth' => array('label' => 'Width', 'default' => '100', 'form' => '[br][hr][h2]PDF[/h2][br][label][number{width:80px;}]%[br]', 'format' => '%s%'),
    4550        'pdfWidthMin' => array('label' => 'Min Width', 'default' => '300', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
    4651        'pdfWidthMax' => array('label' => 'Max Width', 'default' => '2500', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
    4752        'pdfRatio' => array('label' => 'Ratio', 'default' => array(9, 12), 'form' => '[label][number{width:60px;}]:[number{width:60px;}][br][br]', 'format' => '%s:%s'),
    4853
    49         'imgWidth' => array('label' => 'Width', 'default' => '100', 'form' => '[br][hr][br]Image[br][label][number{width:80px;}]%[br]', 'format' => '%s%'),
     54        'imgWidth' => array('label' => 'Width', 'default' => '100', 'form' => '[br][hr][h2]Image[/h2][br][label][number{width:80px;}]%[br]', 'format' => '%s%'),
    5055        'imgWidthMin' => array('label' => 'Min Width', 'default' => '300', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
    5156        'imgWidthMax' => array('label' => 'Max Width', 'default' => '2500', 'form' => '[label][number{width:80px;}]px[br]', 'format' => '%spx'),
  • aspiesoft-auto-embed/trunk/templates/admin.php

    r2582254 r2582309  
    165165      $pluginData = get_plugin_data(WP_PLUGIN_DIR.'/'.sanitize_text_field(constant('PLUGIN_BASENAME_'.basename(plugin_dir_path(dirname(__FILE__, 1))))));
    166166      $this->plugin = array(
    167         'name' => sanitize_text_field($pluginData['Name']),
     167        'name' => preg_replace('/\s*\(.*?\)/', '', sanitize_text_field($pluginData['Name'])),
    168168        'setting' => str_replace('-', '', ucwords(sanitize_text_field($pluginData['TextDomain']), '-')),
    169169        'slug' => sanitize_text_field($pluginData['TextDomain']),
Note: See TracChangeset for help on using the changeset viewer.