Plugin Directory

Changeset 2232257


Ignore:
Timestamp:
01/23/2020 03:04:34 PM (6 years ago)
Author:
sheetdb
Message:

add sheet and sort-method support, update to latest version of sheetdb-handlebars library

Location:
sheetdb/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sheetdb/trunk/readme.txt

    r2193842 r2232257  
    66Tested up to: 5.2.4
    77Requires PHP: 5.4
    8 Stable tag: 1.0.0
     8Stable tag: 1.0.1
    99License: GPLv2 or later
    1010
  • sheetdb/trunk/sheetdb.php

    r2192243 r2232257  
    66Plugin name: SheetDB
    77Description: The SheetDB wordpress plugin allows you to easily add content from Google Spreadsheet to your wordpress site.
    8 Version: 1.0.0
     8Version: 1.0.1
    99Author: SheetDB
    1010Author URI: https://sheetdb.io/
     
    3636        public function __construct() {
    3737            add_shortcode('sheetdb', [$this, 'sheetdb_shortcode']);
    38             wp_enqueue_script( 'sheetdb-js', plugins_url('assets/js/sheetdb-handlebars-1.0.3.js', __FILE__) );
     38            wp_enqueue_script( 'sheetdb-js', plugins_url('assets/js/sheetdb-handlebars-1.0.6.js', __FILE__) );
    3939        }
    4040
     
    4343            isset($atts['element']) ? $element = $atts['element'] : $element = "div";
    4444
     45            isset($atts['sheet']) ? $sheet = $atts['sheet'] : $sheet = null;
    4546            isset($atts['limit']) ? $limit = $atts['limit'] : $limit = null;
    4647            isset($atts['offset']) ? $offset = $atts['offset'] : $offset = null;
     
    4849            isset($atts['sort-by']) ? $sortBy = $atts['sort-by'] : $sortBy = null;
    4950            isset($atts['sort-order']) ? $sortOrder = $atts['sort-order'] : $sortOrder = null;
     51            isset($atts['sort-method']) ? $sortMethod = $atts['sort-method'] : $sortMethod = null;
    5052
    5153            if (!$url) return 'Use URL attribute with the SheetDB shortcode.';
    5254
    53             $additionalCode = $this->makeAdditionalCode($limit, $offset, $search, $sortBy, $sortOrder);
     55            $additionalCode = $this->makeAdditionalCode($sheet, $limit, $offset, $search, $sortBy, $sortOrder, $sortMethod);
    5456
    5557            return "<{$element} data-sheetdb-url=\"{$url}\"{$additionalCode}>{$content}</{$element}>";
    5658        }
    5759
    58         private function makeAdditionalCode($limit, $offset, $search, $sortBy, $sortOrder) {
     60        private function makeAdditionalCode($sheet, $limit, $offset, $search, $sortBy, $sortOrder, $sortMethod) {
    5961            $additionalCode = '';
     62            if ($sheet) {
     63                $additionalCode .= ' data-sheetdb-sheet="' . $sheet . '"';
     64            }
    6065            if ($limit) {
    6166                $additionalCode .= ' data-sheetdb-limit="' . $limit . '"';
     
    7378                $additionalCode .= ' data-sheetdb-sort-order="' . $sortOrder . '"';
    7479            }
     80            if ($sortMethod) {
     81                $additionalCode .= ' data-sheetdb-sort-method="' . $sortMethod . '"';
     82            }
    7583
    7684            return $additionalCode;
Note: See TracChangeset for help on using the changeset viewer.