Changeset 2232257
- Timestamp:
- 01/23/2020 03:04:34 PM (6 years ago)
- Location:
- sheetdb/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
sheetdb.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sheetdb/trunk/readme.txt
r2193842 r2232257 6 6 Tested up to: 5.2.4 7 7 Requires PHP: 5.4 8 Stable tag: 1.0. 08 Stable tag: 1.0.1 9 9 License: GPLv2 or later 10 10 -
sheetdb/trunk/sheetdb.php
r2192243 r2232257 6 6 Plugin name: SheetDB 7 7 Description: The SheetDB wordpress plugin allows you to easily add content from Google Spreadsheet to your wordpress site. 8 Version: 1.0. 08 Version: 1.0.1 9 9 Author: SheetDB 10 10 Author URI: https://sheetdb.io/ … … 36 36 public function __construct() { 37 37 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__) ); 39 39 } 40 40 … … 43 43 isset($atts['element']) ? $element = $atts['element'] : $element = "div"; 44 44 45 isset($atts['sheet']) ? $sheet = $atts['sheet'] : $sheet = null; 45 46 isset($atts['limit']) ? $limit = $atts['limit'] : $limit = null; 46 47 isset($atts['offset']) ? $offset = $atts['offset'] : $offset = null; … … 48 49 isset($atts['sort-by']) ? $sortBy = $atts['sort-by'] : $sortBy = null; 49 50 isset($atts['sort-order']) ? $sortOrder = $atts['sort-order'] : $sortOrder = null; 51 isset($atts['sort-method']) ? $sortMethod = $atts['sort-method'] : $sortMethod = null; 50 52 51 53 if (!$url) return 'Use URL attribute with the SheetDB shortcode.'; 52 54 53 $additionalCode = $this->makeAdditionalCode($ limit, $offset, $search, $sortBy, $sortOrder);55 $additionalCode = $this->makeAdditionalCode($sheet, $limit, $offset, $search, $sortBy, $sortOrder, $sortMethod); 54 56 55 57 return "<{$element} data-sheetdb-url=\"{$url}\"{$additionalCode}>{$content}</{$element}>"; 56 58 } 57 59 58 private function makeAdditionalCode($ limit, $offset, $search, $sortBy, $sortOrder) {60 private function makeAdditionalCode($sheet, $limit, $offset, $search, $sortBy, $sortOrder, $sortMethod) { 59 61 $additionalCode = ''; 62 if ($sheet) { 63 $additionalCode .= ' data-sheetdb-sheet="' . $sheet . '"'; 64 } 60 65 if ($limit) { 61 66 $additionalCode .= ' data-sheetdb-limit="' . $limit . '"'; … … 73 78 $additionalCode .= ' data-sheetdb-sort-order="' . $sortOrder . '"'; 74 79 } 80 if ($sortMethod) { 81 $additionalCode .= ' data-sheetdb-sort-method="' . $sortMethod . '"'; 82 } 75 83 76 84 return $additionalCode;
Note: See TracChangeset
for help on using the changeset viewer.