Plugin Directory

Changeset 2651864


Ignore:
Timestamp:
01/02/2022 04:47:44 PM (4 years ago)
Author:
aspiesoft
Message:

Added ability to combine GUI list with shortcodes

Location:
aspiesoft-church-sermon-video-list/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • aspiesoft-church-sermon-video-list/trunk/aspiesoft-church-sermon-video-list.php

    r2651847 r2651864  
    66/*
    77Plugin Name: AspieSoft Church Sermon Video List
    8 Version: 1.3.1
     8Version: 1.3.2
    99Description: An easy way for a church to list there sermon videos on their website.
    1010Author: AspieSoft
  • aspiesoft-church-sermon-video-list/trunk/main.php

    r2651748 r2651864  
    5454      }
    5555
    56       if ($attr['url'] && preg_match('/[\\w_\\-.]\\/[\\w_\\-.]/', $attr['url'])) {
     56      if ($attr['url'] && preg_match('/^[\\w_\\-.]+\\/[\\w_\\-]+$/', $attr['url'])) {
    5757        $urlParts = explode('/', $attr['url']);
     58        $attr['fb-profile'] = $urlParts[0];
     59        $attr['fb-id'] = $urlParts[1];
     60        $attr['url'] = false;
     61      }else if($attr['url'] && preg_match('/^https?:\\/\\/(?:www\\.|)facebook\\.com\\/([\\w_\\-.]+)\\/videos\\/([\\w_\\-]+)\\/?$/', $attr['url'])){
     62        $urlParts = preg_replace('/^https?:\\/\\/(?:www\\.|)facebook\\.com\\/([\\w_\\-.]+)\\/videos\\/([\\w_\\-]+)\\/?$/', '$1/$2', $attr['url']);
     63        $urlParts = explode('/', $urlParts);
    5864        $attr['fb-profile'] = $urlParts[0];
    5965        $attr['fb-id'] = $urlParts[1];
     
    127133      }
    128134
    129       if($content){
     135      if ($attr['list']) {
    130136        $this->enqueue();
    131         $content = do_shortcode(sanitize_text_field($content));
    132       }else if($attr['list']){
    133         $this->enqueue();
     137        $oldContent = $content;
    134138        $content = '';
    135139
    136140        $sermonList = sanitize_textarea_field(get_option('AspieSoftChurchSermonVideoList'));
    137141        $sermonList = json_decode($sermonList, true);
    138         foreach($sermonList as $item){
     142        foreach ($sermonList as $item) {
    139143          $content .= '[cs-video';
    140           if(!$item['visible']){
     144          if (!$item['visible']) {
    141145            $content .= ' hide=true';
    142146          }
     
    144148        }
    145149
     150        if($oldContent){
     151          $content .= $oldContent;
     152        }
     153
     154        $content = do_shortcode(sanitize_text_field($content));
     155      }else if($content){
     156        $this->enqueue();
    146157        $content = do_shortcode(sanitize_text_field($content));
    147158      }else{
  • aspiesoft-church-sermon-video-list/trunk/readme.txt

    r2651847 r2651864  
    44Requires at least: 3.0.1
    55Tested up to: 5.8.2
    6 Stable tag: 1.3.1
     6Stable tag: 1.3.2
    77Requires PHP: 5.2.4
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.