Version Description
- March 12 2016 =
- Fix: Prevent conflict of Collapsible list with themes using [data-toggle="collapse"] for menu (on mobile devices)
- Update: Remove notice message (when there is Javascript errors in active theme/another plugin). It caused confusion.
Download this release
Release Info
Developer | PT Guy |
Plugin | Content Views – Post Grid & List for WordPress |
Version | 1.8.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.8.0.1 to 1.8.0.2
- README.txt +5 -1
- admin/content-views-admin.php +2 -7
- admin/includes/plugin.php +2 -2
- assets/bootstrap/js/bootstrap.custom.min.js +1 -1
- content-views.php +25 -48
- includes/defines.php +3 -4
- includes/functions.php +5 -2
- includes/hooks.php +8 -61
- public/content-views.php +3 -3
- uninstall.php +2 -5
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: post, post grid, display, recent, posts, recent post, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.4.2
|
7 |
-
Stable tag: 1.8.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -136,6 +136,10 @@ If you are using "Your latest posts" as home page, you should paste this code `<
|
|
136 |
|
137 |
== Changelog ==
|
138 |
|
|
|
|
|
|
|
|
|
139 |
= 1.8.0.1 - March 02 2016 =
|
140 |
* Tweak: Update Notice message at front-end (when Javascript error occurs) to avoid misunderstand
|
141 |
|
4 |
Tags: post, post grid, display, recent, posts, recent post, page, pages, query, queries, search, display, show, grid, column, layout, author, blog, categories, category, comment, content, custom, editor, filter, Formatting, image, list, meta, plugin, responsive, shortcode, excerpt, title, tag, term, Taxonomy, thumbnail, pagination, date, scrollable, slider, collapsible
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 4.4.2
|
7 |
+
Stable tag: 1.8.0.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
136 |
|
137 |
== Changelog ==
|
138 |
|
139 |
+
= 1.8.0.2 - March 12 2016 =
|
140 |
+
* Fix: Prevent conflict of Collapsible list with themes using [data-toggle="collapse"] for menu (on mobile devices)
|
141 |
+
* Update: Remove notice message (when there is Javascript errors in active theme/another plugin). It caused confusion.
|
142 |
+
|
143 |
= 1.8.0.1 - March 02 2016 =
|
144 |
* Tweak: Update Notice message at front-end (when Javascript error occurs) to avoid misunderstand
|
145 |
|
admin/content-views-admin.php
CHANGED
@@ -39,11 +39,7 @@ class PT_Content_Views_Admin {
|
|
39 |
*/
|
40 |
private function __construct() {
|
41 |
|
42 |
-
|
43 |
-
* Call $plugin_slug from public plugin class.
|
44 |
-
*/
|
45 |
-
$plugin = PT_Content_Views::get_instance();
|
46 |
-
$this->plugin_slug = $plugin->get_plugin_slug();
|
47 |
|
48 |
// Redirect to "Add View" page when click "Add new" link in "All Views" page
|
49 |
add_action( 'admin_init', array( $this, 'redirect_add_new' ) );
|
@@ -63,9 +59,8 @@ class PT_Content_Views_Admin {
|
|
63 |
// Output assets content at footer of page
|
64 |
add_action( PT_CV_PREFIX_ . 'preview_footer', array( 'PT_CV_Html', 'assets_of_view_types' ) );
|
65 |
|
66 |
-
|
67 |
// Add an action link pointing to the options page.
|
68 |
-
$plugin_basename = plugin_basename(
|
69 |
add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'filter_add_action_links' ) );
|
70 |
|
71 |
// Filter link of actions in All Views page
|
39 |
*/
|
40 |
private function __construct() {
|
41 |
|
42 |
+
$this->plugin_slug = PT_CV_DOMAIN;
|
|
|
|
|
|
|
|
|
43 |
|
44 |
// Redirect to "Add View" page when click "Add new" link in "All Views" page
|
45 |
add_action( 'admin_init', array( $this, 'redirect_add_new' ) );
|
59 |
// Output assets content at footer of page
|
60 |
add_action( PT_CV_PREFIX_ . 'preview_footer', array( 'PT_CV_Html', 'assets_of_view_types' ) );
|
61 |
|
|
|
62 |
// Add an action link pointing to the options page.
|
63 |
+
$plugin_basename = plugin_basename( PT_CV_PATH . $this->plugin_slug . '.php' );
|
64 |
add_filter( 'plugin_action_links_' . $plugin_basename, array( $this, 'filter_add_action_links' ) );
|
65 |
|
66 |
// Filter link of actions in All Views page
|
admin/includes/plugin.php
CHANGED
@@ -34,7 +34,7 @@ if ( !class_exists( 'PT_CV_Plugin' ) ) {
|
|
34 |
*/
|
35 |
public static function settings_page_section_one() {
|
36 |
|
37 |
-
$file_path =
|
38 |
|
39 |
$text = PT_CV_Functions::file_include_content( $file_path );
|
40 |
|
@@ -48,7 +48,7 @@ if ( !class_exists( 'PT_CV_Plugin' ) ) {
|
|
48 |
*/
|
49 |
public static function settings_page_section_two() {
|
50 |
|
51 |
-
$file_path =
|
52 |
|
53 |
$text = PT_CV_Functions::file_include_content( $file_path );
|
54 |
|
34 |
*/
|
35 |
public static function settings_page_section_one() {
|
36 |
|
37 |
+
$file_path = PT_CV_PATH . 'admin/includes/templates/settings-section-one.php';
|
38 |
|
39 |
$text = PT_CV_Functions::file_include_content( $file_path );
|
40 |
|
48 |
*/
|
49 |
public static function settings_page_section_two() {
|
50 |
|
51 |
+
$file_path = PT_CV_PATH . 'admin/includes/templates/settings-section-two.php';
|
52 |
|
53 |
$text = PT_CV_Functions::file_include_content( $file_path );
|
54 |
|
assets/bootstrap/js/bootstrap.custom.min.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Copyright 2011-2015 Twitter, Inc.
|
5 |
* Licensed under the MIT license
|
6 |
*/
|
7 |
-
if(typeof jQuery==="undefined"){throw new Error("Bootstrap's JavaScript requires jQuery")}+function(c){var d=c.fn.jquery.split(" ")[0].split(".");if((d[0]<2&&d[1]<9)||(d[0]==1&&d[1]==9&&d[2]<1)){throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}}(jQuery);+function(c){function d(){var a=document.createElement("bootstrap");var b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var f in b){if(a.style[f]!==undefined){return{end:b[f]}}}return false}c.fn.emulateTransitionEnd=function(b){var g=false;var h=this;c(this).one("bsTransitionEnd",function(){g=true});var a=function(){if(!g){c(h).trigger(c.support.transition.end)}};setTimeout(a,b);return this};c(function(){c.support.transition=d();if(!c.support.transition){return}c.event.special.bsTransitionEnd={bindType:c.support.transition.end,delegateType:c.support.transition.end,handle:function(a){if(c(a.target).is(this)){return a.handleObj.handler.apply(this,arguments)}}}})}(jQuery);+function(j){var i=function(a,b){this.$element=j(a);this.$indicators=this.$element.find(".pt-cv-carousel-indicators");this.options=b;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",j.proxy(this.keydown,this));this.options.pause=="hover"&&!("ontouchstart" in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",j.proxy(this.pause,this)).on("mouseleave.bs.carousel",j.proxy(this.cycle,this))};i.VERSION="3.3.5";i.TRANSITION_DURATION=600;i.DEFAULTS={interval:5000,pause:"hover",wrap:true,keyboard:true};i.prototype.keydown=function(a){if(/input|textarea/i.test(a.target.tagName)){return}switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()};i.prototype.cycle=function(a){a||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval(j.proxy(this.next,this),this.options.interval));return this};i.prototype.getItemIndex=function(a){this.$items=a.parent().children(".item");return this.$items.index(a||this.$active)};i.prototype.getItemForDirection=function(b,c){var l=this.getItemIndex(c);var e=(b=="prev"&&l===0)||(b=="next"&&l==(this.$items.length-1));if(e&&!this.options.wrap){return c}var a=b=="prev"?-1:1;var d=(l+a)%this.$items.length;return this.$items.eq(d)};i.prototype.to=function(a){var b=this;var c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(a>(this.$items.length-1)||a<0){return}if(this.sliding){return this.$element.one("slid.bs.carousel",function(){b.to(a)})}if(c==a){return this.pause().cycle()}return this.slide(a>c?"next":"prev",this.$items.eq(a))};i.prototype.pause=function(a){a||(this.paused=true);if(this.$element.find(".next, .prev").length&&j.support.transition){this.$element.trigger(j.support.transition.end);this.cycle(true)}this.interval=clearInterval(this.interval);return this};i.prototype.next=function(){if(this.sliding){return}return this.slide("next")};i.prototype.prev=function(){if(this.sliding){return}return this.slide("prev")};i.prototype.slide=function(d,s){var a=this.$element.find(".item.active");var u=s||this.getItemForDirection(d,a);var q=this.interval;var c=d=="next"?"left":"right";var r=this;if(u.hasClass("active")){return(this.sliding=false)}var e=u[0];var v=j.Event("slide.bs.carousel",{relatedTarget:e,direction:c});this.$element.trigger(v);if(v.isDefaultPrevented()){return}this.sliding=true;q&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");var t=j(this.$indicators.children()[this.getItemIndex(u)]);t&&t.addClass("active")}var b=j.Event("slid.bs.carousel",{relatedTarget:e,direction:c});if(j.support.transition&&this.$element.hasClass("slide")){u.addClass(d);u[0].offsetWidth;a.addClass(c);u.addClass(c);a.one("bsTransitionEnd",function(){u.removeClass([d,c].join(" ")).addClass("active");a.removeClass(["active",c].join(" "));r.sliding=false;setTimeout(function(){r.$element.trigger(b)},0)}).emulateTransitionEnd(i.TRANSITION_DURATION)}else{a.removeClass("active");u.addClass("active");this.sliding=false;this.$element.trigger(b)}q&&this.cycle();return this};function f(a){return this.each(function(){var b=j(this);var c=b.data("bs.carousel");var e=j.extend({},i.DEFAULTS,b.data(),typeof a=="object"&&a);var d=typeof a=="string"?a:e.slide;if(!c){b.data("bs.carousel",(c=new i(this,e)))}if(typeof a=="number"){c.to(a)}else{if(d){c[d]()}else{if(e.interval){c.pause().cycle()}}}})}var g=j.fn.carousel;j.fn.carousel=f;j.fn.carousel.Constructor=i;j.fn.carousel.noConflict=function(){j.fn.carousel=g;return this};var h=function(a){var e;var b=j(this);var l=j(b.attr("data-target")||(e=b.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,""));if(!l.hasClass("carousel")){return}var d=j.extend({},l.data(),b.data());var c=b.attr("data-slide-to");if(c){d.interval=false}f.call(l,d);if(c){l.data("bs.carousel").to(c)}a.preventDefault()};j(document).on("click.bs.carousel.data-api","[data-slide]",h).on("click.bs.carousel.data-api","[data-slide-to]",h);j(window).on("load",function(){j('[data-ride="carousel"]').each(function(){var a=j(this);f.call(a,a.data())})})}(jQuery);+function(i){var h=function(a,b){this.$element=i(a);this.options=i.extend({},h.DEFAULTS,b);this.$trigger=i('[data-toggle="collapse"][href="#'+a.id+'"],[data-toggle="collapse"][data-target="#'+a.id+'"]');this.transitioning=null;if(this.options.parent){this.$parent=this.getParent()}else{this.addAriaAndCollapsedClass(this.$element,this.$trigger)}if(this.options.toggle){this.toggle()}};h.VERSION="3.3.5";h.TRANSITION_DURATION=350;h.DEFAULTS={toggle:true};h.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"};h.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in")){return}var d;var b=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(b&&b.length){d=b.data("bs.collapse");if(d&&d.transitioning){return}}var e=i.Event("show.bs.collapse");this.$element.trigger(e);if(e.isDefaultPrevented()){return}if(b&&b.length){f.call(b,"hide");d||b.data("bs.collapse",null)}var a=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded",true);this.$trigger.removeClass("collapsed").attr("aria-expanded",true);this.transitioning=1;var l=function(){this.$element.removeClass("collapsing").addClass("collapse in")[a]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")};if(!i.support.transition){return l.call(this)}var c=i.camelCase(["scroll",a].join("-"));this.$element.one("bsTransitionEnd",i.proxy(l,this)).emulateTransitionEnd(h.TRANSITION_DURATION)[a](this.$element[0][c])};h.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in")){return}var b=i.Event("hide.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented()){return}var a=this.dimension();this.$element[a](this.$element[a]())[0].offsetHeight;this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",false);this.$trigger.addClass("collapsed").attr("aria-expanded",false);this.transitioning=1;var c=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!i.support.transition){return c.call(this)}this.$element[a](0).one("bsTransitionEnd",i.proxy(c,this)).emulateTransitionEnd(h.TRANSITION_DURATION)};h.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};h.prototype.getParent=function(){return i(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(i.proxy(function(a,b){var c=i(b);this.addAriaAndCollapsedClass(j(c),c)},this)).end()};h.prototype.addAriaAndCollapsedClass=function(b,c){var a=b.hasClass("in");b.attr("aria-expanded",a);c.toggleClass("collapsed",!a).attr("aria-expanded",a)};function j(c){var b;var a=c.attr("data-target")||(b=c.attr("href"))&&b.replace(/.*(?=#[^\s]+$)/,"");return i(a)}function f(a){return this.each(function(){var b=i(this);var c=b.data("bs.collapse");var d=i.extend({},h.DEFAULTS,b.data(),typeof a=="object"&&a);if(!c&&d.toggle&&/show|hide/.test(a)){d.toggle=false}if(!c){b.data("bs.collapse",(c=new h(this,d)))}if(typeof a=="string"){c[a]()}})}var g=i.fn.collapse;i.fn.collapse=f;i.fn.collapse.Constructor=h;i.fn.collapse.noConflict=function(){i.fn.collapse=g;return this};i(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(a){var b=i(this);if(!b.attr("data-target")){a.preventDefault()}var e=j(b);var c=e.data("bs.collapse");var d=c?"toggle":b.data();f.call(e,d)})}(jQuery);+function(k){var n=".dropdown-backdrop";var i='[data-toggle="dropdown"]';var j=function(a){k(a).on("click.bs.dropdown",this.toggle)};j.VERSION="3.3.5";function m(a){var c=a.attr("data-target");if(!c){c=a.attr("href");c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,"")}var b=c&&k(c);return b&&b.length?b:a.parent()}function o(a){if(a&&a.which===3){return}k(n).remove();k(i).each(function(){var b=k(this);var c=m(b);var d={relatedTarget:this};if(!c.hasClass("open")){return}if(a&&a.type=="click"&&/input|textarea/i.test(a.target.tagName)&&k.contains(c[0],a.target)){return}c.trigger(a=k.Event("hide.bs.dropdown",d));if(a.isDefaultPrevented()){return}b.attr("aria-expanded","false");c.removeClass("open").trigger("hidden.bs.dropdown",d)})}j.prototype.toggle=function(a){var b=k(this);if(b.is(".disabled, :disabled")){return}var c=m(b);var d=c.hasClass("open");o();if(!d){if("ontouchstart" in document.documentElement&&!c.closest(".navbar-nav").length){k(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(k(this)).on("click",o)}var e={relatedTarget:this};c.trigger(a=k.Event("show.bs.dropdown",e));if(a.isDefaultPrevented()){return}b.trigger("focus").attr("aria-expanded","true");c.toggleClass("open").trigger("shown.bs.dropdown",e)}return false};j.prototype.keydown=function(a){if(!/(38|40|27|32)/.test(a.which)||/input|textarea/i.test(a.target.tagName)){return}var b=k(this);a.preventDefault();a.stopPropagation();if(b.is(".disabled, :disabled")){return}var c=m(b);var d=c.hasClass("open");if(!d&&a.which!=27||d&&a.which==27){if(a.which==27){c.find(i).trigger("focus")}return b.trigger("click")}var g=" li:not(.disabled):visible a";var f=c.find(".dropdown-menu"+g);if(!f.length){return}var e=f.index(a.target);if(a.which==38&&e>0){e--}if(a.which==40&&e<f.length-1){e++}if(!~e){e=0}f.eq(e).trigger("focus")};function l(a){return this.each(function(){var b=k(this);var c=b.data("bs.dropdown");if(!c){b.data("bs.dropdown",(c=new j(this)))}if(typeof a=="string"){c[a].call(b)}})}var p=k.fn.dropdown;k.fn.dropdown=l;k.fn.dropdown.Constructor=j;k.fn.dropdown.noConflict=function(){k.fn.dropdown=p;return this};k(document).ready(function(){k(".pt-cv-wrapper").on("click.bs.dropdown.data-api",o).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",i,j.prototype.toggle).on("keydown.bs.dropdown.data-api",i,j.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",j.prototype.keydown)})}(jQuery);+function(i){var f=function(a){this.element=i(a)};f.VERSION="3.3.5";f.TRANSITION_DURATION=150;f.prototype.show=function(){var a=this.element;var e=a.closest("ul:not(.dropdown-menu)");var m=a.data("target");if(!m){m=a.attr("href");m=m&&m.replace(/.*(?=#[^\s]*$)/,"")}if(a.parent("li").hasClass("active")){return}var c=e.find(".active:last a");var b=i.Event("hide.bs.tab",{relatedTarget:a[0]});var d=i.Event("show.bs.tab",{relatedTarget:c[0]});c.trigger(b);a.trigger(d);if(d.isDefaultPrevented()||b.isDefaultPrevented()){return}var n=i(m);this.activate(a.closest("li"),e);this.activate(n,n.parent(),function(){c.trigger({type:"hidden.bs.tab",relatedTarget:a[0]});a.trigger({type:"shown.bs.tab",relatedTarget:c[0]})})};f.prototype.activate=function(d,e,a){var l=e.find("> .active");var b=a&&i.support.transition&&(l.length&&l.hasClass("fade")||!!e.find("> .fade").length);function c(){l.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",false);d.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",true);if(b){d[0].offsetWidth;d.addClass("in")}else{d.removeClass("fade")}if(d.parent(".dropdown-menu").length){d.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",true)}a&&a()}l.length&&b?l.one("bsTransitionEnd",c).emulateTransitionEnd(f.TRANSITION_DURATION):c();l.removeClass("in")};function j(a){return this.each(function(){var b=i(this);var c=b.data("bs.tab");if(!c){b.data("bs.tab",(c=new f(this)))}if(typeof a=="string"){c[a]()}})}var g=i.fn.tab;i.fn.tab=j;i.fn.tab.Constructor=f;i.fn.tab.noConflict=function(){i.fn.tab=g;return this};var h=function(a){a.preventDefault();j.call(i(this),"show")};i(document).ready(function(){i(".pt-cv-wrapper").on("click.bs.tab.data-api",'[data-toggle="tab"]',h).on("click.bs.tab.data-api",'[data-toggle="pill"]',h)})}(jQuery);
|
8 |
|
9 |
|
10 |
/**
|
4 |
* Copyright 2011-2015 Twitter, Inc.
|
5 |
* Licensed under the MIT license
|
6 |
*/
|
7 |
+
if(typeof jQuery==="undefined"){throw new Error("Bootstrap's JavaScript requires jQuery")}+function(b){function a(){var e=document.createElement("bootstrap");var d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in d){if(e.style[c]!==undefined){return{end:d[c]}}}return false}b.fn.emulateTransitionEnd=function(e){var d=false;var c=this;b(this).one("bsTransitionEnd",function(){d=true});var f=function(){if(!d){b(c).trigger(b.support.transition.end)}};setTimeout(f,e);return this};b(function(){b.support.transition=a();if(!b.support.transition){return}b.event.special.bsTransitionEnd={bindType:b.support.transition.end,delegateType:b.support.transition.end,handle:function(c){if(b(c.target).is(this)){return c.handleObj.handler.apply(this,arguments)}}}})}(jQuery);+function(c){var d=function(g,f){this.$element=c(g);this.$indicators=this.$element.find(".pt-cv-carousel-indicators");this.options=f;this.paused=null;this.sliding=null;this.interval=null;this.$active=null;this.$items=null;this.options.keyboard&&this.$element.on("keydown.bs.carousel",c.proxy(this.keydown,this));this.options.pause=="hover"&&!("ontouchstart" in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",c.proxy(this.pause,this)).on("mouseleave.bs.carousel",c.proxy(this.cycle,this))};d.VERSION="3.3.5";d.TRANSITION_DURATION=600;d.DEFAULTS={interval:5000,pause:"hover",wrap:true,keyboard:true};d.prototype.keydown=function(f){if(/input|textarea/i.test(f.target.tagName)){return}switch(f.which){case 37:this.prev();break;case 39:this.next();break;default:return}f.preventDefault()};d.prototype.cycle=function(f){f||(this.paused=false);this.interval&&clearInterval(this.interval);this.options.interval&&!this.paused&&(this.interval=setInterval(c.proxy(this.next,this),this.options.interval));return this};d.prototype.getItemIndex=function(f){this.$items=f.parent().children(".item");return this.$items.index(f||this.$active)};d.prototype.getItemForDirection=function(j,i){var f=this.getItemIndex(i);var g=(j=="prev"&&f===0)||(j=="next"&&f==(this.$items.length-1));if(g&&!this.options.wrap){return i}var k=j=="prev"?-1:1;var h=(f+k)%this.$items.length;return this.$items.eq(h)};d.prototype.to=function(h){var g=this;var f=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(h>(this.$items.length-1)||h<0){return}if(this.sliding){return this.$element.one("slid.bs.carousel",function(){g.to(h)})}if(f==h){return this.pause().cycle()}return this.slide(h>f?"next":"prev",this.$items.eq(h))};d.prototype.pause=function(f){f||(this.paused=true);if(this.$element.find(".next, .prev").length&&c.support.transition){this.$element.trigger(c.support.transition.end);this.cycle(true)}this.interval=clearInterval(this.interval);return this};d.prototype.next=function(){if(this.sliding){return}return this.slide("next")};d.prototype.prev=function(){if(this.sliding){return}return this.slide("prev")};d.prototype.slide=function(m,i){var p=this.$element.find(".item.active");var g=i||this.getItemForDirection(m,p);var k=this.interval;var n=m=="next"?"left":"right";var j=this;if(g.hasClass("active")){return(this.sliding=false)}var l=g[0];var f=c.Event("slide.bs.carousel",{relatedTarget:l,direction:n});this.$element.trigger(f);if(f.isDefaultPrevented()){return}this.sliding=true;k&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=c(this.$indicators.children()[this.getItemIndex(g)]);h&&h.addClass("active")}var o=c.Event("slid.bs.carousel",{relatedTarget:l,direction:n});if(c.support.transition&&this.$element.hasClass("slide")){g.addClass(m);g[0].offsetWidth;p.addClass(n);g.addClass(n);p.one("bsTransitionEnd",function(){g.removeClass([m,n].join(" ")).addClass("active");p.removeClass(["active",n].join(" "));j.sliding=false;setTimeout(function(){j.$element.trigger(o)},0)}).emulateTransitionEnd(d.TRANSITION_DURATION)}else{p.removeClass("active");g.addClass("active");this.sliding=false;this.$element.trigger(o)}k&&this.cycle();return this};function b(f){return this.each(function(){var j=c(this);var i=j.data("bs.carousel");var g=c.extend({},d.DEFAULTS,j.data(),typeof f=="object"&&f);var h=typeof f=="string"?f:g.slide;if(!i){j.data("bs.carousel",(i=new d(this,g)))}if(typeof f=="number"){i.to(f)}else{if(h){i[h]()}else{if(g.interval){i.pause().cycle()}}}})}var a=c.fn.carousel;c.fn.carousel=b;c.fn.carousel.Constructor=d;c.fn.carousel.noConflict=function(){c.fn.carousel=a;return this};var e=function(k){var g;var j=c(this);var f=c(j.attr("data-target")||(g=j.attr("href"))&&g.replace(/.*(?=#[^\s]+$)/,""));if(!f.hasClass("carousel")){return}var h=c.extend({},f.data(),j.data());var i=j.attr("data-slide-to");if(i){h.interval=false}b.call(f,h);if(i){f.data("bs.carousel").to(i)}k.preventDefault()};c(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e);c(window).on("load",function(){c('[data-ride="carousel"]').each(function(){var f=c(this);b.call(f,f.data())})})}(jQuery);+function(d){var e=function(g,f){this.$element=d(g);this.options=d.extend({},e.DEFAULTS,f);this.$trigger=d('[data-toggle="collapse"][href="#'+g.id+'"],[data-toggle="collapse"][data-target="#'+g.id+'"]');this.transitioning=null;if(this.options.parent){this.$parent=this.getParent()}else{this.addAriaAndCollapsedClass(this.$element,this.$trigger)}if(this.options.toggle){this.toggle()}};e.VERSION="3.3.5";e.TRANSITION_DURATION=350;e.DEFAULTS={toggle:true};e.prototype.dimension=function(){var f=this.$element.hasClass("width");return f?"width":"height"};e.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in")){return}var h;var j=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(j&&j.length){h=j.data("bs.collapse");if(h&&h.transitioning){return}}var g=d.Event("show.bs.collapse");this.$element.trigger(g);if(g.isDefaultPrevented()){return}if(j&&j.length){b.call(j,"hide");h||j.data("bs.collapse",null)}var k=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[k](0).attr("aria-expanded",true);this.$trigger.removeClass("collapsed").attr("aria-expanded",true);this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("collapse in")[k]("");this.transitioning=0;this.$element.trigger("shown.bs.collapse")};if(!d.support.transition){return f.call(this)}var i=d.camelCase(["scroll",k].join("-"));this.$element.one("bsTransitionEnd",d.proxy(f,this)).emulateTransitionEnd(e.TRANSITION_DURATION)[k](this.$element[0][i])};e.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in")){return}var g=d.Event("hide.bs.collapse");this.$element.trigger(g);if(g.isDefaultPrevented()){return}var h=this.dimension();this.$element[h](this.$element[h]())[0].offsetHeight;this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",false);this.$trigger.addClass("collapsed").attr("aria-expanded",false);this.transitioning=1;var f=function(){this.transitioning=0;this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!d.support.transition){return f.call(this)}this.$element[h](0).one("bsTransitionEnd",d.proxy(f,this)).emulateTransitionEnd(e.TRANSITION_DURATION)};e.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};e.prototype.getParent=function(){return d(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(d.proxy(function(h,g){var f=d(g);this.addAriaAndCollapsedClass(c(f),f)},this)).end()};e.prototype.addAriaAndCollapsedClass=function(g,f){var h=g.hasClass("in");g.attr("aria-expanded",h);f.toggleClass("collapsed",!h).attr("aria-expanded",h)};function c(f){var g;var h=f.attr("data-target")||(g=f.attr("href"))&&g.replace(/.*(?=#[^\s]+$)/,"");return d(h)}function b(f){return this.each(function(){var i=d(this);var h=i.data("bs.collapse");var g=d.extend({},e.DEFAULTS,i.data(),typeof f=="object"&&f);if(!h&&g.toggle&&/show|hide/.test(f)){g.toggle=false}if(!h){i.data("bs.collapse",(h=new e(this,g)))}if(typeof f=="string"){h[f]()}})}var a=d.fn.collapse;d.fn.collapse=b;d.fn.collapse.Constructor=e;d.fn.collapse.noConflict=function(){d.fn.collapse=a;return this};d(document).ready(function(){d(".pt-cv-wrapper").on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(j){var i=d(this);if(!i.attr("data-target")){j.preventDefault()}var f=c(i);var h=f.data("bs.collapse");var g=h?"toggle":i.data();b.call(f,g)})})}(jQuery);+function(h){var e=".dropdown-backdrop";var b='[data-toggle="dropdown"]';var a=function(i){h(i).on("click.bs.dropdown",this.toggle)};a.VERSION="3.3.5";function f(k){var i=k.attr("data-target");if(!i){i=k.attr("href");i=i&&/#[A-Za-z]/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")}var j=i&&h(i);return j&&j.length?j:k.parent()}function d(i){if(i&&i.which===3){return}h(e).remove();h(b).each(function(){var l=h(this);var k=f(l);var j={relatedTarget:this};if(!k.hasClass("open")){return}if(i&&i.type=="click"&&/input|textarea/i.test(i.target.tagName)&&h.contains(k[0],i.target)){return}k.trigger(i=h.Event("hide.bs.dropdown",j));if(i.isDefaultPrevented()){return}l.attr("aria-expanded","false");k.removeClass("open").trigger("hidden.bs.dropdown",j)})}a.prototype.toggle=function(m){var l=h(this);if(l.is(".disabled, :disabled")){return}var k=f(l);var j=k.hasClass("open");d();if(!j){if("ontouchstart" in document.documentElement&&!k.closest(".navbar-nav").length){h(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(h(this)).on("click",d)}var i={relatedTarget:this};k.trigger(m=h.Event("show.bs.dropdown",i));if(m.isDefaultPrevented()){return}l.trigger("focus").attr("aria-expanded","true");k.toggleClass("open").trigger("shown.bs.dropdown",i)}return false};a.prototype.keydown=function(m){if(!/(38|40|27|32)/.test(m.which)||/input|textarea/i.test(m.target.tagName)){return}var l=h(this);m.preventDefault();m.stopPropagation();if(l.is(".disabled, :disabled")){return}var k=f(l);var j=k.hasClass("open");if(!j&&m.which!=27||j&&m.which==27){if(m.which==27){k.find(b).trigger("focus")}return l.trigger("click")}var n=" li:not(.disabled):visible a";var o=k.find(".dropdown-menu"+n);if(!o.length){return}var i=o.index(m.target);if(m.which==38&&i>0){i--}if(m.which==40&&i<o.length-1){i++}if(!~i){i=0}o.eq(i).trigger("focus")};function g(i){return this.each(function(){var k=h(this);var j=k.data("bs.dropdown");if(!j){k.data("bs.dropdown",(j=new a(this)))}if(typeof i=="string"){j[i].call(k)}})}var c=h.fn.dropdown;h.fn.dropdown=g;h.fn.dropdown.Constructor=a;h.fn.dropdown.noConflict=function(){h.fn.dropdown=c;return this};h(document).ready(function(){h(".pt-cv-wrapper").on("click.bs.dropdown.data-api",d).on("click.bs.dropdown.data-api",".dropdown form",function(i){i.stopPropagation()}).on("click.bs.dropdown.data-api",b,a.prototype.toggle).on("keydown.bs.dropdown.data-api",b,a.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",a.prototype.keydown)})}(jQuery);+function(d){var b=function(f){this.element=d(f)};b.VERSION="3.3.5";b.TRANSITION_DURATION=150;b.prototype.show=function(){var l=this.element;var h=l.closest("ul:not(.dropdown-menu)");var g=l.data("target");if(!g){g=l.attr("href");g=g&&g.replace(/.*(?=#[^\s]*$)/,"")}if(l.parent("li").hasClass("active")){return}var j=h.find(".active:last a");var k=d.Event("hide.bs.tab",{relatedTarget:l[0]});var i=d.Event("show.bs.tab",{relatedTarget:j[0]});j.trigger(k);l.trigger(i);if(i.isDefaultPrevented()||k.isDefaultPrevented()){return}var f=d(g);this.activate(l.closest("li"),h);this.activate(f,f.parent(),function(){j.trigger({type:"hidden.bs.tab",relatedTarget:l[0]});l.trigger({type:"shown.bs.tab",relatedTarget:j[0]})})};b.prototype.activate=function(h,g,k){var f=g.find("> .active");var j=k&&d.support.transition&&(f.length&&f.hasClass("fade")||!!g.find("> .fade").length);function i(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",false);h.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",true);if(j){h[0].offsetWidth;h.addClass("in")}else{h.removeClass("fade")}if(h.parent(".dropdown-menu").length){h.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",true)}k&&k()}f.length&&j?f.one("bsTransitionEnd",i).emulateTransitionEnd(b.TRANSITION_DURATION):i();f.removeClass("in")};function c(f){return this.each(function(){var h=d(this);var g=h.data("bs.tab");if(!g){h.data("bs.tab",(g=new b(this)))}if(typeof f=="string"){g[f]()}})}var a=d.fn.tab;d.fn.tab=c;d.fn.tab.Constructor=b;d.fn.tab.noConflict=function(){d.fn.tab=a;return this};var e=function(f){f.preventDefault();c.call(d(this),"show")};d(document).ready(function(){d(".pt-cv-wrapper").on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)})}(jQuery);
|
8 |
|
9 |
|
10 |
/**
|
content-views.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* Plugin Name: Content Views
|
12 |
* Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
|
13 |
* Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
|
14 |
-
* Version: 1.8.0.
|
15 |
* Author: PT Guy
|
16 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
17 |
* Text Domain: content-views-query-and-display-post-page
|
@@ -24,65 +24,42 @@
|
|
24 |
if ( !defined( 'WPINC' ) ) {
|
25 |
die;
|
26 |
}
|
27 |
-
/*
|
28 |
-
* Define Constant
|
29 |
-
*/
|
30 |
-
define( 'PT_CV_VERSION', '1.8.0.1' );
|
31 |
-
define( 'PT_CV_FILE', __FILE__ );
|
32 |
-
|
33 |
-
$pt_cv_path = plugin_dir_path( __FILE__ );
|
34 |
-
include_once( $pt_cv_path . 'includes/defines.php' );
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
include_once(
|
41 |
-
include_once( $pt_cv_path . 'includes/hooks.php' );
|
42 |
-
include_once( $pt_cv_path . 'includes/html-viewtype.php' );
|
43 |
-
include_once( $pt_cv_path . 'includes/html.php' );
|
44 |
-
include_once( $pt_cv_path . 'includes/settings.php' );
|
45 |
-
include_once( $pt_cv_path . 'includes/update.php' );
|
46 |
-
include_once( $pt_cv_path . 'includes/values.php' );
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
*/
|
55 |
-
include_once( $pt_cv_path . 'public/content-views.php' );
|
56 |
|
57 |
-
|
58 |
-
* Register hooks that are fired when the plugin is activated or deactivated.
|
59 |
-
* When the plugin is deleted, the uninstall.php file is loaded.
|
60 |
-
*/
|
61 |
register_activation_hook( __FILE__, array( 'PT_Content_Views', 'activate' ) );
|
62 |
register_deactivation_hook( __FILE__, array( 'PT_Content_Views', 'deactivate' ) );
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
/* ----------------------------------------------------------------------------*
|
67 |
-
* Dashboard and Administrative Functionality
|
68 |
-
* ---------------------------------------------------------------------------- */
|
69 |
|
|
|
70 |
if ( is_admin() ) {
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
-
include_once( $pt_cv_path . 'admin/content-views-admin.php' );
|
74 |
-
add_action( 'plugins_loaded', array( 'PT_Content_Views_Admin', 'get_instance' ) );
|
75 |
-
|
76 |
-
// Require PT Options framework
|
77 |
-
include_once( $pt_cv_path . 'admin/includes/options.php' );
|
78 |
-
|
79 |
-
// Settings page for the plugin
|
80 |
-
include_once( $pt_cv_path . 'admin/includes/plugin.php' );
|
81 |
}
|
82 |
|
83 |
-
/**
|
84 |
-
* Common settings
|
85 |
-
*/
|
86 |
// Support for post thumbnails
|
87 |
add_theme_support( 'post-thumbnails' );
|
88 |
|
11 |
* Plugin Name: Content Views
|
12 |
* Plugin URI: http://wordpress.org/plugins/content-views-query-and-display-post-page/
|
13 |
* Description: Query and display <strong>posts, pages</strong> in awesome layouts (<strong>grid, scrollable list, collapsible list</strong>) easier than ever, without coding!
|
14 |
+
* Version: 1.8.0.2
|
15 |
* Author: PT Guy
|
16 |
* Author URI: http://profiles.wordpress.org/pt-guy
|
17 |
* Text Domain: content-views-query-and-display-post-page
|
24 |
if ( !defined( 'WPINC' ) ) {
|
25 |
die;
|
26 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
// Define Constant
|
29 |
+
define( 'PT_CV_VERSION', '1.8.0.2' );
|
30 |
+
define( 'PT_CV_FILE', __FILE__ );
|
31 |
+
define( 'PT_CV_PATH', plugin_dir_path( __FILE__ ) );
|
32 |
+
include_once( PT_CV_PATH . 'includes/defines.php' );
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
+
// Include library files
|
35 |
+
include_once( PT_CV_PATH . 'includes/assets.php' );
|
36 |
+
include_once( PT_CV_PATH . 'includes/functions.php' );
|
37 |
+
include_once( PT_CV_PATH . 'includes/hooks.php' );
|
38 |
+
include_once( PT_CV_PATH . 'includes/html-viewtype.php' );
|
39 |
+
include_once( PT_CV_PATH . 'includes/html.php' );
|
40 |
+
include_once( PT_CV_PATH . 'includes/settings.php' );
|
41 |
+
include_once( PT_CV_PATH . 'includes/update.php' );
|
42 |
+
include_once( PT_CV_PATH . 'includes/values.php' );
|
43 |
|
44 |
+
// Main file
|
45 |
+
include_once( PT_CV_PATH . 'public/content-views.php' );
|
|
|
|
|
46 |
|
47 |
+
// Register hooks when the plugin is activated or deactivated.
|
|
|
|
|
|
|
48 |
register_activation_hook( __FILE__, array( 'PT_Content_Views', 'activate' ) );
|
49 |
register_deactivation_hook( __FILE__, array( 'PT_Content_Views', 'deactivate' ) );
|
50 |
|
51 |
+
// Load plugin
|
52 |
+
PT_Content_Views::get_instance();
|
|
|
|
|
|
|
53 |
|
54 |
+
// For Admin
|
55 |
if ( is_admin() ) {
|
56 |
+
include_once( PT_CV_PATH . 'admin/includes/options.php' );
|
57 |
+
include_once( PT_CV_PATH . 'admin/includes/plugin.php' );
|
58 |
+
include_once( PT_CV_PATH . 'admin/content-views-admin.php' );
|
59 |
|
60 |
+
PT_Content_Views_Admin::get_instance();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
|
|
|
|
|
|
63 |
// Support for post thumbnails
|
64 |
add_theme_support( 'post-thumbnails' );
|
65 |
|
includes/defines.php
CHANGED
@@ -28,17 +28,16 @@ define( 'PT_CV_META_SETTINGS', '_' . PT_CV_PREFIX_ . 'settings' );
|
|
28 |
define( 'PT_CV_META_VIEW_COUNT', '_' . PT_CV_PREFIX_ . 'view_count' );
|
29 |
|
30 |
// Public assets directory
|
31 |
-
define( 'PT_CV_PUBLIC_ASSETS',
|
32 |
|
33 |
// Public assets uri
|
34 |
define( 'PT_CV_PUBLIC_ASSETS_URI', plugins_url( 'public/assets/', PT_CV_FILE ) );
|
35 |
|
36 |
// View type directory (HTML + CSS + JS)
|
37 |
-
define( 'PT_CV_VIEW_TYPE_OUTPUT',
|
38 |
|
39 |
// Enable/Disable debug mode
|
40 |
define( 'PT_CV_DEBUG', false );
|
41 |
|
42 |
// Script error
|
43 |
-
define( 'PT_CV_SOLVE_SCRIPT_ERROR', '
|
44 |
-
define( 'PT_CV_HIDE_SCRIPT_ERROR', 'cv_hide_script_error' );
|
28 |
define( 'PT_CV_META_VIEW_COUNT', '_' . PT_CV_PREFIX_ . 'view_count' );
|
29 |
|
30 |
// Public assets directory
|
31 |
+
define( 'PT_CV_PUBLIC_ASSETS', PT_CV_PATH . 'public/assets/' );
|
32 |
|
33 |
// Public assets uri
|
34 |
define( 'PT_CV_PUBLIC_ASSETS_URI', plugins_url( 'public/assets/', PT_CV_FILE ) );
|
35 |
|
36 |
// View type directory (HTML + CSS + JS)
|
37 |
+
define( 'PT_CV_VIEW_TYPE_OUTPUT', PT_CV_PATH . 'public/templates/' );
|
38 |
|
39 |
// Enable/Disable debug mode
|
40 |
define( 'PT_CV_DEBUG', false );
|
41 |
|
42 |
// Script error
|
43 |
+
define( 'PT_CV_SOLVE_SCRIPT_ERROR', 'cv_solve_script_error_181' );
|
|
includes/functions.php
CHANGED
@@ -734,7 +734,8 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
734 |
if ( $pt_query->have_posts() ) {
|
735 |
do_action( PT_CV_PREFIX_ . 'before_process_item' );
|
736 |
|
737 |
-
$
|
|
|
738 |
while ( $pt_query->have_posts() ) {
|
739 |
$pt_query->the_post();
|
740 |
global $post;
|
@@ -742,10 +743,12 @@ if ( !class_exists( 'PT_CV_Functions' ) ) {
|
|
742 |
// Output HTML for this item
|
743 |
$_post = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post );
|
744 |
if ( $_post ) {
|
745 |
-
$content_items[ $post->ID ]
|
|
|
746 |
}
|
747 |
}
|
748 |
|
|
|
749 |
do_action( PT_CV_PREFIX_ . 'after_process_item' );
|
750 |
} else {
|
751 |
// Get no post found class
|
734 |
if ( $pt_query->have_posts() ) {
|
735 |
do_action( PT_CV_PREFIX_ . 'before_process_item' );
|
736 |
|
737 |
+
$all_posts = array();
|
738 |
+
$post_idx = 0;
|
739 |
while ( $pt_query->have_posts() ) {
|
740 |
$pt_query->the_post();
|
741 |
global $post;
|
743 |
// Output HTML for this item
|
744 |
$_post = apply_filters( PT_CV_PREFIX_ . 'show_this_post', $post );
|
745 |
if ( $_post ) {
|
746 |
+
$content_items[ $post->ID ] = PT_CV_Html::view_type_output( $view_type, $post, $post_idx++ );
|
747 |
+
$all_posts[ $post->ID ] = $post;
|
748 |
}
|
749 |
}
|
750 |
|
751 |
+
$GLOBALS[ 'cv_posts' ] = $all_posts;
|
752 |
do_action( PT_CV_PREFIX_ . 'after_process_item' );
|
753 |
} else {
|
754 |
// Get no post found class
|
includes/hooks.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Custom filters/actions
|
4 |
*
|
@@ -32,8 +33,8 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
|
|
32 |
add_action( PT_CV_PREFIX_ . 'before_process_item', array( __CLASS__, 'action_before_process_item' ) );
|
33 |
add_action( PT_CV_PREFIX_ . 'after_process_item', array( __CLASS__, 'action_after_process_item' ) );
|
34 |
|
|
|
35 |
add_action( 'init', array( __CLASS__, 'action_init' ), 1 );
|
36 |
-
add_action( 'wp_footer', array( __CLASS__, 'action_wp_footer' ), 100 );
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -167,72 +168,18 @@ if ( !class_exists( 'PT_CV_Hooks' ) ) {
|
|
167 |
}
|
168 |
|
169 |
public static function action_init() {
|
170 |
-
if ( !empty( $_GET[ PT_CV_SOLVE_SCRIPT_ERROR ] ) ) {
|
171 |
-
update_option( PT_CV_SOLVE_SCRIPT_ERROR, true, false );
|
172 |
-
}
|
173 |
-
|
174 |
-
if ( !empty( $_GET[ PT_CV_HIDE_SCRIPT_ERROR ] ) ) {
|
175 |
-
update_option( PT_CV_HIDE_SCRIPT_ERROR, true, false );
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
-
/**
|
180 |
-
* If there was JS error occurs, try to solve it.
|
181 |
-
*
|
182 |
-
* @since 1.8
|
183 |
-
* @global type $wp
|
184 |
-
* @return type
|
185 |
-
*/
|
186 |
-
public static function action_wp_footer() {
|
187 |
$user_can = current_user_can( 'administrator' ) || current_user_can( PT_CV_Functions::get_option_value( 'access_role' ) );
|
188 |
-
if (
|
189 |
return;
|
190 |
}
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
$style = "style='font-weight:600;color:red'";
|
195 |
-
|
196 |
-
if ( get_option( PT_CV_SOLVE_SCRIPT_ERROR ) ) {
|
197 |
-
$action1 = add_query_arg( array( PT_CV_HIDE_SCRIPT_ERROR => '1', ), $current_url );
|
198 |
-
$hideit = sprintf( "<a href='%s' $style>here</a>", $action1 );
|
199 |
-
$error_js = sprintf( __( "If Content Views still doesn't work well, please %s contact us %s. Otherwise, please click %s to hide this message.", PT_CV_TEXTDOMAIN ), "<a href='http://www.contentviewspro.com/contact/?utm_source=frontend_error' target='_blank' $style>", '</a>', $hideit );
|
200 |
-
} else {
|
201 |
-
$action2 = add_query_arg( array( PT_CV_SOLVE_SCRIPT_ERROR => '1', ), $current_url );
|
202 |
-
$solveit = sprintf( "<a href='%s' $style>here</a>", $action2 );
|
203 |
-
$closein = sprintf( "<br><span id='cv-close-1'>«%s»</span>", __( 'Closing in <code>20</code> seconds', PT_CV_TEXTDOMAIN ) );
|
204 |
-
// it must be caused by Javascript error(s) on this page
|
205 |
-
$error_js = sprintf( __( "There is Javascript error (of theme/another plugin) which can stop Content Views features (ajax pagination, scrollable list, collapsible list...) from working properly. Please click %s to eliminate influence of this error to Content Views.", PT_CV_TEXTDOMAIN ), $solveit ) . $closein;
|
206 |
}
|
207 |
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
$prefix = PT_CV_PREFIX;
|
213 |
-
$view_selector = ".{$prefix}view";
|
214 |
-
?>
|
215 |
-
<script type="text/javascript" id="cv-debug-script-1">
|
216 |
-
window.onerror = function ( message, source, lineno, colno, error ) {
|
217 |
-
if ( typeof jQuery === "function" ) {
|
218 |
-
if ( jQuery( '<?php echo $view_selector; ?>' ).length ) {
|
219 |
-
jQuery( '<?php echo $view_selector; ?>' ).first().before( "<?php echo $error_html; ?>" );
|
220 |
-
|
221 |
-
jQuery( '#<?php echo $alert_id; ?> code' ).each( function () {
|
222 |
-
var $this = jQuery( this ), t = 19, clsit = window.setInterval( function () {
|
223 |
-
$this.html( t );
|
224 |
-
if ( t === 0 ) {
|
225 |
-
clearInterval( clsit );
|
226 |
-
$this.closest( 'div' ).hide( 0 );
|
227 |
-
}
|
228 |
-
t--;
|
229 |
-
}, 1000 );
|
230 |
-
} );
|
231 |
-
}
|
232 |
-
}
|
233 |
-
};
|
234 |
-
</script>
|
235 |
-
<?php
|
236 |
}
|
237 |
|
238 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Custom filters/actions
|
5 |
*
|
33 |
add_action( PT_CV_PREFIX_ . 'before_process_item', array( __CLASS__, 'action_before_process_item' ) );
|
34 |
add_action( PT_CV_PREFIX_ . 'after_process_item', array( __CLASS__, 'action_after_process_item' ) );
|
35 |
|
36 |
+
// For only Frontend
|
37 |
add_action( 'init', array( __CLASS__, 'action_init' ), 1 );
|
|
|
38 |
}
|
39 |
|
40 |
/**
|
168 |
}
|
169 |
|
170 |
public static function action_init() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
$user_can = current_user_can( 'administrator' ) || current_user_can( PT_CV_Functions::get_option_value( 'access_role' ) );
|
172 |
+
if ( !($user_can) ) {
|
173 |
return;
|
174 |
}
|
175 |
|
176 |
+
if ( !empty( $_GET[ PT_CV_SOLVE_SCRIPT_ERROR ] ) ) {
|
177 |
+
update_option( PT_CV_SOLVE_SCRIPT_ERROR, true, false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
+
if ( !empty( $_GET[ 'cv_undo_solve_error' ] ) ) {
|
181 |
+
delete_option( PT_CV_SOLVE_SCRIPT_ERROR );
|
182 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
}
|
184 |
|
185 |
}
|
public/content-views.php
CHANGED
@@ -38,12 +38,12 @@ class PT_Content_Views {
|
|
38 |
* @since 1.0.0
|
39 |
*/
|
40 |
private function __construct() {
|
41 |
-
// Init session
|
42 |
-
add_action( 'init', array( $this, 'register_session' ), 1 );
|
43 |
-
|
44 |
// Load plugin text domain
|
45 |
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 11 );
|
46 |
|
|
|
|
|
|
|
47 |
// Register content
|
48 |
add_action( 'init', array( $this, 'content_register' ) );
|
49 |
|
38 |
* @since 1.0.0
|
39 |
*/
|
40 |
private function __construct() {
|
|
|
|
|
|
|
41 |
// Load plugin text domain
|
42 |
add_action( 'plugins_loaded', array( $this, 'load_plugin_textdomain' ), 11 );
|
43 |
|
44 |
+
// Init session
|
45 |
+
add_action( 'init', array( $this, 'register_session' ), 1 );
|
46 |
+
|
47 |
// Register content
|
48 |
add_action( 'init', array( $this, 'content_register' ) );
|
49 |
|
uninstall.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* Uninstall the plugin
|
4 |
*
|
@@ -8,14 +9,10 @@
|
|
8 |
* @link http://www.contentviewspro.com/
|
9 |
* @copyright 2014 PT Guy
|
10 |
*/
|
11 |
-
|
12 |
// If uninstall not called from WordPress, then exit
|
13 |
-
if ( !
|
14 |
exit;
|
15 |
}
|
16 |
|
17 |
-
// Include library files
|
18 |
-
include_once( plugin_dir_path( __FILE__ ) . 'includes/defines.php' );
|
19 |
-
|
20 |
// Delete all posts of PT View post type ?
|
21 |
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* Uninstall the plugin
|
5 |
*
|
9 |
* @link http://www.contentviewspro.com/
|
10 |
* @copyright 2014 PT Guy
|
11 |
*/
|
|
|
12 |
// If uninstall not called from WordPress, then exit
|
13 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
14 |
exit;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
17 |
// Delete all posts of PT View post type ?
|
18 |
|