Version Description
- CSS class
.title
is now.job-title
. Thank you Mark - Please resave your WordPress Admin > Testimonials > Settings so that missing aoptions are included again.
- Shortcode and theme function
testimonialswidget_list
being deprecated bytestimonials
- Shortcode and theme function
testimonialswidget_widget
being deprecated bytestimonials_slider
Download this release
Release Info
Developer | comprock |
Plugin | Testimonials Widget |
Version | 2.19.0 |
Comparing to | |
See all releases |
Code changes from version 2.17.2 to 2.19.0
- API.md +4 -0
- CHANGELOG.md +80 -0
- README.md +1 -2
- TODO.md +0 -11
- {css → assets/css}/images/bx_loader.gif +0 -0
- {css → assets/css}/images/controls.png +0 -0
- {css → assets/css}/jquery.bxslider.css +11 -4
- {css → assets/css}/testimonials-widget-2.14.0.css +1 -1
- {css → assets/css}/testimonials-widget-ie7.css +0 -0
- testimonials-widget.css → assets/css/testimonials-widget.css +11 -1
- {media → assets/images}/michael-cannon-red-square-300x2251.jpg +0 -0
- {js → assets/js}/jquery.bxslider.js +53 -25
- assets/js/jquery.bxslider.min.js +10 -0
- {js → assets/js}/jquery.easing.1.3.js +0 -0
- {js → assets/js}/jquery.fitvids.js +0 -0
- changelog.txt +0 -969
- forum-responses.txt +0 -29
- {lib → includes}/class-testimonials-widget-settings.php +156 -84
- {lib → includes}/class-testimonials-widget-widget.php +6 -12
- includes/class-testimonials-widget.php +2167 -0
- includes/libraries/aihrus-framework/CHANGELOG.md +92 -0
- {lib/aihrus → includes/libraries/aihrus-framework}/LICENSE +0 -0
- {lib/aihrus → includes/libraries/aihrus-framework}/README.md +13 -14
- includes/libraries/aihrus-framework/aihrus-framework.php +341 -0
- {lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-common.php +10 -8
- {lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-licensing.php +1 -1
- {lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-settings.php +51 -22
- {lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-widget.php +3 -3
- includes/libraries/aihrus-framework/includes/class-aihrus-common.php +468 -0
- includes/libraries/aihrus-framework/includes/class-aihrus-licensing.php +188 -0
- includes/libraries/aihrus-framework/includes/class-aihrus-settings.php +784 -0
- includes/libraries/aihrus-framework/includes/class-aihrus-widget.php +252 -0
- {lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-common.php +1 -1
- {lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-licensing.php +1 -1
- {lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-widget.php +1 -1
- includes/libraries/aihrus-framework/includes/libraries/class-redrokk-metabox-class.php +1470 -0
- includes/libraries/aihrus-framework/includes/libraries/wp_custom_post_status.php +230 -0
- includes/libraries/aihrus-framework/interface-aihrus-common.php +27 -0
- includes/libraries/aihrus-framework/interface-aihrus-licensing.php +28 -0
- includes/libraries/aihrus-framework/interface-aihrus-widget.php +33 -0
- {lib/aihrus → includes/libraries/aihrus-framework}/requirements.php +19 -19
- {lib → includes/libraries}/class-redrokk-metabox-class.php +0 -0
- {lib → includes}/requirements.php +22 -11
- languages/testimonials-widget.pot +460 -373
- lib/aihrus/.gitignore +0 -2
- lib/aihrus/CHANGELOG.md +0 -50
- lib/aihrus/TODO.md +0 -3
- phpcs.ruleset.xml +0 -31
- phpmd.ruleset.xml +0 -21
- readme.txt +99 -45
- testimonials-widget-ie7.css +0 -15
- testimonials-widget.php +67 -2027
API.md
CHANGED
@@ -179,6 +179,10 @@ The [Testimonials plugin](http://wordpress.org/plugins/testimonials-widget/) com
|
|
179 |
|
180 |
Alows for display of custom input types.
|
181 |
|
|
|
|
|
|
|
|
|
182 |
## Need More?
|
183 |
|
184 |
Further examples and more can be found by reading and searching the [Testimonials Knowledge Base](https://aihrus.zendesk.com/categories/20104507-Testimonials-Widget) and [source code](https://github.com/michael-cannon/testimonials-widget).
|
179 |
|
180 |
Alows for display of custom input types.
|
181 |
|
182 |
+
* `testimonials_widget_settings_defaults`
|
183 |
+
|
184 |
+
Override settings defaults with your own.
|
185 |
+
|
186 |
## Need More?
|
187 |
|
188 |
Further examples and more can be found by reading and searching the [Testimonials Knowledge Base](https://aihrus.zendesk.com/categories/20104507-Testimonials-Widget) and [source code](https://github.com/michael-cannon/testimonials-widget).
|
CHANGELOG.md
CHANGED
@@ -2,6 +2,86 @@
|
|
2 |
|
3 |
## master
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
## 2.17.2
|
6 |
* RESOLVE Testimonials Premium load issue
|
7 |
* RESOLVE [Testimonial box displays as all white in widget on IE9](http://wordpress.org/support/topic/testimonial-box-displays-as-all-white-in-widget-on-ie9). Thank you [jbmoore](http://wordpress.org/support/profile/jbmoore)
|
2 |
|
3 |
## master
|
4 |
|
5 |
+
## 2.19.0
|
6 |
+
* Add screenshot 22. Testimonials Settings > Columns tab
|
7 |
+
* Check system requirements after update
|
8 |
+
* CSS class `.title` is now `.job-title`. Thank you Mark
|
9 |
+
* Only check system requirements once a week
|
10 |
+
* Please resave your WordPress Admin > Testimonials > Settings so that missing aoptions are included again.
|
11 |
+
* RELATE #64 Remove deprecated options and codes
|
12 |
+
* Require Aihrus 1.1.0
|
13 |
+
* RESOLVE #20 Simplify shortcodes
|
14 |
+
* RESOLVE #45 Plugin Disables Itself
|
15 |
+
* RESOLVE #56 Prevent edit page column overload
|
16 |
+
* RESOLVE #67 Use .job-title than .title for job title span class
|
17 |
+
* RESOLVE #76 Undefined index: hide_image_single
|
18 |
+
* Revise Aihrus framework includes
|
19 |
+
* Revise version_check
|
20 |
+
* Shortcode and theme function `testimonialswidget_list` being deprecated by `testimonials`
|
21 |
+
* Shortcode and theme function `testimonialswidget_widget` being deprecated by `testimonials_slider`
|
22 |
+
* Update BxSlider v4.1.2
|
23 |
+
* Use aihr_deactivate_plugin call to deactivate
|
24 |
+
|
25 |
+
## 2.18.4
|
26 |
+
* RESOLVE #69 Disallow .display-none when only 1 testimonials or no refresh_interval
|
27 |
+
|
28 |
+
## 2.18.3
|
29 |
+
* Add option "Exclude bxSlider CSS?"
|
30 |
+
* Exit if accessed directly
|
31 |
+
* Initially no show bxSlider widget testimonials entries
|
32 |
+
* RESOLVE #61 Horizontal transitions not working in widget
|
33 |
+
* RESOLVE #62 Bootstrap class name hide conflict
|
34 |
+
* RESOLVE #65 Widget blank options aren't saving correctly
|
35 |
+
* Update copyright year
|
36 |
+
|
37 |
+
## 2.18.2
|
38 |
+
* RESOLVE #57 Testimonials Stacking on first load
|
39 |
+
|
40 |
+
## 2.18.1
|
41 |
+
* Add FAQ How do I create a testimonial record?
|
42 |
+
* Add screenshot 21. Shortcode helpers on category and tag admin screens
|
43 |
+
* Correct Codeship image include
|
44 |
+
* jQuery 1.10+ note
|
45 |
+
* Remove "Use bxSlider?" and "Include IE7 CSS" from widget options
|
46 |
+
* Remove option "Always Load CSS?" `force_css_loading`
|
47 |
+
* Remove Travis CI configuration. Using Codeship.io instead
|
48 |
+
* Require Aihrus Framework 1.0.3
|
49 |
+
* RESOLVE #2 Add shortcode column to categories page
|
50 |
+
* RESOLVE #3 Add shortcode column to tags page
|
51 |
+
* RESOLVE #54 Notice: Constant TW_AIHR_VERSION already defined
|
52 |
+
* RESOLVE #8 Validate HTML
|
53 |
+
* RESOLVE Featured image via Gravatar not saving correctly
|
54 |
+
* RESOLVE Not passing requirements failure to premium plugin
|
55 |
+
* RESOLVE Schema output cluttered up single view
|
56 |
+
* RESOLVE Scripts not loading in footer
|
57 |
+
* Support JetPack's Publicize module
|
58 |
+
* Verbiage updates
|
59 |
+
* Widgets don't rotate notice
|
60 |
+
|
61 |
+
## 2.18.0
|
62 |
+
* Add Codeship.io status
|
63 |
+
* Check for init and theme functions to exist
|
64 |
+
* CLOSE #11 Conflicts with "Re-order posts within Categories"
|
65 |
+
* Link to Testimonials by WooThemes migrator
|
66 |
+
* Move ci to tests
|
67 |
+
* Move CSS to assets
|
68 |
+
* Move files to assets
|
69 |
+
* Move lib to includes/libraries
|
70 |
+
* Move main class to own class file
|
71 |
+
* Remove Travis CI status
|
72 |
+
* RESOLVE #43 hatom feed errors
|
73 |
+
* RESOLVE #45 Plugin Disables Itself
|
74 |
+
* RESOLVE #7 Support subdirectory testimonial landing page
|
75 |
+
* RESOLVE Non-SSL protocol used for scripts and styles
|
76 |
+
* Revise required file paths
|
77 |
+
* Specify a “Text Domain” and “Domain Path”
|
78 |
+
* Update shortcode examples
|
79 |
+
* Update verbiage
|
80 |
+
* Use $plugin_assets than $plugin_path
|
81 |
+
|
82 |
+
## 2.17.3
|
83 |
+
* RESOLVE #44 Blank testimonial between each rotating testimonial
|
84 |
+
|
85 |
## 2.17.2
|
86 |
* RESOLVE Testimonials Premium load issue
|
87 |
* RESOLVE [Testimonial box displays as all white in widget on IE9](http://wordpress.org/support/topic/testimonial-box-displays-as-all-white-in-widget-on-ie9). Thank you [jbmoore](http://wordpress.org/support/profile/jbmoore)
|
README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1 |
# README Testimonials WordPress Plugin
|
2 |
|
3 |
-
[![
|
4 |
[![ProjectStatus](http://stillmaintained.com/michael-cannon/testimonials-widget.png)](http://stillmaintained.com/michael-cannon/testimonials-widget)
|
5 |
-
[Codeship status](https://www.codeship.io/projects/b5524630-43f6-0131-3b4d-76a8e32a74d4/status)
|
6 |
|
7 |
## Welcome to the Testimonials Github repository
|
8 |
|
1 |
# README Testimonials WordPress Plugin
|
2 |
|
3 |
+
[![Codeship status](https://www.codeship.io/projects/b5524630-43f6-0131-3b4d-76a8e32a74d4/status)](https://www.codeship.io/projects/10739)
|
4 |
[![ProjectStatus](http://stillmaintained.com/michael-cannon/testimonials-widget.png)](http://stillmaintained.com/michael-cannon/testimonials-widget)
|
|
|
5 |
|
6 |
## Welcome to the Testimonials Github repository
|
7 |
|
TODO.md
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
# TODO Testimonials
|
2 |
-
|
3 |
-
Is there something you want done? Write it up on the [support forums](http://wordpress.org/support/plugin/testimonials-widget) and then [donate](http://aihr.us/about-aihrus/donate/) or [write an awesome testimonial](http://aihr.us/about-aihrus/testimonials/add-testimonial/).
|
4 |
-
|
5 |
-
* Add shortcode column to categories page
|
6 |
-
* Add shortcode column to tags page
|
7 |
-
* Consolidate schema by testimonial item
|
8 |
-
* Move suggest JS to footer
|
9 |
-
* On widget expand/collaspe switch labels
|
10 |
-
* Support subdirectory testimonial landing page
|
11 |
-
* Validate HTML
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{css → assets/css}/images/bx_loader.gif
RENAMED
File without changes
|
{css → assets/css}/images/controls.png
RENAMED
File without changes
|
{css → assets/css}/jquery.bxslider.css
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
/**
|
2 |
-
* BxSlider v4.
|
3 |
* http://bxslider.com
|
4 |
*
|
5 |
-
* Written by: Steven Wanderski,
|
6 |
* http://stevenwanderski.com
|
7 |
* (while drinking Belgian ales and listening to jazz)
|
8 |
*
|
@@ -33,9 +33,16 @@
|
|
33 |
-moz-box-shadow: 0 0 5px #ccc;
|
34 |
-webkit-box-shadow: 0 0 5px #ccc;
|
35 |
box-shadow: 0 0 5px #ccc;
|
36 |
-
border: solid #fff
|
37 |
left: -5px;
|
38 |
background: #fff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
}
|
40 |
|
41 |
.bx-wrapper .bx-pager,
|
@@ -194,4 +201,4 @@
|
|
194 |
display: block;
|
195 |
font-size: .85em;
|
196 |
padding: 10px;
|
197 |
-
}
|
1 |
/**
|
2 |
+
* BxSlider v4.1.2 - Fully loaded, responsive content slider
|
3 |
* http://bxslider.com
|
4 |
*
|
5 |
+
* Written by: Steven Wanderski, 2014
|
6 |
* http://stevenwanderski.com
|
7 |
* (while drinking Belgian ales and listening to jazz)
|
8 |
*
|
33 |
-moz-box-shadow: 0 0 5px #ccc;
|
34 |
-webkit-box-shadow: 0 0 5px #ccc;
|
35 |
box-shadow: 0 0 5px #ccc;
|
36 |
+
border: 5px solid #fff;
|
37 |
left: -5px;
|
38 |
background: #fff;
|
39 |
+
|
40 |
+
/*fix other elements on the page moving (on Chrome)*/
|
41 |
+
-webkit-transform: translatez(0);
|
42 |
+
-moz-transform: translatez(0);
|
43 |
+
-ms-transform: translatez(0);
|
44 |
+
-o-transform: translatez(0);
|
45 |
+
transform: translatez(0);
|
46 |
}
|
47 |
|
48 |
.bx-wrapper .bx-pager,
|
201 |
display: block;
|
202 |
font-size: .85em;
|
203 |
padding: 10px;
|
204 |
+
}
|
{css → assets/css}/testimonials-widget-2.14.0.css
RENAMED
@@ -104,7 +104,7 @@
|
|
104 |
|
105 |
.testimonials-widget-testimonial .author,
|
106 |
.testimonials-widget-testimonial .email,
|
107 |
-
.testimonials-widget-testimonial .title,
|
108 |
.testimonials-widget-testimonial .location,
|
109 |
.testimonials-widget-testimonial .company,
|
110 |
.testimonials-widget-testimonial .url {
|
104 |
|
105 |
.testimonials-widget-testimonial .author,
|
106 |
.testimonials-widget-testimonial .email,
|
107 |
+
.testimonials-widget-testimonial .job-title,
|
108 |
.testimonials-widget-testimonial .location,
|
109 |
.testimonials-widget-testimonial .company,
|
110 |
.testimonials-widget-testimonial .url {
|
{css → assets/css}/testimonials-widget-ie7.css
RENAMED
File without changes
|
testimonials-widget.css → assets/css/testimonials-widget.css
RENAMED
@@ -4,6 +4,16 @@
|
|
4 |
.testimonials-widget-testimonial {
|
5 |
}
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
.testimonials-widget-testimonials .paging {
|
8 |
clear: both;
|
9 |
font-weight: 700;
|
@@ -90,7 +100,7 @@
|
|
90 |
|
91 |
.testimonials-widget-testimonial .author,
|
92 |
.testimonials-widget-testimonial .email,
|
93 |
-
.testimonials-widget-testimonial .title,
|
94 |
.testimonials-widget-testimonial .location,
|
95 |
.testimonials-widget-testimonial .company,
|
96 |
.testimonials-widget-testimonial .url {
|
4 |
.testimonials-widget-testimonial {
|
5 |
}
|
6 |
|
7 |
+
.testimonials-widget-testimonials .active {
|
8 |
+
/* active testimonials */
|
9 |
+
display: block;
|
10 |
+
}
|
11 |
+
|
12 |
+
.testimonials-widget-testimonials .display-none {
|
13 |
+
/* staged testimonials */
|
14 |
+
display: none;
|
15 |
+
}
|
16 |
+
|
17 |
.testimonials-widget-testimonials .paging {
|
18 |
clear: both;
|
19 |
font-weight: 700;
|
100 |
|
101 |
.testimonials-widget-testimonial .author,
|
102 |
.testimonials-widget-testimonial .email,
|
103 |
+
.testimonials-widget-testimonial .job-title,
|
104 |
.testimonials-widget-testimonial .location,
|
105 |
.testimonials-widget-testimonial .company,
|
106 |
.testimonials-widget-testimonial .url {
|
{media → assets/images}/michael-cannon-red-square-300x2251.jpg
RENAMED
File without changes
|
{js → assets/js}/jquery.bxslider.js
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
/**
|
2 |
-
* BxSlider v4.1.
|
3 |
* http://bxslider.com
|
4 |
*
|
5 |
-
* Copyright
|
6 |
* Written while drinking Belgian ales and listening to jazz
|
7 |
*
|
8 |
* Released under the MIT license - http://opensource.org/licenses/MIT
|
@@ -33,6 +33,8 @@
|
|
33 |
useCSS: true,
|
34 |
preloadImages: 'visible',
|
35 |
responsive: true,
|
|
|
|
|
36 |
|
37 |
// TOUCH
|
38 |
touchEnabled: true,
|
@@ -68,6 +70,7 @@
|
|
68 |
autoDirection: 'next',
|
69 |
autoHover: false,
|
70 |
autoDelay: 0,
|
|
|
71 |
|
72 |
// CAROUSEL
|
73 |
minSlides: 1,
|
@@ -80,7 +83,8 @@
|
|
80 |
onSlideBefore: function() {},
|
81 |
onSlideAfter: function() {},
|
82 |
onSlideNext: function() {},
|
83 |
-
onSlidePrev: function() {}
|
|
|
84 |
}
|
85 |
|
86 |
$.fn.bxSlider = function(options){
|
@@ -179,7 +183,7 @@
|
|
179 |
*/
|
180 |
var setup = function(){
|
181 |
// wrap el in a wrapper
|
182 |
-
el.wrap('<div class="
|
183 |
// store a namspace reference to .bx-viewport
|
184 |
slider.viewport = el.parent();
|
185 |
// add a loading div to display while images are loading
|
@@ -233,7 +237,7 @@
|
|
233 |
display: 'none'
|
234 |
});
|
235 |
// prepare the z-index on the showing element
|
236 |
-
slider.children.eq(slider.settings.startSlide).css({zIndex:
|
237 |
}
|
238 |
// create an element to contain all slider controls (pager, start / stop, etc)
|
239 |
slider.controls.el = $('<div class="bx-controls" />');
|
@@ -307,8 +311,8 @@
|
|
307 |
slider.initialized = true;
|
308 |
// bind the resize call to the window
|
309 |
if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
|
310 |
-
// if auto is true, start the show
|
311 |
-
if (slider.settings.auto && slider.settings.autoStart) initAuto();
|
312 |
// if ticker is true, start the ticker
|
313 |
if (slider.settings.ticker) initTicker();
|
314 |
// if pager is requested, make the appropriate pager link active
|
@@ -365,6 +369,14 @@
|
|
365 |
return $(this).outerHeight(false);
|
366 |
}).get());
|
367 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
return height;
|
369 |
}
|
370 |
|
@@ -421,8 +433,9 @@
|
|
421 |
slidesShowing = slider.settings.maxSlides;
|
422 |
// if viewport is between min / max thresholds, divide viewport width by first child width
|
423 |
}else{
|
424 |
-
var childWidth = slider.children.first().width();
|
425 |
-
slidesShowing = Math.floor(slider.viewport.width()
|
|
|
426 |
}
|
427 |
// if "vertical" mode, slides showing will always be minSlides
|
428 |
}else if(slider.settings.mode == 'vertical'){
|
@@ -439,7 +452,7 @@
|
|
439 |
// if moveSlides is specified by the user
|
440 |
if(slider.settings.moveSlides > 0){
|
441 |
if(slider.settings.infiniteLoop){
|
442 |
-
pagerQty = slider.children.length / getMoveBy();
|
443 |
}else{
|
444 |
// use a while loop to determine pages
|
445 |
var breakPoint = 0;
|
@@ -481,7 +494,7 @@
|
|
481 |
var lastChild = slider.children.last();
|
482 |
var position = lastChild.position();
|
483 |
// set the left position
|
484 |
-
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.
|
485 |
}else if(slider.settings.mode == 'vertical'){
|
486 |
// get the last showing index's position
|
487 |
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
@@ -616,7 +629,7 @@
|
|
616 |
slider.pagerEl = $(slider.settings.pagerCustom);
|
617 |
}
|
618 |
// assign the pager click binding
|
619 |
-
slider.pagerEl.
|
620 |
}
|
621 |
|
622 |
/**
|
@@ -656,8 +669,8 @@
|
|
656 |
// add the controls to the DOM
|
657 |
slider.controls.autoEl = $('<div class="bx-controls-auto" />');
|
658 |
// bind click actions to the controls
|
659 |
-
slider.controls.autoEl.
|
660 |
-
slider.controls.autoEl.
|
661 |
// if autoControlsCombine, insert only the "start" control
|
662 |
if(slider.settings.autoControlsCombine){
|
663 |
slider.controls.autoEl.append(slider.controls.start);
|
@@ -749,10 +762,12 @@
|
|
749 |
// if auto show is running, stop it
|
750 |
if (slider.settings.auto) el.stopAuto();
|
751 |
var pagerLink = $(e.currentTarget);
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
|
|
|
|
756 |
}
|
757 |
|
758 |
/**
|
@@ -795,8 +810,10 @@
|
|
795 |
}else if(slider.active.index == slider.children.length - 1){
|
796 |
position = slider.children.eq(slider.children.length - 1).position();
|
797 |
}
|
798 |
-
if
|
799 |
-
|
|
|
|
|
800 |
}
|
801 |
// declare that the transition is complete
|
802 |
slider.working = false;
|
@@ -1062,6 +1079,8 @@
|
|
1062 |
* Window resize event callback
|
1063 |
*/
|
1064 |
var resizeWindow = function(e){
|
|
|
|
|
1065 |
// get the new window dimens (again, thank you IE)
|
1066 |
var windowWidthNew = $(window).width();
|
1067 |
var windowHeightNew = $(window).height();
|
@@ -1074,6 +1093,8 @@
|
|
1074 |
windowHeight = windowHeightNew;
|
1075 |
// update all dynamic elements
|
1076 |
el.redrawSlider();
|
|
|
|
|
1077 |
}
|
1078 |
}
|
1079 |
|
@@ -1131,8 +1152,8 @@
|
|
1131 |
// fade out the visible child and reset its z-index value
|
1132 |
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1133 |
// fade in the newly requested slide
|
1134 |
-
slider.children.eq(slider.active.index).css('zIndex',
|
1135 |
-
$(this).css('zIndex',
|
1136 |
updateAfterSlideTransition();
|
1137 |
});
|
1138 |
// slider mode is not "fade"
|
@@ -1245,6 +1266,13 @@
|
|
1245 |
return slider.active.index;
|
1246 |
}
|
1247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1248 |
/**
|
1249 |
* Returns number of slides in show
|
1250 |
*/
|
@@ -1257,7 +1285,7 @@
|
|
1257 |
*/
|
1258 |
el.redrawSlider = function(){
|
1259 |
// resize all children in ratio to new screen size
|
1260 |
-
slider.children.add(el.find('.bx-clone')).
|
1261 |
// adjust the height
|
1262 |
slider.viewport.css('height', getViewportHeight());
|
1263 |
// update the slide position
|
@@ -1290,7 +1318,7 @@
|
|
1290 |
if(slider.controls.el) slider.controls.el.remove();
|
1291 |
if(slider.controls.next) slider.controls.next.remove();
|
1292 |
if(slider.controls.prev) slider.controls.prev.remove();
|
1293 |
-
if(slider.pagerEl) slider.pagerEl.remove();
|
1294 |
$('.bx-caption', this).remove();
|
1295 |
if(slider.controls.autoEl) slider.controls.autoEl.remove();
|
1296 |
clearInterval(slider.interval);
|
@@ -1312,4 +1340,4 @@
|
|
1312 |
return this;
|
1313 |
}
|
1314 |
|
1315 |
-
})(jQuery);
|
1 |
/**
|
2 |
+
* BxSlider v4.1.2 - Fully loaded, responsive content slider
|
3 |
* http://bxslider.com
|
4 |
*
|
5 |
+
* Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com
|
6 |
* Written while drinking Belgian ales and listening to jazz
|
7 |
*
|
8 |
* Released under the MIT license - http://opensource.org/licenses/MIT
|
33 |
useCSS: true,
|
34 |
preloadImages: 'visible',
|
35 |
responsive: true,
|
36 |
+
slideZIndex: 50,
|
37 |
+
wrapperClass: 'bx-wrapper',
|
38 |
|
39 |
// TOUCH
|
40 |
touchEnabled: true,
|
70 |
autoDirection: 'next',
|
71 |
autoHover: false,
|
72 |
autoDelay: 0,
|
73 |
+
autoSlideForOnePage: false,
|
74 |
|
75 |
// CAROUSEL
|
76 |
minSlides: 1,
|
83 |
onSlideBefore: function() {},
|
84 |
onSlideAfter: function() {},
|
85 |
onSlideNext: function() {},
|
86 |
+
onSlidePrev: function() {},
|
87 |
+
onSliderResize: function() {}
|
88 |
}
|
89 |
|
90 |
$.fn.bxSlider = function(options){
|
183 |
*/
|
184 |
var setup = function(){
|
185 |
// wrap el in a wrapper
|
186 |
+
el.wrap('<div class="' + slider.settings.wrapperClass + '"><div class="bx-viewport"></div></div>');
|
187 |
// store a namspace reference to .bx-viewport
|
188 |
slider.viewport = el.parent();
|
189 |
// add a loading div to display while images are loading
|
237 |
display: 'none'
|
238 |
});
|
239 |
// prepare the z-index on the showing element
|
240 |
+
slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
|
241 |
}
|
242 |
// create an element to contain all slider controls (pager, start / stop, etc)
|
243 |
slider.controls.el = $('<div class="bx-controls" />');
|
311 |
slider.initialized = true;
|
312 |
// bind the resize call to the window
|
313 |
if (slider.settings.responsive) $(window).bind('resize', resizeWindow);
|
314 |
+
// if auto is true and has more than 1 page, start the show
|
315 |
+
if (slider.settings.auto && slider.settings.autoStart && (getPagerQty() > 1 || slider.settings.autoSlideForOnePage)) initAuto();
|
316 |
// if ticker is true, start the ticker
|
317 |
if (slider.settings.ticker) initTicker();
|
318 |
// if pager is requested, make the appropriate pager link active
|
369 |
return $(this).outerHeight(false);
|
370 |
}).get());
|
371 |
}
|
372 |
+
|
373 |
+
if(slider.viewport.css('box-sizing') == 'border-box'){
|
374 |
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
|
375 |
+
parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
|
376 |
+
}else if(slider.viewport.css('box-sizing') == 'padding-box'){
|
377 |
+
height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
|
378 |
+
}
|
379 |
+
|
380 |
return height;
|
381 |
}
|
382 |
|
433 |
slidesShowing = slider.settings.maxSlides;
|
434 |
// if viewport is between min / max thresholds, divide viewport width by first child width
|
435 |
}else{
|
436 |
+
var childWidth = slider.children.first().width() + slider.settings.slideMargin;
|
437 |
+
slidesShowing = Math.floor((slider.viewport.width() +
|
438 |
+
slider.settings.slideMargin) / childWidth);
|
439 |
}
|
440 |
// if "vertical" mode, slides showing will always be minSlides
|
441 |
}else if(slider.settings.mode == 'vertical'){
|
452 |
// if moveSlides is specified by the user
|
453 |
if(slider.settings.moveSlides > 0){
|
454 |
if(slider.settings.infiniteLoop){
|
455 |
+
pagerQty = Math.ceil(slider.children.length / getMoveBy());
|
456 |
}else{
|
457 |
// use a while loop to determine pages
|
458 |
var breakPoint = 0;
|
494 |
var lastChild = slider.children.last();
|
495 |
var position = lastChild.position();
|
496 |
// set the left position
|
497 |
+
setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
|
498 |
}else if(slider.settings.mode == 'vertical'){
|
499 |
// get the last showing index's position
|
500 |
var lastShowingIndex = slider.children.length - slider.settings.minSlides;
|
629 |
slider.pagerEl = $(slider.settings.pagerCustom);
|
630 |
}
|
631 |
// assign the pager click binding
|
632 |
+
slider.pagerEl.on('click', 'a', clickPagerBind);
|
633 |
}
|
634 |
|
635 |
/**
|
669 |
// add the controls to the DOM
|
670 |
slider.controls.autoEl = $('<div class="bx-controls-auto" />');
|
671 |
// bind click actions to the controls
|
672 |
+
slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
|
673 |
+
slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
|
674 |
// if autoControlsCombine, insert only the "start" control
|
675 |
if(slider.settings.autoControlsCombine){
|
676 |
slider.controls.autoEl.append(slider.controls.start);
|
762 |
// if auto show is running, stop it
|
763 |
if (slider.settings.auto) el.stopAuto();
|
764 |
var pagerLink = $(e.currentTarget);
|
765 |
+
if(pagerLink.attr('data-slide-index') !== undefined){
|
766 |
+
var pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
|
767 |
+
// if clicked pager link is not active, continue with the goToSlide call
|
768 |
+
if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex);
|
769 |
+
e.preventDefault();
|
770 |
+
}
|
771 |
}
|
772 |
|
773 |
/**
|
810 |
}else if(slider.active.index == slider.children.length - 1){
|
811 |
position = slider.children.eq(slider.children.length - 1).position();
|
812 |
}
|
813 |
+
if(position){
|
814 |
+
if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
|
815 |
+
else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
|
816 |
+
}
|
817 |
}
|
818 |
// declare that the transition is complete
|
819 |
slider.working = false;
|
1079 |
* Window resize event callback
|
1080 |
*/
|
1081 |
var resizeWindow = function(e){
|
1082 |
+
// don't do anything if slider isn't initialized.
|
1083 |
+
if(!slider.initialized) return;
|
1084 |
// get the new window dimens (again, thank you IE)
|
1085 |
var windowWidthNew = $(window).width();
|
1086 |
var windowHeightNew = $(window).height();
|
1093 |
windowHeight = windowHeightNew;
|
1094 |
// update all dynamic elements
|
1095 |
el.redrawSlider();
|
1096 |
+
// Call user resize handler
|
1097 |
+
slider.settings.onSliderResize.call(el, slider.active.index);
|
1098 |
}
|
1099 |
}
|
1100 |
|
1152 |
// fade out the visible child and reset its z-index value
|
1153 |
slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
|
1154 |
// fade in the newly requested slide
|
1155 |
+
slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex+1).fadeIn(slider.settings.speed, function(){
|
1156 |
+
$(this).css('zIndex', slider.settings.slideZIndex);
|
1157 |
updateAfterSlideTransition();
|
1158 |
});
|
1159 |
// slider mode is not "fade"
|
1266 |
return slider.active.index;
|
1267 |
}
|
1268 |
|
1269 |
+
/**
|
1270 |
+
* Returns current slide element
|
1271 |
+
*/
|
1272 |
+
el.getCurrentSlideElement = function(){
|
1273 |
+
return slider.children.eq(slider.active.index);
|
1274 |
+
}
|
1275 |
+
|
1276 |
/**
|
1277 |
* Returns number of slides in show
|
1278 |
*/
|
1285 |
*/
|
1286 |
el.redrawSlider = function(){
|
1287 |
// resize all children in ratio to new screen size
|
1288 |
+
slider.children.add(el.find('.bx-clone')).width(getSlideWidth());
|
1289 |
// adjust the height
|
1290 |
slider.viewport.css('height', getViewportHeight());
|
1291 |
// update the slide position
|
1318 |
if(slider.controls.el) slider.controls.el.remove();
|
1319 |
if(slider.controls.next) slider.controls.next.remove();
|
1320 |
if(slider.controls.prev) slider.controls.prev.remove();
|
1321 |
+
if(slider.pagerEl && slider.settings.controls) slider.pagerEl.remove();
|
1322 |
$('.bx-caption', this).remove();
|
1323 |
if(slider.controls.autoEl) slider.controls.autoEl.remove();
|
1324 |
clearInterval(slider.interval);
|
1340 |
return this;
|
1341 |
}
|
1342 |
|
1343 |
+
})(jQuery);
|
assets/js/jquery.bxslider.min.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* BxSlider v4.1.2 - Fully loaded, responsive content slider
|
3 |
+
* http://bxslider.com
|
4 |
+
*
|
5 |
+
* Copyright 2014, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com
|
6 |
+
* Written while drinking Belgian ales and listening to jazz
|
7 |
+
*
|
8 |
+
* Released under the MIT license - http://opensource.org/licenses/MIT
|
9 |
+
*/
|
10 |
+
!function(t){var e={},s={mode:"horizontal",slideSelector:"",infiniteLoop:!0,hideControlOnEnd:!1,speed:500,easing:null,slideMargin:0,startSlide:0,randomStart:!1,captions:!1,ticker:!1,tickerHover:!1,adaptiveHeight:!1,adaptiveHeightSpeed:500,video:!1,useCSS:!0,preloadImages:"visible",responsive:!0,slideZIndex:50,touchEnabled:!0,swipeThreshold:50,oneToOneTouch:!0,preventDefaultSwipeX:!0,preventDefaultSwipeY:!1,pager:!0,pagerType:"full",pagerShortSeparator:" / ",pagerSelector:null,buildPager:null,pagerCustom:null,controls:!0,nextText:"Next",prevText:"Prev",nextSelector:null,prevSelector:null,autoControls:!1,startText:"Start",stopText:"Stop",autoControlsCombine:!1,autoControlsSelector:null,auto:!1,pause:4e3,autoStart:!0,autoDirection:"next",autoHover:!1,autoDelay:0,minSlides:1,maxSlides:1,moveSlides:0,slideWidth:0,onSliderLoad:function(){},onSlideBefore:function(){},onSlideAfter:function(){},onSlideNext:function(){},onSlidePrev:function(){},onSliderResize:function(){}};t.fn.bxSlider=function(n){if(0==this.length)return this;if(this.length>1)return this.each(function(){t(this).bxSlider(n)}),this;var o={},r=this;e.el=this;var a=t(window).width(),l=t(window).height(),d=function(){o.settings=t.extend({},s,n),o.settings.slideWidth=parseInt(o.settings.slideWidth),o.children=r.children(o.settings.slideSelector),o.children.length<o.settings.minSlides&&(o.settings.minSlides=o.children.length),o.children.length<o.settings.maxSlides&&(o.settings.maxSlides=o.children.length),o.settings.randomStart&&(o.settings.startSlide=Math.floor(Math.random()*o.children.length)),o.active={index:o.settings.startSlide},o.carousel=o.settings.minSlides>1||o.settings.maxSlides>1,o.carousel&&(o.settings.preloadImages="all"),o.minThreshold=o.settings.minSlides*o.settings.slideWidth+(o.settings.minSlides-1)*o.settings.slideMargin,o.maxThreshold=o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin,o.working=!1,o.controls={},o.interval=null,o.animProp="vertical"==o.settings.mode?"top":"left",o.usingCSS=o.settings.useCSS&&"fade"!=o.settings.mode&&function(){var t=document.createElement("div"),e=["WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var i in e)if(void 0!==t.style[e[i]])return o.cssPrefix=e[i].replace("Perspective","").toLowerCase(),o.animProp="-"+o.cssPrefix+"-transform",!0;return!1}(),"vertical"==o.settings.mode&&(o.settings.maxSlides=o.settings.minSlides),r.data("origStyle",r.attr("style")),r.children(o.settings.slideSelector).each(function(){t(this).data("origStyle",t(this).attr("style"))}),c()},c=function(){r.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>'),o.viewport=r.parent(),o.loader=t('<div class="bx-loading" />'),o.viewport.prepend(o.loader),r.css({width:"horizontal"==o.settings.mode?100*o.children.length+215+"%":"auto",position:"relative"}),o.usingCSS&&o.settings.easing?r.css("-"+o.cssPrefix+"-transition-timing-function",o.settings.easing):o.settings.easing||(o.settings.easing="swing"),f(),o.viewport.css({width:"100%",overflow:"hidden",position:"relative"}),o.viewport.parent().css({maxWidth:p()}),o.settings.pager||o.viewport.parent().css({margin:"0 auto 0px"}),o.children.css({"float":"horizontal"==o.settings.mode?"left":"none",listStyle:"none",position:"relative"}),o.children.css("width",u()),"horizontal"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginRight",o.settings.slideMargin),"vertical"==o.settings.mode&&o.settings.slideMargin>0&&o.children.css("marginBottom",o.settings.slideMargin),"fade"==o.settings.mode&&(o.children.css({position:"absolute",zIndex:0,display:"none"}),o.children.eq(o.settings.startSlide).css({zIndex:o.settings.slideZIndex,display:"block"})),o.controls.el=t('<div class="bx-controls" />'),o.settings.captions&&P(),o.active.last=o.settings.startSlide==x()-1,o.settings.video&&r.fitVids();var e=o.children.eq(o.settings.startSlide);"all"==o.settings.preloadImages&&(e=o.children),o.settings.ticker?o.settings.pager=!1:(o.settings.pager&&T(),o.settings.controls&&C(),o.settings.auto&&o.settings.autoControls&&E(),(o.settings.controls||o.settings.autoControls||o.settings.pager)&&o.viewport.after(o.controls.el)),g(e,h)},g=function(e,i){var s=e.find("img, iframe").length;if(0==s)return i(),void 0;var n=0;e.find("img, iframe").each(function(){t(this).one("load",function(){++n==s&&i()}).each(function(){this.complete&&t(this).load()})})},h=function(){if(o.settings.infiniteLoop&&"fade"!=o.settings.mode&&!o.settings.ticker){var e="vertical"==o.settings.mode?o.settings.minSlides:o.settings.maxSlides,i=o.children.slice(0,e).clone().addClass("bx-clone"),s=o.children.slice(-e).clone().addClass("bx-clone");r.append(i).prepend(s)}o.loader.remove(),S(),"vertical"==o.settings.mode&&(o.settings.adaptiveHeight=!0),o.viewport.height(v()),r.redrawSlider(),o.settings.onSliderLoad(o.active.index),o.initialized=!0,o.settings.responsive&&t(window).bind("resize",Z),o.settings.auto&&o.settings.autoStart&&H(),o.settings.ticker&&L(),o.settings.pager&&q(o.settings.startSlide),o.settings.controls&&W(),o.settings.touchEnabled&&!o.settings.ticker&&O()},v=function(){var e=0,s=t();if("vertical"==o.settings.mode||o.settings.adaptiveHeight)if(o.carousel){var n=1==o.settings.moveSlides?o.active.index:o.active.index*m();for(s=o.children.eq(n),i=1;i<=o.settings.maxSlides-1;i++)s=n+i>=o.children.length?s.add(o.children.eq(i-1)):s.add(o.children.eq(n+i))}else s=o.children.eq(o.active.index);else s=o.children;return"vertical"==o.settings.mode?(s.each(function(){e+=t(this).outerHeight()}),o.settings.slideMargin>0&&(e+=o.settings.slideMargin*(o.settings.minSlides-1))):e=Math.max.apply(Math,s.map(function(){return t(this).outerHeight(!1)}).get()),e},p=function(){var t="100%";return o.settings.slideWidth>0&&(t="horizontal"==o.settings.mode?o.settings.maxSlides*o.settings.slideWidth+(o.settings.maxSlides-1)*o.settings.slideMargin:o.settings.slideWidth),t},u=function(){var t=o.settings.slideWidth,e=o.viewport.width();return 0==o.settings.slideWidth||o.settings.slideWidth>e&&!o.carousel||"vertical"==o.settings.mode?t=e:o.settings.maxSlides>1&&"horizontal"==o.settings.mode&&(e>o.maxThreshold||e<o.minThreshold&&(t=(e-o.settings.slideMargin*(o.settings.minSlides-1))/o.settings.minSlides)),t},f=function(){var t=1;if("horizontal"==o.settings.mode&&o.settings.slideWidth>0)if(o.viewport.width()<o.minThreshold)t=o.settings.minSlides;else if(o.viewport.width()>o.maxThreshold)t=o.settings.maxSlides;else{var e=o.children.first().width();t=Math.floor(o.viewport.width()/e)}else"vertical"==o.settings.mode&&(t=o.settings.minSlides);return t},x=function(){var t=0;if(o.settings.moveSlides>0)if(o.settings.infiniteLoop)t=o.children.length/m();else for(var e=0,i=0;e<o.children.length;)++t,e=i+f(),i+=o.settings.moveSlides<=f()?o.settings.moveSlides:f();else t=Math.ceil(o.children.length/f());return t},m=function(){return o.settings.moveSlides>0&&o.settings.moveSlides<=f()?o.settings.moveSlides:f()},S=function(){if(o.children.length>o.settings.maxSlides&&o.active.last&&!o.settings.infiniteLoop){if("horizontal"==o.settings.mode){var t=o.children.last(),e=t.position();b(-(e.left-(o.viewport.width()-t.width())),"reset",0)}else if("vertical"==o.settings.mode){var i=o.children.length-o.settings.minSlides,e=o.children.eq(i).position();b(-e.top,"reset",0)}}else{var e=o.children.eq(o.active.index*m()).position();o.active.index==x()-1&&(o.active.last=!0),void 0!=e&&("horizontal"==o.settings.mode?b(-e.left,"reset",0):"vertical"==o.settings.mode&&b(-e.top,"reset",0))}},b=function(t,e,i,s){if(o.usingCSS){var n="vertical"==o.settings.mode?"translate3d(0, "+t+"px, 0)":"translate3d("+t+"px, 0, 0)";r.css("-"+o.cssPrefix+"-transition-duration",i/1e3+"s"),"slide"==e?(r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),D()})):"reset"==e?r.css(o.animProp,n):"ticker"==e&&(r.css("-"+o.cssPrefix+"-transition-timing-function","linear"),r.css(o.animProp,n),r.bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",function(){r.unbind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd"),b(s.resetValue,"reset",0),N()}))}else{var a={};a[o.animProp]=t,"slide"==e?r.animate(a,i,o.settings.easing,function(){D()}):"reset"==e?r.css(o.animProp,t):"ticker"==e&&r.animate(a,speed,"linear",function(){b(s.resetValue,"reset",0),N()})}},w=function(){for(var e="",i=x(),s=0;i>s;s++){var n="";o.settings.buildPager&&t.isFunction(o.settings.buildPager)?(n=o.settings.buildPager(s),o.pagerEl.addClass("bx-custom-pager")):(n=s+1,o.pagerEl.addClass("bx-default-pager")),e+='<div class="bx-pager-item"><a href="" data-slide-index="'+s+'" class="bx-pager-link">'+n+"</a></div>"}o.pagerEl.html(e)},T=function(){o.settings.pagerCustom?o.pagerEl=t(o.settings.pagerCustom):(o.pagerEl=t('<div class="bx-pager" />'),o.settings.pagerSelector?t(o.settings.pagerSelector).html(o.pagerEl):o.controls.el.addClass("bx-has-pager").append(o.pagerEl),w()),o.pagerEl.on("click","a",I)},C=function(){o.controls.next=t('<a class="bx-next" href="">'+o.settings.nextText+"</a>"),o.controls.prev=t('<a class="bx-prev" href="">'+o.settings.prevText+"</a>"),o.controls.next.bind("click",y),o.controls.prev.bind("click",z),o.settings.nextSelector&&t(o.settings.nextSelector).append(o.controls.next),o.settings.prevSelector&&t(o.settings.prevSelector).append(o.controls.prev),o.settings.nextSelector||o.settings.prevSelector||(o.controls.directionEl=t('<div class="bx-controls-direction" />'),o.controls.directionEl.append(o.controls.prev).append(o.controls.next),o.controls.el.addClass("bx-has-controls-direction").append(o.controls.directionEl))},E=function(){o.controls.start=t('<div class="bx-controls-auto-item"><a class="bx-start" href="">'+o.settings.startText+"</a></div>"),o.controls.stop=t('<div class="bx-controls-auto-item"><a class="bx-stop" href="">'+o.settings.stopText+"</a></div>"),o.controls.autoEl=t('<div class="bx-controls-auto" />'),o.controls.autoEl.on("click",".bx-start",k),o.controls.autoEl.on("click",".bx-stop",M),o.settings.autoControlsCombine?o.controls.autoEl.append(o.controls.start):o.controls.autoEl.append(o.controls.start).append(o.controls.stop),o.settings.autoControlsSelector?t(o.settings.autoControlsSelector).html(o.controls.autoEl):o.controls.el.addClass("bx-has-controls-auto").append(o.controls.autoEl),A(o.settings.autoStart?"stop":"start")},P=function(){o.children.each(function(){var e=t(this).find("img:first").attr("title");void 0!=e&&(""+e).length&&t(this).append('<div class="bx-caption"><span>'+e+"</span></div>")})},y=function(t){o.settings.auto&&r.stopAuto(),r.goToNextSlide(),t.preventDefault()},z=function(t){o.settings.auto&&r.stopAuto(),r.goToPrevSlide(),t.preventDefault()},k=function(t){r.startAuto(),t.preventDefault()},M=function(t){r.stopAuto(),t.preventDefault()},I=function(e){o.settings.auto&&r.stopAuto();var i=t(e.currentTarget),s=parseInt(i.attr("data-slide-index"));s!=o.active.index&&r.goToSlide(s),e.preventDefault()},q=function(e){var i=o.children.length;return"short"==o.settings.pagerType?(o.settings.maxSlides>1&&(i=Math.ceil(o.children.length/o.settings.maxSlides)),o.pagerEl.html(e+1+o.settings.pagerShortSeparator+i),void 0):(o.pagerEl.find("a").removeClass("active"),o.pagerEl.each(function(i,s){t(s).find("a").eq(e).addClass("active")}),void 0)},D=function(){if(o.settings.infiniteLoop){var t="";0==o.active.index?t=o.children.eq(0).position():o.active.index==x()-1&&o.carousel?t=o.children.eq((x()-1)*m()).position():o.active.index==o.children.length-1&&(t=o.children.eq(o.children.length-1).position()),t&&("horizontal"==o.settings.mode?b(-t.left,"reset",0):"vertical"==o.settings.mode&&b(-t.top,"reset",0))}o.working=!1,o.settings.onSlideAfter(o.children.eq(o.active.index),o.oldIndex,o.active.index)},A=function(t){o.settings.autoControlsCombine?o.controls.autoEl.html(o.controls[t]):(o.controls.autoEl.find("a").removeClass("active"),o.controls.autoEl.find("a:not(.bx-"+t+")").addClass("active"))},W=function(){1==x()?(o.controls.prev.addClass("disabled"),o.controls.next.addClass("disabled")):!o.settings.infiniteLoop&&o.settings.hideControlOnEnd&&(0==o.active.index?(o.controls.prev.addClass("disabled"),o.controls.next.removeClass("disabled")):o.active.index==x()-1?(o.controls.next.addClass("disabled"),o.controls.prev.removeClass("disabled")):(o.controls.prev.removeClass("disabled"),o.controls.next.removeClass("disabled")))},H=function(){o.settings.autoDelay>0?setTimeout(r.startAuto,o.settings.autoDelay):r.startAuto(),o.settings.autoHover&&r.hover(function(){o.interval&&(r.stopAuto(!0),o.autoPaused=!0)},function(){o.autoPaused&&(r.startAuto(!0),o.autoPaused=null)})},L=function(){var e=0;if("next"==o.settings.autoDirection)r.append(o.children.clone().addClass("bx-clone"));else{r.prepend(o.children.clone().addClass("bx-clone"));var i=o.children.first().position();e="horizontal"==o.settings.mode?-i.left:-i.top}b(e,"reset",0),o.settings.pager=!1,o.settings.controls=!1,o.settings.autoControls=!1,o.settings.tickerHover&&!o.usingCSS&&o.viewport.hover(function(){r.stop()},function(){var e=0;o.children.each(function(){e+="horizontal"==o.settings.mode?t(this).outerWidth(!0):t(this).outerHeight(!0)});var i=o.settings.speed/e,s="horizontal"==o.settings.mode?"left":"top",n=i*(e-Math.abs(parseInt(r.css(s))));N(n)}),N()},N=function(t){speed=t?t:o.settings.speed;var e={left:0,top:0},i={left:0,top:0};"next"==o.settings.autoDirection?e=r.find(".bx-clone").first().position():i=o.children.first().position();var s="horizontal"==o.settings.mode?-e.left:-e.top,n="horizontal"==o.settings.mode?-i.left:-i.top,a={resetValue:n};b(s,"ticker",speed,a)},O=function(){o.touch={start:{x:0,y:0},end:{x:0,y:0}},o.viewport.bind("touchstart",X)},X=function(t){if(o.working)t.preventDefault();else{o.touch.originalPos=r.position();var e=t.originalEvent;o.touch.start.x=e.changedTouches[0].pageX,o.touch.start.y=e.changedTouches[0].pageY,o.viewport.bind("touchmove",Y),o.viewport.bind("touchend",V)}},Y=function(t){var e=t.originalEvent,i=Math.abs(e.changedTouches[0].pageX-o.touch.start.x),s=Math.abs(e.changedTouches[0].pageY-o.touch.start.y);if(3*i>s&&o.settings.preventDefaultSwipeX?t.preventDefault():3*s>i&&o.settings.preventDefaultSwipeY&&t.preventDefault(),"fade"!=o.settings.mode&&o.settings.oneToOneTouch){var n=0;if("horizontal"==o.settings.mode){var r=e.changedTouches[0].pageX-o.touch.start.x;n=o.touch.originalPos.left+r}else{var r=e.changedTouches[0].pageY-o.touch.start.y;n=o.touch.originalPos.top+r}b(n,"reset",0)}},V=function(t){o.viewport.unbind("touchmove",Y);var e=t.originalEvent,i=0;if(o.touch.end.x=e.changedTouches[0].pageX,o.touch.end.y=e.changedTouches[0].pageY,"fade"==o.settings.mode){var s=Math.abs(o.touch.start.x-o.touch.end.x);s>=o.settings.swipeThreshold&&(o.touch.start.x>o.touch.end.x?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto())}else{var s=0;"horizontal"==o.settings.mode?(s=o.touch.end.x-o.touch.start.x,i=o.touch.originalPos.left):(s=o.touch.end.y-o.touch.start.y,i=o.touch.originalPos.top),!o.settings.infiniteLoop&&(0==o.active.index&&s>0||o.active.last&&0>s)?b(i,"reset",200):Math.abs(s)>=o.settings.swipeThreshold?(0>s?r.goToNextSlide():r.goToPrevSlide(),r.stopAuto()):b(i,"reset",200)}o.viewport.unbind("touchend",V)},Z=function(){var e=t(window).width(),i=t(window).height();(a!=e||l!=i)&&(a=e,l=i,r.redrawSlider(),o.settings.onSliderResize.call(r,o.active.index))};return r.goToSlide=function(e,i){if(!o.working&&o.active.index!=e)if(o.working=!0,o.oldIndex=o.active.index,o.active.index=0>e?x()-1:e>=x()?0:e,o.settings.onSlideBefore(o.children.eq(o.active.index),o.oldIndex,o.active.index),"next"==i?o.settings.onSlideNext(o.children.eq(o.active.index),o.oldIndex,o.active.index):"prev"==i&&o.settings.onSlidePrev(o.children.eq(o.active.index),o.oldIndex,o.active.index),o.active.last=o.active.index>=x()-1,o.settings.pager&&q(o.active.index),o.settings.controls&&W(),"fade"==o.settings.mode)o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed),o.children.filter(":visible").fadeOut(o.settings.speed).css({zIndex:0}),o.children.eq(o.active.index).css("zIndex",o.settings.slideZIndex+1).fadeIn(o.settings.speed,function(){t(this).css("zIndex",o.settings.slideZIndex),D()});else{o.settings.adaptiveHeight&&o.viewport.height()!=v()&&o.viewport.animate({height:v()},o.settings.adaptiveHeightSpeed);var s=0,n={left:0,top:0};if(!o.settings.infiniteLoop&&o.carousel&&o.active.last)if("horizontal"==o.settings.mode){var a=o.children.eq(o.children.length-1);n=a.position(),s=o.viewport.width()-a.outerWidth()}else{var l=o.children.length-o.settings.minSlides;n=o.children.eq(l).position()}else if(o.carousel&&o.active.last&&"prev"==i){var d=1==o.settings.moveSlides?o.settings.maxSlides-m():(x()-1)*m()-(o.children.length-o.settings.maxSlides),a=r.children(".bx-clone").eq(d);n=a.position()}else if("next"==i&&0==o.active.index)n=r.find("> .bx-clone").eq(o.settings.maxSlides).position(),o.active.last=!1;else if(e>=0){var c=e*m();n=o.children.eq(c).position()}if("undefined"!=typeof n){var g="horizontal"==o.settings.mode?-(n.left-s):-n.top;b(g,"slide",o.settings.speed)}}},r.goToNextSlide=function(){if(o.settings.infiniteLoop||!o.active.last){var t=parseInt(o.active.index)+1;r.goToSlide(t,"next")}},r.goToPrevSlide=function(){if(o.settings.infiniteLoop||0!=o.active.index){var t=parseInt(o.active.index)-1;r.goToSlide(t,"prev")}},r.startAuto=function(t){o.interval||(o.interval=setInterval(function(){"next"==o.settings.autoDirection?r.goToNextSlide():r.goToPrevSlide()},o.settings.pause),o.settings.autoControls&&1!=t&&A("stop"))},r.stopAuto=function(t){o.interval&&(clearInterval(o.interval),o.interval=null,o.settings.autoControls&&1!=t&&A("start"))},r.getCurrentSlide=function(){return o.active.index},r.getCurrentSlideElement=function(){return o.children.eq(o.active.index)},r.getSlideCount=function(){return o.children.length},r.redrawSlider=function(){o.children.add(r.find(".bx-clone")).outerWidth(u()),o.viewport.css("height",v()),o.settings.ticker||S(),o.active.last&&(o.active.index=x()-1),o.active.index>=x()&&(o.active.last=!0),o.settings.pager&&!o.settings.pagerCustom&&(w(),q(o.active.index))},r.destroySlider=function(){o.initialized&&(o.initialized=!1,t(".bx-clone",this).remove(),o.children.each(function(){void 0!=t(this).data("origStyle")?t(this).attr("style",t(this).data("origStyle")):t(this).removeAttr("style")}),void 0!=t(this).data("origStyle")?this.attr("style",t(this).data("origStyle")):t(this).removeAttr("style"),t(this).unwrap().unwrap(),o.controls.el&&o.controls.el.remove(),o.controls.next&&o.controls.next.remove(),o.controls.prev&&o.controls.prev.remove(),o.pagerEl&&o.settings.controls&&o.pagerEl.remove(),t(".bx-caption",this).remove(),o.controls.autoEl&&o.controls.autoEl.remove(),clearInterval(o.interval),o.settings.responsive&&t(window).unbind("resize",Z))},r.reloadSlider=function(t){void 0!=t&&(n=t),r.destroySlider(),d()},d(),this}}(jQuery);
|
{js → assets/js}/jquery.easing.1.3.js
RENAMED
File without changes
|
{js → assets/js}/jquery.fitvids.js
RENAMED
File without changes
|
changelog.txt
DELETED
@@ -1,969 +0,0 @@
|
|
1 |
-
=== Testimonials Widget ===
|
2 |
-
|
3 |
-
== Changelog ==
|
4 |
-
|
5 |
-
= trunk =
|
6 |
-
|
7 |
-
= 2.13.0 =
|
8 |
-
* Add PHP Copy and Paste Detector
|
9 |
-
* Add PHP run-time checks
|
10 |
-
* Add Travis CI with PHP Code Sniffer
|
11 |
-
* Add developer README and CONTRIBUTING docs
|
12 |
-
* BUGFIX DOM Element error on last testimonial rotation
|
13 |
-
* BUGFIX Data delete on uninstall not firing
|
14 |
-
* BUGFIX Testimonials Widget edit page doesn't display custom taxonomies
|
15 |
-
* Beta test update text
|
16 |
-
* Coding standards updates
|
17 |
-
* Create TODO doc
|
18 |
-
* Disabled PHP Mess Detector
|
19 |
-
* Don't escape already escaped text
|
20 |
-
* Don't load plugin till all are loaded
|
21 |
-
* FEATURE [Animated widget rotation](http://wordpress.org/support/topic/animate-jumpy-widget)
|
22 |
-
* OPTION Add Disable animation?
|
23 |
-
* Relocate activation, deactivation, and uninstall hooks
|
24 |
-
* Remove WP_UNINSTALL_PLUGIN reference
|
25 |
-
* Remove class from settings page link
|
26 |
-
* Rename class-settings-testimonials-widget.php to class-testimonials-widget-settings.php
|
27 |
-
* Revise API doc headings
|
28 |
-
* Revise instance creators to only fire when ready
|
29 |
-
* Update Filters listing to API document
|
30 |
-
* Update POT
|
31 |
-
|
32 |
-
= 2.12.8 =
|
33 |
-
* Add filter `testimonials_widget_cite_html` to adjust cite contents - Thank you [Dimitrios](http://visualweb.gr/) for the suggestion
|
34 |
-
* BUGFIX Warning: Illegal string offset 'exclude'
|
35 |
-
* Replace __ with esc_html__
|
36 |
-
* Update Premium features
|
37 |
-
|
38 |
-
= 2.12.7 =
|
39 |
-
* BUGFIX Link targets affected page navigation
|
40 |
-
* Removed donate monthly show code
|
41 |
-
|
42 |
-
= 2.12.6 =
|
43 |
-
* BUGFIX If no refresh_interval, then LIMIT 1
|
44 |
-
* Change donate from $1 to $2 due to fees
|
45 |
-
* Dashboard testimonials count statistics
|
46 |
-
* Display donate on major/minor version release or if it's been a month
|
47 |
-
* Remove braces from simple if/else structures
|
48 |
-
* Settings page inheritance note
|
49 |
-
* Update premium features listing
|
50 |
-
* Use donate button than text
|
51 |
-
|
52 |
-
= 2.12.5 =
|
53 |
-
* BUGFIX Correct loose vs strict comparison for intval and absint
|
54 |
-
* If no refresh_interval, then LIMIT 1
|
55 |
-
|
56 |
-
= 2.12.4 =
|
57 |
-
* BUGFIX Settings jQuery UI Tabs conflict
|
58 |
-
* NOT BUG [WPML bug](http://wordpress.org/support/topic/wpml-bug?replies=1)
|
59 |
-
* Remove settings.css
|
60 |
-
* Settings about section height fix
|
61 |
-
* TODOs update
|
62 |
-
* Update Premium product page URL
|
63 |
-
* Update WPML configuration
|
64 |
-
* Use PayPal donate image in settings
|
65 |
-
|
66 |
-
= 2.12.3 =
|
67 |
-
* BUGFIX Import option constantly overrides settings
|
68 |
-
* BUGFIX [Error When Database Does Not Exist Yet](http://wordpress.org/support/topic/error-when-database-does-not-exist-yet)
|
69 |
-
|
70 |
-
= 2.12.2 =
|
71 |
-
* $1 donation link admin_notice on installation or major/minor update
|
72 |
-
* Add forum responses cheat sheet
|
73 |
-
* Auto flush URLs if archive or testimonial slugs change
|
74 |
-
* BUGFIX Respect attribute settings by preventing reset_defaults and importexport activating on front-end
|
75 |
-
* Convert slug, slugs, and term setting items to lowercase on save
|
76 |
-
* Correctly delete all testimonials options on delete
|
77 |
-
* Don't create class instance unless plugin is activated
|
78 |
-
* FEATURE Allow for custom post type categories and tags [Idea via crdunst](http://wordpress.org/support/topic/feedback-tagscategories?replies=3#post-4160839)
|
79 |
-
* Prevent same has_archive and rewrite_slug which causes URL problems
|
80 |
-
* Remove excess FAQ text
|
81 |
-
* Remove unused settings and methods
|
82 |
-
* Remove unused testing settings
|
83 |
-
* Set version for which admin notice to display
|
84 |
-
|
85 |
-
= 2.12.1 =
|
86 |
-
* BUGFIX Settings memory leak [Sites hosed after update 2.12.0](http://wordpress.org/support/topic/premium-sites-hosed-after-update-2120)
|
87 |
-
* BUGFIX [importexport settings failure](http://wordpress.org/support/topic/errors-after-updating)
|
88 |
-
* Change update warning verbiage
|
89 |
-
* Update FAQ & support links to knowledge base
|
90 |
-
|
91 |
-
= 2.12.0 =
|
92 |
-
* Add file headers to lib/class*
|
93 |
-
* Add filter testimonials_widget_widget_options to alter displayed widget options
|
94 |
-
* BUGFIX Correct settings required validation `break 2`
|
95 |
-
* BUGFIX Non-static method Testimonials_Widget::get_testimonials_html() should not be called statically
|
96 |
-
* CSS rename testimonialswidget_testimonial(s) to testimonials-widget-testimonial(s)
|
97 |
-
* Correct static get_testimonials_html, get_testimonials_htmls, widget_options function declaration
|
98 |
-
* Correct static validators call
|
99 |
-
* Explain options inheritance
|
100 |
-
* FEATURE Remove Plugin Data on Deletion? - Delete all Testimonials Widget data and options from database on plugin deletion
|
101 |
-
* FEATURE Settings export/import
|
102 |
-
* Refactor out get_quote and get_cite from get_testimonial_html
|
103 |
-
* Refactor excess settings grab in widget_options
|
104 |
-
* Remove $blank from testimonials_truncate()
|
105 |
-
* Remove unused code
|
106 |
-
* Rename metabox.class.php class-redrokk-metabox-class.php
|
107 |
-
* Rename settings.testimonials-widget.php class-settings-testimonials-widget.php
|
108 |
-
* Rename testimonials-widget-widget.php class-testimonials-widget-widget.php
|
109 |
-
* Revise FAQ
|
110 |
-
* SCREENSHOT 17. Testimonials Widget Settings > Compatibility & Reset tab
|
111 |
-
* Show latest updates notice on activation
|
112 |
-
* Spellcheck readme.txt
|
113 |
-
* Update CSS for WordPress Coding standards
|
114 |
-
* Update FAQ
|
115 |
-
* Update JavaScript for WordPress Coding standards
|
116 |
-
* Update PHP for WordPress Coding Standards
|
117 |
-
* Update POT
|
118 |
-
* Update TODOs
|
119 |
-
* Update premium features
|
120 |
-
* Update rulesets
|
121 |
-
* Use ID for widget
|
122 |
-
|
123 |
-
= 2.11.3 =
|
124 |
-
* BUGFIX [Can't set featured image](http://wordpress.org/support/topic/cant-set-featured-image-3)
|
125 |
-
* Begin WordPress coding standard cleanup
|
126 |
-
* Bold option headers
|
127 |
-
* Change `has_archive` default from `testimonials` to `testimonials-archive`
|
128 |
-
* Clean up static method calls to prevent PHP Strict notices
|
129 |
-
* Correct filter name `testimonials_widget_next_posts_link` to `testimonials_widget_next_posts_link_text`
|
130 |
-
* Correct static methods calling
|
131 |
-
* Secure activation, deactivation, uninstall operations
|
132 |
-
* Update POT
|
133 |
-
* Update profile
|
134 |
-
|
135 |
-
= 2.11.2 =
|
136 |
-
* Add `min1` and `nozero` validation
|
137 |
-
* Always include settings class
|
138 |
-
* BUGFIX Don't prepend http to email addresses
|
139 |
-
* Move lesser used widget options to expandable Additional Widget Options section
|
140 |
-
* Move settings setup to `init`
|
141 |
-
* Revise `absint` and `intval` validation to default on blank entry
|
142 |
-
* Update POT
|
143 |
-
* Update TODO
|
144 |
-
* Update text domain for localization and POT
|
145 |
-
* Use `links_add_target` for widget title link
|
146 |
-
|
147 |
-
= 2.11.1 =
|
148 |
-
* BUGFIX [Fatal error: Testimonials_Widget_Settings](http://wordpress.org/support/topic/fatal-error-testimonials_widget_settings)
|
149 |
-
|
150 |
-
= 2.11.0 =
|
151 |
-
* Add Option "Hide Image in Single View?" `hide_image_single`
|
152 |
-
* Add `.author` and `.email` to CSS
|
153 |
-
* Add `.single` to single view testimonials
|
154 |
-
* Add location to meta_key ordering options
|
155 |
-
* BUGFIX [Convert q tags to blockquote](http://wordpress.org/support/topic/open-link-in-new-tab-html-validation) [Why?](http://www.w3schools.com/tags/tag_blockquote.asp)
|
156 |
-
* BUGFIX [Fix cite tag usage - it's title, not source](http://www.w3.org/html/wg/drafts/html/master/text-level-semantics.html#the-cite-element) using [T](http://html5doctor.com/blockquote-q-cite/) [BD](http://oli.jp/2011/blockquote/)
|
157 |
-
* Beta testers needed section added
|
158 |
-
* Disable self-generated quotation marks
|
159 |
-
* Enable backwards compatibility for default options
|
160 |
-
* Ignore init() during AJAX and autosave operations
|
161 |
-
* Optimize DB after uninstall
|
162 |
-
* Rename CSS attributes to credit
|
163 |
-
* Revise README verbiage in general
|
164 |
-
* Simplify CSS naming
|
165 |
-
* Update Allow Comments verbiage
|
166 |
-
* Update TODOs
|
167 |
-
* Update features listing
|
168 |
-
* Update options listing
|
169 |
-
* Update premium features
|
170 |
-
* Update readme formatting
|
171 |
-
|
172 |
-
= 2.10.3 =
|
173 |
-
* Add "Menu Order" to Order By options
|
174 |
-
* Add Height option to automatically set min and max height
|
175 |
-
* BUGFIX [Only one testimonial displaying](http://wordpress.org/support/topic/only-one-testimonial-displaying)
|
176 |
-
* BUGFIX [Post Types Order](http://wordpress.org/support/topic/random-order-doesnt-work) - sorting conflict
|
177 |
-
* Delete data on uninstall
|
178 |
-
* Enable quotes and join for IE7 - Thank you [SFMichael](http://wordpress.org/support/topic/ie-7-quotes-fix)
|
179 |
-
* Flush URLs on deactivation
|
180 |
-
* Revise self::$base usage
|
181 |
-
* Revise settings_link handling
|
182 |
-
* Screenshot 16 Testimonials Widget Settings > Widget tab
|
183 |
-
* Update Premium link
|
184 |
-
* Update TODOs
|
185 |
-
|
186 |
-
= 2.10.2 =
|
187 |
-
* BUGFIX Settings initialization overwrote previous settings
|
188 |
-
|
189 |
-
= 2.10.1 =
|
190 |
-
* Moved [FAQ](http://aihr.us/testimonials-widget/faq/)
|
191 |
-
* Removed premium screenshots
|
192 |
-
* Rename screenshot-3.png screenshot-2.png
|
193 |
-
* Rename screenshot-4.png screenshot-3.png
|
194 |
-
* Rename screenshot-5.png screenshot-4.png
|
195 |
-
* Rename screenshot-6.png screenshot-5.png
|
196 |
-
* Rename screenshot-7.png screenshot-6.png
|
197 |
-
* Rename screenshot-8.png screenshot-7.png
|
198 |
-
* Rename screenshot-13.png screenshot-8.png
|
199 |
-
* Rename screenshot-14.png screenshot-9.png
|
200 |
-
* Rename screenshot-21.png screenshot-10.png
|
201 |
-
* Rename screenshot-22.png screenshot-11.png
|
202 |
-
* Rename screenshot-23.png screenshot-12.png
|
203 |
-
* Rename screenshot-24.png screenshot-13.png
|
204 |
-
* Rename screenshot-25.png screenshot-14.png
|
205 |
-
* Rename screenshot-26.png screenshot-15.png
|
206 |
-
* Screenshot 2 removed
|
207 |
-
* Screenshot 9 removed
|
208 |
-
* Screenshot 10 removed
|
209 |
-
* Screenshot 11 removed
|
210 |
-
* Screenshot 12 removed
|
211 |
-
* Screenshot 15 removed
|
212 |
-
* Screenshot 16 removed
|
213 |
-
* Screenshot 17 removed
|
214 |
-
* Screenshot 18 removed
|
215 |
-
* Screenshot 19 removed
|
216 |
-
* Screenshot 20 removed
|
217 |
-
* Screenshot 27 removed
|
218 |
-
* Screenshot 28 removed
|
219 |
-
|
220 |
-
= 2.10.0 =
|
221 |
-
* Add `hide_content` option verbiage
|
222 |
-
* Add screenshot 27 `[[testimonialswidgetpremium_form]]` – Add a Testimonial
|
223 |
-
* Add screenshot 28 Testimonials Widget Settings > Entry Form tab
|
224 |
-
* Added rel="nofollow" to URL - Thank you Nicholas Corrieri for the suggestion
|
225 |
-
* Convert validation to configuration
|
226 |
-
* Correct breakline on radio settings display
|
227 |
-
* Correct checkbox checking
|
228 |
-
* Correct paging handling
|
229 |
-
* Correct post_status selection for single view
|
230 |
-
* Describe settings defaults
|
231 |
-
* Dutch translation by Bjorn Robijns
|
232 |
-
* Enable echo/return for display_setting
|
233 |
-
* Enable file input for settings
|
234 |
-
* Enable widget options no-show
|
235 |
-
* Finish validation configuration move
|
236 |
-
* Form demo link
|
237 |
-
* Move Changelog to changelog.txt
|
238 |
-
* Rename load_sections > _sections
|
239 |
-
* Rename load_settings > settings
|
240 |
-
* Save option defaults
|
241 |
-
* Set missing checkbox values to 0 on validate
|
242 |
-
* TODO Delete data option on deactivation
|
243 |
-
* Update Premium description
|
244 |
-
* Update WPML configuration
|
245 |
-
|
246 |
-
= 2.9.1 =
|
247 |
-
* BUGFIX Assigning the return value of new by reference is deprecated in metabox.class.php
|
248 |
-
|
249 |
-
= 2.9.0 =
|
250 |
-
* Add location meta field after title
|
251 |
-
* Add location related options
|
252 |
-
* FAQ 18, 34, 35 update
|
253 |
-
* Screenshot 2, 4, 5 updated
|
254 |
-
* Update POT
|
255 |
-
|
256 |
-
= 2.8.4 =
|
257 |
-
* BUGFIX [Title link does not allow a relative link](http://wordpress.org/support/topic/title-link-does-not-allow-a-relative-link)
|
258 |
-
|
259 |
-
= 2.8.3 =
|
260 |
-
* BUGFIX [Selection > Category Filter doesn't remember >1 category](http://wordpress.org/support/topic/selection-category-filter-doesnt-remember-1-category)
|
261 |
-
* FAQ 67 testimonials paging doesn't work
|
262 |
-
* FAQ 68 feature XYZ
|
263 |
-
|
264 |
-
= 2.8.2 =
|
265 |
-
* Add filter `testimonials_widget_version`
|
266 |
-
* Screenshot 11/16 updated
|
267 |
-
* Update POT
|
268 |
-
* Update Premium features
|
269 |
-
* Version tracking for default settings
|
270 |
-
|
271 |
-
= 2.8.1 =
|
272 |
-
* Customizable archive and testimonial URLs
|
273 |
-
* FAQ 66 Change the testimonials archive or single view URL
|
274 |
-
* Optional commenting on testimonial single-view pages
|
275 |
-
* Screenshot 26 Testimonials Widget Settings > Post Type tab
|
276 |
-
* Update POT
|
277 |
-
|
278 |
-
= 2.8.0 =
|
279 |
-
* Merge in settings branch
|
280 |
-
* Add `tw_get_options`
|
281 |
-
* Add filter `testimonials_widget_sections` – Alter section options
|
282 |
-
* Add filter `testimonials_widget_settings` – Alter setting options
|
283 |
-
* Add settings page 'Selection', 'Ordering', and 'Widget' tabs
|
284 |
-
* BUG with "Post Types Order"
|
285 |
-
* BUGFIX paging when not in singular view
|
286 |
-
* Configure settings within Testimonials_Widget_Settings class
|
287 |
-
* Enable 'Expand/Collapse' view in Widget options
|
288 |
-
* FAQ 65 Disable the stylesheet
|
289 |
-
* FEATURE Remove `.hentry` CSS?
|
290 |
-
* FEATURE Testimonials Widget Settings screen
|
291 |
-
* Removed filters `testimonials_widget_options_update`, `testimonials_widget_options_form`
|
292 |
-
* Rename `widget_text` to `bottom_text`
|
293 |
-
* Revise About page content
|
294 |
-
* Revise Settings page footer
|
295 |
-
* Revise widget options update and validation
|
296 |
-
* Screenshot 11 updated
|
297 |
-
* Screenshot 16 updated
|
298 |
-
* Screenshot 2 updated
|
299 |
-
* Screenshot 22 Testimonials Widget Settings > General tab
|
300 |
-
* Screenshot 23 Expanded 'Selection Options' Testimonials Widget
|
301 |
-
* Screenshot 24 Expanded 'Ordering Options' Testimonials Widget
|
302 |
-
* Screenshot 25 Testimonials Widget Settings > Selection tab
|
303 |
-
* Screenshot 3 updated
|
304 |
-
* Screenshot 4 updated, Expanded 'General Options' Testimonials Widget
|
305 |
-
* Update "Shortcode and Widget Options" verbiage
|
306 |
-
* Update POT file
|
307 |
-
* Use defaults via Testimonials_Widget_Settings class
|
308 |
-
* Validate shortcode and widget options via Testimonials_Widget_Settings::validate_settings
|
309 |
-
* Verbiage updates
|
310 |
-
|
311 |
-
= 2.7.17 =
|
312 |
-
* Add purchase Testimonials Widget Premium plugin meta link
|
313 |
-
* Begin settings screen work
|
314 |
-
* FAQ 20 Update
|
315 |
-
* FAQ 31 Update
|
316 |
-
* FAQ 63 Remove the cite –
|
317 |
-
* FAQ 64 Plugin conflict
|
318 |
-
* Screenshot 21 Poedit Catalog properties
|
319 |
-
* TODO class removal
|
320 |
-
* Update localization verbiage
|
321 |
-
|
322 |
-
= 2.7.16 =
|
323 |
-
* Add comments panel to edit screen - [Thank you BarrieSpence](http://wordpress.org/support/topic/disable-comments-10?replies=1)
|
324 |
-
* TODO Admin panel
|
325 |
-
|
326 |
-
= 2.7.15 =
|
327 |
-
* Add "CSS class" to widget options window
|
328 |
-
* FAQ 31/34/35/50/53/55 updates
|
329 |
-
* FAQ 61 Determine .testimonialswidget_testimonialsNNN
|
330 |
-
* FAQ 62 Category and tag selection
|
331 |
-
* Feature updates
|
332 |
-
* Localization, Hebrew
|
333 |
-
* Screenshot 3 updated
|
334 |
-
|
335 |
-
= 2.7.14 =
|
336 |
-
* BUGFIX [Testimonials archive view URL conflicts with Page slug](http://wordpress.org/support/topic/testimonials-archive-view-url-conflicts-with-page-slug)
|
337 |
-
* FAQ 1 Update - Thank you [aaaronscat](http://wordpress.org/support/topic/writing-php-to-display-rotating-widget-in-a-template) for the inspiration
|
338 |
-
* FAQ 60 Download older versions of Testimonials Widget
|
339 |
-
* Premium feature update
|
340 |
-
* Screenshot 20 added
|
341 |
-
|
342 |
-
= 2.7.13 =
|
343 |
-
* Adapt for `mb_strcut` and `mb_strlen` alternatives
|
344 |
-
* BUGFIX [Widget doesn't appear](http://wordpress.org/support/topic/widget-doesnt-appear-1)
|
345 |
-
* Update POT
|
346 |
-
|
347 |
-
= 2.7.12 =
|
348 |
-
* Change Aihrus support email to contact form
|
349 |
-
* FAQ 1 Update - Thank you [aaaronscat](http://wordpress.org/support/topic/writing-php-to-display-rotating-widget-in-a-template) for the inspiration
|
350 |
-
* Update Testimonials Widget Premium URL
|
351 |
-
|
352 |
-
= 2.7.11 =
|
353 |
-
* Citation styling note
|
354 |
-
* Removed sub-category shortcode example
|
355 |
-
* Thanks to Joe Weber for asset header
|
356 |
-
* Update premium URL
|
357 |
-
* Update premium features
|
358 |
-
* Update premium purchase URL
|
359 |
-
|
360 |
-
= 2.7.10 =
|
361 |
-
* BUGFIX extra excerpt in single view
|
362 |
-
* Screenshot 11 updated
|
363 |
-
* Update premium features
|
364 |
-
|
365 |
-
= 2.7.9 =
|
366 |
-
* Revise content truncation to respect HTML tags
|
367 |
-
* Update premium description
|
368 |
-
* Update premium features
|
369 |
-
|
370 |
-
= 2.7.8 =
|
371 |
-
* Add `before` and `after` options to `paging`
|
372 |
-
* FAQ 58 Specify testimonials per page or section
|
373 |
-
* FAQ 59 Rotating widget show all testimonials than only one at a time
|
374 |
-
* Revert on-demand CSS to always included
|
375 |
-
* Support process and donation update
|
376 |
-
* Thank you to [mkearns](http://wordpress.org/support/topic/just-excellent-3) for specifying a sub-category shortcode example
|
377 |
-
* Update premium URL
|
378 |
-
* Update premium features
|
379 |
-
|
380 |
-
= 2.7.7 =
|
381 |
-
* FAQ 13 Update
|
382 |
-
* FAQ 31 Update
|
383 |
-
* Shortcode examples "[[" to "["
|
384 |
-
|
385 |
-
= 2.7.6 =
|
386 |
-
* Add `[[testimonialswidget_widget]]` to Shortcodes column
|
387 |
-
* CSS cite `margin-top` adjustment
|
388 |
-
* Enable testimonials archive view
|
389 |
-
* FAQ 1 Update
|
390 |
-
* FAQ 52 Update
|
391 |
-
* FAQ 53 Update
|
392 |
-
* FAQ 55 Style page and instance testimonials
|
393 |
-
* FAQ 56 Testimonials archive view URL
|
394 |
-
* FAQ 57 Testimonial single view URL
|
395 |
-
* Only include CSS if testimonials instance called
|
396 |
-
* Screenshot 19 `[[testimonialswidget_widget unique=true]]` Show multiple testimonials in rotation
|
397 |
-
* Set arg defaults via `defaults`
|
398 |
-
|
399 |
-
= 2.7.5 =
|
400 |
-
* BUGFIX PHP Warning for new fields in widget when widget already exists
|
401 |
-
* Exclude IDs option
|
402 |
-
* Implement instance tracking
|
403 |
-
* Protect shortcode examples
|
404 |
-
* Update asset header size
|
405 |
-
* Update premium features
|
406 |
-
|
407 |
-
= 2.7.4 =
|
408 |
-
* Asset header help request
|
409 |
-
* Premium feature updates
|
410 |
-
* Screenshot 9 updated
|
411 |
-
* Screenshot 10 replaced
|
412 |
-
* Screenshot 11 updated
|
413 |
-
* Screenshot 15 updated
|
414 |
-
* Screenshot 17 Single `[[testimonialswidget_list]]` entry with and without 'Read more' link
|
415 |
-
* Screenshot 18 `[[testimonialswidgetpremium_count]]` Examples
|
416 |
-
|
417 |
-
= 2.7.3 =
|
418 |
-
* Apply quotes only around testimonial content
|
419 |
-
* FAQ 13 update
|
420 |
-
* FAQ 34 update
|
421 |
-
* FAQ 35 update
|
422 |
-
* Screenshot 8 replaced
|
423 |
-
* Simplified quotes handling
|
424 |
-
* Upgrade notification
|
425 |
-
|
426 |
-
= 2.7.2 =
|
427 |
-
* FAQ 54 update
|
428 |
-
* Screenshot 12 update
|
429 |
-
* Screenshot 16 Edit testimonial with "Excerpt" and "Read More Link" fields - Testimonials Widget Premium plugin
|
430 |
-
|
431 |
-
= 2.7.1 =
|
432 |
-
* Description update
|
433 |
-
* FAQ 1 update
|
434 |
-
* FAQ 2 update
|
435 |
-
* FAQ 4 update
|
436 |
-
* FAQ 5 update
|
437 |
-
* FAQ 6 update
|
438 |
-
* FAQ 7 update
|
439 |
-
* FAQ 8 update
|
440 |
-
* FAQ 9 update
|
441 |
-
* FAQ 12 update
|
442 |
-
* FAQ 14 update
|
443 |
-
* FAQ 15 update
|
444 |
-
* FAQ 17 update
|
445 |
-
* FAQ 22 update
|
446 |
-
* FAQ 25 update
|
447 |
-
* FAQ 26 update
|
448 |
-
* FAQ 30 update
|
449 |
-
* FAQ 32 update
|
450 |
-
* FAQ 34 update
|
451 |
-
* FAQ 35 update
|
452 |
-
* FAQ 37 update
|
453 |
-
* FAQ 53 update
|
454 |
-
* Feature update
|
455 |
-
* Installation update
|
456 |
-
* Screenshot 1 update
|
457 |
-
* Screenshot 2 update
|
458 |
-
* Screenshot 3 update
|
459 |
-
* Screenshot 4 update
|
460 |
-
* Screenshot 5 update
|
461 |
-
* Screenshot 6 update
|
462 |
-
* Screenshot 7 update
|
463 |
-
* Screenshot 8 replaced
|
464 |
-
* Screenshot 9 replaced
|
465 |
-
* Screenshot 12 update
|
466 |
-
* Screenshot 15 update
|
467 |
-
* Screenshot 16 removed
|
468 |
-
* Screenshot 17 removed
|
469 |
-
* Screenshot 18 removed
|
470 |
-
|
471 |
-
= 2.7.0 =
|
472 |
-
* FAQ 13 Update
|
473 |
-
* FAQ 54 Release early. Release often.
|
474 |
-
* Redo content opening and closing quotes display
|
475 |
-
* Upgrade notification for 2.7.0
|
476 |
-
|
477 |
-
= 2.6.6 =
|
478 |
-
* Remove CSS `overflow: auto` - too many complaints
|
479 |
-
* FAQ 53 Scroll widget based testimonial content
|
480 |
-
|
481 |
-
= 2.6.5 =
|
482 |
-
* BUGFIX: overflow auto than scroll
|
483 |
-
* Correct screenshot 11 & 18
|
484 |
-
|
485 |
-
= 2.6.4 =
|
486 |
-
* Add filters `testimonials_widget_posts_custom_column`, `testimonials_widget_columns`, `testimonials_widget_meta_box`
|
487 |
-
* BUGFIX Testimonial posts page column URL now correctly clickable
|
488 |
-
* Code spacing cleanup
|
489 |
-
* Enabled [scrolling text](http://wordpress.org/support/topic/plugin-testimonials-widget-scroll-for-a-single-but-long-testimonial) for maximum height restricted testimonial widgets
|
490 |
-
* FAQ 34/35 CSS styling update
|
491 |
-
* Scrolling testimonials for maximum height restricted widgets
|
492 |
-
* Testimonials have `get_post_class` applied
|
493 |
-
* Update premium features
|
494 |
-
|
495 |
-
= 2.6.3 =
|
496 |
-
* Add filter `testimonials_widget_query_args`
|
497 |
-
* Add filters `testimonials_widget_testimonials_css`, `testimonials_widget_testimonials_js`
|
498 |
-
* Allow `limit=-1`
|
499 |
-
* BUGFIX Repeated footer CSS and JavaScript
|
500 |
-
* CSS - block disply widget image
|
501 |
-
* FAQ 52 Include testimonies in archive view
|
502 |
-
* Refactor `get_query_args` out of `get_testimonials`
|
503 |
-
* Revise JavaScript handling
|
504 |
-
* Screenshot 17 `require_image`, `minimum_length` and `maximum_length` shortcode option examples
|
505 |
-
* Screenshot 18 Widget with 'Next testimonial…' link
|
506 |
-
* Update POT
|
507 |
-
* Update premium features
|
508 |
-
* Update premium screenshots
|
509 |
-
|
510 |
-
= 2.6.2 =
|
511 |
-
* Compatible with WordPress 3.6
|
512 |
-
* Fix single view PHP warning
|
513 |
-
|
514 |
-
= 2.6.1 =
|
515 |
-
* Add filter `testimonials_widget_testimonial_html_single_content`
|
516 |
-
* Add `force_pad` option to `testimonials_truncate`
|
517 |
-
* Copyright year update
|
518 |
-
* Update Premium features
|
519 |
-
|
520 |
-
= 2.6.0 =
|
521 |
-
* Add FAQ 51 filter `testimonials_widget_get_testimonial_html` usage
|
522 |
-
* FAQ 50 Revise
|
523 |
-
* Reorganize `get_testimonial_html`
|
524 |
-
|
525 |
-
= 2.5.6 =
|
526 |
-
* Add FAQ 50 Example to set widget gradient background color
|
527 |
-
* FAQ 13 Update
|
528 |
-
* FAQ 20 Add PHP tags
|
529 |
-
* FAQ 48 Code correction
|
530 |
-
* FAQ 49 Code correction
|
531 |
-
|
532 |
-
= 2.5.5 =
|
533 |
-
* Enable widget caching
|
534 |
-
* Refactor `get_testimonials_html` to break out CSS/JS generation
|
535 |
-
* Respect [meta capabilities](http://wordpress.org/support/topic/plugin-testimonials-widget-version-20-rewrite-suggestions-request?replies=18#post-3359157)
|
536 |
-
* Revise TODO text
|
537 |
-
* TODO remove Template engine - see `testimonials_widget_testimonial_html*` filters
|
538 |
-
|
539 |
-
= 2.5.4 =
|
540 |
-
* Add filter `testimonials_widget_testimonial_html_single`
|
541 |
-
* Add filter `testimonials_widget_testimonial_html`
|
542 |
-
* Aihrus testimonial URL correction
|
543 |
-
* FAQ 34 Find `testimonialswidget_testimonialsNNN` instance naming
|
544 |
-
* FAQ 48 Customize testimonial list/widget output
|
545 |
-
* FAQ 49 Customize testimonial single output
|
546 |
-
|
547 |
-
= 2.5.3 =
|
548 |
-
* Add donate link in plugin section
|
549 |
-
* Donate links
|
550 |
-
|
551 |
-
= 2.5.2 =
|
552 |
-
* Aihrus branding
|
553 |
-
|
554 |
-
= 2.5.1 =
|
555 |
-
* Update POT file
|
556 |
-
|
557 |
-
= 2.5.0 =
|
558 |
-
* Add option Keep whitespace? - Thank you [kangchenjunga](http://wordpress.org/support/topic/optional-wpautop-functionality-for-better-formatting?replies=2) for the suggestion
|
559 |
-
* Revise FAQ 47
|
560 |
-
* Screenshot 16 - Widget whitespace kept
|
561 |
-
* Update Author URL
|
562 |
-
|
563 |
-
= 2.4.8 =
|
564 |
-
* Donate to purchase verbiage change - One bad experience ruins it for all
|
565 |
-
* FAQ 47 testimonials list in a widget
|
566 |
-
* TODO Add location field
|
567 |
-
* TODO Add plugin donate link
|
568 |
-
* [CleanCSS](http://cleancss.com/) the CSS
|
569 |
-
|
570 |
-
= 2.4.7 =
|
571 |
-
* Add filter `testimonials_widget_defaults_single`
|
572 |
-
* TODO clean up for premium version
|
573 |
-
* TODO Optional wpautop functionality for better formatting
|
574 |
-
|
575 |
-
= 2.4.6 =
|
576 |
-
* Add 'No order' as an Order By widget option
|
577 |
-
* Add FAQ 45 testimonial character limit
|
578 |
-
* Add Recommendation heading
|
579 |
-
* FAQ 23 mention 404
|
580 |
-
* FAQ 46 testimonial ordering by given IDs
|
581 |
-
* Update filters listing
|
582 |
-
* Use `posts_results` filter to put posts in same orders as post__in when orderby=none
|
583 |
-
|
584 |
-
= 2.4.5 =
|
585 |
-
* BUGFIX Missing CSS for testimonialswidget_join_title
|
586 |
-
* FAQ 44 Refresh interval - Thank you [biztips](http://wordpress.org/support/topic/fatal-error-558?replies=6#post-3475595)
|
587 |
-
|
588 |
-
= 2.4.4 =
|
589 |
-
* Add screenshot 15
|
590 |
-
* FAQ 34 Update CSS
|
591 |
-
* FAQ 35 Update CSS
|
592 |
-
* FAQ 42 Exclude testimonial categories from Category widget
|
593 |
-
* FAQ 43 Exclude testimonial categories from my sitemap
|
594 |
-
* Update premium features
|
595 |
-
|
596 |
-
= 2.4.3 =
|
597 |
-
* Adjust default `limit` to 10 from 25
|
598 |
-
* Add CSS `margin-top` to `cite`, `.testimonialswidget_extra` and `.testimonialswidget_text`
|
599 |
-
* BUGFIX [Keep `widget_text` with each testimonial](http://wordpress.org/support/topic/images-not-showin?replies=10)
|
600 |
-
* Donate link update
|
601 |
-
* FAQ 41 Widget height consistency
|
602 |
-
|
603 |
-
= 2.4.2 =
|
604 |
-
* BUGFIX [No image](http://wordpress.org/support/topic/update-17?replies=4) in [widget](http://wordpress.org/support/topic/plugin-testimonials-widget-short-rotating-testimonial-link-to-the-full-testimonial?replies=16)
|
605 |
-
* TODO Add refactor `get_testimonials_html`
|
606 |
-
|
607 |
-
= 2.4.1 =
|
608 |
-
* BUGFIX `testimonialswidget_widget` always random
|
609 |
-
* Comment and verbiage cleanups
|
610 |
-
* Minor refactor of `get_testimonial_html`
|
611 |
-
* TODO Added Template engine
|
612 |
-
|
613 |
-
= 2.4.0 =
|
614 |
-
* FAQ 39 Style the custom widget text
|
615 |
-
* FAQ 40 Page number pagination
|
616 |
-
* FEATURE Custom widget text
|
617 |
-
* FEATURE Make the widget title clickable
|
618 |
-
* FEATURE Page numbers via WP-PageNavi
|
619 |
-
* Refactor paging to use WordPress functions
|
620 |
-
* SCREENSHOT 12 recrop
|
621 |
-
* SCREENSHOT 13 Widget with clickable title and custom text/HTML on bottom
|
622 |
-
* SCREENSHOT 14 WP-PageNavi compatible for page numbers than default arrows
|
623 |
-
* SCREENSHOT 3 update
|
624 |
-
* SCREENSHOT 4 update
|
625 |
-
* TODO Remove Custom widget text - added
|
626 |
-
* TODO Remove Make the widget title clickable - added
|
627 |
-
* TODO Remove Page numbers - added
|
628 |
-
* TODO Remove fields to show - done via theme
|
629 |
-
|
630 |
-
= 2.3.4 =
|
631 |
-
* BUGFIX [Testimonial plugin means Set Feature Image Not Displaying](http://wordpress.org/support/topic/testimonial-plugin-means-set-feature-image-not-displaying)
|
632 |
-
* Test with WordPress 3.5.0 RC1
|
633 |
-
* TODO remove Publish & New - just click 'New Testimonial' after Publishing
|
634 |
-
* Update donate link
|
635 |
-
|
636 |
-
= 2.3.3 =
|
637 |
-
* FEATURE Improved single page view
|
638 |
-
* SCREENSHOT Single testimonial view
|
639 |
-
* TODO Meta capabilities
|
640 |
-
|
641 |
-
= 2.3.2 =
|
642 |
-
* Add filters `testimonials_widget_options_update`, `testimonials_widget_options_form`
|
643 |
-
* BUGFIX ["featured image" module disappeared](http://wordpress.org/support/topic/no-image-upload?replies=12#post-3423001)
|
644 |
-
* Clean up tags per [plugin guidelines](http://wordpress.org/extend/plugins/about/guidelines/)
|
645 |
-
* Combine source and url display when no email or company
|
646 |
-
* FAQ renumber second 36 to 37
|
647 |
-
* FAQ 38 Use filter `testimonials_widget_defaults`
|
648 |
-
* FEATURE Centralized defaults via filter `testimonials_widget_defaults`
|
649 |
-
* Only grab `paged` information once
|
650 |
-
* Prepend HTTP protocol if missing in URL
|
651 |
-
* SCREENSHOT Widget Premium Options
|
652 |
-
* Simplify filter `testimonials_widget_content`
|
653 |
-
* Simplify read more ellipsis
|
654 |
-
* Trim content after formatting
|
655 |
-
|
656 |
-
= 2.3.1 =
|
657 |
-
* BUGFIX [No image upload](http://wordpress.org/support/topic/no-image-upload)
|
658 |
-
* FAQ 36 Why donate?
|
659 |
-
|
660 |
-
= 2.3.0 =
|
661 |
-
* BUGFIX No paging when cached
|
662 |
-
* FAQ 3 Check for empty $data
|
663 |
-
* FAQ 33 Change more content ellipsis
|
664 |
-
* FAQ 34/35 Clarify CSS classes
|
665 |
-
* FAQ 36 Configure Next and Previous page indicators
|
666 |
-
* FEATURE (Premium) [Read More links](http://wordpress.org/support/topic/plugin-testimonials-widget-short-rotating-testimonial-link-to-the-full-testimonial) to [full testimonial page](http://wordpress.org/support/topic/very-easy-to-use-moderately-easy-to-style)
|
667 |
-
* FEATURE Easier to configure Next and Previous page indicators
|
668 |
-
* Refactor `get_testimonial_html`
|
669 |
-
* Refactor testimonial HTML creation methods
|
670 |
-
* Remove "Read more…" preparations
|
671 |
-
* Replace `testimonials_truncate` with WordPress's `wp_trim_words`
|
672 |
-
* SCREENSHOTS 'Read more' links
|
673 |
-
* Sanitize names
|
674 |
-
* TEMP Prevent widget caching
|
675 |
-
* TODO Clarify 'Read more'
|
676 |
-
* TODO Remove - CSV Export
|
677 |
-
* TODO Updates
|
678 |
-
* Update POT file
|
679 |
-
|
680 |
-
= 2.2.9 =
|
681 |
-
* BUGFIX [Testimonial List Loading 2nd Blank Box](http://wordpress.org/support/topic/testimonial-list-loading-2nd-blank-box)
|
682 |
-
|
683 |
-
= 2.2.8 =
|
684 |
-
* Begin "Read more…" preparations
|
685 |
-
* Correct content display processing
|
686 |
-
* FAQ 32 Min-height usage
|
687 |
-
* FAQ 4 Custom code placement clarification
|
688 |
-
* TODO Updates
|
689 |
-
* Widgets display content sans `wpautop` formatting
|
690 |
-
|
691 |
-
= 2.2.7 =
|
692 |
-
* Catch widget number in cache
|
693 |
-
* FAQ Custom query code. Thank you [tcwebguru](http://wordpress.org/support/topic/display-on-page-without-widget)
|
694 |
-
* FAQ Change Testimonials Widget text labels
|
695 |
-
* Language verbiage correction
|
696 |
-
* PHP notice fix - esc_attr
|
697 |
-
* Remove premium code include
|
698 |
-
|
699 |
-
= 2.2.6 =
|
700 |
-
* BUGFIX Widget config not saving correctly
|
701 |
-
* FAQ Export/import
|
702 |
-
* TODO Updates
|
703 |
-
|
704 |
-
= 2.2.5 =
|
705 |
-
* Adapt for [Testimonials Widget Premium plugin](http://aihr.us/downloads/testimonials-widget-premium-wordpress-plugin/)
|
706 |
-
* Add support text
|
707 |
-
* Correct verbiage spacing
|
708 |
-
* Explain `limit`
|
709 |
-
* TODO revisions
|
710 |
-
|
711 |
-
= 2.2.4 =
|
712 |
-
* BUGFIX [Tags - no more than 2?](http://wordpress.org/support/topic/tags-no-more-than-2)
|
713 |
-
* Clean up PHP notices
|
714 |
-
* Fix Changelog link
|
715 |
-
* PREMIUM Implement testimonials query and content caching
|
716 |
-
* TODO update
|
717 |
-
|
718 |
-
= 2.2.3 =
|
719 |
-
* Begin premium plugin adaptions
|
720 |
-
* BUGFIX [Tags - no more than 2?](http://wordpress.org/support/topic/tags-no-more-than-2)
|
721 |
-
* BUGFIX [Updated - Now getting fatal error when using testimonialswidget_list()](http://wordpress.org/support/topic/updated-now-getting-fatal-error-when-using-testimonialswidget_list)
|
722 |
-
* Clean up links in readme.txt
|
723 |
-
* Correct company and URL link usage
|
724 |
-
* [Correct readme.txt to standard](http://wordpress.org/extend/plugins/about/readme.txt)
|
725 |
-
* Don't rotate testimonial if only 1
|
726 |
-
* TODO updates
|
727 |
-
|
728 |
-
= 2.2.2 =
|
729 |
-
* BUGFIX [Now getting fatal error when using testimonialswidget_list()](http://wordpress.org/support/topic/updated-now-getting-fatal-error-when-using-testimonialswidget_list)
|
730 |
-
* Theme function defaults
|
731 |
-
* TODO updates
|
732 |
-
* URL pointing update
|
733 |
-
|
734 |
-
= 2.2.1 =
|
735 |
-
* Number FAQ Entries
|
736 |
-
* Revise Installation Usage text
|
737 |
-
* Revise Shortcode and Widget Options text
|
738 |
-
|
739 |
-
= 2.2.0 =
|
740 |
-
* FAQ `testimonialswidget_widget()` example
|
741 |
-
* Multisite compatible
|
742 |
-
* Reversion as 2.1.10 was a minor release than only bug fixes
|
743 |
-
|
744 |
-
= 2.1.10 =
|
745 |
-
* [Add title field ](http://wordpress.org/support/topic/plugin-testimonials-widget-just-tried-216-thoughts-suggestions)
|
746 |
-
* Consolidate defaults to simplify code maintenance
|
747 |
-
* Correct CSS testimonial list spacing
|
748 |
-
* Debug true - clear out PHP notices and such
|
749 |
-
* Default minimum height removed for widgets, now optional
|
750 |
-
* Maximum height setting
|
751 |
-
* [Remove CSS `position` attributes `.testimonialswidget_testimonial { position: absolute; }`](http://wordpress.org/support/topic/testimonials-widget-not-showing-correctly-on-sub-pages)
|
752 |
-
* TODO cleanup
|
753 |
-
* Update language POT
|
754 |
-
* Update screenshots
|
755 |
-
* Update WPML
|
756 |
-
* Widget options dropdown for ORDER BY entries
|
757 |
-
|
758 |
-
= 2.1.9 =
|
759 |
-
* Allow min_height 0
|
760 |
-
* FAQ - How do I use the theme function `testimonialswidget_list()`?
|
761 |
-
* Move CSS include to header
|
762 |
-
|
763 |
-
= 2.1.8 =
|
764 |
-
* Remove testimonialswidget_widget char_limit default
|
765 |
-
* TODO - debug true
|
766 |
-
|
767 |
-
= 2.1.7 =
|
768 |
-
* [0 disables char_limit](http://wordpress.org/support/topic/plugin-testimonials-widget-more-than-one-testimonial-appears-overlaps-content-below-the-widget)
|
769 |
-
* [Set link target](http://wordpress.org/support/topic/plugin-testimonials-widget-just-tried-216-thoughts-suggestions)
|
770 |
-
* Update widget option top screenshot
|
771 |
-
|
772 |
-
= 2.1.6 =
|
773 |
-
* FAQ: `ORDER BY` explanation
|
774 |
-
* FAQ: `testimonial_extra` explanation
|
775 |
-
* [Moved CSS to footer](http://wordpress.org/support/topic/plugin-testimonials-widget-html-validation)
|
776 |
-
* Next testimonial link idea
|
777 |
-
* Option: Add `hide_not_found` to prevent showing "No testimonials found"
|
778 |
-
* Revise theme methods as functions
|
779 |
-
* Screenshot: Update upper widget options
|
780 |
-
* Staged widget testimonials are initially `display: none` via CSS `.testimonialswidget_display_none`
|
781 |
-
* TODO updates
|
782 |
-
* Verbiage: Refresh Interval to Rotation Speed
|
783 |
-
* Widget option explanations
|
784 |
-
|
785 |
-
= 2.1.5 =
|
786 |
-
* Always apply min-height
|
787 |
-
|
788 |
-
= 2.1.4 =
|
789 |
-
* Enable WPML
|
790 |
-
* Idea - Maximum height setting
|
791 |
-
* Revise description
|
792 |
-
* Revise TODO
|
793 |
-
|
794 |
-
= 2.1.3 =
|
795 |
-
* Allow commas in meta_key
|
796 |
-
* FAQ on page not found
|
797 |
-
* Fix widget Random order always true condition
|
798 |
-
* Increase bottom margin spacing for listed testimonials
|
799 |
-
* TODO vote casting note
|
800 |
-
* Update localization pot file
|
801 |
-
|
802 |
-
= 2.1.2 =
|
803 |
-
* Add `hide_gravatar` option
|
804 |
-
* Add apply_filters( 'testimonials_widget_data', $testimonial_data ) to process data before display
|
805 |
-
* Add right margin to gravatar image
|
806 |
-
* Added empty testimonial data field `testimonial_extra` for customization in testimonials
|
807 |
-
* Allow widget and shortcode sorting by post meta values via `meta_key`
|
808 |
-
* Correct PHP static accessors
|
809 |
-
* Update FAQ
|
810 |
-
* Update widget options screenshots
|
811 |
-
* Working full testimonial URLs
|
812 |
-
|
813 |
-
= 2.1.1 =
|
814 |
-
* Add [[testimonialswidget_list]] paging screenshot
|
815 |
-
|
816 |
-
= 2.1.0 =
|
817 |
-
* Enable paging for [[testimonialswidget_list]] shortcode
|
818 |
-
* Flush rewrite rules on activation
|
819 |
-
* Disallow paging in widget and [[testimonialswidget_widget]] shortcode
|
820 |
-
|
821 |
-
= 2.0.6 =
|
822 |
-
* Update shortcode option directions
|
823 |
-
|
824 |
-
= 2.0.5 =
|
825 |
-
* Ignore already imported
|
826 |
-
* Mark `testimonialswidget_widget() $number` argument as optional
|
827 |
-
|
828 |
-
= 2.0.4 =
|
829 |
-
* Allow for 0 refresh_interval in get_testimonials_html
|
830 |
-
|
831 |
-
= 2.0.3 =
|
832 |
-
* Allow for 0 refresh_interval in widget
|
833 |
-
|
834 |
-
= 2.0.2 =
|
835 |
-
* BUGFIX [Warning: call_user_func_array() ??](http://wordpress.org/support/topic/plugin-testimonials-widget-warning-call_user_func_array)
|
836 |
-
* Added Testimonials_Widget_Widget::get_testimonials_scripts for use with add_filter for wp_footer
|
837 |
-
|
838 |
-
= 2.0.1 =
|
839 |
-
* Verbiage updates
|
840 |
-
* Readme.txt validation
|
841 |
-
* widget q p tag display inline
|
842 |
-
* GPL2 licensing
|
843 |
-
* Move upgrade notice text towards installation
|
844 |
-
* Reorder screenshots
|
845 |
-
* Apply 'the_content' filters directly to prevent plugin baggage
|
846 |
-
* Update screenshot-7.png
|
847 |
-
|
848 |
-
= 2.0.0 =
|
849 |
-
* Major rewrite
|
850 |
-
* Add filters for image & gravatar sizes
|
851 |
-
* Admin bar New > Testimonial
|
852 |
-
* Authors and lower can manage their own testimonials
|
853 |
-
* Auto-migration from old to new format upon install
|
854 |
-
* Public > Published
|
855 |
-
* Not public > Private
|
856 |
-
* Categories - product, project, service
|
857 |
-
* Clean up verbiage
|
858 |
-
* Cleaner widget class
|
859 |
-
* Custom columns list view
|
860 |
-
* Image
|
861 |
-
* Source
|
862 |
-
* Shortcode
|
863 |
-
* Email
|
864 |
-
* Company
|
865 |
-
* URL
|
866 |
-
* Published by
|
867 |
-
* Category
|
868 |
-
* Tags
|
869 |
-
* Date
|
870 |
-
* Custom fields metabox
|
871 |
-
* Email
|
872 |
-
* Company
|
873 |
-
* URL
|
874 |
-
* Custom post-type
|
875 |
-
* Default fields - source, email, company, URL
|
876 |
-
* Editors and higher can manage all testimonials and edit testimonial publisher
|
877 |
-
* Enable categories and tags
|
878 |
-
* Enable full shortcode options in widget
|
879 |
-
* Gravatar
|
880 |
-
* HTML content allowed
|
881 |
-
* Images
|
882 |
-
* JavaScript in footer
|
883 |
-
* Localization
|
884 |
-
* Reference shortcode column
|
885 |
-
* Reorganize widget options panel
|
886 |
-
* Rotation JavaScript in footer than body
|
887 |
-
* Shortcode options validation
|
888 |
-
* WP_Query for get_testimonials()
|
889 |
-
* Widget image on own line
|
890 |
-
* Widget options
|
891 |
-
* Title
|
892 |
-
* Category filter
|
893 |
-
* Tags filter
|
894 |
-
* Require all tags
|
895 |
-
* Advanced options
|
896 |
-
* Hide image?
|
897 |
-
* Hide source?
|
898 |
-
* Hide email?
|
899 |
-
* Hide company?
|
900 |
-
* Hide URL?
|
901 |
-
* Character limit
|
902 |
-
* IDs filter
|
903 |
-
* Limit
|
904 |
-
* Maximum Height
|
905 |
-
* Minimum Height
|
906 |
-
* ORDER BY
|
907 |
-
* ORDER BY Order
|
908 |
-
* Random order
|
909 |
-
* Rotation Speed
|
910 |
-
* Move caching to ideas
|
911 |
-
* Add theme function `testimonialswidget_widget()` doc
|
912 |
-
* Update POT
|
913 |
-
* [[testimonialswidget_widget]] shortcode
|
914 |
-
* Match [[testimonialswidget_widget]] shortcode option defaults to widget
|
915 |
-
* Update screenshots
|
916 |
-
* Readd Minimum Height - need help getting around this
|
917 |
-
|
918 |
-
= 0.2.13 =
|
919 |
-
* Clean up CSS
|
920 |
-
* Remove q & cite p wrapper
|
921 |
-
|
922 |
-
= 0.2.12 =
|
923 |
-
* the_title filter fix
|
924 |
-
|
925 |
-
= 0.2.11 =
|
926 |
-
* Enable character limit for shortcode
|
927 |
-
|
928 |
-
= 0.2.10 =
|
929 |
-
* Character limit nows forces text truncation than preventing of testimonial to show
|
930 |
-
* Add option - Limit number of testimonials to pull at a time
|
931 |
-
* Sanitize widget variables
|
932 |
-
* Fix random_order issue on testimonials widget
|
933 |
-
|
934 |
-
= 0.2.9 =
|
935 |
-
* Require Editor role for managing Testimonials
|
936 |
-
|
937 |
-
= 0.2.8 =
|
938 |
-
* CSS testimonialswidget_testimonial_list fix #2
|
939 |
-
|
940 |
-
= 0.2.7 =
|
941 |
-
* CSS testimonialswidget_testimonial_list fix
|
942 |
-
|
943 |
-
= 0.2.6 =
|
944 |
-
* CSS updates for widgets and lists
|
945 |
-
|
946 |
-
= 0.2.5 =
|
947 |
-
* Add span.testimonialswidget_join for author , join text
|
948 |
-
* Add nl2br for testimonials display on a page
|
949 |
-
|
950 |
-
= 0.2.4 =
|
951 |
-
* Shortcode added - Thank you Hal Gatewood
|
952 |
-
|
953 |
-
= 0.2.3 =
|
954 |
-
* Allow testimonials to have multiple tags
|
955 |
-
* Show only quotes with all tags
|
956 |
-
|
957 |
-
= 0.2.2 =
|
958 |
-
* Show newest testimonials first in admin list by default
|
959 |
-
* Quick locallization
|
960 |
-
* Quotes Collection recommendation
|
961 |
-
|
962 |
-
= 2011-10-03: Version 0.2 =
|
963 |
-
* Multi-widget enabled
|
964 |
-
* Testimonial, author & source text are clickable automatically
|
965 |
-
* Allow 0 refresh to make widget static
|
966 |
-
* Allow pressing return when editing testimonial to save record
|
967 |
-
|
968 |
-
= 2011-08-12: Version 0.1 =
|
969 |
-
* initial release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
forum-responses.txt
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
Are you still having trouble?
|
2 |
-
|
3 |
-
Has looking through the <a href="https://aihrus.zendesk.com/categories/20104507-Testimonials-Widget">knowledge base</a> helped?
|
4 |
-
|
5 |
-
***
|
6 |
-
|
7 |
-
Got a URL to share with me so that I can help further?
|
8 |
-
|
9 |
-
***
|
10 |
-
|
11 |
-
Are you okay now?
|
12 |
-
|
13 |
-
***
|
14 |
-
|
15 |
-
Did you guys give the Testimonials Widget 2.12.1 release a try yet?
|
16 |
-
|
17 |
-
That's correctly the recent memory leak.
|
18 |
-
|
19 |
-
***
|
20 |
-
|
21 |
-
Did the 2.12.1 update work for you?
|
22 |
-
|
23 |
-
***
|
24 |
-
|
25 |
-
Please send me an admin login via http://aihr.us/contact-aihrus/.
|
26 |
-
|
27 |
-
***
|
28 |
-
|
29 |
-
See the <a href="http://wordpress.org/plugins/testimonials-widget/faq/">FAQ</a> and search the knowledge base mentioned there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{lib → includes}/class-testimonials-widget-settings.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -22,7 +22,7 @@
|
|
22 |
* Based upon http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
23 |
*/
|
24 |
|
25 |
-
require_once
|
26 |
|
27 |
if ( class_exists( 'Testimonials_Widget_Settings' ) )
|
28 |
return;
|
@@ -35,7 +35,7 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
35 |
public static $admin_page;
|
36 |
public static $class = __CLASS__;
|
37 |
public static $defaults = array();
|
38 |
-
public static $
|
39 |
public static $plugin_url = 'http://wordpress.org/plugins/testimonials-widget/';
|
40 |
public static $sections = array();
|
41 |
public static $settings = array();
|
@@ -99,10 +99,7 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
99 |
public static function init() {
|
100 |
load_plugin_textdomain( 'testimonials-widget', false, '/testimonials-widget/languages/' );
|
101 |
|
102 |
-
|
103 |
-
$plugin_path = Testimonials_Widget::strip_protocol( $plugin_path );
|
104 |
-
|
105 |
-
self::$plugin_path = $plugin_path;
|
106 |
}
|
107 |
|
108 |
|
@@ -112,6 +109,7 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
112 |
self::$sections['ordering'] = esc_html__( 'Ordering', 'testimonials-widget' );
|
113 |
self::$sections['widget'] = esc_html__( 'Widget', 'testimonials-widget' );
|
114 |
self::$sections['post_type'] = esc_html__( 'Post Type', 'testimonials-widget' );
|
|
|
115 |
|
116 |
parent::sections();
|
117 |
|
@@ -223,28 +221,18 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
223 |
'type' => 'expand_begin',
|
224 |
);
|
225 |
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
'title' => esc_html__( 'Enable Review Schema?', 'testimonials-widget' ),
|
230 |
-
'desc' => sprintf( $desc, 'http://schema.org/Review' ),
|
231 |
'type' => 'checkbox',
|
232 |
'validate' => 'is_true',
|
233 |
-
'std' => 1,
|
234 |
-
);
|
235 |
-
|
236 |
-
self::$settings['item_reviewed'] = array(
|
237 |
-
'title' => esc_html__( 'Reviewed Item?', 'testimonials-widget' ),
|
238 |
-
'desc' => esc_html__( 'Name of thing being referenced in testimonials', 'testimonials-widget' ),
|
239 |
-
'std' => get_option( 'blogname' ),
|
240 |
'widget' => 0,
|
241 |
);
|
242 |
|
243 |
-
self::$settings['
|
244 |
-
'title' => esc_html__( '
|
245 |
-
'
|
246 |
-
'
|
247 |
-
'validate' => 'url',
|
248 |
'widget' => 0,
|
249 |
);
|
250 |
|
@@ -255,10 +243,24 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
255 |
'validate' => 'is_true',
|
256 |
);
|
257 |
|
258 |
-
self::$settings['
|
259 |
-
'title' => esc_html__( '
|
|
|
260 |
'type' => 'checkbox',
|
261 |
'validate' => 'is_true',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
);
|
263 |
|
264 |
self::$settings['hide_gravatar'] = array(
|
@@ -324,15 +326,29 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
324 |
'validate' => 'is_true',
|
325 |
);
|
326 |
|
327 |
-
self::$settings['
|
328 |
-
'
|
329 |
-
'
|
330 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
);
|
332 |
|
333 |
self::$settings['paging'] = array(
|
334 |
'title' => esc_html__( 'Enable Paging?', 'testimonials-widget' ),
|
335 |
-
'desc' => esc_html__( 'For `[
|
336 |
'type' => 'select',
|
337 |
'choices' => array(
|
338 |
'' => esc_html__( 'Disable', 'testimonials-widget' ),
|
@@ -344,14 +360,36 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
344 |
'widget' => 0,
|
345 |
);
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
self::$settings['do_shortcode'] = array(
|
348 |
-
'title' => esc_html__( '
|
349 |
'desc' => esc_html__( 'If unchecked, shortcodes are stripped.', 'testimonials-widget' ),
|
350 |
'type' => 'checkbox',
|
351 |
'validate' => 'is_true',
|
352 |
'std' => 1,
|
353 |
);
|
354 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
self::$settings['general_expand_end'] = array(
|
356 |
'type' => 'expand_end',
|
357 |
);
|
@@ -498,7 +536,7 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
498 |
'title' => esc_html__( 'Archive Page URL', 'testimonials-widget' ),
|
499 |
'desc' => sprintf( $desc, $site_url ),
|
500 |
'std' => 'testimonials-archive',
|
501 |
-
'validate' => '
|
502 |
'widget' => 0,
|
503 |
);
|
504 |
|
@@ -509,7 +547,78 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
509 |
'title' => esc_html__( 'Testimonial Page URL', 'testimonials-widget' ),
|
510 |
'desc' => $desc,
|
511 |
'std' => 'testimonial',
|
512 |
-
'validate' => '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
'widget' => 0,
|
514 |
);
|
515 |
|
@@ -548,6 +657,7 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
548 |
'std' => 0,
|
549 |
),
|
550 |
'std' => 1,
|
|
|
551 |
);
|
552 |
|
553 |
self::$settings['disable_animation'] = array(
|
@@ -596,55 +706,6 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
596 |
'validate' => 'min1',
|
597 |
);
|
598 |
|
599 |
-
self::$settings['force_css_loading'] = array(
|
600 |
-
'section' => 'reset',
|
601 |
-
'title' => esc_html__( 'Always Load CSS?', 'testimonials-widget' ),
|
602 |
-
'desc' => esc_html__( 'Pre 2.14.0, Testimonials\' CSS was always loaded, whether needed or not', 'testimonials-widget' ),
|
603 |
-
'type' => 'checkbox',
|
604 |
-
'validate' => 'is_true',
|
605 |
-
'backwards' => array(
|
606 |
-
'version' => '2.14.0',
|
607 |
-
'std' => 1,
|
608 |
-
),
|
609 |
-
);
|
610 |
-
|
611 |
-
self::$settings['include_ie7_css'] = array(
|
612 |
-
'section' => 'reset',
|
613 |
-
'title' => esc_html__( 'Include IE7 CSS?', 'testimonials-widget' ),
|
614 |
-
'desc' => esc_html__( 'IE7 specific CSS moved to separate CSS file in version 2.13.6.', 'testimonials-widget' ),
|
615 |
-
'type' => 'checkbox',
|
616 |
-
'validate' => 'is_true',
|
617 |
-
'backwards' => array(
|
618 |
-
'version' => '2.13.6',
|
619 |
-
'std' => 1,
|
620 |
-
),
|
621 |
-
'widget' => 1,
|
622 |
-
);
|
623 |
-
|
624 |
-
self::$settings['use_quote_tag'] = array(
|
625 |
-
'section' => 'reset',
|
626 |
-
'title' => esc_html__( 'Use `<q>` tag?', 'testimonials-widget' ),
|
627 |
-
'desc' => esc_html__( 'Pre 2.11.0, not HTML5 compliant', 'testimonials-widget' ),
|
628 |
-
'type' => 'checkbox',
|
629 |
-
'validate' => 'is_true',
|
630 |
-
'backwards' => array(
|
631 |
-
'version' => '2.11.0',
|
632 |
-
'std' => 1,
|
633 |
-
),
|
634 |
-
);
|
635 |
-
|
636 |
-
self::$settings['remove_hentry'] = array(
|
637 |
-
'section' => 'reset',
|
638 |
-
'title' => esc_html__( 'Remove `.hentry` CSS?', 'testimonials-widget' ),
|
639 |
-
'desc' => esc_html__( 'Pre 2.6.4, some themes use class `.hentry` in a manner that breaks Testimonials\' CSS', 'testimonials-widget' ),
|
640 |
-
'type' => 'checkbox',
|
641 |
-
'validate' => 'is_true',
|
642 |
-
'backwards' => array(
|
643 |
-
'version' => '2.6.4',
|
644 |
-
'std' => 1,
|
645 |
-
),
|
646 |
-
);
|
647 |
-
|
648 |
self::$settings['reset_expand_end'] = array(
|
649 |
'section' => 'reset',
|
650 |
'type' => 'expand_end',
|
@@ -660,7 +721,10 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
660 |
public static function get_defaults( $mode = null, $old_version = null ) {
|
661 |
$old_version = tw_get_option( 'version' );
|
662 |
|
663 |
-
|
|
|
|
|
|
|
664 |
}
|
665 |
|
666 |
|
@@ -913,6 +977,14 @@ class Testimonials_Widget_Settings extends Aihrus_Settings {
|
|
913 |
)
|
914 |
);
|
915 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
916 |
$screen->add_help_tab(
|
917 |
array(
|
918 |
'id' => 'tw-reset',
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
22 |
* Based upon http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
23 |
*/
|
24 |
|
25 |
+
require_once AIHR_DIR_INC . 'class-aihrus-settings.php';
|
26 |
|
27 |
if ( class_exists( 'Testimonials_Widget_Settings' ) )
|
28 |
return;
|
35 |
public static $admin_page;
|
36 |
public static $class = __CLASS__;
|
37 |
public static $defaults = array();
|
38 |
+
public static $plugin_assets;
|
39 |
public static $plugin_url = 'http://wordpress.org/plugins/testimonials-widget/';
|
40 |
public static $sections = array();
|
41 |
public static $settings = array();
|
99 |
public static function init() {
|
100 |
load_plugin_textdomain( 'testimonials-widget', false, '/testimonials-widget/languages/' );
|
101 |
|
102 |
+
self::$plugin_assets = Testimonials_Widget::$plugin_assets;
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
|
109 |
self::$sections['ordering'] = esc_html__( 'Ordering', 'testimonials-widget' );
|
110 |
self::$sections['widget'] = esc_html__( 'Widget', 'testimonials-widget' );
|
111 |
self::$sections['post_type'] = esc_html__( 'Post Type', 'testimonials-widget' );
|
112 |
+
self::$sections['columns'] = esc_html__( 'Columns', 'testimonials-widget' );
|
113 |
|
114 |
parent::sections();
|
115 |
|
221 |
'type' => 'expand_begin',
|
222 |
);
|
223 |
|
224 |
+
self::$settings['exclude_bxslider_css'] = array(
|
225 |
+
'title' => esc_html__( 'Exclude bxSlider CSS?', 'testimonials-widget' ),
|
226 |
+
'desc' => esc_html__( 'For a bare-bones, unthemed slider.', 'testimonials-widget' ),
|
|
|
|
|
227 |
'type' => 'checkbox',
|
228 |
'validate' => 'is_true',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
'widget' => 0,
|
230 |
);
|
231 |
|
232 |
+
self::$settings['include_ie7_css'] = array(
|
233 |
+
'title' => esc_html__( 'Include IE7 CSS?', 'testimonials-widget' ),
|
234 |
+
'type' => 'checkbox',
|
235 |
+
'validate' => 'is_true',
|
|
|
236 |
'widget' => 0,
|
237 |
);
|
238 |
|
243 |
'validate' => 'is_true',
|
244 |
);
|
245 |
|
246 |
+
self::$settings['remove_hentry'] = array(
|
247 |
+
'title' => esc_html__( 'Remove `.hentry` CSS?', 'testimonials-widget' ),
|
248 |
+
'desc' => esc_html__( 'Some themes use class `.hentry` in a manner that breaks Testimonials\' CSS', 'testimonials-widget' ),
|
249 |
'type' => 'checkbox',
|
250 |
'validate' => 'is_true',
|
251 |
+
'std' => 1,
|
252 |
+
);
|
253 |
+
|
254 |
+
self::$settings['use_quote_tag'] = array(
|
255 |
+
'title' => esc_html__( 'Use `<q>` tag?', 'testimonials-widget' ),
|
256 |
+
'desc' => esc_html__( 'Not HTML5 compliant', 'testimonials-widget' ),
|
257 |
+
'type' => 'checkbox',
|
258 |
+
'validate' => 'is_true',
|
259 |
+
);
|
260 |
+
|
261 |
+
self::$settings['general_heading_fields'] = array(
|
262 |
+
'desc' => esc_html__( 'Fields to Show', 'testimonials-widget' ),
|
263 |
+
'type' => 'heading',
|
264 |
);
|
265 |
|
266 |
self::$settings['hide_gravatar'] = array(
|
326 |
'validate' => 'is_true',
|
327 |
);
|
328 |
|
329 |
+
self::$settings['general_heading_misc'] = array(
|
330 |
+
'desc' => esc_html__( 'Miscellanious', 'testimonials-widget' ),
|
331 |
+
'type' => 'heading',
|
332 |
+
);
|
333 |
+
|
334 |
+
self::$settings['item_reviewed'] = array(
|
335 |
+
'title' => esc_html__( 'Default Reviewed Item?', 'testimonials-widget' ),
|
336 |
+
'desc' => esc_html__( 'Name of thing being referenced in testimonials', 'testimonials-widget' ),
|
337 |
+
'std' => get_option( 'blogname' ),
|
338 |
+
'widget' => 0,
|
339 |
+
);
|
340 |
+
|
341 |
+
self::$settings['item_reviewed_url'] = array(
|
342 |
+
'title' => esc_html__( 'Default Reviewed Item URL?', 'testimonials-widget' ),
|
343 |
+
'desc' => esc_html__( 'URL of thing being referenced in testimonials', 'testimonials-widget' ),
|
344 |
+
'std' => network_site_url(),
|
345 |
+
'validate' => 'url',
|
346 |
+
'widget' => 0,
|
347 |
);
|
348 |
|
349 |
self::$settings['paging'] = array(
|
350 |
'title' => esc_html__( 'Enable Paging?', 'testimonials-widget' ),
|
351 |
+
'desc' => esc_html__( 'For `[testimonials]`', 'testimonials-widget' ),
|
352 |
'type' => 'select',
|
353 |
'choices' => array(
|
354 |
'' => esc_html__( 'Disable', 'testimonials-widget' ),
|
360 |
'widget' => 0,
|
361 |
);
|
362 |
|
363 |
+
$desc = __( 'Adds HTML tag markup per the <a href="%s">Review schema</a> to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results.', 'testimonials-widget' );
|
364 |
+
|
365 |
+
self::$settings['enable_schema'] = array(
|
366 |
+
'title' => esc_html__( 'Enable Review Schema?', 'testimonials-widget' ),
|
367 |
+
'desc' => sprintf( $desc, 'http://schema.org/Review' ),
|
368 |
+
'type' => 'checkbox',
|
369 |
+
'validate' => 'is_true',
|
370 |
+
'std' => 1,
|
371 |
+
);
|
372 |
+
|
373 |
self::$settings['do_shortcode'] = array(
|
374 |
+
'title' => esc_html__( 'Enable [shortcodes]?', 'testimonials-widget' ),
|
375 |
'desc' => esc_html__( 'If unchecked, shortcodes are stripped.', 'testimonials-widget' ),
|
376 |
'type' => 'checkbox',
|
377 |
'validate' => 'is_true',
|
378 |
'std' => 1,
|
379 |
);
|
380 |
|
381 |
+
self::$settings['hide_not_found'] = array(
|
382 |
+
'title' => esc_html__( 'Hide "Testimonials Not Found"?', 'testimonials-widget' ),
|
383 |
+
'type' => 'checkbox',
|
384 |
+
'validate' => 'is_true',
|
385 |
+
);
|
386 |
+
|
387 |
+
self::$settings['target'] = array(
|
388 |
+
'title' => esc_html__( 'URL Target', 'testimonials-widget' ),
|
389 |
+
'desc' => esc_html__( 'Add target to all URLs; leave blank if none', 'testimonials-widget' ),
|
390 |
+
'validate' => 'term',
|
391 |
+
);
|
392 |
+
|
393 |
self::$settings['general_expand_end'] = array(
|
394 |
'type' => 'expand_end',
|
395 |
);
|
536 |
'title' => esc_html__( 'Archive Page URL', 'testimonials-widget' ),
|
537 |
'desc' => sprintf( $desc, $site_url ),
|
538 |
'std' => 'testimonials-archive',
|
539 |
+
'validate' => 'slash_sanitize_title',
|
540 |
'widget' => 0,
|
541 |
);
|
542 |
|
547 |
'title' => esc_html__( 'Testimonial Page URL', 'testimonials-widget' ),
|
548 |
'desc' => $desc,
|
549 |
'std' => 'testimonial',
|
550 |
+
'validate' => 'slash_sanitize_title',
|
551 |
+
'widget' => 0,
|
552 |
+
);
|
553 |
+
|
554 |
+
// Columns
|
555 |
+
self::$settings['columns_id'] = array(
|
556 |
+
'section' => 'columns',
|
557 |
+
'title' => esc_html__( 'Hide ID?', 'testimonials-widget' ),
|
558 |
+
'type' => 'checkbox',
|
559 |
+
'validate' => 'is_true',
|
560 |
+
'std' => 1,
|
561 |
+
'widget' => 0,
|
562 |
+
);
|
563 |
+
|
564 |
+
self::$settings['columns_thumbnail'] = array(
|
565 |
+
'section' => 'columns',
|
566 |
+
'title' => esc_html__( 'Hide Image?', 'testimonials-widget' ),
|
567 |
+
'type' => 'checkbox',
|
568 |
+
'validate' => 'is_true',
|
569 |
+
'widget' => 0,
|
570 |
+
);
|
571 |
+
|
572 |
+
self::$settings['columns_shortcode'] = array(
|
573 |
+
'section' => 'columns',
|
574 |
+
'title' => esc_html__( 'Hide Shortcode?', 'testimonials-widget' ),
|
575 |
+
'type' => 'checkbox',
|
576 |
+
'validate' => 'is_true',
|
577 |
+
'widget' => 0,
|
578 |
+
);
|
579 |
+
|
580 |
+
self::$settings['columns_job_title'] = array(
|
581 |
+
'section' => 'columns',
|
582 |
+
'title' => esc_html__( 'Hide Job Title?', 'testimonials-widget' ),
|
583 |
+
'type' => 'checkbox',
|
584 |
+
'validate' => 'is_true',
|
585 |
+
'std' => 1,
|
586 |
+
'widget' => 0,
|
587 |
+
);
|
588 |
+
|
589 |
+
self::$settings['columns_location'] = array(
|
590 |
+
'section' => 'columns',
|
591 |
+
'title' => esc_html__( 'Hide Location?', 'testimonials-widget' ),
|
592 |
+
'type' => 'checkbox',
|
593 |
+
'validate' => 'is_true',
|
594 |
+
'std' => 1,
|
595 |
+
'widget' => 0,
|
596 |
+
);
|
597 |
+
|
598 |
+
self::$settings['columns_email'] = array(
|
599 |
+
'section' => 'columns',
|
600 |
+
'title' => esc_html__( 'Hide Email?', 'testimonials-widget' ),
|
601 |
+
'type' => 'checkbox',
|
602 |
+
'validate' => 'is_true',
|
603 |
+
'std' => 1,
|
604 |
+
'widget' => 0,
|
605 |
+
);
|
606 |
+
|
607 |
+
self::$settings['columns_company'] = array(
|
608 |
+
'section' => 'columns',
|
609 |
+
'title' => esc_html__( 'Hide Company?', 'testimonials-widget' ),
|
610 |
+
'type' => 'checkbox',
|
611 |
+
'validate' => 'is_true',
|
612 |
+
'std' => 1,
|
613 |
+
'widget' => 0,
|
614 |
+
);
|
615 |
+
|
616 |
+
self::$settings['columns_url'] = array(
|
617 |
+
'section' => 'columns',
|
618 |
+
'title' => esc_html__( 'Hide URL?', 'testimonials-widget' ),
|
619 |
+
'type' => 'checkbox',
|
620 |
+
'validate' => 'is_true',
|
621 |
+
'std' => 1,
|
622 |
'widget' => 0,
|
623 |
);
|
624 |
|
657 |
'std' => 0,
|
658 |
),
|
659 |
'std' => 1,
|
660 |
+
'widget' => 0,
|
661 |
);
|
662 |
|
663 |
self::$settings['disable_animation'] = array(
|
706 |
'validate' => 'min1',
|
707 |
);
|
708 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
self::$settings['reset_expand_end'] = array(
|
710 |
'section' => 'reset',
|
711 |
'type' => 'expand_end',
|
721 |
public static function get_defaults( $mode = null, $old_version = null ) {
|
722 |
$old_version = tw_get_option( 'version' );
|
723 |
|
724 |
+
$defaults = parent::get_defaults( $mode, $old_version );
|
725 |
+
$defaults = apply_filters( 'testimonials_widget_settings_defaults', $defaults );
|
726 |
+
|
727 |
+
return $defaults;
|
728 |
}
|
729 |
|
730 |
|
977 |
)
|
978 |
);
|
979 |
|
980 |
+
$screen->add_help_tab(
|
981 |
+
array(
|
982 |
+
'id' => 'tw-columns',
|
983 |
+
'title' => esc_html__( 'Columns', 'testimonials-widget' ),
|
984 |
+
'content' => '<p>' . esc_html__( 'Allowed columns to display on edit page.', 'testimonials-widget' ) . '</p>'
|
985 |
+
)
|
986 |
+
);
|
987 |
+
|
988 |
$screen->add_help_tab(
|
989 |
array(
|
990 |
'id' => 'tw-reset',
|
{lib → includes}/class-testimonials-widget-widget.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -16,7 +16,7 @@
|
|
16 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
*/
|
18 |
|
19 |
-
require_once
|
20 |
|
21 |
if ( class_exists( 'Testimonials_Widget_Widget' ) )
|
22 |
return;
|
@@ -51,7 +51,7 @@ class Testimonials_Widget_Widget extends Aihrus_Widget {
|
|
51 |
|
52 |
|
53 |
public static function get_content( $instance, $widget_number ) {
|
54 |
-
return Testimonials_Widget::
|
55 |
}
|
56 |
|
57 |
|
@@ -65,15 +65,9 @@ class Testimonials_Widget_Widget extends Aihrus_Widget {
|
|
65 |
if ( empty( $instance ) ) {
|
66 |
$do_number = false;
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
if ( empty( $defaults['random'] ) )
|
72 |
-
$defaults['random'] = 1;
|
73 |
-
|
74 |
-
$defaults['enable_schema'] = 0;
|
75 |
-
|
76 |
-
$instance = array();
|
77 |
} elseif ( ! empty( $instance['resetted'] ) ) {
|
78 |
if ( empty( $instance['char_limit'] ) )
|
79 |
$instance['char_limit'] = 500;
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
16 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
*/
|
18 |
|
19 |
+
require_once AIHR_DIR_INC . 'class-aihrus-widget.php';
|
20 |
|
21 |
if ( class_exists( 'Testimonials_Widget_Widget' ) )
|
22 |
return;
|
51 |
|
52 |
|
53 |
public static function get_content( $instance, $widget_number ) {
|
54 |
+
return Testimonials_Widget::testimonials_slider( $instance, $widget_number );
|
55 |
}
|
56 |
|
57 |
|
65 |
if ( empty( $instance ) ) {
|
66 |
$do_number = false;
|
67 |
|
68 |
+
$instance['char_limit'] = 500;
|
69 |
+
$instance['random'] = 1;
|
70 |
+
$instance['enable_schema'] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
} elseif ( ! empty( $instance['resetted'] ) ) {
|
72 |
if ( empty( $instance['char_limit'] ) )
|
73 |
$instance['char_limit'] = 500;
|
includes/class-testimonials-widget.php
ADDED
@@ -0,0 +1,2167 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
* This program is free software; you can redistribute it and/or modify
|
5 |
+
* it under the terms of the GNU General Public License, version 2, as
|
6 |
+
* published by the Free Software Foundation.
|
7 |
+
* This program is distributed in the hope that it will be useful,
|
8 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10 |
+
* GNU General Public License for more details.
|
11 |
+
* You should have received a copy of the GNU General Public License
|
12 |
+
* along with this program; if not, write to the Free Software
|
13 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
14 |
+
*/
|
15 |
+
|
16 |
+
require_once AIHR_DIR_INC . 'class-aihrus-common.php';
|
17 |
+
require_once AIHR_DIR_LIB . 'class-redrokk-metabox-class.php';
|
18 |
+
require_once TW_DIR_INC . 'class-testimonials-widget-settings.php';
|
19 |
+
require_once TW_DIR_INC . 'class-testimonials-widget-widget.php';
|
20 |
+
|
21 |
+
if ( class_exists( 'Testimonials_Widget' ) )
|
22 |
+
return;
|
23 |
+
|
24 |
+
|
25 |
+
class Testimonials_Widget extends Aihrus_Common {
|
26 |
+
const BASE = TW_BASE;
|
27 |
+
const ID = 'testimonials-widget-testimonials';
|
28 |
+
const SLUG = 'tw_';
|
29 |
+
const VERSION = TW_VERSION;
|
30 |
+
|
31 |
+
const OLD_NAME = 'testimonialswidget';
|
32 |
+
const PT = 'testimonials-widget';
|
33 |
+
|
34 |
+
private static $found_posts = 0;
|
35 |
+
private static $max_num_pages = 0;
|
36 |
+
private static $post_count = 0;
|
37 |
+
private static $wp_query;
|
38 |
+
|
39 |
+
public static $class = __CLASS__;
|
40 |
+
public static $cpt_category = '';
|
41 |
+
public static $cpt_tags = '';
|
42 |
+
public static $css = array();
|
43 |
+
public static $css_called = false;
|
44 |
+
public static $instance_number = 0;
|
45 |
+
public static $instance_widget = 0;
|
46 |
+
public static $menu_shortcodes;
|
47 |
+
public static $not_found = false;
|
48 |
+
public static $notice_key;
|
49 |
+
public static $plugin_assets;
|
50 |
+
public static $scripts = array();
|
51 |
+
public static $scripts_called = false;
|
52 |
+
public static $settings_link = '';
|
53 |
+
public static $tag_close_quote = '<span class="close-quote"></span>';
|
54 |
+
public static $tag_open_quote = '<span class="open-quote"></span>';
|
55 |
+
public static $use_instance = false;
|
56 |
+
public static $widget_number = 100000;
|
57 |
+
|
58 |
+
public static $agg_count = 'reviewCount';
|
59 |
+
public static $agg_schema = 'http://schema.org/AggregateRating';
|
60 |
+
|
61 |
+
public static $cw_author = 'author';
|
62 |
+
public static $cw_date = 'datePublished';
|
63 |
+
public static $cw_date_mod = 'dateModified';
|
64 |
+
public static $cw_aggregate = 'aggregateRating';
|
65 |
+
public static $cw_review = 'review';
|
66 |
+
public static $cw_source_org = 'sourceOrganization';
|
67 |
+
|
68 |
+
public static $org_location = 'location';
|
69 |
+
public static $org_schema = 'http://schema.org/Organization';
|
70 |
+
|
71 |
+
public static $person_email = 'email';
|
72 |
+
public static $person_home = 'homeLocation';
|
73 |
+
public static $person_job_title = 'jobTitle';
|
74 |
+
public static $person_schema = 'http://schema.org/Person';
|
75 |
+
public static $person_member = 'memberOf';
|
76 |
+
|
77 |
+
public static $place_schema = 'http://schema.org/Place';
|
78 |
+
|
79 |
+
public static $review_body = 'reviewBody';
|
80 |
+
public static $review_item = 'itemReviewed';
|
81 |
+
public static $review_schema = 'http://schema.org/Review';
|
82 |
+
|
83 |
+
public static $schema_div_open = '<div itemscope itemtype="%1$s">';
|
84 |
+
public static $schema_div_prop = '<div itemprop="%1$s" itemscope itemtype="%2$s">%3$s</div>';
|
85 |
+
public static $schema_item_prop = 'itemprop="%1$s"';
|
86 |
+
public static $schema_meta = '<meta itemprop="%1$s" content="%2$s" />';
|
87 |
+
public static $schema_span = '<span itemprop="%1$s">%2$s</span>';
|
88 |
+
|
89 |
+
public static $thing_image = 'image';
|
90 |
+
public static $thing_name = 'name';
|
91 |
+
public static $thing_schema = 'http://schema.org/Thing';
|
92 |
+
public static $thing_url = 'url';
|
93 |
+
|
94 |
+
|
95 |
+
public function __construct() {
|
96 |
+
parent::__construct();
|
97 |
+
|
98 |
+
self::$plugin_assets = plugins_url( '/assets/', dirname( __FILE__ ) );
|
99 |
+
self::$plugin_assets = self::strip_protocol( self::$plugin_assets );
|
100 |
+
|
101 |
+
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
|
102 |
+
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
|
103 |
+
add_action( 'init', array( __CLASS__, 'init' ) );
|
104 |
+
add_action( 'widgets_init', array( __CLASS__, 'widgets_init' ) );
|
105 |
+
add_shortcode( 'testimonials', array( __CLASS__, 'testimonials' ) );
|
106 |
+
add_shortcode( 'testimonialswidget_list', array( __CLASS__, 'testimonialswidget_list' ) );
|
107 |
+
add_shortcode( 'testimonialswidget_widget', array( __CLASS__, 'testimonialswidget_widget' ) );
|
108 |
+
add_shortcode( 'testimonials_slider', array( __CLASS__, 'testimonials_slider' ) );
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
public static function admin_init() {
|
113 |
+
self::support_thumbnails();
|
114 |
+
|
115 |
+
self::$settings_link = '<a href="' . get_admin_url() . 'edit.php?post_type=' . Testimonials_Widget::PT . '&page=' . Testimonials_Widget_Settings::ID . '">' . esc_html__( 'Settings', 'testimonials-widget' ) . '</a>';
|
116 |
+
|
117 |
+
self::add_meta_box_testimonials_widget();
|
118 |
+
self::update();
|
119 |
+
|
120 |
+
add_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
121 |
+
add_action( 'manage_' . self::PT . '_posts_custom_column', array( __CLASS__, 'manage_posts_custom_column' ), 10, 2 );
|
122 |
+
add_action( 'right_now_content_table_end', array( __CLASS__, 'right_now_content_table_end' ) );
|
123 |
+
add_filter( 'manage_' . self::PT . '_posts_columns', array( __CLASS__, 'manage_posts_columns' ) );
|
124 |
+
add_filter( 'plugin_action_links', array( __CLASS__, 'plugin_action_links' ), 10, 2 );
|
125 |
+
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
|
126 |
+
add_filter( 'post_updated_messages', array( __CLASS__, 'post_updated_messages' ) );
|
127 |
+
add_filter( 'pre_get_posts', array( __CLASS__, 'pre_get_posts_author' ) );
|
128 |
+
|
129 |
+
if ( self::do_load() ) {
|
130 |
+
add_filter( 'manage_category_custom_column', array( __CLASS__, 'category_column' ), 10, 3 );
|
131 |
+
add_filter( 'manage_edit-category_columns', array( __CLASS__, 'category_columns' ) );
|
132 |
+
add_filter( 'manage_edit-post_tag_columns', array( __CLASS__, 'category_columns' ) );
|
133 |
+
add_filter( 'manage_edit-testimonials-widget-category_columns', array( __CLASS__, 'category_columns' ) );
|
134 |
+
add_filter( 'manage_edit-testimonials-widget-post_tag_columns', array( __CLASS__, 'category_columns' ) );
|
135 |
+
add_filter( 'manage_post_tag_custom_column', array( __CLASS__, 'post_tag_column' ), 10, 3 );
|
136 |
+
add_filter( 'manage_testimonials-widget-category_custom_column', array( __CLASS__, 'category_column' ), 10, 3 );
|
137 |
+
add_filter( 'manage_testimonials-widget-post_tag_custom_column', array( __CLASS__, 'post_tag_column' ), 10, 3 );
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
public static function admin_menu() {
|
143 |
+
self::$menu_shortcodes = add_submenu_page( 'edit.php?post_type=' . self::PT, esc_html__( 'Testimonials Shortcode Examples', 'testimonials-widget' ), esc_html__( 'E.g. Shortcodes', 'testimonials-widget' ), 'manage_options', 'shortcodes', array( __CLASS__, 'show_shortcodes' ) );
|
144 |
+
}
|
145 |
+
|
146 |
+
|
147 |
+
public static function init() {
|
148 |
+
add_filter( 'the_content', array( __CLASS__, 'get_single' ), -1 );
|
149 |
+
|
150 |
+
load_plugin_textdomain( self::PT, false, 'testimonials-widget/languages' );
|
151 |
+
|
152 |
+
self::$cpt_category = self::PT . '-category';
|
153 |
+
self::$cpt_tags = self::PT . '-post_tag';
|
154 |
+
|
155 |
+
self::init_post_type();
|
156 |
+
self::styles();
|
157 |
+
}
|
158 |
+
|
159 |
+
|
160 |
+
public static function plugin_action_links( $links, $file ) {
|
161 |
+
if ( self::BASE == $file )
|
162 |
+
array_unshift( $links, self::$settings_link );
|
163 |
+
|
164 |
+
return $links;
|
165 |
+
}
|
166 |
+
|
167 |
+
|
168 |
+
public static function add_instance() {
|
169 |
+
self::$use_instance = false;
|
170 |
+
self::$instance_number++;
|
171 |
+
|
172 |
+
return self::$instance_number;
|
173 |
+
}
|
174 |
+
|
175 |
+
|
176 |
+
public static function get_instance() {
|
177 |
+
return self::$use_instance ? self::$instance_number : self::$instance_widget;
|
178 |
+
}
|
179 |
+
|
180 |
+
|
181 |
+
public static function set_instance( $widget_number ) {
|
182 |
+
self::$use_instance = true;
|
183 |
+
self::$instance_widget = $widget_number;
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
public static function support_thumbnails() {
|
188 |
+
$feature = 'post-thumbnails';
|
189 |
+
$feature_level = get_theme_support( $feature );
|
190 |
+
|
191 |
+
if ( true === $feature_level ) {
|
192 |
+
// already enabled for all post types
|
193 |
+
return;
|
194 |
+
} elseif ( false === $feature_level ) {
|
195 |
+
// none allowed, only enable for our own
|
196 |
+
add_theme_support( $feature, array( self::PT ) );
|
197 |
+
} else {
|
198 |
+
// add our own to list of supported
|
199 |
+
$feature_level[0][] = self::PT;
|
200 |
+
add_theme_support( $feature, $feature_level[0] );
|
201 |
+
}
|
202 |
+
}
|
203 |
+
|
204 |
+
|
205 |
+
public static function get_single( $content ) {
|
206 |
+
global $post;
|
207 |
+
|
208 |
+
if ( ! is_single() || self::PT != $post->post_type )
|
209 |
+
return $content;
|
210 |
+
|
211 |
+
$atts = self::get_defaults( true );
|
212 |
+
$atts['hide_content'] = 1;
|
213 |
+
$atts['ids'] = $post->ID;
|
214 |
+
$atts['type'] = 'get_single';
|
215 |
+
|
216 |
+
$instance = self::add_instance();
|
217 |
+
$atts['widget_number'] = $instance;
|
218 |
+
|
219 |
+
$testimonials = array();
|
220 |
+
|
221 |
+
$text = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
222 |
+
if ( false === $text ) {
|
223 |
+
$testimonials = self::get_testimonials( $atts );
|
224 |
+
$testimonial = $testimonials[0];
|
225 |
+
|
226 |
+
$details = self::get_testimonial_html( $testimonial, $atts );
|
227 |
+
$details = apply_filters( 'testimonials_widget_testimonial_html_single', $details, $testimonial, $atts );
|
228 |
+
|
229 |
+
$content = apply_filters( 'testimonials_widget_testimonial_html_single_content', $content, $testimonial, $atts );
|
230 |
+
|
231 |
+
$text = $content . $details;
|
232 |
+
$text = apply_filters( 'testimonials_widget_cache_set', $text, $atts );
|
233 |
+
}
|
234 |
+
|
235 |
+
self::call_scripts_styles( $testimonials, $atts, $instance );
|
236 |
+
|
237 |
+
return $text;
|
238 |
+
}
|
239 |
+
|
240 |
+
|
241 |
+
public static function activation() {
|
242 |
+
if ( ! current_user_can( 'activate_plugins' ) )
|
243 |
+
return;
|
244 |
+
|
245 |
+
self::init();
|
246 |
+
flush_rewrite_rules();
|
247 |
+
}
|
248 |
+
|
249 |
+
|
250 |
+
public static function deactivation() {
|
251 |
+
if ( ! current_user_can( 'activate_plugins' ) )
|
252 |
+
return;
|
253 |
+
|
254 |
+
flush_rewrite_rules();
|
255 |
+
}
|
256 |
+
|
257 |
+
|
258 |
+
public static function uninstall() {
|
259 |
+
if ( ! current_user_can( 'activate_plugins' ) )
|
260 |
+
return;
|
261 |
+
|
262 |
+
global $wpdb;
|
263 |
+
|
264 |
+
require_once TW_DIR_INC . 'class-testimonials-widget-settings.php';
|
265 |
+
|
266 |
+
$delete_data = tw_get_option( 'delete_data', false );
|
267 |
+
if ( $delete_data ) {
|
268 |
+
delete_option( self::OLD_NAME );
|
269 |
+
delete_option( Testimonials_Widget_Settings::ID );
|
270 |
+
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->options . '`' );
|
271 |
+
|
272 |
+
Testimonials_Widget::delete_testimonials();
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
public static function delete_testimonials() {
|
278 |
+
global $wpdb;
|
279 |
+
|
280 |
+
$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::PT . "'";
|
281 |
+
$posts = $wpdb->get_results( $query );
|
282 |
+
|
283 |
+
foreach ( $posts as $post ) {
|
284 |
+
$post_id = $post->ID;
|
285 |
+
Testimonials_Widget::delete_attachments( $post_id );
|
286 |
+
|
287 |
+
// dels post, meta & comments
|
288 |
+
// true is force delete
|
289 |
+
wp_delete_post( $post_id, true );
|
290 |
+
}
|
291 |
+
|
292 |
+
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->postmeta . '`' );
|
293 |
+
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->posts . '`' );
|
294 |
+
}
|
295 |
+
|
296 |
+
|
297 |
+
public static function delete_attachments( $post_id = false ) {
|
298 |
+
global $wpdb;
|
299 |
+
|
300 |
+
$post_id = $post_id ? $post_id : 0;
|
301 |
+
$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent = {$post_id}";
|
302 |
+
$attachments = $wpdb->get_results( $query );
|
303 |
+
|
304 |
+
foreach ( $attachments as $attachment ) {
|
305 |
+
// true is force delete
|
306 |
+
wp_delete_attachment( $attachment->ID, true );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
+
public static function plugin_row_meta( $input, $file ) {
|
312 |
+
if ( self::BASE != $file )
|
313 |
+
return $input;
|
314 |
+
|
315 |
+
$disable_donate = tw_get_option( 'disable_donate' );
|
316 |
+
if ( $disable_donate )
|
317 |
+
return $input;
|
318 |
+
|
319 |
+
$links = array(
|
320 |
+
self::$donate_link,
|
321 |
+
);
|
322 |
+
|
323 |
+
global $TW_Premium;
|
324 |
+
if ( ! isset( $TW_Premium ) )
|
325 |
+
$links[] = TW_PREMIUM_LINK;
|
326 |
+
|
327 |
+
$input = array_merge( $input, $links );
|
328 |
+
|
329 |
+
return $input;
|
330 |
+
}
|
331 |
+
|
332 |
+
|
333 |
+
public static function notice_2_12_0() {
|
334 |
+
$text = sprintf( __( 'If your Testimonials display has gone to funky town, please <a href="%s">read the FAQ</a> about possible CSS fixes.', 'testimonials-widget' ), esc_url( 'https://aihrus.zendesk.com/entries/23722573-Major-Changes-Since-2-10-0' ) );
|
335 |
+
|
336 |
+
aihr_notice_updated( $text );
|
337 |
+
}
|
338 |
+
|
339 |
+
|
340 |
+
public static function notice_donate( $disable_donate = null, $item_name = null ) {
|
341 |
+
$disable_donate = tw_get_option( 'disable_donate' );
|
342 |
+
|
343 |
+
parent::notice_donate( $disable_donate, TW_NAME );
|
344 |
+
}
|
345 |
+
|
346 |
+
|
347 |
+
public static function update() {
|
348 |
+
$prior_version = tw_get_option( 'admin_notices' );
|
349 |
+
if ( $prior_version ) {
|
350 |
+
if ( $prior_version < '2.12.0' )
|
351 |
+
self::set_notice( 'notice_2_12_0' );
|
352 |
+
|
353 |
+
if ( $prior_version < '2.15.0' )
|
354 |
+
self::set_notice( 'notice_2_15_0' );
|
355 |
+
|
356 |
+
if ( $prior_version < self::VERSION ) {
|
357 |
+
tw_requirements_check( true );
|
358 |
+
do_action( 'testimonials_widget_update' );
|
359 |
+
}
|
360 |
+
|
361 |
+
tw_set_option( 'admin_notices' );
|
362 |
+
}
|
363 |
+
|
364 |
+
// display donate on major/minor version release
|
365 |
+
$donate_version = tw_get_option( 'donate_version', false );
|
366 |
+
if ( ! $donate_version || ( $donate_version != self::VERSION && preg_match( '#\.0$#', self::VERSION ) ) ) {
|
367 |
+
self::set_notice( 'notice_donate' );
|
368 |
+
tw_set_option( 'donate_version', self::VERSION );
|
369 |
+
}
|
370 |
+
|
371 |
+
$options = get_option( self::OLD_NAME );
|
372 |
+
if ( true !== $options['migrated'] )
|
373 |
+
self::migrate();
|
374 |
+
}
|
375 |
+
|
376 |
+
|
377 |
+
public static function migrate() {
|
378 |
+
global $wpdb;
|
379 |
+
|
380 |
+
$table_name = $wpdb->prefix . self::OLD_NAME;
|
381 |
+
$meta_key = '_' . self::PT . ':testimonial_id';
|
382 |
+
$has_table_query = "SELECT table_name FROM information_schema.tables WHERE table_schema='{$wpdb->dbname}' AND table_name='{$table_name}'";
|
383 |
+
$has_table_result = $wpdb->get_col( $has_table_query );
|
384 |
+
|
385 |
+
if ( ! empty( $has_table_result ) ) {
|
386 |
+
// check that db table exists and has entries
|
387 |
+
$query = 'SELECT `testimonial_id`, `testimonial`, `author`, `source`, `tags`, `public`, `time_added`, `time_updated` FROM `' . $table_name . '`';
|
388 |
+
|
389 |
+
// ignore already imported
|
390 |
+
$done_import_query = 'SELECT meta_value FROM ' . $wpdb->postmeta . ' WHERE meta_key = "' . $meta_key . '"';
|
391 |
+
$done_import = $wpdb->get_col( $done_import_query );
|
392 |
+
|
393 |
+
if ( ! empty( $done_import ) ) {
|
394 |
+
$done_import = array_unique( $done_import );
|
395 |
+
$query .= ' WHERE testimonial_id NOT IN ( ' . implode( ',', $done_import ) . ' )';
|
396 |
+
}
|
397 |
+
|
398 |
+
$results = $wpdb->get_results( $query );
|
399 |
+
if ( ! empty( $results ) ) {
|
400 |
+
foreach ( $results as $result ) {
|
401 |
+
// author can contain title and company details
|
402 |
+
$author = $result->author;
|
403 |
+
$company = false;
|
404 |
+
|
405 |
+
// ex: First Last of Company!
|
406 |
+
$author = str_replace( ' of ', ', ', $author );
|
407 |
+
// now ex: First Last, Company!
|
408 |
+
|
409 |
+
// ex: First Last, Company
|
410 |
+
// ex: First Last, Web Development Manager, Topcon Positioning Systems, Inc.
|
411 |
+
// ex: First Last, Owner, Company, LLC
|
412 |
+
$author = str_replace( ' of ', ', ', $author );
|
413 |
+
$temp_comma = '^^^';
|
414 |
+
$author = str_replace( ', LLC', $temp_comma . ' LLC', $author );
|
415 |
+
|
416 |
+
// now ex: First Last, Owner, Company^^^ LLC
|
417 |
+
$author = str_replace( ', Inc', $temp_comma . ' Inc', $author );
|
418 |
+
|
419 |
+
// ex: First Last, Web Development Manager, Company^^^ Inc.
|
420 |
+
// it's possible to have "Michael Cannon, Senior Developer" and "Senior Developer" become the company. Okay for now
|
421 |
+
$author = explode( ', ', $author );
|
422 |
+
|
423 |
+
if ( 1 < count( $author ) ) {
|
424 |
+
$company = array_pop( $author );
|
425 |
+
$company = str_replace( $temp_comma, ',', $company );
|
426 |
+
}
|
427 |
+
|
428 |
+
$author = implode( ', ', $author );
|
429 |
+
$author = str_replace( $temp_comma, ',', $author );
|
430 |
+
|
431 |
+
$post_data = array(
|
432 |
+
'post_type' => self::PT,
|
433 |
+
'post_status' => ( 'yes' == $result->public ) ? 'publish' : 'private',
|
434 |
+
'post_date' => $result->time_added,
|
435 |
+
'post_modified' => $result->time_updated,
|
436 |
+
'post_title' => $author,
|
437 |
+
'post_content' => $result->testimonial,
|
438 |
+
'tags_input' => $result->tags,
|
439 |
+
);
|
440 |
+
|
441 |
+
$post_id = wp_insert_post( $post_data, true );
|
442 |
+
|
443 |
+
// track/link testimonial import to new post
|
444 |
+
add_post_meta( $post_id, $meta_key, $result->testimonial_id );
|
445 |
+
|
446 |
+
if ( ! empty( $company ) )
|
447 |
+
add_post_meta( $post_id, 'testimonials-widget-company', $company );
|
448 |
+
|
449 |
+
$source = $result->source;
|
450 |
+
if ( ! empty( $source ) ) {
|
451 |
+
if ( is_email( $source ) ) {
|
452 |
+
add_post_meta( $post_id, 'testimonials-widget-email', $source );
|
453 |
+
} else {
|
454 |
+
add_post_meta( $post_id, 'testimonials-widget-url', $source );
|
455 |
+
}
|
456 |
+
}
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}
|
460 |
+
|
461 |
+
$options['migrated'] = true;
|
462 |
+
delete_option( self::OLD_NAME );
|
463 |
+
add_option( self::OLD_NAME, $options, '', 'no' );
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
public static function pre_get_posts_author( $query ) {
|
468 |
+
global $user_ID;
|
469 |
+
|
470 |
+
// author's and below
|
471 |
+
if ( $query->is_admin && ! empty( $query->is_main_query ) && $query->is_post_type_archive( Testimonials_Widget::PT ) && ! current_user_can( 'edit_others_posts' ) )
|
472 |
+
$query->set( 'post_author', $user_ID );
|
473 |
+
|
474 |
+
return $query;
|
475 |
+
}
|
476 |
+
|
477 |
+
|
478 |
+
public static function manage_posts_custom_column( $column, $post_id ) {
|
479 |
+
$result = false;
|
480 |
+
|
481 |
+
switch ( $column ) {
|
482 |
+
case 'id':
|
483 |
+
$result = $post_id;
|
484 |
+
break;
|
485 |
+
|
486 |
+
case 'shortcode':
|
487 |
+
$result = '[testimonials ids="';
|
488 |
+
$result .= $post_id;
|
489 |
+
$result .= '"]';
|
490 |
+
$result .= '<br />';
|
491 |
+
$result .= '[testimonials_slider ids="';
|
492 |
+
$result .= $post_id;
|
493 |
+
$result .= '"]';
|
494 |
+
break;
|
495 |
+
|
496 |
+
case 'testimonials-widget-company':
|
497 |
+
case 'testimonials-widget-location':
|
498 |
+
case 'testimonials-widget-title':
|
499 |
+
$result = get_post_meta( $post_id, $column, true );
|
500 |
+
break;
|
501 |
+
|
502 |
+
case 'testimonials-widget-email':
|
503 |
+
case 'testimonials-widget-url':
|
504 |
+
$url = get_post_meta( $post_id, $column, true );
|
505 |
+
if ( ! empty( $url ) && ! is_email( $url ) && 0 === preg_match( '#https?://#', $url ) )
|
506 |
+
$url = 'http://' . $url;
|
507 |
+
|
508 |
+
$result = make_clickable( $url );
|
509 |
+
break;
|
510 |
+
|
511 |
+
case 'thumbnail':
|
512 |
+
$email = get_post_meta( $post_id, 'testimonials-widget-email', true );
|
513 |
+
|
514 |
+
if ( has_post_thumbnail( $post_id ) )
|
515 |
+
$result = get_the_post_thumbnail( $post_id, 'thumbnail' );
|
516 |
+
elseif ( is_email( $email ) )
|
517 |
+
$result = get_avatar( $email );
|
518 |
+
else
|
519 |
+
$result = false;
|
520 |
+
break;
|
521 |
+
|
522 |
+
case self::$cpt_category:
|
523 |
+
case self::$cpt_tags:
|
524 |
+
$terms = get_the_terms( $post_id, $column );
|
525 |
+
$result = '';
|
526 |
+
if ( ! empty( $terms ) ) {
|
527 |
+
$out = array();
|
528 |
+
foreach ( $terms as $term )
|
529 |
+
$out[] = '<a href="' . admin_url( 'edit-tags.php?action=edit&taxonomy=' . $column . '&tag_ID=' . $term->term_id . '&post_type=' . self::PT ) . '">' . $term->name . '</a>';
|
530 |
+
|
531 |
+
$result = join( ', ', $out );
|
532 |
+
}
|
533 |
+
break;
|
534 |
+
}
|
535 |
+
|
536 |
+
$result = apply_filters( 'testimonials_widget_posts_custom_column', $result, $column, $post_id );
|
537 |
+
|
538 |
+
if ( $result )
|
539 |
+
echo $result;
|
540 |
+
}
|
541 |
+
|
542 |
+
|
543 |
+
public static function manage_posts_columns( $columns ) {
|
544 |
+
// order of keys matches column ordering
|
545 |
+
$columns = array(
|
546 |
+
'cb' => '<input type="checkbox" />',
|
547 |
+
'title' => esc_html__( 'Source', 'testimonials-widget' ),
|
548 |
+
'author' => esc_html__( 'Published by', 'testimonials-widget' ),
|
549 |
+
'date' => esc_html__( 'Date', 'testimonials-widget' ),
|
550 |
+
);
|
551 |
+
|
552 |
+
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
553 |
+
if ( ! $use_cpt_taxonomy ) {
|
554 |
+
$columns[ 'categories' ] = esc_html__( 'Category', 'testimonials-widget' );
|
555 |
+
$columns[ 'tags' ] = esc_html__( 'Tags', 'testimonials-widget' );
|
556 |
+
} else {
|
557 |
+
$columns[ self::$cpt_category ] = esc_html__( 'Category', 'testimonials-widget' );
|
558 |
+
$columns[ self::$cpt_tags ] = esc_html__( 'Tags', 'testimonials-widget' );
|
559 |
+
}
|
560 |
+
|
561 |
+
$show_id = tw_get_option( 'columns_id' );
|
562 |
+
if ( empty( $show_id ) ) {
|
563 |
+
$columns[ 'id' ] = esc_html__( 'ID', 'testimonials-widget' );
|
564 |
+
}
|
565 |
+
|
566 |
+
$show_thumbnail = tw_get_option( 'columns_thumbnail' );
|
567 |
+
if ( empty( $show_thumbnail ) ) {
|
568 |
+
$columns[ 'thumbnail' ] = esc_html__( 'Image', 'testimonials-widget' );
|
569 |
+
}
|
570 |
+
|
571 |
+
$show_shortcode = tw_get_option( 'columns_shortcode' );
|
572 |
+
if ( empty( $show_shortcode ) ) {
|
573 |
+
$columns[ 'shortcode' ] = esc_html__( 'Shortcodes', 'testimonials-widget' );
|
574 |
+
}
|
575 |
+
|
576 |
+
$show_job_title = tw_get_option( 'columns_job_title' );
|
577 |
+
if ( empty( $show_job_title ) ) {
|
578 |
+
$columns[ 'testimonials-widget-title' ] = esc_html__( 'Job Title', 'testimonials-widget' );
|
579 |
+
}
|
580 |
+
|
581 |
+
$show_location = tw_get_option( 'columns_location' );
|
582 |
+
if ( empty( $show_location ) ) {
|
583 |
+
$columns[ 'testimonials-widget-location' ] = esc_html__( 'Location', 'testimonials-widget' );
|
584 |
+
}
|
585 |
+
|
586 |
+
$show_email = tw_get_option( 'columns_email' );
|
587 |
+
if ( empty( $show_email ) ) {
|
588 |
+
$columns[ 'testimonials-widget-email' ] = esc_html__( 'Email', 'testimonials-widget' );
|
589 |
+
}
|
590 |
+
|
591 |
+
$show_company = tw_get_option( 'columns_company' );
|
592 |
+
if ( empty( $show_company ) ) {
|
593 |
+
$columns[ 'testimonials-widget-company' ] = esc_html__( 'Company', 'testimonials-widget' );
|
594 |
+
}
|
595 |
+
|
596 |
+
$show_url = tw_get_option( 'columns_url' );
|
597 |
+
if ( empty( $show_url ) ) {
|
598 |
+
$columns[ 'testimonials-widget-url' ] = esc_html__( 'URL', 'testimonials-widget' );
|
599 |
+
}
|
600 |
+
|
601 |
+
$columns = apply_filters( 'testimonials_widget_columns', $columns );
|
602 |
+
|
603 |
+
return $columns;
|
604 |
+
}
|
605 |
+
|
606 |
+
|
607 |
+
public static function init_post_type() {
|
608 |
+
$labels = array(
|
609 |
+
'add_new' => esc_html__( 'Add New', 'testimonials-widget' ),
|
610 |
+
'add_new_item' => esc_html__( 'Add New Testimonial', 'testimonials-widget' ),
|
611 |
+
'edit_item' => esc_html__( 'Edit Testimonial', 'testimonials-widget' ),
|
612 |
+
'name' => esc_html__( 'Testimonials', 'testimonials-widget' ),
|
613 |
+
'new_item' => esc_html__( 'Add New Testimonial', 'testimonials-widget' ),
|
614 |
+
'not_found' => esc_html__( 'No testimonials found', 'testimonials-widget' ),
|
615 |
+
'not_found_in_trash' => esc_html__( 'No testimonials found in Trash', 'testimonials-widget' ),
|
616 |
+
'parent_item_colon' => null,
|
617 |
+
'search_items' => esc_html__( 'Search Testimonials', 'testimonials-widget' ),
|
618 |
+
'singular_name' => esc_html__( 'Testimonial', 'testimonials-widget' ),
|
619 |
+
'view_item' => esc_html__( 'View Testimonial', 'testimonials-widget' ),
|
620 |
+
);
|
621 |
+
|
622 |
+
$supports = array(
|
623 |
+
'title',
|
624 |
+
'editor',
|
625 |
+
'thumbnail',
|
626 |
+
'publicize',
|
627 |
+
);
|
628 |
+
|
629 |
+
$allow_comments = tw_get_option( 'allow_comments', false );
|
630 |
+
if ( $allow_comments )
|
631 |
+
$supports[] = 'comments';
|
632 |
+
|
633 |
+
$has_archive = tw_get_option( 'has_archive', true );
|
634 |
+
$rewrite_slug = tw_get_option( 'rewrite_slug', 'testimonial' );
|
635 |
+
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
636 |
+
|
637 |
+
// editor's and up
|
638 |
+
if ( current_user_can( 'edit_others_posts' ) )
|
639 |
+
$supports[] = 'author';
|
640 |
+
|
641 |
+
if ( ! $use_cpt_taxonomy ) {
|
642 |
+
$do_register_taxonomy = false;
|
643 |
+
$taxonomies = array(
|
644 |
+
'category',
|
645 |
+
'post_tag',
|
646 |
+
);
|
647 |
+
} else {
|
648 |
+
$do_register_taxonomy = true;
|
649 |
+
$taxonomies = array(
|
650 |
+
self::$cpt_category,
|
651 |
+
self::$cpt_tags,
|
652 |
+
);
|
653 |
+
|
654 |
+
self::register_taxonomies();
|
655 |
+
}
|
656 |
+
|
657 |
+
$args = array(
|
658 |
+
'label' => esc_html__( 'Testimonials', 'testimonials-widget' ),
|
659 |
+
'capability_type' => 'post',
|
660 |
+
'has_archive' => $has_archive,
|
661 |
+
'hierarchical' => false,
|
662 |
+
'labels' => $labels,
|
663 |
+
'public' => true,
|
664 |
+
'publicly_queryable' => true,
|
665 |
+
'query_var' => true,
|
666 |
+
'rewrite' => array(
|
667 |
+
'slug' => $rewrite_slug,
|
668 |
+
'with_front' => false,
|
669 |
+
),
|
670 |
+
'supports' => $supports,
|
671 |
+
'taxonomies' => $taxonomies,
|
672 |
+
);
|
673 |
+
|
674 |
+
register_post_type( self::PT, $args );
|
675 |
+
|
676 |
+
if ( $do_register_taxonomy ) {
|
677 |
+
register_taxonomy_for_object_type( self::$cpt_category, self::PT );
|
678 |
+
register_taxonomy_for_object_type( self::$cpt_tags, self::PT );
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
|
683 |
+
public static function register_taxonomies() {
|
684 |
+
$args = array(
|
685 |
+
'hierarchical' => true,
|
686 |
+
'show_admin_column' => true,
|
687 |
+
);
|
688 |
+
register_taxonomy( self::$cpt_category, self::PT, $args );
|
689 |
+
|
690 |
+
$args = array(
|
691 |
+
'show_admin_column' => true,
|
692 |
+
'update_count_callback' => '_update_post_term_count',
|
693 |
+
);
|
694 |
+
register_taxonomy( self::$cpt_tags, self::PT, $args );
|
695 |
+
}
|
696 |
+
|
697 |
+
|
698 |
+
public static function get_defaults( $single_view = false ) {
|
699 |
+
if ( empty( $single_view ) )
|
700 |
+
return apply_filters( 'testimonials_widget_defaults', tw_get_options() );
|
701 |
+
else
|
702 |
+
return apply_filters( 'testimonials_widget_defaults_single', tw_get_options() );
|
703 |
+
}
|
704 |
+
|
705 |
+
|
706 |
+
public static function testimonialswidget_list( $atts ) {
|
707 |
+
_deprecated_function( __FUNCTION__, '2.19.0', 'testimonials()' );
|
708 |
+
|
709 |
+
return self::testimonials( $atts );
|
710 |
+
}
|
711 |
+
|
712 |
+
|
713 |
+
public static function testimonials( $atts ) {
|
714 |
+
$atts = wp_parse_args( $atts, self::get_defaults() );
|
715 |
+
$atts = Testimonials_Widget_Settings::validate_settings( $atts );
|
716 |
+
|
717 |
+
if ( get_query_var( 'paged' ) ) {
|
718 |
+
$atts['paged'] = get_query_var( 'paged' );
|
719 |
+
} elseif ( get_query_var( 'page' ) ) {
|
720 |
+
$atts['paged'] = get_query_var( 'page' );
|
721 |
+
} else {
|
722 |
+
$atts['paged'] = 1;
|
723 |
+
}
|
724 |
+
|
725 |
+
$atts['type'] = 'testimonials';
|
726 |
+
|
727 |
+
$instance = self::add_instance();
|
728 |
+
$atts['widget_number'] = $instance;
|
729 |
+
|
730 |
+
$testimonials = array();
|
731 |
+
|
732 |
+
$content = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
733 |
+
if ( false === $content ) {
|
734 |
+
$testimonials = self::get_testimonials( $atts );
|
735 |
+
$content = self::get_testimonials_html( $testimonials, $atts );
|
736 |
+
$content = apply_filters( 'testimonials_widget_cache_set', $content, $atts );
|
737 |
+
}
|
738 |
+
|
739 |
+
self::call_scripts_styles( $testimonials, $atts, $instance );
|
740 |
+
|
741 |
+
return $content;
|
742 |
+
}
|
743 |
+
|
744 |
+
|
745 |
+
public static function testimonialswidget_widget( $atts, $widget_number = null ) {
|
746 |
+
_deprecated_function( __FUNCTION__, '2.19.0', 'testimonials_slider()' );
|
747 |
+
|
748 |
+
return self::testimonials_slider( $atts, $widget_number );
|
749 |
+
}
|
750 |
+
|
751 |
+
|
752 |
+
public static function testimonials_slider( $atts, $widget_number = null ) {
|
753 |
+
if ( empty( $widget_number ) ) {
|
754 |
+
$widget_number = self::$widget_number++;
|
755 |
+
|
756 |
+
if ( ! isset( $atts['random'] ) )
|
757 |
+
$atts['random'] = 1;
|
758 |
+
|
759 |
+
if ( ! isset( $atts['enable_schema'] ) )
|
760 |
+
$atts['enable_schema'] = 0;
|
761 |
+
}
|
762 |
+
|
763 |
+
$atts = wp_parse_args( $atts, self::get_defaults() );
|
764 |
+
$atts = Testimonials_Widget_Settings::validate_settings( $atts );
|
765 |
+
|
766 |
+
$atts['paging'] = false;
|
767 |
+
$atts['type'] = 'testimonials_slider';
|
768 |
+
|
769 |
+
self::set_instance( $widget_number );
|
770 |
+
$atts['widget_number'] = $widget_number;
|
771 |
+
|
772 |
+
$testimonials = array();
|
773 |
+
|
774 |
+
$content = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
775 |
+
if ( false === $content ) {
|
776 |
+
$testimonials = self::get_testimonials( $atts );
|
777 |
+
$content = self::get_testimonials_html( $testimonials, $atts, false, $widget_number );
|
778 |
+
$content = apply_filters( 'testimonials_widget_cache_set', $content, $atts );
|
779 |
+
}
|
780 |
+
|
781 |
+
self::call_scripts_styles( $testimonials, $atts, $widget_number );
|
782 |
+
|
783 |
+
return $content;
|
784 |
+
}
|
785 |
+
|
786 |
+
|
787 |
+
public static function scripts( $atts ) {
|
788 |
+
if ( is_admin() )
|
789 |
+
return;
|
790 |
+
|
791 |
+
wp_enqueue_script( 'jquery' );
|
792 |
+
|
793 |
+
$use_bxslider = $atts['use_bxslider'];
|
794 |
+
if ( $use_bxslider ) {
|
795 |
+
$enable_video = $atts['enable_video'];
|
796 |
+
if ( $enable_video ) {
|
797 |
+
wp_register_script( 'jquery.fitvids', self::$plugin_assets . 'js/jquery.fitvids.js', array( 'jquery' ), '1.0', true );
|
798 |
+
wp_enqueue_script( 'jquery.fitvids' );
|
799 |
+
}
|
800 |
+
|
801 |
+
wp_register_script( 'jquery.bxslider', self::$plugin_assets . 'js/jquery.bxslider.js', array( 'jquery' ), '4.1.1', true );
|
802 |
+
wp_enqueue_script( 'jquery.bxslider' );
|
803 |
+
}
|
804 |
+
|
805 |
+
do_action( 'testimonials_widget_scripts', $atts );
|
806 |
+
}
|
807 |
+
|
808 |
+
|
809 |
+
public static function styles() {
|
810 |
+
if ( is_admin() )
|
811 |
+
return;
|
812 |
+
|
813 |
+
$use_bxslider = tw_get_option( 'use_bxslider' );
|
814 |
+
if ( $use_bxslider ) {
|
815 |
+
$exclude_bxslider_css = tw_get_option( 'exclude_bxslider_css' );
|
816 |
+
if ( empty( $exclude_bxslider_css ) ) {
|
817 |
+
wp_register_style( 'jquery.bxslider', self::$plugin_assets . 'css/jquery.bxslider.css' );
|
818 |
+
wp_enqueue_style( 'jquery.bxslider' );
|
819 |
+
}
|
820 |
+
|
821 |
+
wp_register_style( __CLASS__, self::$plugin_assets . 'css/testimonials-widget.css' );
|
822 |
+
} else {
|
823 |
+
wp_register_style( __CLASS__, self::$plugin_assets . 'css/testimonials-widget-2.14.0.css' );
|
824 |
+
|
825 |
+
$include_ie7_css = tw_get_option( 'include_ie7_css' );
|
826 |
+
if ( $include_ie7_css ) {
|
827 |
+
wp_register_style( __CLASS__ . '-ie7', self::$plugin_assets . 'css/testimonials-widget-ie7.css' );
|
828 |
+
wp_enqueue_style( __CLASS__ . '-ie7' );
|
829 |
+
}
|
830 |
+
}
|
831 |
+
|
832 |
+
wp_enqueue_style( __CLASS__ );
|
833 |
+
|
834 |
+
do_action( 'testimonials_widget_styles' );
|
835 |
+
}
|
836 |
+
|
837 |
+
|
838 |
+
public static function get_testimonials_html_css( $atts, $widget_number = null ) {
|
839 |
+
$css = array();
|
840 |
+
$id_base = self::ID . $widget_number;
|
841 |
+
|
842 |
+
switch ( $atts['type'] ) {
|
843 |
+
case 'testimonials_slider':
|
844 |
+
$use_bxslider = $atts['use_bxslider'];
|
845 |
+
if ( ! $use_bxslider ) {
|
846 |
+
$height = $atts['height'];
|
847 |
+
$max_height = $atts['max_height'];
|
848 |
+
$min_height = $atts['min_height'];
|
849 |
+
|
850 |
+
if ( $height ) {
|
851 |
+
$max_height = $height;
|
852 |
+
$min_height = $height;
|
853 |
+
}
|
854 |
+
|
855 |
+
if ( $min_height ) {
|
856 |
+
$css[] = <<<EOF
|
857 |
+
<style>
|
858 |
+
.$id_base {
|
859 |
+
min-height: {$min_height}px;
|
860 |
+
}
|
861 |
+
</style>
|
862 |
+
EOF;
|
863 |
+
}
|
864 |
+
|
865 |
+
if ( $max_height ) {
|
866 |
+
$css[] = <<<EOF
|
867 |
+
<style>
|
868 |
+
.$id_base {
|
869 |
+
max-height: {$max_height}px;
|
870 |
+
}
|
871 |
+
</style>
|
872 |
+
EOF;
|
873 |
+
}
|
874 |
+
}
|
875 |
+
break;
|
876 |
+
}
|
877 |
+
|
878 |
+
$css = apply_filters( 'testimonials_widget_testimonials_css', $css, $atts, $widget_number );
|
879 |
+
|
880 |
+
return $css;
|
881 |
+
}
|
882 |
+
|
883 |
+
|
884 |
+
public static function get_testimonials_html_js( $testimonials, $atts, $widget_number = null ) {
|
885 |
+
$not_found = self::get_not_found();
|
886 |
+
if ( $not_found )
|
887 |
+
return;
|
888 |
+
|
889 |
+
$scripts = array();
|
890 |
+
$scripts_internal = array();
|
891 |
+
|
892 |
+
$id = self::ID;
|
893 |
+
$id_base = $id . $widget_number;
|
894 |
+
|
895 |
+
switch ( $atts['type'] ) {
|
896 |
+
case 'testimonials_slider':
|
897 |
+
$javascript = '';
|
898 |
+
if ( 1 < count( $testimonials ) ) {
|
899 |
+
$refresh_interval = $atts['refresh_interval'];
|
900 |
+
|
901 |
+
$javascript .= '<script type="text/javascript">' . "\n";
|
902 |
+
|
903 |
+
$use_bxslider = $atts['use_bxslider'];
|
904 |
+
if ( $use_bxslider ) {
|
905 |
+
$enable_video = $atts['enable_video'];
|
906 |
+
$show_start_stop = $atts['show_start_stop'];
|
907 |
+
$transition_mode = $atts['transition_mode'];
|
908 |
+
|
909 |
+
$auto = $refresh_interval ? 'true' : 'false';
|
910 |
+
$pager = ! $refresh_interval ? 'pager: true' : 'pager: false';
|
911 |
+
$pause = $refresh_interval * 1000;
|
912 |
+
$video = $enable_video ? "video: true,\nuseCSS: false" : 'video: false';
|
913 |
+
|
914 |
+
$autoControls = $show_start_stop ? 'autoControls: true,' : '';
|
915 |
+
|
916 |
+
$slider_var = self::SLUG . $widget_number;
|
917 |
+
$javascript .= <<<EOF
|
918 |
+
var {$slider_var} = null;
|
919 |
+
|
920 |
+
jQuery(document).ready(function() {
|
921 |
+
{$slider_var} = jQuery('.{$id_base}').bxSlider({
|
922 |
+
auto: {$auto},
|
923 |
+
{$autoControls}
|
924 |
+
autoHover: true,
|
925 |
+
controls: false,
|
926 |
+
mode: '{$transition_mode}',
|
927 |
+
{$pager},
|
928 |
+
pause: {$pause},
|
929 |
+
{$video},
|
930 |
+
slideMargin: 2
|
931 |
+
});
|
932 |
+
});
|
933 |
+
|
934 |
+
EOF;
|
935 |
+
} else {
|
936 |
+
$tw_padding = 'tw_padding' . $widget_number;
|
937 |
+
$tw_wrapper = 'tw_wrapper' . $widget_number;
|
938 |
+
|
939 |
+
$disable_animation = $atts['disable_animation'];
|
940 |
+
$fade_in_speed = $atts['fade_in_speed'];
|
941 |
+
$fade_out_speed = $atts['fade_out_speed'];
|
942 |
+
$height = $atts['height'];
|
943 |
+
$max_height = $atts['max_height'];
|
944 |
+
$min_height = $atts['min_height'];
|
945 |
+
|
946 |
+
$enable_animation = 1;
|
947 |
+
if ( $disable_animation || $height || $max_height || $min_height )
|
948 |
+
$enable_animation = 0;
|
949 |
+
|
950 |
+
if ( $refresh_interval ) {
|
951 |
+
$javascript .= <<<EOF
|
952 |
+
function nextTestimonial{$widget_number}() {
|
953 |
+
if ( ! jQuery('.{$id_base}').first().hasClass('hovered') ) {
|
954 |
+
var active = jQuery('.{$id_base} .active');
|
955 |
+
var next = (jQuery('.{$id_base} .active').next().length > 0) ? jQuery('.{$id_base} .active').next() : jQuery('.{$id_base} .testimonials-widget-testimonial:first-child');
|
956 |
+
|
957 |
+
active.fadeOut({$fade_out_speed}, function() {
|
958 |
+
active.removeClass('active');
|
959 |
+
next.fadeIn({$fade_in_speed});
|
960 |
+
next.removeClass('display-none');
|
961 |
+
next.addClass('active');
|
962 |
+
|
963 |
+
{INTERNAL_SCRIPTS}
|
964 |
+
|
965 |
+
// added padding
|
966 |
+
if ( {$enable_animation} )
|
967 |
+
{$tw_wrapper}.animate({ height: next.height() + {$tw_padding} });
|
968 |
+
});
|
969 |
+
}
|
970 |
+
}
|
971 |
+
|
972 |
+
jQuery(document).ready(function() {
|
973 |
+
jQuery('.{$id_base}').hover(function() {
|
974 |
+
jQuery(this).addClass('hovered')
|
975 |
+
}, function() {
|
976 |
+
jQuery(this).removeClass('hovered')
|
977 |
+
});
|
978 |
+
|
979 |
+
nextTestimonial{$widget_number}interval = setInterval('nextTestimonial{$widget_number}()', {$refresh_interval} * 1000);
|
980 |
+
});
|
981 |
+
|
982 |
+
EOF;
|
983 |
+
}
|
984 |
+
|
985 |
+
$javascript .= <<<EOF
|
986 |
+
if ( {$enable_animation} ) {
|
987 |
+
var {$tw_wrapper} = jQuery('.{$id_base}');
|
988 |
+
var {$tw_padding} = 0;
|
989 |
+
|
990 |
+
jQuery(document).ready(function() {
|
991 |
+
// tw_padding is the difference in height to take into account all styling options
|
992 |
+
{$tw_padding} = {$tw_wrapper}.height() - jQuery('.{$id_base} .testimonials-widget-testimonial').height();
|
993 |
+
|
994 |
+
// fixes first animation by defining height to adjust to
|
995 |
+
{$tw_wrapper}.height( {$tw_wrapper}.height() );
|
996 |
+
});
|
997 |
+
}
|
998 |
+
EOF;
|
999 |
+
}
|
1000 |
+
|
1001 |
+
$javascript .= "\n" . '</script>';
|
1002 |
+
$scripts[ $id_base ] = $javascript;
|
1003 |
+
}
|
1004 |
+
break;
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
$scripts = apply_filters( 'testimonials_widget_testimonials_js', $scripts, $testimonials, $atts, $widget_number );
|
1008 |
+
$scripts_internal = apply_filters( 'testimonials_widget_testimonials_js_internal', $scripts_internal, $testimonials, $atts, $widget_number );
|
1009 |
+
$internal_scripts = implode( "\n", $scripts_internal );
|
1010 |
+
$scripts = str_replace( '{INTERNAL_SCRIPTS}', $internal_scripts, $scripts );
|
1011 |
+
|
1012 |
+
return $scripts;
|
1013 |
+
}
|
1014 |
+
|
1015 |
+
|
1016 |
+
public static function get_testimonials_html( $testimonials, $atts, $is_list = true, $widget_number = null ) {
|
1017 |
+
$hide_not_found = $atts['hide_not_found'];
|
1018 |
+
$paging = Testimonials_Widget_Settings::is_true( $atts['paging'] );
|
1019 |
+
$paging_before = ( 'before' === strtolower( $atts['paging'] ) );
|
1020 |
+
$paging_after = ( 'after' === strtolower( $atts['paging'] ) );
|
1021 |
+
$target = $atts['target'];
|
1022 |
+
|
1023 |
+
$id = self::ID;
|
1024 |
+
|
1025 |
+
if ( is_null( $widget_number ) ) {
|
1026 |
+
$div_open = '<div class="' . $id;
|
1027 |
+
|
1028 |
+
if ( $is_list )
|
1029 |
+
$div_open .= ' listing';
|
1030 |
+
|
1031 |
+
$div_open .= '">';
|
1032 |
+
} else {
|
1033 |
+
$id_base = $id . $widget_number;
|
1034 |
+
$div_open = '<div class="' . $id . ' ' . $id_base . '">';
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
$div_open .= "\n";
|
1038 |
+
if ( empty( $testimonials ) && ! $hide_not_found ) {
|
1039 |
+
$testimonials = array(
|
1040 |
+
array( 'testimonial_content' => esc_html__( 'No testimonials found', 'testimonials-widget' ) ),
|
1041 |
+
);
|
1042 |
+
|
1043 |
+
self::set_not_found( true );
|
1044 |
+
} else
|
1045 |
+
self::set_not_found();
|
1046 |
+
|
1047 |
+
$pre_paging = '';
|
1048 |
+
if ( $paging || $paging_before )
|
1049 |
+
$pre_paging = self::get_testimonials_paging( $atts );
|
1050 |
+
|
1051 |
+
$is_first = true;
|
1052 |
+
|
1053 |
+
$testimonial_content = '';
|
1054 |
+
foreach ( $testimonials as $testimonial ) {
|
1055 |
+
$content = self::get_testimonial_html( $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1056 |
+
if ( $target )
|
1057 |
+
$content = links_add_target( $content, $target );
|
1058 |
+
$content = apply_filters( 'testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1059 |
+
$is_first = false;
|
1060 |
+
|
1061 |
+
$testimonial_content .= $content;
|
1062 |
+
}
|
1063 |
+
|
1064 |
+
$post_paging = '';
|
1065 |
+
if ( $paging || $paging_after )
|
1066 |
+
$post_paging = self::get_testimonials_paging( $atts, false );
|
1067 |
+
|
1068 |
+
$div_close = '</div>';
|
1069 |
+
$div_close .= "\n";
|
1070 |
+
|
1071 |
+
$html = $div_open
|
1072 |
+
. $pre_paging
|
1073 |
+
. $testimonial_content
|
1074 |
+
. $post_paging
|
1075 |
+
. $div_close;
|
1076 |
+
|
1077 |
+
$html = apply_filters( 'testimonials_widget_get_testimonials_html', $html, $testimonials, $atts, $is_list, $widget_number, $div_open, $pre_paging, $testimonial_content, $post_paging, $div_close );
|
1078 |
+
|
1079 |
+
return $html;
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
|
1083 |
+
public static function get_testimonial_html( $testimonial, $atts, $is_list = true, $is_first = false, $widget_number = null ) {
|
1084 |
+
$disable_quotes = $atts['disable_quotes'];
|
1085 |
+
$do_image = ! $atts['hide_image'] && ! empty( $testimonial['testimonial_image'] );
|
1086 |
+
$do_image_single = ! $atts['hide_image_single'];
|
1087 |
+
$do_schema = $atts['enable_schema'];
|
1088 |
+
$keep_whitespace = $atts['keep_whitespace'];
|
1089 |
+
$remove_hentry = $atts['remove_hentry'];
|
1090 |
+
$transition_mode = $atts['transition_mode'];
|
1091 |
+
$use_bxslider = $atts['use_bxslider'];
|
1092 |
+
|
1093 |
+
$class = 'testimonials-widget-testimonial';
|
1094 |
+
if ( is_single() && empty( $widget_number ) ) {
|
1095 |
+
$class .= ' single';
|
1096 |
+
} elseif ( $is_list ) {
|
1097 |
+
$class .= ' list';
|
1098 |
+
} else {
|
1099 |
+
// widget display
|
1100 |
+
if ( $use_bxslider ) {
|
1101 |
+
$refresh_interval = $atts['refresh_interval'];
|
1102 |
+
if ( ! $is_first && ! empty( $refresh_interval ) && ! in_array( $transition_mode, array( 'horizontal', 'vertical' ) ) ) {
|
1103 |
+
$class .= ' display-none';
|
1104 |
+
}
|
1105 |
+
} else {
|
1106 |
+
if ( $is_first ) {
|
1107 |
+
$class .= ' active';
|
1108 |
+
} else {
|
1109 |
+
$class .= ' display-none';
|
1110 |
+
}
|
1111 |
+
}
|
1112 |
+
}
|
1113 |
+
|
1114 |
+
if ( $keep_whitespace )
|
1115 |
+
$class .= ' whitespace';
|
1116 |
+
|
1117 |
+
$post_id = $testimonial['post_id'];
|
1118 |
+
if ( ! empty( $post_id ) )
|
1119 |
+
$class = join( ' ', get_post_class( $class, $post_id ) );
|
1120 |
+
else
|
1121 |
+
$class = 'testimonials-widget type-testimonials-widget status-publish hentry ' . $class;
|
1122 |
+
|
1123 |
+
$class = apply_filters( 'testimonials_widget_get_testimonial_html_class', $class, $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1124 |
+
$div_open = '<div class="' . $class . '">';
|
1125 |
+
$div_open .= '<!-- ' . self::ID . ":{$post_id}: -->";
|
1126 |
+
|
1127 |
+
if ( $do_schema ) {
|
1128 |
+
$div_open .= "\n";
|
1129 |
+
$div_open .= sprintf( self::$schema_div_open, self::$review_schema );
|
1130 |
+
}
|
1131 |
+
|
1132 |
+
if ( $remove_hentry )
|
1133 |
+
$div_open = str_replace( ' hentry', '', $div_open );
|
1134 |
+
|
1135 |
+
$image = '';
|
1136 |
+
if ( $do_image ) {
|
1137 |
+
$pic = $testimonial['testimonial_image'];
|
1138 |
+
|
1139 |
+
$image .= '<span class="image">';
|
1140 |
+
$image .= $pic;
|
1141 |
+
$image .= '</span>';
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
if ( ! $do_image_single && 'get_single' == $atts['type'] )
|
1145 |
+
$image = '';
|
1146 |
+
|
1147 |
+
$quote = self::get_quote( $testimonial, $atts, $widget_number );
|
1148 |
+
|
1149 |
+
$cite = '';
|
1150 |
+
if ( 1 < count( $testimonial ) ) {
|
1151 |
+
$cite = self::get_cite( $testimonial, $atts );
|
1152 |
+
|
1153 |
+
if ( $do_schema ) {
|
1154 |
+
$schema = self::get_schema( $testimonial, $atts );
|
1155 |
+
$cite .= $schema;
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
$extra = '';
|
1160 |
+
if ( ! empty( $testimonial['testimonial_extra'] ) ) {
|
1161 |
+
$extra .= '<div class="extra">';
|
1162 |
+
$extra .= $testimonial['testimonial_extra'];
|
1163 |
+
$extra .= '</div>';
|
1164 |
+
$extra .= "\n";
|
1165 |
+
}
|
1166 |
+
|
1167 |
+
$bottom_text = '';
|
1168 |
+
if ( ! empty( $atts['bottom_text'] ) ) {
|
1169 |
+
$bottom_text = '<div class="bottom_text">';
|
1170 |
+
$bottom_text .= $atts['bottom_text'];
|
1171 |
+
$bottom_text .= '</div>';
|
1172 |
+
$bottom_text .= "\n";
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
$div_close = '';
|
1176 |
+
if ( $do_schema ) {
|
1177 |
+
$div_close .= '</div>';
|
1178 |
+
$div_close .= "\n";
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
$div_close .= '</div>';
|
1182 |
+
$div_close .= "\n";
|
1183 |
+
|
1184 |
+
$html = $div_open
|
1185 |
+
. $image
|
1186 |
+
. $quote
|
1187 |
+
. $cite
|
1188 |
+
. $extra
|
1189 |
+
. $bottom_text
|
1190 |
+
. $div_close;
|
1191 |
+
|
1192 |
+
$html = apply_filters( 'testimonials_widget_get_testimonial_html', $html, $testimonial, $atts, $is_list, $is_first, $widget_number, $div_open, $image, $quote, $cite, $extra, $bottom_text, $div_close );
|
1193 |
+
|
1194 |
+
// not done sooner as tag_close_quote is used for Premium
|
1195 |
+
if ( $disable_quotes ) {
|
1196 |
+
$html = str_replace( self::$tag_open_quote, '', $html );
|
1197 |
+
$html = str_replace( self::$tag_close_quote, '', $html );
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
return $html;
|
1201 |
+
}
|
1202 |
+
|
1203 |
+
|
1204 |
+
public static function get_quote( $testimonial, $atts, $widget_number ) {
|
1205 |
+
$char_limit = $atts['char_limit'];
|
1206 |
+
$content_more = apply_filters( 'testimonials_widget_content_more', esc_html__( '…', 'testimonials-widget' ) );
|
1207 |
+
$content_more .= self::$tag_close_quote;
|
1208 |
+
$do_content = ! $atts['hide_content'] && ! empty( $testimonial['testimonial_content'] );
|
1209 |
+
$use_quote_tag = $atts['use_quote_tag'];
|
1210 |
+
|
1211 |
+
$quote = '';
|
1212 |
+
if ( $do_content ) {
|
1213 |
+
$content = $testimonial['testimonial_content'];
|
1214 |
+
$content = self::format_content( $content, $widget_number, $atts );
|
1215 |
+
if ( $char_limit ) {
|
1216 |
+
$content = self::testimonials_truncate( $content, $char_limit, $content_more );
|
1217 |
+
$content = force_balance_tags( $content );
|
1218 |
+
}
|
1219 |
+
|
1220 |
+
$content = apply_filters( 'testimonials_widget_content', $content, $widget_number, $testimonial, $atts );
|
1221 |
+
$content = make_clickable( $content );
|
1222 |
+
|
1223 |
+
if ( ! $use_quote_tag ) {
|
1224 |
+
$quote = '<blockquote>';
|
1225 |
+
$quote .= $content;
|
1226 |
+
$quote .= '</blockquote>';
|
1227 |
+
} else {
|
1228 |
+
$quote = '<q>';
|
1229 |
+
$quote .= $content;
|
1230 |
+
$quote .= '</q>';
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
$quote = "\n" . $quote;
|
1234 |
+
}
|
1235 |
+
|
1236 |
+
return $quote;
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
|
1240 |
+
public static function get_cite( $testimonial, $atts ) {
|
1241 |
+
extract( $testimonial );
|
1242 |
+
|
1243 |
+
$do_company = ! $atts['hide_company'] && ! empty( $testimonial_company );
|
1244 |
+
$do_email = ! $atts['hide_email'] && ! empty( $testimonial_email ) && is_email( $testimonial_email );
|
1245 |
+
$do_location = ! $atts['hide_location'] && ! empty( $testimonial_location );
|
1246 |
+
$do_source = ! $atts['hide_source'] && ! empty( $testimonial_source );
|
1247 |
+
$do_title = ! $atts['hide_title'] && ! empty( $testimonial_title );
|
1248 |
+
$do_url = ! $atts['hide_url'] && ! empty( $testimonial_url );
|
1249 |
+
$use_quote_tag = $atts['use_quote_tag'];
|
1250 |
+
|
1251 |
+
$cite = '';
|
1252 |
+
|
1253 |
+
$done_url = false;
|
1254 |
+
if ( $do_source && $do_email ) {
|
1255 |
+
$cite .= '<span class="author">';
|
1256 |
+
$cite .= '<a href="mailto:' . $testimonial_email . '">';
|
1257 |
+
$cite .= $testimonial_source;
|
1258 |
+
$cite .= '</a>';
|
1259 |
+
$cite .= '</span>';
|
1260 |
+
} elseif ( $do_source && ! $do_company && $do_url ) {
|
1261 |
+
$done_url = true;
|
1262 |
+
|
1263 |
+
$cite .= '<span class="author">';
|
1264 |
+
$cite .= '<a href="' . $testimonial_url . '" rel="nofollow">';
|
1265 |
+
$cite .= $testimonial_source;
|
1266 |
+
$cite .= '</a>';
|
1267 |
+
$cite .= '</span>';
|
1268 |
+
} elseif ( $do_source ) {
|
1269 |
+
$cite .= '<span class="author">';
|
1270 |
+
$cite .= $testimonial_source;
|
1271 |
+
$cite .= '</span>';
|
1272 |
+
} elseif ( $do_email ) {
|
1273 |
+
$cite .= '<span class="email">';
|
1274 |
+
$cite .= make_clickable( $testimonial_email );
|
1275 |
+
$cite .= '</span>';
|
1276 |
+
}
|
1277 |
+
|
1278 |
+
if ( $do_title && $cite )
|
1279 |
+
$cite .= '<span class="join-title"></span>';
|
1280 |
+
|
1281 |
+
if ( $do_title ) {
|
1282 |
+
$cite .= '<span class="job-title">';
|
1283 |
+
$cite .= $testimonial_title;
|
1284 |
+
$cite .= '</span>';
|
1285 |
+
}
|
1286 |
+
|
1287 |
+
if ( $do_location && $cite )
|
1288 |
+
$cite .= '<span class="join-location"></span>';
|
1289 |
+
|
1290 |
+
if ( $do_location ) {
|
1291 |
+
$cite .= '<span class="location">';
|
1292 |
+
$cite .= $testimonial_location;
|
1293 |
+
$cite .= '</span>';
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
if ( ( $do_company || ( $do_url && ! $done_url ) ) && $cite )
|
1297 |
+
$cite .= '<span class="join"></span>';
|
1298 |
+
|
1299 |
+
if ( $do_company && $do_url ) {
|
1300 |
+
$cite .= '<span class="company">';
|
1301 |
+
$cite .= '<a href="' . $testimonial_url . '" rel="nofollow">';
|
1302 |
+
$cite .= $testimonial_company;
|
1303 |
+
$cite .= '</a>';
|
1304 |
+
$cite .= '</span>';
|
1305 |
+
} elseif ( $do_company ) {
|
1306 |
+
$cite .= '<span class="company">';
|
1307 |
+
$cite .= $testimonial_company;
|
1308 |
+
$cite .= '</span>';
|
1309 |
+
} elseif ( $do_url && ! $done_url ) {
|
1310 |
+
$cite .= '<span class="url">';
|
1311 |
+
$cite .= make_clickable( $testimonial_url );
|
1312 |
+
$cite .= '</span>';
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
$cite = apply_filters( 'testimonials_widget_cite_html', $cite, $testimonial, $atts );
|
1316 |
+
|
1317 |
+
if ( ! empty( $cite ) ) {
|
1318 |
+
if ( ! $use_quote_tag ) {
|
1319 |
+
$temp = '<div class="credit">';
|
1320 |
+
$temp .= $cite;
|
1321 |
+
$temp .= '</div>';
|
1322 |
+
|
1323 |
+
$cite = "\n" . $temp . "\n";
|
1324 |
+
} else {
|
1325 |
+
$cite = '<cite>' . $cite . '</cite>';
|
1326 |
+
}
|
1327 |
+
}
|
1328 |
+
|
1329 |
+
return $cite;
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
|
1333 |
+
// Original PHP code as myTruncate2 by Chirp Internet: www.chirp.com.au
|
1334 |
+
public static function testimonials_truncate( $string, $char_limit = false, $pad = '…', $force_pad = false ) {
|
1335 |
+
if ( empty( $force_pad ) ) {
|
1336 |
+
if ( ! $char_limit )
|
1337 |
+
return $string;
|
1338 |
+
|
1339 |
+
// return with no change if string is shorter than $char_limit
|
1340 |
+
if ( strlen( $string ) <= $char_limit )
|
1341 |
+
return $string;
|
1342 |
+
}
|
1343 |
+
|
1344 |
+
if ( $char_limit )
|
1345 |
+
return self::truncate( $string, $char_limit, $pad, $force_pad );
|
1346 |
+
|
1347 |
+
return $string . $pad;
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
|
1351 |
+
public static function format_content( $content, $widget_number, $atts ) {
|
1352 |
+
if ( empty ( $content ) )
|
1353 |
+
return $content;
|
1354 |
+
|
1355 |
+
$keep_whitespace = $atts['keep_whitespace'];
|
1356 |
+
$do_shortcode = $atts['do_shortcode'];
|
1357 |
+
|
1358 |
+
// wrap our own quote class around the content before any formatting
|
1359 |
+
// happens
|
1360 |
+
|
1361 |
+
$temp_content = self::$tag_open_quote;
|
1362 |
+
$temp_content .= $content;
|
1363 |
+
$temp_content .= self::$tag_close_quote;
|
1364 |
+
|
1365 |
+
$content = $temp_content;
|
1366 |
+
$content = trim( $content );
|
1367 |
+
$content = wptexturize( $content );
|
1368 |
+
$content = convert_smilies( $content );
|
1369 |
+
$content = convert_chars( $content );
|
1370 |
+
|
1371 |
+
if ( is_null( $widget_number ) || $keep_whitespace )
|
1372 |
+
$content = wpautop( $content );
|
1373 |
+
|
1374 |
+
$content = shortcode_unautop( $content );
|
1375 |
+
|
1376 |
+
if ( $do_shortcode )
|
1377 |
+
$content = do_shortcode( $content );
|
1378 |
+
else
|
1379 |
+
$content = strip_shortcodes( $content );
|
1380 |
+
|
1381 |
+
$content = str_replace( ']]>', ']]>', $content );
|
1382 |
+
$content = trim( $content );
|
1383 |
+
|
1384 |
+
return $content;
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
|
1388 |
+
public static function get_testimonials_paging( $atts, $prepend = true ) {
|
1389 |
+
$html = '';
|
1390 |
+
|
1391 |
+
if ( is_home() || 1 === self::$max_num_pages )
|
1392 |
+
return $html;
|
1393 |
+
|
1394 |
+
$html .= '<div class="paging';
|
1395 |
+
|
1396 |
+
if ( $prepend )
|
1397 |
+
$html .= ' prepend';
|
1398 |
+
else
|
1399 |
+
$html .= ' append';
|
1400 |
+
|
1401 |
+
$html .= '">';
|
1402 |
+
$html .= "\n";
|
1403 |
+
|
1404 |
+
if ( $atts['paged'] )
|
1405 |
+
$paged = $atts['paged'];
|
1406 |
+
else
|
1407 |
+
$paged = 1;
|
1408 |
+
|
1409 |
+
if ( ! function_exists( 'wp_pagenavi' ) ) {
|
1410 |
+
$html .= '<div class="alignleft">';
|
1411 |
+
|
1412 |
+
if ( 1 < $paged ) {
|
1413 |
+
$laquo = apply_filters( 'testimonials_widget_previous_posts_link_text', esc_html__( '«', 'testimonials-widget' ) );
|
1414 |
+
$html .= get_previous_posts_link( $laquo, $paged );
|
1415 |
+
}
|
1416 |
+
|
1417 |
+
$html .= '</div>';
|
1418 |
+
$html .= "\n";
|
1419 |
+
$html .= '<div class="alignright">';
|
1420 |
+
if ( $paged != self::$max_num_pages ) {
|
1421 |
+
$raquo = apply_filters( 'testimonials_widget_next_posts_link_text', esc_html__( '»', 'testimonials-widget' ) );
|
1422 |
+
$html .= get_next_posts_link( $raquo, self::$max_num_pages );
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
$html .= '</div>';
|
1426 |
+
$html .= "\n";
|
1427 |
+
} else {
|
1428 |
+
$args = array(
|
1429 |
+
'echo' => false,
|
1430 |
+
'query' => self::$wp_query,
|
1431 |
+
);
|
1432 |
+
$args = apply_filters( 'testimonials_widget_wp_pagenavi', $args );
|
1433 |
+
|
1434 |
+
$html .= wp_pagenavi( $args );
|
1435 |
+
$html .= "\n";
|
1436 |
+
}
|
1437 |
+
|
1438 |
+
$html .= '</div>';
|
1439 |
+
$html .= "\n";
|
1440 |
+
|
1441 |
+
return $html;
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
|
1445 |
+
public static function get_testimonials_css() {
|
1446 |
+
if ( empty( self::$css_called ) ) {
|
1447 |
+
foreach ( self::$css as $css )
|
1448 |
+
echo $css;
|
1449 |
+
|
1450 |
+
self::$css_called = true;
|
1451 |
+
}
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
|
1455 |
+
public static function get_testimonials_scripts() {
|
1456 |
+
if ( empty( self::$scripts_called ) ) {
|
1457 |
+
foreach ( self::$scripts as $script )
|
1458 |
+
echo $script;
|
1459 |
+
|
1460 |
+
self::$scripts_called = true;
|
1461 |
+
}
|
1462 |
+
}
|
1463 |
+
|
1464 |
+
|
1465 |
+
/**
|
1466 |
+
*
|
1467 |
+
*
|
1468 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1469 |
+
*/
|
1470 |
+
public static function get_query_args( $atts ) {
|
1471 |
+
extract( $atts );
|
1472 |
+
|
1473 |
+
if ( has_filter( 'posts_orderby', 'CPTOrderPosts' ) )
|
1474 |
+
remove_filter( 'posts_orderby', 'CPTOrderPosts', 99, 2 );
|
1475 |
+
|
1476 |
+
if ( $random ) {
|
1477 |
+
$orderby = 'rand';
|
1478 |
+
$order = false;
|
1479 |
+
}
|
1480 |
+
|
1481 |
+
$args = array(
|
1482 |
+
'orderby' => $orderby,
|
1483 |
+
'post_status' => array(
|
1484 |
+
'publish',
|
1485 |
+
'private',
|
1486 |
+
),
|
1487 |
+
'post_type' => Testimonials_Widget::PT,
|
1488 |
+
'posts_per_page' => $limit,
|
1489 |
+
);
|
1490 |
+
|
1491 |
+
if ( is_single() ) {
|
1492 |
+
$args['post_status'][] = 'pending';
|
1493 |
+
$args['post_status'][] = 'draft';
|
1494 |
+
}
|
1495 |
+
|
1496 |
+
if ( $paging && ! empty( $atts['paged'] ) && is_singular() )
|
1497 |
+
$args['paged'] = $atts['paged'];
|
1498 |
+
|
1499 |
+
if ( ! $random && $meta_key ) {
|
1500 |
+
$args['meta_key'] = $meta_key;
|
1501 |
+
$args['orderby'] = 'meta_value';
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
if ( $order )
|
1505 |
+
$args['order'] = $order;
|
1506 |
+
|
1507 |
+
if ( $ids ) {
|
1508 |
+
$ids = explode( ',', $ids );
|
1509 |
+
|
1510 |
+
$args['post__in'] = $ids;
|
1511 |
+
|
1512 |
+
if ( 'none' == $args['orderby'] )
|
1513 |
+
add_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ), 10, 2 );
|
1514 |
+
}
|
1515 |
+
|
1516 |
+
if ( $exclude ) {
|
1517 |
+
$exclude = explode( ',', $exclude );
|
1518 |
+
$args['post__not_in'] = $exclude;
|
1519 |
+
}
|
1520 |
+
|
1521 |
+
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
1522 |
+
if ( ! $use_cpt_taxonomy ) {
|
1523 |
+
if ( $category )
|
1524 |
+
$args['category_name'] = $category;
|
1525 |
+
|
1526 |
+
if ( $tags ) {
|
1527 |
+
$tags = explode( ',', $tags );
|
1528 |
+
|
1529 |
+
if ( $tags_all )
|
1530 |
+
$args['tag_slug__and'] = $tags;
|
1531 |
+
else
|
1532 |
+
$args['tag_slug__in'] = $tags;
|
1533 |
+
}
|
1534 |
+
} else {
|
1535 |
+
if ( $category )
|
1536 |
+
$args[ self::$cpt_category ] = $category;
|
1537 |
+
|
1538 |
+
if ( $tags ) {
|
1539 |
+
if ( $tags_all ) {
|
1540 |
+
$args[ 'tax_query' ] = array(
|
1541 |
+
'relation' => 'AND',
|
1542 |
+
);
|
1543 |
+
|
1544 |
+
$tags = explode( ',', $tags );
|
1545 |
+
foreach ( $tags as $term ) {
|
1546 |
+
$args[ 'tax_query' ][] = array(
|
1547 |
+
'taxonomy' => self::$cpt_tags,
|
1548 |
+
'terms' => array( $term ),
|
1549 |
+
'field' => 'slug',
|
1550 |
+
);
|
1551 |
+
}
|
1552 |
+
} else {
|
1553 |
+
$args[ self::$cpt_tags ] = $tags;
|
1554 |
+
}
|
1555 |
+
}
|
1556 |
+
}
|
1557 |
+
|
1558 |
+
$args = apply_filters( 'testimonials_widget_query_args', $args, $atts );
|
1559 |
+
|
1560 |
+
return $args;
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
|
1564 |
+
/**
|
1565 |
+
*
|
1566 |
+
*
|
1567 |
+
* @SuppressWarnings(PHPMD.LongVariable)
|
1568 |
+
*/
|
1569 |
+
public static function get_testimonials( $atts ) {
|
1570 |
+
$hide_gravatar = $atts['hide_gravatar'];
|
1571 |
+
|
1572 |
+
$args = self::get_query_args( $atts );
|
1573 |
+
$args['query'] = true;
|
1574 |
+
|
1575 |
+
$testimonials = apply_filters( 'testimonials_widget_cache_get', false, $args );
|
1576 |
+
if ( false === $testimonials ) {
|
1577 |
+
$testimonials = new WP_Query( $args );
|
1578 |
+
$testimonials = apply_filters( 'testimonials_widget_cache_set', $testimonials, $args );
|
1579 |
+
}
|
1580 |
+
|
1581 |
+
if ( has_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ) ) )
|
1582 |
+
remove_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ) );
|
1583 |
+
|
1584 |
+
self::$max_num_pages = $testimonials->max_num_pages;
|
1585 |
+
self::$found_posts = $testimonials->found_posts;
|
1586 |
+
self::$post_count = $testimonials->post_count;
|
1587 |
+
self::$wp_query = $testimonials;
|
1588 |
+
|
1589 |
+
wp_reset_postdata();
|
1590 |
+
|
1591 |
+
$image_size = apply_filters( 'testimonials_widget_image_size', 'thumbnail' );
|
1592 |
+
if ( ! is_array( $image_size ) ) {
|
1593 |
+
global $_wp_additional_image_sizes;
|
1594 |
+
if ( ! empty( $_wp_additional_image_sizes[ $image_size ] ) )
|
1595 |
+
$gravatar_size = $_wp_additional_image_sizes[ $image_size ]['width'];
|
1596 |
+
else
|
1597 |
+
$gravatar_size = get_option( $image_size . '_size_w' );
|
1598 |
+
|
1599 |
+
$gravatar_size = apply_filters( 'testimonials_widget_gravatar_size', $gravatar_size );
|
1600 |
+
} else
|
1601 |
+
$gravatar_size = apply_filters( 'testimonials_widget_gravatar_size', $image_size );
|
1602 |
+
|
1603 |
+
$testimonial_data = array();
|
1604 |
+
|
1605 |
+
if ( empty( self::$post_count ) )
|
1606 |
+
return $testimonial_data;
|
1607 |
+
|
1608 |
+
foreach ( $testimonials->posts as $row ) {
|
1609 |
+
$post_id = $row->ID;
|
1610 |
+
$email = get_post_meta( $post_id, 'testimonials-widget-email', true );
|
1611 |
+
|
1612 |
+
if ( has_post_thumbnail( $post_id ) ) {
|
1613 |
+
$image = get_the_post_thumbnail( $post_id, $image_size );
|
1614 |
+
} elseif ( ! $hide_gravatar && is_email( $email ) ) {
|
1615 |
+
$image = get_avatar( $email, $gravatar_size );
|
1616 |
+
|
1617 |
+
self::make_gravatar_featured( $post_id, $email );
|
1618 |
+
} else {
|
1619 |
+
$image = false;
|
1620 |
+
}
|
1621 |
+
|
1622 |
+
$image = self::strip_protocol( $image );
|
1623 |
+
|
1624 |
+
$url = get_post_meta( $post_id, 'testimonials-widget-url', true );
|
1625 |
+
if ( ! empty( $url ) && 0 === preg_match( '#https?://#', $url ) )
|
1626 |
+
$url = 'http://' . $url;
|
1627 |
+
|
1628 |
+
$data = array(
|
1629 |
+
'post_id' => $post_id,
|
1630 |
+
'testimonial_company' => get_post_meta( $post_id, 'testimonials-widget-company', true ),
|
1631 |
+
'testimonial_content' => $row->post_content,
|
1632 |
+
'testimonial_email' => $email,
|
1633 |
+
'testimonial_extra' => '',
|
1634 |
+
'testimonial_image' => $image,
|
1635 |
+
'testimonial_location' => get_post_meta( $post_id, 'testimonials-widget-location', true ),
|
1636 |
+
'testimonial_source' => $row->post_title,
|
1637 |
+
'testimonial_title' => get_post_meta( $post_id, 'testimonials-widget-title', true ),
|
1638 |
+
'testimonial_url' => $url,
|
1639 |
+
);
|
1640 |
+
|
1641 |
+
$testimonial_data[] = $data;
|
1642 |
+
}
|
1643 |
+
|
1644 |
+
$testimonial_data = apply_filters( 'testimonials_widget_data', $testimonial_data, $atts );
|
1645 |
+
|
1646 |
+
return $testimonial_data;
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
|
1650 |
+
public static function posts_results_sort_none( $posts, $query ) {
|
1651 |
+
$order = $query->query_vars['post__in'];
|
1652 |
+
if ( empty( $order ) )
|
1653 |
+
return $posts;
|
1654 |
+
|
1655 |
+
$posts_none_sorted = array();
|
1656 |
+
// put posts in same orders as post__in
|
1657 |
+
foreach ( $order as $id ) {
|
1658 |
+
foreach ( $posts as $key => $post ) {
|
1659 |
+
if ( $id == $post->ID ) {
|
1660 |
+
$posts_none_sorted[] = $post;
|
1661 |
+
unset( $posts[$key] );
|
1662 |
+
}
|
1663 |
+
}
|
1664 |
+
}
|
1665 |
+
|
1666 |
+
return $posts_none_sorted;
|
1667 |
+
}
|
1668 |
+
|
1669 |
+
|
1670 |
+
public static function widgets_init() {
|
1671 |
+
register_widget( 'Testimonials_Widget_Widget' );
|
1672 |
+
}
|
1673 |
+
|
1674 |
+
|
1675 |
+
/**
|
1676 |
+
*
|
1677 |
+
*
|
1678 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1679 |
+
*/
|
1680 |
+
public static function add_meta_box_testimonials_widget() {
|
1681 |
+
$fields = array(
|
1682 |
+
array(
|
1683 |
+
'name' => esc_html__( 'Job Title', 'testimonials-widget' ),
|
1684 |
+
'id' => 'testimonials-widget-title',
|
1685 |
+
'type' => 'text',
|
1686 |
+
'desc' => '',
|
1687 |
+
),
|
1688 |
+
array(
|
1689 |
+
'name' => esc_html__( 'Location', 'testimonials-widget' ),
|
1690 |
+
'id' => 'testimonials-widget-location',
|
1691 |
+
'type' => 'text',
|
1692 |
+
'desc' => '',
|
1693 |
+
),
|
1694 |
+
array(
|
1695 |
+
'name' => esc_html__( 'Email', 'testimonials-widget' ),
|
1696 |
+
'id' => 'testimonials-widget-email',
|
1697 |
+
'type' => 'text',
|
1698 |
+
'desc' => '',
|
1699 |
+
),
|
1700 |
+
array(
|
1701 |
+
'name' => esc_html__( 'Company', 'testimonials-widget' ),
|
1702 |
+
'id' => 'testimonials-widget-company',
|
1703 |
+
'type' => 'text',
|
1704 |
+
'desc' => '',
|
1705 |
+
),
|
1706 |
+
array(
|
1707 |
+
'name' => esc_html__( 'URL', 'testimonials-widget' ),
|
1708 |
+
'id' => 'testimonials-widget-url',
|
1709 |
+
'type' => 'text',
|
1710 |
+
'desc' => '',
|
1711 |
+
),
|
1712 |
+
);
|
1713 |
+
|
1714 |
+
$fields = apply_filters( 'testimonials_widget_meta_box', $fields );
|
1715 |
+
|
1716 |
+
$meta_box = redrokk_metabox_class::getInstance(
|
1717 |
+
self::ID,
|
1718 |
+
array(
|
1719 |
+
'title' => esc_html__( 'Testimonial Data', 'testimonials-widget' ),
|
1720 |
+
'description' => '',
|
1721 |
+
'_object_types' => 'testimonials-widget',
|
1722 |
+
'priority' => 'high',
|
1723 |
+
'_fields' => $fields,
|
1724 |
+
)
|
1725 |
+
);
|
1726 |
+
}
|
1727 |
+
|
1728 |
+
|
1729 |
+
/**
|
1730 |
+
* Revise default new testimonial text
|
1731 |
+
*
|
1732 |
+
* Original author: Travis Ballard http://www.travisballard.com
|
1733 |
+
*
|
1734 |
+
* @param string $translation
|
1735 |
+
* @return string $translation
|
1736 |
+
*/
|
1737 |
+
public static function gettext_testimonials( $translation ) {
|
1738 |
+
remove_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
1739 |
+
|
1740 |
+
global $post;
|
1741 |
+
|
1742 |
+
if ( is_object( $post ) && self::PT == $post->post_type ) {
|
1743 |
+
switch ( $translation ) {
|
1744 |
+
case esc_html__( 'Enter title here', 'testimonials-widget' ):
|
1745 |
+
return esc_html__( 'Enter testimonial source here', 'testimonials-widget' );
|
1746 |
+
break;
|
1747 |
+
}
|
1748 |
+
}
|
1749 |
+
|
1750 |
+
add_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
1751 |
+
|
1752 |
+
return $translation;
|
1753 |
+
}
|
1754 |
+
|
1755 |
+
|
1756 |
+
/**
|
1757 |
+
* Update messages for custom post type
|
1758 |
+
*
|
1759 |
+
* Original author: Travis Ballard http://www.travisballard.com
|
1760 |
+
*
|
1761 |
+
* @SuppressWarnings(PHPMD.Superglobals)
|
1762 |
+
* @param mixed $m
|
1763 |
+
* @return mixed $m
|
1764 |
+
*/
|
1765 |
+
public static function post_updated_messages( $m ) {
|
1766 |
+
global $post;
|
1767 |
+
|
1768 |
+
$m[ self::PT ] = array(
|
1769 |
+
0 => '', // Unused. Messages start at index 1.
|
1770 |
+
1 => sprintf( __( 'Testimonial updated. <a href="%s">View testimonial</a>', 'testimonials-widget' ), esc_url( get_permalink( $post->ID ) ) ),
|
1771 |
+
2 => esc_html__( 'Custom field updated.', 'testimonials-widget' ),
|
1772 |
+
3 => esc_html__( 'Custom field deleted.', 'testimonials-widget' ),
|
1773 |
+
4 => esc_html__( 'Testimonial updated.', 'testimonials-widget' ),
|
1774 |
+
/* translators: %s: date and time of the revision */
|
1775 |
+
5 => isset( $_GET['revision'] ) ? sprintf( esc_html__( 'Testimonial restored to revision from %s', 'testimonials-widget' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
1776 |
+
6 => sprintf( __( 'Testimonial published. <a href="%s">View testimonial</a>', 'testimonials-widget' ), esc_url( get_permalink( $post->ID ) ) ),
|
1777 |
+
7 => esc_html__( 'Testimonial saved.', 'testimonials-widget' ),
|
1778 |
+
8 => sprintf( __( 'Testimonial submitted. <a target="_blank" href="%s">Preview testimonial</a>', 'testimonials-widget' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
|
1779 |
+
9 => sprintf( __( 'Testimonial scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview testimonial</a>', 'testimonials-widget' ), date_i18n( 'M j, Y @ G:i', strtotime( $post->post_date ) ), esc_url( get_permalink( $post->ID ) ) ),
|
1780 |
+
10 => sprintf( __( 'Testimonial draft updated. <a target="_blank" href="%s">Preview testimonial</a>', 'testimonials-widget' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) )
|
1781 |
+
);
|
1782 |
+
|
1783 |
+
return $m;
|
1784 |
+
}
|
1785 |
+
|
1786 |
+
|
1787 |
+
public static function right_now_content_table_end() {
|
1788 |
+
$content = '
|
1789 |
+
<tr>
|
1790 |
+
<td class="first b b-%1$s">%4$s%2$s%5$s</td>
|
1791 |
+
<td class="t %1$s">%4$s%3$s%5$s</td>
|
1792 |
+
</tr>';
|
1793 |
+
$posts = wp_count_posts( Testimonials_Widget::PT );
|
1794 |
+
$count = $posts->publish;
|
1795 |
+
$name = _n( 'Testimonial', 'Testimonials', $count, 'testimonials-widget' );
|
1796 |
+
$count_f = number_format_i18n( $count );
|
1797 |
+
$a_open = '<a href="edit.php?post_type=' . Testimonials_Widget::PT . '">';
|
1798 |
+
$a_close = '</a>';
|
1799 |
+
|
1800 |
+
if ( current_user_can( 'edit_others_posts' ) )
|
1801 |
+
$result = sprintf( $content, Testimonials_Widget::PT, $count_f, $name, $a_open, $a_close );
|
1802 |
+
else
|
1803 |
+
$result = sprintf( $content, Testimonials_Widget::PT, $count_f, $name, '', '' );
|
1804 |
+
|
1805 |
+
echo $result;
|
1806 |
+
}
|
1807 |
+
|
1808 |
+
|
1809 |
+
/**
|
1810 |
+
*
|
1811 |
+
*
|
1812 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1813 |
+
*/
|
1814 |
+
public static function get_schema( $testimonial, $atts ) {
|
1815 |
+
foreach ( $testimonial as $key => $value ) {
|
1816 |
+
if ( 'testimonial_image' != $key )
|
1817 |
+
$testimonial[ $key ] = self::clean_string( $value );
|
1818 |
+
}
|
1819 |
+
|
1820 |
+
extract( $testimonial );
|
1821 |
+
|
1822 |
+
$do_company = ! $atts['hide_company'] && ! empty( $testimonial_company );
|
1823 |
+
$do_content = ! empty( $testimonial['testimonial_content'] );
|
1824 |
+
$do_email = ! $atts['hide_email'] && ! empty( $testimonial_email ) && is_email( $testimonial_email );
|
1825 |
+
$do_image = ! $atts['hide_image'] && ! empty( $testimonial_image );
|
1826 |
+
$do_location = ! $atts['hide_location'] && ! empty( $testimonial_location );
|
1827 |
+
$do_source = ! $atts['hide_source'] && ! empty( $testimonial_source );
|
1828 |
+
$do_title = ! $atts['hide_title'] && ! empty( $testimonial_title );
|
1829 |
+
$do_url = ! $atts['hide_url'] && ! empty( $testimonial_url );
|
1830 |
+
|
1831 |
+
$item_reviewed = self::clean_string( $atts['item_reviewed'] );
|
1832 |
+
$item_reviewed_url = self::clean_string( $atts['item_reviewed_url'] );
|
1833 |
+
|
1834 |
+
$schema = '<div style="display: none;">';
|
1835 |
+
$schema .= "\n";
|
1836 |
+
|
1837 |
+
$agg_meta = array();
|
1838 |
+
$author_meta = array();
|
1839 |
+
$item_meta = array();
|
1840 |
+
$location_meta = array();
|
1841 |
+
$org_meta = array();
|
1842 |
+
$review_meta = array();
|
1843 |
+
|
1844 |
+
if ( $do_source )
|
1845 |
+
$author_meta[ self::$thing_name ] = $testimonial_source;
|
1846 |
+
|
1847 |
+
if ( $do_title )
|
1848 |
+
$author_meta[ self::$person_job_title ] = $testimonial_title;
|
1849 |
+
|
1850 |
+
if ( $do_email )
|
1851 |
+
$author_meta[ self::$person_email ] = $testimonial_email;
|
1852 |
+
|
1853 |
+
if ( ! $do_company ) {
|
1854 |
+
if ( $do_url )
|
1855 |
+
$author_meta[ self::$thing_url ] = $testimonial_url;
|
1856 |
+
} else {
|
1857 |
+
if ( $do_url )
|
1858 |
+
$org_meta[ self::$thing_url ] = $testimonial_url;
|
1859 |
+
|
1860 |
+
$org_meta[ self::$thing_name ] = $testimonial_company;
|
1861 |
+
}
|
1862 |
+
|
1863 |
+
if ( $do_location ) {
|
1864 |
+
$location_meta[ self::$thing_name ] = $testimonial_location;
|
1865 |
+
|
1866 |
+
if ( ! $do_company )
|
1867 |
+
$author_meta[ self::$person_home ] = array( self::$place_schema, $location_meta );
|
1868 |
+
else
|
1869 |
+
$org_meta[ self::$org_location ] = array( self::$place_schema, $location_meta );
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
if ( ! empty( $author_meta ) && ! empty( $org_meta ) )
|
1873 |
+
$author_meta[ self::$person_member ] = array( self::$org_schema, $org_meta );
|
1874 |
+
elseif ( ! empty( $org_meta ) )
|
1875 |
+
$author_meta[ self::$cw_source_org ] = array( self::$org_schema, $org_meta );
|
1876 |
+
|
1877 |
+
$author_meta = apply_filters( 'testimonials_widget_schema_author', $author_meta, $testimonial, $atts );
|
1878 |
+
$author = self::create_schema_div_prop( self::$cw_author, self::$person_schema, $author_meta );
|
1879 |
+
$schema .= $author;
|
1880 |
+
$schema .= "\n";
|
1881 |
+
|
1882 |
+
$post = get_post( $testimonial['post_id'] );
|
1883 |
+
$the_date = mysql2date( 'Y-m-d', $post->post_date );
|
1884 |
+
$the_date_mod = mysql2date( 'Y-m-d', $post->post_modified );
|
1885 |
+
|
1886 |
+
$review_name_length = apply_filters( 'testimonials_widget_review_name_length', 156 );
|
1887 |
+
|
1888 |
+
if ( $do_content )
|
1889 |
+
$review_meta[ self::$review_body ] = $testimonial['testimonial_content'];
|
1890 |
+
|
1891 |
+
$review_meta[ self::$cw_date ] = $the_date;
|
1892 |
+
$review_meta[ self::$cw_date_mod ] = $the_date_mod;
|
1893 |
+
$review_meta[ self::$thing_name ] = self::testimonials_truncate( $testimonial_content, $review_name_length );
|
1894 |
+
$review_meta[ self::$thing_url ] = post_permalink( $post->ID );
|
1895 |
+
|
1896 |
+
if ( $do_image ) {
|
1897 |
+
$src = self::get_image_src( $testimonial_image );
|
1898 |
+
|
1899 |
+
$review_meta[ self::$thing_image ] = $src;
|
1900 |
+
}
|
1901 |
+
|
1902 |
+
$review_meta = apply_filters( 'testimonials_widget_schema_review', $review_meta, $testimonial, $atts );
|
1903 |
+
$review = self::create_schema_meta( $review_meta );
|
1904 |
+
$schema .= $review;
|
1905 |
+
$schema .= "\n";
|
1906 |
+
|
1907 |
+
$agg_meta[ self::$agg_count ] = self::$found_posts;
|
1908 |
+
|
1909 |
+
$agg_meta = apply_filters( 'testimonials_widget_schema_aggregate', $agg_meta, $testimonial, $atts );
|
1910 |
+
$aggregate = self::create_schema_div_prop( self::$cw_aggregate, self::$agg_schema, $agg_meta );
|
1911 |
+
$schema .= $aggregate;
|
1912 |
+
$schema .= "\n";
|
1913 |
+
|
1914 |
+
$item_meta[ self::$thing_name ] = $item_reviewed;
|
1915 |
+
$item_meta[ self::$thing_url ] = $item_reviewed_url;
|
1916 |
+
|
1917 |
+
$item_meta = apply_filters( 'testimonials_widget_schema_item', $item_meta, $testimonial, $atts );
|
1918 |
+
$item = self::create_schema_div_prop( self::$review_item, self::$thing_schema, $item_meta );
|
1919 |
+
$schema .= $item;
|
1920 |
+
$schema .= "\n";
|
1921 |
+
|
1922 |
+
$schema .= '</div>';
|
1923 |
+
$schema .= "\n";
|
1924 |
+
|
1925 |
+
$schema = apply_filters( 'testimonials_widget_schema', $schema, $testimonial, $atts );
|
1926 |
+
|
1927 |
+
return $schema;
|
1928 |
+
}
|
1929 |
+
|
1930 |
+
|
1931 |
+
public static function create_schema_meta( $meta_data ) {
|
1932 |
+
$meta = '';
|
1933 |
+
|
1934 |
+
if ( empty( $meta_data ) )
|
1935 |
+
return $meta;
|
1936 |
+
|
1937 |
+
foreach ( $meta_data as $key => $value ) {
|
1938 |
+
if ( is_array( $value ) )
|
1939 |
+
$meta .= self::create_schema_div_prop( $key, $value[ 0 ], $value[ 1 ] );
|
1940 |
+
else
|
1941 |
+
$meta .= sprintf( self::$schema_meta, $key, $value );
|
1942 |
+
|
1943 |
+
$meta .= "\n";
|
1944 |
+
}
|
1945 |
+
|
1946 |
+
return $meta;
|
1947 |
+
}
|
1948 |
+
|
1949 |
+
|
1950 |
+
public static function create_schema_span( $property_name, $span_data ) {
|
1951 |
+
$span = '';
|
1952 |
+
|
1953 |
+
if ( empty( $span_data ) )
|
1954 |
+
return $span;
|
1955 |
+
|
1956 |
+
$span = sprintf( self::$schema_span, $property_name, $span_data );
|
1957 |
+
|
1958 |
+
return $span;
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
|
1962 |
+
public static function create_schema_div_prop( $property_name, $schema_name, $meta_data ) {
|
1963 |
+
$meta = '';
|
1964 |
+
$schema = '';
|
1965 |
+
|
1966 |
+
if ( empty( $meta_data ) )
|
1967 |
+
return $schema;
|
1968 |
+
|
1969 |
+
if ( is_array( $meta_data ) ) {
|
1970 |
+
foreach ( $meta_data as $key => $value ) {
|
1971 |
+
if ( is_array( $value ) )
|
1972 |
+
$meta .= self::create_schema_div_prop( $key, $value[ 0 ], $value[ 1 ] );
|
1973 |
+
else
|
1974 |
+
$meta .= sprintf( self::$schema_meta, $key, $value );
|
1975 |
+
|
1976 |
+
$meta .= "\n";
|
1977 |
+
}
|
1978 |
+
|
1979 |
+
$schema = sprintf( self::$schema_div_prop, $property_name, $schema_name, $meta );
|
1980 |
+
} else
|
1981 |
+
$schema = sprintf( self::$schema_div_prop, $property_name, $schema_name, $meta_data );
|
1982 |
+
|
1983 |
+
return $schema;
|
1984 |
+
}
|
1985 |
+
|
1986 |
+
|
1987 |
+
public static function generate_css( $atts, $widget_number = null ) {
|
1988 |
+
$atts['subtype'] = 'css';
|
1989 |
+
|
1990 |
+
$css = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
1991 |
+
if ( false === $css ) {
|
1992 |
+
$css = self::get_testimonials_html_css( $atts, $widget_number );
|
1993 |
+
$css = apply_filters( 'testimonials_widget_cache_set', $css, $atts );
|
1994 |
+
}
|
1995 |
+
|
1996 |
+
if ( ! empty( $css ) ) {
|
1997 |
+
self::$css = array_merge( $css, self::$css );
|
1998 |
+
add_action( 'wp_footer', array( 'Testimonials_Widget', 'get_testimonials_css' ), 20 );
|
1999 |
+
}
|
2000 |
+
}
|
2001 |
+
|
2002 |
+
|
2003 |
+
public static function generate_js( $testimonials, $atts, $widget_number = null ) {
|
2004 |
+
$atts['subtype'] = 'js';
|
2005 |
+
|
2006 |
+
$js = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
2007 |
+
if ( false === $js ) {
|
2008 |
+
$js = self::get_testimonials_html_js( $testimonials, $atts, $widget_number );
|
2009 |
+
$js = apply_filters( 'testimonials_widget_cache_set', $js, $atts );
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
if ( ! empty( $js ) ) {
|
2013 |
+
self::$scripts = array_merge( $js, self::$scripts );
|
2014 |
+
add_action( 'wp_footer', array( 'Testimonials_Widget', 'get_testimonials_scripts' ), 20 );
|
2015 |
+
}
|
2016 |
+
}
|
2017 |
+
|
2018 |
+
|
2019 |
+
public static function call_scripts_styles( $testimonials, $atts, $widget_number = null ) {
|
2020 |
+
if ( is_null( $widget_number ) )
|
2021 |
+
$widget_number = Testimonials_Widget::get_instance();
|
2022 |
+
|
2023 |
+
self::scripts( $atts );
|
2024 |
+
|
2025 |
+
self::generate_css( $atts );
|
2026 |
+
self::generate_js( $testimonials, $atts, $widget_number );
|
2027 |
+
}
|
2028 |
+
|
2029 |
+
|
2030 |
+
public static function make_gravatar_featured( $post_id, $email ) {
|
2031 |
+
$size = get_option( 'large_size_w' );
|
2032 |
+
$image = get_avatar( $email, $size );
|
2033 |
+
$src = self::get_image_src( $image, false );
|
2034 |
+
$file = sanitize_title( $email ) . '.jpeg';
|
2035 |
+
|
2036 |
+
self::add_media( $post_id, $src, $file );
|
2037 |
+
}
|
2038 |
+
|
2039 |
+
|
2040 |
+
public static function notice_2_15_0() {
|
2041 |
+
$text = sprintf( __( 'If your Testimonials display has gone to funky town, please <a href="%s">read the FAQ</a> about possible fixes.', 'testimonials-widget' ), esc_url( 'https://aihrus.zendesk.com/entries/28402246-Major-Change-for-2-15-0' ) );
|
2042 |
+
|
2043 |
+
aihr_notice_updated( $text );
|
2044 |
+
}
|
2045 |
+
|
2046 |
+
|
2047 |
+
public static function show_shortcodes() {
|
2048 |
+
echo '<div class="wrap">';
|
2049 |
+
echo '<div class="icon32" id="icon-options-general"></div>';
|
2050 |
+
echo '<h2>' . esc_html__( 'Testimonials Shortcode Examples', 'testimonials-widget' ) . '</h2>';
|
2051 |
+
|
2052 |
+
$shortcodes = <<<EOD
|
2053 |
+
<h3>[testimonials]</h3>
|
2054 |
+
|
2055 |
+
<ul>
|
2056 |
+
<li><code>[testimonials category="category-name"]</code> - Testimonial list by category</li>
|
2057 |
+
<li><code>[testimonials category=product hide_not_found=true]</code> - Testimonial list by category and hide "No testimonials found" message</li>
|
2058 |
+
<li><code>[testimonials category=product tags=widget limit=5]</code> - Testimonial list by tag, showing 5 at most</li>
|
2059 |
+
<li><code>[testimonials char_limit=0 limit=-1]</code> - Show all testimonials on one page</li>
|
2060 |
+
<li><code>[testimonials char_limit=0 target=_new limit=3 disable_quotes=true]</code> - Show 3 full-length testimonials, with opening and closing quote marks removed</li>
|
2061 |
+
<li><code>[testimonials hide_source=true hide_url=true]</code> - Show testimonial list with source and urls hidden</li>
|
2062 |
+
<li><code>[testimonials ids="1,11,111" paging=false]</code> - Show only these 3 testimonials</li>
|
2063 |
+
<li><code>[testimonials meta_key=testimonials-widget-company order=asc limit=15]</code> - Show 15 testimonials, in company order</li>
|
2064 |
+
<li><code>[testimonials order=ASC orderby=title]</code> - List testimonials by post title</li>
|
2065 |
+
<li><code>[testimonials tags="test,fun" random=true exclude="2,22,333"]</code> - Select testimonials tagged with either "test" or "fun", in random order, but ignore those of the excluded ids</li>
|
2066 |
+
</ul>
|
2067 |
+
|
2068 |
+
<h3>[testimonials_slider]</h3>
|
2069 |
+
|
2070 |
+
<ul>
|
2071 |
+
<li><code>[testimonials_slider category=product order=asc]</code> - Show rotating testimonials, of the product category, lowest post ids first</li>
|
2072 |
+
<li><code>[testimonials_slider tags=sometag random=true]</code> - Show rotating, random testimonials having tag "sometag"</li>
|
2073 |
+
</ul>
|
2074 |
+
EOD;
|
2075 |
+
|
2076 |
+
$shortcodes = apply_filters( 'testimonials_widget_shortcodes', $shortcodes );
|
2077 |
+
|
2078 |
+
echo $shortcodes;
|
2079 |
+
echo '</div>';
|
2080 |
+
}
|
2081 |
+
|
2082 |
+
|
2083 |
+
public static function set_not_found( $not_found = false ) {
|
2084 |
+
self::$not_found = $not_found;
|
2085 |
+
}
|
2086 |
+
|
2087 |
+
|
2088 |
+
public static function get_not_found() {
|
2089 |
+
return self::$not_found;
|
2090 |
+
}
|
2091 |
+
|
2092 |
+
|
2093 |
+
public static function version_check() {
|
2094 |
+
$valid_version = true;
|
2095 |
+
if ( ! $valid_version ) {
|
2096 |
+
$deactivate_reason = esc_html__( 'Failed version check', 'testimonials-widget' );
|
2097 |
+
aihr_deactivate_plugin( self::BASE, TW_NAME, $deactivate_reason );
|
2098 |
+
self::check_notices();
|
2099 |
+
}
|
2100 |
+
|
2101 |
+
return $valid_version;
|
2102 |
+
}
|
2103 |
+
|
2104 |
+
|
2105 |
+
/**
|
2106 |
+
*
|
2107 |
+
*
|
2108 |
+
* @SuppressWarnings(PHPMD.Superglobals)
|
2109 |
+
*/
|
2110 |
+
public static function do_load() {
|
2111 |
+
$do_load = false;
|
2112 |
+
if ( ! empty( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'options.php' ) ) ) {
|
2113 |
+
$do_load = true;
|
2114 |
+
} elseif ( ! empty( $_REQUEST['post_type'] ) && self::PT == $_REQUEST['post_type'] ) {
|
2115 |
+
if ( ! empty( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'edit.php', 'edit-tags.php' ) ) ) {
|
2116 |
+
$do_load = true;
|
2117 |
+
} elseif ( ! empty( $_REQUEST['page'] ) && Testimonials_Widget_Settings::ID == $_REQUEST['page'] ) {
|
2118 |
+
$do_load = true;
|
2119 |
+
}
|
2120 |
+
}
|
2121 |
+
|
2122 |
+
return $do_load;
|
2123 |
+
}
|
2124 |
+
|
2125 |
+
|
2126 |
+
public static function category_columns( $columns ) {
|
2127 |
+
$columns['shortcode'] = esc_html__( 'Shortcode', 'testimonials-widget' );
|
2128 |
+
|
2129 |
+
return $columns;
|
2130 |
+
}
|
2131 |
+
|
2132 |
+
|
2133 |
+
public static function category_column( $result, $column_name, $term_id, $category = true ) {
|
2134 |
+
$attribute = $category ? 'category' : 'tags';
|
2135 |
+
|
2136 |
+
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
2137 |
+
if ( ! $use_cpt_taxonomy ) {
|
2138 |
+
if ( $category )
|
2139 |
+
$term = get_term( $term_id, 'category' );
|
2140 |
+
else
|
2141 |
+
$term = get_term( $term_id, 'post_tag' );
|
2142 |
+
} else {
|
2143 |
+
if ( $category )
|
2144 |
+
$term = get_term( $term_id, self::$cpt_category );
|
2145 |
+
else
|
2146 |
+
$term = get_term( $term_id, self::$cpt_tags );
|
2147 |
+
}
|
2148 |
+
|
2149 |
+
switch ( $column_name ) {
|
2150 |
+
case 'shortcode':
|
2151 |
+
$result = '[testimonials ' . $attribute . '="' .$term->slug . '"]';
|
2152 |
+
$result .= '<br />';
|
2153 |
+
$result .= '[testimonials_slider ' . $attribute . '="' .$term->slug . '"]';
|
2154 |
+
break;
|
2155 |
+
}
|
2156 |
+
|
2157 |
+
return $result;
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
|
2161 |
+
public static function post_tag_column( $result, $column_name, $term_id ) {
|
2162 |
+
return self::category_column( $result, $column_name, $term_id, false );
|
2163 |
+
}
|
2164 |
+
}
|
2165 |
+
|
2166 |
+
|
2167 |
+
?>
|
includes/libraries/aihrus-framework/CHANGELOG.md
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# CHANGELOG Aihrus Framework
|
2 |
+
|
3 |
+
## master
|
4 |
+
|
5 |
+
## 1.1.0
|
6 |
+
* Abstract deactivate_plugins actual to aihr_deactivate_plugin_do
|
7 |
+
* Add class redrokk_metabox_class
|
8 |
+
* Add class wp_custom_post_status
|
9 |
+
* Add date, time, and datetime types to redrokk_metabox_class
|
10 |
+
* Add rich_editor type
|
11 |
+
* Add validate_email
|
12 |
+
* Consolidate deactivate_plugins activity into aihr_deactivate_plugin
|
13 |
+
* Don't esc_attr rich editor value
|
14 |
+
* Limit wp_custom_post_status to post type
|
15 |
+
* Move classes/interfaces to includes
|
16 |
+
* Register `jquery-style`
|
17 |
+
* Rename requirements.php to aihrus-framework.php
|
18 |
+
* RESOLVE michael-cannon/testimonials-widget#63 Unable to activate premium license
|
19 |
+
* RESOLVE michael-cannon/testimonials-widget#65 Widget blank options aren't saving correctly
|
20 |
+
* RESOLVE michael-cannon/testimonials-widget#76 Undefined index: hide_image_single
|
21 |
+
* RESOLVE redrokk_metabox_class prepare warning
|
22 |
+
* Revise get_styles handling
|
23 |
+
* Set AIHR_DIR* helpers
|
24 |
+
* Set defaults for validators
|
25 |
+
* Set premium license key for 2 years though it expires at 1
|
26 |
+
* Update copyright year
|
27 |
+
|
28 |
+
## 1.0.3
|
29 |
+
* RESOLVE Fatal error: Call to undefined function add_settings_error() in class-aihrus-settings.php on line 559
|
30 |
+
* RESOLVE Featured image via Gravatar not saving correctly
|
31 |
+
* Revise data deletion description - Thank you Mark
|
32 |
+
|
33 |
+
## 1.0.2
|
34 |
+
* Add phpunit.xml
|
35 |
+
* Add `slash_sanitize_title` verification helper
|
36 |
+
* Coding standards
|
37 |
+
* Display "Settings saved."
|
38 |
+
* Move ci to tests
|
39 |
+
* Remove Travis configuration
|
40 |
+
* RESOLVE michael-cannon/testimonials-widget#48 Activation on WP 3.6 not working
|
41 |
+
* RESOLVE michael-cannon/wootheme-testimonials-to-testimonials#2 No settings saved notice upon saving settings
|
42 |
+
* Update usage instructions
|
43 |
+
* Use $plugin_assets than $plugin_path
|
44 |
+
|
45 |
+
## 1.0.1
|
46 |
+
* Add strip_protocol
|
47 |
+
* Add valid_hash check
|
48 |
+
* Move relicensing to plugin level
|
49 |
+
|
50 |
+
## 1.0.0
|
51 |
+
* Enable aihr_check_aihrus_framework
|
52 |
+
|
53 |
+
## 0.0.0
|
54 |
+
* Abstract notice helper methods as functions
|
55 |
+
* Add TODO
|
56 |
+
* Add `add_media` post attachment helper
|
57 |
+
* Add `clean_string` trim, strip_shortcodes, and strip_tags a string
|
58 |
+
* Add `create_link( $link )`
|
59 |
+
* Add `create_nonce( $action )`
|
60 |
+
* Add `file_get_contents_curl`
|
61 |
+
* Add `get_image_src`
|
62 |
+
* Add `is_true`, terms, url validate cases
|
63 |
+
* Add `truncate`
|
64 |
+
* Add `verify_nonce( $nonce, $action )`
|
65 |
+
* Add abstract class Aihrus_Settings
|
66 |
+
* Add abstract class Aihrus_Widget
|
67 |
+
* Add aihr_notice_license
|
68 |
+
* Add name filed to aihr_check_php
|
69 |
+
* Add requirements helper
|
70 |
+
* Add shortcode id helpers
|
71 |
+
* Allow reset_defaults in widget
|
72 |
+
* BUGFIX Method version not static
|
73 |
+
* BUGFIX Widget title is same as link
|
74 |
+
* CLOSES #2 Disable purchase premium links if premium is active
|
75 |
+
* Check for PHP 5.3
|
76 |
+
* Convert TODO to https://github.com/michael-cannon/aihrus-framework/issues
|
77 |
+
* Display option values as is
|
78 |
+
* Encase pronouns in double-quotes
|
79 |
+
* RESOLVES #1 PHP Version checking
|
80 |
+
* RESOLVES #3 Add WordPress version check
|
81 |
+
* Remove unused methods
|
82 |
+
* Rename $options[$id] to $field_value
|
83 |
+
* Rename no_code to show_code
|
84 |
+
* Revise create_link parameters
|
85 |
+
* Settings link with null post_type
|
86 |
+
* Switch from require_once to require file inclusion
|
87 |
+
* Use `aihr_` as function prefix
|
88 |
+
* Widget title uses create_link
|
89 |
+
* static::ITEM_NAME to static::NAME
|
90 |
+
|
91 |
+
## 0.0.0
|
92 |
+
* Initial code release
|
{lib/aihrus → includes/libraries/aihrus-framework}/LICENSE
RENAMED
File without changes
|
{lib/aihrus → includes/libraries/aihrus-framework}/README.md
RENAMED
@@ -20,7 +20,7 @@ A helper library for WordPress plugins by Aihrus.
|
|
20 |
|
21 |
```
|
22 |
git remote add aihrus https://github.com/michael-cannon/aihrus-framework.git
|
23 |
-
git subtree add -P
|
24 |
git commit -a -m "Readd aihrus framework"
|
25 |
git push origin master
|
26 |
```
|
@@ -28,7 +28,7 @@ git push origin master
|
|
28 |
* Link plugin to libary
|
29 |
|
30 |
```
|
31 |
-
require
|
32 |
```
|
33 |
|
34 |
* Extend plugin class to library
|
@@ -40,32 +40,31 @@ class Wordpress_Starter extends Aihrus_Common {
|
|
40 |
* Add class static members
|
41 |
|
42 |
```
|
43 |
-
public static $class;
|
44 |
public static $notice_key;
|
45 |
```
|
46 |
|
47 |
-
* Set notices…
|
48 |
|
49 |
```
|
50 |
…
|
51 |
if ( $bad_version )
|
52 |
-
|
53 |
…
|
54 |
-
|
55 |
-
$
|
56 |
-
$
|
57 |
-
|
58 |
-
$
|
59 |
-
|
60 |
-
|
61 |
-
parent::notice_version( $free_base, $free_name, $free_slug, $free_version, $item_name );
|
62 |
}
|
63 |
```
|
64 |
|
65 |
* Update the external library
|
66 |
|
67 |
```
|
68 |
-
git subtree pull -P
|
69 |
```
|
70 |
|
71 |
* Update the plugin repository
|
20 |
|
21 |
```
|
22 |
git remote add aihrus https://github.com/michael-cannon/aihrus-framework.git
|
23 |
+
git subtree add -P include/libraries/aihrus-framework aihrus master
|
24 |
git commit -a -m "Readd aihrus framework"
|
25 |
git push origin master
|
26 |
```
|
28 |
* Link plugin to libary
|
29 |
|
30 |
```
|
31 |
+
require WPS_DIR_LIB . '/aihrus-framework/class-aihrus-common.php';
|
32 |
```
|
33 |
|
34 |
* Extend plugin class to library
|
40 |
* Add class static members
|
41 |
|
42 |
```
|
43 |
+
public static $class = __CLASS__;
|
44 |
public static $notice_key;
|
45 |
```
|
46 |
|
47 |
+
* Set notices…
|
48 |
|
49 |
```
|
50 |
…
|
51 |
if ( $bad_version )
|
52 |
+
add_action( 'admin_notices', 'wps_notice_aihrus' );
|
53 |
…
|
54 |
+
function wps_notice_aihrus() {
|
55 |
+
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/35689458' );
|
56 |
+
$help_link = sprintf( __( '<a href="%1$s">Update plugins</a>. <a href="%2$s">More information</a>.' ), self_admin_url( 'update-core.php' ), $help_url );
|
57 |
+
|
58 |
+
$text = sprintf( esc_html__( 'Plugin "%1$s" has been deactivated as it requires a current Aihrus Framework. Once corrected, "%1$s" can be activated. %2$s' ), WPS_NAME, $help_link );
|
59 |
+
|
60 |
+
aihr_notice_error( $text );
|
|
|
61 |
}
|
62 |
```
|
63 |
|
64 |
* Update the external library
|
65 |
|
66 |
```
|
67 |
+
git subtree pull -P include/libraries/aihrus-framework aihrus master
|
68 |
```
|
69 |
|
70 |
* Update the plugin repository
|
includes/libraries/aihrus-framework/aihrus-framework.php
ADDED
@@ -0,0 +1,341 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( ! defined( 'AIHR_BASE' ) )
|
20 |
+
define( 'AIHR_BASE', __FILE__ );
|
21 |
+
|
22 |
+
if ( ! defined( 'AIHR_DIR' ) )
|
23 |
+
define( 'AIHR_DIR', plugin_dir_path( __FILE__ ) );
|
24 |
+
|
25 |
+
if ( ! defined( 'AIHR_DIR_INC' ) )
|
26 |
+
define( 'AIHR_DIR_INC', AIHR_DIR . 'includes/' );
|
27 |
+
|
28 |
+
if ( ! defined( 'AIHR_DIR_LIB' ) )
|
29 |
+
define( 'AIHR_DIR_LIB', AIHR_DIR_INC . 'libraries/' );
|
30 |
+
|
31 |
+
if ( ! defined( 'AIHR_VERSION' ) )
|
32 |
+
define( 'AIHR_VERSION', '1.1.0' );
|
33 |
+
|
34 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
35 |
+
|
36 |
+
|
37 |
+
if ( ! function_exists( 'aihr_check_aihrus_framework' ) ) {
|
38 |
+
function aihr_check_aihrus_framework( $file = null, $name = null, $aihr_min = '1.0.0' ) {
|
39 |
+
if ( is_null( $file ) ) {
|
40 |
+
aihr_notice_error( __( '`aihr_check_aihrus_framework` requires $file argument' ) );
|
41 |
+
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
|
45 |
+
if ( ! defined( 'AIHR_VERSION' ) ) {
|
46 |
+
$check_okay = false;
|
47 |
+
} else {
|
48 |
+
$check_okay = version_compare( AIHR_VERSION, $aihr_min, '>=' );
|
49 |
+
}
|
50 |
+
|
51 |
+
$file = plugin_basename( $file );
|
52 |
+
if ( ! $check_okay && __FILE__ != $file ) {
|
53 |
+
if ( ! defined( 'AIHR_VERSION_FILE' ) ) {
|
54 |
+
define( 'AIHR_VERSION_FILE', $file );
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( ! is_null( $name ) && ! defined( 'AIHR_VERSION_NAME' ) ) {
|
58 |
+
define( 'AIHR_VERSION_NAME', $name );
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( ! defined( 'AIHR_VERSION_MIN' ) ) {
|
62 |
+
define( 'AIHR_VERSION_MIN', $aihr_min );
|
63 |
+
}
|
64 |
+
|
65 |
+
add_action( 'admin_notices', 'aihr_notice_aihrus_framework' );
|
66 |
+
}
|
67 |
+
|
68 |
+
return $check_okay;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
if ( ! function_exists( 'aihr_notice_aihrus_framework' ) ) {
|
73 |
+
function aihr_notice_aihrus_framework() {
|
74 |
+
if ( defined( 'AIHR_VERSION_NAME' ) ) {
|
75 |
+
$name = AIHR_VERSION_NAME;
|
76 |
+
} else {
|
77 |
+
$name = basename( dirname( AIHR_VERSION_FILE ) );
|
78 |
+
$name = str_replace( '-', ' ', $name );
|
79 |
+
$name = ucwords( $name );
|
80 |
+
}
|
81 |
+
|
82 |
+
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/35689458' );
|
83 |
+
$help_link = sprintf( __( '<a href="%1$s">Update plugins</a>. <a href="%2$s">More information</a>.' ), self_admin_url( 'update-core.php' ), $help_url );
|
84 |
+
|
85 |
+
$note = '';
|
86 |
+
if ( defined( 'AIHR_BASE' ) ) {
|
87 |
+
$plugin = plugin_basename( AIHR_BASE );
|
88 |
+
$plugin = explode( '/', $plugin );
|
89 |
+
|
90 |
+
$plugin_name = $plugin[0];
|
91 |
+
$plugin_name = str_replace( '-', ' ', $plugin_name );
|
92 |
+
$plugin_name = ucwords( $plugin_name );
|
93 |
+
|
94 |
+
$note = sprintf( esc_html__( 'Plugin "%1$s" is causing the out of date issue.' ), $plugin_name );
|
95 |
+
}
|
96 |
+
|
97 |
+
$aihr_version = defined( 'AIHR_VERSION' ) ? AIHR_VERSION : '0.0.0';
|
98 |
+
|
99 |
+
$text = sprintf( esc_html__( 'Plugin "%1$s" has been deactivated as it requires Aihrus Framework %2$s or newer. You\'re running Aihrus Framework %4$s. Once corrected, "%1$s" can be activated. %5$s %3$s' ), $name, AIHR_VERSION_MIN, $help_link, $aihr_version, $note );
|
100 |
+
|
101 |
+
aihr_notice_error( $text );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
if ( ! function_exists( 'aihr_check_php' ) ) {
|
106 |
+
function aihr_check_php( $file = null, $name = null, $php_min = '5.3.0' ) {
|
107 |
+
if ( is_null( $file ) ) {
|
108 |
+
aihr_notice_error( __( '`aihr_check_php` requires $file argument' ) );
|
109 |
+
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
+
$check_okay = version_compare( PHP_VERSION, $php_min, '>=' );
|
114 |
+
$file = plugin_basename( $file );
|
115 |
+
if ( ! $check_okay && __FILE__ != $file ) {
|
116 |
+
if ( ! defined( 'AIHR_PHP_VERSION_FILE' ) ) {
|
117 |
+
define( 'AIHR_PHP_VERSION_FILE', $file );
|
118 |
+
}
|
119 |
+
|
120 |
+
if ( ! is_null( $name ) && ! defined( 'AIHR_PHP_VERSION_NAME' ) ) {
|
121 |
+
define( 'AIHR_PHP_VERSION_NAME', $name );
|
122 |
+
}
|
123 |
+
|
124 |
+
if ( ! defined( 'AIHR_PHP_VERSION_MIN' ) ) {
|
125 |
+
define( 'AIHR_PHP_VERSION_MIN', $php_min );
|
126 |
+
}
|
127 |
+
|
128 |
+
add_action( 'admin_notices', 'aihr_notice_php' );
|
129 |
+
}
|
130 |
+
|
131 |
+
return $check_okay;
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
if ( ! function_exists( 'aihr_notice_php' ) ) {
|
136 |
+
function aihr_notice_php() {
|
137 |
+
if ( defined( 'AIHR_PHP_VERSION_NAME' ) ) {
|
138 |
+
$name = AIHR_PHP_VERSION_NAME;
|
139 |
+
} else {
|
140 |
+
$name = basename( dirname( AIHR_PHP_VERSION_FILE ) );
|
141 |
+
$name = str_replace( '-', ' ', $name );
|
142 |
+
$name = ucwords( $name );
|
143 |
+
}
|
144 |
+
|
145 |
+
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/30678006' );
|
146 |
+
|
147 |
+
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires PHP %2$s or newer. You\'re running PHP %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">More information</a>.' ), $name, AIHR_PHP_VERSION_MIN, $help_url, PHP_VERSION );
|
148 |
+
|
149 |
+
aihr_notice_error( $text );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
if ( ! function_exists( 'aihr_check_wp' ) ) {
|
154 |
+
function aihr_check_wp( $file = null, $name = null, $wp_min = '3.6' ) {
|
155 |
+
if ( is_null( $file ) ) {
|
156 |
+
aihr_notice_error( __( '`aihr_check_wp` requires $file argument' ) );
|
157 |
+
|
158 |
+
return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
global $wp_version;
|
162 |
+
|
163 |
+
$check_okay = version_compare( $wp_version, $wp_min, '>=' );
|
164 |
+
$file = plugin_basename( $file );
|
165 |
+
if ( ! $check_okay && __FILE__ != $file ) {
|
166 |
+
if ( ! defined( 'AIHR_WP_VERSION_FILE' ) ) {
|
167 |
+
define( 'AIHR_WP_VERSION_FILE', $file );
|
168 |
+
}
|
169 |
+
|
170 |
+
if ( ! is_null( $name ) && ! defined( 'AIHR_WP_VERSION_NAME' ) ) {
|
171 |
+
define( 'AIHR_WP_VERSION_NAME', $name );
|
172 |
+
}
|
173 |
+
|
174 |
+
if ( ! defined( 'AIHR_WP_VERSION_MIN' ) ) {
|
175 |
+
define( 'AIHR_WP_VERSION_MIN', $wp_min );
|
176 |
+
}
|
177 |
+
|
178 |
+
add_action( 'admin_notices', 'aihr_notice_wp' );
|
179 |
+
}
|
180 |
+
|
181 |
+
return $check_okay;
|
182 |
+
}
|
183 |
+
}
|
184 |
+
|
185 |
+
if ( ! function_exists( 'aihr_notice_wp' ) ) {
|
186 |
+
function aihr_notice_wp() {
|
187 |
+
global $wp_version;
|
188 |
+
|
189 |
+
if ( defined( 'AIHR_WP_VERSION_NAME' ) ) {
|
190 |
+
$name = AIHR_WP_VERSION_NAME;
|
191 |
+
} else {
|
192 |
+
$name = basename( dirname( AIHR_WP_VERSION_FILE ) );
|
193 |
+
$name = str_replace( '-', ' ', $name );
|
194 |
+
$name = ucwords( $name );
|
195 |
+
}
|
196 |
+
|
197 |
+
$help_url = network_admin_url( 'update-core.php' );
|
198 |
+
|
199 |
+
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires WordPress %2$s or newer. You\'re running WordPress %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">Update WordPress</a>.' ), $name, AIHR_WP_VERSION_MIN, $help_url, $wp_version );
|
200 |
+
|
201 |
+
aihr_notice_error( $text );
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
if ( ! function_exists( 'aihr_notice_error' ) ) {
|
206 |
+
function aihr_notice_error( $text ) {
|
207 |
+
aihr_notice_updated( $text, 'error' );
|
208 |
+
}
|
209 |
+
}
|
210 |
+
|
211 |
+
if ( ! function_exists( 'aihr_notice_updated' ) ) {
|
212 |
+
function aihr_notice_updated( $text, $class = 'updated' ) {
|
213 |
+
if ( 'updated' == $class )
|
214 |
+
$class .= ' fade';
|
215 |
+
|
216 |
+
$content = '';
|
217 |
+
$content .= '<div class="' . $class . '"><p>';
|
218 |
+
$content .= $text;
|
219 |
+
$content .= '</p></div>';
|
220 |
+
|
221 |
+
echo $content;
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
if ( ! function_exists( 'aihr_notice_version' ) ) {
|
226 |
+
function aihr_notice_version( $required_base, $required_name, $required_slug, $required_version, $item_name ) {
|
227 |
+
$is_active = is_plugin_active( $required_base );
|
228 |
+
if ( $is_active )
|
229 |
+
$link = sprintf( __( '<a href="%1$s">update to</a>' ), self_admin_url( 'update-core.php' ) );
|
230 |
+
else {
|
231 |
+
$plugins = get_plugins();
|
232 |
+
if ( empty( $plugins[ $required_base ] ) ) {
|
233 |
+
$install = esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $required_slug ), 'install-plugin_' . $required_slug ) );
|
234 |
+
$link = sprintf( __( '<a href="%1$s">install</a>' ), $install );
|
235 |
+
} else {
|
236 |
+
$activate = esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $required_base ), 'activate-plugin_' . $required_base ) );
|
237 |
+
$link = sprintf( __( '<a href="%1$s">activate</a>' ), $activate );
|
238 |
+
}
|
239 |
+
}
|
240 |
+
|
241 |
+
$text = sprintf( __( 'Plugin "%3$s" has been deactivated. Please %1$s "%4$s" version %2$s or newer before activating "%3$s".' ), $link, $required_version, $item_name, $required_name );
|
242 |
+
|
243 |
+
aihr_notice_error( $text );
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
if ( ! function_exists( 'aihr_notice_license' ) ) {
|
248 |
+
function aihr_notice_license( $post_type, $settings_id, $free_name, $purchase_url, $item_name ) {
|
249 |
+
if ( empty( $post_type ) )
|
250 |
+
$link = get_admin_url() . 'options-general.php?page=' . $settings_id;
|
251 |
+
else
|
252 |
+
$link = get_admin_url() . 'edit.php?post_type=' . $post_type . '&page=' . $settings_id;
|
253 |
+
|
254 |
+
$text = __( '<a href="%1$s">%2$s > Settings</a>, <em>Premium</em> tab, <em>License Key</em> entry' );
|
255 |
+
|
256 |
+
$settings_link = sprintf( $text, $link, $free_name );
|
257 |
+
|
258 |
+
$link = esc_url( 'https://aihrus.zendesk.com/entries/28745227' );
|
259 |
+
$text = __( '<a href="%s">Where\'s my license key?</a>' );
|
260 |
+
|
261 |
+
$faq_link = sprintf( $text, $link );
|
262 |
+
|
263 |
+
$link = esc_url( $purchase_url );
|
264 |
+
$text = __( '<a href="%1$s">%2$s</a>' );
|
265 |
+
|
266 |
+
$buy_link = sprintf( $text, $link, $item_name );
|
267 |
+
|
268 |
+
$text = sprintf( __( 'Plugin "%1$s" requires license activation before updating will work. Please activate the license key through %2$s. No license key? See "%3$s" or purchase "%4$s".' ), $item_name, $settings_link, $faq_link, $buy_link );
|
269 |
+
|
270 |
+
aihr_notice_error( $text );
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
if ( ! function_exists( 'aihr_deactivate_plugin' ) ) {
|
275 |
+
function aihr_deactivate_plugin( $file = null, $name = null, $reason = '' ) {
|
276 |
+
error_log( print_r( debug_backtrace(), true ) );
|
277 |
+
|
278 |
+
if ( is_null( $file ) ) {
|
279 |
+
aihr_notice_error( __( '`aihr_deactivate_plugin` requires $file argument' ) );
|
280 |
+
|
281 |
+
return false;
|
282 |
+
}
|
283 |
+
|
284 |
+
if ( is_null( $name ) && empty( $reason ) ) {
|
285 |
+
aihr_deactivate_plugin_do( $file );
|
286 |
+
return false;
|
287 |
+
}
|
288 |
+
|
289 |
+
if ( ! defined( 'AIHR_DEACTIVATE_REASON' ) ) {
|
290 |
+
define( 'AIHR_DEACTIVATE_REASON', $reason );
|
291 |
+
}
|
292 |
+
|
293 |
+
if ( ! defined( 'AIHR_DEACTIVATE_FILE' ) ) {
|
294 |
+
define( 'AIHR_DEACTIVATE_FILE', $file );
|
295 |
+
}
|
296 |
+
|
297 |
+
if ( ! is_null( $name ) && ! defined( 'AIHR_DEACTIVATE_NAME' ) ) {
|
298 |
+
define( 'AIHR_DEACTIVATE_NAME', $name );
|
299 |
+
}
|
300 |
+
|
301 |
+
add_action( 'admin_notices', 'aihr_notice_deactivate' );
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
if ( ! function_exists( 'aihr_notice_deactivate' ) ) {
|
306 |
+
function aihr_notice_deactivate() {
|
307 |
+
if ( defined( 'AIHR_DEACTIVATE_NAME' ) ) {
|
308 |
+
$name = AIHR_DEACTIVATE_NAME;
|
309 |
+
} else {
|
310 |
+
$name = basename( dirname( AIHR_DEACTIVATE_FILE ) );
|
311 |
+
$name = str_replace( '-', ' ', $name );
|
312 |
+
$name = ucwords( $name );
|
313 |
+
}
|
314 |
+
|
315 |
+
if ( defined( 'AIHR_DEACTIVATE_REASON' ) ) {
|
316 |
+
$reason = AIHR_DEACTIVATE_REASON;
|
317 |
+
} else {
|
318 |
+
$reason = esc_html__( 'Unknown' );
|
319 |
+
}
|
320 |
+
|
321 |
+
$text = sprintf( __( 'Plugin "%1$s" has been deactivated due to "%2$s". Once corrected, "%1$s" can be activated.' ), $name, $reason );
|
322 |
+
|
323 |
+
aihr_notice_error( $text );
|
324 |
+
|
325 |
+
aihr_deactivate_plugin_do( AIHR_DEACTIVATE_FILE );
|
326 |
+
}
|
327 |
+
}
|
328 |
+
|
329 |
+
if ( ! function_exists( 'aihr_deactivate_plugin_do' ) ) {
|
330 |
+
function aihr_deactivate_plugin_do( $file = null ) {
|
331 |
+
if ( is_null( $file ) ) {
|
332 |
+
aihr_notice_error( __( '`aihr_deactivate_plugin_do` requires $file argument' ) );
|
333 |
+
|
334 |
+
return false;
|
335 |
+
}
|
336 |
+
|
337 |
+
deactivate_plugins( $file );
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
?>
|
{lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-common.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -153,7 +153,7 @@ EOD;
|
|
153 |
if ( $disable_donate )
|
154 |
return;
|
155 |
|
156 |
-
$text = sprintf( esc_html__( 'Please donate $5 towards ongoing free support and development of the "%1$s" plugin. %2$s'
|
157 |
|
158 |
aihr_notice_updated( $text );
|
159 |
}
|
@@ -308,12 +308,14 @@ EOD;
|
|
308 |
}
|
309 |
|
310 |
|
311 |
-
public static function get_image_src( $image ) {
|
312 |
$doc = new DOMDocument();
|
313 |
$doc->loadHTML( $image );
|
314 |
$xpath = new DOMXPath( $doc );
|
315 |
$src = $xpath->evaluate( 'string(//img/@src)' );
|
316 |
-
|
|
|
|
|
317 |
|
318 |
return $src;
|
319 |
}
|
@@ -446,11 +448,11 @@ EOD;
|
|
446 |
|
447 |
|
448 |
public static function strip_protocol( $link ) {
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
|
453 |
-
|
454 |
}
|
455 |
|
456 |
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
153 |
if ( $disable_donate )
|
154 |
return;
|
155 |
|
156 |
+
$text = sprintf( esc_html__( 'Please donate $5 towards ongoing free support and development of the "%1$s" plugin. %2$s' ), $item_name, self::$donate_button );
|
157 |
|
158 |
aihr_notice_updated( $text );
|
159 |
}
|
308 |
}
|
309 |
|
310 |
|
311 |
+
public static function get_image_src( $image, $strip_protocol = true ) {
|
312 |
$doc = new DOMDocument();
|
313 |
$doc->loadHTML( $image );
|
314 |
$xpath = new DOMXPath( $doc );
|
315 |
$src = $xpath->evaluate( 'string(//img/@src)' );
|
316 |
+
|
317 |
+
if ( $strip_protocol )
|
318 |
+
$src = self::strip_protocol( $src );
|
319 |
|
320 |
return $src;
|
321 |
}
|
448 |
|
449 |
|
450 |
public static function strip_protocol( $link ) {
|
451 |
+
if ( ! empty( $link ) ) {
|
452 |
+
$link = preg_replace( '#https?:#', '', $link );
|
453 |
+
}
|
454 |
|
455 |
+
return $link;
|
456 |
}
|
457 |
|
458 |
|
{lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-licensing.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
{lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-settings.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -22,6 +22,7 @@
|
|
22 |
* Based upon http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
23 |
*/
|
24 |
|
|
|
25 |
|
26 |
if ( class_exists( 'Aihrus_Settings' ) )
|
27 |
return;
|
@@ -58,8 +59,8 @@ abstract class Aihrus_Settings {
|
|
58 |
|
59 |
|
60 |
public static function sections() {
|
61 |
-
static::$sections['reset'] = esc_html__( 'Reset'
|
62 |
-
static::$sections['about'] = esc_html__( 'About'
|
63 |
}
|
64 |
|
65 |
|
@@ -77,9 +78,9 @@ abstract class Aihrus_Settings {
|
|
77 |
|
78 |
static::$settings['export'] = array(
|
79 |
'section' => 'reset',
|
80 |
-
'title' => esc_html__( 'Export Settings'
|
81 |
'type' => 'readonly',
|
82 |
-
'desc' => esc_html__( 'These are your current settings in a serialized format. Copy the contents to make a backup of your settings.'
|
83 |
'std' => $serialized_options,
|
84 |
'widget' => 0,
|
85 |
);
|
@@ -87,17 +88,17 @@ abstract class Aihrus_Settings {
|
|
87 |
|
88 |
static::$settings['import'] = array(
|
89 |
'section' => 'reset',
|
90 |
-
'title' => esc_html__( 'Import Settings'
|
91 |
'type' => 'textarea',
|
92 |
-
'desc' => esc_html__( 'Paste new serialized settings here to overwrite your current configuration.'
|
93 |
'widget' => 0,
|
94 |
);
|
95 |
|
96 |
-
$desc = esc_html__( 'Delete all %s data and options from database on plugin deletion', '
|
97 |
|
98 |
static::$settings['delete_data'] = array(
|
99 |
'section' => 'reset',
|
100 |
-
'title' => esc_html__( 'Remove Plugin Data on Deletion?'
|
101 |
'type' => 'checkbox',
|
102 |
'class' => 'warning',
|
103 |
'desc' => sprintf( $desc, static::NAME ),
|
@@ -106,10 +107,10 @@ abstract class Aihrus_Settings {
|
|
106 |
|
107 |
static::$settings['reset_defaults'] = array(
|
108 |
'section' => 'reset',
|
109 |
-
'title' => esc_html__( 'Reset to Defaults?'
|
110 |
'type' => 'checkbox',
|
111 |
'class' => 'warning',
|
112 |
-
'desc' => esc_html__( 'Check this box to reset options to their defaults'
|
113 |
);
|
114 |
}
|
115 |
|
@@ -233,12 +234,12 @@ abstract class Aihrus_Settings {
|
|
233 |
|
234 |
public static function display_about() {
|
235 |
$name = str_replace( ' Settings', '', static::NAME );
|
236 |
-
$text = __( '<img class="alignright size-medium" src="%1$
|
237 |
|
238 |
echo '<div id="about" style="width: 70%; min-height: 225px;"><p>';
|
239 |
echo sprintf(
|
240 |
$text,
|
241 |
-
static::$
|
242 |
esc_url( static::$plugin_url ),
|
243 |
$name,
|
244 |
esc_url( 'http://aihr.us/resume/' ),
|
@@ -262,6 +263,7 @@ abstract class Aihrus_Settings {
|
|
262 |
|
263 |
echo '<form action="options.php" method="post">';
|
264 |
|
|
|
265 |
settings_fields( static::ID );
|
266 |
|
267 |
echo '<div id="' . static::ID . '">
|
@@ -275,7 +277,7 @@ abstract class Aihrus_Settings {
|
|
275 |
self::do_settings_sections( static::ID );
|
276 |
|
277 |
echo '
|
278 |
-
<p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_html__( 'Save Changes'
|
279 |
</form>
|
280 |
</div>
|
281 |
';
|
@@ -283,7 +285,7 @@ abstract class Aihrus_Settings {
|
|
283 |
if ( ! $disable_donate ) {
|
284 |
echo '<p>' .
|
285 |
sprintf(
|
286 |
-
__( 'If you like this plugin, please <a href="%1$s" title="Donate for Good Karma"><img src="%2$s" border="0" alt="Donate for Good Karma" /></a> or <a href="%3$s" title="purchase premium WordPress plugins from Aihrus ">purchase the Premium version</a> to help fund further development and <a href="%4$s" title="Support forums">support</a>.'
|
287 |
esc_url( 'http://aihr.us/about-aihrus/donate/' ),
|
288 |
esc_url( 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' ),
|
289 |
esc_url( 'http://aihr.us/store/' ),
|
@@ -294,7 +296,7 @@ abstract class Aihrus_Settings {
|
|
294 |
|
295 |
echo '<p class="copyright">' .
|
296 |
sprintf(
|
297 |
-
__( 'Copyright ©%1$s <a href="%2$s">Aihrus</a>.'
|
298 |
date( 'Y' ),
|
299 |
esc_url( 'http://aihr.us' )
|
300 |
) .
|
@@ -466,7 +468,8 @@ abstract class Aihrus_Settings {
|
|
466 |
|
467 |
|
468 |
public static function styles() {
|
469 |
-
|
|
|
470 |
}
|
471 |
|
472 |
|
@@ -478,9 +481,12 @@ abstract class Aihrus_Settings {
|
|
478 |
public static function validate_settings( $input, $options = null, $do_errors = false ) {
|
479 |
$errors = array();
|
480 |
|
|
|
481 |
if ( is_null( $options ) ) {
|
482 |
-
$
|
|
|
483 |
$defaults = static::get_defaults();
|
|
|
484 |
|
485 |
if ( is_admin() ) {
|
486 |
if ( ! empty( $input['reset_defaults'] ) ) {
|
@@ -511,10 +517,15 @@ abstract class Aihrus_Settings {
|
|
511 |
$validations = explode( ',', $validations );
|
512 |
|
513 |
if ( ! isset( $input[ $id ] ) ) {
|
514 |
-
if ( 'checkbox' != $type )
|
515 |
$input[ $id ] = $default;
|
516 |
-
else
|
517 |
-
$
|
|
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
|
520 |
if ( $default == $input[ $id ] && ! in_array( 'required', $validations ) )
|
@@ -546,6 +557,16 @@ abstract class Aihrus_Settings {
|
|
546 |
unset( $input['export'] );
|
547 |
unset( $input['import'] );
|
548 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
549 |
if ( empty( $do_errors ) ) {
|
550 |
$validated = $input;
|
551 |
} else {
|
@@ -595,7 +616,15 @@ abstract class Aihrus_Settings {
|
|
595 |
|
596 |
case 'required':
|
597 |
if ( empty( $input[ $id ] ) )
|
598 |
-
$errors[ $id ] = esc_html__( 'Required'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
599 |
break;
|
600 |
|
601 |
case 'slug':
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
22 |
* Based upon http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
23 |
*/
|
24 |
|
25 |
+
require_once ABSPATH . 'wp-admin/includes/template.php';
|
26 |
|
27 |
if ( class_exists( 'Aihrus_Settings' ) )
|
28 |
return;
|
59 |
|
60 |
|
61 |
public static function sections() {
|
62 |
+
static::$sections['reset'] = esc_html__( 'Reset' );
|
63 |
+
static::$sections['about'] = esc_html__( 'About' );
|
64 |
}
|
65 |
|
66 |
|
78 |
|
79 |
static::$settings['export'] = array(
|
80 |
'section' => 'reset',
|
81 |
+
'title' => esc_html__( 'Export Settings' ),
|
82 |
'type' => 'readonly',
|
83 |
+
'desc' => esc_html__( 'These are your current settings in a serialized format. Copy the contents to make a backup of your settings.' ),
|
84 |
'std' => $serialized_options,
|
85 |
'widget' => 0,
|
86 |
);
|
88 |
|
89 |
static::$settings['import'] = array(
|
90 |
'section' => 'reset',
|
91 |
+
'title' => esc_html__( 'Import Settings' ),
|
92 |
'type' => 'textarea',
|
93 |
+
'desc' => esc_html__( 'Paste new serialized settings here to overwrite your current configuration.' ),
|
94 |
'widget' => 0,
|
95 |
);
|
96 |
|
97 |
+
$desc = esc_html__( 'Delete all %s data and options from database on plugin deletion. Even if this option isn\'t checked, WordPress will still give a data deletion warning.' );
|
98 |
|
99 |
static::$settings['delete_data'] = array(
|
100 |
'section' => 'reset',
|
101 |
+
'title' => esc_html__( 'Remove Plugin Data on Deletion?' ),
|
102 |
'type' => 'checkbox',
|
103 |
'class' => 'warning',
|
104 |
'desc' => sprintf( $desc, static::NAME ),
|
107 |
|
108 |
static::$settings['reset_defaults'] = array(
|
109 |
'section' => 'reset',
|
110 |
+
'title' => esc_html__( 'Reset to Defaults?' ),
|
111 |
'type' => 'checkbox',
|
112 |
'class' => 'warning',
|
113 |
+
'desc' => esc_html__( 'Check this box to reset options to their defaults' ),
|
114 |
);
|
115 |
}
|
116 |
|
234 |
|
235 |
public static function display_about() {
|
236 |
$name = str_replace( ' Settings', '', static::NAME );
|
237 |
+
$text = __( '<img class="alignright size-medium" src="%1$simages/michael-cannon-red-square-300x2251.jpg" alt="Michael in Red Square, Moscow, Russia" width="300" height="225" /><a href="%2$s">%3$s</a> is by <a href="%4$s">Michael Cannon</a>. He\'s <a href="%5$s">Peichi’s</a> smiling man, an adventurous <a href="%6$s" target="_blank">water-rat</a>, <a href="%7$s">chief people officer</a>, <a href="%8$s">cyclist</a>, <a href="%9$s">full stack developer</a>, <a href="%10$s">poet</a>, <a href="%11$s">WWOOF’er</a> and <a href="%12$s">world traveler</a>.' );
|
238 |
|
239 |
echo '<div id="about" style="width: 70%; min-height: 225px;"><p>';
|
240 |
echo sprintf(
|
241 |
$text,
|
242 |
+
static::$plugin_assets,
|
243 |
esc_url( static::$plugin_url ),
|
244 |
$name,
|
245 |
esc_url( 'http://aihr.us/resume/' ),
|
263 |
|
264 |
echo '<form action="options.php" method="post">';
|
265 |
|
266 |
+
settings_errors( static::ID );
|
267 |
settings_fields( static::ID );
|
268 |
|
269 |
echo '<div id="' . static::ID . '">
|
277 |
self::do_settings_sections( static::ID );
|
278 |
|
279 |
echo '
|
280 |
+
<p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_html__( 'Save Changes' ) . '" /></p>
|
281 |
</form>
|
282 |
</div>
|
283 |
';
|
285 |
if ( ! $disable_donate ) {
|
286 |
echo '<p>' .
|
287 |
sprintf(
|
288 |
+
__( 'If you like this plugin, please <a href="%1$s" title="Donate for Good Karma"><img src="%2$s" border="0" alt="Donate for Good Karma" /></a> or <a href="%3$s" title="purchase premium WordPress plugins from Aihrus ">purchase the Premium version</a> to help fund further development and <a href="%4$s" title="Support forums">support</a>.' ),
|
289 |
esc_url( 'http://aihr.us/about-aihrus/donate/' ),
|
290 |
esc_url( 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' ),
|
291 |
esc_url( 'http://aihr.us/store/' ),
|
296 |
|
297 |
echo '<p class="copyright">' .
|
298 |
sprintf(
|
299 |
+
__( 'Copyright ©%1$s <a href="%2$s">Aihrus</a>.' ),
|
300 |
date( 'Y' ),
|
301 |
esc_url( 'http://aihr.us' )
|
302 |
) .
|
468 |
|
469 |
|
470 |
public static function styles() {
|
471 |
+
wp_register_style( 'jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
|
472 |
+
wp_enqueue_style( 'jquery-style' );
|
473 |
}
|
474 |
|
475 |
|
481 |
public static function validate_settings( $input, $options = null, $do_errors = false ) {
|
482 |
$errors = array();
|
483 |
|
484 |
+
$null_options = false;
|
485 |
if ( is_null( $options ) ) {
|
486 |
+
$null_options = true;
|
487 |
+
|
488 |
$defaults = static::get_defaults();
|
489 |
+
$options = self::get_settings();
|
490 |
|
491 |
if ( is_admin() ) {
|
492 |
if ( ! empty( $input['reset_defaults'] ) ) {
|
517 |
$validations = explode( ',', $validations );
|
518 |
|
519 |
if ( ! isset( $input[ $id ] ) ) {
|
520 |
+
if ( 'checkbox' != $type ) {
|
521 |
$input[ $id ] = $default;
|
522 |
+
} else {
|
523 |
+
if ( empty( $parts['widget'] ) ) {
|
524 |
+
continue;
|
525 |
+
} else {
|
526 |
+
$input[ $id ] = 0;
|
527 |
+
}
|
528 |
+
}
|
529 |
}
|
530 |
|
531 |
if ( $default == $input[ $id ] && ! in_array( 'required', $validations ) )
|
557 |
unset( $input['export'] );
|
558 |
unset( $input['import'] );
|
559 |
|
560 |
+
$hide_update_notice = false;
|
561 |
+
if ( isset( static::$hide_update_notice ) && ! empty( static::$hide_update_notice ) ) {
|
562 |
+
$hide_update_notice = true;
|
563 |
+
}
|
564 |
+
|
565 |
+
if ( $null_options && empty( $errors ) && ! $hide_update_notice ) {
|
566 |
+
add_settings_error( static::ID, 'settings_updated', esc_html__( 'Settings saved.' ), 'updated' );
|
567 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
568 |
+
}
|
569 |
+
|
570 |
if ( empty( $do_errors ) ) {
|
571 |
$validated = $input;
|
572 |
} else {
|
616 |
|
617 |
case 'required':
|
618 |
if ( empty( $input[ $id ] ) )
|
619 |
+
$errors[ $id ] = esc_html__( 'Required' );
|
620 |
+
break;
|
621 |
+
|
622 |
+
case 'slash_sanitize_title':
|
623 |
+
$temp = explode( '/', $input[ $id ] );
|
624 |
+
$temp = array_map( 'sanitize_title', $temp );
|
625 |
+
$temp = implode( '/', $temp );
|
626 |
+
|
627 |
+
$input[ $id ] = $temp;
|
628 |
break;
|
629 |
|
630 |
case 'slug':
|
{lib/aihrus → includes/libraries/aihrus-framework}/class-aihrus-widget.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -137,7 +137,7 @@ abstract class Aihrus_Widget extends WP_Widget implements Aihrus_Widget_Interfac
|
|
137 |
if ( ! empty( $desc ) )
|
138 |
echo '<h3>' . $desc . '</h3>';
|
139 |
|
140 |
-
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'.tw-collapsible-control\' ) . slideToggle(); jQuery( \'.tw-collapsible\' ) . slideToggle();">' . esc_html__( 'Expand/Collapse All Options'
|
141 |
|
142 |
$do_return = true;
|
143 |
break;
|
@@ -146,7 +146,7 @@ abstract class Aihrus_Widget extends WP_Widget implements Aihrus_Widget_Interfac
|
|
146 |
if ( ! empty( $desc ) )
|
147 |
echo '<h3>' . $desc . '</h3>';
|
148 |
|
149 |
-
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'div#' . $this->get_field_id( $id ) . '\' ) . slideToggle();" class="tw-collapsible-control">' . esc_html__( 'Expand/Collapse'
|
150 |
echo '<div id="' . $this->get_field_id( $id ) . '" style="display:none" class="tw-collapsible">';
|
151 |
|
152 |
$do_return = true;
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
137 |
if ( ! empty( $desc ) )
|
138 |
echo '<h3>' . $desc . '</h3>';
|
139 |
|
140 |
+
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'.tw-collapsible-control\' ) . slideToggle(); jQuery( \'.tw-collapsible\' ) . slideToggle();">' . esc_html__( 'Expand/Collapse All Options' ) . ' »</a>';
|
141 |
|
142 |
$do_return = true;
|
143 |
break;
|
146 |
if ( ! empty( $desc ) )
|
147 |
echo '<h3>' . $desc . '</h3>';
|
148 |
|
149 |
+
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'div#' . $this->get_field_id( $id ) . '\' ) . slideToggle();" class="tw-collapsible-control">' . esc_html__( 'Expand/Collapse' ) . ' »</a>';
|
150 |
echo '<div id="' . $this->get_field_id( $id ) . '" style="display:none" class="tw-collapsible">';
|
151 |
|
152 |
$do_return = true;
|
includes/libraries/aihrus-framework/includes/class-aihrus-common.php
ADDED
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Common' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
require_once 'interface-aihrus-common.php';
|
23 |
+
|
24 |
+
|
25 |
+
abstract class Aihrus_Common implements Aihrus_Common_Interface {
|
26 |
+
public static $donate_button;
|
27 |
+
public static $donate_link;
|
28 |
+
|
29 |
+
|
30 |
+
public function __construct() {
|
31 |
+
self::set_notice_key();
|
32 |
+
|
33 |
+
self::$donate_button = <<<EOD
|
34 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
35 |
+
<input type="hidden" name="cmd" value="_s-xclick">
|
36 |
+
<input type="hidden" name="hosted_button_id" value="WM4F995W9LHXE">
|
37 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
38 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
39 |
+
</form>
|
40 |
+
EOD;
|
41 |
+
|
42 |
+
self::$donate_link = '<a href="http://aihr.us/about-aihrus/donate/"><img src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" alt="PayPal - The safer, easier way to pay online!" /></a>';
|
43 |
+
|
44 |
+
add_action( 'admin_init', array( static::$class, 'check_notices' ), 9999 );
|
45 |
+
}
|
46 |
+
|
47 |
+
|
48 |
+
public static function set_notice( $notice_name, $frequency_limit = false ) {
|
49 |
+
$notice_key = self::get_notice_key();
|
50 |
+
|
51 |
+
$frequency_limit = intval( $frequency_limit );
|
52 |
+
if ( ! empty( $frequency_limit ) ) {
|
53 |
+
$fl_key = $notice_key . '_' . $notice_name;
|
54 |
+
$proceed = get_transient( $fl_key );
|
55 |
+
if ( false === $proceed ) {
|
56 |
+
delete_transient( $fl_key );
|
57 |
+
set_transient( $fl_key, time(), $frequency_limit );
|
58 |
+
} else {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
$notices = get_transient( $notice_key );
|
64 |
+
if ( false === $notices )
|
65 |
+
$notices = array();
|
66 |
+
|
67 |
+
$notices[] = $notice_name;
|
68 |
+
|
69 |
+
self::delete_notices();
|
70 |
+
set_transient( $notice_key, $notices, HOUR_IN_SECONDS );
|
71 |
+
}
|
72 |
+
|
73 |
+
|
74 |
+
public static function delete_notices() {
|
75 |
+
$notice_key = self::get_notice_key();
|
76 |
+
|
77 |
+
delete_transient( $notice_key );
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
public static function check_notices() {
|
82 |
+
$notice_key = self::get_notice_key();
|
83 |
+
|
84 |
+
$notices = get_transient( $notice_key );
|
85 |
+
if ( false === $notices )
|
86 |
+
return;
|
87 |
+
|
88 |
+
$notices = array_unique( $notices );
|
89 |
+
foreach ( $notices as $notice ) {
|
90 |
+
if ( function_exists( $notice ) ) {
|
91 |
+
add_action( 'admin_notices', $notice );
|
92 |
+
} elseif ( is_array( $notice ) ) {
|
93 |
+
add_action( 'admin_notices', $notice );
|
94 |
+
} else {
|
95 |
+
add_action( 'admin_notices', array( static::$class, $notice ) );
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
self::delete_notices();
|
100 |
+
}
|
101 |
+
|
102 |
+
|
103 |
+
public static function get_notice_key() {
|
104 |
+
if ( is_null( static::$notice_key ) )
|
105 |
+
self::set_notice_key();
|
106 |
+
|
107 |
+
return static::$notice_key;
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
public static function set_notice_key() {
|
112 |
+
static::$notice_key = static::SLUG . 'notices';
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
public static function version( $version ) {
|
117 |
+
$version .= '-' . static::ID . '-' . static::VERSION;
|
118 |
+
|
119 |
+
return $version;
|
120 |
+
}
|
121 |
+
|
122 |
+
|
123 |
+
/**
|
124 |
+
* flatten an arbitrarily deep multidimensional array
|
125 |
+
* into a list of its scalar values
|
126 |
+
* (may be inefficient for large structures)
|
127 |
+
* (will infinite recurse on self-referential structures)
|
128 |
+
* (could be extended to handle objects)
|
129 |
+
*
|
130 |
+
* @ref http://in1.php.net/manual/en/function.array-values.php#41967
|
131 |
+
*/
|
132 |
+
|
133 |
+
|
134 |
+
public static function array_values_recursive( $ary ) {
|
135 |
+
$lst = array();
|
136 |
+
foreach ( array_keys( $ary ) as $k ) {
|
137 |
+
$v = $ary[$k];
|
138 |
+
if ( is_scalar( $v ) ) {
|
139 |
+
$lst[] = $v;
|
140 |
+
} elseif ( is_array( $v ) ) {
|
141 |
+
$lst = array_merge(
|
142 |
+
$lst,
|
143 |
+
self::array_values_recursive( $v )
|
144 |
+
);
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
return $lst;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
public static function notice_donate( $disable_donate = null, $item_name = null ) {
|
153 |
+
if ( $disable_donate )
|
154 |
+
return;
|
155 |
+
|
156 |
+
$text = sprintf( esc_html__( 'Please donate $5 towards ongoing free support and development of the "%1$s" plugin. %2$s' ), $item_name, self::$donate_button );
|
157 |
+
|
158 |
+
aihr_notice_updated( $text );
|
159 |
+
}
|
160 |
+
|
161 |
+
|
162 |
+
public static function get_scripts() {
|
163 |
+
if ( static::$scripts_called )
|
164 |
+
return;
|
165 |
+
|
166 |
+
foreach ( static::$scripts as $script )
|
167 |
+
echo $script;
|
168 |
+
|
169 |
+
static::$scripts_called = true;
|
170 |
+
}
|
171 |
+
|
172 |
+
|
173 |
+
public static function get_styles() {
|
174 |
+
if ( empty( self::$styles ) )
|
175 |
+
return;
|
176 |
+
|
177 |
+
if ( empty( self::$styles_called ) ) {
|
178 |
+
echo '<style>';
|
179 |
+
|
180 |
+
foreach ( self::$styles as $style )
|
181 |
+
echo $style;
|
182 |
+
|
183 |
+
echo '</style>';
|
184 |
+
|
185 |
+
self::$styles_called = true;
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
|
190 |
+
public static function create_nonce( $action ) {
|
191 |
+
$nonce = uniqid();
|
192 |
+
$uid = get_current_user_id();
|
193 |
+
$check = $uid . $action;
|
194 |
+
set_transient( $nonce, $check, HOUR_IN_SECONDS );
|
195 |
+
|
196 |
+
return $nonce;
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
public static function verify_nonce( $nonce, $action ) {
|
201 |
+
$active = get_transient( $nonce );
|
202 |
+
$uid = get_current_user_id();
|
203 |
+
$check = $uid . $action;
|
204 |
+
$valid = false;
|
205 |
+
|
206 |
+
if ( $active == $check ) {
|
207 |
+
delete_transient( $nonce );
|
208 |
+
$valid = true;
|
209 |
+
}
|
210 |
+
|
211 |
+
return $valid;
|
212 |
+
}
|
213 |
+
|
214 |
+
|
215 |
+
/**
|
216 |
+
* If incoming link is empty, then get_site_url() is used instead.
|
217 |
+
*/
|
218 |
+
public static function create_link( $link, $title = null, $target = null, $return_as_tag = true ) {
|
219 |
+
if ( empty( $link ) )
|
220 |
+
$link = get_site_url();
|
221 |
+
|
222 |
+
if ( preg_match( '#^\d+$#', $link ) ) {
|
223 |
+
$permalink = get_permalink( $link );
|
224 |
+
$tag_title = get_the_title( $link );
|
225 |
+
if ( empty( $title ) )
|
226 |
+
$title = $tag_title;
|
227 |
+
|
228 |
+
$tag = '<a href="';
|
229 |
+
$tag .= $permalink;
|
230 |
+
$tag .= '" title="';
|
231 |
+
$tag .= $tag_title;
|
232 |
+
$tag .= '">';
|
233 |
+
$tag .= $title;
|
234 |
+
$tag .= '</a>';
|
235 |
+
} else {
|
236 |
+
$orig_link = empty( $title ) ? $link : $title;
|
237 |
+
$do_http = true;
|
238 |
+
|
239 |
+
if ( 0 === strpos( $link, '/' ) )
|
240 |
+
$do_http = false;
|
241 |
+
|
242 |
+
if ( $do_http && 0 === preg_match( '#https?://#', $link ) )
|
243 |
+
$link = 'http://' . $link;
|
244 |
+
|
245 |
+
$permalink = $link;
|
246 |
+
|
247 |
+
$tag = '<a href="';
|
248 |
+
$tag .= $permalink;
|
249 |
+
$tag .= '">';
|
250 |
+
$tag .= $orig_link;
|
251 |
+
$tag .= '</a>';
|
252 |
+
}
|
253 |
+
|
254 |
+
if ( ! empty( $target ) && is_string( $target ) )
|
255 |
+
$tag = links_add_target( $tag, $target );
|
256 |
+
|
257 |
+
if ( $return_as_tag )
|
258 |
+
return $tag;
|
259 |
+
else
|
260 |
+
return array(
|
261 |
+
'link' => $permalink,
|
262 |
+
'tag' => $tag,
|
263 |
+
);
|
264 |
+
}
|
265 |
+
|
266 |
+
|
267 |
+
public static function add_media( $post_id, $media_src, $media_name = null, $featured_image = true ) {
|
268 |
+
require_once ABSPATH . 'wp-admin/includes/image.php';
|
269 |
+
|
270 |
+
if ( empty( $media_name ) )
|
271 |
+
$media_name = basename( $media_src );
|
272 |
+
|
273 |
+
$wp_filetype = wp_check_filetype( $media_name, null );
|
274 |
+
$attachment = array(
|
275 |
+
'post_mime_type' => $wp_filetype['type'],
|
276 |
+
'post_status' => 'inherit',
|
277 |
+
'post_title' => $media_name,
|
278 |
+
);
|
279 |
+
|
280 |
+
$file_move = wp_upload_bits( $media_name, null, self::file_get_contents_curl( $media_src ) );
|
281 |
+
$file_name = $file_move['file'];
|
282 |
+
|
283 |
+
$image_id = wp_insert_attachment( $attachment, $file_name, $post_id );
|
284 |
+
$metadata = wp_generate_attachment_metadata( $image_id, $file_name );
|
285 |
+
wp_update_attachment_metadata( $image_id, $metadata );
|
286 |
+
|
287 |
+
if ( $featured_image )
|
288 |
+
update_post_meta( $post_id, '_thumbnail_id', $image_id );
|
289 |
+
|
290 |
+
return $image_id;
|
291 |
+
}
|
292 |
+
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Thank you Tobylewis
|
296 |
+
*
|
297 |
+
* file_get_contents support on some shared systems is turned off
|
298 |
+
*
|
299 |
+
* @ref http://wordpress.org/support/topic/plugin-flickr-shortcode-importer-file_get_contents-with-url-isp-does-not-support?replies=2#post-2878241
|
300 |
+
*/
|
301 |
+
public static function file_get_contents_curl( $url ) {
|
302 |
+
$ch = curl_init();
|
303 |
+
|
304 |
+
curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
|
305 |
+
curl_setopt( $ch, CURLOPT_HEADER, 0 );
|
306 |
+
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
|
307 |
+
curl_setopt( $ch, CURLOPT_URL, $url );
|
308 |
+
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
|
309 |
+
|
310 |
+
$data = curl_exec( $ch );
|
311 |
+
curl_close( $ch );
|
312 |
+
|
313 |
+
return $data;
|
314 |
+
}
|
315 |
+
|
316 |
+
|
317 |
+
public static function get_image_src( $image, $strip_protocol = true ) {
|
318 |
+
$doc = new DOMDocument();
|
319 |
+
$doc->loadHTML( $image );
|
320 |
+
$xpath = new DOMXPath( $doc );
|
321 |
+
$src = $xpath->evaluate( 'string(//img/@src)' );
|
322 |
+
|
323 |
+
if ( $strip_protocol )
|
324 |
+
$src = self::strip_protocol( $src );
|
325 |
+
|
326 |
+
return $src;
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
public static function clean_string( $string ) {
|
331 |
+
if ( ! is_string( $string ) )
|
332 |
+
return $string;
|
333 |
+
|
334 |
+
return trim( strip_shortcodes( strip_tags( $string ) ) );
|
335 |
+
}
|
336 |
+
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Truncate HTML, close opened tags. UTF-8 aware, and aware of unpaired tags
|
340 |
+
* (which don't need a matching closing tag)
|
341 |
+
*
|
342 |
+
* @param string $html
|
343 |
+
* @param int $max_length Maximum length of the characters of the string
|
344 |
+
* @param string $indicator Suffix to use if string was truncated.
|
345 |
+
* @param boolean $force_indicator Suffix to use if string was truncated.
|
346 |
+
* @return string
|
347 |
+
*
|
348 |
+
* @ref http://pastie.org/3084080
|
349 |
+
*/
|
350 |
+
public static function truncate( $html, $max_length, $indicator = '…', $force_indicator = false ) {
|
351 |
+
$output_length = 0; // number of counted characters stored so far in $output
|
352 |
+
$position = 0; // character offset within input string after last tag/entity
|
353 |
+
$tag_stack = array(); // stack of tags we've encountered but not closed
|
354 |
+
$output = '';
|
355 |
+
$truncated = false;
|
356 |
+
|
357 |
+
/**
|
358 |
+
* these tags don't have matching closing elements, in HTML (in XHTML they
|
359 |
+
* theoretically need a closing /> )
|
360 |
+
*
|
361 |
+
* @see http://www.netstrider.com/tutorials/HTMLRef/a_d.html
|
362 |
+
* @see http://www.w3schools.com/tags/default.asp
|
363 |
+
* @see http://stackoverflow.com/questions/3741896/what-do-you-call-tags-that-need-no-ending-tag
|
364 |
+
*/
|
365 |
+
$unpaired_tags = array(
|
366 |
+
'doctype',
|
367 |
+
'!doctype',
|
368 |
+
'area',
|
369 |
+
'base',
|
370 |
+
'basefont',
|
371 |
+
'bgsound',
|
372 |
+
'br',
|
373 |
+
'col',
|
374 |
+
'embed',
|
375 |
+
'frame',
|
376 |
+
'hr',
|
377 |
+
'img',
|
378 |
+
'input',
|
379 |
+
'link',
|
380 |
+
'meta',
|
381 |
+
'param',
|
382 |
+
'sound',
|
383 |
+
'spacer',
|
384 |
+
'wbr',
|
385 |
+
);
|
386 |
+
|
387 |
+
$func_strcut = function_exists( 'mb_strcut' ) ? 'mb_strcut' : 'substr';
|
388 |
+
$func_strlen = function_exists( 'mb_strlen' ) ? 'mb_strlen' : 'strlen';
|
389 |
+
|
390 |
+
// loop through, splitting at HTML entities or tags
|
391 |
+
while ( $output_length < $max_length && preg_match( '{</?([a-z]+)[^>]*>|&#?[a-zA-Z0-9]+;}', $html, $match, PREG_OFFSET_CAPTURE, $position ) ) {
|
392 |
+
list( $tag, $tag_position ) = $match[0];
|
393 |
+
|
394 |
+
// get text leading up to the tag, and store it – up to max_length
|
395 |
+
$text = $func_strcut( $html, $position, $tag_position - $position );
|
396 |
+
if ( $output_length + $func_strlen( $text ) > $max_length ) {
|
397 |
+
$output .= $func_strcut( $text, 0, $max_length - $output_length );
|
398 |
+
$truncated = true;
|
399 |
+
$output_length = $max_length;
|
400 |
+
break;
|
401 |
+
}
|
402 |
+
|
403 |
+
// store everything, it wasn't too long
|
404 |
+
$output .= $text;
|
405 |
+
$output_length += $func_strlen( $text );
|
406 |
+
|
407 |
+
if ( $tag[0] == '&' ) {
|
408 |
+
// Handle HTML entity by copying straight through
|
409 |
+
$output .= $tag;
|
410 |
+
$output_length++; // only counted as one character
|
411 |
+
} else {
|
412 |
+
// Handle HTML tag
|
413 |
+
$tag_inner = $match[1][0];
|
414 |
+
if ( $tag[1] == '/' ) {
|
415 |
+
// This is a closing tag.
|
416 |
+
$output .= $tag;
|
417 |
+
// If input tags aren't balanced, we leave the popped tag
|
418 |
+
// on the stack so hopefully we're not introducing more
|
419 |
+
// problems.
|
420 |
+
|
421 |
+
if ( end( $tag_stack ) == $tag_inner )
|
422 |
+
array_pop( $tag_stack );
|
423 |
+
} elseif ( $tag[$func_strlen( $tag ) - 2] == '/' || in_array( strtolower( $tag_inner ), $unpaired_tags ) ) {
|
424 |
+
// Self-closing or unpaired tag
|
425 |
+
$output .= $tag;
|
426 |
+
} else {
|
427 |
+
// Opening tag.
|
428 |
+
$output .= $tag;
|
429 |
+
$tag_stack[] = $tag_inner; // push tag onto the stack
|
430 |
+
}
|
431 |
+
}
|
432 |
+
|
433 |
+
// Continue after the tag we just found
|
434 |
+
$position = $tag_position + $func_strlen( $tag );
|
435 |
+
}
|
436 |
+
|
437 |
+
// Print any remaining text after the last tag, if there's room
|
438 |
+
|
439 |
+
if ( $output_length < $max_length && $position < $func_strlen( $html ) )
|
440 |
+
$output .= $func_strcut( $html, $position, $max_length - $output_length );
|
441 |
+
|
442 |
+
$truncated = $func_strlen( $html ) - $position > $max_length - $output_length;
|
443 |
+
|
444 |
+
// add terminator if it was truncated in loop or just above here
|
445 |
+
if ( $truncated || $force_indicator )
|
446 |
+
$output .= $indicator;
|
447 |
+
|
448 |
+
// Close any open tags
|
449 |
+
while ( ! empty( $tag_stack ) )
|
450 |
+
$output .= '</'.array_pop( $tag_stack ).'>';
|
451 |
+
|
452 |
+
return $output;
|
453 |
+
}
|
454 |
+
|
455 |
+
|
456 |
+
public static function strip_protocol( $link ) {
|
457 |
+
if ( ! empty( $link ) ) {
|
458 |
+
$link = preg_replace( '#https?:#', '', $link );
|
459 |
+
}
|
460 |
+
|
461 |
+
return $link;
|
462 |
+
}
|
463 |
+
|
464 |
+
|
465 |
+
}
|
466 |
+
|
467 |
+
|
468 |
+
?>
|
includes/libraries/aihrus-framework/includes/class-aihrus-licensing.php
ADDED
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Licensing' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
require_once 'interface-aihrus-licensing.php';
|
23 |
+
|
24 |
+
|
25 |
+
abstract class Aihrus_Licensing implements Aihrus_Licensing_Interface {
|
26 |
+
public $author;
|
27 |
+
public $item_name;
|
28 |
+
public $slug;
|
29 |
+
public $store_url;
|
30 |
+
|
31 |
+
|
32 |
+
public function __construct( $slug, $item_name, $author = 'Michael Cannon', $store_url = 'http://aihr.us' ) {
|
33 |
+
$this->author = $author;
|
34 |
+
$this->item_name = urlencode( $item_name );
|
35 |
+
$this->slug = $slug;
|
36 |
+
$this->store_url = $store_url;
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
public function license_key() {
|
41 |
+
$key = $this->slug . 'license_key';
|
42 |
+
|
43 |
+
return $key;
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
public function get_license() {
|
48 |
+
$key = $this->license_key();
|
49 |
+
$license = get_transient( $key );
|
50 |
+
|
51 |
+
return $license;
|
52 |
+
}
|
53 |
+
|
54 |
+
|
55 |
+
public function update_license( $value = null ) {
|
56 |
+
$license = $this->get_license();
|
57 |
+
if ( $license === $value )
|
58 |
+
return $value;
|
59 |
+
|
60 |
+
if ( $this->valid_hash( $value ) ) {
|
61 |
+
$this->set_license( $value );
|
62 |
+
$value = $this->activate_license();
|
63 |
+
$this->set_license( $value );
|
64 |
+
|
65 |
+
return $value;
|
66 |
+
} else {
|
67 |
+
$this->deactivate_license();
|
68 |
+
$this->delete_license();
|
69 |
+
|
70 |
+
return '';
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
|
75 |
+
public function set_license( $value = null ) {
|
76 |
+
$key = $this->license_key();
|
77 |
+
|
78 |
+
delete_transient( $key );
|
79 |
+
|
80 |
+
if ( ! is_null( $value ) )
|
81 |
+
set_transient( $key, $value, 2 * YEAR_IN_SECONDS );
|
82 |
+
}
|
83 |
+
|
84 |
+
|
85 |
+
public function valid_license() {
|
86 |
+
$license = $this->get_license();
|
87 |
+
if ( $this->valid_hash( $license ) )
|
88 |
+
return true;
|
89 |
+
else
|
90 |
+
return false;
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
public function get_api_call( $action ) {
|
95 |
+
$license = $this->get_license();
|
96 |
+
$api_params = array(
|
97 |
+
'edd_action' => $action,
|
98 |
+
'item_name' => $this->item_name,
|
99 |
+
'license' => $license,
|
100 |
+
);
|
101 |
+
|
102 |
+
$api_call = add_query_arg(
|
103 |
+
$api_params,
|
104 |
+
$this->store_url
|
105 |
+
);
|
106 |
+
|
107 |
+
return $api_call;
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
public function get_remote_get( $api_call ) {
|
112 |
+
$response = wp_remote_get(
|
113 |
+
$api_call,
|
114 |
+
array(
|
115 |
+
'timeout' => 10,
|
116 |
+
'sslverify' => false,
|
117 |
+
)
|
118 |
+
);
|
119 |
+
|
120 |
+
return $response;
|
121 |
+
}
|
122 |
+
|
123 |
+
|
124 |
+
public function activate_license() {
|
125 |
+
$license_data = $this->get_license_data( 'activate_license' );
|
126 |
+
if ( false !== $license_data ) {
|
127 |
+
if ( 'valid' == $license_data->license ) {
|
128 |
+
$license = $this->get_license();
|
129 |
+
|
130 |
+
return $license;
|
131 |
+
}
|
132 |
+
|
133 |
+
return $license_data->license;
|
134 |
+
}
|
135 |
+
|
136 |
+
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
public function get_license_data( $action = 'check_license' ) {
|
141 |
+
$api_call = $this->get_api_call( $action );
|
142 |
+
$response = $this->get_remote_get( $api_call );
|
143 |
+
if ( is_wp_error( $response ) )
|
144 |
+
return false;
|
145 |
+
|
146 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
147 |
+
|
148 |
+
return $license_data;
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
public function deactivate_license() {
|
153 |
+
$license_data = $this->get_license_data( 'deactivate_license' );
|
154 |
+
if ( false !== $license_data ) {
|
155 |
+
if ( 'deactivated' == $license_data->license )
|
156 |
+
return true;
|
157 |
+
|
158 |
+
return $license_data->license;
|
159 |
+
}
|
160 |
+
|
161 |
+
return false;
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
public function delete_license() {
|
166 |
+
$this->set_license();
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
public function license_notice() {
|
171 |
+
$result = '<p><em>' . esc_html( 'Premium features require licensing to function.' ) . '</em></p>';
|
172 |
+
|
173 |
+
return $result;
|
174 |
+
}
|
175 |
+
|
176 |
+
|
177 |
+
public function valid_hash( $value = null ) {
|
178 |
+
if ( is_string( $value ) && preg_match( '#^[0-9a-f]{32}$#i', $value ) )
|
179 |
+
return true;
|
180 |
+
|
181 |
+
return false;
|
182 |
+
}
|
183 |
+
|
184 |
+
|
185 |
+
}
|
186 |
+
|
187 |
+
|
188 |
+
?>
|
includes/libraries/aihrus-framework/includes/class-aihrus-settings.php
ADDED
@@ -0,0 +1,784 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Aihrus Framework settings helper class
|
21 |
+
*
|
22 |
+
* Based upon http://alisothegeek.com/2011/01/wordpress-settings-api-tutorial-1/
|
23 |
+
*/
|
24 |
+
|
25 |
+
require_once ABSPATH . 'wp-admin/includes/template.php';
|
26 |
+
|
27 |
+
if ( class_exists( 'Aihrus_Settings' ) )
|
28 |
+
return;
|
29 |
+
|
30 |
+
|
31 |
+
abstract class Aihrus_Settings {
|
32 |
+
public static $default = array(
|
33 |
+
'backwards' => array(
|
34 |
+
'version' => null, // below this version number, use std
|
35 |
+
'std' => null,
|
36 |
+
),
|
37 |
+
'choices' => array(), // key => value
|
38 |
+
'class' => null, // warning, etc.
|
39 |
+
'desc' => null,
|
40 |
+
'id' => null,
|
41 |
+
'section' => 'general',
|
42 |
+
'show_code' => false,
|
43 |
+
'std' => null, // default key or value
|
44 |
+
'suggest' => false, // attempt for auto-suggest on inputs
|
45 |
+
'title' => null,
|
46 |
+
'type' => 'text', // textarea, checkbox, radio, select, hidden, heading, password, expand_begin, expand_end
|
47 |
+
'validate' => null, // required, term, slug, slugs, ids, order, single paramater PHP functions
|
48 |
+
'widget' => 1, // show in widget options, 0 off
|
49 |
+
);
|
50 |
+
|
51 |
+
|
52 |
+
public function __construct() {}
|
53 |
+
|
54 |
+
|
55 |
+
public static function load_options() {
|
56 |
+
static::sections();
|
57 |
+
static::settings();
|
58 |
+
}
|
59 |
+
|
60 |
+
|
61 |
+
public static function sections() {
|
62 |
+
static::$sections['reset'] = esc_html__( 'Reset' );
|
63 |
+
static::$sections['about'] = esc_html__( 'About' );
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
*
|
69 |
+
*
|
70 |
+
* @SuppressWarnings(PHPMD.Superglobals)
|
71 |
+
*/
|
72 |
+
public static function settings() {
|
73 |
+
// Reset section defaults
|
74 |
+
$options = get_option( static::ID );
|
75 |
+
if ( ! empty( $options ) ) {
|
76 |
+
$serialized_options = serialize( $options );
|
77 |
+
$_SESSION['export'] = $serialized_options;
|
78 |
+
|
79 |
+
static::$settings['export'] = array(
|
80 |
+
'section' => 'reset',
|
81 |
+
'title' => esc_html__( 'Export Settings' ),
|
82 |
+
'type' => 'readonly',
|
83 |
+
'desc' => esc_html__( 'These are your current settings in a serialized format. Copy the contents to make a backup of your settings.' ),
|
84 |
+
'std' => $serialized_options,
|
85 |
+
'widget' => 0,
|
86 |
+
);
|
87 |
+
}
|
88 |
+
|
89 |
+
static::$settings['import'] = array(
|
90 |
+
'section' => 'reset',
|
91 |
+
'title' => esc_html__( 'Import Settings' ),
|
92 |
+
'type' => 'textarea',
|
93 |
+
'desc' => esc_html__( 'Paste new serialized settings here to overwrite your current configuration.' ),
|
94 |
+
'widget' => 0,
|
95 |
+
);
|
96 |
+
|
97 |
+
$desc = esc_html__( 'Delete all %s data and options from database on plugin deletion. Even if this option isn\'t checked, WordPress will still give a data deletion warning.' );
|
98 |
+
|
99 |
+
static::$settings['delete_data'] = array(
|
100 |
+
'section' => 'reset',
|
101 |
+
'title' => esc_html__( 'Remove Plugin Data on Deletion?' ),
|
102 |
+
'type' => 'checkbox',
|
103 |
+
'class' => 'warning',
|
104 |
+
'desc' => sprintf( $desc, static::NAME ),
|
105 |
+
'widget' => 0,
|
106 |
+
);
|
107 |
+
|
108 |
+
static::$settings['reset_defaults'] = array(
|
109 |
+
'section' => 'reset',
|
110 |
+
'title' => esc_html__( 'Reset to Defaults?' ),
|
111 |
+
'type' => 'checkbox',
|
112 |
+
'class' => 'warning',
|
113 |
+
'desc' => esc_html__( 'Check this box to reset options to their defaults' ),
|
114 |
+
);
|
115 |
+
}
|
116 |
+
|
117 |
+
|
118 |
+
public static function get_defaults( $mode = null, $old_version = null ) {
|
119 |
+
if ( empty( static::$defaults ) )
|
120 |
+
static::settings();
|
121 |
+
|
122 |
+
$do_backwards = false;
|
123 |
+
if ( 'backwards' == $mode ) {
|
124 |
+
if ( ! empty( $old_version ) )
|
125 |
+
$do_backwards = true;
|
126 |
+
}
|
127 |
+
|
128 |
+
foreach ( static::$settings as $id => $parts ) {
|
129 |
+
$std = isset( $parts['std'] ) ? $parts['std'] : '';
|
130 |
+
if ( $do_backwards ) {
|
131 |
+
$version = ! empty( $parts['backwards']['version'] ) ? $parts['backwards']['version'] : false;
|
132 |
+
if ( ! empty( $version ) ) {
|
133 |
+
if ( $old_version < $version )
|
134 |
+
$std = $parts['backwards']['std'];
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
static::$defaults[ $id ] = $std;
|
139 |
+
}
|
140 |
+
|
141 |
+
return static::$defaults;
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
public static function get_settings() {
|
146 |
+
if ( empty( static::$settings ) )
|
147 |
+
static::settings();
|
148 |
+
|
149 |
+
return static::$settings;
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
public static function initialize_settings( $version = null ) {
|
154 |
+
$defaults = static::get_defaults( 'backwards' );
|
155 |
+
$current = get_option( static::ID );
|
156 |
+
$current = wp_parse_args( $current, $defaults );
|
157 |
+
|
158 |
+
$current['admin_notices'] = $version;
|
159 |
+
$current['version'] = static::$version;
|
160 |
+
|
161 |
+
update_option( static::ID, $current );
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
+
/**
|
166 |
+
*
|
167 |
+
*
|
168 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
169 |
+
*/
|
170 |
+
public static function create_setting( $args = array() ) {
|
171 |
+
extract( $args );
|
172 |
+
|
173 |
+
if ( preg_match( '#(_expand_begin|_expand_end)#', $id ) )
|
174 |
+
return;
|
175 |
+
|
176 |
+
$field_args = array(
|
177 |
+
'choices' => $choices,
|
178 |
+
'class' => $class,
|
179 |
+
'desc' => $desc,
|
180 |
+
'id' => $id,
|
181 |
+
'label_for' => $id,
|
182 |
+
'show_code' => $show_code,
|
183 |
+
'std' => $std,
|
184 |
+
'suggest' => $suggest,
|
185 |
+
'type' => $type,
|
186 |
+
);
|
187 |
+
|
188 |
+
static::$defaults[$id] = $std;
|
189 |
+
|
190 |
+
add_settings_field( $id, $title, array( static::$class, 'display_setting' ), static::ID, $section, $field_args );
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
public static function section_scripts() {
|
195 |
+
echo '
|
196 |
+
<script type="text/javascript">
|
197 |
+
jQuery(document).ready(function($) {
|
198 |
+
$( "#' . static::ID . '" ).tabs();
|
199 |
+
// This will make the "warning" checkbox class really stand out when checked.
|
200 |
+
$(".warning").change(function() {
|
201 |
+
if ($(this).is(":checked"))
|
202 |
+
$(this).parent().css("background", "#c00").css("color", "#fff").css("fontWeight", "bold");
|
203 |
+
else
|
204 |
+
$(this).parent().css("background", "inherit").css("color", "inherit").css("fontWeight", "inherit");
|
205 |
+
});
|
206 |
+
});
|
207 |
+
</script>
|
208 |
+
';
|
209 |
+
}
|
210 |
+
|
211 |
+
|
212 |
+
public static function do_settings_sections( $page ) {
|
213 |
+
global $wp_settings_sections, $wp_settings_fields;
|
214 |
+
|
215 |
+
if ( ! isset( $wp_settings_sections ) || ! isset( $wp_settings_sections[$page] ) )
|
216 |
+
return;
|
217 |
+
|
218 |
+
foreach ( (array) $wp_settings_sections[$page] as $section ) {
|
219 |
+
if ( $section['callback'] )
|
220 |
+
call_user_func( $section['callback'], $section );
|
221 |
+
|
222 |
+
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[$page] ) || ! isset( $wp_settings_fields[$page][$section['id']] ) )
|
223 |
+
continue;
|
224 |
+
|
225 |
+
echo '<table id=' . $section['id'] . ' class="form-table">';
|
226 |
+
do_settings_fields( $page, $section['id'] );
|
227 |
+
echo '</table>';
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
|
232 |
+
public static function display_section() {}
|
233 |
+
|
234 |
+
|
235 |
+
public static function display_about() {
|
236 |
+
$name = str_replace( ' Settings', '', static::NAME );
|
237 |
+
$text = __( '<img class="alignright size-medium" src="%1$simages/michael-cannon-red-square-300x2251.jpg" alt="Michael in Red Square, Moscow, Russia" width="300" height="225" /><a href="%2$s">%3$s</a> is by <a href="%4$s">Michael Cannon</a>. He\'s <a href="%5$s">Peichi’s</a> smiling man, an adventurous <a href="%6$s" target="_blank">water-rat</a>, <a href="%7$s">chief people officer</a>, <a href="%8$s">cyclist</a>, <a href="%9$s">full stack developer</a>, <a href="%10$s">poet</a>, <a href="%11$s">WWOOF’er</a> and <a href="%12$s">world traveler</a>.' );
|
238 |
+
|
239 |
+
echo '<div id="about" style="width: 70%; min-height: 225px;"><p>';
|
240 |
+
echo sprintf(
|
241 |
+
$text,
|
242 |
+
static::$plugin_assets,
|
243 |
+
esc_url( static::$plugin_url ),
|
244 |
+
$name,
|
245 |
+
esc_url( 'http://aihr.us/resume/' ),
|
246 |
+
esc_url( 'http://peimic.com/t/peichi-liu/' ),
|
247 |
+
esc_url( 'http://www.chinesehoroscope.org/chinese_zodiac/rat/' ),
|
248 |
+
esc_url( 'http://axelerant.com/who-we-are' ),
|
249 |
+
esc_url( 'http://peimic.com/c/biking/' ),
|
250 |
+
esc_url( 'http://aihr.us/about-aihrus/' ),
|
251 |
+
esc_url( 'http://peimic.com/t/poetry/' ),
|
252 |
+
esc_url( 'http://peimic.com/t/WWOOF/' ),
|
253 |
+
esc_url( 'http://peimic.com/c/travel/' )
|
254 |
+
);
|
255 |
+
echo '</p></div>';
|
256 |
+
}
|
257 |
+
|
258 |
+
|
259 |
+
public static function display_page( $disable_donate = false ) {
|
260 |
+
echo '<div class="wrap">
|
261 |
+
<div class="icon32" id="icon-options-general"></div>
|
262 |
+
<h2>' . static::NAME . '</h2>';
|
263 |
+
|
264 |
+
echo '<form action="options.php" method="post">';
|
265 |
+
|
266 |
+
settings_errors( static::ID );
|
267 |
+
settings_fields( static::ID );
|
268 |
+
|
269 |
+
echo '<div id="' . static::ID . '">
|
270 |
+
<ul>';
|
271 |
+
|
272 |
+
foreach ( static::$sections as $section_slug => $section )
|
273 |
+
echo '<li><a href="#' . $section_slug . '">' . $section . '</a></li>';
|
274 |
+
|
275 |
+
echo '</ul>';
|
276 |
+
|
277 |
+
self::do_settings_sections( static::ID );
|
278 |
+
|
279 |
+
echo '
|
280 |
+
<p class="submit"><input name="Submit" type="submit" class="button-primary" value="' . esc_html__( 'Save Changes' ) . '" /></p>
|
281 |
+
</form>
|
282 |
+
</div>
|
283 |
+
';
|
284 |
+
|
285 |
+
if ( ! $disable_donate ) {
|
286 |
+
echo '<p>' .
|
287 |
+
sprintf(
|
288 |
+
__( 'If you like this plugin, please <a href="%1$s" title="Donate for Good Karma"><img src="%2$s" border="0" alt="Donate for Good Karma" /></a> or <a href="%3$s" title="purchase premium WordPress plugins from Aihrus ">purchase the Premium version</a> to help fund further development and <a href="%4$s" title="Support forums">support</a>.' ),
|
289 |
+
esc_url( 'http://aihr.us/about-aihrus/donate/' ),
|
290 |
+
esc_url( 'https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' ),
|
291 |
+
esc_url( 'http://aihr.us/store/' ),
|
292 |
+
esc_url( 'https://aihrus.zendesk.com/home' )
|
293 |
+
) .
|
294 |
+
'</p>';
|
295 |
+
}
|
296 |
+
|
297 |
+
echo '<p class="copyright">' .
|
298 |
+
sprintf(
|
299 |
+
__( 'Copyright ©%1$s <a href="%2$s">Aihrus</a>.' ),
|
300 |
+
date( 'Y' ),
|
301 |
+
esc_url( 'http://aihr.us' )
|
302 |
+
) .
|
303 |
+
'</p>';
|
304 |
+
|
305 |
+
echo '</div>';
|
306 |
+
|
307 |
+
add_action( 'admin_footer', array( static::$class, 'section_scripts' ) );
|
308 |
+
}
|
309 |
+
|
310 |
+
|
311 |
+
public static function display_setting( $args = array(), $do_echo = true, $input = null ) {
|
312 |
+
$content = '';
|
313 |
+
|
314 |
+
extract( $args );
|
315 |
+
|
316 |
+
if ( is_null( $input ) )
|
317 |
+
$options = get_option( static::ID );
|
318 |
+
else {
|
319 |
+
$options = array();
|
320 |
+
$options[$id] = $input;
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( ! isset( $options[$id] ) && $type != 'checkbox' )
|
324 |
+
$options[$id] = $std;
|
325 |
+
elseif ( ! isset( $options[$id] ) )
|
326 |
+
$options[$id] = 0;
|
327 |
+
|
328 |
+
$field_class = '';
|
329 |
+
if ( ! empty( $class ) )
|
330 |
+
$field_class = ' ' . $class;
|
331 |
+
|
332 |
+
// desc isn't escaped because it's might contain allowed html
|
333 |
+
$choices = array_map( 'esc_attr', $choices );
|
334 |
+
$field_class = esc_attr( $field_class );
|
335 |
+
$id = esc_attr( $id );
|
336 |
+
$field_value = esc_attr( $options[$id] );
|
337 |
+
$std = esc_attr( $std );
|
338 |
+
|
339 |
+
switch ( $type ) {
|
340 |
+
case 'checkbox':
|
341 |
+
$content .= '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . static::ID . '[' . $id . ']" value="1" ' . checked( $field_value, 1, false ) . ' /> ';
|
342 |
+
|
343 |
+
if ( ! empty( $desc ) )
|
344 |
+
$content .= '<label for="' . $id . '"><span class="description">' . $desc . '</span></label>';
|
345 |
+
|
346 |
+
if ( $show_code )
|
347 |
+
$content .= '<br /><code>' . $id . '</code>';
|
348 |
+
break;
|
349 |
+
|
350 |
+
case 'file':
|
351 |
+
$content .= '<input class="regular-text' . $field_class . '" type="file" id="' . $id . '" name="' . static::ID . '[' . $id . ']" />';
|
352 |
+
|
353 |
+
if ( ! empty( $desc ) )
|
354 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
355 |
+
|
356 |
+
break;
|
357 |
+
|
358 |
+
case 'heading':
|
359 |
+
$content .= '</td></tr><tr valign="top"><td colspan="2"><h4>' . $desc . '</h4>';
|
360 |
+
break;
|
361 |
+
|
362 |
+
case 'hidden':
|
363 |
+
$content .= '<input type="hidden" id="' . $id . '" name="' . static::ID . '[' . $id . ']" value="' . $field_value . '" />';
|
364 |
+
|
365 |
+
break;
|
366 |
+
|
367 |
+
case 'password':
|
368 |
+
$content .= '<input class="regular-text' . $field_class . '" type="password" id="' . $id . '" name="' . static::ID . '[' . $id . ']" value="' . $field_value . '" />';
|
369 |
+
|
370 |
+
if ( ! empty( $desc ) )
|
371 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
372 |
+
|
373 |
+
break;
|
374 |
+
|
375 |
+
case 'radio':
|
376 |
+
$i = 1;
|
377 |
+
$count_choices = count( $choices );
|
378 |
+
foreach ( $choices as $value => $label ) {
|
379 |
+
$content .= '<input class="radio' . $field_class . '" type="radio" name="' . static::ID . '[' . $id . ']" id="' . $id . $i . '" value="' . $value . '" ' . checked( $field_value, $value, false ) . '> <label for="' . $id . $i . '">' . $label . '</label>';
|
380 |
+
|
381 |
+
if ( $i < $count_choices )
|
382 |
+
$content .= '<br />';
|
383 |
+
|
384 |
+
$i++;
|
385 |
+
}
|
386 |
+
|
387 |
+
if ( ! empty( $desc ) )
|
388 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
389 |
+
|
390 |
+
if ( $show_code )
|
391 |
+
$content .= '<br /><code>' . $id . '</code>';
|
392 |
+
break;
|
393 |
+
|
394 |
+
case 'readonly':
|
395 |
+
$content .= '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . static::ID . '[' . $id . ']" value="' . $field_value . '" readonly="readonly" />';
|
396 |
+
|
397 |
+
if ( ! empty( $desc ) )
|
398 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
399 |
+
break;
|
400 |
+
|
401 |
+
case 'rich_editor':
|
402 |
+
global $wp_version;
|
403 |
+
|
404 |
+
$field_value = $options[$id];
|
405 |
+
|
406 |
+
if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) {
|
407 |
+
ob_start();
|
408 |
+
wp_editor( $field_value, static::ID . '[' . $id . ']', array( 'textarea_name' => static::ID . '[' . $id . ']' ) );
|
409 |
+
$content = ob_get_clean();
|
410 |
+
} else {
|
411 |
+
$content = '<textarea class="large-text" rows="10" id="' . static::ID . '[' . $id . ']" name="' . static::ID . '[' . $id . ']">' . esc_textarea( $field_value ) . '</textarea>';
|
412 |
+
}
|
413 |
+
|
414 |
+
if ( ! empty( $desc ) )
|
415 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
416 |
+
|
417 |
+
if ( $show_code )
|
418 |
+
$content .= '<br /><code>' . $id . '</code>';
|
419 |
+
break;
|
420 |
+
|
421 |
+
case 'select':
|
422 |
+
$content .= '<select class="select' . $field_class . '" id="' . $id . '" name="' . static::ID . '[' . $id . ']">';
|
423 |
+
|
424 |
+
foreach ( $choices as $value => $label )
|
425 |
+
$content .= '<option value="' . $value . '"' . selected( $field_value, $value, false ) . '>' . $label . '</option>';
|
426 |
+
|
427 |
+
$content .= '</select>';
|
428 |
+
|
429 |
+
if ( ! empty( $desc ) )
|
430 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
431 |
+
|
432 |
+
if ( $show_code )
|
433 |
+
$content .= '<br /><code>' . $id . '</code>';
|
434 |
+
break;
|
435 |
+
|
436 |
+
case 'text':
|
437 |
+
$content .= '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . static::ID . '[' . $id . ']" placeholder="' . $std . '" value="' . $field_value . '" />';
|
438 |
+
|
439 |
+
if ( ! empty( $desc ) )
|
440 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
441 |
+
|
442 |
+
if ( $show_code )
|
443 |
+
$content .= '<br /><code>' . $id . '</code>';
|
444 |
+
break;
|
445 |
+
|
446 |
+
case 'textarea':
|
447 |
+
$content .= '<textarea class="' . $field_class . '" id="' . $id . '" name="' . static::ID . '[' . $id . ']" placeholder="' . $std . '" rows="5" cols="30">' . $field_value . '</textarea>';
|
448 |
+
|
449 |
+
if ( ! empty( $desc ) )
|
450 |
+
$content .= '<br /><span class="description">' . $desc . '</span>';
|
451 |
+
|
452 |
+
if ( $show_code )
|
453 |
+
$content .= '<br /><code>' . $id . '</code>';
|
454 |
+
break;
|
455 |
+
|
456 |
+
default:
|
457 |
+
break;
|
458 |
+
}
|
459 |
+
|
460 |
+
if ( ! $do_echo )
|
461 |
+
return $content;
|
462 |
+
|
463 |
+
echo $content;
|
464 |
+
}
|
465 |
+
|
466 |
+
|
467 |
+
public static function register_settings() {
|
468 |
+
register_setting( static::ID, static::ID, array( static::$class, 'validate_settings' ) );
|
469 |
+
|
470 |
+
foreach ( static::$sections as $slug => $title ) {
|
471 |
+
if ( $slug == 'about' )
|
472 |
+
add_settings_section( $slug, $title, array( static::$class, 'display_about' ), static::ID );
|
473 |
+
else
|
474 |
+
add_settings_section( $slug, $title, array( static::$class, 'display_section' ), static::ID );
|
475 |
+
}
|
476 |
+
|
477 |
+
foreach ( static::$settings as $id => $setting ) {
|
478 |
+
$setting['id'] = $id;
|
479 |
+
static::create_setting( $setting );
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
|
484 |
+
public static function scripts() {
|
485 |
+
wp_enqueue_script( 'jquery-ui-tabs' );
|
486 |
+
}
|
487 |
+
|
488 |
+
|
489 |
+
public static function styles() {
|
490 |
+
wp_register_style( 'jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css' );
|
491 |
+
wp_enqueue_style( 'jquery-style' );
|
492 |
+
}
|
493 |
+
|
494 |
+
|
495 |
+
/**
|
496 |
+
*
|
497 |
+
*
|
498 |
+
* @SuppressWarnings(PHPMD.Superglobals)
|
499 |
+
*/
|
500 |
+
public static function validate_settings( $input, $options = null, $do_errors = false ) {
|
501 |
+
$errors = array();
|
502 |
+
|
503 |
+
$null_options = false;
|
504 |
+
if ( is_null( $options ) ) {
|
505 |
+
$null_options = true;
|
506 |
+
|
507 |
+
$defaults = static::get_defaults();
|
508 |
+
$options = self::get_settings();
|
509 |
+
|
510 |
+
if ( is_admin() ) {
|
511 |
+
if ( ! empty( $input['reset_defaults'] ) ) {
|
512 |
+
foreach ( $defaults as $id => $std )
|
513 |
+
$input[$id] = $std;
|
514 |
+
|
515 |
+
unset( $input['reset_defaults'] );
|
516 |
+
|
517 |
+
$input['resetted'] = true;
|
518 |
+
}
|
519 |
+
|
520 |
+
if ( ! empty( $input['import'] ) && $_SESSION['export'] != $input['import'] ) {
|
521 |
+
$import = $input['import'];
|
522 |
+
$unserialized = unserialize( $import );
|
523 |
+
if ( is_array( $unserialized ) ) {
|
524 |
+
foreach ( $unserialized as $id => $std )
|
525 |
+
$input[$id] = $std;
|
526 |
+
}
|
527 |
+
}
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
foreach ( $options as $id => $parts ) {
|
532 |
+
$default = $parts['std'];
|
533 |
+
$type = $parts['type'];
|
534 |
+
$validations = ! empty( $parts['validate'] ) ? $parts['validate'] : array();
|
535 |
+
if ( ! empty( $validations ) )
|
536 |
+
$validations = explode( ',', $validations );
|
537 |
+
|
538 |
+
if ( ! isset( $input[ $id ] ) ) {
|
539 |
+
if ( 'checkbox' != $type ) {
|
540 |
+
$input[ $id ] = $default;
|
541 |
+
} else {
|
542 |
+
$input[ $id ] = 0;
|
543 |
+
}
|
544 |
+
}
|
545 |
+
|
546 |
+
if ( $default == $input[ $id ] && ! in_array( 'required', $validations ) )
|
547 |
+
continue;
|
548 |
+
|
549 |
+
if ( 'checkbox' == $type ) {
|
550 |
+
if ( self::is_true( $input[ $id ] ) )
|
551 |
+
$input[ $id ] = 1;
|
552 |
+
else
|
553 |
+
$input[ $id ] = 0;
|
554 |
+
} elseif ( in_array( $type, array( 'radio', 'select' ) ) ) {
|
555 |
+
// single choices only
|
556 |
+
$keys = array_keys( $parts['choices'] );
|
557 |
+
|
558 |
+
if ( ! in_array( $input[ $id ], $keys ) ) {
|
559 |
+
if ( self::is_true( $input[ $id ] ) )
|
560 |
+
$input[ $id ] = 1;
|
561 |
+
else
|
562 |
+
$input[ $id ] = 0;
|
563 |
+
}
|
564 |
+
}
|
565 |
+
|
566 |
+
if ( ! empty( $validations ) ) {
|
567 |
+
foreach ( $validations as $validate )
|
568 |
+
self::validators( $validate, $id, $input, $default, $errors );
|
569 |
+
}
|
570 |
+
}
|
571 |
+
|
572 |
+
unset( $input['export'] );
|
573 |
+
unset( $input['import'] );
|
574 |
+
|
575 |
+
$hide_update_notice = false;
|
576 |
+
if ( isset( static::$hide_update_notice ) && ! empty( static::$hide_update_notice ) ) {
|
577 |
+
$hide_update_notice = true;
|
578 |
+
}
|
579 |
+
|
580 |
+
if ( $null_options && empty( $errors ) && ! $hide_update_notice ) {
|
581 |
+
add_settings_error( static::ID, 'settings_updated', esc_html__( 'Settings saved.' ), 'updated' );
|
582 |
+
set_transient( 'settings_errors', get_settings_errors(), 30 );
|
583 |
+
}
|
584 |
+
|
585 |
+
if ( empty( $do_errors ) ) {
|
586 |
+
$validated = $input;
|
587 |
+
} else {
|
588 |
+
$validated = array(
|
589 |
+
'input' => $input,
|
590 |
+
'errors' => $errors,
|
591 |
+
);
|
592 |
+
}
|
593 |
+
|
594 |
+
return $validated;
|
595 |
+
}
|
596 |
+
|
597 |
+
|
598 |
+
public static function validators( $validate, $id, &$input, $default, &$errors ) {
|
599 |
+
switch ( $validate ) {
|
600 |
+
case 'absint':
|
601 |
+
case 'intval':
|
602 |
+
if ( '' !== $input[ $id ] )
|
603 |
+
$input[ $id ] = $validate( $input[ $id ] );
|
604 |
+
else
|
605 |
+
$input[ $id ] = $default;
|
606 |
+
break;
|
607 |
+
|
608 |
+
case 'email':
|
609 |
+
$input[ $id ] = self::validate_email( $input[ $id ], $default );
|
610 |
+
break;
|
611 |
+
|
612 |
+
case 'ids':
|
613 |
+
$input[ $id ] = self::validate_ids( $input[ $id ], $default );
|
614 |
+
break;
|
615 |
+
|
616 |
+
case 'is_true':
|
617 |
+
$input[ $id ] = self::is_true( $input[ $id ] );
|
618 |
+
break;
|
619 |
+
|
620 |
+
case 'min1':
|
621 |
+
$input[ $id ] = intval( $input[ $id ] );
|
622 |
+
if ( 0 >= $input[ $id ] )
|
623 |
+
$input[ $id ] = $default;
|
624 |
+
break;
|
625 |
+
|
626 |
+
case 'nozero':
|
627 |
+
$input[ $id ] = intval( $input[ $id ] );
|
628 |
+
if ( 0 === $input[ $id ] )
|
629 |
+
$input[ $id ] = $default;
|
630 |
+
break;
|
631 |
+
|
632 |
+
case 'order':
|
633 |
+
$input[ $id ] = self::validate_order( $input[ $id ], $default );
|
634 |
+
break;
|
635 |
+
|
636 |
+
case 'required':
|
637 |
+
if ( empty( $input[ $id ] ) )
|
638 |
+
$errors[ $id ] = esc_html__( 'Required' );
|
639 |
+
break;
|
640 |
+
|
641 |
+
case 'slash_sanitize_title':
|
642 |
+
$temp = explode( '/', $input[ $id ] );
|
643 |
+
$temp = array_map( 'sanitize_title', $temp );
|
644 |
+
$temp = implode( '/', $temp );
|
645 |
+
|
646 |
+
$input[ $id ] = $temp;
|
647 |
+
break;
|
648 |
+
|
649 |
+
case 'slug':
|
650 |
+
$input[ $id ] = self::validate_slug( $input[ $id ], $default );
|
651 |
+
$input[ $id ] = strtolower( $input[ $id ] );
|
652 |
+
break;
|
653 |
+
|
654 |
+
case 'slugs':
|
655 |
+
$input[ $id ] = self::validate_slugs( $input[ $id ], $default );
|
656 |
+
$input[ $id ] = strtolower( $input[ $id ] );
|
657 |
+
break;
|
658 |
+
|
659 |
+
case 'term':
|
660 |
+
$input[ $id ] = self::validate_term( $input[ $id ], $default );
|
661 |
+
$input[ $id ] = strtolower( $input[ $id ] );
|
662 |
+
break;
|
663 |
+
|
664 |
+
case 'terms':
|
665 |
+
$input[ $id ] = self::validate_terms( $input[ $id ], $default );
|
666 |
+
break;
|
667 |
+
|
668 |
+
case 'trim':
|
669 |
+
$options = explode( "\n", $input[ $id ] );
|
670 |
+
foreach ( $options as $key => $value )
|
671 |
+
$options[ $key ] = trim( $value );
|
672 |
+
|
673 |
+
$input[ $id ] = implode( "\n", $options );
|
674 |
+
break;
|
675 |
+
|
676 |
+
case 'url':
|
677 |
+
$input[ $id ] = self::validate_url( $input[ $id ], $default );
|
678 |
+
break;
|
679 |
+
|
680 |
+
default:
|
681 |
+
$input[ $id ] = $validate( $input[ $id ] );
|
682 |
+
break;
|
683 |
+
}
|
684 |
+
}
|
685 |
+
|
686 |
+
|
687 |
+
public static function validate_ids( $input, $default = false ) {
|
688 |
+
if ( preg_match( '#^\d+(,\s?\d+)*$#', $input ) )
|
689 |
+
return preg_replace( '#\s#', '', $input );
|
690 |
+
|
691 |
+
return $default;
|
692 |
+
}
|
693 |
+
|
694 |
+
|
695 |
+
public static function validate_order( $input, $default = false ) {
|
696 |
+
if ( preg_match( '#^desc|asc$#i', $input ) )
|
697 |
+
return $input;
|
698 |
+
|
699 |
+
return $default;
|
700 |
+
}
|
701 |
+
|
702 |
+
|
703 |
+
public static function validate_slugs( $input, $default = false ) {
|
704 |
+
if ( preg_match( '#^[\w-]+(,\s?[\w-]+)*$#', $input ) )
|
705 |
+
return preg_replace( '#\s#', '', $input );
|
706 |
+
|
707 |
+
return $default;
|
708 |
+
}
|
709 |
+
|
710 |
+
|
711 |
+
public static function validate_slug( $input, $default = false ) {
|
712 |
+
if ( preg_match( '#^[\w-]+$#', $input ) )
|
713 |
+
return $input;
|
714 |
+
|
715 |
+
return $default;
|
716 |
+
}
|
717 |
+
|
718 |
+
|
719 |
+
public static function validate_term( $input, $default = false ) {
|
720 |
+
if ( preg_match( '#^\w+$#', $input ) )
|
721 |
+
return $input;
|
722 |
+
|
723 |
+
return $default;
|
724 |
+
}
|
725 |
+
|
726 |
+
|
727 |
+
/**
|
728 |
+
* Let values like true, 'true', 1, 'on', and 'yes' to be true. Else, false
|
729 |
+
*/
|
730 |
+
public static function is_true( $value = null, $return_boolean = true ) {
|
731 |
+
if ( true === $value || 'true' == strtolower( $value ) || 1 == $value || 'on' == strtolower( $value ) || 'yes' == strtolower( $value ) ) {
|
732 |
+
if ( $return_boolean )
|
733 |
+
return true;
|
734 |
+
else
|
735 |
+
return 1;
|
736 |
+
} else {
|
737 |
+
if ( $return_boolean )
|
738 |
+
return false;
|
739 |
+
else
|
740 |
+
return 0;
|
741 |
+
}
|
742 |
+
}
|
743 |
+
|
744 |
+
|
745 |
+
public static function validate_email( $input, $default = false ) {
|
746 |
+
if ( filter_var( $input, FILTER_VALIDATE_EMAIL ) )
|
747 |
+
return $input;
|
748 |
+
|
749 |
+
return $default;
|
750 |
+
}
|
751 |
+
|
752 |
+
|
753 |
+
public static function validate_terms( $input, $default = false ) {
|
754 |
+
if ( preg_match( '#^(([\w- ]+)(,\s?)?)+$#', $input ) )
|
755 |
+
return preg_replace( '#,\s*$#', '', $input );
|
756 |
+
|
757 |
+
return $default;
|
758 |
+
}
|
759 |
+
|
760 |
+
|
761 |
+
public static function validate_url( $input, $default = false ) {
|
762 |
+
if ( filter_var( $input, FILTER_VALIDATE_URL ) )
|
763 |
+
return $input;
|
764 |
+
|
765 |
+
return $default;
|
766 |
+
}
|
767 |
+
|
768 |
+
|
769 |
+
public static function get_scripts() {
|
770 |
+
foreach ( static::$scripts as $script )
|
771 |
+
echo $script;
|
772 |
+
}
|
773 |
+
|
774 |
+
|
775 |
+
public static function get_styles() {
|
776 |
+
foreach ( static::$styles as $style )
|
777 |
+
echo $style;
|
778 |
+
}
|
779 |
+
|
780 |
+
|
781 |
+
}
|
782 |
+
|
783 |
+
|
784 |
+
?>
|
includes/libraries/aihrus-framework/includes/class-aihrus-widget.php
ADDED
@@ -0,0 +1,252 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Widget' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
require_once 'interface-aihrus-widget.php';
|
23 |
+
|
24 |
+
|
25 |
+
abstract class Aihrus_Widget extends WP_Widget implements Aihrus_Widget_Interface {
|
26 |
+
public static $suggest_id = 0;
|
27 |
+
|
28 |
+
|
29 |
+
public function __construct( $classname, $description, $id_base, $title ) {
|
30 |
+
// Widget settings
|
31 |
+
$widget_ops = array(
|
32 |
+
'classname' => $classname,
|
33 |
+
'description' => $description,
|
34 |
+
);
|
35 |
+
|
36 |
+
// Widget control settings
|
37 |
+
$control_ops = array(
|
38 |
+
'id_base' => $id_base,
|
39 |
+
);
|
40 |
+
|
41 |
+
// Create the widget
|
42 |
+
$this->WP_Widget(
|
43 |
+
static::ID,
|
44 |
+
$title,
|
45 |
+
$widget_ops,
|
46 |
+
$control_ops
|
47 |
+
);
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
public function widget( $args, $instance ) {
|
52 |
+
global $before_widget, $before_title, $after_title, $after_widget;
|
53 |
+
|
54 |
+
$args = wp_parse_args( $args, static::get_defaults() );
|
55 |
+
extract( $args );
|
56 |
+
|
57 |
+
// Our variables from the widget settings
|
58 |
+
$title = apply_filters( 'widget_title', $instance['title'], null );
|
59 |
+
$content = static::get_content( $instance, $this->number );
|
60 |
+
|
61 |
+
// Before widget (defined by themes)
|
62 |
+
echo $before_widget;
|
63 |
+
|
64 |
+
if ( ! empty( $instance['title_link'] ) ) {
|
65 |
+
$target = ! empty( $instance['target'] ) ? $instance['target'] : null;
|
66 |
+
$title = Aihrus_Common::create_link( $instance['title_link'], $title, $target );
|
67 |
+
}
|
68 |
+
|
69 |
+
// Display the widget title if one was input (before and after defined by themes)
|
70 |
+
if ( ! empty( $title ) )
|
71 |
+
echo $before_title . $title . $after_title;
|
72 |
+
|
73 |
+
// Display Widget
|
74 |
+
echo $content;
|
75 |
+
|
76 |
+
// After widget (defined by themes)
|
77 |
+
echo $after_widget;
|
78 |
+
}
|
79 |
+
|
80 |
+
|
81 |
+
/**
|
82 |
+
*
|
83 |
+
*
|
84 |
+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
85 |
+
*/
|
86 |
+
|
87 |
+
|
88 |
+
public function update( $new_instance, $old_instance ) {
|
89 |
+
$instance = static::validate_settings( $new_instance );
|
90 |
+
|
91 |
+
return $instance;
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
public function form( $instance ) {
|
96 |
+
$instance = static::form_instance( $instance );
|
97 |
+
$defaults = static::get_defaults();
|
98 |
+
$instance = wp_parse_args( $instance, $defaults );
|
99 |
+
|
100 |
+
$form_parts = static::form_parts( $instance, $this->number );
|
101 |
+
foreach ( $form_parts as $key => $part ) {
|
102 |
+
$part[ 'id' ] = $key;
|
103 |
+
$this->display_setting( $part, $instance );
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
|
108 |
+
public static function widget_options( $options ) {
|
109 |
+
foreach ( $options as $id => $parts ) {
|
110 |
+
// remove non-widget parts
|
111 |
+
if ( empty( $parts['widget'] ) )
|
112 |
+
unset( $options[ $id ] );
|
113 |
+
}
|
114 |
+
|
115 |
+
return $options;
|
116 |
+
}
|
117 |
+
|
118 |
+
|
119 |
+
/**
|
120 |
+
*
|
121 |
+
*
|
122 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
123 |
+
*/
|
124 |
+
public function display_setting( $args = array(), $options ) {
|
125 |
+
extract( $args );
|
126 |
+
|
127 |
+
$do_return = false;
|
128 |
+
switch ( $type ) {
|
129 |
+
case 'heading':
|
130 |
+
if ( ! empty( $desc ) )
|
131 |
+
echo '<h3>' . $desc . '</h3>';
|
132 |
+
|
133 |
+
$do_return = true;
|
134 |
+
break;
|
135 |
+
|
136 |
+
case 'expand_all':
|
137 |
+
if ( ! empty( $desc ) )
|
138 |
+
echo '<h3>' . $desc . '</h3>';
|
139 |
+
|
140 |
+
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'.tw-collapsible-control\' ) . slideToggle(); jQuery( \'.tw-collapsible\' ) . slideToggle();">' . esc_html__( 'Expand/Collapse All Options' ) . ' »</a>';
|
141 |
+
|
142 |
+
$do_return = true;
|
143 |
+
break;
|
144 |
+
|
145 |
+
case 'expand_begin':
|
146 |
+
if ( ! empty( $desc ) )
|
147 |
+
echo '<h3>' . $desc . '</h3>';
|
148 |
+
|
149 |
+
echo '<a id="' . $this->get_field_id( $id ) . '" style="cursor:pointer;" onclick="jQuery( \'div#' . $this->get_field_id( $id ) . '\' ) . slideToggle();" class="tw-collapsible-control">' . esc_html__( 'Expand/Collapse' ) . ' »</a>';
|
150 |
+
echo '<div id="' . $this->get_field_id( $id ) . '" style="display:none" class="tw-collapsible">';
|
151 |
+
|
152 |
+
$do_return = true;
|
153 |
+
break;
|
154 |
+
|
155 |
+
case 'expand_end':
|
156 |
+
echo '</div>';
|
157 |
+
|
158 |
+
$do_return = true;
|
159 |
+
break;
|
160 |
+
|
161 |
+
default:
|
162 |
+
break;
|
163 |
+
}
|
164 |
+
|
165 |
+
if ( $do_return )
|
166 |
+
return;
|
167 |
+
|
168 |
+
if ( ! isset( $options[$id] ) && $type != 'checkbox' )
|
169 |
+
$options[$id] = $std;
|
170 |
+
elseif ( ! isset( $options[$id] ) )
|
171 |
+
$options[$id] = 0;
|
172 |
+
|
173 |
+
$field_class = '';
|
174 |
+
if ( ! empty( $class ) )
|
175 |
+
$field_class = ' ' . $class;
|
176 |
+
|
177 |
+
echo '<p>';
|
178 |
+
|
179 |
+
switch ( $type ) {
|
180 |
+
case 'checkbox':
|
181 |
+
echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $this->get_field_id( $id ) . '" name="' . $this->get_field_name( $id ) . '" value="1" ' . checked( $options[$id], 1, false ) . ' /> ';
|
182 |
+
|
183 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
184 |
+
break;
|
185 |
+
|
186 |
+
case 'select':
|
187 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
188 |
+
echo '<select id="' . $this->get_field_id( $id ) . '"class="select' . $field_class . '" name="' . $this->get_field_name( $id ) . '">';
|
189 |
+
|
190 |
+
foreach ( $choices as $value => $label )
|
191 |
+
echo '<option value="' . esc_attr( $value ) . '"' . selected( $options[$id], $value, false ) . '>' . $label . '</option>';
|
192 |
+
|
193 |
+
echo '</select>';
|
194 |
+
break;
|
195 |
+
|
196 |
+
case 'radio':
|
197 |
+
$i = 0;
|
198 |
+
$count_options = count( $options ) - 1;
|
199 |
+
|
200 |
+
foreach ( $choices as $value => $label ) {
|
201 |
+
echo '<input class="radio' . $field_class . '" type="radio" name="' . $this->get_field_name( $id ) . '" id="' . $this->get_field_name( $id . $i ) . '" value="' . esc_attr( $value ) . '" ' . checked( $options[$id], $value, false ) . '> <label for="' . $this->get_field_name( $id . $i ) . '">' . $label . '</label>';
|
202 |
+
if ( $i < $count_options )
|
203 |
+
echo '<br />';
|
204 |
+
$i++;
|
205 |
+
}
|
206 |
+
|
207 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
208 |
+
break;
|
209 |
+
|
210 |
+
case 'textarea':
|
211 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
212 |
+
|
213 |
+
echo '<textarea class="widefat' . $field_class . '" id="' . $this->get_field_id( $id ) . '" name="' . $this->get_field_name( $id ) . '" placeholder="' . $std . '" rows="5" cols="30">' . wp_htmledit_pre( $options[$id] ) . '</textarea>';
|
214 |
+
break;
|
215 |
+
|
216 |
+
case 'password':
|
217 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
218 |
+
|
219 |
+
echo '<input class="widefat' . $field_class . '" type="password" id="' . $this->get_field_id( $id ) . '" name="' . $this->get_field_name( $id ) . '" value="' . esc_attr( $options[$id] ) . '" />';
|
220 |
+
break;
|
221 |
+
|
222 |
+
case 'readonly':
|
223 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
224 |
+
|
225 |
+
echo '<input class="widefat' . $field_class . '" type="text" id="' . $this->get_field_id( $id ) . '" name="' . $this->get_field_name( $id ) . '" value="' . esc_attr( $options[$id] ) . '" readonly="readonly" />';
|
226 |
+
break;
|
227 |
+
|
228 |
+
case 'text':
|
229 |
+
echo '<label for="' . $this->get_field_id( $id ) . '">' . $title . '</label>';
|
230 |
+
|
231 |
+
$suggest_id = 'suggest_' . self::$suggest_id++;
|
232 |
+
echo '<input class="widefat' . $field_class . ' ' . $suggest_id . '" type="text" id="' . $this->get_field_id( $id ) . '" name="' . $this->get_field_name( $id ) . '" placeholder="' . $std . '" value="' . esc_attr( $options[$id] ) . '" />';
|
233 |
+
|
234 |
+
if ( $suggest )
|
235 |
+
echo static::get_suggest( $id, $suggest_id );
|
236 |
+
break;
|
237 |
+
|
238 |
+
default:
|
239 |
+
break;
|
240 |
+
}
|
241 |
+
|
242 |
+
if ( ! empty( $desc ) )
|
243 |
+
echo '<br /><span class="setting-description"><small>' . $desc . '</small></span>';
|
244 |
+
|
245 |
+
echo '</p>';
|
246 |
+
}
|
247 |
+
|
248 |
+
|
249 |
+
}
|
250 |
+
|
251 |
+
|
252 |
+
?>
|
{lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-common.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
{lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-licensing.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
{lib/aihrus → includes/libraries/aihrus-framework/includes}/interface-aihrus-widget.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
includes/libraries/aihrus-framework/includes/libraries/class-redrokk-metabox-class.php
ADDED
@@ -0,0 +1,1470 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @Author Anonymous
|
6 |
+
* @link http://www.redrokk.com
|
7 |
+
* @Package Wordpress
|
8 |
+
* @SubPackage RedRokk Library
|
9 |
+
*
|
10 |
+
* @version 2.0
|
11 |
+
*/
|
12 |
+
|
13 |
+
|
14 |
+
//security
|
15 |
+
defined( 'ABSPATH' ) or die( 'You\'re not supposed to be here.' );
|
16 |
+
|
17 |
+
/**
|
18 |
+
*
|
19 |
+
*
|
20 |
+
* @author Anonymous
|
21 |
+
* @example
|
22 |
+
* $gallery = redrokk_metabox_class::getInstance('gallery');
|
23 |
+
*/
|
24 |
+
if ( !class_exists( 'redrokk_metabox_class' ) ):
|
25 |
+
class redrokk_metabox_class {
|
26 |
+
|
27 |
+
/**
|
28 |
+
* HTML 'id' attribute of the edit screen section
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
+
var $_id;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Save the form fields here that will be displayed to the user
|
36 |
+
*
|
37 |
+
* @var array
|
38 |
+
*/
|
39 |
+
var $_fields;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Title of the edit screen section, visible to user
|
43 |
+
* Default: None
|
44 |
+
*
|
45 |
+
* @var string
|
46 |
+
*/
|
47 |
+
var $title;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Function that prints out the HTML for the edit screen section. Pass
|
51 |
+
* function name as a string. Within a class, you can instead pass an
|
52 |
+
* array to call one of the class's methods. See the second example under
|
53 |
+
* Example below.
|
54 |
+
* Default: None
|
55 |
+
*
|
56 |
+
* @var callback
|
57 |
+
*/
|
58 |
+
var $callback = null;
|
59 |
+
|
60 |
+
/**
|
61 |
+
* The part of the page where the edit screen section should be shown
|
62 |
+
* ('normal', 'advanced', or 'side'). (Note that 'side' doesn't exist before 2.7)
|
63 |
+
* Default: 'advanced'
|
64 |
+
*
|
65 |
+
* @var string
|
66 |
+
*/
|
67 |
+
var $context = 'normal';
|
68 |
+
|
69 |
+
/**
|
70 |
+
* The priority within the context where the boxes should show
|
71 |
+
* ('high', 'core', 'default' or 'low')
|
72 |
+
* Default: 'default'
|
73 |
+
*
|
74 |
+
* @var string
|
75 |
+
*/
|
76 |
+
var $priority = 'default';
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Arguments to pass into your callback function. The callback will receive the
|
80 |
+
* $post object and whatever parameters are passed through this variable.
|
81 |
+
* Default: null
|
82 |
+
*
|
83 |
+
* @var array
|
84 |
+
*/
|
85 |
+
var $callback_args;
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Prebuilt metaboxes can be activated by using this type
|
89 |
+
* Default: default
|
90 |
+
*
|
91 |
+
* (options:)
|
92 |
+
* default
|
93 |
+
* images
|
94 |
+
*
|
95 |
+
* @var string
|
96 |
+
*/
|
97 |
+
var $_type;
|
98 |
+
|
99 |
+
/**
|
100 |
+
*
|
101 |
+
*
|
102 |
+
* @var unknown_type
|
103 |
+
*/
|
104 |
+
var $_category_name;
|
105 |
+
|
106 |
+
/**
|
107 |
+
* The type of Write screen on which to show the edit screen section
|
108 |
+
* ('post', 'page', 'link', or 'custom_post_type' where custom_post_type
|
109 |
+
* is the custom post type slug)
|
110 |
+
* Default: None
|
111 |
+
*
|
112 |
+
* @var array
|
113 |
+
*/
|
114 |
+
var $_object_types = array();
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Whether or not to make the fields available as wp-options
|
118 |
+
*
|
119 |
+
* @var bool
|
120 |
+
*/
|
121 |
+
var $_isAdminPage = false;
|
122 |
+
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Constructor.
|
126 |
+
*
|
127 |
+
*/
|
128 |
+
function __construct( $options = array() ) {
|
129 |
+
//initializing
|
130 |
+
$this->setProperties( $options );
|
131 |
+
$this->setOptionHooks();
|
132 |
+
|
133 |
+
if ( !$this->callback ) {
|
134 |
+
$this->callback = array( $this, 'show' );
|
135 |
+
}
|
136 |
+
if ( !$this->title ) {
|
137 |
+
$this->title = ucfirst( $this->_id );
|
138 |
+
}
|
139 |
+
|
140 |
+
//registering this metabox
|
141 |
+
add_action( 'add_meta_boxes', array( $this, '_register' ) );
|
142 |
+
|
143 |
+
// backwards compatible (before WP 3.0)
|
144 |
+
// add_action( 'admin_init', array($this, '_register'), 1 );
|
145 |
+
|
146 |
+
add_action( 'save_post', array( $this, '_save' ) );
|
147 |
+
add_filter( 'wp_redirect', array( $this, '_redirectIntervention' ), 40, 1 );
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Method properly inturprets the given parameter and sets it accordingly
|
153 |
+
*
|
154 |
+
* @param string|object $value
|
155 |
+
*/
|
156 |
+
function setObjectTypes( $value ) {
|
157 |
+
if ( is_a( $value, 'redrokk_post_class' ) ) {
|
158 |
+
$value = $value->_post_type;
|
159 |
+
}
|
160 |
+
if ( is_a( $value, 'redrokk_admin_class' ) ) {
|
161 |
+
$value = $value->id;
|
162 |
+
$this->_isAdminPage = $value;
|
163 |
+
}
|
164 |
+
if ( is_array( $value ) ) {
|
165 |
+
foreach ( $value as $v )
|
166 |
+
$this->_object_types[] = $v;
|
167 |
+
return $this;
|
168 |
+
}
|
169 |
+
|
170 |
+
$this->_object_types[] = $value;
|
171 |
+
return $this;
|
172 |
+
}
|
173 |
+
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Method is designed to return the currently visible post type
|
177 |
+
*/
|
178 |
+
function getCurrentPostType() {
|
179 |
+
$post_type = false;
|
180 |
+
if ( isset( $_REQUEST['post_type'] ) ) {
|
181 |
+
$post_type = $_REQUEST['post_type'];
|
182 |
+
}
|
183 |
+
elseif ( isset( $_REQUEST['post'] ) ) {
|
184 |
+
$post = get_post( $_REQUEST['post'] );
|
185 |
+
$post_type = $post->post_type;
|
186 |
+
}
|
187 |
+
elseif ( isset( $_REQUEST['page'] ) ) {
|
188 |
+
$post_type = $_REQUEST['page'];
|
189 |
+
}
|
190 |
+
|
191 |
+
return $post_type;
|
192 |
+
}
|
193 |
+
|
194 |
+
|
195 |
+
/**
|
196 |
+
* Method properly prepares the metabox type by binding the necessary hooks
|
197 |
+
*
|
198 |
+
* @param mixed $value
|
199 |
+
*/
|
200 |
+
function settype( $value = 'default' ) {
|
201 |
+
$this->_type = $value;
|
202 |
+
|
203 |
+
switch ( $this->_type ) {
|
204 |
+
default:
|
205 |
+
case 'default':
|
206 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderForm' ), 20, 1 );
|
207 |
+
add_action( 'metabox-save-'.$this->_id, array( $this, 'saveAsPostMeta' ), 10, 2 );
|
208 |
+
break;
|
209 |
+
case 'image':
|
210 |
+
case 'images':
|
211 |
+
$this->_fields = array(
|
212 |
+
array(
|
213 |
+
'name' => 'New Image',
|
214 |
+
'type' => 'title',
|
215 |
+
),
|
216 |
+
array(
|
217 |
+
'name' => 'Image Title',
|
218 |
+
'id' => $this->_id.'_post_title',
|
219 |
+
'type' => 'text',
|
220 |
+
),
|
221 |
+
array(
|
222 |
+
'name' => 'Description',
|
223 |
+
'id' => $this->_id.'_post_content',
|
224 |
+
'type' => 'textarea',
|
225 |
+
),
|
226 |
+
array(
|
227 |
+
'name' => 'Image File',
|
228 |
+
'id' => $this->_id.'_image',
|
229 |
+
'type' => 'image',
|
230 |
+
),
|
231 |
+
array(
|
232 |
+
'name' => 'Save Image',
|
233 |
+
'type' => 'submit',
|
234 |
+
),
|
235 |
+
);
|
236 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderListImageAttachments' ), 20, 1 );
|
237 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderForm' ), 20, 1 );
|
238 |
+
add_action( 'metabox-save-'.$this->_id, array( $this, 'saveAsAttachment' ), 1, 2 );
|
239 |
+
break;
|
240 |
+
case 'video':
|
241 |
+
case 'videos':
|
242 |
+
$this->_fields = array(
|
243 |
+
array(
|
244 |
+
'name' => 'New Video',
|
245 |
+
'type' => 'title',
|
246 |
+
),
|
247 |
+
array(
|
248 |
+
'name' => 'Video Title',
|
249 |
+
'id' => $this->_id.'_post_title',
|
250 |
+
'type' => 'text',
|
251 |
+
),
|
252 |
+
array(
|
253 |
+
'name' => 'Description',
|
254 |
+
'id' => $this->_id.'_post_content',
|
255 |
+
'type' => 'textarea',
|
256 |
+
),
|
257 |
+
array(
|
258 |
+
'name' => 'Video File',
|
259 |
+
'id' => $this->_id.'_image',
|
260 |
+
'type' => 'image',
|
261 |
+
),
|
262 |
+
array(
|
263 |
+
'name' => 'Video Link',
|
264 |
+
'id' => $this->_id.'_link',
|
265 |
+
'type' => 'text',
|
266 |
+
),
|
267 |
+
array(
|
268 |
+
'name' => '_videocat',
|
269 |
+
'id' => $this->_id.'_videocat',
|
270 |
+
'default'=>$this->getCategory(),
|
271 |
+
'type' => 'hidden',
|
272 |
+
),
|
273 |
+
array(
|
274 |
+
'name' => '_metaid',
|
275 |
+
'id' => $this->_id.'_metaid',
|
276 |
+
'type' => 'hidden',
|
277 |
+
),
|
278 |
+
array(
|
279 |
+
'name' => 'Save Video',
|
280 |
+
'type' => 'submit',
|
281 |
+
),
|
282 |
+
);
|
283 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderListAttachments' ), 20, 1 );
|
284 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderListVideoAttachments' ), 20, 1 );
|
285 |
+
add_action( 'metabox-show-'.$this->_id, array( $this, '_renderForm' ), 20, 1 );
|
286 |
+
add_action( 'metabox-save-'.$this->_id, array( $this, 'saveAsPostMeta' ), 1, 2 );
|
287 |
+
break;
|
288 |
+
}
|
289 |
+
}
|
290 |
+
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Returns the category to use
|
294 |
+
*/
|
295 |
+
function getCategory() {
|
296 |
+
return isset( $this->_category_name )
|
297 |
+
? $this->_category_name
|
298 |
+
: '_videocat';
|
299 |
+
}
|
300 |
+
|
301 |
+
|
302 |
+
/**
|
303 |
+
* Method will save the posted content as an image attachment
|
304 |
+
*
|
305 |
+
*/
|
306 |
+
function saveAsAttachment( $source, $post_id ) {
|
307 |
+
if ( empty( $_FILES ) || !isset( $_REQUEST[$this->_id.'files'] ) ) return $source;
|
308 |
+
|
309 |
+
// initializing
|
310 |
+
$property = $_REQUEST[$this->_id.'files'];
|
311 |
+
$post_data = array();
|
312 |
+
|
313 |
+
if ( isset( $source[$this->_id.'_post_title'] ) && $source[$this->_id.'_post_title'] ) {
|
314 |
+
$post_data['post_title'] = $source[$this->_id.'_post_title'];
|
315 |
+
}
|
316 |
+
|
317 |
+
if ( isset( $source[$this->_id.'_post_content'] ) && $source[$this->_id.'_post_content'] ) {
|
318 |
+
$post_data['post_content'] = $source[$this->_id.'_post_content'];
|
319 |
+
}
|
320 |
+
|
321 |
+
$id = media_handle_upload( $property, $post_id, $post_data );
|
322 |
+
$source[$property] = $id;
|
323 |
+
|
324 |
+
$type = 'post';
|
325 |
+
if ( $this->getCurrentPostType() ) {
|
326 |
+
$type = $this->getCurrentPostType();
|
327 |
+
}
|
328 |
+
|
329 |
+
//saving the attachment ID to the taxonomy
|
330 |
+
if ( !in_array( $type, get_post_types( array( 'public' => false ) ) ) ) {
|
331 |
+
$old = get_metadata( $type, $post_id, $property, true );
|
332 |
+
if ( $id && $id != $old ) {
|
333 |
+
wp_delete_attachment( $old, true );
|
334 |
+
update_metadata( $type, $post_id, $property, $id );
|
335 |
+
}
|
336 |
+
}
|
337 |
+
|
338 |
+
foreach ( (array)$source as $property => $new ) {
|
339 |
+
//skip everything but the specially prefixed
|
340 |
+
if ( strpos( $property, $this->_id ) !== 0 ) continue;
|
341 |
+
if ( in_array( $property, array(
|
342 |
+
$this->_id.'_post_title',
|
343 |
+
$this->_id.'_post_content',
|
344 |
+
) ) ) continue;
|
345 |
+
|
346 |
+
$old = get_metadata( $type, $id, $property, true );
|
347 |
+
if ( $new && $new != $old ) {
|
348 |
+
update_metadata( $type, $id, $property, $new );
|
349 |
+
}
|
350 |
+
elseif ( !$new ) {
|
351 |
+
delete_metadata( $type, $id, $property, $old );
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
return $source;
|
356 |
+
}
|
357 |
+
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Method saves the data provided as post meta values
|
361 |
+
*
|
362 |
+
* @param array $source
|
363 |
+
* @param integer $post_id
|
364 |
+
*/
|
365 |
+
function saveAsPostMeta( $source, $post_id ) {
|
366 |
+
$type = 'post';
|
367 |
+
if ( !$this->getCurrentPostType() ) {
|
368 |
+
$type = $this->_table;
|
369 |
+
}
|
370 |
+
|
371 |
+
//save as a file
|
372 |
+
//if there's no FILES then we save as a meta
|
373 |
+
$source = $this->saveAsAttachment( $source, $post_id );
|
374 |
+
|
375 |
+
//get the ID of this meta set
|
376 |
+
$id = false;
|
377 |
+
if ( isset( $source[$this->_id.'_metaid'] ) && $source[$this->_id.'_metaid'] ) {
|
378 |
+
$id = $source[$this->_id.'_metaid'];
|
379 |
+
}
|
380 |
+
|
381 |
+
// if this is a built in metabox
|
382 |
+
if ( $this->_type != 'default'
|
383 |
+
&& ( !isset( $source[$this->_id.'_image'] ) || !$source[$this->_id.'_image'] ) )
|
384 |
+
return false;
|
385 |
+
|
386 |
+
// Saving only the specially prefixed items
|
387 |
+
foreach ( (array)$source as $property => $new ) {
|
388 |
+
//skip everything but the specially prefixed
|
389 |
+
if ( strpos( $property, $this->_id ) !== 0 ) continue;
|
390 |
+
|
391 |
+
//each meta set has it's own ID
|
392 |
+
$property = str_replace( $this->_id, $this->_category_name.'_'.$id, $property );
|
393 |
+
|
394 |
+
$old = get_metadata( $type, $post_id, $property, true );
|
395 |
+
if ( $new && $new != $old ) {
|
396 |
+
update_metadata( $type, $post_id, $property, $new );
|
397 |
+
}
|
398 |
+
elseif ( !$new ) {
|
399 |
+
delete_metadata( $type, $post_id, $property, $old );
|
400 |
+
}
|
401 |
+
}
|
402 |
+
|
403 |
+
// maybe there's a last id
|
404 |
+
if ( !$id ) {
|
405 |
+
if ( !$id = get_metadata( $type, $post_id, '_metaidlast', true ) ) {
|
406 |
+
$id = 0;
|
407 |
+
}
|
408 |
+
$id++;
|
409 |
+
update_metadata( $type, $post_id, '_metaidlast', $id );
|
410 |
+
}
|
411 |
+
|
412 |
+
// saving all of the standard items
|
413 |
+
foreach ( (array)$source as $property => $new ) {
|
414 |
+
//skip special properties that are prefixed with the id
|
415 |
+
if ( strpos( $property, $this->_id ) === 0 ) continue;
|
416 |
+
|
417 |
+
$old = get_metadata( $type, $post_id, $property, true );
|
418 |
+
update_metadata( $type, $post_id, $property, $new );
|
419 |
+
|
420 |
+
// if ($new && $new != $old) {
|
421 |
+
// update_metadata($type, $post_id, $property, $new);
|
422 |
+
// }
|
423 |
+
// elseif (!$new) {
|
424 |
+
// delete_metadata($type, $post_id, $property, $old);
|
425 |
+
// }
|
426 |
+
|
427 |
+
}
|
428 |
+
|
429 |
+
return true;
|
430 |
+
}
|
431 |
+
|
432 |
+
|
433 |
+
/**
|
434 |
+
* Do something with the data entered
|
435 |
+
*
|
436 |
+
* @param integer $post_id
|
437 |
+
*/
|
438 |
+
function _save( $post_id ) {
|
439 |
+
//initializing
|
440 |
+
$post = get_post( $post_id );
|
441 |
+
|
442 |
+
// verify if this is an auto save routine.
|
443 |
+
// If it is our form has not been submitted, so we dont want to do anything
|
444 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
445 |
+
return;
|
446 |
+
|
447 |
+
// verify this came from the our screen and with proper authorization,
|
448 |
+
// because save_post can be triggered at other times
|
449 |
+
if ( !isset( $_REQUEST[ get_class().$this->_id ] ) )
|
450 |
+
return;
|
451 |
+
|
452 |
+
if ( !wp_verify_nonce( $_REQUEST[ get_class().$this->_id ], plugin_basename( __FILE__ ) ) )
|
453 |
+
return;
|
454 |
+
|
455 |
+
// this metabox is to be displayed for a certain object type only
|
456 |
+
if ( !in_array( $post->post_type, $this->_object_types ) )
|
457 |
+
return;
|
458 |
+
|
459 |
+
// Check permissions
|
460 |
+
if ( 'page' == $post->post_type ) {
|
461 |
+
if ( !current_user_can( 'edit_page', $post->ID ) )
|
462 |
+
return;
|
463 |
+
}
|
464 |
+
else {
|
465 |
+
if ( !current_user_can( 'edit_post', $post->ID ) )
|
466 |
+
return;
|
467 |
+
}
|
468 |
+
|
469 |
+
//saving the request data
|
470 |
+
if ( !$this->_type ) $this->setType();
|
471 |
+
do_action( 'metabox-save-'.$this->_id, $this->getRequestPostMetas(), $post->ID, $this );
|
472 |
+
return true;
|
473 |
+
}
|
474 |
+
|
475 |
+
|
476 |
+
/**
|
477 |
+
* Method returns the post meta
|
478 |
+
*
|
479 |
+
*/
|
480 |
+
function getRequestPostMetas() {
|
481 |
+
$ignores = array( 'post_title', 'post_name', 'post_content', 'post_excerpt', 'post',
|
482 |
+
'post_status', 'post_type', 'post_author', 'ping_status', 'post_parent', 'message',
|
483 |
+
'post_category', 'comment_status', 'menu_order', 'to_ping', 'pinged', 'post_password',
|
484 |
+
'guid', 'post_content_filtered', 'import_id', 'post_date', 'post_date_gmt', 'tags_input',
|
485 |
+
'action' );
|
486 |
+
|
487 |
+
$fields = array();
|
488 |
+
foreach ( (array)$this->_fields as $field ) {
|
489 |
+
if ( !array_key_exists( 'id', $field ) ) continue;
|
490 |
+
$fields[] = $field['id'];
|
491 |
+
}
|
492 |
+
|
493 |
+
$requests = $_REQUEST;
|
494 |
+
foreach ( (array)$requests as $k => $request ) {
|
495 |
+
if ( ( !empty( $fields ) && !in_array( $k, $fields ) )
|
496 |
+
|| ( in_array( $k, $ignores ) || strpos( $k, 'nounce' ) !== false ) ) {
|
497 |
+
unset( $requests[$k] );
|
498 |
+
}
|
499 |
+
}
|
500 |
+
|
501 |
+
return apply_filters( 'metabox-requests-'.$this->_id, $requests );
|
502 |
+
}
|
503 |
+
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Display the inner contents of the metabox
|
507 |
+
*
|
508 |
+
* @param object $post
|
509 |
+
*/
|
510 |
+
function show( $post ) {
|
511 |
+
// Use nonce for verification
|
512 |
+
wp_nonce_field( plugin_basename( __FILE__ ), get_class().$this->_id );
|
513 |
+
do_action( 'metabox-show-'.$this->_id, $this->_fields, $this );
|
514 |
+
}
|
515 |
+
|
516 |
+
|
517 |
+
/**
|
518 |
+
* Method displays a list of attached images
|
519 |
+
*
|
520 |
+
*/
|
521 |
+
function _renderListImageAttachments() {
|
522 |
+
global $post, $current_screen;
|
523 |
+
$images = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image" );
|
524 |
+
|
525 |
+
// no images to render
|
526 |
+
if ( empty( $images ) ) {
|
527 |
+
?><p>No images have been saved.</p><?php
|
528 |
+
|
529 |
+
// rendering the images
|
530 |
+
} else {
|
531 |
+
|
532 |
+
?>
|
533 |
+
<table class="wp-list-table form-table widefat" style="border:none;">
|
534 |
+
<?php foreach ( (array)$images as $post_id => $image ): ?>
|
535 |
+
<?php $image_attributes = wp_get_attachment_image_src( $image->ID, 'thumbnail' ); ?>
|
536 |
+
<tbody id="the-list">
|
537 |
+
<tr>
|
538 |
+
<th scope="row" style="width: 140px">
|
539 |
+
<div style="padding:10px;background:whiteSmoke;">
|
540 |
+
<img src="<?php echo wp_get_attachment_thumb_url( $image->ID ); ?>" /></div>
|
541 |
+
</th>
|
542 |
+
<td>
|
543 |
+
<b><?php echo $image->post_title; ?></b>
|
544 |
+
<p><?php echo get_the_content( $image->ID ); ?></p>
|
545 |
+
|
546 |
+
<div class="row-actions">
|
547 |
+
<span class="inline">
|
548 |
+
<a href="<?php echo wp_nonce_url(
|
549 |
+
"media.php?attachment_id=$image->ID"
|
550 |
+
."&action=edit&_redirect="
|
551 |
+
.urlencode( $this->_currentPageURL() )
|
552 |
+
); ?>">
|
553 |
+
Edit</a> |
|
554 |
+
</span>
|
555 |
+
<span class="trash">
|
556 |
+
<a class="submitdelete"
|
557 |
+
onclick="return showNotice.warn();"
|
558 |
+
href="<?php echo wp_nonce_url(
|
559 |
+
"post.php?action=delete&_redirect="
|
560 |
+
.urlencode( $this->_currentPageURL() )
|
561 |
+
."&post=$image->ID",
|
562 |
+
'delete-attachment_' . $image->ID ); ?>">
|
563 |
+
Delete Permanently</a> |
|
564 |
+
</span>
|
565 |
+
<span class="inline">
|
566 |
+
<a target="_blank"
|
567 |
+
href="<?php echo get_attachment_link( $image->ID ); ?>">
|
568 |
+
View</a>
|
569 |
+
</span>
|
570 |
+
</div>
|
571 |
+
</td>
|
572 |
+
</tr>
|
573 |
+
</tbody>
|
574 |
+
<?php endforeach; ?>
|
575 |
+
</table>
|
576 |
+
<?php
|
577 |
+
}
|
578 |
+
return;
|
579 |
+
}
|
580 |
+
|
581 |
+
|
582 |
+
/**
|
583 |
+
* Return a clean list of meta listings created by this system
|
584 |
+
*
|
585 |
+
* @param string $category
|
586 |
+
* $param object $post
|
587 |
+
*/
|
588 |
+
public static function getMetaListings( $category, $post = null ) {
|
589 |
+
// initializing
|
590 |
+
if ( $post === NULL ) {
|
591 |
+
global $post;
|
592 |
+
}
|
593 |
+
$custom = get_post_custom( $post->ID );
|
594 |
+
$return = array();
|
595 |
+
|
596 |
+
//looping all values to build our return array
|
597 |
+
foreach ( (array)$custom as $property => $value ) {
|
598 |
+
$parts = explode( '_', $property );
|
599 |
+
if ( !isset( $parts[0] ) || !isset( $parts[1] ) || !isset( $parts[2] ) ) continue;
|
600 |
+
if ( $parts[0] != $category ) continue;
|
601 |
+
|
602 |
+
$pro = str_replace( $parts[0].'_'.$parts[1].'_', '', $property );
|
603 |
+
$return[$parts[1]][$pro] = $value;
|
604 |
+
}
|
605 |
+
|
606 |
+
return $return;
|
607 |
+
}
|
608 |
+
|
609 |
+
|
610 |
+
/**
|
611 |
+
* Function removes a specific category meta
|
612 |
+
*
|
613 |
+
* @param string $category
|
614 |
+
* $param string $meta_id
|
615 |
+
* $param object $post
|
616 |
+
*/
|
617 |
+
public static function deleteMetaListing( $category, $meta_id, $post = null ) {
|
618 |
+
// initializing
|
619 |
+
if ( $post === NULL ) {
|
620 |
+
global $post;
|
621 |
+
}
|
622 |
+
$listings = redrokk_metabox_class::getMetaListings( $category, $post );
|
623 |
+
if ( !isset( $listings[$meta_id] ) ) return false;
|
624 |
+
|
625 |
+
$type = 'post';
|
626 |
+
|
627 |
+
foreach ( (array)$listings[$meta_id] as $property => $value ) {
|
628 |
+
$pro = $category.'_'.$meta_id.'_'.$property;
|
629 |
+
delete_metadata( $type, $post->ID, $pro, $value[0] );
|
630 |
+
}
|
631 |
+
return true;
|
632 |
+
}
|
633 |
+
|
634 |
+
|
635 |
+
/**
|
636 |
+
* Method displays a list of meta attachments
|
637 |
+
*
|
638 |
+
*/
|
639 |
+
function _renderListAttachments() {
|
640 |
+
global $post;
|
641 |
+
|
642 |
+
//delete action prior to pulling new listings
|
643 |
+
if ( isset( $_REQUEST['redrokkdelete'] ) && $_REQUEST['redrokkdelete'] ) {
|
644 |
+
redrokk_metabox_class::deleteMetaListing( $this->_category_name, $_REQUEST['redrokkdelete'], $post );
|
645 |
+
}
|
646 |
+
|
647 |
+
//pull new listings
|
648 |
+
$metaListings = redrokk_metabox_class::getMetaListings( $this->_category_name, $post );
|
649 |
+
|
650 |
+
if ( !empty( $metaListings ) ) {
|
651 |
+
?>
|
652 |
+
<table class="wp-list-table form-table widefat" style="border:none;">
|
653 |
+
<tbody id="the-list">
|
654 |
+
<?php foreach ( (array)$metaListings as $meta_id => $video ): ?>
|
655 |
+
<?php $video = apply_filters( 'redrokk_metabox_class::_renderListAttachments', $video, $meta_id );?>
|
656 |
+
|
657 |
+
<tr id="<?php echo $this->_category_name; ?>_<?php echo $meta_id; ?>">
|
658 |
+
<th scope="row" style="width: 140px">
|
659 |
+
<div style="padding:10px;background:whiteSmoke;">
|
660 |
+
<?php if ( isset( $video['link'] ) ) echo apply_filters( 'the_content', $video['link'][0] ); ?>
|
661 |
+
</div>
|
662 |
+
</th>
|
663 |
+
<td>
|
664 |
+
<b><?php if ( isset( $video['post_title'] ) ) echo $video['post_title'][0]; ?></b>
|
665 |
+
<p><?php if ( isset( $video['post_content'] ) ) echo $video['post_content'][0]; ?></p>
|
666 |
+
|
667 |
+
<div class="row-actions">
|
668 |
+
<span class="inline">
|
669 |
+
<a href="#" id="edit_<?php echo $this->_category_name; ?>_<?php echo $meta_id; ?>">
|
670 |
+
Edit</a> |
|
671 |
+
</span>
|
672 |
+
<span class="trash">
|
673 |
+
<a class="submitdelete"
|
674 |
+
onclick="return showNotice.warn();"
|
675 |
+
href="<?php echo site_url( "wp-admin/post.php?post={$post->ID}"
|
676 |
+
."&action=edit"
|
677 |
+
."&redrokkdelete=$meta_id"
|
678 |
+
); ?>">
|
679 |
+
Delete Permanently</a>
|
680 |
+
</span>
|
681 |
+
</div>
|
682 |
+
<script>
|
683 |
+
jQuery('#edit_<?php echo $this->_category_name; ?>_<?php echo $meta_id; ?>').click(function(){
|
684 |
+
var data = {
|
685 |
+
<?php
|
686 |
+
$data = array();
|
687 |
+
|
688 |
+
//making sure all fields will be cleared
|
689 |
+
foreach ( (array)$this->_fields as $field ) {
|
690 |
+
if ( !isset( $field['id'] ) || !isset( $field['type'] ) ) continue;
|
691 |
+
if ( !in_array( $field['type'], array( 'text', 'file', 'image', 'textarea', 'hidden' ) ) )
|
692 |
+
continue;
|
693 |
+
|
694 |
+
$id = str_replace( $this->_id.'_', '', $field['id'] );
|
695 |
+
$data[$id] = "'$id':''";
|
696 |
+
}
|
697 |
+
|
698 |
+
//adding our values to the array
|
699 |
+
foreach ( (array)$video as $vp => $vv ) {
|
700 |
+
if ( isset( $vv[0] ) ) $vv = $vv[0];
|
701 |
+
$data[$vp] = "'$vp':'$vv'";
|
702 |
+
}
|
703 |
+
|
704 |
+
//adding the meta ID to the array
|
705 |
+
$data[$id] = "'metaid':'$meta_id'";
|
706 |
+
|
707 |
+
echo implode( ',', $data );
|
708 |
+
?>
|
709 |
+
};
|
710 |
+
|
711 |
+
jQuery.each(data, function(key, value){
|
712 |
+
jQuery('#<?php echo $this->_id; ?>_'+key).val( value );
|
713 |
+
});
|
714 |
+
return false;
|
715 |
+
});
|
716 |
+
</script>
|
717 |
+
</td>
|
718 |
+
<?php do_action( 'redrokk_metabox_class::_renderListAttachments::rows', $video, $meta_id, $this ); ?>
|
719 |
+
</tr>
|
720 |
+
<?php endforeach; ?>
|
721 |
+
</tbody>
|
722 |
+
</table>
|
723 |
+
<?php
|
724 |
+
}
|
725 |
+
|
726 |
+
}
|
727 |
+
|
728 |
+
|
729 |
+
/**
|
730 |
+
* Method displays a list of attached videos
|
731 |
+
*
|
732 |
+
*/
|
733 |
+
function _renderListVideoAttachments() {
|
734 |
+
global $post;
|
735 |
+
|
736 |
+
//pull new listings
|
737 |
+
$videos = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=video/mp4" );
|
738 |
+
|
739 |
+
// no images to render
|
740 |
+
if ( !empty( $videos ) ) {
|
741 |
+
?>
|
742 |
+
<table class="wp-list-table form-table widefat" style="border:none;">
|
743 |
+
<tbody id="the-list">
|
744 |
+
<?php foreach ( (array)$videos as $post_id => $video ): ?>
|
745 |
+
<?php $image_attributes = wp_get_attachment_link( $video->ID ); ?>
|
746 |
+
<tr>
|
747 |
+
<th scope="row" style="width: 140px">
|
748 |
+
<div style="padding:10px;background:whiteSmoke;">
|
749 |
+
<?php echo $image_attributes; ?>
|
750 |
+
</div>
|
751 |
+
</th>
|
752 |
+
<td>
|
753 |
+
<b><?php echo $video->post_title; ?></b>
|
754 |
+
<p><?php echo get_the_content( $video->ID ); ?></p>
|
755 |
+
|
756 |
+
<div class="row-actions">
|
757 |
+
<span class="inline">
|
758 |
+
<a href="<?php echo wp_nonce_url(
|
759 |
+
"media.php?attachment_id=$meta_id"
|
760 |
+
."&action=edit&_redirect="
|
761 |
+
.urlencode( $this->_currentPageURL() )
|
762 |
+
); ?>">
|
763 |
+
Edit</a> |
|
764 |
+
</span>
|
765 |
+
<span class="trash">
|
766 |
+
<a class="submitdelete"
|
767 |
+
onclick="return showNotice.warn();"
|
768 |
+
href="<?php echo wp_nonce_url(
|
769 |
+
"post.php?action=delete&_redirect="
|
770 |
+
.urlencode( $this->_currentPageURL() )
|
771 |
+
."&post=$video->ID",
|
772 |
+
'delete-attachment_' . $video->ID ); ?>">
|
773 |
+
Delete Permanently</a>
|
774 |
+
</span>
|
775 |
+
</div>
|
776 |
+
</td>
|
777 |
+
</tr>
|
778 |
+
<?php endforeach; ?>
|
779 |
+
</tbody>
|
780 |
+
</table>
|
781 |
+
<?php
|
782 |
+
}
|
783 |
+
}
|
784 |
+
|
785 |
+
|
786 |
+
/**
|
787 |
+
* Method renders the form from any source
|
788 |
+
*
|
789 |
+
* @param array $fields
|
790 |
+
*/
|
791 |
+
function _renderForm( $fields = array() ) {
|
792 |
+
//initializing
|
793 |
+
global $post;
|
794 |
+
$defaults = array(
|
795 |
+
'name' => '',
|
796 |
+
'desc' => '',
|
797 |
+
'id' => '',
|
798 |
+
'type' => 'text',
|
799 |
+
'options' => array(),
|
800 |
+
'default' => '',
|
801 |
+
'value' => '',
|
802 |
+
'class' => '',
|
803 |
+
'multiple' => '',
|
804 |
+
'args' => array(
|
805 |
+
'hide_empty' => 0,
|
806 |
+
'name' => 'element_name',
|
807 |
+
'hierarchical' => true
|
808 |
+
),
|
809 |
+
'attributes' => ''
|
810 |
+
);
|
811 |
+
|
812 |
+
// no fields to render
|
813 |
+
if ( empty( $fields ) ) {
|
814 |
+
?>
|
815 |
+
<p>No form fields have been defined. Use <pre>
|
816 |
+
$metabox->set('_fields', array(
|
817 |
+
array(
|
818 |
+
'name' => 'Title',
|
819 |
+
'type' => 'title',
|
820 |
+
),
|
821 |
+
array(
|
822 |
+
'name' => 'Title',
|
823 |
+
'desc' => '',
|
824 |
+
'id' => 'title',
|
825 |
+
'type' => 'text',
|
826 |
+
'std' => ''
|
827 |
+
),
|
828 |
+
array(
|
829 |
+
'name' => 'image',
|
830 |
+
'desc' => '',
|
831 |
+
'id' => 'imagefile',
|
832 |
+
'type' => 'image',
|
833 |
+
'std' => ''
|
834 |
+
),
|
835 |
+
array(
|
836 |
+
'name' => 'Textarea',
|
837 |
+
'desc' => 'Enter big text here',
|
838 |
+
'id' => 'textarea_id',
|
839 |
+
'type' => 'textarea',
|
840 |
+
'std' => 'Default value 2'
|
841 |
+
),
|
842 |
+
array(
|
843 |
+
'name' => 'Select box',
|
844 |
+
'id' => 'select_id',
|
845 |
+
'type' => 'select',
|
846 |
+
'options'=> array(
|
847 |
+
'value1' => 'Value 1',
|
848 |
+
'value2' => 'Value 2',
|
849 |
+
'value3' => 'Value 3',
|
850 |
+
'value4' => 'Value 4',
|
851 |
+
)
|
852 |
+
),
|
853 |
+
array(
|
854 |
+
'name' => 'Radio',
|
855 |
+
'id' => 'radio_id',
|
856 |
+
'type' => 'radio',
|
857 |
+
'value' => 'test',
|
858 |
+
'desc' => 'Check this box if you want its value saved',
|
859 |
+
),
|
860 |
+
array(
|
861 |
+
'name' => '',
|
862 |
+
'id' => 'radio_id',
|
863 |
+
'type' => 'radio',
|
864 |
+
'value' => 'test2',
|
865 |
+
'desc' => 'Check this box if you want its value saved',
|
866 |
+
),
|
867 |
+
array(
|
868 |
+
'name' => 'Checkbox',
|
869 |
+
'id' => 'checkbox_id',
|
870 |
+
'type' => 'checkbox',
|
871 |
+
'desc' => 'Check this box if you want its value saved',
|
872 |
+
),
|
873 |
+
));</pre>
|
874 |
+
</p>
|
875 |
+
<?php
|
876 |
+
|
877 |
+
// rendering the fields
|
878 |
+
} else {
|
879 |
+
?>
|
880 |
+
<table class="form-table">
|
881 |
+
<?php
|
882 |
+
// do_action("{$this->_class}_before");
|
883 |
+
$custom = get_post_custom( $this->_id );
|
884 |
+
|
885 |
+
foreach ( (array)$fields as $field ):
|
886 |
+
$field = wp_parse_args( $field, $defaults );
|
887 |
+
$field['args'] = wp_parse_args( $field['args'], $defaults['args'] );
|
888 |
+
|
889 |
+
extract( $field );
|
890 |
+
$field['args']['name'] = $element_name = $id;
|
891 |
+
|
892 |
+
// grabbing the meta value
|
893 |
+
if ( array_key_exists( $id, $custom ) ) {
|
894 |
+
if ( isset( $custom[$id][0] ) )
|
895 |
+
$meta = esc_attr( $custom[$id][0] );
|
896 |
+
else
|
897 |
+
$meta = esc_attr( $custom[$id] );
|
898 |
+
} else {
|
899 |
+
$meta = $default;
|
900 |
+
}
|
901 |
+
|
902 |
+
$id = sanitize_title( $id );
|
903 |
+
|
904 |
+
if ( array_key_exists( 'deleteattachment', $_GET )
|
905 |
+
&& $id == $_GET['fileproperty']
|
906 |
+
&& $meta == $_GET['deleteattachment'] ) {
|
907 |
+
wp_delete_attachment( $_GET['deleteattachment'], $force_delete = true );
|
908 |
+
update_post_meta( $post->ID, $id, '' );
|
909 |
+
}
|
910 |
+
?>
|
911 |
+
<?php switch ( $type ) { default: ?>
|
912 |
+
<?php if ( is_callable( $type ) && function_exists( $type ) ) : ?>
|
913 |
+
<tr>
|
914 |
+
<th scope="row" style="width: 140px">
|
915 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
916 |
+
</th>
|
917 |
+
<td>
|
918 |
+
<?php call_user_func( $type, $args, $field, $custom[ $id ] ); ?>
|
919 |
+
<span class="description"><?php echo $desc; ?></span>
|
920 |
+
</td>
|
921 |
+
</tr>
|
922 |
+
<?php break; endif; ?>
|
923 |
+
<?php case 'text': ?>
|
924 |
+
<tr>
|
925 |
+
<th scope="row" style="width: 140px">
|
926 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
927 |
+
</th>
|
928 |
+
<td>
|
929 |
+
<input <?php echo $attributes ?>
|
930 |
+
id="<?php echo $id; ?>"
|
931 |
+
value="<?php echo $meta; ?>"
|
932 |
+
type="<?php echo $type; ?>"
|
933 |
+
name="<?php echo $id; ?>"
|
934 |
+
class="text large-text <?php echo $class; ?>" />
|
935 |
+
<span class="description"><?php echo $desc; ?></span>
|
936 |
+
</td>
|
937 |
+
</tr>
|
938 |
+
<?php break; ?>
|
939 |
+
<?php case 'submit': ?>
|
940 |
+
<?php case 'button': ?>
|
941 |
+
<tr>
|
942 |
+
<td colspan="2">
|
943 |
+
<input <?php echo $attributes ?>
|
944 |
+
id="<?php echo $id; ?>"
|
945 |
+
value="<?php echo $name; ?>"
|
946 |
+
type="submit"
|
947 |
+
name="submit"
|
948 |
+
class="button-primary <?php echo $class; ?>" />
|
949 |
+
<span class="description"><?php echo $desc; ?></span>
|
950 |
+
</td>
|
951 |
+
</tr>
|
952 |
+
<?php break; ?>
|
953 |
+
<?php case 'file': ?>
|
954 |
+
<?php case 'image': ?>
|
955 |
+
<tr>
|
956 |
+
<th scope="row" style="width: 140px">
|
957 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
958 |
+
</th>
|
959 |
+
<td>
|
960 |
+
<?php if ( $meta && wp_get_attachment_url( $meta ) ): ?>
|
961 |
+
<?php echo wp_get_attachment_image( $meta ); ?>
|
962 |
+
<span><a href="<?php echo add_query_arg( 'fileproperty', $id, add_query_arg( 'deleteattachment', $meta, $this->_currentPageURL() ) ); ?>">Delete Image</a></span>
|
963 |
+
<?php else: ?>
|
964 |
+
<input type="hidden" name="<?php echo $this->_id; ?>files" value="<?php echo $id; ?>" />
|
965 |
+
<!-- first hidden input forces this item to be submitted when it is not checked -->
|
966 |
+
<input <?php echo $attributes ?>
|
967 |
+
id="<?php echo $id; ?>"
|
968 |
+
type="file"
|
969 |
+
name="<?php echo $id; ?>"
|
970 |
+
onChange="jQuery(this).closest('form').attr('enctype', 'multipart/form-data');"
|
971 |
+
class="<?php echo $class; ?>" />
|
972 |
+
<?php endif; ?>
|
973 |
+
<span class="description"><?php echo $desc; ?></span>
|
974 |
+
</td>
|
975 |
+
</tr>
|
976 |
+
<?php break; ?>
|
977 |
+
<?php case 'title': ?>
|
978 |
+
<tr>
|
979 |
+
<th colspan="2" scope="row">
|
980 |
+
<h3 <?php echo $attributes ?> style="border: 1px solid #ddd;
|
981 |
+
padding: 10px;
|
982 |
+
background: #eee;
|
983 |
+
border-radius: 2px;
|
984 |
+
color: #666;
|
985 |
+
margin: 0;"><?php echo $name; ?>
|
986 |
+
</h3>
|
987 |
+
</th>
|
988 |
+
</tr>
|
989 |
+
<?php break; ?>
|
990 |
+
<?php case 'checkbox': ?>
|
991 |
+
<tr>
|
992 |
+
<th scope="row" style="width: 140px">
|
993 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
994 |
+
</th>
|
995 |
+
<td>
|
996 |
+
<input type="hidden" name="<?php echo $id; ?>" value="" />
|
997 |
+
<!-- first hidden input forces this item to be submitted when it is not checked -->
|
998 |
+
|
999 |
+
<?php foreach ( (array)$options as $_value => $_name ): ?>
|
1000 |
+
<input value="<?php echo $_value; ?>" type="checkbox" <?php echo $attributes ?>
|
1001 |
+
name="<?php echo $element_name; ?>" id="<?php echo $id; ?>"
|
1002 |
+
<?php echo $meta == $_value? 'checked="checked"' :''; ?>
|
1003 |
+
class="<?php echo $class; ?>" />
|
1004 |
+
<?php echo $_name; ?>
|
1005 |
+
<?php endforeach; ?>
|
1006 |
+
<span class="description"><?php echo $desc; ?></span>
|
1007 |
+
</td>
|
1008 |
+
</tr>
|
1009 |
+
<?php break; ?>
|
1010 |
+
<?php case 'radio': ?>
|
1011 |
+
<tr>
|
1012 |
+
<th scope="row" style="width: 140px">
|
1013 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1014 |
+
</th>
|
1015 |
+
<td>
|
1016 |
+
<?php foreach ( (array)$options as $_value => $_name ): ?>
|
1017 |
+
<input name="<?php echo $element_name; ?>" id="<?php echo $id; ?>"
|
1018 |
+
value="<?php echo $_value; ?>" type="<?php echo $type; ?>"
|
1019 |
+
<?php echo $meta == $_value?'checked="checked"' :''; ?>
|
1020 |
+
<?php echo $attributes ?> class="<?php echo $class; ?>" />
|
1021 |
+
<?php echo $_name; ?>
|
1022 |
+
<?php endforeach; ?>
|
1023 |
+
<span class="description"><?php echo $desc; ?></span>
|
1024 |
+
</td>
|
1025 |
+
</tr>
|
1026 |
+
<?php break; ?>
|
1027 |
+
<?php case 'textarea': ?>
|
1028 |
+
<tr>
|
1029 |
+
<th scope="row" style="width: 140px">
|
1030 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1031 |
+
</th>
|
1032 |
+
<td>
|
1033 |
+
<textarea <?php echo $attributes ?>
|
1034 |
+
id="<?php echo $id; ?>"
|
1035 |
+
name="<?php echo $id; ?>"
|
1036 |
+
class="large-text <?php echo $class; ?>"
|
1037 |
+
><?php echo $meta; ?></textarea>
|
1038 |
+
<span class="description"><?php echo $desc; ?></span>
|
1039 |
+
</td>
|
1040 |
+
</tr>
|
1041 |
+
<?php break; ?>
|
1042 |
+
<?php case 'wpeditor': ?>
|
1043 |
+
<tr>
|
1044 |
+
<th scope="row" style="width: 140px">
|
1045 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1046 |
+
</th>
|
1047 |
+
<td>
|
1048 |
+
<?php wp_editor( $meta, $id, $settings = array() ); ?>
|
1049 |
+
<span class="description"><?php echo $desc; ?></span>
|
1050 |
+
</td>
|
1051 |
+
</tr>
|
1052 |
+
<?php break; ?>
|
1053 |
+
<?php case 'select_capabilities': ?>
|
1054 |
+
<?php $options = $type=='select_capabilities' ?$this->get_options_capabilities()+$options :$options; ?>
|
1055 |
+
|
1056 |
+
<?php case 'select_roles': ?>
|
1057 |
+
<?php $options = $type=='select_roles' ?$this->get_options_roles()+$options :$options; ?>
|
1058 |
+
|
1059 |
+
<?php case 'select_menu': ?>
|
1060 |
+
<?php $options = $type=='select_menu' ?$this->get_options_menus()+$options :$options; ?>
|
1061 |
+
|
1062 |
+
<?php case 'select_pages': ?>
|
1063 |
+
<?php $options = $type=='select_pages' ?$this->get_options_pages()+$options :$options; ?>
|
1064 |
+
|
1065 |
+
<?php case 'select_users': ?>
|
1066 |
+
<?php $options = $type=='select_users' ?$this->get_options_users()+$options :$options; ?>
|
1067 |
+
|
1068 |
+
<?php case 'select_categories': ?>
|
1069 |
+
<?php case 'select': ?>
|
1070 |
+
<tr>
|
1071 |
+
<th scope="row" style="width: 140px">
|
1072 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1073 |
+
</th>
|
1074 |
+
<td>
|
1075 |
+
<?php if ( $type == 'select_categories' ): ?>
|
1076 |
+
<?php wp_dropdown_categories( $args ); ?>
|
1077 |
+
|
1078 |
+
<?php else: ?>
|
1079 |
+
|
1080 |
+
<select <?php echo $attributes ?>
|
1081 |
+
id="<?php echo $id; ?>"
|
1082 |
+
name="<?php echo $id; ?>"
|
1083 |
+
class="<?php echo $class; ?>"
|
1084 |
+
<?php echo $multiple ?"MULTIPLE SIZE='$multiple'" :''; ?>
|
1085 |
+
><?php foreach ( (array)$options as $_value => $_name ): ?>
|
1086 |
+
|
1087 |
+
<option
|
1088 |
+
value="<?php echo $_value; ?>"
|
1089 |
+
<?php echo $meta == $_value ?' selected="selected"' :''; ?>
|
1090 |
+
><?php echo $_name; ?></option>
|
1091 |
+
|
1092 |
+
<?php endforeach; ?></select>
|
1093 |
+
<?php endif; ?>
|
1094 |
+
<span class="description"><?php echo $desc; ?></span>
|
1095 |
+
</td>
|
1096 |
+
</tr>
|
1097 |
+
<?php break; ?>
|
1098 |
+
<?php case 'hidden': ?>
|
1099 |
+
<tr>
|
1100 |
+
<td colspan="2">
|
1101 |
+
<input <?php echo $attributes ?>
|
1102 |
+
id="<?php echo $id; ?>"
|
1103 |
+
value="<?php echo $meta ?$meta :$default; ?>"
|
1104 |
+
type="<?php echo $type; ?>"
|
1105 |
+
name="<?php echo $id; ?>"
|
1106 |
+
style="visibility:hidden;" />
|
1107 |
+
</td>
|
1108 |
+
</tr>
|
1109 |
+
<?php break; ?>
|
1110 |
+
<?php case 'custom': ?>
|
1111 |
+
<tr>
|
1112 |
+
<td colspan="2">
|
1113 |
+
<?php echo $desc.$default; ?>
|
1114 |
+
</td>
|
1115 |
+
</tr>
|
1116 |
+
<?php case 'date': ?>
|
1117 |
+
<tr>
|
1118 |
+
<th scope="row" style="width: 140px">
|
1119 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1120 |
+
</th>
|
1121 |
+
<td>
|
1122 |
+
<?php echo mysql2date( get_option( 'date_format' ), $meta ); ?>
|
1123 |
+
<span class="description"><?php echo $desc; ?></span>
|
1124 |
+
</td>
|
1125 |
+
</tr>
|
1126 |
+
<?php break; ?>
|
1127 |
+
<?php case 'time': ?>
|
1128 |
+
<tr>
|
1129 |
+
<th scope="row" style="width: 140px">
|
1130 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1131 |
+
</th>
|
1132 |
+
<td>
|
1133 |
+
<?php echo mysql2date( get_option( 'time_format' ), $meta ); ?>
|
1134 |
+
<span class="description"><?php echo $desc; ?></span>
|
1135 |
+
</td>
|
1136 |
+
</tr>
|
1137 |
+
<?php break; ?>
|
1138 |
+
<?php case 'datetime': ?>
|
1139 |
+
<tr>
|
1140 |
+
<th scope="row" style="width: 140px">
|
1141 |
+
<label for="<?php echo $id; ?>"><?php echo $name; ?></label>
|
1142 |
+
</th>
|
1143 |
+
<td>
|
1144 |
+
<?php echo mysql2date( get_option( 'date_format' ), $meta ); ?>
|
1145 |
+
<?php echo mysql2date( get_option( 'time_format' ), $meta ); ?>
|
1146 |
+
<span class="description"><?php echo $desc; ?></span>
|
1147 |
+
</td>
|
1148 |
+
</tr>
|
1149 |
+
<?php break; ?>
|
1150 |
+
<?php } ?>
|
1151 |
+
<?php endforeach; ?>
|
1152 |
+
</table>
|
1153 |
+
<?php
|
1154 |
+
}
|
1155 |
+
return $this;
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
|
1159 |
+
/**
|
1160 |
+
* Returns an options list of menus
|
1161 |
+
*/
|
1162 |
+
function get_options_pages() {
|
1163 |
+
// initializing
|
1164 |
+
$options = array( '0'=>' -- ' );
|
1165 |
+
$pages = get_pages( array( 'post_type' => 'page', 'post_status' => 'publish' ) );
|
1166 |
+
|
1167 |
+
foreach ( $pages as $page ) {
|
1168 |
+
$options[$page->ID] = $page->post_title;
|
1169 |
+
}
|
1170 |
+
|
1171 |
+
return $options;
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
|
1175 |
+
/**
|
1176 |
+
* Returns an options list of menus
|
1177 |
+
*/
|
1178 |
+
function get_options_menus() {
|
1179 |
+
// initializing
|
1180 |
+
$options = array( '0'=>' -- ' );
|
1181 |
+
$menus = get_terms( 'nav_menu', array(
|
1182 |
+
'hide_empty' => 0
|
1183 |
+
) );
|
1184 |
+
|
1185 |
+
foreach ( $menus as $menu ) {
|
1186 |
+
$options[$menu->slug] = $menu->name;
|
1187 |
+
}
|
1188 |
+
|
1189 |
+
return $options;
|
1190 |
+
}
|
1191 |
+
|
1192 |
+
|
1193 |
+
/**
|
1194 |
+
* Returns an options list of users
|
1195 |
+
*/
|
1196 |
+
function get_options_users() {
|
1197 |
+
// initializing
|
1198 |
+
global $wpdb;
|
1199 |
+
|
1200 |
+
$options = array( '0'=>' -- ' );
|
1201 |
+
$query = $wpdb->prepare( "SELECT $wpdb->users.ID, $wpdb->users.display_name FROM $wpdb->users", null );
|
1202 |
+
$results = $wpdb->get_results( $query );
|
1203 |
+
|
1204 |
+
foreach ( (array)$results as $result ) {
|
1205 |
+
$options[$result->ID] = $result->display_name;
|
1206 |
+
}
|
1207 |
+
|
1208 |
+
return $options;
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
|
1212 |
+
/**
|
1213 |
+
* Returns an options list of capabilities
|
1214 |
+
*/
|
1215 |
+
function get_options_capabilities() {
|
1216 |
+
// initializing
|
1217 |
+
global $wpdb;
|
1218 |
+
|
1219 |
+
$options = array();
|
1220 |
+
$roles = get_option( $wpdb->prefix . 'user_roles' );
|
1221 |
+
|
1222 |
+
foreach ( (array)$roles as $role ) {
|
1223 |
+
if ( !isset( $role['capabilities'] ) ) continue;
|
1224 |
+
foreach ( (array)$role['capabilities'] as $cap => $v ) {
|
1225 |
+
$options[$role['name']."::$cap"] = $role['name']."::$cap";
|
1226 |
+
}
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
return $options;
|
1230 |
+
}
|
1231 |
+
|
1232 |
+
|
1233 |
+
/**
|
1234 |
+
* Returns an options list of roles
|
1235 |
+
*/
|
1236 |
+
function get_options_roles() {
|
1237 |
+
// initializing
|
1238 |
+
global $wpdb;
|
1239 |
+
|
1240 |
+
$options = array(
|
1241 |
+
'read' => 'Public'
|
1242 |
+
);
|
1243 |
+
$roles = get_option( $wpdb->prefix . 'user_roles' );
|
1244 |
+
|
1245 |
+
foreach ( (array)$roles as $role ) {
|
1246 |
+
$options[strtolower( $role['name'] )] = $role['name'];
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
return $options;
|
1250 |
+
}
|
1251 |
+
|
1252 |
+
|
1253 |
+
/**
|
1254 |
+
* Adds a box to the main column on the Post and Page edit screens
|
1255 |
+
*
|
1256 |
+
*/
|
1257 |
+
function _register() {
|
1258 |
+
// this metabox is to be displayed for a certain object type only
|
1259 |
+
if ( !empty( $this->_object_types ) && !in_array( $this->getCurrentPostType(), $this->_object_types ) )
|
1260 |
+
return;
|
1261 |
+
|
1262 |
+
if ( !$this->callback_args ) {
|
1263 |
+
$this->callback_args = $this;
|
1264 |
+
}
|
1265 |
+
|
1266 |
+
// if the user has not already set the type of this metabox,
|
1267 |
+
// then we need to do that now
|
1268 |
+
if ( !$this->_type ) {
|
1269 |
+
$this->setType();
|
1270 |
+
}
|
1271 |
+
|
1272 |
+
add_meta_box(
|
1273 |
+
$this->_id,
|
1274 |
+
$this->title,
|
1275 |
+
$this->callback,
|
1276 |
+
$this->getCurrentPostType(),
|
1277 |
+
$this->context,
|
1278 |
+
$this->priority,
|
1279 |
+
$this->callback_args
|
1280 |
+
);
|
1281 |
+
}
|
1282 |
+
|
1283 |
+
|
1284 |
+
/**
|
1285 |
+
* Method set's the hooks for the options creted by this metabox
|
1286 |
+
*
|
1287 |
+
*/
|
1288 |
+
function setOptionHooks() {
|
1289 |
+
foreach ( (array)$this->_fields as $field ) {
|
1290 |
+
if ( !isset( $field['id'] ) ) continue;
|
1291 |
+
|
1292 |
+
//creating the callback for the admin page
|
1293 |
+
$function = create_function( '$default', '
|
1294 |
+
return redrokk_admin_class::getInstance("'.$this->_isAdminPage.'")
|
1295 |
+
->getOption("'.$field['id'].'", $default, true);
|
1296 |
+
' );
|
1297 |
+
add_filter( "pre_option_{$field['id']}", $function, 20, 2 );
|
1298 |
+
}
|
1299 |
+
}
|
1300 |
+
|
1301 |
+
|
1302 |
+
/**
|
1303 |
+
* Method redirects the user if we have added a request redirect
|
1304 |
+
* in the url
|
1305 |
+
*
|
1306 |
+
* @param string $location
|
1307 |
+
*/
|
1308 |
+
function _redirectIntervention( $location ) {
|
1309 |
+
if ( isset( $_GET['_redirect'] ) ) {
|
1310 |
+
$location = urldecode( $_GET['_redirect'] );
|
1311 |
+
}
|
1312 |
+
return $location;
|
1313 |
+
}
|
1314 |
+
|
1315 |
+
|
1316 |
+
/**
|
1317 |
+
* Get the current page url
|
1318 |
+
*/
|
1319 |
+
function _currentPageURL() {
|
1320 |
+
$pageURL = 'http';
|
1321 |
+
if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {$pageURL .= "s";}
|
1322 |
+
$pageURL .= "://";
|
1323 |
+
if ( $_SERVER["SERVER_PORT"] != "80" ) {
|
1324 |
+
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
|
1325 |
+
} else {
|
1326 |
+
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
|
1327 |
+
}
|
1328 |
+
return $pageURL;
|
1329 |
+
}
|
1330 |
+
|
1331 |
+
|
1332 |
+
/**
|
1333 |
+
* Method to bind an associative array or object to the JTable instance.This
|
1334 |
+
* method only binds properties that are publicly accessible and optionally
|
1335 |
+
* takes an array of properties to ignore when binding.
|
1336 |
+
*
|
1337 |
+
* @param mixed $src An associative array or object to bind to the JTable instance.
|
1338 |
+
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
|
1339 |
+
*
|
1340 |
+
* @return boolean True on success.
|
1341 |
+
*
|
1342 |
+
* @link http://docs.joomla.org/JTable/bind
|
1343 |
+
* @since 11.1
|
1344 |
+
*/
|
1345 |
+
public function bind( $src, $ignore = array() ) {
|
1346 |
+
// If the source value is not an array or object return false.
|
1347 |
+
if ( !is_object( $src ) && !is_array( $src ) ) {
|
1348 |
+
trigger_error( 'Bind failed as the provided source is not an array.' );
|
1349 |
+
return false;
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
// If the source value is an object, get its accessible properties.
|
1353 |
+
if ( is_object( $src ) ) {
|
1354 |
+
$src = get_object_vars( $src );
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
// If the ignore value is a string, explode it over spaces.
|
1358 |
+
if ( !is_array( $ignore ) ) {
|
1359 |
+
$ignore = explode( ' ', $ignore );
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
// Bind the source value, excluding the ignored fields.
|
1363 |
+
foreach ( $this->getProperties() as $k => $v ) {
|
1364 |
+
// Only process fields not in the ignore array.
|
1365 |
+
if ( !in_array( $k, $ignore ) ) {
|
1366 |
+
if ( isset( $src[$k] ) ) {
|
1367 |
+
$this->$k = $src[$k];
|
1368 |
+
}
|
1369 |
+
}
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
return true;
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
|
1376 |
+
/**
|
1377 |
+
* Set the object properties based on a named array/hash.
|
1378 |
+
*
|
1379 |
+
* @param mixed $properties Either an associative array or another object.
|
1380 |
+
*
|
1381 |
+
* @return boolean
|
1382 |
+
*
|
1383 |
+
* @since 11.1
|
1384 |
+
*
|
1385 |
+
* @see set()
|
1386 |
+
*/
|
1387 |
+
public function setProperties( $properties ) {
|
1388 |
+
if ( is_array( $properties ) || is_object( $properties ) ) {
|
1389 |
+
foreach ( (array) $properties as $k => $v ) {
|
1390 |
+
// Use the set function which might be overridden.
|
1391 |
+
$this->set( $k, $v );
|
1392 |
+
}
|
1393 |
+
return true;
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
return false;
|
1397 |
+
}
|
1398 |
+
|
1399 |
+
|
1400 |
+
/**
|
1401 |
+
* Modifies a property of the object, creating it if it does not already exist.
|
1402 |
+
*
|
1403 |
+
* @param string $property The name of the property.
|
1404 |
+
* @param mixed $value The value of the property to set.
|
1405 |
+
*
|
1406 |
+
* @return mixed Previous value of the property.
|
1407 |
+
*
|
1408 |
+
* @since 11.1
|
1409 |
+
*/
|
1410 |
+
public function set( $property, $value = null ) {
|
1411 |
+
$_property = 'set'.str_replace( ' ', '', ucwords( str_replace( '_', ' ', $property ) ) );
|
1412 |
+
if ( method_exists( $this, $_property ) ) {
|
1413 |
+
return $this->$_property( $value );
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
$previous = isset( $this->$property ) ? $this->$property : null;
|
1417 |
+
$this->$property = $value;
|
1418 |
+
return $previous;
|
1419 |
+
}
|
1420 |
+
|
1421 |
+
|
1422 |
+
/**
|
1423 |
+
* Returns an associative array of object properties.
|
1424 |
+
*
|
1425 |
+
* @param boolean $public If true, returns only the public properties.
|
1426 |
+
*
|
1427 |
+
* @return array
|
1428 |
+
*
|
1429 |
+
* @see get()
|
1430 |
+
*/
|
1431 |
+
public function getProperties( $public = true ) {
|
1432 |
+
$vars = get_object_vars( $this );
|
1433 |
+
if ( $public ) {
|
1434 |
+
foreach ( $vars as $key => $value ) {
|
1435 |
+
if ( '_' == substr( $key, 0, 1 ) ) {
|
1436 |
+
unset( $vars[$key] );
|
1437 |
+
}
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
return $vars;
|
1442 |
+
}
|
1443 |
+
|
1444 |
+
|
1445 |
+
/**
|
1446 |
+
* contains the current instance of this class
|
1447 |
+
*
|
1448 |
+
* @var object
|
1449 |
+
*/
|
1450 |
+
static $_instances = null;
|
1451 |
+
|
1452 |
+
/**
|
1453 |
+
* Method is called when we need to instantiate this class
|
1454 |
+
*
|
1455 |
+
* @param array $options
|
1456 |
+
*/
|
1457 |
+
public static function getInstance( $_id, $options = array() ) {
|
1458 |
+
if ( !isset( self::$_instances[$_id] ) ) {
|
1459 |
+
$options['_id'] = $_id;
|
1460 |
+
$class = get_class();
|
1461 |
+
self::$_instances[$_id] = new $class( $options );
|
1462 |
+
}
|
1463 |
+
return self::$_instances[$_id];
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
|
1467 |
+
}
|
1468 |
+
|
1469 |
+
|
1470 |
+
endif;
|
includes/libraries/aihrus-framework/includes/libraries/wp_custom_post_status.php
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// No, Thanks. Direct file access forbidden.
|
3 |
+
! defined( 'ABSPATH' ) AND exit;
|
4 |
+
/*
|
5 |
+
Plugin Name: Custom Post Status
|
6 |
+
Plugin URI: http://
|
7 |
+
Description: Adds a custom post status for posts, pages or custom post types
|
8 |
+
Author: Franz Josef Kaiser
|
9 |
+
Version: 2012-06-14.1426
|
10 |
+
Author URI: http://unserkaiser.com/
|
11 |
+
License: MIT
|
12 |
+
*/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
class wp_custom_post_status
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Name of the post status
|
20 |
+
* Must be lower case
|
21 |
+
*
|
22 |
+
* @access protected
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
public $post_status;
|
26 |
+
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Post type (slug) where the post status should appear
|
30 |
+
*
|
31 |
+
* @access protected
|
32 |
+
* @var string/array
|
33 |
+
*/
|
34 |
+
public $post_type = array( 'post', 'page' );
|
35 |
+
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Custom Args for the post status
|
39 |
+
*
|
40 |
+
* @access protected
|
41 |
+
* @var string
|
42 |
+
*/
|
43 |
+
public $args;
|
44 |
+
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Track jQuery firing
|
48 |
+
*
|
49 |
+
* @access protected
|
50 |
+
* @var boolean
|
51 |
+
*/
|
52 |
+
private static $jquery_ran = false;
|
53 |
+
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Construct
|
57 |
+
* @return void
|
58 |
+
*/
|
59 |
+
public function __construct()
|
60 |
+
{
|
61 |
+
#echo '<pre>'; print_r( $this ); echo '</pre>';
|
62 |
+
// We need to have at least a post status name
|
63 |
+
if ( ! isset( $this->post_status ) )
|
64 |
+
return;
|
65 |
+
|
66 |
+
add_action( 'init', array( $this, 'add_post_status' ), 0 );
|
67 |
+
|
68 |
+
foreach ( array( 'post', 'post-new' ) as $hook )
|
69 |
+
add_action( "admin_footer-{$hook}.php", array( $this,'extend_submitdiv_post_status' ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Add a new post status of "Unavailable"
|
75 |
+
*
|
76 |
+
* @return void
|
77 |
+
*/
|
78 |
+
public function add_post_status()
|
79 |
+
{
|
80 |
+
$defaults = array(
|
81 |
+
'label_count' => false
|
82 |
+
// defaults to FALSE
|
83 |
+
,'hierarchical' => false
|
84 |
+
// defaults to FALSE
|
85 |
+
,'public' => true
|
86 |
+
// If NULL, then inherits "public"
|
87 |
+
,'publicly_queryable' => null
|
88 |
+
|
89 |
+
// most important switch
|
90 |
+
,'internal' => false
|
91 |
+
// If NULL, inherits from "internal"
|
92 |
+
,'exclude_from_search' => null
|
93 |
+
// If NULL, inherits from "internal"
|
94 |
+
,'show_in_admin_all_list' => null
|
95 |
+
// If NULL, inherits from "internal"
|
96 |
+
,'show_in_admin_status_list' => null
|
97 |
+
|
98 |
+
// If NULL, will be set to FALSE
|
99 |
+
,'protected' => null
|
100 |
+
// If NULL, will be set to FALSE
|
101 |
+
,'private' => null
|
102 |
+
// not set by the core function - defaults to NULL
|
103 |
+
,'show_in_admin_all' => null
|
104 |
+
// defaults to "post"
|
105 |
+
,'capability_type' => 'post'
|
106 |
+
,'single_view_cap' => null
|
107 |
+
// @internal use only - don't touch
|
108 |
+
,'_builtin' => false
|
109 |
+
,'_edit_link' => 'post.php?post=%d'
|
110 |
+
);
|
111 |
+
|
112 |
+
// if FALSE, will take the 1st fn arg
|
113 |
+
$defaults['label'] = __(
|
114 |
+
ucwords( str_replace(
|
115 |
+
array( '_', '-' )
|
116 |
+
,array( ' ', ' ' )
|
117 |
+
,$this->post_status
|
118 |
+
) )
|
119 |
+
,'cps_textdomain'
|
120 |
+
);
|
121 |
+
|
122 |
+
// Care about counters:
|
123 |
+
// If FALSE, will be set to array( $args->label, $args->label ), which is not desired
|
124 |
+
$defaults['label_count'] = _n_noop(
|
125 |
+
"{$defaults['label']} <span class='count'>(%s)</span>"
|
126 |
+
,"{$defaults['label']} <span class='count'>(%s)</span>"
|
127 |
+
,'cps_textdomain'
|
128 |
+
);
|
129 |
+
|
130 |
+
// Register the status: Merge Args with defaults
|
131 |
+
register_post_status(
|
132 |
+
$this->post_status
|
133 |
+
,wp_parse_args(
|
134 |
+
$this->args
|
135 |
+
,$defaults
|
136 |
+
)
|
137 |
+
);
|
138 |
+
}
|
139 |
+
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Adds post status to the "submitdiv" Meta Box and post type WP List Table screens
|
143 |
+
*
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
public function extend_submitdiv_post_status()
|
147 |
+
{
|
148 |
+
if ( self::$jquery_ran )
|
149 |
+
return;
|
150 |
+
else
|
151 |
+
self::$jquery_ran = true;
|
152 |
+
|
153 |
+
// Abort if we're on the wrong post type, but only if we got a restriction
|
154 |
+
if ( empty( $this->post_type ) )
|
155 |
+
return;
|
156 |
+
|
157 |
+
global $post_type;
|
158 |
+
if ( is_array( $this->post_type ) )
|
159 |
+
{
|
160 |
+
if ( in_array( $post_type, $this->post_type ) )
|
161 |
+
return;
|
162 |
+
}
|
163 |
+
elseif ( $this->post_type !== $post_type )
|
164 |
+
{
|
165 |
+
return;
|
166 |
+
}
|
167 |
+
|
168 |
+
// Our post status and post type objects
|
169 |
+
global $wp_post_statuses, $post;
|
170 |
+
|
171 |
+
// Get all non-builtin post status and add them as <option>
|
172 |
+
$options = $display = '';
|
173 |
+
foreach ( $wp_post_statuses as $status )
|
174 |
+
{
|
175 |
+
if ( ! empty( $status->internal ) )
|
176 |
+
continue;
|
177 |
+
|
178 |
+
if ( ! empty( $status->private ) )
|
179 |
+
continue;
|
180 |
+
|
181 |
+
if ( ! empty( $status->protected ) )
|
182 |
+
continue;
|
183 |
+
|
184 |
+
if ( empty( $status->_builtin ) )
|
185 |
+
{
|
186 |
+
if ( ! empty( $status->label_count['domain'] ) && 'cps_textdomain' != $status->label_count['domain'] )
|
187 |
+
continue;
|
188 |
+
|
189 |
+
}
|
190 |
+
|
191 |
+
// Match against the current posts status
|
192 |
+
$selected = selected( $post->post_status, $status->name, false );
|
193 |
+
|
194 |
+
// If we one of our custom post status is selected, remember it
|
195 |
+
$selected AND $display = $status->label;
|
196 |
+
|
197 |
+
// Build the options
|
198 |
+
$options .= "<option{$selected} value='{$status->name}'>{$status->label}</option>";
|
199 |
+
|
200 |
+
}
|
201 |
+
?>
|
202 |
+
<script type="text/javascript">
|
203 |
+
jQuery( document ).ready( function($)
|
204 |
+
{
|
205 |
+
var appended = false;
|
206 |
+
|
207 |
+
<?php
|
208 |
+
// Add the selected post status label to the "Status: [Name] (Edit)"
|
209 |
+
if ( ! empty( $display ) ) :
|
210 |
+
?>
|
211 |
+
$( '#post-status-display' ).html( '<?php echo $display; ?>' )
|
212 |
+
<?php
|
213 |
+
endif;
|
214 |
+
|
215 |
+
// Add the options to the <select> element
|
216 |
+
?>
|
217 |
+
$( '.edit-post-status' ).on( 'click', function()
|
218 |
+
{
|
219 |
+
if ( !appended )
|
220 |
+
{
|
221 |
+
var select = $( '#post-status-select' ).find( 'select' );
|
222 |
+
$( select ).append( "<?php echo $options; ?>" );
|
223 |
+
appended = true;
|
224 |
+
}
|
225 |
+
} );
|
226 |
+
} );
|
227 |
+
</script>
|
228 |
+
<?php
|
229 |
+
}
|
230 |
+
}
|
includes/libraries/aihrus-framework/interface-aihrus-common.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Common_Interface' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
|
23 |
+
interface Aihrus_Common_Interface {
|
24 |
+
}
|
25 |
+
|
26 |
+
|
27 |
+
?>
|
includes/libraries/aihrus-framework/interface-aihrus-licensing.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Licensing_Interface' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
|
23 |
+
interface Aihrus_Licensing_Interface {
|
24 |
+
public function settings( $settings );
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
?>
|
includes/libraries/aihrus-framework/interface-aihrus-widget.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
+
|
5 |
+
This program is free software; you can redistribute it and/or modify
|
6 |
+
it under the terms of the GNU General Public License, version 2, as
|
7 |
+
published by the Free Software Foundation.
|
8 |
+
|
9 |
+
This program is distributed in the hope that it will be useful,
|
10 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
+
GNU General Public License for more details.
|
13 |
+
|
14 |
+
You should have received a copy of the GNU General Public License
|
15 |
+
along with this program; if not, write to the Free Software
|
16 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
+
*/
|
18 |
+
|
19 |
+
if ( class_exists( 'Aihrus_Widget_Interface' ) )
|
20 |
+
return;
|
21 |
+
|
22 |
+
|
23 |
+
interface Aihrus_Widget_Interface {
|
24 |
+
public static function form_instance( $instance );
|
25 |
+
public static function form_parts( $instance, $number );
|
26 |
+
public static function get_content( $instance, $widget_number );
|
27 |
+
public static function get_defaults();
|
28 |
+
public static function get_suggest( $id, $suggest_id );
|
29 |
+
public static function validate_settings( $instance );
|
30 |
+
}
|
31 |
+
|
32 |
+
|
33 |
+
?>
|
{lib/aihrus → includes/libraries/aihrus-framework}/requirements.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -20,14 +20,14 @@ if ( ! defined( 'AIHR_BASE' ) )
|
|
20 |
define( 'AIHR_BASE', __FILE__ );
|
21 |
|
22 |
if ( ! defined( 'AIHR_VERSION' ) )
|
23 |
-
define( 'AIHR_VERSION', '1.0.
|
24 |
|
25 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
26 |
|
27 |
if ( ! function_exists( 'aihr_check_aihrus_framework' ) ) {
|
28 |
function aihr_check_aihrus_framework( $file = null, $name = null, $aihr_min = '1.0.0' ) {
|
29 |
if ( is_null( $file ) ) {
|
30 |
-
aihr_notice_error( __( '`aihr_check_aihrus_framework` requires $file argument'
|
31 |
|
32 |
return false;
|
33 |
}
|
@@ -72,7 +72,7 @@ if ( ! function_exists( 'aihr_notice_aihrus_framework' ) ) {
|
|
72 |
}
|
73 |
|
74 |
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/35689458' );
|
75 |
-
$help_link = sprintf( __( '<a href="%1$s">Update plugins</a>. <a href="%2$s">More information</a>.'
|
76 |
|
77 |
$note = '';
|
78 |
if ( defined( 'AIHR_BASE' ) ) {
|
@@ -83,12 +83,12 @@ if ( ! function_exists( 'aihr_notice_aihrus_framework' ) ) {
|
|
83 |
$plugin_name = str_replace( '-', ' ', $plugin_name );
|
84 |
$plugin_name = ucwords( $plugin_name );
|
85 |
|
86 |
-
$note = sprintf( esc_html__( 'Plugin "%1$s" is causing the out of date issue.'
|
87 |
}
|
88 |
|
89 |
$aihr_version = defined( 'AIHR_VERSION' ) ? AIHR_VERSION : '0.0.0';
|
90 |
|
91 |
-
$text = sprintf( esc_html__( 'Plugin "%1$s" has been deactivated as it requires Aihrus Framework %2$s or newer. You\'re running Aihrus Framework %4$s. Once corrected, "%1$s" can be activated. %5$s %3$s'
|
92 |
|
93 |
aihr_notice_error( $text );
|
94 |
}
|
@@ -97,7 +97,7 @@ if ( ! function_exists( 'aihr_notice_aihrus_framework' ) ) {
|
|
97 |
if ( ! function_exists( 'aihr_check_php' ) ) {
|
98 |
function aihr_check_php( $file = null, $name = null, $php_min = '5.3.0' ) {
|
99 |
if ( is_null( $file ) ) {
|
100 |
-
aihr_notice_error( __( '`aihr_check_php` requires $file argument'
|
101 |
|
102 |
return false;
|
103 |
}
|
@@ -138,16 +138,16 @@ if ( ! function_exists( 'aihr_notice_php' ) ) {
|
|
138 |
|
139 |
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/30678006' );
|
140 |
|
141 |
-
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires PHP %2$s or newer. You\'re running PHP %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">More information</a>.'
|
142 |
|
143 |
aihr_notice_error( $text );
|
144 |
}
|
145 |
}
|
146 |
|
147 |
if ( ! function_exists( 'aihr_check_wp' ) ) {
|
148 |
-
function aihr_check_wp( $file = null, $name = null, $wp_min = '3.6
|
149 |
if ( is_null( $file ) ) {
|
150 |
-
aihr_notice_error( __( '`aihr_check_wp` requires $file argument'
|
151 |
|
152 |
return false;
|
153 |
}
|
@@ -192,7 +192,7 @@ if ( ! function_exists( 'aihr_notice_wp' ) ) {
|
|
192 |
|
193 |
$help_url = network_admin_url( 'update-core.php' );
|
194 |
|
195 |
-
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires WordPress %2$s or newer. You\'re running WordPress %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">Update WordPress</a>.'
|
196 |
|
197 |
aihr_notice_error( $text );
|
198 |
}
|
@@ -222,19 +222,19 @@ if ( ! function_exists( 'aihr_notice_version' ) ) {
|
|
222 |
function aihr_notice_version( $required_base, $required_name, $required_slug, $required_version, $item_name ) {
|
223 |
$is_active = is_plugin_active( $required_base );
|
224 |
if ( $is_active )
|
225 |
-
$link = sprintf( __( '<a href="%1$s">update to</a>'
|
226 |
else {
|
227 |
$plugins = get_plugins();
|
228 |
if ( empty( $plugins[ $required_base ] ) ) {
|
229 |
$install = esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $required_slug ), 'install-plugin_' . $required_slug ) );
|
230 |
-
$link = sprintf( __( '<a href="%1$s">install</a>'
|
231 |
} else {
|
232 |
$activate = esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $required_base ), 'activate-plugin_' . $required_base ) );
|
233 |
-
$link = sprintf( __( '<a href="%1$s">activate</a>'
|
234 |
}
|
235 |
}
|
236 |
|
237 |
-
$text = sprintf( __( 'Plugin "%3$s" has been deactivated. Please %1$s "%4$s" version %2$s or newer before activating "%3$s".'
|
238 |
|
239 |
aihr_notice_error( $text );
|
240 |
}
|
@@ -247,21 +247,21 @@ if ( ! function_exists( 'aihr_notice_license' ) ) {
|
|
247 |
else
|
248 |
$link = get_admin_url() . 'edit.php?post_type=' . $post_type . '&page=' . $settings_id;
|
249 |
|
250 |
-
$text = __( '<a href="%1$s">%2$s > Settings</a>, <em>Premium</em> tab, <em>License Key</em> entry'
|
251 |
|
252 |
$settings_link = sprintf( $text, $link, $free_name );
|
253 |
|
254 |
$link = esc_url( 'https://aihrus.zendesk.com/entries/28745227' );
|
255 |
-
$text = __( '<a href="%s">Where\'s my license key?</a>'
|
256 |
|
257 |
$faq_link = sprintf( $text, $link );
|
258 |
|
259 |
$link = esc_url( $purchase_url );
|
260 |
-
$text = __( '<a href="%1$s">%2$s</a>'
|
261 |
|
262 |
$buy_link = sprintf( $text, $link, $item_name );
|
263 |
|
264 |
-
$text = sprintf( __( 'Plugin "%1$s" requires license activation before updating will work. Please activate the license key through %2$s. No license key? See "%3$s" or purchase "%4$s".'
|
265 |
|
266 |
aihr_notice_error( $text );
|
267 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
20 |
define( 'AIHR_BASE', __FILE__ );
|
21 |
|
22 |
if ( ! defined( 'AIHR_VERSION' ) )
|
23 |
+
define( 'AIHR_VERSION', '1.0.4RC2' );
|
24 |
|
25 |
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
26 |
|
27 |
if ( ! function_exists( 'aihr_check_aihrus_framework' ) ) {
|
28 |
function aihr_check_aihrus_framework( $file = null, $name = null, $aihr_min = '1.0.0' ) {
|
29 |
if ( is_null( $file ) ) {
|
30 |
+
aihr_notice_error( __( '`aihr_check_aihrus_framework` requires $file argument' ) );
|
31 |
|
32 |
return false;
|
33 |
}
|
72 |
}
|
73 |
|
74 |
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/35689458' );
|
75 |
+
$help_link = sprintf( __( '<a href="%1$s">Update plugins</a>. <a href="%2$s">More information</a>.' ), self_admin_url( 'update-core.php' ), $help_url );
|
76 |
|
77 |
$note = '';
|
78 |
if ( defined( 'AIHR_BASE' ) ) {
|
83 |
$plugin_name = str_replace( '-', ' ', $plugin_name );
|
84 |
$plugin_name = ucwords( $plugin_name );
|
85 |
|
86 |
+
$note = sprintf( esc_html__( 'Plugin "%1$s" is causing the out of date issue.' ), $plugin_name );
|
87 |
}
|
88 |
|
89 |
$aihr_version = defined( 'AIHR_VERSION' ) ? AIHR_VERSION : '0.0.0';
|
90 |
|
91 |
+
$text = sprintf( esc_html__( 'Plugin "%1$s" has been deactivated as it requires Aihrus Framework %2$s or newer. You\'re running Aihrus Framework %4$s. Once corrected, "%1$s" can be activated. %5$s %3$s' ), $name, AIHR_VERSION_MIN, $help_link, $aihr_version, $note );
|
92 |
|
93 |
aihr_notice_error( $text );
|
94 |
}
|
97 |
if ( ! function_exists( 'aihr_check_php' ) ) {
|
98 |
function aihr_check_php( $file = null, $name = null, $php_min = '5.3.0' ) {
|
99 |
if ( is_null( $file ) ) {
|
100 |
+
aihr_notice_error( __( '`aihr_check_php` requires $file argument' ) );
|
101 |
|
102 |
return false;
|
103 |
}
|
138 |
|
139 |
$help_url = esc_url( 'https://aihrus.zendesk.com/entries/30678006' );
|
140 |
|
141 |
+
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires PHP %2$s or newer. You\'re running PHP %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">More information</a>.' ), $name, AIHR_PHP_VERSION_MIN, $help_url, PHP_VERSION );
|
142 |
|
143 |
aihr_notice_error( $text );
|
144 |
}
|
145 |
}
|
146 |
|
147 |
if ( ! function_exists( 'aihr_check_wp' ) ) {
|
148 |
+
function aihr_check_wp( $file = null, $name = null, $wp_min = '3.6' ) {
|
149 |
if ( is_null( $file ) ) {
|
150 |
+
aihr_notice_error( __( '`aihr_check_wp` requires $file argument' ) );
|
151 |
|
152 |
return false;
|
153 |
}
|
192 |
|
193 |
$help_url = network_admin_url( 'update-core.php' );
|
194 |
|
195 |
+
$text = sprintf( __( 'Plugin "%1$s" has been deactivated as it requires WordPress %2$s or newer. You\'re running WordPress %4$s. Once corrected, "%1$s" can be activated. <a href="%3$s">Update WordPress</a>.' ), $name, AIHR_WP_VERSION_MIN, $help_url, $wp_version );
|
196 |
|
197 |
aihr_notice_error( $text );
|
198 |
}
|
222 |
function aihr_notice_version( $required_base, $required_name, $required_slug, $required_version, $item_name ) {
|
223 |
$is_active = is_plugin_active( $required_base );
|
224 |
if ( $is_active )
|
225 |
+
$link = sprintf( __( '<a href="%1$s">update to</a>' ), self_admin_url( 'update-core.php' ) );
|
226 |
else {
|
227 |
$plugins = get_plugins();
|
228 |
if ( empty( $plugins[ $required_base ] ) ) {
|
229 |
$install = esc_url( wp_nonce_url( self_admin_url( 'update.php?action=install-plugin&plugin=' . $required_slug ), 'install-plugin_' . $required_slug ) );
|
230 |
+
$link = sprintf( __( '<a href="%1$s">install</a>' ), $install );
|
231 |
} else {
|
232 |
$activate = esc_url( wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=' . $required_base ), 'activate-plugin_' . $required_base ) );
|
233 |
+
$link = sprintf( __( '<a href="%1$s">activate</a>' ), $activate );
|
234 |
}
|
235 |
}
|
236 |
|
237 |
+
$text = sprintf( __( 'Plugin "%3$s" has been deactivated. Please %1$s "%4$s" version %2$s or newer before activating "%3$s".' ), $link, $required_version, $item_name, $required_name );
|
238 |
|
239 |
aihr_notice_error( $text );
|
240 |
}
|
247 |
else
|
248 |
$link = get_admin_url() . 'edit.php?post_type=' . $post_type . '&page=' . $settings_id;
|
249 |
|
250 |
+
$text = __( '<a href="%1$s">%2$s > Settings</a>, <em>Premium</em> tab, <em>License Key</em> entry' );
|
251 |
|
252 |
$settings_link = sprintf( $text, $link, $free_name );
|
253 |
|
254 |
$link = esc_url( 'https://aihrus.zendesk.com/entries/28745227' );
|
255 |
+
$text = __( '<a href="%s">Where\'s my license key?</a>' );
|
256 |
|
257 |
$faq_link = sprintf( $text, $link );
|
258 |
|
259 |
$link = esc_url( $purchase_url );
|
260 |
+
$text = __( '<a href="%1$s">%2$s</a>' );
|
261 |
|
262 |
$buy_link = sprintf( $text, $link, $item_name );
|
263 |
|
264 |
+
$text = sprintf( __( 'Plugin "%1$s" requires license activation before updating will work. Please activate the license key through %2$s. No license key? See "%3$s" or purchase "%4$s".' ), $item_name, $settings_link, $faq_link, $buy_link );
|
265 |
|
266 |
aihr_notice_error( $text );
|
267 |
}
|
{lib → includes/libraries}/class-redrokk-metabox-class.php
RENAMED
File without changes
|
{lib → includes}/requirements.php
RENAMED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Copyright
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -16,31 +16,42 @@
|
|
16 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
*/
|
18 |
|
19 |
-
require_once TW_DIR_LIB . '/aihrus
|
20 |
|
21 |
|
22 |
-
function tw_requirements_check() {
|
23 |
-
$
|
|
|
|
|
|
|
|
|
|
|
24 |
if ( ! function_exists( 'aihr_check_aihrus_framework' ) ) {
|
25 |
-
$
|
26 |
add_action( 'admin_notices', 'tw_notice_aihrus' );
|
27 |
} elseif ( ! aihr_check_aihrus_framework( TW_BASE, TW_NAME, TW_AIHR_VERSION ) ) {
|
28 |
-
$
|
29 |
}
|
30 |
|
31 |
if ( ! aihr_check_php( TW_BASE, TW_NAME ) ) {
|
32 |
-
$
|
33 |
}
|
34 |
|
35 |
if ( ! aihr_check_wp( TW_BASE, TW_NAME ) ) {
|
36 |
-
$
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
|
|
|
|
|
41 |
}
|
42 |
|
43 |
-
return $
|
44 |
}
|
45 |
|
46 |
|
1 |
<?php
|
2 |
/*
|
3 |
+
Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
4 |
|
5 |
This program is free software; you can redistribute it and/or modify
|
6 |
it under the terms of the GNU General Public License, version 2, as
|
16 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
17 |
*/
|
18 |
|
19 |
+
require_once TW_DIR_LIB . 'aihrus-framework/aihrus-framework.php';
|
20 |
|
21 |
|
22 |
+
function tw_requirements_check( $force_check = false ) {
|
23 |
+
$check_okay = get_transient( 'tw_requirements_check' );
|
24 |
+
if ( empty( $force_check ) && $check_okay !== false ) {
|
25 |
+
return $check_okay;
|
26 |
+
}
|
27 |
+
|
28 |
+
$deactivate_reason = false;
|
29 |
if ( ! function_exists( 'aihr_check_aihrus_framework' ) ) {
|
30 |
+
$deactivate_reason = esc_html__( 'Missing Aihrus Framework', 'testimonials-widget' );
|
31 |
add_action( 'admin_notices', 'tw_notice_aihrus' );
|
32 |
} elseif ( ! aihr_check_aihrus_framework( TW_BASE, TW_NAME, TW_AIHR_VERSION ) ) {
|
33 |
+
$deactivate_reason = esc_html__( 'Old Aihrus Framework version detected', 'testimonials-widget' );
|
34 |
}
|
35 |
|
36 |
if ( ! aihr_check_php( TW_BASE, TW_NAME ) ) {
|
37 |
+
$deactivate_reason = esc_html__( 'Old PHP version detected', 'testimonials-widget' );
|
38 |
}
|
39 |
|
40 |
if ( ! aihr_check_wp( TW_BASE, TW_NAME ) ) {
|
41 |
+
$deactivate_reason = esc_html__( 'Old WordPress version detected', 'testimonials-widget' );
|
42 |
+
}
|
43 |
+
|
44 |
+
if ( ! empty( $deactivate_reason ) ) {
|
45 |
+
aihr_deactivate_plugin( TW_BASE, TW_NAME, $deactivate_reason );
|
46 |
}
|
47 |
|
48 |
+
$check_okay = empty( $deactivate_reason );
|
49 |
+
if ( $check_okay ) {
|
50 |
+
delete_transient( 'tw_requirements_check' );
|
51 |
+
set_transient( 'tw_requirements_check', $check_okay, HOUR_IN_SECONDS );
|
52 |
}
|
53 |
|
54 |
+
return $check_okay;
|
55 |
}
|
56 |
|
57 |
|
languages/testimonials-widget.pot
CHANGED
@@ -1,860 +1,947 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the Testimonials by Aihrus package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Testimonials by Aihrus 2.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/testimonials-widget\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#:
|
16 |
-
msgid "Please donate $5 towards ongoing free support and development of the \"%1$s\" plugin. %2$s"
|
17 |
-
msgstr ""
|
18 |
-
|
19 |
-
#: lib/aihrus/class-aihrus-settings.php:61
|
20 |
-
msgid "Reset"
|
21 |
-
msgstr ""
|
22 |
-
|
23 |
-
#: lib/aihrus/class-aihrus-settings.php:62
|
24 |
-
msgid "About"
|
25 |
-
msgstr ""
|
26 |
-
|
27 |
-
#: lib/aihrus/class-aihrus-settings.php:80
|
28 |
-
msgid "Export Settings"
|
29 |
-
msgstr ""
|
30 |
-
|
31 |
-
#: lib/aihrus/class-aihrus-settings.php:82
|
32 |
-
msgid "These are your current settings in a serialized format. Copy the contents to make a backup of your settings."
|
33 |
-
msgstr ""
|
34 |
-
|
35 |
-
#: lib/aihrus/class-aihrus-settings.php:90
|
36 |
-
msgid "Import Settings"
|
37 |
-
msgstr ""
|
38 |
-
|
39 |
-
#: lib/aihrus/class-aihrus-settings.php:92
|
40 |
-
msgid "Paste new serialized settings here to overwrite your current configuration."
|
41 |
-
msgstr ""
|
42 |
-
|
43 |
-
#: lib/aihrus/class-aihrus-settings.php:96
|
44 |
-
msgid "Delete all %s data and options from database on plugin deletion"
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: lib/aihrus/class-aihrus-settings.php:100
|
48 |
-
msgid "Remove Plugin Data on Deletion?"
|
49 |
-
msgstr ""
|
50 |
-
|
51 |
-
#: lib/aihrus/class-aihrus-settings.php:109
|
52 |
-
msgid "Reset to Defaults?"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: lib/aihrus/class-aihrus-settings.php:112
|
56 |
-
msgid "Check this box to reset options to their defaults"
|
57 |
-
msgstr ""
|
58 |
-
|
59 |
-
#: lib/aihrus/class-aihrus-settings.php:236
|
60 |
-
msgid "<img class=\"alignright size-medium\" src=\"%1$s/media/michael-cannon-red-square-300x2251.jpg\" alt=\"Michael in Red Square, Moscow, Russia\" width=\"300\" height=\"225\" /><a href=\"%2$s\">%3$s</a> is by <a href=\"%4$s\">Michael Cannon</a>. He's <a href=\"%5$s\">Peichi’s</a> smiling man, an adventurous <a href=\"%6$s\" target=\"_blank\">water-rat</a>, <a href=\"%7$s\">chief people officer</a>, <a href=\"%8$s\">cyclist</a>, <a href=\"%9$s\">full stack developer</a>, <a href=\"%10$s\">poet</a>, <a href=\"%11$s\">WWOOF’er</a> and <a href=\"%12$s\">world traveler</a>."
|
61 |
-
msgstr ""
|
62 |
-
|
63 |
-
#: lib/aihrus/class-aihrus-settings.php:278
|
64 |
-
msgid "Save Changes"
|
65 |
-
msgstr ""
|
66 |
-
|
67 |
-
#: lib/aihrus/class-aihrus-settings.php:286
|
68 |
-
msgid "If you like this plugin, please <a href=\"%1$s\" title=\"Donate for Good Karma\"><img src=\"%2$s\" border=\"0\" alt=\"Donate for Good Karma\" /></a> or <a href=\"%3$s\" title=\"purchase premium WordPress plugins from Aihrus \">purchase the Premium version</a> to help fund further development and <a href=\"%4$s\" title=\"Support forums\">support</a>."
|
69 |
-
msgstr ""
|
70 |
-
|
71 |
-
#: lib/aihrus/class-aihrus-settings.php:297
|
72 |
-
msgid "Copyright ©%1$s <a href=\"%2$s\">Aihrus</a>."
|
73 |
-
msgstr ""
|
74 |
-
|
75 |
-
#: lib/aihrus/class-aihrus-settings.php:598
|
76 |
-
msgid "Required"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: lib/aihrus/class-aihrus-widget.php:140
|
80 |
-
msgid "Expand/Collapse All Options"
|
81 |
-
msgstr ""
|
82 |
-
|
83 |
-
#: lib/aihrus/class-aihrus-widget.php:149
|
84 |
-
msgid "Expand/Collapse"
|
85 |
-
msgstr ""
|
86 |
-
|
87 |
-
#: lib/aihrus/requirements.php:30
|
88 |
-
msgid "`aihr_check_aihrus_framework` requires $file argument"
|
89 |
-
msgstr ""
|
90 |
-
|
91 |
-
#: lib/aihrus/requirements.php:75 lib/requirements.php:49
|
92 |
-
msgid "<a href=\"%1$s\">Update plugins</a>. <a href=\"%2$s\">More information</a>."
|
93 |
-
msgstr ""
|
94 |
-
|
95 |
-
#: lib/aihrus/requirements.php:86
|
96 |
-
msgid "Plugin \"%1$s\" is causing the out of date issue."
|
97 |
-
msgstr ""
|
98 |
-
|
99 |
-
#: lib/aihrus/requirements.php:91
|
100 |
-
msgid "Plugin \"%1$s\" has been deactivated as it requires Aihrus Framework %2$s or newer. You're running Aihrus Framework %4$s. Once corrected, \"%1$s\" can be activated. %5$s %3$s"
|
101 |
-
msgstr ""
|
102 |
-
|
103 |
-
#: lib/aihrus/requirements.php:100
|
104 |
-
msgid "`aihr_check_php` requires $file argument"
|
105 |
-
msgstr ""
|
106 |
-
|
107 |
-
#: lib/aihrus/requirements.php:141
|
108 |
-
msgid "Plugin \"%1$s\" has been deactivated as it requires PHP %2$s or newer. You're running PHP %4$s. Once corrected, \"%1$s\" can be activated. <a href=\"%3$s\">More information</a>."
|
109 |
-
msgstr ""
|
110 |
-
|
111 |
-
#: lib/aihrus/requirements.php:150
|
112 |
-
msgid "`aihr_check_wp` requires $file argument"
|
113 |
-
msgstr ""
|
114 |
-
|
115 |
-
#: lib/aihrus/requirements.php:195
|
116 |
-
msgid "Plugin \"%1$s\" has been deactivated as it requires WordPress %2$s or newer. You're running WordPress %4$s. Once corrected, \"%1$s\" can be activated. <a href=\"%3$s\">Update WordPress</a>."
|
117 |
-
msgstr ""
|
118 |
-
|
119 |
-
#: lib/aihrus/requirements.php:225
|
120 |
-
msgid "<a href=\"%1$s\">update to</a>"
|
121 |
-
msgstr ""
|
122 |
-
|
123 |
-
#: lib/aihrus/requirements.php:230
|
124 |
-
msgid "<a href=\"%1$s\">install</a>"
|
125 |
-
msgstr ""
|
126 |
-
|
127 |
-
#: lib/aihrus/requirements.php:233
|
128 |
-
msgid "<a href=\"%1$s\">activate</a>"
|
129 |
-
msgstr ""
|
130 |
-
|
131 |
-
#: lib/aihrus/requirements.php:237
|
132 |
-
msgid "Plugin \"%3$s\" has been deactivated. Please %1$s \"%4$s\" version %2$s or newer before activating \"%3$s\"."
|
133 |
-
msgstr ""
|
134 |
-
|
135 |
-
#: lib/aihrus/requirements.php:250
|
136 |
-
msgid "<a href=\"%1$s\">%2$s > Settings</a>, <em>Premium</em> tab, <em>License Key</em> entry"
|
137 |
-
msgstr ""
|
138 |
-
|
139 |
-
#: lib/aihrus/requirements.php:255
|
140 |
-
msgid "<a href=\"%s\">Where's my license key?</a>"
|
141 |
-
msgstr ""
|
142 |
-
|
143 |
-
#: lib/aihrus/requirements.php:260
|
144 |
-
msgid "<a href=\"%1$s\">%2$s</a>"
|
145 |
-
msgstr ""
|
146 |
-
|
147 |
-
#: lib/aihrus/requirements.php:264
|
148 |
-
msgid "Plugin \"%1$s\" requires license activation before updating will work. Please activate the license key through %2$s. No license key? See \"%3$s\" or purchase \"%4$s\"."
|
149 |
-
msgstr ""
|
150 |
-
|
151 |
-
#: lib/class-testimonials-widget-settings.php:91
|
152 |
msgid "Testimonials Settings"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#:
|
|
|
156 |
msgid "Settings"
|
157 |
msgstr ""
|
158 |
|
159 |
-
#:
|
160 |
-
#:
|
161 |
msgid "General"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#:
|
165 |
-
#:
|
166 |
msgid "Selection"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#:
|
170 |
-
#:
|
171 |
msgid "Ordering"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#:
|
175 |
-
#:
|
176 |
msgid "Widget"
|
177 |
msgstr ""
|
178 |
|
179 |
-
#:
|
180 |
-
#:
|
181 |
msgid "Post Type"
|
182 |
msgstr ""
|
183 |
|
184 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
185 |
msgid "Widget Title"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#:
|
189 |
-
#:
|
190 |
-
#: testimonials-widget.php:
|
|
|
191 |
msgid "Testimonials"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#:
|
195 |
msgid "Title Link"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#:
|
199 |
msgid "URL, path, or post ID to link widget title to. Ex: http://example.com/stuff, /testimonials, 123 or "
|
200 |
msgstr ""
|
201 |
|
202 |
-
#:
|
203 |
msgid "Character Limit"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#:
|
207 |
msgid "Number of characters to limit non-single testimonial views to"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#:
|
211 |
msgid "Rotation Speed"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#:
|
215 |
msgid "Number of seconds between testimonial rotations or 0 for no rotation at all refresh"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#:
|
219 |
msgid "Additional Widget Options"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#:
|
223 |
msgid "Transition Mode?"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#:
|
227 |
msgid "Type of transition between slides"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#:
|
231 |
msgid "Fade"
|
232 |
msgstr ""
|
233 |
|
234 |
-
#:
|
235 |
msgid "Horizontal"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#:
|
239 |
msgid "Vertical"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#:
|
243 |
msgid "Show Play/Pause?"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#:
|
247 |
msgid "Display start and stop buttons underneath the testimonial slider."
|
248 |
msgstr ""
|
249 |
|
250 |
-
#:
|
251 |
msgid "Enable Video?"
|
252 |
msgstr ""
|
253 |
|
254 |
-
#:
|
255 |
msgid "Only enable when displaying video content."
|
256 |
msgstr ""
|
257 |
|
258 |
-
#:
|
259 |
msgid "Keep Whitespace?"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#:
|
263 |
msgid "Keeps testimonials looking as entered than sans auto-formatting"
|
264 |
msgstr ""
|
265 |
|
266 |
-
#:
|
267 |
msgid "Testimonial Bottom Text"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#:
|
271 |
msgid "Custom text or HTML for bottom of testimonials"
|
272 |
msgstr ""
|
273 |
|
274 |
-
#:
|
275 |
msgid "General Options"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#:
|
279 |
-
msgid "
|
280 |
msgstr ""
|
281 |
|
282 |
-
#:
|
283 |
-
msgid "
|
284 |
msgstr ""
|
285 |
|
286 |
-
#:
|
287 |
-
msgid "
|
288 |
msgstr ""
|
289 |
|
290 |
-
#:
|
291 |
-
msgid "
|
292 |
msgstr ""
|
293 |
|
294 |
-
#:
|
295 |
-
msgid "
|
296 |
msgstr ""
|
297 |
|
298 |
-
#:
|
299 |
-
msgid "
|
300 |
msgstr ""
|
301 |
|
302 |
-
#:
|
303 |
-
msgid "
|
304 |
msgstr ""
|
305 |
|
306 |
-
#:
|
307 |
-
msgid "
|
308 |
msgstr ""
|
309 |
|
310 |
-
#:
|
311 |
-
msgid "
|
|
|
|
|
|
|
|
|
312 |
msgstr ""
|
313 |
|
314 |
-
#:
|
315 |
msgid "Hide Gravatar Image?"
|
316 |
msgstr ""
|
317 |
|
318 |
-
#:
|
|
|
319 |
msgid "Hide Image?"
|
320 |
msgstr ""
|
321 |
|
322 |
-
#:
|
323 |
msgid "Hide Image in Single View?"
|
324 |
msgstr ""
|
325 |
|
326 |
-
#:
|
327 |
msgid "Hide Testimonial Content?"
|
328 |
msgstr ""
|
329 |
|
330 |
-
#:
|
331 |
msgid "Hide Author/Source?"
|
332 |
msgstr ""
|
333 |
|
334 |
-
#:
|
335 |
msgid "Don't display \"Post Title\" in cite"
|
336 |
msgstr ""
|
337 |
|
338 |
-
#:
|
|
|
339 |
msgid "Hide Email?"
|
340 |
msgstr ""
|
341 |
|
342 |
-
#:
|
|
|
343 |
msgid "Hide Job Title?"
|
344 |
msgstr ""
|
345 |
|
346 |
-
#:
|
|
|
347 |
msgid "Hide Location?"
|
348 |
msgstr ""
|
349 |
|
350 |
-
#:
|
|
|
351 |
msgid "Hide Company?"
|
352 |
msgstr ""
|
353 |
|
354 |
-
#:
|
|
|
355 |
msgid "Hide URL?"
|
356 |
msgstr ""
|
357 |
|
358 |
-
#:
|
359 |
-
msgid "
|
360 |
msgstr ""
|
361 |
|
362 |
-
#:
|
363 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
msgstr ""
|
365 |
|
366 |
-
#:
|
|
|
|
|
|
|
|
|
367 |
msgid "Enable Paging?"
|
368 |
msgstr ""
|
369 |
|
370 |
-
#:
|
371 |
-
msgid "For `[
|
372 |
msgstr ""
|
373 |
|
374 |
-
#:
|
375 |
msgid "Disable"
|
376 |
msgstr ""
|
377 |
|
378 |
-
#:
|
379 |
msgid "Enable"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#:
|
383 |
msgid "Before testimonials"
|
384 |
msgstr ""
|
385 |
|
386 |
-
#:
|
387 |
msgid "After testimonials"
|
388 |
msgstr ""
|
389 |
|
390 |
-
#:
|
391 |
-
msgid "
|
|
|
|
|
|
|
|
|
392 |
msgstr ""
|
393 |
|
394 |
-
#:
|
|
|
|
|
|
|
|
|
395 |
msgid "If unchecked, shortcodes are stripped."
|
396 |
msgstr ""
|
397 |
|
398 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
msgid "Selection Options"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#:
|
403 |
msgid "Category Filter"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#:
|
407 |
msgid "Comma separated category names. Ex: Category A, Another category"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#:
|
411 |
msgid "Tags Filter"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#:
|
415 |
msgid "Comma separated tag names. Ex: Tag A, Another tag"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#:
|
419 |
msgid "Require All Tags?"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#:
|
423 |
msgid "Select only testimonials with all of the given tags"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#:
|
427 |
msgid "Include IDs Filter"
|
428 |
msgstr ""
|
429 |
|
430 |
-
#:
|
431 |
-
#:
|
432 |
msgid "Comma separated testimonial IDs. Ex: 3,1,2"
|
433 |
msgstr ""
|
434 |
|
435 |
-
#:
|
436 |
msgid "Exclude IDs Filter"
|
437 |
msgstr ""
|
438 |
|
439 |
-
#:
|
440 |
msgid "Limit"
|
441 |
msgstr ""
|
442 |
|
443 |
-
#:
|
444 |
msgid "Number of testimonials to select per instance"
|
445 |
msgstr ""
|
446 |
|
447 |
-
#:
|
448 |
msgid "Ordering Options"
|
449 |
msgstr ""
|
450 |
|
451 |
-
#:
|
452 |
msgid "Random Order?"
|
453 |
msgstr ""
|
454 |
|
455 |
-
#:
|
456 |
msgid "If checked, ignores ORDER BY, ORDER BY meta_key, and ORDER BY Order. Widgets are random by default automatically"
|
457 |
msgstr ""
|
458 |
|
459 |
-
#:
|
460 |
msgid "ORDER BY"
|
461 |
msgstr ""
|
462 |
|
463 |
-
#:
|
464 |
msgid "Used when \"Random Order\" is disabled"
|
465 |
msgstr ""
|
466 |
|
467 |
-
#:
|
468 |
msgid "Testimonial ID"
|
469 |
msgstr ""
|
470 |
|
471 |
-
#:
|
472 |
msgid "Author"
|
473 |
msgstr ""
|
474 |
|
475 |
-
#:
|
|
|
476 |
msgid "Date"
|
477 |
msgstr ""
|
478 |
|
479 |
-
#:
|
480 |
msgid "Menu Order"
|
481 |
msgstr ""
|
482 |
|
483 |
-
#:
|
|
|
484 |
msgid "Source"
|
485 |
msgstr ""
|
486 |
|
487 |
-
#:
|
488 |
msgid "No order"
|
489 |
msgstr ""
|
490 |
|
491 |
-
#:
|
492 |
msgid "ORDER BY meta_key"
|
493 |
msgstr ""
|
494 |
|
495 |
-
#:
|
496 |
msgid "Used when \"Random Order\" is disabled and sorting by a testimonials meta key is needed. Overrides ORDER BY"
|
497 |
msgstr ""
|
498 |
|
499 |
-
#:
|
500 |
msgid "None"
|
501 |
msgstr ""
|
502 |
|
503 |
-
#:
|
504 |
-
#: testimonials-widget.php:
|
|
|
505 |
msgid "Job Title"
|
506 |
msgstr ""
|
507 |
|
508 |
-
#:
|
509 |
-
#: testimonials-widget.php:
|
|
|
510 |
msgid "Email"
|
511 |
msgstr ""
|
512 |
|
513 |
-
#:
|
514 |
-
#: testimonials-widget.php:
|
|
|
515 |
msgid "Location"
|
516 |
msgstr ""
|
517 |
|
518 |
-
#:
|
519 |
-
#: testimonials-widget.php:
|
|
|
520 |
msgid "Company"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#:
|
524 |
-
#: testimonials-widget.php:
|
|
|
525 |
msgid "URL"
|
526 |
msgstr ""
|
527 |
|
528 |
-
#:
|
529 |
msgid "ORDER BY Order"
|
530 |
msgstr ""
|
531 |
|
532 |
-
#:
|
533 |
msgid "Descending"
|
534 |
msgstr ""
|
535 |
|
536 |
-
#:
|
537 |
msgid "Ascending"
|
538 |
msgstr ""
|
539 |
|
540 |
-
#:
|
541 |
msgid "Allow Comments?"
|
542 |
msgstr ""
|
543 |
|
544 |
-
#:
|
545 |
msgid "Only affects the Testimonials post edit page. Your theme controls the front-end view."
|
546 |
msgstr ""
|
547 |
|
548 |
-
#:
|
549 |
msgid "URL slug-name for <a href=\"%1s\">testimonials archive</a> page."
|
550 |
msgstr ""
|
551 |
|
552 |
-
#:
|
553 |
msgid "Archive Page URL"
|
554 |
msgstr ""
|
555 |
|
556 |
-
#:
|
557 |
msgid "URL slug-name for testimonial view pages. Shouldn't be the same as the Archive Page URL nor should it match a page URL slug."
|
558 |
msgstr ""
|
559 |
|
560 |
-
#:
|
561 |
msgid "Testimonial Page URL"
|
562 |
msgstr ""
|
563 |
|
564 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
565 |
msgid "Reset & Compatiblity Options"
|
566 |
msgstr ""
|
567 |
|
568 |
-
#:
|
569 |
msgid "Don't Use Default Taxonomies?"
|
570 |
msgstr ""
|
571 |
|
572 |
-
#:
|
573 |
msgid "If checked, use Testimonials' own category and tag taxonomies instead"
|
574 |
msgstr ""
|
575 |
|
576 |
-
#:
|
577 |
msgid "Version Based Options"
|
578 |
msgstr ""
|
579 |
|
580 |
-
#:
|
581 |
msgid "Use bxSlider?"
|
582 |
msgstr ""
|
583 |
|
584 |
-
#:
|
585 |
msgid "Pre 2.15.0, Testimonials' used custom JavaScript for transitions."
|
586 |
msgstr ""
|
587 |
|
588 |
-
#:
|
589 |
msgid "Disable Animation?"
|
590 |
msgstr ""
|
591 |
|
592 |
-
#:
|
593 |
msgid "Pre 2.15.0, Disable animation between testimonial transitions. Useful when stacking widgets."
|
594 |
msgstr ""
|
595 |
|
596 |
-
#:
|
597 |
msgid "Fade Out Speed"
|
598 |
msgstr ""
|
599 |
|
600 |
-
#:
|
601 |
-
#:
|
602 |
msgid "Pre 2.15.0, Transition duration in milliseconds; higher values indicate slower animations, not faster ones."
|
603 |
msgstr ""
|
604 |
|
605 |
-
#:
|
606 |
msgid "Fade In Speed"
|
607 |
msgstr ""
|
608 |
|
609 |
-
#:
|
610 |
msgid "Height"
|
611 |
msgstr ""
|
612 |
|
613 |
-
#:
|
614 |
msgid "Pre 2.15.0, Testimonials height, in pixels. Overrides minimum and maximum height"
|
615 |
msgstr ""
|
616 |
|
617 |
-
#:
|
618 |
msgid "Minimum Height"
|
619 |
msgstr ""
|
620 |
|
621 |
-
#:
|
622 |
msgid "Pre 2.15.0, Set for minimum display height, in pixels"
|
623 |
msgstr ""
|
624 |
|
625 |
-
#:
|
626 |
msgid "Maximum Height"
|
627 |
msgstr ""
|
628 |
|
629 |
-
#:
|
630 |
msgid "Pre 2.15.0, Set for maximum display height, in pixels"
|
631 |
msgstr ""
|
632 |
|
633 |
-
#:
|
634 |
-
msgid "Always Load CSS?"
|
635 |
-
msgstr ""
|
636 |
-
|
637 |
-
#: lib/class-testimonials-widget-settings.php:602
|
638 |
-
msgid "Pre 2.14.0, Testimonials' CSS was always loaded, whether needed or not"
|
639 |
-
msgstr ""
|
640 |
-
|
641 |
-
#: lib/class-testimonials-widget-settings.php:613
|
642 |
-
msgid "Include IE7 CSS?"
|
643 |
-
msgstr ""
|
644 |
-
|
645 |
-
#: lib/class-testimonials-widget-settings.php:614
|
646 |
-
msgid "IE7 specific CSS moved to separate CSS file in version 2.13.6."
|
647 |
-
msgstr ""
|
648 |
-
|
649 |
-
#: lib/class-testimonials-widget-settings.php:626
|
650 |
-
msgid "Use `<q>` tag?"
|
651 |
-
msgstr ""
|
652 |
-
|
653 |
-
#: lib/class-testimonials-widget-settings.php:627
|
654 |
-
msgid "Pre 2.11.0, not HTML5 compliant"
|
655 |
-
msgstr ""
|
656 |
-
|
657 |
-
#: lib/class-testimonials-widget-settings.php:638
|
658 |
-
msgid "Remove `.hentry` CSS?"
|
659 |
-
msgstr ""
|
660 |
-
|
661 |
-
#: lib/class-testimonials-widget-settings.php:639
|
662 |
-
msgid "Pre 2.6.4, some themes use class `.hentry` in a manner that breaks Testimonials' CSS"
|
663 |
-
msgstr ""
|
664 |
-
|
665 |
-
#: lib/class-testimonials-widget-settings.php:865
|
666 |
msgid "These Testimonials Settings establish the default option values for shortcodes, theme functions, and widget instances. Widgets, once created no longer inherit these global settings. Therefore, you'll need to update each widget with the new settings. It might be easier to delete the widget and then recreate it."
|
667 |
msgstr ""
|
668 |
|
669 |
-
#:
|
670 |
msgid "Shortcode option names are listed below each entry."
|
671 |
msgstr ""
|
672 |
|
673 |
-
#:
|
674 |
msgid "View the <a href=\"%s\">Testimonials documentation</a>."
|
675 |
msgstr ""
|
676 |
|
677 |
-
#:
|
678 |
msgid "Show or hide optional fields."
|
679 |
msgstr ""
|
680 |
|
681 |
-
#:
|
682 |
msgid "Options used to select testimonials."
|
683 |
msgstr ""
|
684 |
|
685 |
-
#:
|
686 |
msgid "Options used to determine displayed testimonials ordering."
|
687 |
msgstr ""
|
688 |
|
689 |
-
#:
|
690 |
msgid "Options related to showing testimonials in widgets."
|
691 |
msgstr ""
|
692 |
|
693 |
-
#:
|
694 |
msgid "Archive and singular page URL related testimonials options."
|
695 |
msgstr ""
|
696 |
|
697 |
-
#:
|
|
|
|
|
|
|
|
|
698 |
msgid "Compatibility & Reset"
|
699 |
msgstr ""
|
700 |
|
701 |
-
#:
|
702 |
msgid "Backwards compatibility, import/export options, and reset options."
|
703 |
msgstr ""
|
704 |
|
705 |
-
#:
|
706 |
msgid "Display testimonials with multiple selection and display options"
|
707 |
msgstr ""
|
708 |
|
709 |
-
#:
|
710 |
msgid "CSS Class"
|
711 |
msgstr ""
|
712 |
|
713 |
-
#:
|
714 |
msgid "This widget's unique CSS class for styling"
|
715 |
msgstr ""
|
716 |
|
717 |
-
#:
|
718 |
-
|
719 |
-
msgstr ""
|
720 |
-
|
721 |
-
#: testimonials-widget.php:148 testimonials-widget.php:1980
|
722 |
msgid "Testimonials Shortcode Examples"
|
723 |
msgstr ""
|
724 |
|
725 |
-
#: testimonials-widget.php:
|
726 |
msgid "E.g. Shortcodes"
|
727 |
msgstr ""
|
728 |
|
729 |
-
#: testimonials-widget.php:
|
730 |
msgid "If your Testimonials display has gone to funky town, please <a href=\"%s\">read the FAQ</a> about possible CSS fixes."
|
731 |
msgstr ""
|
732 |
|
733 |
-
#: testimonials-widget.php:
|
734 |
-
msgid "
|
735 |
msgstr ""
|
736 |
|
737 |
-
#: testimonials-widget.php:
|
738 |
-
|
|
|
739 |
msgstr ""
|
740 |
|
741 |
-
#: testimonials-widget.php:
|
742 |
-
|
|
|
743 |
msgstr ""
|
744 |
|
745 |
-
#: testimonials-widget.php:
|
746 |
-
msgid "
|
747 |
msgstr ""
|
748 |
|
749 |
-
#:
|
750 |
-
msgid "
|
751 |
msgstr ""
|
752 |
|
753 |
-
#:
|
754 |
-
msgid "
|
755 |
msgstr ""
|
756 |
|
757 |
-
#: testimonials-widget.php:
|
758 |
msgid "Add New"
|
759 |
msgstr ""
|
760 |
|
761 |
-
#:
|
|
|
762 |
msgid "Add New Testimonial"
|
763 |
msgstr ""
|
764 |
|
765 |
-
#: testimonials-widget.php:
|
766 |
msgid "Edit Testimonial"
|
767 |
msgstr ""
|
768 |
|
769 |
-
#:
|
|
|
770 |
msgid "No testimonials found"
|
771 |
msgstr ""
|
772 |
|
773 |
-
#: testimonials-widget.php:
|
774 |
msgid "No testimonials found in Trash"
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: testimonials-widget.php:
|
778 |
msgid "Search Testimonials"
|
779 |
msgstr ""
|
780 |
|
781 |
-
#:
|
|
|
782 |
msgid "Testimonial"
|
783 |
msgstr ""
|
784 |
|
785 |
-
#: testimonials-widget.php:
|
786 |
msgid "View Testimonial"
|
787 |
msgstr ""
|
788 |
|
789 |
-
#: testimonials-widget.php:
|
790 |
msgid "…"
|
791 |
msgstr ""
|
792 |
|
793 |
-
#: testimonials-widget.php:
|
794 |
msgid "«"
|
795 |
msgstr ""
|
796 |
|
797 |
-
#: testimonials-widget.php:
|
798 |
msgid "»"
|
799 |
msgstr ""
|
800 |
|
801 |
-
#: testimonials-widget.php:
|
802 |
msgid "Testimonial Data"
|
803 |
msgstr ""
|
804 |
|
805 |
-
#: testimonials-widget.php:
|
806 |
msgid "Enter title here"
|
807 |
msgstr ""
|
808 |
|
809 |
-
#: testimonials-widget.php:
|
810 |
msgid "Enter testimonial source here"
|
811 |
msgstr ""
|
812 |
|
813 |
-
#: testimonials-widget.php:
|
814 |
msgid "Testimonial updated. <a href=\"%s\">View testimonial</a>"
|
815 |
msgstr ""
|
816 |
|
817 |
-
#: testimonials-widget.php:
|
818 |
msgid "Custom field updated."
|
819 |
msgstr ""
|
820 |
|
821 |
-
#: testimonials-widget.php:
|
822 |
msgid "Custom field deleted."
|
823 |
msgstr ""
|
824 |
|
825 |
-
#: testimonials-widget.php:
|
826 |
msgid "Testimonial updated."
|
827 |
msgstr ""
|
828 |
|
829 |
#. translators: %s: date and time of the revision
|
830 |
|
831 |
-
#: testimonials-widget.php:
|
832 |
msgid "Testimonial restored to revision from %s"
|
833 |
msgstr ""
|
834 |
|
835 |
-
#: testimonials-widget.php:
|
836 |
msgid "Testimonial published. <a href=\"%s\">View testimonial</a>"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: testimonials-widget.php:
|
840 |
msgid "Testimonial saved."
|
841 |
msgstr ""
|
842 |
|
843 |
-
#: testimonials-widget.php:
|
844 |
msgid "Testimonial submitted. <a target=\"_blank\" href=\"%s\">Preview testimonial</a>"
|
845 |
msgstr ""
|
846 |
|
847 |
-
#: testimonials-widget.php:
|
848 |
msgid "Testimonial scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview testimonial</a>"
|
849 |
msgstr ""
|
850 |
|
851 |
-
#: testimonials-widget.php:
|
852 |
msgid "Testimonial draft updated. <a target=\"_blank\" href=\"%s\">Preview testimonial</a>"
|
853 |
msgstr ""
|
854 |
|
855 |
-
#: testimonials-widget.php:
|
856 |
msgid "If your Testimonials display has gone to funky town, please <a href=\"%s\">read the FAQ</a> about possible fixes."
|
857 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
858 |
#. Plugin Name of the plugin/theme
|
859 |
msgid "Testimonials by Aihrus"
|
860 |
msgstr ""
|
1 |
+
# Copyright (C) 2014 Testimonials by Aihrus
|
2 |
# This file is distributed under the same license as the Testimonials by Aihrus package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Testimonials by Aihrus 2.19.0\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/testimonials-widget\n"
|
7 |
+
"POT-Creation-Date: 2014-04-07 12:26:01+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: includes/class-testimonials-widget-settings.php:91
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
msgid "Testimonials Settings"
|
17 |
msgstr ""
|
18 |
|
19 |
+
#: includes/class-testimonials-widget-settings.php:91
|
20 |
+
#: includes/class-testimonials-widget.php:115
|
21 |
msgid "Settings"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: includes/class-testimonials-widget-settings.php:107
|
25 |
+
#: includes/class-testimonials-widget-settings.php:943
|
26 |
msgid "General"
|
27 |
msgstr ""
|
28 |
|
29 |
+
#: includes/class-testimonials-widget-settings.php:108
|
30 |
+
#: includes/class-testimonials-widget-settings.php:951
|
31 |
msgid "Selection"
|
32 |
msgstr ""
|
33 |
|
34 |
+
#: includes/class-testimonials-widget-settings.php:109
|
35 |
+
#: includes/class-testimonials-widget-settings.php:959
|
36 |
msgid "Ordering"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: includes/class-testimonials-widget-settings.php:110
|
40 |
+
#: includes/class-testimonials-widget-settings.php:967
|
41 |
msgid "Widget"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: includes/class-testimonials-widget-settings.php:111
|
45 |
+
#: includes/class-testimonials-widget-settings.php:975
|
46 |
msgid "Post Type"
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: includes/class-testimonials-widget-settings.php:112
|
50 |
+
#: includes/class-testimonials-widget-settings.php:983
|
51 |
+
msgid "Columns"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: includes/class-testimonials-widget-settings.php:129
|
55 |
msgid "Widget Title"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: includes/class-testimonials-widget-settings.php:130
|
59 |
+
#: includes/class-testimonials-widget-widget.php:32
|
60 |
+
#: includes/class-testimonials-widget.php:612
|
61 |
+
#: includes/class-testimonials-widget.php:658
|
62 |
msgid "Testimonials"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: includes/class-testimonials-widget-settings.php:136
|
66 |
msgid "Title Link"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/class-testimonials-widget-settings.php:137
|
70 |
msgid "URL, path, or post ID to link widget title to. Ex: http://example.com/stuff, /testimonials, 123 or "
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: includes/class-testimonials-widget-settings.php:143
|
74 |
msgid "Character Limit"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: includes/class-testimonials-widget-settings.php:144
|
78 |
msgid "Number of characters to limit non-single testimonial views to"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: includes/class-testimonials-widget-settings.php:150
|
82 |
msgid "Rotation Speed"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: includes/class-testimonials-widget-settings.php:151
|
86 |
msgid "Number of seconds between testimonial rotations or 0 for no rotation at all refresh"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: includes/class-testimonials-widget-settings.php:163
|
90 |
msgid "Additional Widget Options"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: includes/class-testimonials-widget-settings.php:169
|
94 |
msgid "Transition Mode?"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: includes/class-testimonials-widget-settings.php:170
|
98 |
msgid "Type of transition between slides"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: includes/class-testimonials-widget-settings.php:173
|
102 |
msgid "Fade"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: includes/class-testimonials-widget-settings.php:174
|
106 |
msgid "Horizontal"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: includes/class-testimonials-widget-settings.php:175
|
110 |
msgid "Vertical"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/class-testimonials-widget-settings.php:182
|
114 |
msgid "Show Play/Pause?"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: includes/class-testimonials-widget-settings.php:183
|
118 |
msgid "Display start and stop buttons underneath the testimonial slider."
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: includes/class-testimonials-widget-settings.php:191
|
122 |
msgid "Enable Video?"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: includes/class-testimonials-widget-settings.php:192
|
126 |
msgid "Only enable when displaying video content."
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: includes/class-testimonials-widget-settings.php:199
|
130 |
msgid "Keep Whitespace?"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: includes/class-testimonials-widget-settings.php:200
|
134 |
msgid "Keeps testimonials looking as entered than sans auto-formatting"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: includes/class-testimonials-widget-settings.php:207
|
138 |
msgid "Testimonial Bottom Text"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: includes/class-testimonials-widget-settings.php:208
|
142 |
msgid "Custom text or HTML for bottom of testimonials"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: includes/class-testimonials-widget-settings.php:220
|
146 |
msgid "General Options"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: includes/class-testimonials-widget-settings.php:225
|
150 |
+
msgid "Exclude bxSlider CSS?"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: includes/class-testimonials-widget-settings.php:226
|
154 |
+
msgid "For a bare-bones, unthemed slider."
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: includes/class-testimonials-widget-settings.php:233
|
158 |
+
msgid "Include IE7 CSS?"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: includes/class-testimonials-widget-settings.php:240
|
162 |
+
msgid "Hide built-in quotes?"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: includes/class-testimonials-widget-settings.php:241
|
166 |
+
msgid "Remove open and close quote span tags surrounding testimonial content"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: includes/class-testimonials-widget-settings.php:247
|
170 |
+
msgid "Remove `.hentry` CSS?"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: includes/class-testimonials-widget-settings.php:248
|
174 |
+
msgid "Some themes use class `.hentry` in a manner that breaks Testimonials' CSS"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: includes/class-testimonials-widget-settings.php:255
|
178 |
+
msgid "Use `<q>` tag?"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: includes/class-testimonials-widget-settings.php:256
|
182 |
+
msgid "Not HTML5 compliant"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: includes/class-testimonials-widget-settings.php:262
|
186 |
+
msgid "Fields to Show"
|
187 |
msgstr ""
|
188 |
|
189 |
+
#: includes/class-testimonials-widget-settings.php:267
|
190 |
msgid "Hide Gravatar Image?"
|
191 |
msgstr ""
|
192 |
|
193 |
+
#: includes/class-testimonials-widget-settings.php:273
|
194 |
+
#: includes/class-testimonials-widget-settings.php:566
|
195 |
msgid "Hide Image?"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: includes/class-testimonials-widget-settings.php:279
|
199 |
msgid "Hide Image in Single View?"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: includes/class-testimonials-widget-settings.php:286
|
203 |
msgid "Hide Testimonial Content?"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: includes/class-testimonials-widget-settings.php:292
|
207 |
msgid "Hide Author/Source?"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: includes/class-testimonials-widget-settings.php:295
|
211 |
msgid "Don't display \"Post Title\" in cite"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: includes/class-testimonials-widget-settings.php:299
|
215 |
+
#: includes/class-testimonials-widget-settings.php:600
|
216 |
msgid "Hide Email?"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: includes/class-testimonials-widget-settings.php:306
|
220 |
+
#: includes/class-testimonials-widget-settings.php:582
|
221 |
msgid "Hide Job Title?"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: includes/class-testimonials-widget-settings.php:312
|
225 |
+
#: includes/class-testimonials-widget-settings.php:591
|
226 |
msgid "Hide Location?"
|
227 |
msgstr ""
|
228 |
|
229 |
+
#: includes/class-testimonials-widget-settings.php:318
|
230 |
+
#: includes/class-testimonials-widget-settings.php:609
|
231 |
msgid "Hide Company?"
|
232 |
msgstr ""
|
233 |
|
234 |
+
#: includes/class-testimonials-widget-settings.php:324
|
235 |
+
#: includes/class-testimonials-widget-settings.php:618
|
236 |
msgid "Hide URL?"
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: includes/class-testimonials-widget-settings.php:330
|
240 |
+
msgid "Miscellanious"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: includes/class-testimonials-widget-settings.php:335
|
244 |
+
msgid "Default Reviewed Item?"
|
245 |
+
msgstr ""
|
246 |
+
|
247 |
+
#: includes/class-testimonials-widget-settings.php:336
|
248 |
+
msgid "Name of thing being referenced in testimonials"
|
249 |
+
msgstr ""
|
250 |
+
|
251 |
+
#: includes/class-testimonials-widget-settings.php:342
|
252 |
+
msgid "Default Reviewed Item URL?"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: includes/class-testimonials-widget-settings.php:343
|
256 |
+
msgid "URL of thing being referenced in testimonials"
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#: includes/class-testimonials-widget-settings.php:350
|
260 |
msgid "Enable Paging?"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: includes/class-testimonials-widget-settings.php:351
|
264 |
+
msgid "For `[testimonials]`"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: includes/class-testimonials-widget-settings.php:354
|
268 |
msgid "Disable"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: includes/class-testimonials-widget-settings.php:355
|
272 |
msgid "Enable"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: includes/class-testimonials-widget-settings.php:356
|
276 |
msgid "Before testimonials"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: includes/class-testimonials-widget-settings.php:357
|
280 |
msgid "After testimonials"
|
281 |
msgstr ""
|
282 |
|
283 |
+
#: includes/class-testimonials-widget-settings.php:363
|
284 |
+
msgid "Adds HTML tag markup per the <a href=\"%s\">Review schema</a> to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results."
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: includes/class-testimonials-widget-settings.php:366
|
288 |
+
msgid "Enable Review Schema?"
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: includes/class-testimonials-widget-settings.php:374
|
292 |
+
msgid "Enable [shortcodes]?"
|
293 |
+
msgstr ""
|
294 |
+
|
295 |
+
#: includes/class-testimonials-widget-settings.php:375
|
296 |
msgid "If unchecked, shortcodes are stripped."
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: includes/class-testimonials-widget-settings.php:382
|
300 |
+
msgid "Hide \"Testimonials Not Found\"?"
|
301 |
+
msgstr ""
|
302 |
+
|
303 |
+
#: includes/class-testimonials-widget-settings.php:388
|
304 |
+
msgid "URL Target"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: includes/class-testimonials-widget-settings.php:389
|
308 |
+
msgid "Add target to all URLs; leave blank if none"
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: includes/class-testimonials-widget-settings.php:400
|
312 |
msgid "Selection Options"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: includes/class-testimonials-widget-settings.php:406
|
316 |
msgid "Category Filter"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: includes/class-testimonials-widget-settings.php:407
|
320 |
msgid "Comma separated category names. Ex: Category A, Another category"
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: includes/class-testimonials-widget-settings.php:414
|
324 |
msgid "Tags Filter"
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: includes/class-testimonials-widget-settings.php:415
|
328 |
msgid "Comma separated tag names. Ex: Tag A, Another tag"
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: includes/class-testimonials-widget-settings.php:422
|
332 |
msgid "Require All Tags?"
|
333 |
msgstr ""
|
334 |
|
335 |
+
#: includes/class-testimonials-widget-settings.php:423
|
336 |
msgid "Select only testimonials with all of the given tags"
|
337 |
msgstr ""
|
338 |
|
339 |
+
#: includes/class-testimonials-widget-settings.php:430
|
340 |
msgid "Include IDs Filter"
|
341 |
msgstr ""
|
342 |
|
343 |
+
#: includes/class-testimonials-widget-settings.php:431
|
344 |
+
#: includes/class-testimonials-widget-settings.php:438
|
345 |
msgid "Comma separated testimonial IDs. Ex: 3,1,2"
|
346 |
msgstr ""
|
347 |
|
348 |
+
#: includes/class-testimonials-widget-settings.php:437
|
349 |
msgid "Exclude IDs Filter"
|
350 |
msgstr ""
|
351 |
|
352 |
+
#: includes/class-testimonials-widget-settings.php:444
|
353 |
msgid "Limit"
|
354 |
msgstr ""
|
355 |
|
356 |
+
#: includes/class-testimonials-widget-settings.php:445
|
357 |
msgid "Number of testimonials to select per instance"
|
358 |
msgstr ""
|
359 |
|
360 |
+
#: includes/class-testimonials-widget-settings.php:458
|
361 |
msgid "Ordering Options"
|
362 |
msgstr ""
|
363 |
|
364 |
+
#: includes/class-testimonials-widget-settings.php:464
|
365 |
msgid "Random Order?"
|
366 |
msgstr ""
|
367 |
|
368 |
+
#: includes/class-testimonials-widget-settings.php:465
|
369 |
msgid "If checked, ignores ORDER BY, ORDER BY meta_key, and ORDER BY Order. Widgets are random by default automatically"
|
370 |
msgstr ""
|
371 |
|
372 |
+
#: includes/class-testimonials-widget-settings.php:472
|
373 |
msgid "ORDER BY"
|
374 |
msgstr ""
|
375 |
|
376 |
+
#: includes/class-testimonials-widget-settings.php:473
|
377 |
msgid "Used when \"Random Order\" is disabled"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: includes/class-testimonials-widget-settings.php:476
|
381 |
msgid "Testimonial ID"
|
382 |
msgstr ""
|
383 |
|
384 |
+
#: includes/class-testimonials-widget-settings.php:477
|
385 |
msgid "Author"
|
386 |
msgstr ""
|
387 |
|
388 |
+
#: includes/class-testimonials-widget-settings.php:478
|
389 |
+
#: includes/class-testimonials-widget.php:549
|
390 |
msgid "Date"
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: includes/class-testimonials-widget-settings.php:479
|
394 |
msgid "Menu Order"
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: includes/class-testimonials-widget-settings.php:480
|
398 |
+
#: includes/class-testimonials-widget.php:547
|
399 |
msgid "Source"
|
400 |
msgstr ""
|
401 |
|
402 |
+
#: includes/class-testimonials-widget-settings.php:481
|
403 |
msgid "No order"
|
404 |
msgstr ""
|
405 |
|
406 |
+
#: includes/class-testimonials-widget-settings.php:489
|
407 |
msgid "ORDER BY meta_key"
|
408 |
msgstr ""
|
409 |
|
410 |
+
#: includes/class-testimonials-widget-settings.php:490
|
411 |
msgid "Used when \"Random Order\" is disabled and sorting by a testimonials meta key is needed. Overrides ORDER BY"
|
412 |
msgstr ""
|
413 |
|
414 |
+
#: includes/class-testimonials-widget-settings.php:493
|
415 |
msgid "None"
|
416 |
msgstr ""
|
417 |
|
418 |
+
#: includes/class-testimonials-widget-settings.php:494
|
419 |
+
#: includes/class-testimonials-widget.php:578
|
420 |
+
#: includes/class-testimonials-widget.php:1683
|
421 |
msgid "Job Title"
|
422 |
msgstr ""
|
423 |
|
424 |
+
#: includes/class-testimonials-widget-settings.php:495
|
425 |
+
#: includes/class-testimonials-widget.php:588
|
426 |
+
#: includes/class-testimonials-widget.php:1695
|
427 |
msgid "Email"
|
428 |
msgstr ""
|
429 |
|
430 |
+
#: includes/class-testimonials-widget-settings.php:496
|
431 |
+
#: includes/class-testimonials-widget.php:583
|
432 |
+
#: includes/class-testimonials-widget.php:1689
|
433 |
msgid "Location"
|
434 |
msgstr ""
|
435 |
|
436 |
+
#: includes/class-testimonials-widget-settings.php:497
|
437 |
+
#: includes/class-testimonials-widget.php:593
|
438 |
+
#: includes/class-testimonials-widget.php:1701
|
439 |
msgid "Company"
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: includes/class-testimonials-widget-settings.php:498
|
443 |
+
#: includes/class-testimonials-widget.php:598
|
444 |
+
#: includes/class-testimonials-widget.php:1707
|
445 |
msgid "URL"
|
446 |
msgstr ""
|
447 |
|
448 |
+
#: includes/class-testimonials-widget-settings.php:505
|
449 |
msgid "ORDER BY Order"
|
450 |
msgstr ""
|
451 |
|
452 |
+
#: includes/class-testimonials-widget-settings.php:508
|
453 |
msgid "Descending"
|
454 |
msgstr ""
|
455 |
|
456 |
+
#: includes/class-testimonials-widget-settings.php:509
|
457 |
msgid "Ascending"
|
458 |
msgstr ""
|
459 |
|
460 |
+
#: includes/class-testimonials-widget-settings.php:523
|
461 |
msgid "Allow Comments?"
|
462 |
msgstr ""
|
463 |
|
464 |
+
#: includes/class-testimonials-widget-settings.php:524
|
465 |
msgid "Only affects the Testimonials post edit page. Your theme controls the front-end view."
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: includes/class-testimonials-widget-settings.php:530
|
469 |
msgid "URL slug-name for <a href=\"%1s\">testimonials archive</a> page."
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: includes/class-testimonials-widget-settings.php:536
|
473 |
msgid "Archive Page URL"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: includes/class-testimonials-widget-settings.php:543
|
477 |
msgid "URL slug-name for testimonial view pages. Shouldn't be the same as the Archive Page URL nor should it match a page URL slug."
|
478 |
msgstr ""
|
479 |
|
480 |
+
#: includes/class-testimonials-widget-settings.php:547
|
481 |
msgid "Testimonial Page URL"
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: includes/class-testimonials-widget-settings.php:557
|
485 |
+
msgid "Hide ID?"
|
486 |
+
msgstr ""
|
487 |
+
|
488 |
+
#: includes/class-testimonials-widget-settings.php:574
|
489 |
+
msgid "Hide Shortcode?"
|
490 |
+
msgstr ""
|
491 |
+
|
492 |
+
#: includes/class-testimonials-widget-settings.php:628
|
493 |
msgid "Reset & Compatiblity Options"
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: includes/class-testimonials-widget-settings.php:634
|
497 |
msgid "Don't Use Default Taxonomies?"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: includes/class-testimonials-widget-settings.php:637
|
501 |
msgid "If checked, use Testimonials' own category and tag taxonomies instead"
|
502 |
msgstr ""
|
503 |
|
504 |
+
#: includes/class-testimonials-widget-settings.php:645
|
505 |
msgid "Version Based Options"
|
506 |
msgstr ""
|
507 |
|
508 |
+
#: includes/class-testimonials-widget-settings.php:651
|
509 |
msgid "Use bxSlider?"
|
510 |
msgstr ""
|
511 |
|
512 |
+
#: includes/class-testimonials-widget-settings.php:652
|
513 |
msgid "Pre 2.15.0, Testimonials' used custom JavaScript for transitions."
|
514 |
msgstr ""
|
515 |
|
516 |
+
#: includes/class-testimonials-widget-settings.php:665
|
517 |
msgid "Disable Animation?"
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: includes/class-testimonials-widget-settings.php:666
|
521 |
msgid "Pre 2.15.0, Disable animation between testimonial transitions. Useful when stacking widgets."
|
522 |
msgstr ""
|
523 |
|
524 |
+
#: includes/class-testimonials-widget-settings.php:674
|
525 |
msgid "Fade Out Speed"
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: includes/class-testimonials-widget-settings.php:675
|
529 |
+
#: includes/class-testimonials-widget-settings.php:683
|
530 |
msgid "Pre 2.15.0, Transition duration in milliseconds; higher values indicate slower animations, not faster ones."
|
531 |
msgstr ""
|
532 |
|
533 |
+
#: includes/class-testimonials-widget-settings.php:682
|
534 |
msgid "Fade In Speed"
|
535 |
msgstr ""
|
536 |
|
537 |
+
#: includes/class-testimonials-widget-settings.php:690
|
538 |
msgid "Height"
|
539 |
msgstr ""
|
540 |
|
541 |
+
#: includes/class-testimonials-widget-settings.php:691
|
542 |
msgid "Pre 2.15.0, Testimonials height, in pixels. Overrides minimum and maximum height"
|
543 |
msgstr ""
|
544 |
|
545 |
+
#: includes/class-testimonials-widget-settings.php:697
|
546 |
msgid "Minimum Height"
|
547 |
msgstr ""
|
548 |
|
549 |
+
#: includes/class-testimonials-widget-settings.php:698
|
550 |
msgid "Pre 2.15.0, Set for minimum display height, in pixels"
|
551 |
msgstr ""
|
552 |
|
553 |
+
#: includes/class-testimonials-widget-settings.php:704
|
554 |
msgid "Maximum Height"
|
555 |
msgstr ""
|
556 |
|
557 |
+
#: includes/class-testimonials-widget-settings.php:705
|
558 |
msgid "Pre 2.15.0, Set for maximum display height, in pixels"
|
559 |
msgstr ""
|
560 |
|
561 |
+
#: includes/class-testimonials-widget-settings.php:929
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
562 |
msgid "These Testimonials Settings establish the default option values for shortcodes, theme functions, and widget instances. Widgets, once created no longer inherit these global settings. Therefore, you'll need to update each widget with the new settings. It might be easier to delete the widget and then recreate it."
|
563 |
msgstr ""
|
564 |
|
565 |
+
#: includes/class-testimonials-widget-settings.php:931
|
566 |
msgid "Shortcode option names are listed below each entry."
|
567 |
msgstr ""
|
568 |
|
569 |
+
#: includes/class-testimonials-widget-settings.php:934
|
570 |
msgid "View the <a href=\"%s\">Testimonials documentation</a>."
|
571 |
msgstr ""
|
572 |
|
573 |
+
#: includes/class-testimonials-widget-settings.php:944
|
574 |
msgid "Show or hide optional fields."
|
575 |
msgstr ""
|
576 |
|
577 |
+
#: includes/class-testimonials-widget-settings.php:952
|
578 |
msgid "Options used to select testimonials."
|
579 |
msgstr ""
|
580 |
|
581 |
+
#: includes/class-testimonials-widget-settings.php:960
|
582 |
msgid "Options used to determine displayed testimonials ordering."
|
583 |
msgstr ""
|
584 |
|
585 |
+
#: includes/class-testimonials-widget-settings.php:968
|
586 |
msgid "Options related to showing testimonials in widgets."
|
587 |
msgstr ""
|
588 |
|
589 |
+
#: includes/class-testimonials-widget-settings.php:976
|
590 |
msgid "Archive and singular page URL related testimonials options."
|
591 |
msgstr ""
|
592 |
|
593 |
+
#: includes/class-testimonials-widget-settings.php:984
|
594 |
+
msgid "Allowed columns to display on edit page."
|
595 |
+
msgstr ""
|
596 |
+
|
597 |
+
#: includes/class-testimonials-widget-settings.php:991
|
598 |
msgid "Compatibility & Reset"
|
599 |
msgstr ""
|
600 |
|
601 |
+
#: includes/class-testimonials-widget-settings.php:992
|
602 |
msgid "Backwards compatibility, import/export options, and reset options."
|
603 |
msgstr ""
|
604 |
|
605 |
+
#: includes/class-testimonials-widget-widget.php:30
|
606 |
msgid "Display testimonials with multiple selection and display options"
|
607 |
msgstr ""
|
608 |
|
609 |
+
#: includes/class-testimonials-widget-widget.php:96
|
610 |
msgid "CSS Class"
|
611 |
msgstr ""
|
612 |
|
613 |
+
#: includes/class-testimonials-widget-widget.php:97
|
614 |
msgid "This widget's unique CSS class for styling"
|
615 |
msgstr ""
|
616 |
|
617 |
+
#: includes/class-testimonials-widget.php:143
|
618 |
+
#: includes/class-testimonials-widget.php:2050
|
|
|
|
|
|
|
619 |
msgid "Testimonials Shortcode Examples"
|
620 |
msgstr ""
|
621 |
|
622 |
+
#: includes/class-testimonials-widget.php:143
|
623 |
msgid "E.g. Shortcodes"
|
624 |
msgstr ""
|
625 |
|
626 |
+
#: includes/class-testimonials-widget.php:334
|
627 |
msgid "If your Testimonials display has gone to funky town, please <a href=\"%s\">read the FAQ</a> about possible CSS fixes."
|
628 |
msgstr ""
|
629 |
|
630 |
+
#: includes/class-testimonials-widget.php:548
|
631 |
+
msgid "Published by"
|
632 |
msgstr ""
|
633 |
|
634 |
+
#: includes/class-testimonials-widget.php:554
|
635 |
+
#: includes/class-testimonials-widget.php:557
|
636 |
+
msgid "Category"
|
637 |
msgstr ""
|
638 |
|
639 |
+
#: includes/class-testimonials-widget.php:555
|
640 |
+
#: includes/class-testimonials-widget.php:558
|
641 |
+
msgid "Tags"
|
642 |
msgstr ""
|
643 |
|
644 |
+
#: includes/class-testimonials-widget.php:563
|
645 |
+
msgid "ID"
|
646 |
msgstr ""
|
647 |
|
648 |
+
#: includes/class-testimonials-widget.php:568
|
649 |
+
msgid "Image"
|
650 |
msgstr ""
|
651 |
|
652 |
+
#: includes/class-testimonials-widget.php:573
|
653 |
+
msgid "Shortcodes"
|
654 |
msgstr ""
|
655 |
|
656 |
+
#: includes/class-testimonials-widget.php:609
|
657 |
msgid "Add New"
|
658 |
msgstr ""
|
659 |
|
660 |
+
#: includes/class-testimonials-widget.php:610
|
661 |
+
#: includes/class-testimonials-widget.php:613
|
662 |
msgid "Add New Testimonial"
|
663 |
msgstr ""
|
664 |
|
665 |
+
#: includes/class-testimonials-widget.php:611
|
666 |
msgid "Edit Testimonial"
|
667 |
msgstr ""
|
668 |
|
669 |
+
#: includes/class-testimonials-widget.php:614
|
670 |
+
#: includes/class-testimonials-widget.php:1040
|
671 |
msgid "No testimonials found"
|
672 |
msgstr ""
|
673 |
|
674 |
+
#: includes/class-testimonials-widget.php:615
|
675 |
msgid "No testimonials found in Trash"
|
676 |
msgstr ""
|
677 |
|
678 |
+
#: includes/class-testimonials-widget.php:617
|
679 |
msgid "Search Testimonials"
|
680 |
msgstr ""
|
681 |
|
682 |
+
#: includes/class-testimonials-widget.php:618
|
683 |
+
#: includes/class-testimonials-widget.php:1795
|
684 |
msgid "Testimonial"
|
685 |
msgstr ""
|
686 |
|
687 |
+
#: includes/class-testimonials-widget.php:619
|
688 |
msgid "View Testimonial"
|
689 |
msgstr ""
|
690 |
|
691 |
+
#: includes/class-testimonials-widget.php:1206
|
692 |
msgid "…"
|
693 |
msgstr ""
|
694 |
|
695 |
+
#: includes/class-testimonials-widget.php:1413
|
696 |
msgid "«"
|
697 |
msgstr ""
|
698 |
|
699 |
+
#: includes/class-testimonials-widget.php:1421
|
700 |
msgid "»"
|
701 |
msgstr ""
|
702 |
|
703 |
+
#: includes/class-testimonials-widget.php:1719
|
704 |
msgid "Testimonial Data"
|
705 |
msgstr ""
|
706 |
|
707 |
+
#: includes/class-testimonials-widget.php:1744
|
708 |
msgid "Enter title here"
|
709 |
msgstr ""
|
710 |
|
711 |
+
#: includes/class-testimonials-widget.php:1745
|
712 |
msgid "Enter testimonial source here"
|
713 |
msgstr ""
|
714 |
|
715 |
+
#: includes/class-testimonials-widget.php:1770
|
716 |
msgid "Testimonial updated. <a href=\"%s\">View testimonial</a>"
|
717 |
msgstr ""
|
718 |
|
719 |
+
#: includes/class-testimonials-widget.php:1771
|
720 |
msgid "Custom field updated."
|
721 |
msgstr ""
|
722 |
|
723 |
+
#: includes/class-testimonials-widget.php:1772
|
724 |
msgid "Custom field deleted."
|
725 |
msgstr ""
|
726 |
|
727 |
+
#: includes/class-testimonials-widget.php:1773
|
728 |
msgid "Testimonial updated."
|
729 |
msgstr ""
|
730 |
|
731 |
#. translators: %s: date and time of the revision
|
732 |
|
733 |
+
#: includes/class-testimonials-widget.php:1775
|
734 |
msgid "Testimonial restored to revision from %s"
|
735 |
msgstr ""
|
736 |
|
737 |
+
#: includes/class-testimonials-widget.php:1776
|
738 |
msgid "Testimonial published. <a href=\"%s\">View testimonial</a>"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: includes/class-testimonials-widget.php:1777
|
742 |
msgid "Testimonial saved."
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: includes/class-testimonials-widget.php:1778
|
746 |
msgid "Testimonial submitted. <a target=\"_blank\" href=\"%s\">Preview testimonial</a>"
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: includes/class-testimonials-widget.php:1779
|
750 |
msgid "Testimonial scheduled for: <strong>%1$s</strong>. <a target=\"_blank\" href=\"%2$s\">Preview testimonial</a>"
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: includes/class-testimonials-widget.php:1780
|
754 |
msgid "Testimonial draft updated. <a target=\"_blank\" href=\"%s\">Preview testimonial</a>"
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: includes/class-testimonials-widget.php:2041
|
758 |
msgid "If your Testimonials display has gone to funky town, please <a href=\"%s\">read the FAQ</a> about possible fixes."
|
759 |
msgstr ""
|
760 |
+
|
761 |
+
#: includes/class-testimonials-widget.php:2096
|
762 |
+
msgid "Failed version check"
|
763 |
+
msgstr ""
|
764 |
+
|
765 |
+
#: includes/class-testimonials-widget.php:2127
|
766 |
+
msgid "Shortcode"
|
767 |
+
msgstr ""
|
768 |
+
|
769 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:40
|
770 |
+
msgid "`aihr_check_aihrus_framework` requires $file argument"
|
771 |
+
msgstr ""
|
772 |
+
|
773 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:83
|
774 |
+
#: includes/requirements.php:58
|
775 |
+
msgid "<a href=\"%1$s\">Update plugins</a>. <a href=\"%2$s\">More information</a>."
|
776 |
+
msgstr ""
|
777 |
+
|
778 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:94
|
779 |
+
msgid "Plugin \"%1$s\" is causing the out of date issue."
|
780 |
+
msgstr ""
|
781 |
+
|
782 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:99
|
783 |
+
msgid "Plugin \"%1$s\" has been deactivated as it requires Aihrus Framework %2$s or newer. You're running Aihrus Framework %4$s. Once corrected, \"%1$s\" can be activated. %5$s %3$s"
|
784 |
+
msgstr ""
|
785 |
+
|
786 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:108
|
787 |
+
msgid "`aihr_check_php` requires $file argument"
|
788 |
+
msgstr ""
|
789 |
+
|
790 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:147
|
791 |
+
msgid "Plugin \"%1$s\" has been deactivated as it requires PHP %2$s or newer. You're running PHP %4$s. Once corrected, \"%1$s\" can be activated. <a href=\"%3$s\">More information</a>."
|
792 |
+
msgstr ""
|
793 |
+
|
794 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:156
|
795 |
+
msgid "`aihr_check_wp` requires $file argument"
|
796 |
+
msgstr ""
|
797 |
+
|
798 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:199
|
799 |
+
msgid "Plugin \"%1$s\" has been deactivated as it requires WordPress %2$s or newer. You're running WordPress %4$s. Once corrected, \"%1$s\" can be activated. <a href=\"%3$s\">Update WordPress</a>."
|
800 |
+
msgstr ""
|
801 |
+
|
802 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:229
|
803 |
+
msgid "<a href=\"%1$s\">update to</a>"
|
804 |
+
msgstr ""
|
805 |
+
|
806 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:234
|
807 |
+
msgid "<a href=\"%1$s\">install</a>"
|
808 |
+
msgstr ""
|
809 |
+
|
810 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:237
|
811 |
+
msgid "<a href=\"%1$s\">activate</a>"
|
812 |
+
msgstr ""
|
813 |
+
|
814 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:241
|
815 |
+
msgid "Plugin \"%3$s\" has been deactivated. Please %1$s \"%4$s\" version %2$s or newer before activating \"%3$s\"."
|
816 |
+
msgstr ""
|
817 |
+
|
818 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:254
|
819 |
+
msgid "<a href=\"%1$s\">%2$s > Settings</a>, <em>Premium</em> tab, <em>License Key</em> entry"
|
820 |
+
msgstr ""
|
821 |
+
|
822 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:259
|
823 |
+
msgid "<a href=\"%s\">Where's my license key?</a>"
|
824 |
+
msgstr ""
|
825 |
+
|
826 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:264
|
827 |
+
msgid "<a href=\"%1$s\">%2$s</a>"
|
828 |
+
msgstr ""
|
829 |
+
|
830 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:268
|
831 |
+
msgid "Plugin \"%1$s\" requires license activation before updating will work. Please activate the license key through %2$s. No license key? See \"%3$s\" or purchase \"%4$s\"."
|
832 |
+
msgstr ""
|
833 |
+
|
834 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:279
|
835 |
+
msgid "`aihr_deactivate_plugin` requires $file argument"
|
836 |
+
msgstr ""
|
837 |
+
|
838 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:318
|
839 |
+
msgid "Unknown"
|
840 |
+
msgstr ""
|
841 |
+
|
842 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:321
|
843 |
+
msgid "Plugin \"%1$s\" has been deactivated due to \"%2$s\". Once corrected, \"%1$s\" can be activated."
|
844 |
+
msgstr ""
|
845 |
+
|
846 |
+
#: includes/libraries/aihrus-framework/aihrus-framework.php:332
|
847 |
+
msgid "`aihr_deactivate_plugin_do` requires $file argument"
|
848 |
+
msgstr ""
|
849 |
+
|
850 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-common.php:156
|
851 |
+
msgid "Please donate $5 towards ongoing free support and development of the \"%1$s\" plugin. %2$s"
|
852 |
+
msgstr ""
|
853 |
+
|
854 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:62
|
855 |
+
msgid "Reset"
|
856 |
+
msgstr ""
|
857 |
+
|
858 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:63
|
859 |
+
msgid "About"
|
860 |
+
msgstr ""
|
861 |
+
|
862 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:81
|
863 |
+
msgid "Export Settings"
|
864 |
+
msgstr ""
|
865 |
+
|
866 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:83
|
867 |
+
msgid "These are your current settings in a serialized format. Copy the contents to make a backup of your settings."
|
868 |
+
msgstr ""
|
869 |
+
|
870 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:91
|
871 |
+
msgid "Import Settings"
|
872 |
+
msgstr ""
|
873 |
+
|
874 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:93
|
875 |
+
msgid "Paste new serialized settings here to overwrite your current configuration."
|
876 |
+
msgstr ""
|
877 |
+
|
878 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:97
|
879 |
+
msgid "Delete all %s data and options from database on plugin deletion. Even if this option isn't checked, WordPress will still give a data deletion warning."
|
880 |
+
msgstr ""
|
881 |
+
|
882 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:101
|
883 |
+
msgid "Remove Plugin Data on Deletion?"
|
884 |
+
msgstr ""
|
885 |
+
|
886 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:110
|
887 |
+
msgid "Reset to Defaults?"
|
888 |
+
msgstr ""
|
889 |
+
|
890 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:113
|
891 |
+
msgid "Check this box to reset options to their defaults"
|
892 |
+
msgstr ""
|
893 |
+
|
894 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:237
|
895 |
+
msgid "<img class=\"alignright size-medium\" src=\"%1$simages/michael-cannon-red-square-300x2251.jpg\" alt=\"Michael in Red Square, Moscow, Russia\" width=\"300\" height=\"225\" /><a href=\"%2$s\">%3$s</a> is by <a href=\"%4$s\">Michael Cannon</a>. He's <a href=\"%5$s\">Peichi’s</a> smiling man, an adventurous <a href=\"%6$s\" target=\"_blank\">water-rat</a>, <a href=\"%7$s\">chief people officer</a>, <a href=\"%8$s\">cyclist</a>, <a href=\"%9$s\">full stack developer</a>, <a href=\"%10$s\">poet</a>, <a href=\"%11$s\">WWOOF’er</a> and <a href=\"%12$s\">world traveler</a>."
|
896 |
+
msgstr ""
|
897 |
+
|
898 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:280
|
899 |
+
msgid "Save Changes"
|
900 |
+
msgstr ""
|
901 |
+
|
902 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:288
|
903 |
+
msgid "If you like this plugin, please <a href=\"%1$s\" title=\"Donate for Good Karma\"><img src=\"%2$s\" border=\"0\" alt=\"Donate for Good Karma\" /></a> or <a href=\"%3$s\" title=\"purchase premium WordPress plugins from Aihrus \">purchase the Premium version</a> to help fund further development and <a href=\"%4$s\" title=\"Support forums\">support</a>."
|
904 |
+
msgstr ""
|
905 |
+
|
906 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:299
|
907 |
+
msgid "Copyright ©%1$s <a href=\"%2$s\">Aihrus</a>."
|
908 |
+
msgstr ""
|
909 |
+
|
910 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:581
|
911 |
+
msgid "Settings saved."
|
912 |
+
msgstr ""
|
913 |
+
|
914 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-settings.php:638
|
915 |
+
msgid "Required"
|
916 |
+
msgstr ""
|
917 |
+
|
918 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-widget.php:140
|
919 |
+
msgid "Expand/Collapse All Options"
|
920 |
+
msgstr ""
|
921 |
+
|
922 |
+
#: includes/libraries/aihrus-framework/includes/class-aihrus-widget.php:149
|
923 |
+
msgid "Expand/Collapse"
|
924 |
+
msgstr ""
|
925 |
+
|
926 |
+
#: includes/requirements.php:30
|
927 |
+
msgid "Missing Aihrus Framework"
|
928 |
+
msgstr ""
|
929 |
+
|
930 |
+
#: includes/requirements.php:33
|
931 |
+
msgid "Old Aihrus Framework version detected"
|
932 |
+
msgstr ""
|
933 |
+
|
934 |
+
#: includes/requirements.php:37
|
935 |
+
msgid "Old PHP version detected"
|
936 |
+
msgstr ""
|
937 |
+
|
938 |
+
#: includes/requirements.php:41
|
939 |
+
msgid "Old WordPress version detected"
|
940 |
+
msgstr ""
|
941 |
+
|
942 |
+
#: includes/requirements.php:60
|
943 |
+
msgid "Plugin \"%1$s\" has been deactivated as it requires a current Aihrus Framework. Once corrected, \"%1$s\" can be activated. %2$s"
|
944 |
+
msgstr ""
|
945 |
#. Plugin Name of the plugin/theme
|
946 |
msgid "Testimonials by Aihrus"
|
947 |
msgstr ""
|
lib/aihrus/.gitignore
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
000-code-qa.txt
|
2 |
-
diff.txt
|
|
|
|
lib/aihrus/CHANGELOG.md
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
# CHANGELOG Aihrus Framework
|
2 |
-
|
3 |
-
## 1.0.1-alpha
|
4 |
-
* Add strip_protocol
|
5 |
-
* Add valid_hash check
|
6 |
-
* Move relicensing to plugin level
|
7 |
-
|
8 |
-
## 1.0.0
|
9 |
-
* Enable aihr_check_aihrus_framework
|
10 |
-
|
11 |
-
## master
|
12 |
-
* Abstract notice helper methods as functions
|
13 |
-
* Add TODO
|
14 |
-
* Add `add_media` post attachment helper
|
15 |
-
* Add `clean_string` trim, strip_shortcodes, and strip_tags a string
|
16 |
-
* Add `create_link( $link )`
|
17 |
-
* Add `create_nonce( $action )`
|
18 |
-
* Add `file_get_contents_curl`
|
19 |
-
* Add `get_image_src`
|
20 |
-
* Add `is_true`, terms, url validate cases
|
21 |
-
* Add `truncate`
|
22 |
-
* Add `verify_nonce( $nonce, $action )`
|
23 |
-
* Add abstract class Aihrus_Settings
|
24 |
-
* Add abstract class Aihrus_Widget
|
25 |
-
* Add aihr_notice_license
|
26 |
-
* Add name filed to aihr_check_php
|
27 |
-
* Add requirements helper
|
28 |
-
* Add shortcode id helpers
|
29 |
-
* Allow reset_defaults in widget
|
30 |
-
* BUGFIX Method version not static
|
31 |
-
* BUGFIX Widget title is same as link
|
32 |
-
* CLOSES #2 Disable purchase premium links if premium is active
|
33 |
-
* Check for PHP 5.3
|
34 |
-
* Convert TODO to https://github.com/michael-cannon/aihrus-framework/issues
|
35 |
-
* Display option values as is
|
36 |
-
* Encase pronouns in double-quotes
|
37 |
-
* RESOLVES #1 PHP Version checking
|
38 |
-
* RESOLVES #3 Add WordPress version check
|
39 |
-
* Remove unused methods
|
40 |
-
* Rename $options[$id] to $field_value
|
41 |
-
* Rename no_code to show_code
|
42 |
-
* Revise create_link parameters
|
43 |
-
* Settings link with null post_type
|
44 |
-
* Switch from require_once to require file inclusion
|
45 |
-
* Use `aihr_` as function prefix
|
46 |
-
* Widget title uses create_link
|
47 |
-
* static::ITEM_NAME to static::NAME
|
48 |
-
|
49 |
-
## 0.0.0
|
50 |
-
* Initial code release
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/aihrus/TODO.md
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
# TODO Aihrus Framework
|
2 |
-
|
3 |
-
* TBD
|
|
|
|
|
|
phpcs.ruleset.xml
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Aihrus">
|
3 |
-
<description>
|
4 |
-
Custom phpcs rules to check for Aihrus' WordPress projects
|
5 |
-
</description>
|
6 |
-
|
7 |
-
<exclude-pattern>lib/class-redrokk-metabox-class.php</exclude-pattern>
|
8 |
-
<exclude-pattern>lib/Akismet.class.php</exclude-pattern>
|
9 |
-
|
10 |
-
<rule ref="Generic">
|
11 |
-
<exclude name="Generic.ControlStructures.InlineControlStructure.NotAllowed" />
|
12 |
-
<exclude name="Generic.Files.EndFileNoNewline.Found" />
|
13 |
-
<exclude name="Generic.Files.LineLength.MaxExceeded" />
|
14 |
-
<exclude name="Generic.Formatting.NoSpaceAfterCast.SpaceFound" />
|
15 |
-
<exclude name="Generic.Functions.OpeningFunctionBraceBsdAllman.BraceOnSameLine" />
|
16 |
-
<exclude name="Generic.Metrics.CyclomaticComplexity.MaxExceeded" />
|
17 |
-
<exclude name="Generic.NamingConventions.CamelCapsFunctionName.ScopeNotCamelCaps" />
|
18 |
-
<exclude name="Generic.PHP.UpperCaseConstant.Found" />
|
19 |
-
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
|
20 |
-
<exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect" />
|
21 |
-
</rule>
|
22 |
-
|
23 |
-
<rule ref="Squiz.PHP.CommentedOutCode"/>
|
24 |
-
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
25 |
-
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine" />
|
26 |
-
</rule>
|
27 |
-
|
28 |
-
<rule ref="WordPress">
|
29 |
-
<exclude name="WordPress.XSS.EscapeOutput" />
|
30 |
-
</rule>
|
31 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
phpmd.ruleset.xml
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<ruleset name="Aihrus"
|
3 |
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4 |
-
xsi:schemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
|
5 |
-
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
6 |
-
<description>
|
7 |
-
Custom phpmd rules to check for Aihrus' WordPress projects
|
8 |
-
</description>
|
9 |
-
|
10 |
-
<!-- @ref http://phpmd.org/documentation/creating-a-ruleset.html -->
|
11 |
-
|
12 |
-
<!--
|
13 |
-
<rule ref="rulesets/codesize.xml" />
|
14 |
-
-->
|
15 |
-
<rule ref="rulesets/controversial.xml/Superglobals" />
|
16 |
-
<rule ref="rulesets/design.xml" />
|
17 |
-
<rule ref="rulesets/naming.xml">
|
18 |
-
<exclude name="ShortVariable" />
|
19 |
-
</rule>
|
20 |
-
<rule ref="rulesets/unusedcode.xml" />
|
21 |
-
</ruleset>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Donate link: http://aihr.us/about-aihrus/donate/
|
|
5 |
Tags: client, customer, portfolio, quotations, quote, quotes, random, recommendation, reference, review, reviews, testimonial, testimonials, testimony, wpml
|
6 |
Requires at least: 3.6
|
7 |
Tested up to: 3.9.0
|
8 |
-
Stable tag: 2.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -16,8 +16,9 @@ Testimonials by Aihrus lets you randomly slide or list selected portfolios, quot
|
|
16 |
|
17 |
Testimonials [by Aihrus](http://aihr.us/about-aihrus/) lets you randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site. You can insert Testimonials content via shortcode, theme functions, or widgets with category and tag selections and having multiple display options such as random or specific ordering. Further, [Review schema](http://schema.org/Review) for improved search engine results is built-in.
|
18 |
|
19 |
-
[youtube
|
20 |
-
|
|
|
21 |
|
22 |
**View a [Live Testimonials Demo](http://aihr.us/good-work-deserves-good-words-testimonials-examples/)**
|
23 |
|
@@ -61,17 +62,18 @@ The single testimonial view supports image, source, title, location, email, comp
|
|
61 |
|
62 |
= Shortcodes =
|
63 |
|
64 |
-
* `[[
|
65 |
-
* `[[
|
66 |
|
67 |
= Theme Functions =
|
68 |
|
69 |
-
* `
|
70 |
-
* `
|
71 |
|
72 |
= Testimonials Migration Helpers =
|
73 |
* Testimonials Widget pre 2.0.0 - Upgrading is automatic
|
74 |
* [GC Testimonials](http://wordpress.org/plugins/gc-testimonials-to-testimonials/)
|
|
|
75 |
|
76 |
= Testimonials Premium =
|
77 |
|
@@ -95,15 +97,15 @@ Testimonials Premium adds onto the best WordPress testimonials plugin there is,
|
|
95 |
|
96 |
= Premium Shortcodes =
|
97 |
|
98 |
-
* Count of testimonials `[[
|
99 |
-
* List of testimonial source and title linking to full entry `[[
|
100 |
-
* Testimonials entry form `[[
|
101 |
|
102 |
= Premium Theme Functions =
|
103 |
|
104 |
-
* `<?php echo
|
105 |
-
* `<?php echo
|
106 |
-
* `<?php echo
|
107 |
|
108 |
[Buy Testimonials Premium](http://aihr.us/products/testimonials-premium-wordpress-plugin/) plugin for WordPress.
|
109 |
|
@@ -140,37 +142,37 @@ Testimonials Premium adds onto the best WordPress testimonials plugin there is,
|
|
140 |
* Respects meta capabilities
|
141 |
* Rotation JavaScript in footer than body
|
142 |
* Settings page contextual help
|
|
|
143 |
* Shortcodes allowed inside of testimonials content
|
144 |
* Supports [WP-PageNavi](http://wordpress.org/extend/plugins/wp-pagenavi/)
|
145 |
* Testimonial content supports HTML
|
146 |
* Testimonial, email, and URL fields are clickable – URL requires `http://` or `https://` prefix
|
147 |
-
* Testimonials widget displays static and rotating testimonials
|
148 |
* Testimonials output is completely customizable via filters
|
149 |
* Testimonials support styling based upon CSS classes for category, tags and post id
|
150 |
-
*
|
151 |
* Unique CSS class per widget
|
|
|
152 |
* WordPress Multilingual enabled [WPML](http://wpml.org/)
|
153 |
|
154 |
= Shortcode Examples =
|
155 |
|
156 |
-
**[[
|
157 |
|
158 |
-
* `[[
|
159 |
-
* `[[
|
160 |
-
* `[[
|
161 |
-
* `[[
|
162 |
-
* `[[
|
163 |
-
* `[[
|
164 |
-
* `[[
|
165 |
-
* `[[
|
166 |
-
* `[[
|
167 |
-
* `[[
|
168 |
|
169 |
-
**[[
|
170 |
|
171 |
-
* `[[
|
172 |
-
* `[[
|
173 |
-
* `[[testimonialswidget_widget tags=sometag random=true]]` - Show rotating, random testimonials having tag "sometag"
|
174 |
|
175 |
= Shortcode and Widget Options =
|
176 |
|
@@ -182,9 +184,9 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
182 |
|
183 |
* Enable Review Schema? – Adds HTML tag markup per the [Review schema](http://schema.org/Review) to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results.
|
184 |
* `enable_schema` - default true; enable_schema=false
|
185 |
-
* Reviewed Item? - Name of thing being referenced in testimonials
|
186 |
* `item_reviewed` - default "Site Title"
|
187 |
-
* Reviewed Item URL? - URL of thing being referenced in testimonials
|
188 |
* `item_reviewed_url` - default `network_site_url();`
|
189 |
* Hide built-in quotes? - Remove open and close quote span tags surrounding testimonial content
|
190 |
* `disable_quotes` - default false; disable_quotes=true
|
@@ -210,16 +212,23 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
210 |
* `hide_company` - default show; hide_company=true
|
211 |
* Hide URL?
|
212 |
* `hide_url` - default show; hide_url=true
|
|
|
|
|
213 |
* URL Target - Add target to all URLs; leave blank if none
|
214 |
* `target` - default none; target=_new
|
215 |
-
* Enable Paging - for [[
|
216 |
* `paging` - default true [true|before|after|false]; paging=false
|
217 |
* `true` – display paging before and after testimonial entries
|
218 |
* `before` – display paging only before testimonial entries
|
219 |
* `after` – display paging only after testimonial entries
|
220 |
* Widget - Not functional
|
221 |
-
*
|
222 |
* `do_shortcode` - default false; do_shortcode=true
|
|
|
|
|
|
|
|
|
|
|
223 |
|
224 |
**Selection**
|
225 |
|
@@ -300,18 +309,13 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
300 |
* `min_height` - default none; min_height=100
|
301 |
* Maximum Height - Set for maximum display height, in pixels
|
302 |
* `max_height` - default none; max_height=250
|
303 |
-
* Always Load CSS? - Pre 2.14.0. Testimonials' CSS was always loaded, whether needed or not
|
304 |
-
* Include IE7 CSS? - IE7 specific CSS moved to separate CSS file in version 2.13.6.
|
305 |
-
* Use `<q>` tag? – Pre 2.11.0. Not HTML5 compliant
|
306 |
-
* `use_quote_tag` - default none; use_quote_tag=true
|
307 |
-
* Remove `.hentry` CSS? – Some themes use class `.hentry` in a manner that breaks Testimonials' CSS
|
308 |
-
* `remove_hentry` - default none; remove_hentry=true
|
309 |
|
310 |
|
311 |
== Installation ==
|
312 |
|
313 |
= Requirements =
|
314 |
|
|
|
315 |
* PHP 5.3+ [Read notice](https://aihrus.zendesk.com/entries/30678006) – Since 2.16.0
|
316 |
|
317 |
= Install Methods =
|
@@ -338,8 +342,8 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
338 |
1. Add and manage testimonials through the "Testimonials" menu in the WordPress admin area
|
339 |
1. To display testimonials in the sidebar, go to "Widgets" menu and drag "Testimonials" widget into the desired widget area
|
340 |
1. Configure "Testimonials" to select quotes and display as needed
|
341 |
-
1. Use the `[[
|
342 |
-
1. Read [theme functions usage](https://aihrus.zendesk.com/entries/23702878) for `
|
343 |
|
344 |
= Upgrading =
|
345 |
|
@@ -357,12 +361,17 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
357 |
= Most Common Issues =
|
358 |
|
359 |
* Got `Parse error: syntax error, unexpected T_STATIC, expecting ')'`? Read [Most Aihrus Plugins Require PHP 5.3+](https://aihrus.zendesk.com/entries/30678006) for the fixes.
|
360 |
-
* [
|
361 |
* [Change or debug CSS](https://aihrus.zendesk.com/entries/24910733) AKA "What's up with these quotes?"
|
362 |
* [Customize bxSlider](http://bxslider.com/examples)
|
|
|
363 |
* [How do I change my widget's rotation speed or other options?](https://aihrus.zendesk.com/entries/27714083)
|
|
|
|
|
|
|
364 |
* [Pagination is broken](https://aihrus.zendesk.com/entries/23693513)
|
365 |
* [Test Review schema output](http://www.google.com/webmasters/tools/richsnippets)
|
|
|
366 |
|
367 |
= Still Stuck or Want Something Done? Get Support! =
|
368 |
|
@@ -379,8 +388,8 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
379 |
2. Collapsed Testimonials options
|
380 |
3. Expanded "General Options" in Testimonials options
|
381 |
4. Testimonial widget in the sidebar
|
382 |
-
5. [[
|
383 |
-
6. [[
|
384 |
7. Widget whitespace kept
|
385 |
8. Widget with clickable title and custom text/HTML on bottom
|
386 |
9. [WP-PageNavi compatible](http://wordpress.org/extend/plugins/wp-pagenavi/) for page numbers than default arrows
|
@@ -395,6 +404,8 @@ Further, global settings are the baseline for shortcodes. If you want to alter t
|
|
395 |
18. Dashboard > Right Now "Testimonials" count
|
396 |
19. Using Review and AggregateRating schema data structures
|
397 |
20. Testimonials Shortcode Examples page
|
|
|
|
|
398 |
|
399 |
[gallery]
|
400 |
|
@@ -406,6 +417,31 @@ See [Changelog](https://github.com/michael-cannon/testimonials-widget/blob/maste
|
|
406 |
|
407 |
== Upgrade Notice ==
|
408 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
409 |
= 2.16.0 =
|
410 |
|
411 |
* [Requires PHP 5.3+](https://aihrus.zendesk.com/entries/30678006)
|
@@ -512,6 +548,24 @@ Version 2.0.0 of Testimonials is a complete rewrite based upon a composite of id
|
|
512 |
Prior to version 2.0.0, this plugin was a fork of [Quotes Collection](http://srinig.com/wordpress/plugins/quotes-collection/) by [Srini G](http://wordpress.org/support/profile/SriniG) with additional contributions from [j0hnsmith](http://wordpress.org/support/profile/j0hnsmith), [ChrisCree](http://wordpress.org/support/profile/ChrisCree) and [comprock](http://wordpress.org/support/profile/comprock).
|
513 |
|
514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
== Localization ==
|
516 |
|
517 |
* Dutch by Bjorn Robijns
|
5 |
Tags: client, customer, portfolio, quotations, quote, quotes, random, recommendation, reference, review, reviews, testimonial, testimonials, testimony, wpml
|
6 |
Requires at least: 3.6
|
7 |
Tested up to: 3.9.0
|
8 |
+
Stable tag: 2.19.0
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
16 |
|
17 |
Testimonials [by Aihrus](http://aihr.us/about-aihrus/) lets you randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site. You can insert Testimonials content via shortcode, theme functions, or widgets with category and tag selections and having multiple display options such as random or specific ordering. Further, [Review schema](http://schema.org/Review) for improved search engine results is built-in.
|
18 |
|
19 |
+
[youtube https://www.youtube.com/watch?v=bhUhuQ-2m8s]
|
20 |
+
|
21 |
+
**[Video introduction](https://www.youtube.com/watch?v=bhUhuQ-2m8s)**
|
22 |
|
23 |
**View a [Live Testimonials Demo](http://aihr.us/good-work-deserves-good-words-testimonials-examples/)**
|
24 |
|
62 |
|
63 |
= Shortcodes =
|
64 |
|
65 |
+
* `[[testimonials]]` - Listings with paging
|
66 |
+
* `[[testimonials_slider]]` - Rotating
|
67 |
|
68 |
= Theme Functions =
|
69 |
|
70 |
+
* `testimonials()` - Testimonials listing with paging
|
71 |
+
* `testimonials_slider()` - Rotating testimonials
|
72 |
|
73 |
= Testimonials Migration Helpers =
|
74 |
* Testimonials Widget pre 2.0.0 - Upgrading is automatic
|
75 |
* [GC Testimonials](http://wordpress.org/plugins/gc-testimonials-to-testimonials/)
|
76 |
+
* [Testimonials by WooThemes](http://wordpress.org/plugins/wootheme-testimonials-to-testimonials/)
|
77 |
|
78 |
= Testimonials Premium =
|
79 |
|
97 |
|
98 |
= Premium Shortcodes =
|
99 |
|
100 |
+
* Count of testimonials `[[testimonials_count]]`
|
101 |
+
* List of testimonial source and title linking to full entry `[[testimonials_links]]`
|
102 |
+
* Testimonials entry form `[[testimonials_form]]`
|
103 |
|
104 |
= Premium Theme Functions =
|
105 |
|
106 |
+
* `<?php echo testimonials_count( $args ); ?>`
|
107 |
+
* `<?php echo testimonials_form( $args ); ?>`
|
108 |
+
* `<?php echo testimonials_links( $args ); ?>`
|
109 |
|
110 |
[Buy Testimonials Premium](http://aihr.us/products/testimonials-premium-wordpress-plugin/) plugin for WordPress.
|
111 |
|
142 |
* Respects meta capabilities
|
143 |
* Rotation JavaScript in footer than body
|
144 |
* Settings page contextual help
|
145 |
+
* Shortcode helpers on category and tag admin screens
|
146 |
* Shortcodes allowed inside of testimonials content
|
147 |
* Supports [WP-PageNavi](http://wordpress.org/extend/plugins/wp-pagenavi/)
|
148 |
* Testimonial content supports HTML
|
149 |
* Testimonial, email, and URL fields are clickable – URL requires `http://` or `https://` prefix
|
|
|
150 |
* Testimonials output is completely customizable via filters
|
151 |
* Testimonials support styling based upon CSS classes for category, tags and post id
|
152 |
+
* Testimonials widget displays static and rotating testimonials
|
153 |
* Unique CSS class per widget
|
154 |
+
* URLs can be opened in new windows
|
155 |
* WordPress Multilingual enabled [WPML](http://wpml.org/)
|
156 |
|
157 |
= Shortcode Examples =
|
158 |
|
159 |
+
**[[testimonials]]**
|
160 |
|
161 |
+
* `[[testimonials category="category-name"]]` - Testimonial list by category
|
162 |
+
* `[[testimonials category=product hide_not_found=true]]` - Testimonial list by category and hide "No testimonials found" message
|
163 |
+
* `[[testimonials category=product tags=widget limit=5]]` - Testimonial list by tag, showing 5 at most
|
164 |
+
* `[[testimonials char_limit=0 limit=-1]]` - Show all testimonials on one page
|
165 |
+
* `[[testimonials char_limit=0 target=_new limit=3 disable_quotes=true]]` - Show 3 full-length testimonials, with opening and closing quote marks removed
|
166 |
+
* `[[testimonials hide_source=true hide_url=true]]` - Show testimonial list with source and urls hidden
|
167 |
+
* `[[testimonials ids="1,11,111" paging=false]]` - Show only these 3 testimonials
|
168 |
+
* `[[testimonials meta_key=testimonials-widget-company order=asc limit=15]]` - Show 15 testimonials, in company order
|
169 |
+
* `[[testimonials order=ASC orderby=title]]` - List testimonials by post title
|
170 |
+
* `[[testimonials tags="test,fun" random=true exclude="2,22,333"]]` - Select testimonials tagged with either "test" or "fun", in random order, but ignore those of the excluded ids
|
171 |
|
172 |
+
**[[testimonials_slider]]**
|
173 |
|
174 |
+
* `[[testimonials_slider category=product order=asc]]` - Show rotating testimonials, of the product category, lowest post ids first
|
175 |
+
* `[[testimonials_slider tags=sometag random=true]]` - Show rotating, random testimonials having tag "sometag"
|
|
|
176 |
|
177 |
= Shortcode and Widget Options =
|
178 |
|
184 |
|
185 |
* Enable Review Schema? – Adds HTML tag markup per the [Review schema](http://schema.org/Review) to testimonials. Search engines including Bing, Google, Yahoo! and Yandex rely on this markup to improve the display of search results.
|
186 |
* `enable_schema` - default true; enable_schema=false
|
187 |
+
* Default Reviewed Item? - Name of thing being referenced in testimonials
|
188 |
* `item_reviewed` - default "Site Title"
|
189 |
+
* Default Reviewed Item URL? - URL of thing being referenced in testimonials
|
190 |
* `item_reviewed_url` - default `network_site_url();`
|
191 |
* Hide built-in quotes? - Remove open and close quote span tags surrounding testimonial content
|
192 |
* `disable_quotes` - default false; disable_quotes=true
|
212 |
* `hide_company` - default show; hide_company=true
|
213 |
* Hide URL?
|
214 |
* `hide_url` - default show; hide_url=true
|
215 |
+
* Exclude bxSlider CSS? - For a bare-bones, unthemed slider.
|
216 |
+
* `exclude_bxslider_css` - default show; exclude_bxslider_css=true
|
217 |
* URL Target - Add target to all URLs; leave blank if none
|
218 |
* `target` - default none; target=_new
|
219 |
+
* Enable Paging? - for [[testimonials]]
|
220 |
* `paging` - default true [true|before|after|false]; paging=false
|
221 |
* `true` – display paging before and after testimonial entries
|
222 |
* `before` – display paging only before testimonial entries
|
223 |
* `after` – display paging only after testimonial entries
|
224 |
* Widget - Not functional
|
225 |
+
* Enable [shortcodes]? - If unchecked, shortcodes are stripped.
|
226 |
* `do_shortcode` - default false; do_shortcode=true
|
227 |
+
* Include IE7 CSS?
|
228 |
+
* Use `<q>` tag? – Not HTML5 compliant
|
229 |
+
* `use_quote_tag` - default none; use_quote_tag=true
|
230 |
+
* Remove `.hentry` CSS? – Some themes use class `.hentry` in a manner that breaks Testimonials' CSS and corrupts microdata parsing
|
231 |
+
* `remove_hentry` - default true; remove_hentry=false
|
232 |
|
233 |
**Selection**
|
234 |
|
309 |
* `min_height` - default none; min_height=100
|
310 |
* Maximum Height - Set for maximum display height, in pixels
|
311 |
* `max_height` - default none; max_height=250
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
|
313 |
|
314 |
== Installation ==
|
315 |
|
316 |
= Requirements =
|
317 |
|
318 |
+
* [jQuery 1.10+](https://aihrus.zendesk.com/entries/23693363)
|
319 |
* PHP 5.3+ [Read notice](https://aihrus.zendesk.com/entries/30678006) – Since 2.16.0
|
320 |
|
321 |
= Install Methods =
|
342 |
1. Add and manage testimonials through the "Testimonials" menu in the WordPress admin area
|
343 |
1. To display testimonials in the sidebar, go to "Widgets" menu and drag "Testimonials" widget into the desired widget area
|
344 |
1. Configure "Testimonials" to select quotes and display as needed
|
345 |
+
1. Use the `[[testimonials]]` or `[[testimonials_slider]]` shortcodes to display testimonials on a page or in a post
|
346 |
+
1. Read [theme functions usage](https://aihrus.zendesk.com/entries/23702878) for `testimonials()` and `testimonials_slider()`
|
347 |
|
348 |
= Upgrading =
|
349 |
|
361 |
= Most Common Issues =
|
362 |
|
363 |
* Got `Parse error: syntax error, unexpected T_STATIC, expecting ')'`? Read [Most Aihrus Plugins Require PHP 5.3+](https://aihrus.zendesk.com/entries/30678006) for the fixes.
|
364 |
+
* [404 - Page not found](https://aihrus.zendesk.com/entries/23679301)
|
365 |
* [Change or debug CSS](https://aihrus.zendesk.com/entries/24910733) AKA "What's up with these quotes?"
|
366 |
* [Customize bxSlider](http://bxslider.com/examples)
|
367 |
+
* [Debug common theme and plugin conflicts](https://aihrus.zendesk.com/entries/25119302)
|
368 |
* [How do I change my widget's rotation speed or other options?](https://aihrus.zendesk.com/entries/27714083)
|
369 |
+
* [How do I create a testimonial record?](https://aihrus.zendesk.com/entries/30602506)
|
370 |
+
* [How to change testimonials layout](https://aihrus.zendesk.com/entries/38055707)
|
371 |
+
* [My options don't work, no matter what I do.](https://aihrus.zendesk.com/entries/30746533)
|
372 |
* [Pagination is broken](https://aihrus.zendesk.com/entries/23693513)
|
373 |
* [Test Review schema output](http://www.google.com/webmasters/tools/richsnippets)
|
374 |
+
* [Widgets don't rotate](https://aihrus.zendesk.com/entries/23693363)
|
375 |
|
376 |
= Still Stuck or Want Something Done? Get Support! =
|
377 |
|
388 |
2. Collapsed Testimonials options
|
389 |
3. Expanded "General Options" in Testimonials options
|
390 |
4. Testimonial widget in the sidebar
|
391 |
+
5. [[testimonials]] in post
|
392 |
+
6. [[testimonials]] results with paging
|
393 |
7. Widget whitespace kept
|
394 |
8. Widget with clickable title and custom text/HTML on bottom
|
395 |
9. [WP-PageNavi compatible](http://wordpress.org/extend/plugins/wp-pagenavi/) for page numbers than default arrows
|
404 |
18. Dashboard > Right Now "Testimonials" count
|
405 |
19. Using Review and AggregateRating schema data structures
|
406 |
20. Testimonials Shortcode Examples page
|
407 |
+
21. Shortcode helpers on category and tag admin screens
|
408 |
+
22. Testimonials Settings > Columns tab
|
409 |
|
410 |
[gallery]
|
411 |
|
417 |
|
418 |
== Upgrade Notice ==
|
419 |
|
420 |
+
= 2.19.0 =
|
421 |
+
|
422 |
+
* CSS class `.title` is now `.job-title`. Thank you Mark
|
423 |
+
* Please resave your WordPress Admin > Testimonials > Settings so that missing aoptions are included again.
|
424 |
+
* Shortcode and theme function `testimonialswidget_list` being deprecated by `testimonials`
|
425 |
+
* Shortcode and theme function `testimonialswidget_widget` being deprecated by `testimonials_slider`
|
426 |
+
|
427 |
+
= 2.18.3 =
|
428 |
+
|
429 |
+
* CSS class `.hide` renamed `.display-none`
|
430 |
+
* This is the last version supporting pre-bxSlider options
|
431 |
+
|
432 |
+
= 2.18.2 =
|
433 |
+
|
434 |
+
* CSS class `.display-none` renamed `.hide`
|
435 |
+
|
436 |
+
= 2.18.1 =
|
437 |
+
|
438 |
+
* CSS is back to being always loaded in the header
|
439 |
+
* Removed "Use bxSlider?" and "Include IE7 CSS" from widget options
|
440 |
+
|
441 |
+
= 2.18.0 =
|
442 |
+
|
443 |
+
* `remove_hentry` is now true by default
|
444 |
+
|
445 |
= 2.16.0 =
|
446 |
|
447 |
* [Requires PHP 5.3+](https://aihrus.zendesk.com/entries/30678006)
|
548 |
Prior to version 2.0.0, this plugin was a fork of [Quotes Collection](http://srinig.com/wordpress/plugins/quotes-collection/) by [Srini G](http://wordpress.org/support/profile/SriniG) with additional contributions from [j0hnsmith](http://wordpress.org/support/profile/j0hnsmith), [ChrisCree](http://wordpress.org/support/profile/ChrisCree) and [comprock](http://wordpress.org/support/profile/comprock).
|
549 |
|
550 |
|
551 |
+
== Conflicts ==
|
552 |
+
|
553 |
+
* [ReOrder Post Within Categories](http://wordpress.org/plugins/reorder-post-within-categories/) – Uses custom ordering table
|
554 |
+
|
555 |
+
|
556 |
+
== Deprecation Notices ==
|
557 |
+
|
558 |
+
= Deprecated Shortcodes =
|
559 |
+
|
560 |
+
* `[[testimonialswidget_list]]` - Listings with paging
|
561 |
+
* `[[testimonialswidget_widget]]` - Rotating
|
562 |
+
|
563 |
+
= Deprecated Theme Functions =
|
564 |
+
|
565 |
+
* `testimonialswidget_list()` - Testimonials listing with paging
|
566 |
+
* `testimonialswidget_widget()` - Rotating testimonials
|
567 |
+
|
568 |
+
|
569 |
== Localization ==
|
570 |
|
571 |
* Dutch by Bjorn Robijns
|
testimonials-widget-ie7.css
DELETED
@@ -1,15 +0,0 @@
|
|
1 |
-
/*csslint star-property-hack: false*/
|
2 |
-
.testimonials-widget-testimonial .open-quote {
|
3 |
-
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '“' );
|
4 |
-
}
|
5 |
-
|
6 |
-
.testimonials-widget-testimonial .close-quote {
|
7 |
-
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '”' );
|
8 |
-
}
|
9 |
-
|
10 |
-
.testimonials-widget-testimonial .join-title,
|
11 |
-
.testimonials-widget-testimonial .join-location,
|
12 |
-
.testimonials-widget-testimonial .join {
|
13 |
-
/* section between source and company information */
|
14 |
-
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ', ' );
|
15 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
testimonials-widget.php
CHANGED
@@ -3,15 +3,17 @@
|
|
3 |
* Plugin Name: Testimonials by Aihrus
|
4 |
* Plugin URI: http://wordpress.org/plugins/testimonials-widget/
|
5 |
* Description: Testimonials by Aihrus lets you randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site.
|
6 |
-
* Version: 2.
|
7 |
* Author: Michael Cannon
|
8 |
* Author URI: http://aihr.us/resume/
|
9 |
* License: GPLv2 or later
|
|
|
|
|
10 |
*/
|
11 |
|
12 |
|
13 |
/**
|
14 |
-
* Copyright
|
15 |
* This program is free software; you can redistribute it and/or modify
|
16 |
* it under the terms of the GNU General Public License, version 2, as
|
17 |
* published by the Free Software Foundation.
|
@@ -24,2028 +26,67 @@
|
|
24 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
define( 'TW_DIR_LIB', TW_DIR . '/lib' );
|
31 |
-
define( 'TW_NAME', 'Testimonials by Aihrus' );
|
32 |
-
define( 'TW_PREMIUM_LINK', '<a href="http://aihr.us/downloads/testimonials-widget-premium-wordpress-plugin/">Purchase Testimonials Premium</a>' );
|
33 |
-
define( 'TW_VERSION', '2.17.2' );
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
if ( ! tw_requirements_check() ) {
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
|
41 |
-
require_once TW_DIR_LIB . '/aihrus/class-aihrus-common.php';
|
42 |
-
require_once TW_DIR_LIB . '/class-redrokk-metabox-class.php';
|
43 |
-
require_once TW_DIR_LIB . '/class-testimonials-widget-settings.php';
|
44 |
-
require_once TW_DIR_LIB . '/class-testimonials-widget-widget.php';
|
45 |
-
|
46 |
-
|
47 |
-
class Testimonials_Widget extends Aihrus_Common {
|
48 |
-
const BASE = TW_BASE;
|
49 |
-
const ID = 'testimonials-widget-testimonials';
|
50 |
-
const SLUG = 'tw_';
|
51 |
-
const VERSION = TW_VERSION;
|
52 |
-
|
53 |
-
const OLD_NAME = 'testimonialswidget';
|
54 |
-
const PT = 'testimonials-widget';
|
55 |
-
|
56 |
-
private static $found_posts = 0;
|
57 |
-
private static $max_num_pages = 0;
|
58 |
-
private static $post_count = 0;
|
59 |
-
private static $wp_query;
|
60 |
-
|
61 |
-
public static $class = __CLASS__;
|
62 |
-
public static $cpt_category = '';
|
63 |
-
public static $cpt_tags = '';
|
64 |
-
public static $css = array();
|
65 |
-
public static $css_called = false;
|
66 |
-
public static $instance_number = 0;
|
67 |
-
public static $instance_widget = 0;
|
68 |
-
public static $menu_shortcodes;
|
69 |
-
public static $not_found = false;
|
70 |
-
public static $notice_key;
|
71 |
-
public static $scripts = array();
|
72 |
-
public static $scripts_called = false;
|
73 |
-
public static $settings_link = '';
|
74 |
-
public static $tag_close_quote = '<span class="close-quote"></span>';
|
75 |
-
public static $tag_open_quote = '<span class="open-quote"></span>';
|
76 |
-
public static $use_instance = false;
|
77 |
-
public static $widget_number = 100000;
|
78 |
-
|
79 |
-
public static $agg_count = 'reviewCount';
|
80 |
-
public static $agg_schema = 'http://schema.org/AggregateRating';
|
81 |
-
|
82 |
-
public static $cw_author = 'author';
|
83 |
-
public static $cw_date = 'datePublished';
|
84 |
-
public static $cw_date_mod = 'dateModified';
|
85 |
-
public static $cw_aggregate = 'aggregateRating';
|
86 |
-
public static $cw_review = 'review';
|
87 |
-
public static $cw_source_org = 'sourceOrganization';
|
88 |
-
|
89 |
-
public static $org_location = 'location';
|
90 |
-
public static $org_schema = 'http://schema.org/Organization';
|
91 |
-
|
92 |
-
public static $person_email = 'email';
|
93 |
-
public static $person_home = 'homeLocation';
|
94 |
-
public static $person_job_title = 'jobTitle';
|
95 |
-
public static $person_schema = 'http://schema.org/Person';
|
96 |
-
public static $person_member = 'memberOf';
|
97 |
-
|
98 |
-
public static $place_schema = 'http://schema.org/Place';
|
99 |
-
|
100 |
-
public static $review_body = 'reviewBody';
|
101 |
-
public static $review_item = 'itemReviewed';
|
102 |
-
public static $review_schema = 'http://schema.org/Review';
|
103 |
-
|
104 |
-
public static $schema_div_open = '<div itemscope itemtype="%1$s">';
|
105 |
-
public static $schema_div_prop = '<div itemprop="%1$s" itemscope itemtype="%2$s">%3$s</div>';
|
106 |
-
public static $schema_item_prop = 'itemprop="%1$s"';
|
107 |
-
public static $schema_meta = '<meta itemprop="%1$s" content="%2$s" />';
|
108 |
-
public static $schema_span = '<span itemprop="%1$s">%2$s</span>';
|
109 |
-
|
110 |
-
public static $thing_image = 'image';
|
111 |
-
public static $thing_name = 'name';
|
112 |
-
public static $thing_schema = 'http://schema.org/Thing';
|
113 |
-
public static $thing_url = 'url';
|
114 |
-
|
115 |
-
|
116 |
-
public function __construct() {
|
117 |
-
parent::__construct();
|
118 |
-
|
119 |
-
add_action( 'admin_init', array( __CLASS__, 'admin_init' ) );
|
120 |
-
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
|
121 |
-
add_action( 'init', array( __CLASS__, 'init' ) );
|
122 |
-
add_action( 'widgets_init', array( __CLASS__, 'widgets_init' ) );
|
123 |
-
add_shortcode( 'testimonialswidget_list', array( __CLASS__, 'testimonialswidget_list' ) );
|
124 |
-
add_shortcode( 'testimonialswidget_widget', array( __CLASS__, 'testimonialswidget_widget' ) );
|
125 |
-
}
|
126 |
-
|
127 |
-
|
128 |
-
public static function admin_init() {
|
129 |
-
self::support_thumbnails();
|
130 |
-
|
131 |
-
self::$settings_link = '<a href="' . get_admin_url() . 'edit.php?post_type=' . Testimonials_Widget::PT . '&page=' . Testimonials_Widget_Settings::ID . '">' . esc_html__( 'Settings', 'testimonials-widget' ) . '</a>';
|
132 |
-
|
133 |
-
self::add_meta_box_testimonials_widget();
|
134 |
-
self::update();
|
135 |
-
|
136 |
-
add_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
137 |
-
add_action( 'manage_' . self::PT . '_posts_custom_column', array( __CLASS__, 'manage_posts_custom_column' ), 10, 2 );
|
138 |
-
add_action( 'right_now_content_table_end', array( __CLASS__, 'right_now_content_table_end' ) );
|
139 |
-
add_filter( 'manage_' . self::PT . '_posts_columns', array( __CLASS__, 'manage_posts_columns' ) );
|
140 |
-
add_filter( 'plugin_action_links', array( __CLASS__, 'plugin_action_links' ), 10, 2 );
|
141 |
-
add_filter( 'plugin_row_meta', array( __CLASS__, 'plugin_row_meta' ), 10, 2 );
|
142 |
-
add_filter( 'post_updated_messages', array( __CLASS__, 'post_updated_messages' ) );
|
143 |
-
add_filter( 'pre_get_posts', array( __CLASS__, 'pre_get_posts_author' ) );
|
144 |
-
}
|
145 |
-
|
146 |
-
|
147 |
-
public static function admin_menu() {
|
148 |
-
self::$menu_shortcodes = add_submenu_page( 'edit.php?post_type=' . self::PT, esc_html__( 'Testimonials Shortcode Examples', 'testimonials-widget' ), esc_html__( 'E.g. Shortcodes', 'testimonials-widget' ), 'manage_options', 'shortcodes', array( __CLASS__, 'show_shortcodes' ) );
|
149 |
-
}
|
150 |
-
|
151 |
-
|
152 |
-
public static function init() {
|
153 |
-
add_filter( 'the_content', array( __CLASS__, 'get_single' ) );
|
154 |
-
|
155 |
-
load_plugin_textdomain( self::PT, false, 'testimonials-widget/languages' );
|
156 |
-
|
157 |
-
self::$cpt_category = self::PT . '-category';
|
158 |
-
self::$cpt_tags = self::PT . '-post_tag';
|
159 |
-
|
160 |
-
self::init_post_type();
|
161 |
-
|
162 |
-
$force_css_loading = tw_get_option( 'force_css_loading' );
|
163 |
-
if ( $force_css_loading )
|
164 |
-
self::styles();
|
165 |
-
}
|
166 |
-
|
167 |
-
|
168 |
-
public static function plugin_action_links( $links, $file ) {
|
169 |
-
if ( self::BASE == $file )
|
170 |
-
array_unshift( $links, self::$settings_link );
|
171 |
-
|
172 |
-
return $links;
|
173 |
-
}
|
174 |
-
|
175 |
-
|
176 |
-
public static function add_instance() {
|
177 |
-
self::$use_instance = false;
|
178 |
-
self::$instance_number++;
|
179 |
-
|
180 |
-
return self::$instance_number;
|
181 |
-
}
|
182 |
-
|
183 |
-
|
184 |
-
public static function get_instance() {
|
185 |
-
return self::$use_instance ? self::$instance_number : self::$instance_widget;
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
-
public static function set_instance( $widget_number ) {
|
190 |
-
self::$use_instance = true;
|
191 |
-
self::$instance_widget = $widget_number;
|
192 |
-
}
|
193 |
-
|
194 |
-
|
195 |
-
public static function support_thumbnails() {
|
196 |
-
$feature = 'post-thumbnails';
|
197 |
-
$feature_level = get_theme_support( $feature );
|
198 |
-
|
199 |
-
if ( true === $feature_level ) {
|
200 |
-
// already enabled for all post types
|
201 |
-
return;
|
202 |
-
} elseif ( false === $feature_level ) {
|
203 |
-
// none allowed, only enable for our own
|
204 |
-
add_theme_support( $feature, array( self::PT ) );
|
205 |
-
} else {
|
206 |
-
// add our own to list of supported
|
207 |
-
$feature_level[0][] = self::PT;
|
208 |
-
add_theme_support( $feature, $feature_level[0] );
|
209 |
-
}
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
public static function get_single( $content ) {
|
214 |
-
global $post;
|
215 |
-
|
216 |
-
if ( ! is_single() || self::PT != $post->post_type )
|
217 |
-
return $content;
|
218 |
-
|
219 |
-
$atts = self::get_defaults( true );
|
220 |
-
$atts['hide_content'] = 1;
|
221 |
-
$atts['ids'] = $post->ID;
|
222 |
-
$atts['type'] = 'get_single';
|
223 |
-
|
224 |
-
$instance = self::add_instance();
|
225 |
-
$atts['widget_number'] = $instance;
|
226 |
-
|
227 |
-
$testimonials = array();
|
228 |
-
|
229 |
-
$text = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
230 |
-
if ( false === $text ) {
|
231 |
-
$testimonials = self::get_testimonials( $atts );
|
232 |
-
$testimonial = $testimonials[0];
|
233 |
-
|
234 |
-
$details = self::get_testimonial_html( $testimonial, $atts );
|
235 |
-
$details = apply_filters( 'testimonials_widget_testimonial_html_single', $details, $testimonial, $atts );
|
236 |
-
|
237 |
-
$do_schema = $atts['enable_schema'];
|
238 |
-
if ( $do_schema )
|
239 |
-
$content = self::create_schema_span( self::$review_body, $content );
|
240 |
-
|
241 |
-
$content = apply_filters( 'testimonials_widget_testimonial_html_single_content', $content, $testimonial, $atts );
|
242 |
-
|
243 |
-
$text = $content . $details;
|
244 |
-
if ( $do_schema )
|
245 |
-
$text = self::create_schema_div_prop( self::$cw_review, self::$review_schema, $text );
|
246 |
-
|
247 |
-
$text = apply_filters( 'testimonials_widget_cache_set', $text, $atts );
|
248 |
-
}
|
249 |
-
|
250 |
-
self::call_scripts_styles( $testimonials, $atts, $instance );
|
251 |
-
|
252 |
-
return $text;
|
253 |
-
}
|
254 |
-
|
255 |
-
|
256 |
-
public static function activation() {
|
257 |
-
if ( ! current_user_can( 'activate_plugins' ) )
|
258 |
-
return;
|
259 |
-
|
260 |
-
self::init();
|
261 |
-
flush_rewrite_rules();
|
262 |
-
}
|
263 |
-
|
264 |
-
|
265 |
-
public static function deactivation() {
|
266 |
-
if ( ! current_user_can( 'activate_plugins' ) )
|
267 |
-
return;
|
268 |
-
|
269 |
-
flush_rewrite_rules();
|
270 |
-
}
|
271 |
-
|
272 |
-
|
273 |
-
public static function uninstall() {
|
274 |
-
if ( ! current_user_can( 'activate_plugins' ) )
|
275 |
-
return;
|
276 |
-
|
277 |
-
global $wpdb;
|
278 |
-
|
279 |
-
require_once TW_DIR_LIB . '/class-testimonials-widget-settings.php';
|
280 |
-
|
281 |
-
$delete_data = tw_get_option( 'delete_data', false );
|
282 |
-
if ( $delete_data ) {
|
283 |
-
delete_option( self::OLD_NAME );
|
284 |
-
delete_option( Testimonials_Widget_Settings::ID );
|
285 |
-
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->options . '`' );
|
286 |
-
|
287 |
-
Testimonials_Widget::delete_testimonials();
|
288 |
-
}
|
289 |
-
}
|
290 |
-
|
291 |
-
|
292 |
-
public static function delete_testimonials() {
|
293 |
-
global $wpdb;
|
294 |
-
|
295 |
-
$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type = '" . self::PT . "'";
|
296 |
-
$posts = $wpdb->get_results( $query );
|
297 |
-
|
298 |
-
foreach ( $posts as $post ) {
|
299 |
-
$post_id = $post->ID;
|
300 |
-
Testimonials_Widget::delete_attachments( $post_id );
|
301 |
-
|
302 |
-
// dels post, meta & comments
|
303 |
-
// true is force delete
|
304 |
-
wp_delete_post( $post_id, true );
|
305 |
-
}
|
306 |
-
|
307 |
-
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->postmeta . '`' );
|
308 |
-
$wpdb->query( 'OPTIMIZE TABLE `' . $wpdb->posts . '`' );
|
309 |
-
}
|
310 |
-
|
311 |
-
|
312 |
-
public static function delete_attachments( $post_id = false ) {
|
313 |
-
global $wpdb;
|
314 |
-
|
315 |
-
$post_id = $post_id ? $post_id : 0;
|
316 |
-
$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'attachment' AND post_parent = {$post_id}";
|
317 |
-
$attachments = $wpdb->get_results( $query );
|
318 |
-
|
319 |
-
foreach ( $attachments as $attachment ) {
|
320 |
-
// true is force delete
|
321 |
-
wp_delete_attachment( $attachment->ID, true );
|
322 |
-
}
|
323 |
-
}
|
324 |
-
|
325 |
-
|
326 |
-
public static function plugin_row_meta( $input, $file ) {
|
327 |
-
if ( self::BASE != $file )
|
328 |
-
return $input;
|
329 |
-
|
330 |
-
$disable_donate = tw_get_option( 'disable_donate' );
|
331 |
-
if ( $disable_donate )
|
332 |
-
return $input;
|
333 |
-
|
334 |
-
$links = array(
|
335 |
-
self::$donate_link,
|
336 |
-
);
|
337 |
-
|
338 |
-
global $TW_Premium;
|
339 |
-
if ( ! isset( $TW_Premium ) )
|
340 |
-
$links[] = TW_PREMIUM_LINK;
|
341 |
-
|
342 |
-
$input = array_merge( $input, $links );
|
343 |
-
|
344 |
-
return $input;
|
345 |
-
}
|
346 |
-
|
347 |
-
|
348 |
-
public static function notice_2_12_0() {
|
349 |
-
$text = sprintf( __( 'If your Testimonials display has gone to funky town, please <a href="%s">read the FAQ</a> about possible CSS fixes.', 'testimonials-widget' ), esc_url( 'https://aihrus.zendesk.com/entries/23722573-Major-Changes-Since-2-10-0' ) );
|
350 |
-
|
351 |
-
self::notice_updated( $text );
|
352 |
-
}
|
353 |
-
|
354 |
-
|
355 |
-
public static function notice_donate( $disable_donate = null, $item_name = null ) {
|
356 |
-
$disable_donate = tw_get_option( 'disable_donate' );
|
357 |
-
|
358 |
-
parent::notice_donate( $disable_donate, TW_NAME );
|
359 |
-
}
|
360 |
-
|
361 |
-
|
362 |
-
public static function update() {
|
363 |
-
$prior_version = tw_get_option( 'admin_notices' );
|
364 |
-
if ( $prior_version ) {
|
365 |
-
if ( $prior_version < '2.12.0' )
|
366 |
-
self::set_notice( 'notice_2_12_0' );
|
367 |
-
|
368 |
-
if ( $prior_version < '2.15.0' )
|
369 |
-
self::set_notice( 'notice_2_15_0' );
|
370 |
-
|
371 |
-
if ( $prior_version < self::VERSION )
|
372 |
-
do_action( 'testimonials_widget_update' );
|
373 |
-
|
374 |
-
tw_set_option( 'admin_notices' );
|
375 |
-
}
|
376 |
-
|
377 |
-
// display donate on major/minor version release
|
378 |
-
$donate_version = tw_get_option( 'donate_version', false );
|
379 |
-
if ( ! $donate_version || ( $donate_version != self::VERSION && preg_match( '#\.0$#', self::VERSION ) ) ) {
|
380 |
-
self::set_notice( 'notice_donate' );
|
381 |
-
tw_set_option( 'donate_version', self::VERSION );
|
382 |
-
}
|
383 |
-
|
384 |
-
$options = get_option( self::OLD_NAME );
|
385 |
-
if ( true !== $options['migrated'] )
|
386 |
-
self::migrate();
|
387 |
-
}
|
388 |
-
|
389 |
-
|
390 |
-
public static function migrate() {
|
391 |
-
global $wpdb;
|
392 |
-
|
393 |
-
$table_name = $wpdb->prefix . self::OLD_NAME;
|
394 |
-
$meta_key = '_' . self::PT . ':testimonial_id';
|
395 |
-
$has_table_query = "SELECT table_name FROM information_schema.tables WHERE table_schema='{$wpdb->dbname}' AND table_name='{$table_name}'";
|
396 |
-
$has_table_result = $wpdb->get_col( $has_table_query );
|
397 |
-
|
398 |
-
if ( ! empty( $has_table_result ) ) {
|
399 |
-
// check that db table exists and has entries
|
400 |
-
$query = 'SELECT `testimonial_id`, `testimonial`, `author`, `source`, `tags`, `public`, `time_added`, `time_updated` FROM `' . $table_name . '`';
|
401 |
-
|
402 |
-
// ignore already imported
|
403 |
-
$done_import_query = 'SELECT meta_value FROM ' . $wpdb->postmeta . ' WHERE meta_key = "' . $meta_key . '"';
|
404 |
-
$done_import = $wpdb->get_col( $done_import_query );
|
405 |
-
|
406 |
-
if ( ! empty( $done_import ) ) {
|
407 |
-
$done_import = array_unique( $done_import );
|
408 |
-
$query .= ' WHERE testimonial_id NOT IN ( ' . implode( ',', $done_import ) . ' )';
|
409 |
-
}
|
410 |
-
|
411 |
-
$results = $wpdb->get_results( $query );
|
412 |
-
if ( ! empty( $results ) ) {
|
413 |
-
foreach ( $results as $result ) {
|
414 |
-
// author can contain title and company details
|
415 |
-
$author = $result->author;
|
416 |
-
$company = false;
|
417 |
-
|
418 |
-
// ex: First Last of Company!
|
419 |
-
$author = str_replace( ' of ', ', ', $author );
|
420 |
-
// now ex: First Last, Company!
|
421 |
-
|
422 |
-
// ex: First Last, Company
|
423 |
-
// ex: First Last, Web Development Manager, Topcon Positioning Systems, Inc.
|
424 |
-
// ex: First Last, Owner, Company, LLC
|
425 |
-
$author = str_replace( ' of ', ', ', $author );
|
426 |
-
$temp_comma = '^^^';
|
427 |
-
$author = str_replace( ', LLC', $temp_comma . ' LLC', $author );
|
428 |
-
|
429 |
-
// now ex: First Last, Owner, Company^^^ LLC
|
430 |
-
$author = str_replace( ', Inc', $temp_comma . ' Inc', $author );
|
431 |
-
|
432 |
-
// ex: First Last, Web Development Manager, Company^^^ Inc.
|
433 |
-
// it's possible to have "Michael Cannon, Senior Developer" and "Senior Developer" become the company. Okay for now
|
434 |
-
$author = explode( ', ', $author );
|
435 |
-
|
436 |
-
if ( 1 < count( $author ) ) {
|
437 |
-
$company = array_pop( $author );
|
438 |
-
$company = str_replace( $temp_comma, ',', $company );
|
439 |
-
}
|
440 |
-
|
441 |
-
$author = implode( ', ', $author );
|
442 |
-
$author = str_replace( $temp_comma, ',', $author );
|
443 |
-
|
444 |
-
$post_data = array(
|
445 |
-
'post_type' => self::PT,
|
446 |
-
'post_status' => ( 'yes' == $result->public ) ? 'publish' : 'private',
|
447 |
-
'post_date' => $result->time_added,
|
448 |
-
'post_modified' => $result->time_updated,
|
449 |
-
'post_title' => $author,
|
450 |
-
'post_content' => $result->testimonial,
|
451 |
-
'tags_input' => $result->tags,
|
452 |
-
);
|
453 |
-
|
454 |
-
$post_id = wp_insert_post( $post_data, true );
|
455 |
-
|
456 |
-
// track/link testimonial import to new post
|
457 |
-
add_post_meta( $post_id, $meta_key, $result->testimonial_id );
|
458 |
-
|
459 |
-
if ( ! empty( $company ) )
|
460 |
-
add_post_meta( $post_id, 'testimonials-widget-company', $company );
|
461 |
-
|
462 |
-
$source = $result->source;
|
463 |
-
if ( ! empty( $source ) ) {
|
464 |
-
if ( is_email( $source ) ) {
|
465 |
-
add_post_meta( $post_id, 'testimonials-widget-email', $source );
|
466 |
-
} else {
|
467 |
-
add_post_meta( $post_id, 'testimonials-widget-url', $source );
|
468 |
-
}
|
469 |
-
}
|
470 |
-
}
|
471 |
-
}
|
472 |
-
}
|
473 |
-
|
474 |
-
$options['migrated'] = true;
|
475 |
-
delete_option( self::OLD_NAME );
|
476 |
-
add_option( self::OLD_NAME, $options, '', 'no' );
|
477 |
-
}
|
478 |
-
|
479 |
-
|
480 |
-
public static function pre_get_posts_author( $query ) {
|
481 |
-
global $user_ID;
|
482 |
-
|
483 |
-
// author's and below
|
484 |
-
if ( $query->is_admin && ! empty( $query->is_main_query ) && $query->is_post_type_archive( Testimonials_Widget::PT ) && ! current_user_can( 'edit_others_posts' ) )
|
485 |
-
$query->set( 'post_author', $user_ID );
|
486 |
-
|
487 |
-
return $query;
|
488 |
-
}
|
489 |
-
|
490 |
-
|
491 |
-
public static function manage_posts_custom_column( $column, $post_id ) {
|
492 |
-
$result = false;
|
493 |
-
|
494 |
-
switch ( $column ) {
|
495 |
-
case 'id':
|
496 |
-
$result = $post_id;
|
497 |
-
break;
|
498 |
-
|
499 |
-
case 'shortcode':
|
500 |
-
$result = '[testimonialswidget_list ids="';
|
501 |
-
$result .= $post_id;
|
502 |
-
$result .= '"]';
|
503 |
-
$result .= '<br />';
|
504 |
-
$result .= '[testimonialswidget_widget ids="';
|
505 |
-
$result .= $post_id;
|
506 |
-
$result .= '"]';
|
507 |
-
break;
|
508 |
-
|
509 |
-
case 'testimonials-widget-company':
|
510 |
-
case 'testimonials-widget-location':
|
511 |
-
case 'testimonials-widget-title':
|
512 |
-
$result = get_post_meta( $post_id, $column, true );
|
513 |
-
break;
|
514 |
-
|
515 |
-
case 'testimonials-widget-email':
|
516 |
-
case 'testimonials-widget-url':
|
517 |
-
$url = get_post_meta( $post_id, $column, true );
|
518 |
-
if ( ! empty( $url ) && ! is_email( $url ) && 0 === preg_match( '#https?://#', $url ) )
|
519 |
-
$url = 'http://' . $url;
|
520 |
-
|
521 |
-
$result = make_clickable( $url );
|
522 |
-
break;
|
523 |
-
|
524 |
-
case 'thumbnail':
|
525 |
-
$email = get_post_meta( $post_id, 'testimonials-widget-email', true );
|
526 |
-
|
527 |
-
if ( has_post_thumbnail( $post_id ) )
|
528 |
-
$result = get_the_post_thumbnail( $post_id, 'thumbnail' );
|
529 |
-
elseif ( is_email( $email ) )
|
530 |
-
$result = get_avatar( $email );
|
531 |
-
else
|
532 |
-
$result = false;
|
533 |
-
break;
|
534 |
-
|
535 |
-
case self::$cpt_category:
|
536 |
-
case self::$cpt_tags:
|
537 |
-
$terms = get_the_terms( $post_id, $column );
|
538 |
-
$result = '';
|
539 |
-
if ( ! empty( $terms ) ) {
|
540 |
-
$out = array();
|
541 |
-
foreach ( $terms as $term )
|
542 |
-
$out[] = '<a href="' . admin_url( 'edit-tags.php?action=edit&taxonomy=' . $column . '&tag_ID=' . $term->term_id . '&post_type=' . self::PT ) . '">' . $term->name . '</a>';
|
543 |
-
|
544 |
-
$result = join( ', ', $out );
|
545 |
-
}
|
546 |
-
break;
|
547 |
-
}
|
548 |
-
|
549 |
-
$result = apply_filters( 'testimonials_widget_posts_custom_column', $result, $column, $post_id );
|
550 |
-
|
551 |
-
if ( $result )
|
552 |
-
echo $result;
|
553 |
-
}
|
554 |
-
|
555 |
-
|
556 |
-
public static function manage_posts_columns( $columns ) {
|
557 |
-
// order of keys matches column ordering
|
558 |
-
$columns = array(
|
559 |
-
'cb' => '<input type="checkbox" />',
|
560 |
-
'id' => esc_html__( 'ID', 'testimonials-widget' ),
|
561 |
-
'thumbnail' => esc_html__( 'Image', 'testimonials-widget' ),
|
562 |
-
'title' => esc_html__( 'Source', 'testimonials-widget' ),
|
563 |
-
'shortcode' => esc_html__( 'Shortcodes', 'testimonials-widget' ),
|
564 |
-
'testimonials-widget-title' => esc_html__( 'Job Title', 'testimonials-widget' ),
|
565 |
-
'testimonials-widget-location' => esc_html__( 'Location', 'testimonials-widget' ),
|
566 |
-
'testimonials-widget-email' => esc_html__( 'Email', 'testimonials-widget' ),
|
567 |
-
'testimonials-widget-company' => esc_html__( 'Company', 'testimonials-widget' ),
|
568 |
-
'testimonials-widget-url' => esc_html__( 'URL', 'testimonials-widget' ),
|
569 |
-
'author' => esc_html__( 'Published by', 'testimonials-widget' ),
|
570 |
-
'date' => esc_html__( 'Date', 'testimonials-widget' ),
|
571 |
-
);
|
572 |
-
|
573 |
-
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
574 |
-
if ( ! $use_cpt_taxonomy ) {
|
575 |
-
$columns[ 'categories' ] = esc_html__( 'Category', 'testimonials-widget' );
|
576 |
-
$columns[ 'tags' ] = esc_html__( 'Tags', 'testimonials-widget' );
|
577 |
-
} else {
|
578 |
-
$columns[ self::$cpt_category ] = esc_html__( 'Category', 'testimonials-widget' );
|
579 |
-
$columns[ self::$cpt_tags ] = esc_html__( 'Tags', 'testimonials-widget' );
|
580 |
-
}
|
581 |
-
|
582 |
-
$columns = apply_filters( 'testimonials_widget_columns', $columns );
|
583 |
-
|
584 |
-
return $columns;
|
585 |
-
}
|
586 |
-
|
587 |
-
|
588 |
-
public static function init_post_type() {
|
589 |
-
$labels = array(
|
590 |
-
'add_new' => esc_html__( 'Add New', 'testimonials-widget' ),
|
591 |
-
'add_new_item' => esc_html__( 'Add New Testimonial', 'testimonials-widget' ),
|
592 |
-
'edit_item' => esc_html__( 'Edit Testimonial', 'testimonials-widget' ),
|
593 |
-
'name' => esc_html__( 'Testimonials', 'testimonials-widget' ),
|
594 |
-
'new_item' => esc_html__( 'Add New Testimonial', 'testimonials-widget' ),
|
595 |
-
'not_found' => esc_html__( 'No testimonials found', 'testimonials-widget' ),
|
596 |
-
'not_found_in_trash' => esc_html__( 'No testimonials found in Trash', 'testimonials-widget' ),
|
597 |
-
'parent_item_colon' => null,
|
598 |
-
'search_items' => esc_html__( 'Search Testimonials', 'testimonials-widget' ),
|
599 |
-
'singular_name' => esc_html__( 'Testimonial', 'testimonials-widget' ),
|
600 |
-
'view_item' => esc_html__( 'View Testimonial', 'testimonials-widget' ),
|
601 |
-
);
|
602 |
-
|
603 |
-
$supports = array(
|
604 |
-
'title',
|
605 |
-
'editor',
|
606 |
-
'thumbnail',
|
607 |
-
);
|
608 |
-
|
609 |
-
$allow_comments = tw_get_option( 'allow_comments', false );
|
610 |
-
if ( $allow_comments )
|
611 |
-
$supports[] = 'comments';
|
612 |
-
|
613 |
-
$has_archive = tw_get_option( 'has_archive', true );
|
614 |
-
$rewrite_slug = tw_get_option( 'rewrite_slug', 'testimonial' );
|
615 |
-
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
616 |
-
|
617 |
-
// editor's and up
|
618 |
-
if ( current_user_can( 'edit_others_posts' ) )
|
619 |
-
$supports[] = 'author';
|
620 |
-
|
621 |
-
if ( ! $use_cpt_taxonomy ) {
|
622 |
-
$do_register_taxonomy = false;
|
623 |
-
$taxonomies = array(
|
624 |
-
'category',
|
625 |
-
'post_tag',
|
626 |
-
);
|
627 |
-
} else {
|
628 |
-
$do_register_taxonomy = true;
|
629 |
-
$taxonomies = array(
|
630 |
-
self::$cpt_category,
|
631 |
-
self::$cpt_tags,
|
632 |
-
);
|
633 |
-
|
634 |
-
self::register_taxonomies();
|
635 |
-
}
|
636 |
-
|
637 |
-
$args = array(
|
638 |
-
'label' => esc_html__( 'Testimonials', 'testimonials-widget' ),
|
639 |
-
'capability_type' => 'post',
|
640 |
-
'has_archive' => $has_archive,
|
641 |
-
'hierarchical' => false,
|
642 |
-
'labels' => $labels,
|
643 |
-
'public' => true,
|
644 |
-
'publicly_queryable' => true,
|
645 |
-
'query_var' => true,
|
646 |
-
'rewrite' => array(
|
647 |
-
'slug' => $rewrite_slug,
|
648 |
-
'with_front' => false,
|
649 |
-
),
|
650 |
-
'supports' => $supports,
|
651 |
-
'taxonomies' => $taxonomies,
|
652 |
-
);
|
653 |
-
|
654 |
-
register_post_type( self::PT, $args );
|
655 |
-
|
656 |
-
if ( $do_register_taxonomy ) {
|
657 |
-
register_taxonomy_for_object_type( self::$cpt_category, self::PT );
|
658 |
-
register_taxonomy_for_object_type( self::$cpt_tags, self::PT );
|
659 |
-
}
|
660 |
-
}
|
661 |
-
|
662 |
-
|
663 |
-
public static function register_taxonomies() {
|
664 |
-
$args = array(
|
665 |
-
'hierarchical' => true,
|
666 |
-
'show_admin_column' => true,
|
667 |
-
);
|
668 |
-
register_taxonomy( self::$cpt_category, self::PT, $args );
|
669 |
-
|
670 |
-
$args = array(
|
671 |
-
'show_admin_column' => true,
|
672 |
-
'update_count_callback' => '_update_post_term_count',
|
673 |
-
);
|
674 |
-
register_taxonomy( self::$cpt_tags, self::PT, $args );
|
675 |
-
}
|
676 |
-
|
677 |
-
|
678 |
-
public static function get_defaults( $single_view = false ) {
|
679 |
-
if ( empty( $single_view ) )
|
680 |
-
return apply_filters( 'testimonials_widget_defaults', tw_get_options() );
|
681 |
-
else
|
682 |
-
return apply_filters( 'testimonials_widget_defaults_single', tw_get_options() );
|
683 |
-
}
|
684 |
-
|
685 |
-
|
686 |
-
public static function testimonialswidget_list( $atts ) {
|
687 |
-
$atts = wp_parse_args( $atts, self::get_defaults() );
|
688 |
-
$atts = Testimonials_Widget_Settings::validate_settings( $atts );
|
689 |
-
|
690 |
-
if ( get_query_var( 'paged' ) ) {
|
691 |
-
$atts['paged'] = get_query_var( 'paged' );
|
692 |
-
} elseif ( get_query_var( 'page' ) ) {
|
693 |
-
$atts['paged'] = get_query_var( 'page' );
|
694 |
-
} else {
|
695 |
-
$atts['paged'] = 1;
|
696 |
-
}
|
697 |
-
|
698 |
-
$atts['type'] = 'testimonialswidget_list';
|
699 |
-
|
700 |
-
$instance = self::add_instance();
|
701 |
-
$atts['widget_number'] = $instance;
|
702 |
-
|
703 |
-
$testimonials = array();
|
704 |
-
|
705 |
-
$content = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
706 |
-
if ( false === $content ) {
|
707 |
-
$testimonials = self::get_testimonials( $atts );
|
708 |
-
$content = self::get_testimonials_html( $testimonials, $atts );
|
709 |
-
$content = apply_filters( 'testimonials_widget_cache_set', $content, $atts );
|
710 |
-
}
|
711 |
-
|
712 |
-
self::call_scripts_styles( $testimonials, $atts, $instance );
|
713 |
-
|
714 |
-
return $content;
|
715 |
-
}
|
716 |
-
|
717 |
-
|
718 |
-
public static function testimonialswidget_widget( $atts, $widget_number = null ) {
|
719 |
-
if ( empty( $widget_number ) ) {
|
720 |
-
$widget_number = self::$widget_number++;
|
721 |
-
|
722 |
-
if ( ! isset( $atts['random'] ) )
|
723 |
-
$atts['random'] = 1;
|
724 |
-
|
725 |
-
if ( ! isset( $atts['enable_schema'] ) )
|
726 |
-
$atts['enable_schema'] = 0;
|
727 |
-
}
|
728 |
-
|
729 |
-
$atts = wp_parse_args( $atts, self::get_defaults() );
|
730 |
-
$atts = Testimonials_Widget_Settings::validate_settings( $atts );
|
731 |
-
|
732 |
-
$atts['paging'] = false;
|
733 |
-
$atts['type'] = 'testimonialswidget_widget';
|
734 |
-
|
735 |
-
self::set_instance( $widget_number );
|
736 |
-
$atts['widget_number'] = $widget_number;
|
737 |
-
|
738 |
-
$testimonials = array();
|
739 |
-
|
740 |
-
$content = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
741 |
-
if ( false === $content ) {
|
742 |
-
$testimonials = self::get_testimonials( $atts );
|
743 |
-
$content = self::get_testimonials_html( $testimonials, $atts, false, $widget_number );
|
744 |
-
$content = apply_filters( 'testimonials_widget_cache_set', $content, $atts );
|
745 |
-
}
|
746 |
-
|
747 |
-
self::call_scripts_styles( $testimonials, $atts, $widget_number );
|
748 |
-
|
749 |
-
return $content;
|
750 |
-
}
|
751 |
-
|
752 |
-
|
753 |
-
public static function scripts( $atts ) {
|
754 |
-
if ( is_admin() )
|
755 |
-
return;
|
756 |
-
|
757 |
-
wp_enqueue_script( 'jquery' );
|
758 |
-
|
759 |
-
$use_bxslider = $atts['use_bxslider'];
|
760 |
-
if ( $use_bxslider ) {
|
761 |
-
$enable_video = $atts['enable_video'];
|
762 |
-
if ( $enable_video ) {
|
763 |
-
wp_register_script( 'jquery.fitvids', plugins_url( 'js/jquery.fitvids.js', __FILE__ ), array( 'jquery' ), '1.0' );
|
764 |
-
wp_enqueue_script( 'jquery.fitvids' );
|
765 |
-
}
|
766 |
-
|
767 |
-
wp_register_script( 'jquery.bxslider', plugins_url( 'js/jquery.bxslider.js', __FILE__ ), array( 'jquery' ), '4.1.1' );
|
768 |
-
wp_enqueue_script( 'jquery.bxslider' );
|
769 |
-
}
|
770 |
-
|
771 |
-
do_action( 'testimonials_widget_scripts', $atts );
|
772 |
-
}
|
773 |
-
|
774 |
-
|
775 |
-
public static function styles() {
|
776 |
-
if ( is_admin() )
|
777 |
-
return;
|
778 |
-
|
779 |
-
$use_bxslider = tw_get_option( 'use_bxslider' );
|
780 |
-
if ( $use_bxslider ) {
|
781 |
-
wp_register_style( 'jquery.bxslider', plugins_url( 'css/jquery.bxslider.css', __FILE__ ) );
|
782 |
-
wp_enqueue_style( 'jquery.bxslider' );
|
783 |
-
|
784 |
-
wp_register_style( __CLASS__, plugins_url( 'testimonials-widget.css', __FILE__ ) );
|
785 |
-
} else {
|
786 |
-
wp_register_style( __CLASS__, plugins_url( 'css/testimonials-widget-2.14.0.css', __FILE__ ) );
|
787 |
-
|
788 |
-
$include_ie7_css = tw_get_option( 'include_ie7_css' );
|
789 |
-
if ( $include_ie7_css ) {
|
790 |
-
wp_register_style( __CLASS__ . '-ie7', plugins_url( 'css/testimonials-widget-ie7.css', __FILE__ ) );
|
791 |
-
wp_enqueue_style( __CLASS__ . '-ie7' );
|
792 |
-
}
|
793 |
-
}
|
794 |
-
|
795 |
-
wp_enqueue_style( __CLASS__ );
|
796 |
-
|
797 |
-
do_action( 'testimonials_widget_styles' );
|
798 |
-
}
|
799 |
-
|
800 |
-
|
801 |
-
public static function get_testimonials_html_css( $atts, $widget_number = null ) {
|
802 |
-
$css = array();
|
803 |
-
$id_base = self::ID . $widget_number;
|
804 |
-
|
805 |
-
switch ( $atts['type'] ) {
|
806 |
-
case 'testimonialswidget_widget':
|
807 |
-
$use_bxslider = $atts['use_bxslider'];
|
808 |
-
if ( ! $use_bxslider ) {
|
809 |
-
$height = $atts['height'];
|
810 |
-
$max_height = $atts['max_height'];
|
811 |
-
$min_height = $atts['min_height'];
|
812 |
-
|
813 |
-
if ( $height ) {
|
814 |
-
$max_height = $height;
|
815 |
-
$min_height = $height;
|
816 |
-
}
|
817 |
-
|
818 |
-
if ( $min_height ) {
|
819 |
-
$css[] = <<<EOF
|
820 |
-
<style>
|
821 |
-
.$id_base {
|
822 |
-
min-height: {$min_height}px;
|
823 |
-
}
|
824 |
-
</style>
|
825 |
-
EOF;
|
826 |
-
}
|
827 |
-
|
828 |
-
if ( $max_height ) {
|
829 |
-
$css[] = <<<EOF
|
830 |
-
<style>
|
831 |
-
.$id_base {
|
832 |
-
max-height: {$max_height}px;
|
833 |
-
}
|
834 |
-
</style>
|
835 |
-
EOF;
|
836 |
-
}
|
837 |
-
}
|
838 |
-
break;
|
839 |
-
}
|
840 |
-
|
841 |
-
$css = apply_filters( 'testimonials_widget_testimonials_css', $css, $atts, $widget_number );
|
842 |
-
|
843 |
-
return $css;
|
844 |
-
}
|
845 |
-
|
846 |
-
|
847 |
-
public static function get_testimonials_html_js( $testimonials, $atts, $widget_number = null ) {
|
848 |
-
$not_found = self::get_not_found();
|
849 |
-
if ( $not_found )
|
850 |
-
return;
|
851 |
-
|
852 |
-
$scripts = array();
|
853 |
-
$scripts_internal = array();
|
854 |
-
|
855 |
-
$id = self::ID;
|
856 |
-
$id_base = $id . $widget_number;
|
857 |
-
|
858 |
-
switch ( $atts['type'] ) {
|
859 |
-
case 'testimonialswidget_widget':
|
860 |
-
$javascript = '';
|
861 |
-
if ( 1 < count( $testimonials ) ) {
|
862 |
-
$refresh_interval = $atts['refresh_interval'];
|
863 |
-
|
864 |
-
$javascript .= '<script type="text/javascript">' . "\n";
|
865 |
-
|
866 |
-
$use_bxslider = $atts['use_bxslider'];
|
867 |
-
if ( $use_bxslider ) {
|
868 |
-
$enable_video = $atts['enable_video'];
|
869 |
-
$show_start_stop = $atts['show_start_stop'];
|
870 |
-
$transition_mode = $atts['transition_mode'];
|
871 |
-
|
872 |
-
$auto = $refresh_interval ? 'true' : 'false';
|
873 |
-
$pager = ! $refresh_interval ? 'pager: true' : 'pager: false';
|
874 |
-
$pause = $refresh_interval * 1000;
|
875 |
-
$video = $enable_video ? "video: true,\nuseCSS: false" : 'video: false';
|
876 |
-
|
877 |
-
$autoControls = $show_start_stop ? 'autoControls: true,' : '';
|
878 |
-
|
879 |
-
$slider_var = self::SLUG . $widget_number;
|
880 |
-
$javascript .= <<<EOF
|
881 |
-
var {$slider_var} = null;
|
882 |
-
|
883 |
-
jQuery(document).ready(function() {
|
884 |
-
{$slider_var} = jQuery('.{$id_base}').bxSlider({
|
885 |
-
auto: {$auto},
|
886 |
-
{$autoControls}
|
887 |
-
autoHover: true,
|
888 |
-
controls: false,
|
889 |
-
mode: '{$transition_mode}',
|
890 |
-
{$pager},
|
891 |
-
pause: {$pause},
|
892 |
-
{$video},
|
893 |
-
slideMargin: 2
|
894 |
-
});
|
895 |
-
});
|
896 |
-
|
897 |
-
EOF;
|
898 |
-
} else {
|
899 |
-
$tw_padding = 'tw_padding' . $widget_number;
|
900 |
-
$tw_wrapper = 'tw_wrapper' . $widget_number;
|
901 |
-
|
902 |
-
$disable_animation = $atts['disable_animation'];
|
903 |
-
$fade_in_speed = $atts['fade_in_speed'];
|
904 |
-
$fade_out_speed = $atts['fade_out_speed'];
|
905 |
-
$height = $atts['height'];
|
906 |
-
$max_height = $atts['max_height'];
|
907 |
-
$min_height = $atts['min_height'];
|
908 |
-
|
909 |
-
$enable_animation = 1;
|
910 |
-
if ( $disable_animation || $height || $max_height || $min_height )
|
911 |
-
$enable_animation = 0;
|
912 |
-
|
913 |
-
if ( $refresh_interval ) {
|
914 |
-
$javascript .= <<<EOF
|
915 |
-
function nextTestimonial{$widget_number}() {
|
916 |
-
if ( ! jQuery('.{$id_base}').first().hasClass('hovered') ) {
|
917 |
-
var active = jQuery('.{$id_base} .active');
|
918 |
-
var next = (jQuery('.{$id_base} .active').next().length > 0) ? jQuery('.{$id_base} .active').next() : jQuery('.{$id_base} .testimonials-widget-testimonial:first-child');
|
919 |
-
|
920 |
-
active.fadeOut({$fade_out_speed}, function() {
|
921 |
-
active.removeClass('active');
|
922 |
-
next.fadeIn({$fade_in_speed});
|
923 |
-
next.removeClass('display-none');
|
924 |
-
next.addClass('active');
|
925 |
-
|
926 |
-
{INTERNAL_SCRIPTS}
|
927 |
-
|
928 |
-
// added padding
|
929 |
-
if ( {$enable_animation} )
|
930 |
-
{$tw_wrapper}.animate({ height: next.height() + {$tw_padding} });
|
931 |
-
});
|
932 |
-
}
|
933 |
-
}
|
934 |
-
|
935 |
-
jQuery(document).ready(function() {
|
936 |
-
jQuery('.{$id_base}').hover(function() {
|
937 |
-
jQuery(this).addClass('hovered')
|
938 |
-
}, function() {
|
939 |
-
jQuery(this).removeClass('hovered')
|
940 |
-
});
|
941 |
-
|
942 |
-
nextTestimonial{$widget_number}interval = setInterval('nextTestimonial{$widget_number}()', {$refresh_interval} * 1000);
|
943 |
-
});
|
944 |
-
|
945 |
-
EOF;
|
946 |
-
}
|
947 |
-
|
948 |
-
$javascript .= <<<EOF
|
949 |
-
if ( {$enable_animation} ) {
|
950 |
-
var {$tw_wrapper} = jQuery('.{$id_base}');
|
951 |
-
var {$tw_padding} = 0;
|
952 |
-
|
953 |
-
jQuery(document).ready(function() {
|
954 |
-
// tw_padding is the difference in height to take into account all styling options
|
955 |
-
{$tw_padding} = {$tw_wrapper}.height() - jQuery('.{$id_base} .testimonials-widget-testimonial').height();
|
956 |
-
|
957 |
-
// fixes first animation by defining height to adjust to
|
958 |
-
{$tw_wrapper}.height( {$tw_wrapper}.height() );
|
959 |
-
});
|
960 |
-
}
|
961 |
-
EOF;
|
962 |
-
}
|
963 |
-
|
964 |
-
$javascript .= "\n" . '</script>';
|
965 |
-
$scripts[ $id_base ] = $javascript;
|
966 |
-
}
|
967 |
-
break;
|
968 |
-
}
|
969 |
-
|
970 |
-
$scripts = apply_filters( 'testimonials_widget_testimonials_js', $scripts, $testimonials, $atts, $widget_number );
|
971 |
-
$scripts_internal = apply_filters( 'testimonials_widget_testimonials_js_internal', $scripts_internal, $testimonials, $atts, $widget_number );
|
972 |
-
$internal_scripts = implode( "\n", $scripts_internal );
|
973 |
-
$scripts = str_replace( '{INTERNAL_SCRIPTS}', $internal_scripts, $scripts );
|
974 |
-
|
975 |
-
return $scripts;
|
976 |
-
}
|
977 |
-
|
978 |
-
|
979 |
-
public static function get_testimonials_html( $testimonials, $atts, $is_list = true, $widget_number = null ) {
|
980 |
-
$hide_not_found = $atts['hide_not_found'];
|
981 |
-
$paging = Testimonials_Widget_Settings::is_true( $atts['paging'] );
|
982 |
-
$paging_before = ( 'before' === strtolower( $atts['paging'] ) );
|
983 |
-
$paging_after = ( 'after' === strtolower( $atts['paging'] ) );
|
984 |
-
$target = $atts['target'];
|
985 |
-
|
986 |
-
$id = self::ID;
|
987 |
-
|
988 |
-
if ( is_null( $widget_number ) ) {
|
989 |
-
$div_open = '<div class="' . $id;
|
990 |
-
|
991 |
-
if ( $is_list )
|
992 |
-
$div_open .= ' listing';
|
993 |
-
|
994 |
-
$div_open .= '">';
|
995 |
-
} else {
|
996 |
-
$id_base = $id . $widget_number;
|
997 |
-
$div_open = '<div class="' . $id . ' ' . $id_base . '">';
|
998 |
-
}
|
999 |
-
|
1000 |
-
if ( empty( $testimonials ) && ! $hide_not_found ) {
|
1001 |
-
$testimonials = array(
|
1002 |
-
array( 'testimonial_content' => esc_html__( 'No testimonials found', 'testimonials-widget' ) ),
|
1003 |
-
);
|
1004 |
-
|
1005 |
-
self::set_not_found( true );
|
1006 |
-
} else
|
1007 |
-
self::set_not_found();
|
1008 |
-
|
1009 |
-
$pre_paging = '';
|
1010 |
-
if ( $paging || $paging_before )
|
1011 |
-
$pre_paging = self::get_testimonials_paging( $atts );
|
1012 |
-
|
1013 |
-
$is_first = true;
|
1014 |
-
|
1015 |
-
$testimonial_content = '';
|
1016 |
-
foreach ( $testimonials as $testimonial ) {
|
1017 |
-
$content = self::get_testimonial_html( $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1018 |
-
if ( $target )
|
1019 |
-
$content = links_add_target( $content, $target );
|
1020 |
-
$content = apply_filters( 'testimonials_widget_testimonial_html', $content, $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1021 |
-
$is_first = false;
|
1022 |
-
|
1023 |
-
$testimonial_content .= $content;
|
1024 |
-
}
|
1025 |
-
|
1026 |
-
$post_paging = '';
|
1027 |
-
if ( $paging || $paging_after )
|
1028 |
-
$post_paging = self::get_testimonials_paging( $atts, false );
|
1029 |
-
|
1030 |
-
$div_close = '</div>';
|
1031 |
-
|
1032 |
-
$html = $div_open
|
1033 |
-
. $pre_paging
|
1034 |
-
. $testimonial_content
|
1035 |
-
. $post_paging
|
1036 |
-
. $div_close;
|
1037 |
-
|
1038 |
-
$html = apply_filters( 'testimonials_widget_get_testimonials_html', $html, $testimonials, $atts, $is_list, $widget_number, $div_open, $pre_paging, $testimonial_content, $post_paging, $div_close );
|
1039 |
-
|
1040 |
-
return $html;
|
1041 |
-
}
|
1042 |
-
|
1043 |
-
|
1044 |
-
public static function get_testimonial_html( $testimonial, $atts, $is_list = true, $is_first = false, $widget_number = null ) {
|
1045 |
-
$disable_quotes = $atts['disable_quotes'];
|
1046 |
-
$do_image = ! $atts['hide_image'] && ! empty( $testimonial['testimonial_image'] );
|
1047 |
-
$do_image_single = ! $atts['hide_image_single'];
|
1048 |
-
$do_content = ! $atts['hide_content'];
|
1049 |
-
$do_schema = $atts['enable_schema'];
|
1050 |
-
$keep_whitespace = $atts['keep_whitespace'];
|
1051 |
-
$remove_hentry = $atts['remove_hentry'];
|
1052 |
-
$use_bxslider = $atts['use_bxslider'];
|
1053 |
-
|
1054 |
-
$class = 'testimonials-widget-testimonial';
|
1055 |
-
if ( is_single() && empty( $widget_number ) )
|
1056 |
-
$class .= ' single';
|
1057 |
-
elseif ( $is_list )
|
1058 |
-
$class .= ' list';
|
1059 |
-
elseif ( ! $use_bxslider ) {
|
1060 |
-
if ( $is_first )
|
1061 |
-
$class .= ' active';
|
1062 |
-
elseif ( ! $is_first )
|
1063 |
-
$class .= ' display-none';
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
if ( $keep_whitespace )
|
1067 |
-
$class .= ' whitespace';
|
1068 |
-
|
1069 |
-
$post_id = $testimonial['post_id'];
|
1070 |
-
if ( ! empty( $post_id ) )
|
1071 |
-
$class = join( ' ', get_post_class( $class, $post_id ) );
|
1072 |
-
else
|
1073 |
-
$class = 'testimonials-widget type-testimonials-widget status-publish hentry ' . $class;
|
1074 |
-
|
1075 |
-
$class = apply_filters( 'testimonials_widget_get_testimonial_html_class', $class, $testimonial, $atts, $is_list, $is_first, $widget_number );
|
1076 |
-
$div_open = '<!-- ' . self::ID . ":{$post_id}: -->";
|
1077 |
-
$div_open .= '<div class="' . $class . '">';
|
1078 |
-
|
1079 |
-
if ( $do_schema && $do_content )
|
1080 |
-
$div_open .= sprintf( self::$schema_div_open, self::$review_schema );
|
1081 |
-
|
1082 |
-
if ( $remove_hentry )
|
1083 |
-
$div_open = str_replace( ' hentry', '', $div_open );
|
1084 |
-
|
1085 |
-
$image = '';
|
1086 |
-
if ( $do_image ) {
|
1087 |
-
$pic = $testimonial['testimonial_image'];
|
1088 |
-
|
1089 |
-
$image .= '<span class="image">';
|
1090 |
-
$image .= $pic;
|
1091 |
-
$image .= '</span>';
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
if ( ! $do_image_single && 'get_single' == $atts['type'] )
|
1095 |
-
$image = '';
|
1096 |
-
|
1097 |
-
$quote = self::get_quote( $testimonial, $atts, $widget_number );
|
1098 |
-
|
1099 |
-
$cite = '';
|
1100 |
-
if ( 1 < count( $testimonial ) ) {
|
1101 |
-
$cite = self::get_cite( $testimonial, $atts );
|
1102 |
-
|
1103 |
-
if ( $do_schema ) {
|
1104 |
-
$schema = self::get_schema( $testimonial, $atts );
|
1105 |
-
$cite .= $schema;
|
1106 |
-
}
|
1107 |
-
}
|
1108 |
-
|
1109 |
-
$extra = '';
|
1110 |
-
if ( ! empty( $testimonial['testimonial_extra'] ) ) {
|
1111 |
-
$extra .= '<div class="extra">';
|
1112 |
-
$extra .= $testimonial['testimonial_extra'];
|
1113 |
-
$extra .= '</div>';
|
1114 |
-
}
|
1115 |
-
|
1116 |
-
$bottom_text = '';
|
1117 |
-
if ( ! empty( $atts['bottom_text'] ) ) {
|
1118 |
-
$bottom_text = '<div class="bottom_text">';
|
1119 |
-
$bottom_text .= $atts['bottom_text'];
|
1120 |
-
$bottom_text .= '</div>';
|
1121 |
-
}
|
1122 |
-
|
1123 |
-
$div_close = '';
|
1124 |
-
if ( $do_schema && $do_content )
|
1125 |
-
$div_close .= '</div>';
|
1126 |
-
|
1127 |
-
$div_close .= '</div>';
|
1128 |
-
|
1129 |
-
$html = $div_open
|
1130 |
-
. $image
|
1131 |
-
. $quote
|
1132 |
-
. $cite
|
1133 |
-
. $extra
|
1134 |
-
. $bottom_text
|
1135 |
-
. $div_close;
|
1136 |
-
|
1137 |
-
$html = apply_filters( 'testimonials_widget_get_testimonial_html', $html, $testimonial, $atts, $is_list, $is_first, $widget_number, $div_open, $image, $quote, $cite, $extra, $bottom_text, $div_close );
|
1138 |
-
|
1139 |
-
// not done sooner as tag_close_quote is used for Premium
|
1140 |
-
if ( $disable_quotes ) {
|
1141 |
-
$html = str_replace( self::$tag_open_quote, '', $html );
|
1142 |
-
$html = str_replace( self::$tag_close_quote, '', $html );
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
return $html;
|
1146 |
-
}
|
1147 |
-
|
1148 |
-
|
1149 |
-
public static function get_quote( $testimonial, $atts, $widget_number ) {
|
1150 |
-
$char_limit = $atts['char_limit'];
|
1151 |
-
$content_more = apply_filters( 'testimonials_widget_content_more', esc_html__( '…', 'testimonials-widget' ) );
|
1152 |
-
$content_more .= self::$tag_close_quote;
|
1153 |
-
$do_content = ! $atts['hide_content'] && ! empty( $testimonial['testimonial_content'] );
|
1154 |
-
$do_schema = $atts['enable_schema'];
|
1155 |
-
$use_quote_tag = $atts['use_quote_tag'];
|
1156 |
-
|
1157 |
-
$quote = '';
|
1158 |
-
if ( $do_content ) {
|
1159 |
-
$content = $testimonial['testimonial_content'];
|
1160 |
-
if ( $do_schema )
|
1161 |
-
$content = self::create_schema_span( self::$review_body, $content );
|
1162 |
-
|
1163 |
-
$content = self::format_content( $content, $widget_number, $atts );
|
1164 |
-
|
1165 |
-
if ( $char_limit ) {
|
1166 |
-
$content = self::testimonials_truncate( $content, $char_limit, $content_more );
|
1167 |
-
$content = force_balance_tags( $content );
|
1168 |
-
}
|
1169 |
-
|
1170 |
-
$content = apply_filters( 'testimonials_widget_content', $content, $widget_number, $testimonial, $atts );
|
1171 |
-
$content = make_clickable( $content );
|
1172 |
-
|
1173 |
-
if ( ! $use_quote_tag ) {
|
1174 |
-
$quote = '<blockquote>';
|
1175 |
-
$quote .= $content;
|
1176 |
-
$quote .= '</blockquote>';
|
1177 |
-
} else {
|
1178 |
-
$quote = '<q>';
|
1179 |
-
$quote .= $content;
|
1180 |
-
$quote .= '</q>';
|
1181 |
-
}
|
1182 |
-
}
|
1183 |
-
|
1184 |
-
return $quote;
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
|
1188 |
-
public static function get_cite( $testimonial, $atts ) {
|
1189 |
-
extract( $testimonial );
|
1190 |
-
|
1191 |
-
$do_company = ! $atts['hide_company'] && ! empty( $testimonial_company );
|
1192 |
-
$do_email = ! $atts['hide_email'] && ! empty( $testimonial_email ) && is_email( $testimonial_email );
|
1193 |
-
$do_location = ! $atts['hide_location'] && ! empty( $testimonial_location );
|
1194 |
-
$do_source = ! $atts['hide_source'] && ! empty( $testimonial_source );
|
1195 |
-
$do_title = ! $atts['hide_title'] && ! empty( $testimonial_title );
|
1196 |
-
$do_url = ! $atts['hide_url'] && ! empty( $testimonial_url );
|
1197 |
-
$use_quote_tag = $atts['use_quote_tag'];
|
1198 |
-
|
1199 |
-
$cite = '';
|
1200 |
-
|
1201 |
-
$done_url = false;
|
1202 |
-
if ( $do_source && $do_email ) {
|
1203 |
-
$cite .= '<span class="author">';
|
1204 |
-
$cite .= '<a href="mailto:' . $testimonial_email . '">';
|
1205 |
-
$cite .= $testimonial_source;
|
1206 |
-
$cite .= '</a>';
|
1207 |
-
$cite .= '</span>';
|
1208 |
-
} elseif ( $do_source && ! $do_company && $do_url ) {
|
1209 |
-
$done_url = true;
|
1210 |
-
|
1211 |
-
$cite .= '<span class="author">';
|
1212 |
-
$cite .= '<a href="' . $testimonial_url . '" rel="nofollow">';
|
1213 |
-
$cite .= $testimonial_source;
|
1214 |
-
$cite .= '</a>';
|
1215 |
-
$cite .= '</span>';
|
1216 |
-
} elseif ( $do_source ) {
|
1217 |
-
$cite .= '<span class="author">';
|
1218 |
-
$cite .= $testimonial_source;
|
1219 |
-
$cite .= '</span>';
|
1220 |
-
} elseif ( $do_email ) {
|
1221 |
-
$cite .= '<span class="email">';
|
1222 |
-
$cite .= make_clickable( $testimonial_email );
|
1223 |
-
$cite .= '</span>';
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
if ( $do_title && $cite )
|
1227 |
-
$cite .= '<span class="join-title"></span>';
|
1228 |
-
|
1229 |
-
if ( $do_title ) {
|
1230 |
-
$cite .= '<span class="title">';
|
1231 |
-
$cite .= $testimonial_title;
|
1232 |
-
$cite .= '</span>';
|
1233 |
-
}
|
1234 |
-
|
1235 |
-
if ( $do_location && $cite )
|
1236 |
-
$cite .= '<span class="join-location"></span>';
|
1237 |
-
|
1238 |
-
if ( $do_location ) {
|
1239 |
-
$cite .= '<span class="location">';
|
1240 |
-
$cite .= $testimonial_location;
|
1241 |
-
$cite .= '</span>';
|
1242 |
-
}
|
1243 |
-
|
1244 |
-
if ( ( $do_company || ( $do_url && ! $done_url ) ) && $cite )
|
1245 |
-
$cite .= '<span class="join"></span>';
|
1246 |
-
|
1247 |
-
if ( $do_company && $do_url ) {
|
1248 |
-
$cite .= '<span class="company">';
|
1249 |
-
$cite .= '<a href="' . $testimonial_url . '" rel="nofollow">';
|
1250 |
-
$cite .= $testimonial_company;
|
1251 |
-
$cite .= '</a>';
|
1252 |
-
$cite .= '</span>';
|
1253 |
-
} elseif ( $do_company ) {
|
1254 |
-
$cite .= '<span class="company">';
|
1255 |
-
$cite .= $testimonial_company;
|
1256 |
-
$cite .= '</span>';
|
1257 |
-
} elseif ( $do_url && ! $done_url ) {
|
1258 |
-
$cite .= '<span class="url">';
|
1259 |
-
$cite .= make_clickable( $testimonial_url );
|
1260 |
-
$cite .= '</span>';
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
$cite = apply_filters( 'testimonials_widget_cite_html', $cite, $testimonial, $atts );
|
1264 |
-
|
1265 |
-
if ( ! empty( $cite ) ) {
|
1266 |
-
if ( ! $use_quote_tag ) {
|
1267 |
-
$temp = '<div class="credit">';
|
1268 |
-
$temp .= $cite;
|
1269 |
-
$temp .= '</div>';
|
1270 |
-
|
1271 |
-
$cite = $temp;
|
1272 |
-
} else {
|
1273 |
-
$cite = '<cite>' . $cite . '</cite>';
|
1274 |
-
}
|
1275 |
-
}
|
1276 |
-
|
1277 |
-
return $cite;
|
1278 |
-
}
|
1279 |
-
|
1280 |
-
|
1281 |
-
// Original PHP code as myTruncate2 by Chirp Internet: www.chirp.com.au
|
1282 |
-
public static function testimonials_truncate( $string, $char_limit = false, $pad = '…', $force_pad = false ) {
|
1283 |
-
if ( empty( $force_pad ) ) {
|
1284 |
-
if ( ! $char_limit )
|
1285 |
-
return $string;
|
1286 |
-
|
1287 |
-
// return with no change if string is shorter than $char_limit
|
1288 |
-
if ( strlen( $string ) <= $char_limit )
|
1289 |
-
return $string;
|
1290 |
-
}
|
1291 |
-
|
1292 |
-
if ( $char_limit )
|
1293 |
-
return self::truncate( $string, $char_limit, $pad, $force_pad );
|
1294 |
-
|
1295 |
-
return $string . $pad;
|
1296 |
-
}
|
1297 |
-
|
1298 |
-
|
1299 |
-
public static function format_content( $content, $widget_number, $atts ) {
|
1300 |
-
if ( empty ( $content ) )
|
1301 |
-
return $content;
|
1302 |
-
|
1303 |
-
$keep_whitespace = $atts['keep_whitespace'];
|
1304 |
-
$do_shortcode = $atts['do_shortcode'];
|
1305 |
-
|
1306 |
-
// wrap our own quote class around the content before any formatting
|
1307 |
-
// happens
|
1308 |
-
|
1309 |
-
$temp_content = self::$tag_open_quote;
|
1310 |
-
$temp_content .= $content;
|
1311 |
-
$temp_content .= self::$tag_close_quote;
|
1312 |
-
|
1313 |
-
$content = $temp_content;
|
1314 |
-
$content = trim( $content );
|
1315 |
-
$content = wptexturize( $content );
|
1316 |
-
$content = convert_smilies( $content );
|
1317 |
-
$content = convert_chars( $content );
|
1318 |
-
|
1319 |
-
if ( is_null( $widget_number ) || $keep_whitespace )
|
1320 |
-
$content = wpautop( $content );
|
1321 |
-
|
1322 |
-
$content = shortcode_unautop( $content );
|
1323 |
-
|
1324 |
-
if ( $do_shortcode )
|
1325 |
-
$content = do_shortcode( $content );
|
1326 |
-
else
|
1327 |
-
$content = strip_shortcodes( $content );
|
1328 |
-
|
1329 |
-
$content = str_replace( ']]>', ']]>', $content );
|
1330 |
-
$content = trim( $content );
|
1331 |
-
|
1332 |
-
return $content;
|
1333 |
-
}
|
1334 |
-
|
1335 |
-
|
1336 |
-
public static function get_testimonials_paging( $atts, $prepend = true ) {
|
1337 |
-
$html = '';
|
1338 |
-
|
1339 |
-
if ( is_home() || 1 === self::$max_num_pages )
|
1340 |
-
return $html;
|
1341 |
-
|
1342 |
-
$html .= '<div class="paging';
|
1343 |
-
|
1344 |
-
if ( $prepend )
|
1345 |
-
$html .= ' prepend';
|
1346 |
-
else
|
1347 |
-
$html .= ' append';
|
1348 |
-
|
1349 |
-
$html .= '">';
|
1350 |
-
|
1351 |
-
if ( $atts['paged'] )
|
1352 |
-
$paged = $atts['paged'];
|
1353 |
-
else
|
1354 |
-
$paged = 1;
|
1355 |
-
|
1356 |
-
if ( ! function_exists( 'wp_pagenavi' ) ) {
|
1357 |
-
$html .= ' <div class="alignleft">';
|
1358 |
-
|
1359 |
-
if ( 1 < $paged ) {
|
1360 |
-
$laquo = apply_filters( 'testimonials_widget_previous_posts_link_text', esc_html__( '«', 'testimonials-widget' ) );
|
1361 |
-
$html .= get_previous_posts_link( $laquo, $paged );
|
1362 |
-
}
|
1363 |
-
|
1364 |
-
$html .= ' </div>';
|
1365 |
-
|
1366 |
-
$html .= ' <div class="alignright">';
|
1367 |
-
|
1368 |
-
if ( $paged != self::$max_num_pages ) {
|
1369 |
-
$raquo = apply_filters( 'testimonials_widget_next_posts_link_text', esc_html__( '»', 'testimonials-widget' ) );
|
1370 |
-
$html .= get_next_posts_link( $raquo, self::$max_num_pages );
|
1371 |
-
}
|
1372 |
-
|
1373 |
-
$html .= ' </div>';
|
1374 |
-
} else {
|
1375 |
-
$args = array(
|
1376 |
-
'echo' => false,
|
1377 |
-
'query' => self::$wp_query,
|
1378 |
-
);
|
1379 |
-
$args = apply_filters( 'testimonials_widget_wp_pagenavi', $args );
|
1380 |
-
|
1381 |
-
$html .= wp_pagenavi( $args );
|
1382 |
-
}
|
1383 |
-
|
1384 |
-
$html .= '</div>';
|
1385 |
-
|
1386 |
-
return $html;
|
1387 |
-
}
|
1388 |
-
|
1389 |
-
|
1390 |
-
public static function get_testimonials_css() {
|
1391 |
-
if ( empty( self::$css_called ) ) {
|
1392 |
-
foreach ( self::$css as $css )
|
1393 |
-
echo $css;
|
1394 |
-
|
1395 |
-
self::$css_called = true;
|
1396 |
-
}
|
1397 |
-
}
|
1398 |
-
|
1399 |
-
|
1400 |
-
public static function get_testimonials_scripts() {
|
1401 |
-
if ( empty( self::$scripts_called ) ) {
|
1402 |
-
foreach ( self::$scripts as $script )
|
1403 |
-
echo $script;
|
1404 |
-
|
1405 |
-
self::$scripts_called = true;
|
1406 |
-
}
|
1407 |
-
}
|
1408 |
-
|
1409 |
-
|
1410 |
-
/**
|
1411 |
-
*
|
1412 |
-
*
|
1413 |
-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1414 |
-
*/
|
1415 |
-
public static function get_query_args( $atts ) {
|
1416 |
-
extract( $atts );
|
1417 |
-
|
1418 |
-
if ( has_filter( 'posts_orderby', 'CPTOrderPosts' ) )
|
1419 |
-
remove_filter( 'posts_orderby', 'CPTOrderPosts', 99, 2 );
|
1420 |
-
|
1421 |
-
if ( $random ) {
|
1422 |
-
$orderby = 'rand';
|
1423 |
-
$order = false;
|
1424 |
-
}
|
1425 |
-
|
1426 |
-
$args = array(
|
1427 |
-
'orderby' => $orderby,
|
1428 |
-
'post_status' => array(
|
1429 |
-
'publish',
|
1430 |
-
'private',
|
1431 |
-
),
|
1432 |
-
'post_type' => Testimonials_Widget::PT,
|
1433 |
-
'posts_per_page' => $limit,
|
1434 |
-
);
|
1435 |
-
|
1436 |
-
if ( is_single() ) {
|
1437 |
-
$args['post_status'][] = 'pending';
|
1438 |
-
$args['post_status'][] = 'draft';
|
1439 |
-
}
|
1440 |
-
|
1441 |
-
if ( $paging && ! empty( $atts['paged'] ) && is_singular() )
|
1442 |
-
$args['paged'] = $atts['paged'];
|
1443 |
-
|
1444 |
-
if ( ! $random && $meta_key ) {
|
1445 |
-
$args['meta_key'] = $meta_key;
|
1446 |
-
$args['orderby'] = 'meta_value';
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
if ( $order )
|
1450 |
-
$args['order'] = $order;
|
1451 |
-
|
1452 |
-
if ( $ids ) {
|
1453 |
-
$ids = explode( ',', $ids );
|
1454 |
-
|
1455 |
-
$args['post__in'] = $ids;
|
1456 |
-
|
1457 |
-
if ( 'none' == $args['orderby'] )
|
1458 |
-
add_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ), 10, 2 );
|
1459 |
-
}
|
1460 |
-
|
1461 |
-
if ( $exclude ) {
|
1462 |
-
$exclude = explode( ',', $exclude );
|
1463 |
-
$args['post__not_in'] = $exclude;
|
1464 |
-
}
|
1465 |
-
|
1466 |
-
$use_cpt_taxonomy = tw_get_option( 'use_cpt_taxonomy', false );
|
1467 |
-
if ( ! $use_cpt_taxonomy ) {
|
1468 |
-
if ( $category )
|
1469 |
-
$args['category_name'] = $category;
|
1470 |
-
|
1471 |
-
if ( $tags ) {
|
1472 |
-
$tags = explode( ',', $tags );
|
1473 |
-
|
1474 |
-
if ( $tags_all )
|
1475 |
-
$args['tag_slug__and'] = $tags;
|
1476 |
-
else
|
1477 |
-
$args['tag_slug__in'] = $tags;
|
1478 |
-
}
|
1479 |
-
} else {
|
1480 |
-
if ( $category )
|
1481 |
-
$args[ self::$cpt_category ] = $category;
|
1482 |
-
|
1483 |
-
if ( $tags ) {
|
1484 |
-
if ( $tags_all ) {
|
1485 |
-
$args[ 'tax_query' ] = array(
|
1486 |
-
'relation' => 'AND',
|
1487 |
-
);
|
1488 |
-
|
1489 |
-
$tags = explode( ',', $tags );
|
1490 |
-
foreach ( $tags as $term ) {
|
1491 |
-
$args[ 'tax_query' ][] = array(
|
1492 |
-
'taxonomy' => self::$cpt_tags,
|
1493 |
-
'terms' => array( $term ),
|
1494 |
-
'field' => 'slug',
|
1495 |
-
);
|
1496 |
-
}
|
1497 |
-
} else {
|
1498 |
-
$args[ self::$cpt_tags ] = $tags;
|
1499 |
-
}
|
1500 |
-
}
|
1501 |
-
}
|
1502 |
-
|
1503 |
-
$args = apply_filters( 'testimonials_widget_query_args', $args, $atts );
|
1504 |
-
|
1505 |
-
return $args;
|
1506 |
-
}
|
1507 |
-
|
1508 |
-
|
1509 |
-
/**
|
1510 |
-
*
|
1511 |
-
*
|
1512 |
-
* @SuppressWarnings(PHPMD.LongVariable)
|
1513 |
-
*/
|
1514 |
-
public static function get_testimonials( $atts ) {
|
1515 |
-
$hide_gravatar = $atts['hide_gravatar'];
|
1516 |
-
|
1517 |
-
$args = self::get_query_args( $atts );
|
1518 |
-
$args['query'] = true;
|
1519 |
-
|
1520 |
-
$testimonials = apply_filters( 'testimonials_widget_cache_get', false, $args );
|
1521 |
-
if ( false === $testimonials ) {
|
1522 |
-
$testimonials = new WP_Query( $args );
|
1523 |
-
$testimonials = apply_filters( 'testimonials_widget_cache_set', $testimonials, $args );
|
1524 |
-
}
|
1525 |
-
|
1526 |
-
if ( has_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ) ) )
|
1527 |
-
remove_filter( 'posts_results', array( 'Testimonials_Widget', 'posts_results_sort_none' ) );
|
1528 |
-
|
1529 |
-
self::$max_num_pages = $testimonials->max_num_pages;
|
1530 |
-
self::$found_posts = $testimonials->found_posts;
|
1531 |
-
self::$post_count = $testimonials->post_count;
|
1532 |
-
self::$wp_query = $testimonials;
|
1533 |
-
|
1534 |
-
wp_reset_postdata();
|
1535 |
-
|
1536 |
-
$image_size = apply_filters( 'testimonials_widget_image_size', 'thumbnail' );
|
1537 |
-
if ( ! is_array( $image_size ) ) {
|
1538 |
-
global $_wp_additional_image_sizes;
|
1539 |
-
if ( ! empty( $_wp_additional_image_sizes[ $image_size ] ) )
|
1540 |
-
$gravatar_size = $_wp_additional_image_sizes[ $image_size ]['width'];
|
1541 |
-
else
|
1542 |
-
$gravatar_size = get_option( $image_size . '_size_w' );
|
1543 |
-
|
1544 |
-
$gravatar_size = apply_filters( 'testimonials_widget_gravatar_size', $gravatar_size );
|
1545 |
-
} else
|
1546 |
-
$gravatar_size = apply_filters( 'testimonials_widget_gravatar_size', $image_size );
|
1547 |
-
|
1548 |
-
$testimonial_data = array();
|
1549 |
-
|
1550 |
-
if ( empty( self::$post_count ) )
|
1551 |
-
return $testimonial_data;
|
1552 |
-
|
1553 |
-
foreach ( $testimonials->posts as $row ) {
|
1554 |
-
$post_id = $row->ID;
|
1555 |
-
$email = get_post_meta( $post_id, 'testimonials-widget-email', true );
|
1556 |
-
|
1557 |
-
if ( has_post_thumbnail( $post_id ) ) {
|
1558 |
-
$image = get_the_post_thumbnail( $post_id, $image_size );
|
1559 |
-
} elseif ( ! $hide_gravatar && is_email( $email ) ) {
|
1560 |
-
$image = get_avatar( $email, $gravatar_size );
|
1561 |
-
|
1562 |
-
self::make_gravatar_featured( $post_id, $email );
|
1563 |
-
} else {
|
1564 |
-
$image = false;
|
1565 |
-
}
|
1566 |
-
|
1567 |
-
$image = self::strip_protocol( $image );
|
1568 |
-
|
1569 |
-
$url = get_post_meta( $post_id, 'testimonials-widget-url', true );
|
1570 |
-
if ( ! empty( $url ) && 0 === preg_match( '#https?://#', $url ) )
|
1571 |
-
$url = 'http://' . $url;
|
1572 |
-
|
1573 |
-
$data = array(
|
1574 |
-
'post_id' => $post_id,
|
1575 |
-
'testimonial_company' => get_post_meta( $post_id, 'testimonials-widget-company', true ),
|
1576 |
-
'testimonial_content' => $row->post_content,
|
1577 |
-
'testimonial_email' => $email,
|
1578 |
-
'testimonial_extra' => '',
|
1579 |
-
'testimonial_image' => $image,
|
1580 |
-
'testimonial_location' => get_post_meta( $post_id, 'testimonials-widget-location', true ),
|
1581 |
-
'testimonial_source' => $row->post_title,
|
1582 |
-
'testimonial_title' => get_post_meta( $post_id, 'testimonials-widget-title', true ),
|
1583 |
-
'testimonial_url' => $url,
|
1584 |
-
);
|
1585 |
-
|
1586 |
-
$testimonial_data[] = $data;
|
1587 |
-
}
|
1588 |
-
|
1589 |
-
$testimonial_data = apply_filters( 'testimonials_widget_data', $testimonial_data, $atts );
|
1590 |
-
|
1591 |
-
return $testimonial_data;
|
1592 |
-
}
|
1593 |
-
|
1594 |
-
|
1595 |
-
public static function posts_results_sort_none( $posts, $query ) {
|
1596 |
-
$order = $query->query_vars['post__in'];
|
1597 |
-
if ( empty( $order ) )
|
1598 |
-
return $posts;
|
1599 |
-
|
1600 |
-
$posts_none_sorted = array();
|
1601 |
-
// put posts in same orders as post__in
|
1602 |
-
foreach ( $order as $id ) {
|
1603 |
-
foreach ( $posts as $key => $post ) {
|
1604 |
-
if ( $id == $post->ID ) {
|
1605 |
-
$posts_none_sorted[] = $post;
|
1606 |
-
unset( $posts[$key] );
|
1607 |
-
}
|
1608 |
-
}
|
1609 |
-
}
|
1610 |
-
|
1611 |
-
return $posts_none_sorted;
|
1612 |
-
}
|
1613 |
-
|
1614 |
-
|
1615 |
-
public static function widgets_init() {
|
1616 |
-
register_widget( 'Testimonials_Widget_Widget' );
|
1617 |
-
}
|
1618 |
-
|
1619 |
-
|
1620 |
-
/**
|
1621 |
-
*
|
1622 |
-
*
|
1623 |
-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1624 |
-
*/
|
1625 |
-
public static function add_meta_box_testimonials_widget() {
|
1626 |
-
$fields = array(
|
1627 |
-
array(
|
1628 |
-
'name' => esc_html__( 'Job Title', 'testimonials-widget' ),
|
1629 |
-
'id' => 'testimonials-widget-title',
|
1630 |
-
'type' => 'text',
|
1631 |
-
'desc' => '',
|
1632 |
-
),
|
1633 |
-
array(
|
1634 |
-
'name' => esc_html__( 'Location', 'testimonials-widget' ),
|
1635 |
-
'id' => 'testimonials-widget-location',
|
1636 |
-
'type' => 'text',
|
1637 |
-
'desc' => '',
|
1638 |
-
),
|
1639 |
-
array(
|
1640 |
-
'name' => esc_html__( 'Email', 'testimonials-widget' ),
|
1641 |
-
'id' => 'testimonials-widget-email',
|
1642 |
-
'type' => 'text',
|
1643 |
-
'desc' => '',
|
1644 |
-
),
|
1645 |
-
array(
|
1646 |
-
'name' => esc_html__( 'Company', 'testimonials-widget' ),
|
1647 |
-
'id' => 'testimonials-widget-company',
|
1648 |
-
'type' => 'text',
|
1649 |
-
'desc' => '',
|
1650 |
-
),
|
1651 |
-
array(
|
1652 |
-
'name' => esc_html__( 'URL', 'testimonials-widget' ),
|
1653 |
-
'id' => 'testimonials-widget-url',
|
1654 |
-
'type' => 'text',
|
1655 |
-
'desc' => '',
|
1656 |
-
),
|
1657 |
-
);
|
1658 |
-
|
1659 |
-
$fields = apply_filters( 'testimonials_widget_meta_box', $fields );
|
1660 |
-
|
1661 |
-
$meta_box = redrokk_metabox_class::getInstance(
|
1662 |
-
self::ID,
|
1663 |
-
array(
|
1664 |
-
'title' => esc_html__( 'Testimonial Data', 'testimonials-widget' ),
|
1665 |
-
'description' => '',
|
1666 |
-
'_object_types' => 'testimonials-widget',
|
1667 |
-
'priority' => 'high',
|
1668 |
-
'_fields' => $fields,
|
1669 |
-
)
|
1670 |
-
);
|
1671 |
-
}
|
1672 |
|
|
|
|
|
1673 |
|
1674 |
-
|
1675 |
-
|
1676 |
-
*
|
1677 |
-
* Original author: Travis Ballard http://www.travisballard.com
|
1678 |
-
*
|
1679 |
-
* @param string $translation
|
1680 |
-
* @return string $translation
|
1681 |
-
*/
|
1682 |
-
public static function gettext_testimonials( $translation ) {
|
1683 |
-
remove_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
1684 |
|
1685 |
-
|
|
|
1686 |
|
1687 |
-
|
1688 |
-
|
1689 |
-
case esc_html__( 'Enter title here', 'testimonials-widget' ):
|
1690 |
-
return esc_html__( 'Enter testimonial source here', 'testimonials-widget' );
|
1691 |
-
break;
|
1692 |
-
}
|
1693 |
-
}
|
1694 |
-
|
1695 |
-
add_action( 'gettext', array( __CLASS__, 'gettext_testimonials' ) );
|
1696 |
-
|
1697 |
-
return $translation;
|
1698 |
-
}
|
1699 |
-
|
1700 |
-
|
1701 |
-
/**
|
1702 |
-
* Update messages for custom post type
|
1703 |
-
*
|
1704 |
-
* Original author: Travis Ballard http://www.travisballard.com
|
1705 |
-
*
|
1706 |
-
* @SuppressWarnings(PHPMD.Superglobals)
|
1707 |
-
* @param mixed $m
|
1708 |
-
* @return mixed $m
|
1709 |
-
*/
|
1710 |
-
public static function post_updated_messages( $m ) {
|
1711 |
-
global $post;
|
1712 |
-
|
1713 |
-
$m[ self::PT ] = array(
|
1714 |
-
0 => '', // Unused. Messages start at index 1.
|
1715 |
-
1 => sprintf( __( 'Testimonial updated. <a href="%s">View testimonial</a>', 'testimonials-widget' ), esc_url( get_permalink( $post->ID ) ) ),
|
1716 |
-
2 => esc_html__( 'Custom field updated.', 'testimonials-widget' ),
|
1717 |
-
3 => esc_html__( 'Custom field deleted.', 'testimonials-widget' ),
|
1718 |
-
4 => esc_html__( 'Testimonial updated.', 'testimonials-widget' ),
|
1719 |
-
/* translators: %s: date and time of the revision */
|
1720 |
-
5 => isset( $_GET['revision'] ) ? sprintf( esc_html__( 'Testimonial restored to revision from %s', 'testimonials-widget' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
1721 |
-
6 => sprintf( __( 'Testimonial published. <a href="%s">View testimonial</a>', 'testimonials-widget' ), esc_url( get_permalink( $post->ID ) ) ),
|
1722 |
-
7 => esc_html__( 'Testimonial saved.', 'testimonials-widget' ),
|
1723 |
-
8 => sprintf( __( 'Testimonial submitted. <a target="_blank" href="%s">Preview testimonial</a>', 'testimonials-widget' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ),
|
1724 |
-
9 => sprintf( __( 'Testimonial scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview testimonial</a>', 'testimonials-widget' ), date_i18n( 'M j, Y @ G:i', strtotime( $post->post_date ) ), esc_url( get_permalink( $post->ID ) ) ),
|
1725 |
-
10 => sprintf( __( 'Testimonial draft updated. <a target="_blank" href="%s">Preview testimonial</a>', 'testimonials-widget' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) )
|
1726 |
-
);
|
1727 |
-
|
1728 |
-
return $m;
|
1729 |
-
}
|
1730 |
-
|
1731 |
-
|
1732 |
-
public static function right_now_content_table_end() {
|
1733 |
-
$content = '
|
1734 |
-
<tr>
|
1735 |
-
<td class="first b b-%1$s">%4$s%2$s%5$s</td>
|
1736 |
-
<td class="t %1$s">%4$s%3$s%5$s</td>
|
1737 |
-
</tr>';
|
1738 |
-
$posts = wp_count_posts( Testimonials_Widget::PT );
|
1739 |
-
$count = $posts->publish;
|
1740 |
-
$name = _n( 'Testimonial', 'Testimonials', $count, 'testimonials-widget' );
|
1741 |
-
$count_f = number_format_i18n( $count );
|
1742 |
-
$a_open = '<a href="edit.php?post_type=' . Testimonials_Widget::PT . '">';
|
1743 |
-
$a_close = '</a>';
|
1744 |
-
|
1745 |
-
if ( current_user_can( 'edit_others_posts' ) )
|
1746 |
-
$result = sprintf( $content, Testimonials_Widget::PT, $count_f, $name, $a_open, $a_close );
|
1747 |
-
else
|
1748 |
-
$result = sprintf( $content, Testimonials_Widget::PT, $count_f, $name, '', '' );
|
1749 |
-
|
1750 |
-
echo $result;
|
1751 |
-
}
|
1752 |
-
|
1753 |
-
|
1754 |
-
/**
|
1755 |
-
*
|
1756 |
-
*
|
1757 |
-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
1758 |
-
*/
|
1759 |
-
public static function get_schema( $testimonial, $atts ) {
|
1760 |
-
foreach ( $testimonial as $key => $value ) {
|
1761 |
-
if ( 'testimonial_image' != $key )
|
1762 |
-
$testimonial[ $key ] = self::clean_string( $value );
|
1763 |
-
}
|
1764 |
-
|
1765 |
-
extract( $testimonial );
|
1766 |
-
|
1767 |
-
$do_company = ! $atts['hide_company'] && ! empty( $testimonial_company );
|
1768 |
-
$do_email = ! $atts['hide_email'] && ! empty( $testimonial_email ) && is_email( $testimonial_email );
|
1769 |
-
$do_image = ! $atts['hide_image'] && ! empty( $testimonial_image );
|
1770 |
-
$do_location = ! $atts['hide_location'] && ! empty( $testimonial_location );
|
1771 |
-
$do_source = ! $atts['hide_source'] && ! empty( $testimonial_source );
|
1772 |
-
$do_title = ! $atts['hide_title'] && ! empty( $testimonial_title );
|
1773 |
-
$do_url = ! $atts['hide_url'] && ! empty( $testimonial_url );
|
1774 |
-
|
1775 |
-
$item_reviewed = self::clean_string( $atts['item_reviewed'] );
|
1776 |
-
$item_reviewed_url = self::clean_string( $atts['item_reviewed_url'] );
|
1777 |
-
|
1778 |
-
$schema = '';
|
1779 |
-
|
1780 |
-
$agg_meta = array();
|
1781 |
-
$author_meta = array();
|
1782 |
-
$item_meta = array();
|
1783 |
-
$location_meta = array();
|
1784 |
-
$org_meta = array();
|
1785 |
-
$review_meta = array();
|
1786 |
-
|
1787 |
-
if ( $do_source )
|
1788 |
-
$author_meta[ self::$thing_name ] = $testimonial_source;
|
1789 |
-
|
1790 |
-
if ( $do_title )
|
1791 |
-
$author_meta[ self::$person_job_title ] = $testimonial_title;
|
1792 |
-
|
1793 |
-
if ( $do_email )
|
1794 |
-
$author_meta[ self::$person_email ] = $testimonial_email;
|
1795 |
-
|
1796 |
-
if ( ! $do_company ) {
|
1797 |
-
if ( $do_url )
|
1798 |
-
$author_meta[ self::$thing_url ] = $testimonial_url;
|
1799 |
-
} else {
|
1800 |
-
if ( $do_url )
|
1801 |
-
$org_meta[ self::$thing_url ] = $testimonial_url;
|
1802 |
-
|
1803 |
-
$org_meta[ self::$thing_name ] = $testimonial_company;
|
1804 |
-
}
|
1805 |
-
|
1806 |
-
if ( $do_location ) {
|
1807 |
-
$location_meta[ self::$thing_name ] = $testimonial_location;
|
1808 |
-
|
1809 |
-
if ( ! $do_company )
|
1810 |
-
$author_meta[ self::$person_home ] = array( self::$place_schema, $location_meta );
|
1811 |
-
else
|
1812 |
-
$org_meta[ self::$org_location ] = array( self::$place_schema, $location_meta );
|
1813 |
-
}
|
1814 |
-
|
1815 |
-
if ( ! empty( $author_meta ) && ! empty( $org_meta ) )
|
1816 |
-
$author_meta[ self::$person_member ] = array( self::$org_schema, $org_meta );
|
1817 |
-
elseif ( ! empty( $org_meta ) )
|
1818 |
-
$author_meta[ self::$cw_source_org ] = array( self::$org_schema, $org_meta );
|
1819 |
-
|
1820 |
-
$author_meta = apply_filters( 'testimonials_widget_schema_author', $author_meta, $testimonial, $atts );
|
1821 |
-
$author = self::create_schema_div_prop( self::$cw_author, self::$person_schema, $author_meta );
|
1822 |
-
$schema .= $author;
|
1823 |
-
|
1824 |
-
$post = get_post( $testimonial['post_id'] );
|
1825 |
-
$the_date = mysql2date( 'Y-m-d', $post->post_date );
|
1826 |
-
$the_date_mod = mysql2date( 'Y-m-d', $post->post_modified );
|
1827 |
-
|
1828 |
-
$review_name_length = apply_filters( 'testimonials_widget_review_name_length', 156 );
|
1829 |
-
|
1830 |
-
$review_meta[ self::$cw_date ] = $the_date;
|
1831 |
-
$review_meta[ self::$cw_date_mod ] = $the_date_mod;
|
1832 |
-
$review_meta[ self::$thing_name ] = self::testimonials_truncate( $testimonial_content, $review_name_length );
|
1833 |
-
$review_meta[ self::$thing_url ] = post_permalink( $post->ID );
|
1834 |
-
|
1835 |
-
if ( $do_image ) {
|
1836 |
-
$src = self::get_image_src( $testimonial_image );
|
1837 |
-
|
1838 |
-
$review_meta[ self::$thing_image ] = $src;
|
1839 |
-
}
|
1840 |
-
|
1841 |
-
$review_meta = apply_filters( 'testimonials_widget_schema_review', $review_meta, $testimonial, $atts );
|
1842 |
-
$review = self::create_schema_meta( $review_meta );
|
1843 |
-
$schema .= $review;
|
1844 |
-
|
1845 |
-
$agg_meta[ self::$agg_count ] = self::$found_posts;
|
1846 |
-
|
1847 |
-
$agg_meta = apply_filters( 'testimonials_widget_schema_aggregate', $agg_meta, $testimonial, $atts );
|
1848 |
-
$aggregate = self::create_schema_div_prop( self::$cw_aggregate, self::$agg_schema, $agg_meta );
|
1849 |
-
$schema .= $aggregate;
|
1850 |
-
|
1851 |
-
$item_meta[ self::$thing_name ] = $item_reviewed;
|
1852 |
-
$item_meta[ self::$thing_url ] = $item_reviewed_url;
|
1853 |
-
|
1854 |
-
$item_meta = apply_filters( 'testimonials_widget_schema_item', $item_meta, $testimonial, $atts );
|
1855 |
-
$item = self::create_schema_div_prop( self::$review_item, self::$thing_schema, $item_meta );
|
1856 |
-
$schema .= $item;
|
1857 |
-
|
1858 |
-
$schema = apply_filters( 'testimonials_widget_schema', $schema, $testimonial, $atts );
|
1859 |
-
|
1860 |
-
return $schema;
|
1861 |
-
}
|
1862 |
-
|
1863 |
-
|
1864 |
-
public static function create_schema_meta( $meta_data ) {
|
1865 |
-
$meta = '';
|
1866 |
-
|
1867 |
-
if ( empty( $meta_data ) )
|
1868 |
-
return $meta;
|
1869 |
-
|
1870 |
-
foreach ( $meta_data as $key => $value ) {
|
1871 |
-
if ( is_array( $value ) )
|
1872 |
-
$meta .= self::create_schema_div_prop( $key, $value[ 0 ], $value[ 1 ] );
|
1873 |
-
else
|
1874 |
-
$meta .= sprintf( self::$schema_meta, $key, $value );
|
1875 |
-
}
|
1876 |
-
|
1877 |
-
return $meta;
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
|
1881 |
-
public static function create_schema_span( $property_name, $span_data ) {
|
1882 |
-
$span = '';
|
1883 |
-
|
1884 |
-
if ( empty( $span_data ) )
|
1885 |
-
return $span;
|
1886 |
-
|
1887 |
-
$span = sprintf( self::$schema_span, $property_name, $span_data );
|
1888 |
-
|
1889 |
-
return $span;
|
1890 |
-
}
|
1891 |
-
|
1892 |
-
|
1893 |
-
public static function create_schema_div_prop( $property_name, $schema_name, $meta_data ) {
|
1894 |
-
$meta = '';
|
1895 |
-
$schema = '';
|
1896 |
-
|
1897 |
-
if ( empty( $meta_data ) )
|
1898 |
-
return $schema;
|
1899 |
-
|
1900 |
-
if ( is_array( $meta_data ) ) {
|
1901 |
-
foreach ( $meta_data as $key => $value ) {
|
1902 |
-
if ( is_array( $value ) )
|
1903 |
-
$meta .= self::create_schema_div_prop( $key, $value[ 0 ], $value[ 1 ] );
|
1904 |
-
else
|
1905 |
-
$meta .= sprintf( self::$schema_meta, $key, $value );
|
1906 |
-
}
|
1907 |
|
1908 |
-
|
1909 |
-
|
1910 |
-
$schema = sprintf( self::$schema_div_prop, $property_name, $schema_name, $meta_data );
|
1911 |
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
|
1916 |
-
public static function generate_css( $atts, $widget_number = null ) {
|
1917 |
-
$atts['subtype'] = 'css';
|
1918 |
-
|
1919 |
-
$css = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
1920 |
-
if ( false === $css ) {
|
1921 |
-
$css = self::get_testimonials_html_css( $atts, $widget_number );
|
1922 |
-
$css = apply_filters( 'testimonials_widget_cache_set', $css, $atts );
|
1923 |
-
}
|
1924 |
-
|
1925 |
-
if ( ! empty( $css ) ) {
|
1926 |
-
self::$css = array_merge( $css, self::$css );
|
1927 |
-
add_action( 'wp_footer', array( 'Testimonials_Widget', 'get_testimonials_css' ), 20 );
|
1928 |
-
}
|
1929 |
-
}
|
1930 |
-
|
1931 |
-
|
1932 |
-
public static function generate_js( $testimonials, $atts, $widget_number = null ) {
|
1933 |
-
$atts['subtype'] = 'js';
|
1934 |
-
|
1935 |
-
$js = apply_filters( 'testimonials_widget_cache_get', false, $atts );
|
1936 |
-
if ( false === $js ) {
|
1937 |
-
$js = self::get_testimonials_html_js( $testimonials, $atts, $widget_number );
|
1938 |
-
$js = apply_filters( 'testimonials_widget_cache_set', $js, $atts );
|
1939 |
-
}
|
1940 |
-
|
1941 |
-
if ( ! empty( $js ) ) {
|
1942 |
-
self::$scripts = array_merge( $js, self::$scripts );
|
1943 |
-
add_action( 'wp_footer', array( 'Testimonials_Widget', 'get_testimonials_scripts' ), 20 );
|
1944 |
-
}
|
1945 |
-
}
|
1946 |
-
|
1947 |
-
|
1948 |
-
public static function call_scripts_styles( $testimonials, $atts, $widget_number = null ) {
|
1949 |
-
if ( is_null( $widget_number ) )
|
1950 |
-
$widget_number = Testimonials_Widget::get_instance();
|
1951 |
-
|
1952 |
-
self::scripts( $atts );
|
1953 |
-
self::styles();
|
1954 |
-
|
1955 |
-
self::generate_css( $atts );
|
1956 |
-
self::generate_js( $testimonials, $atts, $widget_number );
|
1957 |
-
}
|
1958 |
-
|
1959 |
-
|
1960 |
-
public static function make_gravatar_featured( $post_id, $email ) {
|
1961 |
-
$size = get_option( 'large_size_w' );
|
1962 |
-
$image = get_avatar( $email, $size );
|
1963 |
-
$src = self::get_image_src( $image );
|
1964 |
-
$file = sanitize_title( $email ) . '.jpeg';
|
1965 |
-
|
1966 |
-
self::add_media( $post_id, $src, $file );
|
1967 |
-
}
|
1968 |
-
|
1969 |
-
|
1970 |
-
public static function notice_2_15_0() {
|
1971 |
-
$text = sprintf( __( 'If your Testimonials display has gone to funky town, please <a href="%s">read the FAQ</a> about possible fixes.', 'testimonials-widget' ), esc_url( 'https://aihrus.zendesk.com/entries/28402246-Major-Change-for-2-15-0' ) );
|
1972 |
-
|
1973 |
-
self::notice_updated( $text );
|
1974 |
-
}
|
1975 |
-
|
1976 |
-
|
1977 |
-
public static function show_shortcodes() {
|
1978 |
-
echo '<div class="wrap">';
|
1979 |
-
echo '<div class="icon32" id="icon-options-general"></div>';
|
1980 |
-
echo '<h2>' . esc_html__( 'Testimonials Shortcode Examples', 'testimonials-widget' ) . '</h2>';
|
1981 |
-
|
1982 |
-
$shortcodes = <<<EOD
|
1983 |
-
<h3>[testimonialswidget_list]</h3>
|
1984 |
-
|
1985 |
-
<ul>
|
1986 |
-
<li><code>[testimonialswidget_list category="category-name"]</code> - Testimonial list by category</li>
|
1987 |
-
<li><code>[testimonialswidget_list category=product hide_not_found=true]</code> - Testimonial list by category and hide "No testimonials found" message</li>
|
1988 |
-
<li><code>[testimonialswidget_list category=product tags=widget limit=5]</code> - Testimonial list by tag, showing 5 at most</li>
|
1989 |
-
<li><code>[testimonialswidget_list char_limit=0 limit=-1]</code> - Show all testimonials on one page</li>
|
1990 |
-
<li><code>[testimonialswidget_list char_limit=0 target=_new limit=3 disable_quotes=true]</code> - Show 3 full-length testimonials, with opening and closing quote marks removed</li>
|
1991 |
-
<li><code>[testimonialswidget_list hide_source=true hide_url=true]</code> - Show testimonial list with source and urls hidden</li>
|
1992 |
-
<li><code>[testimonialswidget_list ids="1,11,111" paging=false]</code> - Show only these 3 testimonials</li>
|
1993 |
-
<li><code>[testimonialswidget_list meta_key=testimonials-widget-company order=asc limit=15]</code> - Show 15 testimonials, in company order</li>
|
1994 |
-
<li><code>[testimonialswidget_list order=ASC orderby=title]</code> - List testimonials by post title</li>
|
1995 |
-
<li><code>[testimonialswidget_list tags="test,fun" random=true exclude="2,22,333"]</code> - Select testimonials tagged with either "test" or "fun", in random order, but ignore those of the excluded ids</li>
|
1996 |
-
</ul>
|
1997 |
|
1998 |
-
|
|
|
1999 |
|
2000 |
-
|
2001 |
-
<li><code>[testimonialswidget_widget category=product order=asc height=300]</code> - Show rotating testimonials, in a fixed height container, of the product category, lowest post ids first</li>
|
2002 |
-
<li><code>[testimonialswidget_widget min_height=250 max_height=500]</code> - Show rotating testimonials in a box no smaller or bigger than 250 to 500 pixels in height</li>
|
2003 |
-
<li><code>[testimonialswidget_widget tags=sometag random=true]</code> - Show rotating, random testimonials having tag "sometag"</li>
|
2004 |
-
</ul>
|
2005 |
-
EOD;
|
2006 |
|
2007 |
-
|
2008 |
-
|
2009 |
-
echo $shortcodes;
|
2010 |
-
echo '</div>';
|
2011 |
-
}
|
2012 |
-
|
2013 |
-
|
2014 |
-
public static function set_not_found( $not_found = false ) {
|
2015 |
-
self::$not_found = $not_found;
|
2016 |
-
}
|
2017 |
|
|
|
|
|
|
|
2018 |
|
2019 |
-
|
2020 |
-
|
2021 |
-
}
|
2022 |
|
|
|
2023 |
|
2024 |
-
|
2025 |
-
$good_version = true;
|
2026 |
|
2027 |
-
return $good_version;
|
2028 |
-
}
|
2029 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2030 |
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
* @SuppressWarnings(PHPMD.Superglobals)
|
2035 |
-
*/
|
2036 |
-
public static function do_load() {
|
2037 |
-
$do_load = false;
|
2038 |
-
if ( ! empty( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'options.php' ) ) ) {
|
2039 |
-
$do_load = true;
|
2040 |
-
} elseif ( ! empty( $_REQUEST['post_type'] ) && self::PT == $_REQUEST['post_type'] ) {
|
2041 |
-
if ( ! empty( $GLOBALS['pagenow'] ) && in_array( $GLOBALS['pagenow'], array( 'edit.php' ) ) ) {
|
2042 |
-
$do_load = true;
|
2043 |
-
} elseif ( ! empty( $_REQUEST['page'] ) && Testimonials_Widget_Settings::ID == $_REQUEST['page'] ) {
|
2044 |
-
$do_load = true;
|
2045 |
-
}
|
2046 |
}
|
2047 |
-
|
2048 |
-
return $do_load;
|
2049 |
}
|
2050 |
}
|
2051 |
|
@@ -2055,40 +96,39 @@ register_deactivation_hook( __FILE__, array( 'Testimonials_Widget', 'deactivatio
|
|
2055 |
register_uninstall_hook( __FILE__, array( 'Testimonials_Widget', 'uninstall' ) );
|
2056 |
|
2057 |
|
2058 |
-
|
|
|
|
|
2059 |
|
|
|
|
|
|
|
2060 |
|
2061 |
-
/**
|
2062 |
-
*
|
2063 |
-
*
|
2064 |
-
* @SuppressWarnings(PHPMD.LongVariable)
|
2065 |
-
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
2066 |
-
*/
|
2067 |
-
function testimonialswidget_init() {
|
2068 |
-
if ( Testimonials_Widget::version_check() ) {
|
2069 |
-
global $Testimonials_Widget_Settings;
|
2070 |
-
if ( is_null( $Testimonials_Widget_Settings ) )
|
2071 |
-
$Testimonials_Widget_Settings = new Testimonials_Widget_Settings();
|
2072 |
|
|
|
|
|
2073 |
global $Testimonials_Widget;
|
2074 |
-
|
2075 |
-
|
2076 |
}
|
2077 |
}
|
2078 |
|
2079 |
|
2080 |
-
|
2081 |
-
|
|
|
2082 |
|
2083 |
-
|
|
|
2084 |
}
|
2085 |
|
2086 |
|
2087 |
-
|
2088 |
-
|
|
|
2089 |
|
2090 |
-
|
|
|
2091 |
}
|
2092 |
|
2093 |
-
|
2094 |
?>
|
3 |
* Plugin Name: Testimonials by Aihrus
|
4 |
* Plugin URI: http://wordpress.org/plugins/testimonials-widget/
|
5 |
* Description: Testimonials by Aihrus lets you randomly slide or list selected portfolios, quotes, reviews, or text with images or videos on your WordPress site.
|
6 |
+
* Version: 2.19.0
|
7 |
* Author: Michael Cannon
|
8 |
* Author URI: http://aihr.us/resume/
|
9 |
* License: GPLv2 or later
|
10 |
+
* Text Domain: testimonials-widget
|
11 |
+
* Domain Path: /languages
|
12 |
*/
|
13 |
|
14 |
|
15 |
/**
|
16 |
+
* Copyright 2014 Michael Cannon (email: mc@aihr.us)
|
17 |
* This program is free software; you can redistribute it and/or modify
|
18 |
* it under the terms of the GNU General Public License, version 2, as
|
19 |
* published by the Free Software Foundation.
|
26 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
*/
|
28 |
|
29 |
+
// Exit if accessed directly
|
30 |
+
if ( ! defined( 'ABSPATH' ) )
|
31 |
+
exit;
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
if ( ! defined( 'TW_AIHR_VERSION' ) )
|
34 |
+
define( 'TW_AIHR_VERSION', '1.1.0' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
if ( ! defined( 'TW_BASE' ) )
|
37 |
+
define( 'TW_BASE', plugin_basename( __FILE__ ) );
|
38 |
|
39 |
+
if ( ! defined( 'TW_DIR' ) )
|
40 |
+
define( 'TW_DIR', plugin_dir_path( __FILE__ ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
+
if ( ! defined( 'TW_DIR_INC' ) )
|
43 |
+
define( 'TW_DIR_INC', TW_DIR . 'includes/' );
|
44 |
|
45 |
+
if ( ! defined( 'TW_DIR_LIB' ) )
|
46 |
+
define( 'TW_DIR_LIB', TW_DIR_INC . 'libraries/' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
if ( ! defined( 'TW_NAME' ) )
|
49 |
+
define( 'TW_NAME', 'Testimonials by Aihrus' );
|
|
|
50 |
|
51 |
+
if ( ! defined( 'TW_PREMIUM_LINK' ) )
|
52 |
+
define( 'TW_PREMIUM_LINK', '<a href="http://aihr.us/downloads/testimonials-widget-premium-wordpress-plugin/">Buy Premium</a>' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
+
if ( ! defined( 'TW_VERSION' ) )
|
55 |
+
define( 'TW_VERSION', '2.19.0' );
|
56 |
|
57 |
+
require_once TW_DIR_INC . 'requirements.php';
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
+
global $tw_activated;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
$tw_activated = true;
|
62 |
+
if ( ! tw_requirements_check() ) {
|
63 |
+
$tw_activated = false;
|
64 |
|
65 |
+
return false;
|
66 |
+
}
|
|
|
67 |
|
68 |
+
require_once TW_DIR_INC . 'class-testimonials-widget.php';
|
69 |
|
70 |
+
add_action( 'plugins_loaded', 'testimonialswidget_init', 99 );
|
|
|
71 |
|
|
|
|
|
72 |
|
73 |
+
/**
|
74 |
+
*
|
75 |
+
*
|
76 |
+
* @SuppressWarnings(PHPMD.LongVariable)
|
77 |
+
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
|
78 |
+
*/
|
79 |
+
if ( ! function_exists( 'testimonialswidget_init' ) ) {
|
80 |
+
function testimonialswidget_init() {
|
81 |
+
if ( Testimonials_Widget::version_check() ) {
|
82 |
+
global $Testimonials_Widget_Settings;
|
83 |
+
if ( is_null( $Testimonials_Widget_Settings ) )
|
84 |
+
$Testimonials_Widget_Settings = new Testimonials_Widget_Settings();
|
85 |
|
86 |
+
global $Testimonials_Widget;
|
87 |
+
if ( is_null( $Testimonials_Widget ) )
|
88 |
+
$Testimonials_Widget = new Testimonials_Widget();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
|
|
|
|
90 |
}
|
91 |
}
|
92 |
|
96 |
register_uninstall_hook( __FILE__, array( 'Testimonials_Widget', 'uninstall' ) );
|
97 |
|
98 |
|
99 |
+
if ( ! function_exists( 'testimonials' ) ) {
|
100 |
+
function testimonials( $atts = array() ) {
|
101 |
+
global $Testimonials_Widget;
|
102 |
|
103 |
+
return $Testimonials_Widget->testimonials( $atts );
|
104 |
+
}
|
105 |
+
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
|
108 |
+
if ( ! function_exists( 'testimonials_slider' ) ) {
|
109 |
+
function testimonials_slider( $atts = array(), $widget_number = null ) {
|
110 |
global $Testimonials_Widget;
|
111 |
+
|
112 |
+
return $Testimonials_Widget->testimonials_slider( $atts, $widget_number );
|
113 |
}
|
114 |
}
|
115 |
|
116 |
|
117 |
+
if ( ! function_exists( 'testimonialswidget_list' ) ) {
|
118 |
+
function testimonialswidget_list( $atts = array() ) {
|
119 |
+
_deprecated_function( __FUNCTION__, '2.19.0', 'testimonials()' );
|
120 |
|
121 |
+
return testimonials( $atts );
|
122 |
+
}
|
123 |
}
|
124 |
|
125 |
|
126 |
+
if ( ! function_exists( 'testimonialswidget_widget' ) ) {
|
127 |
+
function testimonialswidget_widget( $atts = array(), $widget_number = null ) {
|
128 |
+
_deprecated_function( __FUNCTION__, '2.19.0', 'testimonials_slider()' );
|
129 |
|
130 |
+
return testimonials_slider( $atts, $widget_number );
|
131 |
+
}
|
132 |
}
|
133 |
|
|
|
134 |
?>
|