Version Description
- Initial release. Woo!
=
Download this release
Release Info
Developer | woothemes |
Plugin | Testimonials by WooThemes |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- assets/css/admin.css +23 -0
- assets/css/admin.less +37 -0
- assets/images/testimonials-icon.png +0 -0
- assets/images/testimonials-icon@x2.png +0 -0
- classes/class-woothemes-testimonials.php +509 -0
- classes/class-woothemes-widget-testimonials.php +242 -0
- lang/woothemes-testimonials-en_GB.po +308 -0
- lang/woothemes-testimonials-xx_XX.pot +21 -0
- readme.txt +70 -0
- woothemes-testimonials-template.php +196 -0
- woothemes-testimonials.php +21 -0
assets/css/admin.css
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#menu-posts-testimonial .wp-menu-image {
|
2 |
+
background: none;
|
3 |
+
background-image: url(../images/testimonials-icon.png);
|
4 |
+
background-position: 7px -132px !important;
|
5 |
+
background-repeat: no-repeat;
|
6 |
+
}
|
7 |
+
#menu-posts-testimonial.wp-menu-open .wp-menu-image,
|
8 |
+
#menu-posts-testimonial:hover .wp-menu-image {
|
9 |
+
background-position: 7px -164px !important;
|
10 |
+
}
|
11 |
+
#icon-edit.icon32-posts-testimonial {
|
12 |
+
background: transparent url(../images/testimonials-icon.png) no-repeat 0 0;
|
13 |
+
}
|
14 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2) {
|
15 |
+
#menu-posts-testimonial .wp-menu-image {
|
16 |
+
background-image: url(../images/testimonials-icon@x2.png);
|
17 |
+
background-size: 32px 187px;
|
18 |
+
}
|
19 |
+
#icon-edit.icon32-posts-testimonial {
|
20 |
+
background-image: url(../images/testimonials-icon@x2.png);
|
21 |
+
background-size: 32px 187px;
|
22 |
+
}
|
23 |
+
}
|
assets/css/admin.less
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Features icon
|
2 |
+
#menu-posts-testimonial {
|
3 |
+
.wp-menu-image {
|
4 |
+
background: none;
|
5 |
+
background-image: url(../images/testimonials-icon.png);
|
6 |
+
background-position: 7px -132px !important;
|
7 |
+
background-repeat: no-repeat;
|
8 |
+
}
|
9 |
+
}
|
10 |
+
|
11 |
+
#menu-posts-testimonial.wp-menu-open, #menu-posts-testimonial:hover {
|
12 |
+
.wp-menu-image {
|
13 |
+
background-position: 7px -164px !important;
|
14 |
+
}
|
15 |
+
}
|
16 |
+
|
17 |
+
#icon-edit.icon32-posts-testimonial {
|
18 |
+
background: transparent url(../images/testimonials-icon.png) no-repeat 0 0;
|
19 |
+
}
|
20 |
+
|
21 |
+
// Retina
|
22 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 2),
|
23 |
+
only screen and ( min--moz-device-pixel-ratio: 2),
|
24 |
+
only screen and ( -o-min-device-pixel-ratio: 2/1),
|
25 |
+
only screen and ( min-device-pixel-ratio: 2),
|
26 |
+
{
|
27 |
+
#menu-posts-testimonial {
|
28 |
+
.wp-menu-image {
|
29 |
+
background-image: url(../images/testimonials-icon@x2.png);
|
30 |
+
background-size: 32px 187px;
|
31 |
+
}
|
32 |
+
}
|
33 |
+
#icon-edit.icon32-posts-testimonial {
|
34 |
+
background-image: url(../images/testimonials-icon@x2.png);
|
35 |
+
background-size: 32px 187px;
|
36 |
+
}
|
37 |
+
}
|
assets/images/testimonials-icon.png
ADDED
Binary file
|
assets/images/testimonials-icon@x2.png
ADDED
Binary file
|
classes/class-woothemes-testimonials.php
ADDED
@@ -0,0 +1,509 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
|
3 |
+
|
4 |
+
/**
|
5 |
+
* WooThemes Testimonials Class
|
6 |
+
*
|
7 |
+
* All functionality pertaining to the Testimonials feature.
|
8 |
+
*
|
9 |
+
* @package WordPress
|
10 |
+
* @subpackage WooThemes_Testimonials
|
11 |
+
* @category Plugin
|
12 |
+
* @author Matty
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
class Woothemes_Testimonials {
|
16 |
+
private $dir;
|
17 |
+
private $assets_dir;
|
18 |
+
private $assets_url;
|
19 |
+
private $token;
|
20 |
+
public $version;
|
21 |
+
private $file;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Constructor function.
|
25 |
+
*
|
26 |
+
* @access public
|
27 |
+
* @since 1.0.0
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
+
public function __construct( $file ) {
|
31 |
+
$this->dir = dirname( $file );
|
32 |
+
$this->file = $file;
|
33 |
+
$this->assets_dir = trailingslashit( $this->dir ) . 'assets';
|
34 |
+
$this->assets_url = esc_url( str_replace( WP_PLUGIN_DIR, WP_PLUGIN_URL, $this->assets_dir ) );
|
35 |
+
$this->token = 'testimonial';
|
36 |
+
|
37 |
+
$this->load_plugin_textdomain();
|
38 |
+
add_action( 'init', array( &$this, 'load_localisation' ), 0 );
|
39 |
+
|
40 |
+
// Run this on activation.
|
41 |
+
register_activation_hook( $this->file, array( &$this, 'activation' ) );
|
42 |
+
|
43 |
+
add_action( 'init', array( &$this, 'register_post_type' ) );
|
44 |
+
|
45 |
+
if ( is_admin() ) {
|
46 |
+
global $pagenow;
|
47 |
+
|
48 |
+
add_action( 'admin_menu', array( &$this, 'meta_box_setup' ), 20 );
|
49 |
+
add_action( 'save_post', array( &$this, 'meta_box_save' ) );
|
50 |
+
add_filter( 'enter_title_here', array( &$this, 'enter_title_here' ) );
|
51 |
+
add_action( 'admin_print_styles', array( &$this, 'enqueue_admin_styles' ), 10 );
|
52 |
+
add_filter( 'post_updated_messages', array( &$this, 'updated_messages' ) );
|
53 |
+
|
54 |
+
if ( $pagenow == 'edit.php' && isset( $_GET['post_type'] ) && esc_attr( $_GET['post_type'] ) == $this->token ) {
|
55 |
+
add_filter( 'manage_edit-' . $this->token . '_columns', array( &$this, 'register_custom_column_headings' ), 10, 1 );
|
56 |
+
add_action( 'manage_posts_custom_column', array( &$this, 'register_custom_columns' ), 10, 2 );
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
add_action( 'after_setup_theme', array( &$this, 'ensure_post_thumbnails_support' ) );
|
61 |
+
} // End __construct()
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Register the post type.
|
65 |
+
*
|
66 |
+
* @access public
|
67 |
+
* @param string $token
|
68 |
+
* @param string 'Testimonial'
|
69 |
+
* @param string 'Testimonials'
|
70 |
+
* @param array $supports
|
71 |
+
* @return void
|
72 |
+
*/
|
73 |
+
public function register_post_type () {
|
74 |
+
$labels = array(
|
75 |
+
'name' => _x( 'Testimonials', 'post type general name', 'woothemes-testimonials' ),
|
76 |
+
'singular_name' => _x( 'Testimonial', 'post type singular name', 'woothemes-testimonials' ),
|
77 |
+
'add_new' => _x( 'Add New', 'testimonial', 'woothemes-testimonials' ),
|
78 |
+
'add_new_item' => sprintf( __( 'Add New %s', 'woothemes-testimonials' ), __( 'Testimonial', 'woothemes-testimonials' ) ),
|
79 |
+
'edit_item' => sprintf( __( 'Edit %s', 'woothemes-testimonials' ), __( 'Testimonial', 'woothemes-testimonials' ) ),
|
80 |
+
'new_item' => sprintf( __( 'New %s', 'woothemes-testimonials' ), __( 'Testimonial', 'woothemes-testimonials' ) ),
|
81 |
+
'all_items' => sprintf( __( 'All %s', 'woothemes-testimonials' ), __( 'Testimonials', 'woothemes-testimonials' ) ),
|
82 |
+
'view_item' => sprintf( __( 'View %s', 'woothemes-testimonials' ), __( 'Testimonial', 'woothemes-testimonials' ) ),
|
83 |
+
'search_items' => sprintf( __( 'Search %a', 'woothemes-testimonials' ), __( 'Testimonials', 'woothemes-testimonials' ) ),
|
84 |
+
'not_found' => sprintf( __( 'No %s Found', 'woothemes-testimonials' ), __( 'Testimonials', 'woothemes-testimonials' ) ),
|
85 |
+
'not_found_in_trash' => sprintf( __( 'No %s Found In Trash', 'woothemes-testimonials' ), __( 'Testimonials', 'woothemes-testimonials' ) ),
|
86 |
+
'parent_item_colon' => '',
|
87 |
+
'menu_name' => __( 'Testimonials', 'woothemes-testimonials' )
|
88 |
+
|
89 |
+
);
|
90 |
+
$args = array(
|
91 |
+
'labels' => $labels,
|
92 |
+
'public' => true,
|
93 |
+
'publicly_queryable' => true,
|
94 |
+
'show_ui' => true,
|
95 |
+
'show_in_menu' => true,
|
96 |
+
'query_var' => true,
|
97 |
+
'rewrite' => array( 'slug' => 'testimonial' ),
|
98 |
+
'capability_type' => 'post',
|
99 |
+
'has_archive' => array( 'slug' => 'testimonials' ),
|
100 |
+
'hierarchical' => false,
|
101 |
+
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
|
102 |
+
'menu_position' => 5,
|
103 |
+
'menu_icon' => ''
|
104 |
+
);
|
105 |
+
register_post_type( $this->token, $args );
|
106 |
+
} // End register_post_type()
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Add custom columns for the "manage" screen of this post type.
|
110 |
+
*
|
111 |
+
* @access public
|
112 |
+
* @param string $column_name
|
113 |
+
* @param int $id
|
114 |
+
* @since 1.0.0
|
115 |
+
* @return void
|
116 |
+
*/
|
117 |
+
public function register_custom_columns ( $column_name, $id ) {
|
118 |
+
global $wpdb, $post;
|
119 |
+
|
120 |
+
$meta = get_post_custom( $id );
|
121 |
+
|
122 |
+
switch ( $column_name ) {
|
123 |
+
|
124 |
+
case 'image':
|
125 |
+
$value = '';
|
126 |
+
|
127 |
+
$value = $this->get_image( $id, 40 );
|
128 |
+
|
129 |
+
echo $value;
|
130 |
+
break;
|
131 |
+
|
132 |
+
default:
|
133 |
+
break;
|
134 |
+
|
135 |
+
}
|
136 |
+
} // End register_custom_columns()
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Add custom column headings for the "manage" screen of this post type.
|
140 |
+
*
|
141 |
+
* @access public
|
142 |
+
* @param array $defaults
|
143 |
+
* @since 1.0.0
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
+
public function register_custom_column_headings ( $defaults ) {
|
147 |
+
$new_columns = array( 'image' => __( 'Image', 'woothemes-testimonials' ) );
|
148 |
+
|
149 |
+
$last_item = '';
|
150 |
+
|
151 |
+
if ( isset( $defaults['date'] ) ) { unset( $defaults['date'] ); }
|
152 |
+
|
153 |
+
if ( count( $defaults ) > 2 ) {
|
154 |
+
$last_item = array_slice( $defaults, -1 );
|
155 |
+
|
156 |
+
array_pop( $defaults );
|
157 |
+
}
|
158 |
+
$defaults = array_merge( $defaults, $new_columns );
|
159 |
+
|
160 |
+
if ( $last_item != '' ) {
|
161 |
+
foreach ( $last_item as $k => $v ) {
|
162 |
+
$defaults[$k] = $v;
|
163 |
+
break;
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
return $defaults;
|
168 |
+
} // End register_custom_column_headings()
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Update messages for the post type admin.
|
172 |
+
* @since 1.0.0
|
173 |
+
* @param array $messages Array of messages for all post types.
|
174 |
+
* @return array Modified array.
|
175 |
+
*/
|
176 |
+
public function updated_messages ( $messages ) {
|
177 |
+
global $post, $post_ID;
|
178 |
+
|
179 |
+
$messages[$this->token] = array(
|
180 |
+
0 => '', // Unused. Messages start at index 1.
|
181 |
+
1 => sprintf( __( 'Testimonial updated. %sView testimonial%s', 'woothemes-testimonials' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ),
|
182 |
+
2 => __( 'Custom field updated.', 'woothemes-testimonials' ),
|
183 |
+
3 => __( 'Custom field deleted.', 'woothemes-testimonials' ),
|
184 |
+
4 => __( 'Testimonial updated.', 'woothemes-testimonials' ),
|
185 |
+
/* translators: %s: date and time of the revision */
|
186 |
+
5 => isset($_GET['revision']) ? sprintf( __( 'Testimonial restored to revision from %s', 'woothemes-testimonials' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
|
187 |
+
6 => sprintf( __( 'Testimonial published. %sView testimonial%s', 'woothemes-testimonials' ), '<a href="' . esc_url( get_permalink( $post_ID ) ) . '">', '</a>' ),
|
188 |
+
7 => __('Testimonial saved.'),
|
189 |
+
8 => sprintf( __( 'Testimonial submitted. %sPreview testimonial%s', 'woothemes-testimonials' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ),
|
190 |
+
9 => sprintf( __( 'Testimonial scheduled for: %1$s. %2$sPreview testimonial%3$s', 'woothemes-testimonials' ),
|
191 |
+
// translators: Publish box date format, see http://php.net/date
|
192 |
+
'<strong>' . date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) . '</strong>', '<a target="_blank" href="' . esc_url( get_permalink($post_ID) ) . '">', '</a>' ),
|
193 |
+
10 => sprintf( __( 'Testimonial draft updated. %sPreview testimonial%s', 'woothemes-testimonials' ), '<a target="_blank" href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) . '">', '</a>' ),
|
194 |
+
);
|
195 |
+
|
196 |
+
return $messages;
|
197 |
+
} // End updated_messages()
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Setup the meta box.
|
201 |
+
*
|
202 |
+
* @access public
|
203 |
+
* @since 1.0.0
|
204 |
+
* @return void
|
205 |
+
*/
|
206 |
+
public function meta_box_setup () {
|
207 |
+
add_meta_box( 'testimonial-data', __( 'Testimonial Details', 'woothemes-testimonials' ), array( &$this, 'meta_box_content' ), $this->token, 'normal', 'high' );
|
208 |
+
} // End meta_box_setup()
|
209 |
+
|
210 |
+
/**
|
211 |
+
* The contents of our meta box.
|
212 |
+
*
|
213 |
+
* @access public
|
214 |
+
* @since 1.0.0
|
215 |
+
* @return void
|
216 |
+
*/
|
217 |
+
public function meta_box_content () {
|
218 |
+
global $post_id;
|
219 |
+
$fields = get_post_custom( $post_id );
|
220 |
+
$field_data = $this->get_custom_fields_settings();
|
221 |
+
|
222 |
+
$html = '';
|
223 |
+
|
224 |
+
$html .= '<input type="hidden" name="woo_' . $this->token . '_noonce" id="woo_' . $this->token . '_noonce" value="' . wp_create_nonce( plugin_basename( $this->dir ) ) . '" />';
|
225 |
+
|
226 |
+
if ( 0 < count( $field_data ) ) {
|
227 |
+
$html .= '<table class="form-table">' . "\n";
|
228 |
+
$html .= '<tbody>' . "\n";
|
229 |
+
|
230 |
+
foreach ( $field_data as $k => $v ) {
|
231 |
+
$data = $v['default'];
|
232 |
+
if ( isset( $fields['_' . $k] ) && isset( $fields['_' . $k][0] ) ) {
|
233 |
+
$data = $fields['_' . $k][0];
|
234 |
+
}
|
235 |
+
|
236 |
+
$html .= '<tr valign="top"><th scope="row"><label for="' . esc_attr( $k ) . '">' . $v['name'] . '</label></th><td><input name="' . esc_attr( $k ) . '" type="text" id="' . esc_attr( $k ) . '" class="regular-text" value="' . esc_attr( $data ) . '" />' . "\n";
|
237 |
+
$html .= '<p class="description">' . $v['description'] . '</p>' . "\n";
|
238 |
+
$html .= '</td><tr/>' . "\n";
|
239 |
+
}
|
240 |
+
|
241 |
+
$html .= '</tbody>' . "\n";
|
242 |
+
$html .= '</table>' . "\n";
|
243 |
+
}
|
244 |
+
|
245 |
+
echo $html;
|
246 |
+
} // End meta_box_content()
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Save meta box fields.
|
250 |
+
*
|
251 |
+
* @access public
|
252 |
+
* @since 1.0.0
|
253 |
+
* @param int $post_id
|
254 |
+
* @return void
|
255 |
+
*/
|
256 |
+
public function meta_box_save ( $post_id ) {
|
257 |
+
global $post, $messages;
|
258 |
+
|
259 |
+
// Verify
|
260 |
+
if ( ( get_post_type() != $this->token ) || ! wp_verify_nonce( $_POST['woo_' . $this->token . '_noonce'], plugin_basename( $this->dir ) ) ) {
|
261 |
+
return $post_id;
|
262 |
+
}
|
263 |
+
|
264 |
+
if ( 'page' == $_POST['post_type'] ) {
|
265 |
+
if ( ! current_user_can( 'edit_page', $post_id ) ) {
|
266 |
+
return $post_id;
|
267 |
+
}
|
268 |
+
} else {
|
269 |
+
if ( ! current_user_can( 'edit_post', $post_id ) ) {
|
270 |
+
return $post_id;
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
$field_data = $this->get_custom_fields_settings();
|
275 |
+
$fields = array_keys( $field_data );
|
276 |
+
|
277 |
+
foreach ( $fields as $f ) {
|
278 |
+
|
279 |
+
${$f} = strip_tags(trim($_POST[$f]));
|
280 |
+
|
281 |
+
// Escape the URLs.
|
282 |
+
if ( 'url' == $field_data[$f]['type'] ) {
|
283 |
+
${$f} = esc_url( ${$f} );
|
284 |
+
}
|
285 |
+
|
286 |
+
if ( get_post_meta( $post_id, '_' . $f ) == '' ) {
|
287 |
+
add_post_meta( $post_id, '_' . $f, ${$f}, true );
|
288 |
+
} elseif( ${$f} != get_post_meta( $post_id, '_' . $f, true ) ) {
|
289 |
+
update_post_meta( $post_id, '_' . $f, ${$f} );
|
290 |
+
} elseif ( ${$f} == '' ) {
|
291 |
+
delete_post_meta( $post_id, '_' . $f, get_post_meta( $post_id, '_' . $f, true ) );
|
292 |
+
}
|
293 |
+
}
|
294 |
+
} // End meta_box_save()
|
295 |
+
|
296 |
+
/**
|
297 |
+
* Customise the "Enter title here" text.
|
298 |
+
*
|
299 |
+
* @access public
|
300 |
+
* @since 1.0.0
|
301 |
+
* @param string $title
|
302 |
+
* @return void
|
303 |
+
*/
|
304 |
+
public function enter_title_here ( $title ) {
|
305 |
+
if ( get_post_type() == $this->token ) {
|
306 |
+
$title = __( 'Enter the customer\'s name here', 'woothemes-testimonials' );
|
307 |
+
}
|
308 |
+
return $title;
|
309 |
+
} // End enter_title_here()
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Enqueue post type admin CSS.
|
313 |
+
*
|
314 |
+
* @access public
|
315 |
+
* @since 1.0.0
|
316 |
+
* @return void
|
317 |
+
*/
|
318 |
+
public function enqueue_admin_styles () {
|
319 |
+
wp_register_style( 'woothemes-testimonials-admin', $this->assets_url . '/css/admin.css', array(), '1.0.1' );
|
320 |
+
wp_enqueue_style( 'woothemes-testimonials-admin' );
|
321 |
+
} // End enqueue_admin_styles()
|
322 |
+
|
323 |
+
/**
|
324 |
+
* Get the settings for the custom fields.
|
325 |
+
* @since 1.0.0
|
326 |
+
* @return array
|
327 |
+
*/
|
328 |
+
public function get_custom_fields_settings () {
|
329 |
+
$fields = array();
|
330 |
+
|
331 |
+
$fields['gravatar_email'] = array(
|
332 |
+
'name' => __( 'Gravatar E-mail Address', 'woothemes-testimonials' ),
|
333 |
+
'description' => sprintf( __( 'Enter in an e-mail address, to use a %sGravatar%s, instead of using the "Featured Image".', 'woothemes-testimonials' ), '<a href="' . esc_url( 'http://gravatar.com/' ) . '" target="_blank">', '</a>' ),
|
334 |
+
'type' => 'text',
|
335 |
+
'default' => '',
|
336 |
+
'section' => 'info'
|
337 |
+
);
|
338 |
+
|
339 |
+
$fields['byline'] = array(
|
340 |
+
'name' => __( 'Byline', 'woothemes-testimonials' ),
|
341 |
+
'description' => __( 'Enter a byline for the customer giving this testimonial (for example: "CEO of WooThemes").', 'woothemes-testimonials' ),
|
342 |
+
'type' => 'text',
|
343 |
+
'default' => '',
|
344 |
+
'section' => 'info'
|
345 |
+
);
|
346 |
+
|
347 |
+
$fields['url'] = array(
|
348 |
+
'name' => __( 'URL', 'woothemes-testimonials' ),
|
349 |
+
'description' => __( 'Enter a URL that applies to this customer (for example: http://woothemes.com/).', 'woothemes-testimonials' ),
|
350 |
+
'type' => 'url',
|
351 |
+
'default' => '',
|
352 |
+
'section' => 'info'
|
353 |
+
);
|
354 |
+
|
355 |
+
return $fields;
|
356 |
+
} // End get_custom_fields_settings()
|
357 |
+
|
358 |
+
/**
|
359 |
+
* Get the image for the given ID. If no featured image, check for Gravatar e-mail.
|
360 |
+
* @param int $id Post ID.
|
361 |
+
* @param string/array/int $size Image dimension.
|
362 |
+
* @since 1.0.0
|
363 |
+
* @return string <img> tag.
|
364 |
+
*/
|
365 |
+
protected function get_image ( $id, $size ) {
|
366 |
+
$response = '';
|
367 |
+
|
368 |
+
if ( has_post_thumbnail( $id ) ) {
|
369 |
+
// If not a string or an array, and not an integer, default to 50x50.
|
370 |
+
if ( is_int( $size ) || ( 0 < intval( $size ) ) ) {
|
371 |
+
$size = array( intval( $size ), intval( $size ) );
|
372 |
+
} elseif ( ! is_string( $size ) && ! is_array( $size ) ) {
|
373 |
+
$size = array( 50, 50 );
|
374 |
+
}
|
375 |
+
$response = get_the_post_thumbnail( intval( $id ), $size );
|
376 |
+
} else {
|
377 |
+
$gravatar_email = get_post_meta( $id, '_gravatar_email', true );
|
378 |
+
if ( '' != $gravatar_email && is_email( $gravatar_email ) ) {
|
379 |
+
$response = get_avatar( $gravatar_email, $size );
|
380 |
+
}
|
381 |
+
}
|
382 |
+
|
383 |
+
return $response;
|
384 |
+
} // End get_image()
|
385 |
+
|
386 |
+
/**
|
387 |
+
* Get testimonials.
|
388 |
+
* @param string/array $args Arguments to be passed to the query.
|
389 |
+
* @since 1.0.0
|
390 |
+
* @return array/boolean Array if true, boolean if false.
|
391 |
+
*/
|
392 |
+
public function get_testimonials ( $args = '' ) {
|
393 |
+
$defaults = array(
|
394 |
+
'limit' => 5,
|
395 |
+
'orderby' => 'menu_order',
|
396 |
+
'order' => 'DESC',
|
397 |
+
'id' => 0
|
398 |
+
);
|
399 |
+
|
400 |
+
$args = wp_parse_args( $args, $defaults );
|
401 |
+
|
402 |
+
// Allow child themes/plugins to filter here.
|
403 |
+
$args = apply_filters( 'woothemes_get_testimonials_args', $args );
|
404 |
+
|
405 |
+
// The Query Arguments.
|
406 |
+
$query_args = array();
|
407 |
+
$query_args['post_type'] = 'testimonial';
|
408 |
+
$query_args['numberposts'] = $args['limit'];
|
409 |
+
$query_args['orderby'] = $args['orderby'];
|
410 |
+
$query_args['order'] = $args['order'];
|
411 |
+
|
412 |
+
if ( is_numeric( $args['id'] ) && ( intval( $args['id'] ) > 0 ) ) {
|
413 |
+
$query_args['p'] = intval( $args['id'] );
|
414 |
+
}
|
415 |
+
|
416 |
+
// Whitelist checks.
|
417 |
+
if ( ! in_array( $query_args['orderby'], array( 'none', 'ID', 'author', 'title', 'date', 'modified', 'parent', 'rand', 'comment_count', 'menu_order', 'meta_value', 'meta_value_num' ) ) ) {
|
418 |
+
$query_args['orderby'] = 'date';
|
419 |
+
}
|
420 |
+
|
421 |
+
if ( ! in_array( $query_args['order'], array( 'ASC', 'DESC' ) ) ) {
|
422 |
+
$query_args['order'] = 'DESC';
|
423 |
+
}
|
424 |
+
|
425 |
+
if ( ! in_array( $query_args['post_type'], get_post_types() ) ) {
|
426 |
+
$query_args['post_type'] = 'testimonial';
|
427 |
+
}
|
428 |
+
|
429 |
+
// The Query.
|
430 |
+
$query = get_posts( $query_args );
|
431 |
+
|
432 |
+
// The Display.
|
433 |
+
if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
|
434 |
+
foreach ( $query as $k => $v ) {
|
435 |
+
$meta = get_post_custom( $v->ID );
|
436 |
+
|
437 |
+
// Get the image.
|
438 |
+
$query[$k]->image = $this->get_image( $v->ID, $args['size'] );
|
439 |
+
|
440 |
+
foreach ( (array)$this->get_custom_fields_settings() as $i => $j ) {
|
441 |
+
if ( isset( $meta['_' . $i] ) && ( '' != $meta['_' . $i][0] ) ) {
|
442 |
+
$query[$k]->$i = $meta['_' . $i][0];
|
443 |
+
} else {
|
444 |
+
$query[$k]->$i = $j['default'];
|
445 |
+
}
|
446 |
+
}
|
447 |
+
}
|
448 |
+
} else {
|
449 |
+
$query = false;
|
450 |
+
}
|
451 |
+
|
452 |
+
return $query;
|
453 |
+
} // End get_testimonials()
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Load the plugin's localisation file.
|
457 |
+
* @access public
|
458 |
+
* @since 1.0.0
|
459 |
+
* @return void
|
460 |
+
*/
|
461 |
+
public function load_localisation () {
|
462 |
+
load_plugin_textdomain( 'woothemes-testimonials', false, dirname( plugin_basename( $this->file ) ) . '/lang/' );
|
463 |
+
} // End load_localisation()
|
464 |
+
|
465 |
+
/**
|
466 |
+
* Load the plugin textdomain from the main WordPress "languages" folder.
|
467 |
+
* @since 1.0.0
|
468 |
+
* @return void
|
469 |
+
*/
|
470 |
+
public function load_plugin_textdomain () {
|
471 |
+
$domain = 'woothemes-testimonials';
|
472 |
+
// The "plugin_locale" filter is also used in load_plugin_textdomain()
|
473 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
474 |
+
|
475 |
+
load_textdomain( $domain, WP_LANG_DIR . '/' . $domain . '/' . $domain . '-' . $locale . '.mo' );
|
476 |
+
load_plugin_textdomain( $domain, FALSE, dirname( plugin_basename( $this->file ) ) . '/lang/' );
|
477 |
+
} // End load_plugin_textdomain()
|
478 |
+
|
479 |
+
/**
|
480 |
+
* Run on activation.
|
481 |
+
* @access public
|
482 |
+
* @since 1.0.0
|
483 |
+
* @return void
|
484 |
+
*/
|
485 |
+
public function activation () {
|
486 |
+
$this->register_plugin_version();
|
487 |
+
} // End activation()
|
488 |
+
|
489 |
+
/**
|
490 |
+
* Register the plugin's version.
|
491 |
+
* @access public
|
492 |
+
* @since 1.0.0
|
493 |
+
* @return void
|
494 |
+
*/
|
495 |
+
private function register_plugin_version () {
|
496 |
+
if ( $this->version != '' ) {
|
497 |
+
update_option( 'woothemes-testimonials' . '-version', $this->version );
|
498 |
+
}
|
499 |
+
} // End register_plugin_version()
|
500 |
+
|
501 |
+
/**
|
502 |
+
* Ensure that "post-thumbnails" support is available for those themes that don't register it.
|
503 |
+
* @since 1.0.1
|
504 |
+
* @return void
|
505 |
+
*/
|
506 |
+
public function ensure_post_thumbnails_support () {
|
507 |
+
if ( ! current_theme_supports( 'post-thumbnails' ) ) { add_theme_support( 'post-thumbnails' ); }
|
508 |
+
} // End ensure_post_thumbnails_support()
|
509 |
+
} // End Class
|
classes/class-woothemes-widget-testimonials.php
ADDED
@@ -0,0 +1,242 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) || ! function_exists( 'woothemes_testimonials' ) ) exit; // Exit if accessed directly.
|
3 |
+
|
4 |
+
/**
|
5 |
+
* WooThemes Testimonials Widget
|
6 |
+
*
|
7 |
+
* A WooThemes standardized testimonials widget.
|
8 |
+
*
|
9 |
+
* @package WordPress
|
10 |
+
* @subpackage WooThemes_Testimonials
|
11 |
+
* @category Widgets
|
12 |
+
* @author WooThemes
|
13 |
+
* @since 1.0.0
|
14 |
+
*
|
15 |
+
* TABLE OF CONTENTS
|
16 |
+
*
|
17 |
+
* protected $woothemes_widget_cssclass
|
18 |
+
* protected $woothemes_widget_description
|
19 |
+
* protected $woothemes_widget_idbase
|
20 |
+
* protected $woothemes_widget_title
|
21 |
+
*
|
22 |
+
* - __construct()
|
23 |
+
* - widget()
|
24 |
+
* - update()
|
25 |
+
* - form()
|
26 |
+
* - get_orderby_options()
|
27 |
+
*/
|
28 |
+
class Woothemes_Widget_Testmonials extends WP_Widget {
|
29 |
+
protected $woothemes_widget_cssclass;
|
30 |
+
protected $woothemes_widget_description;
|
31 |
+
protected $woothemes_widget_idbase;
|
32 |
+
protected $woothemes_widget_title;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Constructor function.
|
36 |
+
* @since 1.0.0
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
/* Widget variable settings. */
|
41 |
+
$this->woothemes_widget_cssclass = 'widget_woothemes_testimonials';
|
42 |
+
$this->woothemes_widget_description = __( 'Recent testimonials on your site.', 'woothemes-testimonials' );
|
43 |
+
$this->woothemes_widget_idbase = 'woothemes_testimonials';
|
44 |
+
$this->woothemes_widget_title = __( 'Testimonials', 'woothemes-testimonials' );
|
45 |
+
|
46 |
+
/* Widget settings. */
|
47 |
+
$widget_ops = array( 'classname' => $this->woothemes_widget_cssclass, 'description' => $this->woothemes_widget_description );
|
48 |
+
|
49 |
+
/* Widget control settings. */
|
50 |
+
$control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => $this->woothemes_widget_idbase );
|
51 |
+
|
52 |
+
/* Create the widget. */
|
53 |
+
$this->WP_Widget( $this->woothemes_widget_idbase, $this->woothemes_widget_title, $widget_ops, $control_ops );
|
54 |
+
} // End __construct()
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Display the widget on the frontend.
|
58 |
+
* @since 1.0.0
|
59 |
+
* @param array $args Widget arguments.
|
60 |
+
* @param array $instance Widget settings for this instance.
|
61 |
+
* @return void
|
62 |
+
*/
|
63 |
+
public function widget( $args, $instance ) {
|
64 |
+
extract( $args, EXTR_SKIP );
|
65 |
+
|
66 |
+
/* Our variables from the widget settings. */
|
67 |
+
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base );
|
68 |
+
|
69 |
+
/* Before widget (defined by themes). */
|
70 |
+
// echo $before_widget;
|
71 |
+
|
72 |
+
$args = array();
|
73 |
+
|
74 |
+
/* Display the widget title if one was input (before and after defined by themes). */
|
75 |
+
if ( $title ) { $args['title'] = $title; }
|
76 |
+
|
77 |
+
/* Widget content. */
|
78 |
+
// Add actions for plugins/themes to hook onto.
|
79 |
+
do_action( $this->woothemes_widget_cssclass . '_top' );
|
80 |
+
|
81 |
+
// Integer values.
|
82 |
+
if ( isset( $instance['limit'] ) && ( 0 < count( $instance['limit'] ) ) ) { $args['limit'] = intval( $instance['limit'] ); }
|
83 |
+
if ( isset( $instance['specific_id'] ) && ( 0 < count( $instance['specific_id'] ) ) ) { $args['id'] = intval( $instance['specific_id'] ); }
|
84 |
+
if ( isset( $instance['size'] ) && ( 0 < count( $instance['size'] ) ) ) { $args['size'] = intval( $instance['size'] ); }
|
85 |
+
|
86 |
+
// Boolean values.
|
87 |
+
if ( isset( $instance['display_author'] ) && ( 1 == $instance['display_author'] ) ) { $args['display_author'] = true; } else { $args['display_author'] = false; }
|
88 |
+
if ( isset( $instance['display_url'] ) && ( 1 == $instance['display_url'] ) ) { $args['display_url'] = true; } else { $args['display_url'] = false; }
|
89 |
+
|
90 |
+
// Select boxes.
|
91 |
+
if ( isset( $instance['orderby'] ) && in_array( $instance['orderby'], array_keys( $this->get_orderby_options() ) ) ) { $args['orderby'] = $instance['orderby']; }
|
92 |
+
if ( isset( $instance['order'] ) && in_array( $instance['order'], array_keys( $this->get_order_options() ) ) ) { $args['order'] = $instance['order']; }
|
93 |
+
|
94 |
+
// Display the testimonials.
|
95 |
+
woothemes_testimonials( $args );
|
96 |
+
|
97 |
+
// Add actions for plugins/themes to hook onto.
|
98 |
+
do_action( $this->woothemes_widget_cssclass . '_bottom' );
|
99 |
+
|
100 |
+
/* After widget (defined by themes). */
|
101 |
+
// echo $after_widget;
|
102 |
+
|
103 |
+
} // End widget()
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Method to update the settings from the form() method.
|
107 |
+
* @since 1.0.0
|
108 |
+
* @param array $new_instance New settings.
|
109 |
+
* @param array $old_instance Previous settings.
|
110 |
+
* @return array Updated settings.
|
111 |
+
*/
|
112 |
+
public function update ( $new_instance, $old_instance ) {
|
113 |
+
$instance = $old_instance;
|
114 |
+
|
115 |
+
/* Strip tags for title and name to remove HTML (important for text inputs). */
|
116 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
117 |
+
|
118 |
+
/* Make sure the integer values are definitely integers. */
|
119 |
+
$instance['limit'] = intval( $new_instance['limit'] );
|
120 |
+
$instance['specific_id'] = intval( $new_instance['specific_id'] );
|
121 |
+
$instance['size'] = intval( $new_instance['size'] );
|
122 |
+
|
123 |
+
/* The select box is returning a text value, so we escape it. */
|
124 |
+
$instance['orderby'] = esc_attr( $new_instance['orderby'] );
|
125 |
+
$instance['order'] = esc_attr( $new_instance['order'] );
|
126 |
+
|
127 |
+
/* The checkbox is returning a Boolean (true/false), so we check for that. */
|
128 |
+
$instance['display_author'] = (bool) esc_attr( $new_instance['display_author'] );
|
129 |
+
$instance['display_url'] = (bool) esc_attr( $new_instance['display_url'] );
|
130 |
+
|
131 |
+
return $instance;
|
132 |
+
} // End update()
|
133 |
+
|
134 |
+
/**
|
135 |
+
* The form on the widget control in the widget administration area.
|
136 |
+
* Make use of the get_field_id() and get_field_name() function when creating your form elements. This handles the confusing stuff.
|
137 |
+
* @since 1.0.0
|
138 |
+
* @param array $instance The settings for this instance.
|
139 |
+
* @return void
|
140 |
+
*/
|
141 |
+
public function form( $instance ) {
|
142 |
+
|
143 |
+
/* Set up some default widget settings. */
|
144 |
+
/* Make sure all keys are added here, even with empty string values. */
|
145 |
+
$defaults = array(
|
146 |
+
'title' => '',
|
147 |
+
'limit' => 5,
|
148 |
+
'orderby' => 'menu_order',
|
149 |
+
'order' => 'DESC',
|
150 |
+
'specific_id' => '',
|
151 |
+
'display_author' => true,
|
152 |
+
'display_url' => true,
|
153 |
+
'effect' => 'fade', // Options: 'fade', 'none'
|
154 |
+
'pagination' => false,
|
155 |
+
'size' => 50
|
156 |
+
);
|
157 |
+
|
158 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
159 |
+
?>
|
160 |
+
<!-- Widget Title: Text Input -->
|
161 |
+
<p>
|
162 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title (optional):', 'woothemes-testimonials' ); ?></label>
|
163 |
+
<input type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" />
|
164 |
+
</p>
|
165 |
+
<!-- Widget Limit: Text Input -->
|
166 |
+
<p>
|
167 |
+
<label for="<?php echo $this->get_field_id( 'limit' ); ?>"><?php _e( 'Limit:', 'woothemes-testimonials' ); ?></label>
|
168 |
+
<input type="text" name="<?php echo $this->get_field_name( 'limit' ); ?>" value="<?php echo $instance['limit']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'limit' ); ?>" />
|
169 |
+
</p>
|
170 |
+
<!-- Widget Image Size: Text Input -->
|
171 |
+
<p>
|
172 |
+
<label for="<?php echo $this->get_field_id( 'size' ); ?>"><?php _e( 'Image Size (in pixels):', 'woothemes-testimonials' ); ?></label>
|
173 |
+
<input type="text" name="<?php echo $this->get_field_name( 'size' ); ?>" value="<?php echo $instance['size']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'size' ); ?>" />
|
174 |
+
</p>
|
175 |
+
<!-- Widget Order By: Select Input -->
|
176 |
+
<p>
|
177 |
+
<label for="<?php echo $this->get_field_id( 'orderby' ); ?>"><?php _e( 'Order By:', 'woothemes-testimonials' ); ?></label>
|
178 |
+
<select name="<?php echo $this->get_field_name( 'orderby' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>">
|
179 |
+
<?php foreach ( $this->get_orderby_options() as $k => $v ) { ?>
|
180 |
+
<option value="<?php echo $k; ?>"<?php selected( $instance['orderby'], $k ); ?>><?php echo $v; ?></option>
|
181 |
+
<?php } ?>
|
182 |
+
</select>
|
183 |
+
</p>
|
184 |
+
<!-- Widget Order: Select Input -->
|
185 |
+
<p>
|
186 |
+
<label for="<?php echo $this->get_field_id( 'order' ); ?>"><?php _e( 'Order Direction:', 'woothemes-testimonials' ); ?></label>
|
187 |
+
<select name="<?php echo $this->get_field_name( 'order' ); ?>" class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>">
|
188 |
+
<?php foreach ( $this->get_order_options() as $k => $v ) { ?>
|
189 |
+
<option value="<?php echo $k; ?>"<?php selected( $instance['order'], $k ); ?>><?php echo $v; ?></option>
|
190 |
+
<?php } ?>
|
191 |
+
</select>
|
192 |
+
</p>
|
193 |
+
<!-- Widget Display Author: Checkbox Input -->
|
194 |
+
<p>
|
195 |
+
<input id="<?php echo $this->get_field_id( 'display_author' ); ?>" name="<?php echo $this->get_field_name( 'display_author' ); ?>" type="checkbox"<?php checked( $instance['display_author'], 1 ); ?> />
|
196 |
+
<label for="<?php echo $this->get_field_id( 'display_author' ); ?>"><?php _e( 'Display Author', 'woothemes-testimonials' ); ?></label>
|
197 |
+
</p>
|
198 |
+
<!-- Widget Display URL: Checkbox Input -->
|
199 |
+
<p>
|
200 |
+
<input id="<?php echo $this->get_field_id( 'display_url' ); ?>" name="<?php echo $this->get_field_name( 'display_url' ); ?>" type="checkbox"<?php checked( $instance['display_url'], 1 ); ?> />
|
201 |
+
<label for="<?php echo $this->get_field_id( 'display_url' ); ?>"><?php _e( 'Display URL', 'woothemes-testimonials' ); ?></label>
|
202 |
+
</p>
|
203 |
+
<!-- Widget ID: Text Input -->
|
204 |
+
<p>
|
205 |
+
<label for="<?php echo $this->get_field_id( 'specific_id' ); ?>"><?php _e( 'Specific ID (optional):', 'woothemes-testimonials' ); ?></label>
|
206 |
+
<input type="text" name="<?php echo $this->get_field_name( 'specific_id' ); ?>" value="<?php echo $instance['specific_id']; ?>" class="widefat" id="<?php echo $this->get_field_id( 'specific_id' ); ?>" />
|
207 |
+
</p>
|
208 |
+
<p><small><?php _e( 'Display a specific testimonial, rather than a list.', 'woothemes-testimonials' ); ?></small></p>
|
209 |
+
<?php
|
210 |
+
} // End form()
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Get an array of the available orderby options.
|
214 |
+
* @since 1.0.0
|
215 |
+
* @return array
|
216 |
+
*/
|
217 |
+
protected function get_orderby_options () {
|
218 |
+
return array(
|
219 |
+
'none' => __( 'No Order', 'woothemes-testimonials' ),
|
220 |
+
'ID' => __( 'Entry ID', 'woothemes-testimonials' ),
|
221 |
+
'title' => __( 'Title', 'woothemes-testimonials' ),
|
222 |
+
'date' => __( 'Date Added', 'woothemes-testimonials' ),
|
223 |
+
'menu_order' => __( 'Specified Order Setting', 'woothemes-testimonials' )
|
224 |
+
);
|
225 |
+
} // End get_orderby_options()
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Get an array of the available order options.
|
229 |
+
* @since 1.0.0
|
230 |
+
* @return array
|
231 |
+
*/
|
232 |
+
protected function get_order_options () {
|
233 |
+
return array(
|
234 |
+
'asc' => __( 'Ascending', 'woothemes-testimonials' ),
|
235 |
+
'desc' => __( 'Descending', 'woothemes-testimonials' )
|
236 |
+
);
|
237 |
+
} // End get_order_options()
|
238 |
+
} // End Class
|
239 |
+
|
240 |
+
/* Register the widget. */
|
241 |
+
add_action( 'widgets_init', create_function( '', 'return register_widget("Woothemes_Widget_Testmonials");' ), 1 );
|
242 |
+
?>
|
lang/woothemes-testimonials-en_GB.po
ADDED
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Testimonials v1.0.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2012-10-17 09:22:43+0000\n"
|
7 |
+
"Last-Translator: Matty <matt@woothemes.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: English\n"
|
14 |
+
"X-Poedit-Country: UNITED KINGDOM\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
22 |
+
#: classes/class-woothemes-testimonials.php:75
|
23 |
+
#@ woothemes-testimonials
|
24 |
+
msgctxt "post type general name"
|
25 |
+
msgid "Testimonials"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: classes/class-woothemes-testimonials.php:76
|
29 |
+
#@ woothemes-testimonials
|
30 |
+
msgctxt "post type singular name"
|
31 |
+
msgid "Testimonial"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: classes/class-woothemes-testimonials.php:77
|
35 |
+
#@ woothemes-testimonials
|
36 |
+
msgctxt "testimonial"
|
37 |
+
msgid "Add New"
|
38 |
+
msgstr ""
|
39 |
+
|
40 |
+
#: classes/class-woothemes-testimonials.php:78
|
41 |
+
#, php-format
|
42 |
+
#@ woothemes-testimonials
|
43 |
+
msgid "Add New %s"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: classes/class-woothemes-testimonials.php:78
|
47 |
+
#: classes/class-woothemes-testimonials.php:79
|
48 |
+
#: classes/class-woothemes-testimonials.php:80
|
49 |
+
#: classes/class-woothemes-testimonials.php:82
|
50 |
+
#@ woothemes-testimonials
|
51 |
+
msgid "Testimonial"
|
52 |
+
msgstr ""
|
53 |
+
|
54 |
+
#: classes/class-woothemes-testimonials.php:79
|
55 |
+
#, php-format
|
56 |
+
#@ woothemes-testimonials
|
57 |
+
msgid "Edit %s"
|
58 |
+
msgstr ""
|
59 |
+
|
60 |
+
#: classes/class-woothemes-testimonials.php:80
|
61 |
+
#, php-format
|
62 |
+
#@ woothemes-testimonials
|
63 |
+
msgid "New %s"
|
64 |
+
msgstr ""
|
65 |
+
|
66 |
+
#: classes/class-woothemes-testimonials.php:81
|
67 |
+
#, php-format
|
68 |
+
#@ woothemes-testimonials
|
69 |
+
msgid "All %s"
|
70 |
+
msgstr ""
|
71 |
+
|
72 |
+
#: classes/class-woothemes-testimonials.php:81
|
73 |
+
#: classes/class-woothemes-testimonials.php:83
|
74 |
+
#: classes/class-woothemes-testimonials.php:84
|
75 |
+
#: classes/class-woothemes-testimonials.php:85
|
76 |
+
#: classes/class-woothemes-testimonials.php:87
|
77 |
+
#: classes/class-woothemes-widget-testimonials.php:44
|
78 |
+
#@ woothemes-testimonials
|
79 |
+
msgid "Testimonials"
|
80 |
+
msgstr ""
|
81 |
+
|
82 |
+
#: classes/class-woothemes-testimonials.php:82
|
83 |
+
#, php-format
|
84 |
+
#@ woothemes-testimonials
|
85 |
+
msgid "View %s"
|
86 |
+
msgstr ""
|
87 |
+
|
88 |
+
#: classes/class-woothemes-testimonials.php:83
|
89 |
+
#, php-format
|
90 |
+
#@ woothemes-testimonials
|
91 |
+
msgid "Search %a"
|
92 |
+
msgstr ""
|
93 |
+
|
94 |
+
#: classes/class-woothemes-testimonials.php:84
|
95 |
+
#, php-format
|
96 |
+
#@ woothemes-testimonials
|
97 |
+
msgid "No %s Found"
|
98 |
+
msgstr ""
|
99 |
+
|
100 |
+
#: classes/class-woothemes-testimonials.php:85
|
101 |
+
#, php-format
|
102 |
+
#@ woothemes-testimonials
|
103 |
+
msgid "No %s Found In Trash"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: classes/class-woothemes-testimonials.php:147
|
107 |
+
#@ woothemes-testimonials
|
108 |
+
msgid "Image"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: classes/class-woothemes-testimonials.php:181
|
112 |
+
#, php-format
|
113 |
+
#@ woothemes-testimonials
|
114 |
+
msgid "Testimonial updated. %sView testimonial%s"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: classes/class-woothemes-testimonials.php:182
|
118 |
+
#@ woothemes-testimonials
|
119 |
+
msgid "Custom field updated."
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: classes/class-woothemes-testimonials.php:183
|
123 |
+
#@ woothemes-testimonials
|
124 |
+
msgid "Custom field deleted."
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: classes/class-woothemes-testimonials.php:184
|
128 |
+
#@ woothemes-testimonials
|
129 |
+
msgid "Testimonial updated."
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#. translators: %s: date and time of the revision
|
133 |
+
#: classes/class-woothemes-testimonials.php:186
|
134 |
+
#, php-format
|
135 |
+
#@ woothemes-testimonials
|
136 |
+
msgid "Testimonial restored to revision from %s"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: classes/class-woothemes-testimonials.php:187
|
140 |
+
#, php-format
|
141 |
+
#@ woothemes-testimonials
|
142 |
+
msgid "Testimonial published. %sView testimonial%s"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: classes/class-woothemes-testimonials.php:188
|
146 |
+
#@ default
|
147 |
+
msgid "Testimonial saved."
|
148 |
+
msgstr ""
|
149 |
+
|
150 |
+
#: classes/class-woothemes-testimonials.php:189
|
151 |
+
#, php-format
|
152 |
+
#@ woothemes-testimonials
|
153 |
+
msgid "Testimonial submitted. %sPreview testimonial%s"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: classes/class-woothemes-testimonials.php:190
|
157 |
+
#, php-format
|
158 |
+
#@ woothemes-testimonials
|
159 |
+
msgid "Testimonial scheduled for: %1$s. %2$sPreview testimonial%3$s"
|
160 |
+
msgstr ""
|
161 |
+
|
162 |
+
#: classes/class-woothemes-testimonials.php:192
|
163 |
+
#@ default
|
164 |
+
msgid "M j, Y @ G:i"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: classes/class-woothemes-testimonials.php:193
|
168 |
+
#, php-format
|
169 |
+
#@ woothemes-testimonials
|
170 |
+
msgid "Testimonial draft updated. %sPreview testimonial%s"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: classes/class-woothemes-testimonials.php:207
|
174 |
+
#@ woothemes-testimonials
|
175 |
+
msgid "Testimonial Details"
|
176 |
+
msgstr ""
|
177 |
+
|
178 |
+
#: classes/class-woothemes-testimonials.php:306
|
179 |
+
#@ woothemes-testimonials
|
180 |
+
msgid "Enter the customer's name here"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: classes/class-woothemes-testimonials.php:332
|
184 |
+
#@ woothemes-testimonials
|
185 |
+
msgid "Gravatar E-mail Address"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#: classes/class-woothemes-testimonials.php:333
|
189 |
+
#, php-format
|
190 |
+
#@ woothemes-testimonials
|
191 |
+
msgid "Enter in an e-mail address, to use a %sGravatar%s, instead of using the \"Featured Image\"."
|
192 |
+
msgstr ""
|
193 |
+
|
194 |
+
#: classes/class-woothemes-testimonials.php:340
|
195 |
+
#@ woothemes-testimonials
|
196 |
+
msgid "Byline"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: classes/class-woothemes-testimonials.php:341
|
200 |
+
#@ woothemes-testimonials
|
201 |
+
msgid "Enter a byline for the customer giving this testimonial (for example: \"CEO of WooThemes\")."
|
202 |
+
msgstr ""
|
203 |
+
|
204 |
+
#: classes/class-woothemes-testimonials.php:348
|
205 |
+
#@ woothemes-testimonials
|
206 |
+
msgid "URL"
|
207 |
+
msgstr ""
|
208 |
+
|
209 |
+
#: classes/class-woothemes-testimonials.php:349
|
210 |
+
#@ woothemes-testimonials
|
211 |
+
msgid "Enter a URL that applies to this customer (for example: http://woothemes.com/)."
|
212 |
+
msgstr ""
|
213 |
+
|
214 |
+
#: classes/class-woothemes-widget-testimonials.php:42
|
215 |
+
#@ woothemes-testimonials
|
216 |
+
msgid "Recent testimonials on your site."
|
217 |
+
msgstr ""
|
218 |
+
|
219 |
+
#: classes/class-woothemes-widget-testimonials.php:162
|
220 |
+
#@ woothemes-testimonials
|
221 |
+
msgid "Title (optional):"
|
222 |
+
msgstr ""
|
223 |
+
|
224 |
+
#: classes/class-woothemes-widget-testimonials.php:167
|
225 |
+
#@ woothemes-testimonials
|
226 |
+
msgid "Limit:"
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
#: classes/class-woothemes-widget-testimonials.php:172
|
230 |
+
#@ woothemes-testimonials
|
231 |
+
msgid "Image Size (in pixels):"
|
232 |
+
msgstr ""
|
233 |
+
|
234 |
+
#: classes/class-woothemes-widget-testimonials.php:177
|
235 |
+
#@ woothemes-testimonials
|
236 |
+
msgid "Order By:"
|
237 |
+
msgstr ""
|
238 |
+
|
239 |
+
#: classes/class-woothemes-widget-testimonials.php:186
|
240 |
+
#@ woothemes-testimonials
|
241 |
+
msgid "Order Direction:"
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
+
#: classes/class-woothemes-widget-testimonials.php:196
|
245 |
+
#@ woothemes-testimonials
|
246 |
+
msgid "Display Author"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: classes/class-woothemes-widget-testimonials.php:201
|
250 |
+
#@ woothemes-testimonials
|
251 |
+
msgid "Display URL"
|
252 |
+
msgstr ""
|
253 |
+
|
254 |
+
#: classes/class-woothemes-widget-testimonials.php:205
|
255 |
+
#@ woothemes-testimonials
|
256 |
+
msgid "Specific ID (optional):"
|
257 |
+
msgstr ""
|
258 |
+
|
259 |
+
#: classes/class-woothemes-widget-testimonials.php:208
|
260 |
+
#@ woothemes-testimonials
|
261 |
+
msgid "Display a specific testimonial, rather than a list."
|
262 |
+
msgstr ""
|
263 |
+
|
264 |
+
#: classes/class-woothemes-widget-testimonials.php:219
|
265 |
+
#@ woothemes-testimonials
|
266 |
+
msgid "No Order"
|
267 |
+
msgstr ""
|
268 |
+
|
269 |
+
#: classes/class-woothemes-widget-testimonials.php:220
|
270 |
+
#@ woothemes-testimonials
|
271 |
+
msgid "Entry ID"
|
272 |
+
msgstr ""
|
273 |
+
|
274 |
+
#: classes/class-woothemes-widget-testimonials.php:221
|
275 |
+
#@ woothemes-testimonials
|
276 |
+
msgid "Title"
|
277 |
+
msgstr ""
|
278 |
+
|
279 |
+
#: classes/class-woothemes-widget-testimonials.php:222
|
280 |
+
#@ woothemes-testimonials
|
281 |
+
msgid "Date Added"
|
282 |
+
msgstr ""
|
283 |
+
|
284 |
+
#: classes/class-woothemes-widget-testimonials.php:223
|
285 |
+
#@ woothemes-testimonials
|
286 |
+
msgid "Specified Order Setting"
|
287 |
+
msgstr ""
|
288 |
+
|
289 |
+
#: classes/class-woothemes-widget-testimonials.php:234
|
290 |
+
#@ woothemes-testimonials
|
291 |
+
msgid "Ascending"
|
292 |
+
msgstr ""
|
293 |
+
|
294 |
+
#: classes/class-woothemes-widget-testimonials.php:235
|
295 |
+
#@ woothemes-testimonials
|
296 |
+
msgid "Descending"
|
297 |
+
msgstr ""
|
298 |
+
|
299 |
+
#: woothemes-testimonials-template.php:110
|
300 |
+
#@ woothemes-testimonials
|
301 |
+
msgid "Previous"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: woothemes-testimonials-template.php:111
|
305 |
+
#@ woothemes-testimonials
|
306 |
+
msgid "Next"
|
307 |
+
msgstr ""
|
308 |
+
|
lang/woothemes-testimonials-xx_XX.pot
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: PlaceHolder\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2012-10-17 08:56:48+0000\n"
|
7 |
+
"Last-Translator: none\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Poedit-Language: English\n"
|
14 |
+
"X-Poedit-Country: UNITED STATES\n"
|
15 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
16 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Poedit-Bookmarks: \n"
|
19 |
+
"X-Poedit-SearchPath-0: .\n"
|
20 |
+
"X-Textdomain-Support: yes"
|
21 |
+
|
readme.txt
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Testimonials by WooThemes ===
|
2 |
+
Contributors: woothemes, mattyza, jameskoster
|
3 |
+
Donate link: http://woothemes.com/
|
4 |
+
Tags: testimonials, widget, shortcode, template-tag, feedback, customers
|
5 |
+
Requires at least: 3.4.2
|
6 |
+
Tested up to: 3.5-beta2
|
7 |
+
Stable tag: 1.0.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Show off what your customers are saying about your business and how great they say you are, using our shortcode, widget or template tag.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
"Testimonials by WooThemes" is a clean and easy-to-use testimonials management system for WordPress. Load in what your customers are saying about your business, and display the testimonials via a shortcode, widget or template tag on your website.
|
16 |
+
|
17 |
+
=== Usage ===
|
18 |
+
|
19 |
+
To display your testimonials via a theme or a custom plugin, please use the following code:
|
20 |
+
|
21 |
+
`<?php do_action( 'woothemes_testimonials' ); ?>`
|
22 |
+
|
23 |
+
To add arguments to this, please use any of the following arguments, using the syntax provided below:
|
24 |
+
|
25 |
+
* 'limit' => 5 (the maximum number of items to display)
|
26 |
+
* 'orderby' => 'menu_order' (how to order the items - accepts all default WordPress ordering options)
|
27 |
+
* 'order' => 'DESC' (the order direction)
|
28 |
+
* 'id' => 0 (display a specific item)
|
29 |
+
* 'display_author' => true (whether or not to display the author information)
|
30 |
+
* 'display_url' => true (whether or not to display the URL information)
|
31 |
+
* 'echo' => true (whether to display or return the data - useful with the template tag)
|
32 |
+
* 'size' => 50 (the pixel dimensions of the image)
|
33 |
+
* 'title' => '' (an optional title)
|
34 |
+
|
35 |
+
`<?php do_action( 'woothemes_testimonials', array( 'limit' => 10, 'display_author' => false ) ); ?>`
|
36 |
+
|
37 |
+
The same arguments apply to the shortcode which is `[woothemes_testimonials]` and the template tag, which is `<?php woothemes_testimonials(); ?>`.
|
38 |
+
|
39 |
+
== Installation ==
|
40 |
+
|
41 |
+
Installing "Testimonials by WooThemes" can be done either by searching for "Testimonials by WooThemes" via the "Plugins > Add New" screen in your WordPress dashboard, or by using the following steps:
|
42 |
+
|
43 |
+
1. Download the plugin via WordPress.org.
|
44 |
+
1. Upload the ZIP file through the "Plugins > Add New > Upload" screen in your WordPress dashboard.
|
45 |
+
1. Activate the plugin through the 'Plugins' menu in WordPress
|
46 |
+
1. Place `<?php do_action( 'woothemes_testimonials' ); ?>` in your templates, or use the provided widget or shortcode.
|
47 |
+
|
48 |
+
== Frequently Asked Questions ==
|
49 |
+
|
50 |
+
= The plugin looks unstyled when I activate it. Why is this? =
|
51 |
+
|
52 |
+
"Testimonials by WooThemes" is a lean plugin that aims to keep it's purpose as clean and clear as possible. Thus, we don't load any preset CSS styling, to allow full control over the styling within your theme or child theme.
|
53 |
+
|
54 |
+
= How do I contribute? =
|
55 |
+
|
56 |
+
We encourage everyone to contribute their ideas, thoughts and code snippets. This can be done by forking the [repository over at GitHub](http://github.com/woothemes/testimonials/).
|
57 |
+
|
58 |
+
== Screenshots ==
|
59 |
+
|
60 |
+
1. The testimonials management screen within the WordPress admin.
|
61 |
+
|
62 |
+
== Upgrade Notice ==
|
63 |
+
|
64 |
+
= 1.0.0 =
|
65 |
+
* Initial release. Woo!
|
66 |
+
|
67 |
+
== Changelog ==
|
68 |
+
|
69 |
+
= 1.0.0 =
|
70 |
+
* Initial release. Woo!
|
woothemes-testimonials-template.php
ADDED
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
3 |
+
|
4 |
+
if ( ! function_exists( 'woothemes_get_testimonials' ) ) {
|
5 |
+
/**
|
6 |
+
* Wrapper function to get the testimonials from the WooDojo_Testimonials class.
|
7 |
+
* @param string/array $args Arguments.
|
8 |
+
* @since 1.0.0
|
9 |
+
* @return array/boolean Array if true, boolean if false.
|
10 |
+
*/
|
11 |
+
function woothemes_get_testimonials ( $args = '' ) {
|
12 |
+
global $woothemes_testimonials;
|
13 |
+
return $woothemes_testimonials->get_testimonials( $args );
|
14 |
+
} // End woothemes_get_testimonials()
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Enable the usage of do_action( 'woothemes_testimonials' ) to display testimonials within a theme/plugin.
|
19 |
+
*
|
20 |
+
* @since 1.0.0
|
21 |
+
*/
|
22 |
+
add_action( 'woothemes_testimonials', 'woothemes_testimonials' );
|
23 |
+
|
24 |
+
if ( ! function_exists( 'woothemes_testimonials' ) ) {
|
25 |
+
/**
|
26 |
+
* Display or return HTML-formatted testimonials.
|
27 |
+
* @param string/array $args Arguments.
|
28 |
+
* @since 1.0.0
|
29 |
+
* @return string
|
30 |
+
*/
|
31 |
+
function woothemes_testimonials ( $args = '' ) {
|
32 |
+
global $post;
|
33 |
+
|
34 |
+
$defaults = array(
|
35 |
+
'limit' => 5,
|
36 |
+
'orderby' => 'menu_order',
|
37 |
+
'order' => 'DESC',
|
38 |
+
'id' => 0,
|
39 |
+
'display_author' => true,
|
40 |
+
'display_url' => true,
|
41 |
+
'effect' => 'fade', // Options: 'fade', 'none'
|
42 |
+
'pagination' => false,
|
43 |
+
'echo' => true,
|
44 |
+
'size' => 50,
|
45 |
+
'title' => ''
|
46 |
+
);
|
47 |
+
|
48 |
+
$args = wp_parse_args( $args, $defaults );
|
49 |
+
|
50 |
+
// Allow child themes/plugins to filter here.
|
51 |
+
$args = apply_filters( 'woothemes_testimonials_args', $args );
|
52 |
+
$html = '';
|
53 |
+
|
54 |
+
do_action( 'woothemes_testimonials_before', $args );
|
55 |
+
|
56 |
+
// The Query.
|
57 |
+
$query = woothemes_get_testimonials( $args );
|
58 |
+
|
59 |
+
// The Display.
|
60 |
+
if ( ! is_wp_error( $query ) && is_array( $query ) && count( $query ) > 0 ) {
|
61 |
+
|
62 |
+
if ( $args['effect'] != 'none' ) {
|
63 |
+
$effect = ' ' . $args['effect'];
|
64 |
+
}
|
65 |
+
|
66 |
+
$html .= '<div class="widget widget_woothemes_testimonials">' . "\n";
|
67 |
+
$html .= '<div class="testimonials component' . $effect . '">' . "\n";
|
68 |
+
|
69 |
+
if ( '' != $args['title'] ) {
|
70 |
+
$html .= '<h2>' . esc_html( $args['title'] ) . '</h2>' . "\n";
|
71 |
+
}
|
72 |
+
|
73 |
+
$html .= '<div class="testimonials-list">' . "\n";
|
74 |
+
|
75 |
+
// Begin templating logic.
|
76 |
+
$tpl = '<div id="quote-%%ID%%" class="%%CLASS%%"><blockquote class="testimonials-text">%%TEXT%%</blockquote>%%AVATAR%% %%AUTHOR%%<div class="fix"></div></div>';
|
77 |
+
$tpl = apply_filters( 'woothemes_testimonials_item_template', $tpl, $args );
|
78 |
+
|
79 |
+
$count = 0;
|
80 |
+
foreach ( $query as $post ) { $count++;
|
81 |
+
$template = $tpl;
|
82 |
+
|
83 |
+
$css_class = 'quote';
|
84 |
+
if ( 1 == $count ) { $css_class .= ' first'; }
|
85 |
+
if ( count( $query ) == $count ) { $css_class .= ' last'; }
|
86 |
+
|
87 |
+
setup_postdata( $post );
|
88 |
+
|
89 |
+
$author = '';
|
90 |
+
$author_text = '';
|
91 |
+
|
92 |
+
// If we need to display the author, get the data.
|
93 |
+
if ( ( get_the_title( $post ) != '' ) && true == $args['display_author'] ) {
|
94 |
+
$author .= '<cite class="author">';
|
95 |
+
|
96 |
+
$author_name = get_the_title( $post );
|
97 |
+
|
98 |
+
$author .= $author_name;
|
99 |
+
|
100 |
+
if ( isset( $post->byline ) && '' != $post->byline ) {
|
101 |
+
$author .= ' <span class="excerpt">' . $post->byline . '</span><!--/.excerpt-->' . "\n";
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( true == $args['display_url'] && '' != $post->url ) {
|
105 |
+
$author .= ' <span class="url"><a href="' . esc_url( $post->url ) . '">' . $post->url . '</a></span><!--/.excerpt-->' . "\n";
|
106 |
+
}
|
107 |
+
|
108 |
+
$author .= '</cite><!--/.author-->' . "\n";
|
109 |
+
|
110 |
+
// Templating engine replacement.
|
111 |
+
$template = str_replace( '%%AUTHOR%%', $author, $template );
|
112 |
+
} else {
|
113 |
+
$template = str_replace( '%%AUTHOR%%', '', $template );
|
114 |
+
}
|
115 |
+
|
116 |
+
// Templating logic replacement.
|
117 |
+
$template = str_replace( '%%ID%%', get_the_ID(), $template );
|
118 |
+
$template = str_replace( '%%CLASS%%', esc_attr( $css_class ), $template );
|
119 |
+
|
120 |
+
if ( isset( $post->image ) && ( '' != $post->image ) ) {
|
121 |
+
$template = str_replace( '%%AVATAR%%', '<a href="' . esc_url( $post->url ) . '" class="avatar-link">' . $post->image . '</a>', $template );
|
122 |
+
}
|
123 |
+
|
124 |
+
$template = str_replace( '%%TEXT%%', get_the_content(), $template );
|
125 |
+
|
126 |
+
// Assign for output.
|
127 |
+
$html .= $template;
|
128 |
+
}
|
129 |
+
|
130 |
+
$html .= '</div><!--/.testimonials-list-->' . "\n";
|
131 |
+
|
132 |
+
if ( $args['pagination'] == true && count( $query ) > 1 && $args['effect'] != 'none' ) {
|
133 |
+
$html .= '<div class="pagination">' . "\n";
|
134 |
+
$html .= '<a href="#" class="btn-prev">' . apply_filters( 'woothemes_testimonials_prev_btn', '← ' . __( 'Previous', 'woothemes-testimonials' ) ) . '</a>' . "\n";
|
135 |
+
$html .= '<a href="#" class="btn-next">' . apply_filters( 'woothemes_testimonials_next_btn', __( 'Next', 'woothemes-testimonials' ) . ' →' ) . '</a>' . "\n";
|
136 |
+
$html .= '</div><!--/.pagination-->' . "\n";
|
137 |
+
}
|
138 |
+
$html .= '<div class="fix"></div>' . "\n";
|
139 |
+
$html .= '</div><!--/.testimonials-->' . "\n";
|
140 |
+
$html .= '</div>' . "\n";
|
141 |
+
}
|
142 |
+
|
143 |
+
// Allow child themes/plugins to filter here.
|
144 |
+
$html = apply_filters( 'woothemes_testimonials_html', $html, $query, $args );
|
145 |
+
|
146 |
+
if ( $args['echo'] != true ) { return $html; }
|
147 |
+
|
148 |
+
// Should only run is "echo" is set to true.
|
149 |
+
echo $html;
|
150 |
+
|
151 |
+
do_action( 'woothemes_testimonials_after', $args ); // Only if "echo" is set to true.
|
152 |
+
} // End woothemes_testimonials()
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( ! function_exists( 'woothemes_testimonials_shortcode' ) ) {
|
156 |
+
function woothemes_testimonials_shortcode ( $atts, $content = null ) {
|
157 |
+
$args = (array)$atts;
|
158 |
+
|
159 |
+
$defaults = array(
|
160 |
+
'limit' => 5,
|
161 |
+
'orderby' => 'menu_order',
|
162 |
+
'order' => 'DESC',
|
163 |
+
'id' => 0,
|
164 |
+
'display_author' => true,
|
165 |
+
'display_url' => true,
|
166 |
+
'effect' => 'fade', // Options: 'fade', 'none'
|
167 |
+
'pagination' => false,
|
168 |
+
'echo' => true,
|
169 |
+
'size' => 50
|
170 |
+
);
|
171 |
+
|
172 |
+
$args = shortcode_atts( $defaults, $atts );
|
173 |
+
|
174 |
+
// Make sure we return and don't echo.
|
175 |
+
$args['echo'] = false;
|
176 |
+
|
177 |
+
// Fix integers.
|
178 |
+
if ( isset( $args['limit'] ) ) $args['limit'] = intval( $args['limit'] );
|
179 |
+
if ( isset( $args['id'] ) ) $args['id'] = intval( $args['id'] );
|
180 |
+
if ( isset( $args['size'] ) && ( 0 < intval( $args['size'] ) ) ) $args['size'] = intval( $args['size'] );
|
181 |
+
|
182 |
+
// Fix booleans.
|
183 |
+
foreach ( array( 'display_author', 'display_url', 'pagination' ) as $k => $v ) {
|
184 |
+
if ( isset( $args[$v] ) && ( 'true' == $args[$v] ) ) {
|
185 |
+
$args[$v] = true;
|
186 |
+
} else {
|
187 |
+
$args[$v] = false;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
return woothemes_testimonials( $args );
|
192 |
+
} // End woothemes_testimonials_shortcode()
|
193 |
+
}
|
194 |
+
|
195 |
+
add_shortcode( 'woothemes_testimonials', 'woothemes_testimonials_shortcode' );
|
196 |
+
?>
|
woothemes-testimonials.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Testimonials
|
4 |
+
* Plugin URI: http://woothemes.com/
|
5 |
+
* Description: Hi, I'm your testimonials management plugin for WordPress. Show off what your customers or website users are saying about your business and how great they say you are, using our shortcode, widget or template tag.
|
6 |
+
* Author: WooThemes
|
7 |
+
* Version: 1.0.0
|
8 |
+
* Author URI: http://woothemes.com/
|
9 |
+
*
|
10 |
+
* @package WordPress
|
11 |
+
* @subpackage WooThemes_Testimonials
|
12 |
+
* @author Matty
|
13 |
+
* @since 1.0.0
|
14 |
+
*/
|
15 |
+
|
16 |
+
require_once( 'classes/class-woothemes-testimonials.php' );
|
17 |
+
require_once( 'woothemes-testimonials-template.php' );
|
18 |
+
require_once( 'classes/class-woothemes-widget-testimonials.php' );
|
19 |
+
global $woothemes_testimonials;
|
20 |
+
$woothemes_testimonials = new Woothemes_Testimonials( __FILE__ );
|
21 |
+
?>
|