Changeset 1410266
- Timestamp:
- 05/04/2016 11:18:01 AM (10 years ago)
- Location:
- cactus-masonry-plus
- Files:
-
- 12 added
- 2 edited
-
tags/0.0.1.4 (added)
-
tags/0.0.1.4/cactusBrick.js (added)
-
tags/0.0.1.4/cactusBrick.min.js (added)
-
tags/0.0.1.4/cactusGallery.js (added)
-
tags/0.0.1.4/cactusGallery.min.js (added)
-
tags/0.0.1.4/cactusMasonry.php (added)
-
tags/0.0.1.4/cactusMasonryPlus.js (added)
-
tags/0.0.1.4/cactusMasonryPlus.min.js (added)
-
tags/0.0.1.4/license.txt (added)
-
tags/0.0.1.4/readme.txt (added)
-
tags/0.0.1.4/style.css (added)
-
tags/0.0.1.4/style.scss (added)
-
trunk/cactusMasonry.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cactus-masonry-plus/trunk/cactusMasonry.php
r1406363 r1410266 2 2 /** 3 3 * @package Cactus Masonry Plus 4 * @version 0.0.1. 34 * @version 0.0.1.4 5 5 */ 6 6 /* … … 8 8 * Plugin URI: cactus.cloud 9 9 * Description: A highly customizable gallery of post thumbnails. 10 * Version: 0.0.1. 310 * Version: 0.0.1.4 11 11 * Author: cactus.cloud 12 12 * Author URI: http://cactus.cloud/masonryplus … … 34 34 35 35 private static $a = null; 36 private static $VERSION = "0.0.1.3"; 36 37 37 38 static public function init() { 38 39 add_shortcode("cactusMasonry", array(__CLASS__, "cactus_masonry_shortcode_handler")); 39 40 add_shortcode("cactusmasonry", array(__CLASS__, "cactus_masonry_shortcode_handler")); 40 add_action("wp_enqueue_scripts", array(__CLASS__, "cactus_masonry_scripts") );41 add_action("wp_enqueue_scripts", array(__CLASS__, "cactus_masonry_scripts"), 42); 41 42 //ADD JQUERY TO HEAD 42 43 $plugin = plugin_basename(__FILE__); … … 45 46 46 47 static public function cactus_masonry_scripts() { 47 wp_enqueue_script('jquery'); 48 if(!wp_script_is("jquery", "enqueued") || !wp_script_is("jquery", "registered")) wp_enqueue_script("jquery", includes_url() . 'js/jquery/jquery.js', array(), false, true); 49 wp_enqueue_script('cactusBrickScript', plugin_dir_url(__FILE__) . 'cactusBrick.min.js', array('jquery'), self::$VERSION, true); 50 wp_enqueue_script('cactusGalleryScript', plugin_dir_url(__FILE__) . 'cactusGallery.min.js', array('jquery', 'cactusBrickScript'), self::$VERSION, true); 51 wp_enqueue_script('cactusMasonryPlusScript', plugin_dir_url(__FILE__) . 'cactusMasonryPlus.min.js', array('jquery', 'cactusBrickScript', 'cactusGalleryScript'), self::$VERSION, true); 52 wp_enqueue_style('cactusMasonryPlusStyle', plugin_dir_url(__FILE__) . 'style.css'); 48 53 } 49 54 … … 57 62 58 63 static public function cactus_masonry_shortcode_handler($atts) { 59 wp_enqueue_script('cactusBrickScript', plugin_dir_url(__FILE__) . 'cactusBrick.min.js');60 wp_enqueue_script('cactusGalleryScript', plugin_dir_url(__FILE__) . 'cactusGallery.min.js');61 wp_enqueue_script('cactusMasonryPlusScript', plugin_dir_url(__FILE__) . 'cactusMasonryPlus.min.js');62 wp_enqueue_style('cactusMasonryPlusStyle', plugin_dir_url(__FILE__) . 'style.css');63 64 //Accept input parameters 64 65 $defaultAtts = array( 65 66 //JS 66 'id' => "cactus" ,67 'id' => "cactus" . mt_rand(10000,99999), 67 68 68 69 //Functionality … … 177 178 } 178 179 179 $ids_in = self::parse_csv(self::$a["includedpostids"]);180 $ids_out = self::parse_csv(self::$a["excludedpostids"]);181 180 182 181 $args = array( "posts_per_page" => self::$a["pagesize"], … … 184 183 "offset" => self::$a["offset"], 185 184 "category_name" => self::$a["categoryslug"], 186 "meta_query" => $meta); 185 "meta_query" => $meta 186 ); 187 187 188 188 //Get included ids 189 if(count($ids_in) > 0) $args['posts__in'] = $ids_in; 190 if(count($ids_out) > 0) $args['posts__not_in'] = $ids_out; 191 189 if(self::parse_csv(self::$a["includedpostids"]) != "") { 190 $ids_in = self::parse_csv(self::$a["includedpostids"]); 191 if($ids_in[0] != "") $args['post__in'] = $ids_in; 192 } 193 if(self::parse_csv(self::$a["excludedpostids"])) { 194 $ids_out = self::parse_csv(self::$a["excludedpostids"]); 195 if($ids_out[0] != "") $args['post__not_in'] = $ids_out; 196 } 192 197 $args['meta_key'] = self::$a["metakey"]; 193 198 … … 206 211 207 212 $the_query = new WP_Query($args); 213 214 //DEBUG echo "<p>REQUEST:$the_query->request</p>"; 208 215 //For each post: 209 216 … … 218 225 //Set up main JS 219 226 $o .= "<script>"; 220 $o .= " jQuery(document).on(\"ready\", function() {";227 $o .= "document.addEventListener(\"DOMContentLoaded\", function() {"; 221 228 $o .= "var cmp{$id} = new CactusMasonryPlus();"; 222 229 $o .= "cmp{$id}.margin = " . (self::$a['margin']/2) . ";"; -
cactus-masonry-plus/trunk/readme.txt
r1406399 r1410266 5 5 Requires at least: 4.4.2 6 6 Tested up to: 4.5.1 7 Stable tag: 0.0.1. 37 Stable tag: 0.0.1.4 8 8 License: GNU AGPLv3 9 9 License URI: http://cactus.cloud/licenses/agpl-3.0.txt … … 46 46 47 47 == Changelog == 48 = 0.0.1.4 = 49 * Fixed a major bug that prevented the 'includedPostIds' and 'excludedPostIds' parameters from functioning 50 * Improved the efficiency of the plugin's filtering of the 'includedPostIds' and 'excludedPostIds' parameters when empty 51 * Moved script tags to the footer for content prioritized page loading and to improve SEO 52 48 53 = 0.0.1.3 = 49 54 * Updated WordPress repository tags … … 69 74 70 75 == Upgrade Notice == 71 76 = 0.0.1.4 = 77 * Fixed a major bug with included/excluded IDs and made caching easier 72 78 73 79
Note: See TracChangeset
for help on using the changeset viewer.