Version Description
- Add ImageRecycle images and PDF compression integration (www.imagerecycle.com)
Download this release
Release Info
Developer | JoomUnited |
Plugin | WP Meta SEO |
Version | 2.1.0 |
Comparing to | |
See all releases |
Code changes from version 2.0.3 to 2.1.0
- inc/class.metaseo-admin.php +12 -0
- inc/class.metaseo-dashboard.php +42 -0
- inc/class.metaseo-meta.php +36 -421
- inc/class.metaseo-metabox.php +0 -9
- inc/class.metaseo-snippet-preview.php +0 -28
- inc/pages/dashboard.php +55 -0
- inc/pages/metaseo-image-compression.php +152 -0
- readme.txt +11 -7
- wp-meta-seo.php +27 -16
inc/class.metaseo-admin.php
CHANGED
@@ -713,6 +713,15 @@ class MetaSeo_Admin {
|
|
713 |
array($this, 'load_page'),
|
714 |
null,
|
715 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
array(
|
717 |
'metaseo_dashboard',
|
718 |
'',
|
@@ -775,6 +784,9 @@ class MetaSeo_Admin {
|
|
775 |
function load_page() {
|
776 |
if (isset($_GET['page'])) {
|
777 |
switch ($_GET['page']) {
|
|
|
|
|
|
|
778 |
case 'metaseo_broken_link':
|
779 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/metaseo-broken-link.php' );
|
780 |
break;
|
713 |
array($this, 'load_page'),
|
714 |
null,
|
715 |
),
|
716 |
+
array(
|
717 |
+
'metaseo_dashboard',
|
718 |
+
'',
|
719 |
+
__('Image compression', 'wp-meta-seo'),
|
720 |
+
$manage_options_cap,
|
721 |
+
'metaseo_image_compression',
|
722 |
+
array($this, 'load_page'),
|
723 |
+
null,
|
724 |
+
),
|
725 |
array(
|
726 |
'metaseo_dashboard',
|
727 |
'',
|
784 |
function load_page() {
|
785 |
if (isset($_GET['page'])) {
|
786 |
switch ($_GET['page']) {
|
787 |
+
case 'metaseo_image_compression':
|
788 |
+
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/metaseo-image-compression.php' );
|
789 |
+
break;
|
790 |
case 'metaseo_broken_link':
|
791 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/pages/metaseo-broken-link.php' );
|
792 |
break;
|
inc/class.metaseo-dashboard.php
CHANGED
@@ -294,4 +294,46 @@ class MetaSeo_Dashboard {
|
|
294 |
}
|
295 |
return array('count_404' => $count_404 , 'count_404_redirected' => $count_404_redirected , 'percent' => $percent);
|
296 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
}
|
294 |
}
|
295 |
return array('count_404' => $count_404 , 'count_404_redirected' => $count_404_redirected , 'percent' => $percent);
|
296 |
}
|
297 |
+
|
298 |
+
public function wpmf_getImages_optimizer(){
|
299 |
+
global $wpdb;
|
300 |
+
$query = 'SELECT distinct file FROM '.$wpdb->prefix.'wpio_images';
|
301 |
+
$files = $wpdb->get_results($query);
|
302 |
+
$image_optimize = 0;
|
303 |
+
foreach ($files as $file){
|
304 |
+
if(file_exists(str_replace('/', DIRECTORY_SEPARATOR, ABSPATH . $file->file))){
|
305 |
+
$image_optimize++;
|
306 |
+
}
|
307 |
+
}
|
308 |
+
return $image_optimize;
|
309 |
+
}
|
310 |
+
|
311 |
+
public function wpmf_getImages_count(){
|
312 |
+
$wpio_settings = get_option('_wpio_settings');
|
313 |
+
$include_folders = $wpio_settings['wpio_api_include'];
|
314 |
+
$allowedPath = explode(',',$include_folders);
|
315 |
+
$images = array();
|
316 |
+
$image_optimize = $this->wpmf_getImages_optimizer();
|
317 |
+
|
318 |
+
$allowed_ext = array('jpg','jpeg','jpe','gif','png','pdf');
|
319 |
+
$min_size = (int)$wpio_settings['wpio_api_minfilesize'] *1024;
|
320 |
+
$max_size = (int)$wpio_settings['wpio_api_maxfilesize'] *1024;
|
321 |
+
if($max_size==0) $max_size = 5 * 1024 * 1024;
|
322 |
+
$count_image = 0;
|
323 |
+
$scan_dir = str_replace('/', DIRECTORY_SEPARATOR, ABSPATH) ;
|
324 |
+
foreach (new RecursiveIteratorIterator(new IgnorantRecursiveDirectoryIterator($scan_dir)) as $filename){
|
325 |
+
if(!in_array(strtolower(pathinfo($filename,PATHINFO_EXTENSION)),$allowed_ext)){
|
326 |
+
continue;
|
327 |
+
}
|
328 |
+
|
329 |
+
$count_image++;
|
330 |
+
}
|
331 |
+
|
332 |
+
if($count_image == 0){
|
333 |
+
$precent = 0;
|
334 |
+
}else{
|
335 |
+
$precent = ceil($image_optimize/$count_image*100);
|
336 |
+
}
|
337 |
+
return array('image_optimize' => $image_optimize, 'count_image' => $count_image , 'percent' => $precent);
|
338 |
+
}
|
339 |
}
|
inc/class.metaseo-meta.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
class WPMSEO_Meta {
|
4 |
|
5 |
public static $meta_prefix = '_metaseo_meta';
|
@@ -13,97 +13,97 @@ class WPMSEO_Meta {
|
|
13 |
'general' => array(
|
14 |
'snippetpreview' => array(
|
15 |
'type' => 'snippetpreview',
|
16 |
-
'title' => '',
|
17 |
-
'help' => '',
|
18 |
),
|
19 |
'title' => array(
|
20 |
'type' => 'textarea',
|
21 |
-
'title' => '',
|
22 |
'default_value' => '',
|
23 |
-
'description' => '',
|
24 |
-
'help' => '',
|
25 |
'rows' => 2
|
26 |
),
|
27 |
'keywords' => array(
|
28 |
'type' => 'textarea',
|
29 |
-
'title' => '',
|
30 |
'default_value' => '',
|
31 |
-
'description' => '',
|
32 |
-
'help' => '',
|
33 |
'rows' => 2
|
34 |
),
|
35 |
'desc' => array(
|
36 |
'type' => 'textarea',
|
37 |
-
'title' => '',
|
38 |
'default_value' => '',
|
39 |
'class' => 'desc',
|
40 |
'rows' => 3,
|
41 |
-
'description' => '',
|
42 |
-
'help' => '',
|
43 |
),
|
44 |
'metaseo_chart' => array(
|
45 |
'type' => 'metaseo_chart',
|
46 |
-
'title' => '',
|
47 |
'default_value' => '',
|
48 |
'class' => 'metaseo_chart',
|
49 |
'rows' => 2,
|
50 |
-
'description' => '',
|
51 |
-
'help' => '',
|
52 |
),
|
53 |
),
|
54 |
'social' => array(
|
55 |
'opengraph-title' => array(
|
56 |
'type' => 'text',
|
57 |
-
'title' => '',
|
58 |
'default_value' => '',
|
59 |
-
'description' => '',
|
60 |
-
'help' => '',
|
61 |
),
|
62 |
'opengraph-desc' => array(
|
63 |
'type' => 'textarea',
|
64 |
-
'title' => '',
|
65 |
'default_value' => '',
|
66 |
'class' => 'desc',
|
67 |
'rows' => 3,
|
68 |
-
'description' => '',
|
69 |
-
'help' => '',
|
70 |
),
|
71 |
'opengraph-image' => array(
|
72 |
'type' => 'upload',
|
73 |
-
'title' => '',
|
74 |
'default_value' => '',
|
75 |
'class' => 'desc',
|
76 |
-
'description' => '',
|
77 |
-
'help' => '',
|
78 |
),
|
79 |
|
80 |
'twitter-title' => array(
|
81 |
'type' => 'text',
|
82 |
-
'title' => '',
|
83 |
'default_value' => '',
|
84 |
-
'description' => '',
|
85 |
-
'help' => '',
|
86 |
),
|
87 |
'twitter-desc' => array(
|
88 |
'type' => 'textarea',
|
89 |
-
'title' => '',
|
90 |
'default_value' => '',
|
91 |
'class' => 'desc',
|
92 |
'rows' => 3,
|
93 |
-
'description' => '',
|
94 |
-
'help' => '',
|
95 |
),
|
96 |
'twitter-image' => array(
|
97 |
'type' => 'upload',
|
98 |
-
'title' => '',
|
99 |
'default_value' => '',
|
100 |
'class' => 'desc',
|
101 |
-
'description' => '',
|
102 |
-
'help' => '',
|
103 |
),
|
104 |
|
105 |
),
|
106 |
-
|
107 |
'non_form' => array(
|
108 |
'linkdex' => array(
|
109 |
'type' => null,
|
@@ -135,10 +135,8 @@ class WPMSEO_Meta {
|
|
135 |
}
|
136 |
|
137 |
$field_defs = self::$meta_fields[$tab];
|
138 |
-
|
139 |
switch ($tab) {
|
140 |
case 'non-form':
|
141 |
-
// Prevent non-form fields from being passed to forms.
|
142 |
$field_defs = array();
|
143 |
break;
|
144 |
|
@@ -146,226 +144,22 @@ class WPMSEO_Meta {
|
|
146 |
case 'general':
|
147 |
$options = get_option('wpmseo_titles');
|
148 |
if ($options['usemetakeywords'] === true) {
|
149 |
-
/* Adjust the link in the keywords description text string based on the post type */
|
150 |
$field_defs['metakeywords']['description'] = sprintf($field_defs['metakeywords']['description'], '<a target="_blank" href="' . esc_url(admin_url('admin.php?page=wpmseo_titles#top#post_types')) . '">', '</a>');
|
151 |
} else {
|
152 |
-
/* Don't show the keywords field if keywords aren't enabled */
|
153 |
unset($field_defs['metakeywords']);
|
154 |
}
|
155 |
-
|
156 |
-
* Filter the WPSEO metabox form field definitions for the general tab, backward compatibility
|
157 |
-
*
|
158 |
-
* @deprecated 1.5.0
|
159 |
-
* @deprecated use the 'wpmseo_metabox_entries_general' filter instead
|
160 |
-
* @see WPMSEO_Meta::get_meta_field_defs()
|
161 |
-
*
|
162 |
-
* @param array $field_defs Metabox orm definitions.
|
163 |
-
*
|
164 |
-
* @return array
|
165 |
-
*/
|
166 |
$field_defs = apply_filters('wpmseo_metabox_entries', $field_defs);
|
167 |
break;
|
168 |
|
169 |
|
170 |
case 'advanced':
|
171 |
-
// global $post;
|
172 |
-
//
|
173 |
-
// $options = WPSEO_Options::get_all();
|
174 |
-
//
|
175 |
-
// if ( ! current_user_can( 'manage_options' ) && $options['disableadvanced_meta'] ) {
|
176 |
-
// return array();
|
177 |
-
// }
|
178 |
-
//
|
179 |
-
// $post_type = '';
|
180 |
-
// if ( isset( $post->post_type ) ) {
|
181 |
-
// $post_type = $post->post_type;
|
182 |
-
// }
|
183 |
-
// elseif ( ! isset( $post->post_type ) && isset( $_GET['post_type'] ) ) {
|
184 |
-
// $post_type = sanitize_text_field( $_GET['post_type'] );
|
185 |
-
// }
|
186 |
-
//
|
187 |
-
// /* Adjust the no-index 'default for post type' text string based on the post type */
|
188 |
-
// $field_defs['meta-robots-noindex']['options']['0'] = sprintf( $field_defs['meta-robots-noindex']['options']['0'], ( ( isset( $options[ 'noindex-' . $post_type ] ) && $options[ 'noindex-' . $post_type ] === true ) ? 'noindex' : 'index' ) );
|
189 |
-
//
|
190 |
-
// /* Adjust the robots advanced 'site-wide default' text string based on those settings */
|
191 |
-
// if ( $options['noodp'] !== false || $options['noydir'] !== false ) {
|
192 |
-
// $robots_adv = array();
|
193 |
-
// foreach ( array( 'noodp', 'noydir' ) as $robot ) {
|
194 |
-
// if ( $options[ $robot ] === true ) {
|
195 |
-
// // Use translation from field def options - mind that $options and $field_def['options'] keys should be the same!
|
196 |
-
// $robots_adv[] = $field_defs['meta-robots-adv']['options'][ $robot ];
|
197 |
-
// }
|
198 |
-
// }
|
199 |
-
// unset( $robot );
|
200 |
-
// $robots_adv = implode( ', ', $robots_adv );
|
201 |
-
// }
|
202 |
-
// else {
|
203 |
-
// $robots_adv = __( 'None', 'wordpress-seo' );
|
204 |
-
// }
|
205 |
-
// $field_defs['meta-robots-adv']['options']['-'] = sprintf( $field_defs['meta-robots-adv']['options']['-'], $robots_adv );
|
206 |
-
// unset( $robots_adv );
|
207 |
-
//
|
208 |
-
//
|
209 |
-
// /* Don't show the breadcrumb title field if breadcrumbs aren't enabled */
|
210 |
-
// if ( $options['breadcrumbs-enable'] !== true ) {
|
211 |
-
// unset( $field_defs['bctitle'] );
|
212 |
-
// }
|
213 |
-
//
|
214 |
-
// global $post;
|
215 |
-
//
|
216 |
-
// if ( empty( $post->ID ) || ( ! empty( $post->ID ) && self::get_value( 'redirect', $post->ID ) === '' ) ) {
|
217 |
-
// unset( $field_defs['redirect'] );
|
218 |
-
// }
|
219 |
break;
|
220 |
}
|
221 |
|
222 |
return apply_filters('wpmseo_metabox_entries_' . $tab, $field_defs, $post_type);
|
223 |
}
|
224 |
|
225 |
-
public static function sanitize_post_meta($meta_value, $meta_key) {
|
226 |
-
$field_def = self::$meta_fields[self::$fields_index[$meta_key]['subset']][self::$fields_index[$meta_key]['key']];
|
227 |
-
$clean = self::$defaults[$meta_key];
|
228 |
-
|
229 |
-
switch (true) {
|
230 |
-
case ( $meta_key === self::$meta_prefix . 'linkdex' ):
|
231 |
-
$int = WPMSEO_Utils::validate_int($meta_value);
|
232 |
-
if ($int !== false && $int >= 0) {
|
233 |
-
$clean = strval($int); // Convert to string to make sure default check works.
|
234 |
-
}
|
235 |
-
break;
|
236 |
-
|
237 |
-
|
238 |
-
case ( $field_def['type'] === 'checkbox' ):
|
239 |
-
// Only allow value if it's one of the predefined options.
|
240 |
-
if (in_array($meta_value, array('on', 'off'), true)) {
|
241 |
-
$clean = $meta_value;
|
242 |
-
}
|
243 |
-
break;
|
244 |
-
|
245 |
-
|
246 |
-
case ( $field_def['type'] === 'select' || $field_def['type'] === 'radio' ):
|
247 |
-
// Only allow value if it's one of the predefined options.
|
248 |
-
if (isset($field_def['options'][$meta_value])) {
|
249 |
-
$clean = $meta_value;
|
250 |
-
}
|
251 |
-
break;
|
252 |
-
|
253 |
-
|
254 |
-
case ( $field_def['type'] === 'multiselect' && $meta_key === self::$meta_prefix . 'meta-robots-adv' ):
|
255 |
-
$clean = self::validate_meta_robots_adv($meta_value);
|
256 |
-
break;
|
257 |
-
|
258 |
-
|
259 |
-
case ( $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'canonical' ):
|
260 |
-
case ( $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'redirect' ):
|
261 |
-
// Validate as url(-part).
|
262 |
-
$url = WPMSEO_Utils::sanitize_url($meta_value);
|
263 |
-
if ($url !== '') {
|
264 |
-
$clean = $url;
|
265 |
-
}
|
266 |
-
break;
|
267 |
-
|
268 |
-
|
269 |
-
case ( $field_def['type'] === 'upload' && $meta_key === self::$meta_prefix . 'opengraph-image' ):
|
270 |
-
// Validate as url.
|
271 |
-
$url = WPMSEO_Utils::sanitize_url($meta_value, array('http', 'https', 'ftp', 'ftps'));
|
272 |
-
if ($url !== '') {
|
273 |
-
$clean = $url;
|
274 |
-
}
|
275 |
-
break;
|
276 |
-
|
277 |
-
|
278 |
-
case ( $field_def['type'] === 'textarea' ):
|
279 |
-
if (is_string($meta_value)) {
|
280 |
-
// Remove line breaks and tabs.
|
281 |
-
// @todo [JRF => Yoast] verify that line breaks and the likes aren't allowed/recommended in meta header fields.
|
282 |
-
$meta_value = str_replace(array("\n", "\r", "\t", ' '), ' ', $meta_value);
|
283 |
-
$clean = WPMSEO_Utils::sanitize_text_field(trim($meta_value));
|
284 |
-
}
|
285 |
-
break;
|
286 |
-
|
287 |
-
case ( 'multiselect' === $field_def['type'] ):
|
288 |
-
$clean = $meta_value;
|
289 |
-
break;
|
290 |
-
|
291 |
-
|
292 |
-
case ( $field_def['type'] === 'text' ):
|
293 |
-
default:
|
294 |
-
if (is_string($meta_value)) {
|
295 |
-
$clean = WPMSEO_Utils::sanitize_text_field(trim($meta_value));
|
296 |
-
}
|
297 |
-
break;
|
298 |
-
}
|
299 |
-
|
300 |
-
$clean = apply_filters('wpmseo_sanitize_post_meta_' . $meta_key, $clean, $meta_value, $field_def, $meta_key);
|
301 |
-
|
302 |
-
return $clean;
|
303 |
-
}
|
304 |
-
|
305 |
-
public static function validate_meta_robots_adv($meta_value) {
|
306 |
-
$clean = self::$meta_fields['advanced']['meta-robots-adv']['default_value'];
|
307 |
-
$options = self::$meta_fields['advanced']['meta-robots-adv']['options'];
|
308 |
-
|
309 |
-
if (is_string($meta_value)) {
|
310 |
-
$meta_value = explode(',', $meta_value);
|
311 |
-
}
|
312 |
-
|
313 |
-
if (is_array($meta_value) && $meta_value !== array()) {
|
314 |
-
$meta_value = array_map('trim', $meta_value);
|
315 |
-
|
316 |
-
if (in_array('none', $meta_value, true)) {
|
317 |
-
// None is one of the selected values, takes priority over everything else.
|
318 |
-
$clean = 'none';
|
319 |
-
} elseif (in_array('-', $meta_value, true)) {
|
320 |
-
// Site-wide defaults is one of the selected values, takes priority over individual selected entries.
|
321 |
-
$clean = '-';
|
322 |
-
} else {
|
323 |
-
// Individual selected entries.
|
324 |
-
$cleaning = array();
|
325 |
-
foreach ($meta_value as $value) {
|
326 |
-
if (isset($options[$value])) {
|
327 |
-
$cleaning[] = $value;
|
328 |
-
}
|
329 |
-
}
|
330 |
-
|
331 |
-
if ($cleaning !== array()) {
|
332 |
-
$clean = implode(',', $cleaning);
|
333 |
-
}
|
334 |
-
unset($cleaning, $value);
|
335 |
-
}
|
336 |
-
}
|
337 |
-
|
338 |
-
return $clean;
|
339 |
-
}
|
340 |
-
|
341 |
-
public static function remove_meta_if_default($null, $object_id, $meta_key, $meta_value, $prev_value = '') {
|
342 |
-
/* If it's one of our meta fields, check against default */
|
343 |
-
if (isset(self::$fields_index[$meta_key]) && self::meta_value_is_default($meta_key, $meta_value) === true) {
|
344 |
-
if ($prev_value !== '') {
|
345 |
-
delete_post_meta($object_id, $meta_key, $prev_value);
|
346 |
-
} else {
|
347 |
-
delete_post_meta($object_id, $meta_key);
|
348 |
-
}
|
349 |
-
|
350 |
-
return true; // Stop saving the value.
|
351 |
-
}
|
352 |
-
|
353 |
-
return null; // Go on with the normal execution (update) in meta.php.
|
354 |
-
}
|
355 |
-
|
356 |
-
public static function dont_save_meta_if_default($null, $object_id, $meta_key, $meta_value) {
|
357 |
-
/* If it's one of our meta fields, check against default */
|
358 |
-
if (isset(self::$fields_index[$meta_key]) && self::meta_value_is_default($meta_key, $meta_value) === true) {
|
359 |
-
return true; // Stop saving the value.
|
360 |
-
}
|
361 |
-
|
362 |
-
return null; // Go on with the normal execution (add) in meta.php.
|
363 |
-
}
|
364 |
-
|
365 |
-
public static function meta_value_is_default($meta_key, $meta_value) {
|
366 |
-
return ( isset(self::$defaults[$meta_key]) && $meta_value === self::$defaults[$meta_key] );
|
367 |
-
}
|
368 |
-
|
369 |
public static function get_value($key, $postid = 0) {
|
370 |
global $post;
|
371 |
|
@@ -378,7 +172,7 @@ class WPMSEO_Meta {
|
|
378 |
}
|
379 |
}
|
380 |
|
381 |
-
$custom = get_post_custom($postid);
|
382 |
|
383 |
if (isset($custom[self::$meta_prefix . $key][0])) {
|
384 |
$unserialized = maybe_unserialize($custom[self::$meta_prefix . $key][0]);
|
@@ -389,7 +183,6 @@ class WPMSEO_Meta {
|
|
389 |
}
|
390 |
}
|
391 |
|
392 |
-
// Meta was either not found or found, but object/array while not allowed to be.
|
393 |
if (isset(self::$defaults[self::$meta_prefix . $key])) {
|
394 |
return self::$defaults[self::$meta_prefix . $key];
|
395 |
} else {
|
@@ -400,184 +193,6 @@ class WPMSEO_Meta {
|
|
400 |
public static function set_value($key, $meta_value, $post_id) {
|
401 |
return update_post_meta($post_id, self::$meta_prefix . $key, $meta_value);
|
402 |
}
|
403 |
-
|
404 |
-
public static function replace_meta($old_metakey, $new_metakey, $delete_old = false) {
|
405 |
-
global $wpdb;
|
406 |
-
$query = $wpdb->prepare(
|
407 |
-
"
|
408 |
-
SELECT `a`.*
|
409 |
-
FROM {$wpdb->postmeta} AS a
|
410 |
-
WHERE `a`.`meta_key` = %s
|
411 |
-
AND NOT EXISTS (
|
412 |
-
SELECT DISTINCT `post_id` , count( `meta_id` ) AS count
|
413 |
-
FROM {$wpdb->postmeta} AS b
|
414 |
-
WHERE `a`.`post_id` = `b`.`post_id`
|
415 |
-
AND `meta_key` LIKE %s
|
416 |
-
AND `meta_key` <> %s
|
417 |
-
GROUP BY `post_id`
|
418 |
-
)
|
419 |
-
;", $old_metakey, $wpdb->esc_like(self::$meta_prefix . '%'), self::$meta_prefix . 'linkdex'
|
420 |
-
);
|
421 |
-
$oldies = $wpdb->get_results($query);
|
422 |
-
|
423 |
-
if (is_array($oldies) && $oldies !== array()) {
|
424 |
-
foreach ($oldies as $old) {
|
425 |
-
update_post_meta($old->post_id, $new_metakey, $old->meta_value);
|
426 |
-
}
|
427 |
-
}
|
428 |
-
|
429 |
-
// Delete old keys.
|
430 |
-
if ($delete_old === true) {
|
431 |
-
delete_post_meta_by_key($old_metakey);
|
432 |
-
}
|
433 |
-
}
|
434 |
-
|
435 |
-
public static function clean_up() {
|
436 |
-
global $wpdb;
|
437 |
-
$query = $wpdb->prepare(
|
438 |
-
"
|
439 |
-
SELECT `a`.*
|
440 |
-
FROM {$wpdb->postmeta} AS a
|
441 |
-
WHERE `a`.`meta_key` = %s
|
442 |
-
AND NOT EXISTS (
|
443 |
-
SELECT DISTINCT `post_id` , count( `meta_id` ) AS count
|
444 |
-
FROM {$wpdb->postmeta} AS b
|
445 |
-
WHERE `a`.`post_id` = `b`.`post_id`
|
446 |
-
AND ( `meta_key` = %s
|
447 |
-
OR `meta_key` = %s )
|
448 |
-
GROUP BY `post_id`
|
449 |
-
)
|
450 |
-
;", self::$meta_prefix . 'meta-robots', self::$meta_prefix . 'meta-robots-noindex', self::$meta_prefix . 'meta-robots-nofollow'
|
451 |
-
);
|
452 |
-
$oldies = $wpdb->get_results($query);
|
453 |
-
|
454 |
-
if (is_array($oldies) && $oldies !== array()) {
|
455 |
-
foreach ($oldies as $old) {
|
456 |
-
$old_values = explode(',', $old->meta_value);
|
457 |
-
foreach ($old_values as $value) {
|
458 |
-
if ($value === 'noindex') {
|
459 |
-
update_post_meta($old->post_id, self::$meta_prefix . 'meta-robots-noindex', 1);
|
460 |
-
} elseif ($value === 'nofollow') {
|
461 |
-
update_post_meta($old->post_id, self::$meta_prefix . 'meta-robots-nofollow', 1);
|
462 |
-
}
|
463 |
-
}
|
464 |
-
}
|
465 |
-
}
|
466 |
-
unset($query, $oldies, $old, $old_values, $value);
|
467 |
-
|
468 |
-
// Delete old keys.
|
469 |
-
delete_post_meta_by_key(self::$meta_prefix . 'meta-robots');
|
470 |
-
|
471 |
-
$query = array();
|
472 |
-
|
473 |
-
foreach (self::$meta_fields as $subset => $field_group) {
|
474 |
-
foreach ($field_group as $key => $field_def) {
|
475 |
-
if ($field_def['type'] === 'snippetpreview' || !isset($field_def['default_value'])) {
|
476 |
-
continue;
|
477 |
-
}
|
478 |
-
|
479 |
-
if ($key === 'meta-robots-adv') {
|
480 |
-
$query[] = $wpdb->prepare(
|
481 |
-
"( meta_key = %s AND ( meta_value = 'none' OR meta_value = '-' ) )", self::$meta_prefix . $key
|
482 |
-
);
|
483 |
-
} elseif (isset($field_def['options']) && is_array($field_def['options']) && $field_def['options'] !== array()) {
|
484 |
-
$valid = $field_def['options'];
|
485 |
-
// Remove the default value from the valid options.
|
486 |
-
unset($valid[$field_def['default_value']]);
|
487 |
-
$valid = array_keys($valid);
|
488 |
-
|
489 |
-
$query[] = $wpdb->prepare(
|
490 |
-
"( meta_key = %s AND meta_value NOT IN ( '" . implode("','", esc_sql($valid)) . "' ) )", self::$meta_prefix . $key
|
491 |
-
);
|
492 |
-
unset($valid);
|
493 |
-
} elseif (is_string($field_def['default_value']) && $field_def['default_value'] !== '') {
|
494 |
-
$query[] = $wpdb->prepare(
|
495 |
-
'( meta_key = %s AND meta_value = %s )', self::$meta_prefix . $key, $field_def['default_value']
|
496 |
-
);
|
497 |
-
} else {
|
498 |
-
$query[] = $wpdb->prepare(
|
499 |
-
"( meta_key = %s AND meta_value = '' )", self::$meta_prefix . $key
|
500 |
-
);
|
501 |
-
}
|
502 |
-
}
|
503 |
-
}
|
504 |
-
unset($subset, $field_group, $key, $field_def);
|
505 |
-
|
506 |
-
$query = "SELECT meta_id FROM {$wpdb->postmeta} WHERE " . implode(' OR ', $query) . ';';
|
507 |
-
$meta_ids = $wpdb->get_col($query);
|
508 |
-
|
509 |
-
if (is_array($meta_ids) && $meta_ids !== array()) {
|
510 |
-
// WP native action.
|
511 |
-
do_action('delete_post_meta', $meta_ids, null, null, null);
|
512 |
-
|
513 |
-
$query = "DELETE FROM {$wpdb->postmeta} WHERE meta_id IN( " . implode(',', $meta_ids) . ' )';
|
514 |
-
$count = $wpdb->query($query);
|
515 |
-
|
516 |
-
if ($count) {
|
517 |
-
foreach ($meta_ids as $object_id) {
|
518 |
-
wp_cache_delete($object_id, 'post_meta');
|
519 |
-
}
|
520 |
-
|
521 |
-
// WP native action.
|
522 |
-
do_action('deleted_post_meta', $meta_ids, null, null, null);
|
523 |
-
}
|
524 |
-
}
|
525 |
-
unset($query, $meta_ids, $count, $object_id);
|
526 |
-
|
527 |
-
$query = $wpdb->prepare(
|
528 |
-
"SELECT meta_id, meta_value FROM {$wpdb->postmeta} WHERE meta_key = %s", self::$meta_prefix . 'meta-robots-adv'
|
529 |
-
);
|
530 |
-
$oldies = $wpdb->get_results($query);
|
531 |
-
|
532 |
-
if (is_array($oldies) && $oldies !== array()) {
|
533 |
-
foreach ($oldies as $old) {
|
534 |
-
$clean = self::validate_meta_robots_adv($old->meta_value);
|
535 |
-
|
536 |
-
if ($clean !== $old->meta_value) {
|
537 |
-
if ($clean !== self::$meta_fields['advanced']['meta-robots-adv']['default_value']) {
|
538 |
-
update_metadata_by_mid('post', $old->meta_id, $clean);
|
539 |
-
} else {
|
540 |
-
delete_metadata_by_mid('post', $old->meta_id);
|
541 |
-
}
|
542 |
-
}
|
543 |
-
}
|
544 |
-
}
|
545 |
-
unset($query, $oldies, $old, $clean);
|
546 |
-
|
547 |
-
do_action('wpmseo_meta_clean_up');
|
548 |
-
}
|
549 |
-
|
550 |
-
public static function array_merge_recursive_distinct() {
|
551 |
-
|
552 |
-
$arrays = func_get_args();
|
553 |
-
if (count($arrays) < 2) {
|
554 |
-
if ($arrays === array()) {
|
555 |
-
return array();
|
556 |
-
} else {
|
557 |
-
return $arrays[0];
|
558 |
-
}
|
559 |
-
}
|
560 |
-
|
561 |
-
$merged = array_shift($arrays);
|
562 |
-
|
563 |
-
foreach ($arrays as $array) {
|
564 |
-
foreach ($array as $key => $value) {
|
565 |
-
if (is_array($value) && ( isset($merged[$key]) && is_array($merged[$key]) )) {
|
566 |
-
$merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value);
|
567 |
-
} else {
|
568 |
-
$merged[$key] = $value;
|
569 |
-
}
|
570 |
-
}
|
571 |
-
unset($key, $value);
|
572 |
-
}
|
573 |
-
|
574 |
-
return $merged;
|
575 |
-
}
|
576 |
-
|
577 |
-
public static function get_post_value($key) {
|
578 |
-
return ( array_key_exists($key, $_POST) ) ? $_POST[$key] : '';
|
579 |
-
}
|
580 |
-
|
581 |
}
|
582 |
|
583 |
/* End of class */
|
1 |
<?php
|
2 |
+
/* Based on some work of Yoast SEO plugin */
|
3 |
class WPMSEO_Meta {
|
4 |
|
5 |
public static $meta_prefix = '_metaseo_meta';
|
13 |
'general' => array(
|
14 |
'snippetpreview' => array(
|
15 |
'type' => 'snippetpreview',
|
16 |
+
'title' => '',
|
17 |
+
'help' => '',
|
18 |
),
|
19 |
'title' => array(
|
20 |
'type' => 'textarea',
|
21 |
+
'title' => '',
|
22 |
'default_value' => '',
|
23 |
+
'description' => '',
|
24 |
+
'help' => '',
|
25 |
'rows' => 2
|
26 |
),
|
27 |
'keywords' => array(
|
28 |
'type' => 'textarea',
|
29 |
+
'title' => '',
|
30 |
'default_value' => '',
|
31 |
+
'description' => '',
|
32 |
+
'help' => '',
|
33 |
'rows' => 2
|
34 |
),
|
35 |
'desc' => array(
|
36 |
'type' => 'textarea',
|
37 |
+
'title' => '',
|
38 |
'default_value' => '',
|
39 |
'class' => 'desc',
|
40 |
'rows' => 3,
|
41 |
+
'description' => '',
|
42 |
+
'help' => '',
|
43 |
),
|
44 |
'metaseo_chart' => array(
|
45 |
'type' => 'metaseo_chart',
|
46 |
+
'title' => '',
|
47 |
'default_value' => '',
|
48 |
'class' => 'metaseo_chart',
|
49 |
'rows' => 2,
|
50 |
+
'description' => '',
|
51 |
+
'help' => '',
|
52 |
),
|
53 |
),
|
54 |
'social' => array(
|
55 |
'opengraph-title' => array(
|
56 |
'type' => 'text',
|
57 |
+
'title' => '',
|
58 |
'default_value' => '',
|
59 |
+
'description' => '',
|
60 |
+
'help' => '',
|
61 |
),
|
62 |
'opengraph-desc' => array(
|
63 |
'type' => 'textarea',
|
64 |
+
'title' => '',
|
65 |
'default_value' => '',
|
66 |
'class' => 'desc',
|
67 |
'rows' => 3,
|
68 |
+
'description' => '',
|
69 |
+
'help' => '',
|
70 |
),
|
71 |
'opengraph-image' => array(
|
72 |
'type' => 'upload',
|
73 |
+
'title' => '',
|
74 |
'default_value' => '',
|
75 |
'class' => 'desc',
|
76 |
+
'description' => '',
|
77 |
+
'help' => '',
|
78 |
),
|
79 |
|
80 |
'twitter-title' => array(
|
81 |
'type' => 'text',
|
82 |
+
'title' => '',
|
83 |
'default_value' => '',
|
84 |
+
'description' => '',
|
85 |
+
'help' => '',
|
86 |
),
|
87 |
'twitter-desc' => array(
|
88 |
'type' => 'textarea',
|
89 |
+
'title' => '',
|
90 |
'default_value' => '',
|
91 |
'class' => 'desc',
|
92 |
'rows' => 3,
|
93 |
+
'description' => '',
|
94 |
+
'help' => '',
|
95 |
),
|
96 |
'twitter-image' => array(
|
97 |
'type' => 'upload',
|
98 |
+
'title' => '',
|
99 |
'default_value' => '',
|
100 |
'class' => 'desc',
|
101 |
+
'description' => '',
|
102 |
+
'help' => '',
|
103 |
),
|
104 |
|
105 |
),
|
106 |
+
|
107 |
'non_form' => array(
|
108 |
'linkdex' => array(
|
109 |
'type' => null,
|
135 |
}
|
136 |
|
137 |
$field_defs = self::$meta_fields[$tab];
|
|
|
138 |
switch ($tab) {
|
139 |
case 'non-form':
|
|
|
140 |
$field_defs = array();
|
141 |
break;
|
142 |
|
144 |
case 'general':
|
145 |
$options = get_option('wpmseo_titles');
|
146 |
if ($options['usemetakeywords'] === true) {
|
|
|
147 |
$field_defs['metakeywords']['description'] = sprintf($field_defs['metakeywords']['description'], '<a target="_blank" href="' . esc_url(admin_url('admin.php?page=wpmseo_titles#top#post_types')) . '">', '</a>');
|
148 |
} else {
|
|
|
149 |
unset($field_defs['metakeywords']);
|
150 |
}
|
151 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
$field_defs = apply_filters('wpmseo_metabox_entries', $field_defs);
|
153 |
break;
|
154 |
|
155 |
|
156 |
case 'advanced':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
break;
|
158 |
}
|
159 |
|
160 |
return apply_filters('wpmseo_metabox_entries_' . $tab, $field_defs, $post_type);
|
161 |
}
|
162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
public static function get_value($key, $postid = 0) {
|
164 |
global $post;
|
165 |
|
172 |
}
|
173 |
}
|
174 |
|
175 |
+
$custom = get_post_custom($postid);
|
176 |
|
177 |
if (isset($custom[self::$meta_prefix . $key][0])) {
|
178 |
$unserialized = maybe_unserialize($custom[self::$meta_prefix . $key][0]);
|
183 |
}
|
184 |
}
|
185 |
|
|
|
186 |
if (isset(self::$defaults[self::$meta_prefix . $key])) {
|
187 |
return self::$defaults[self::$meta_prefix . $key];
|
188 |
} else {
|
193 |
public static function set_value($key, $meta_value, $post_id) {
|
194 |
return update_post_meta($post_id, self::$meta_prefix . $key, $meta_value);
|
195 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
}
|
197 |
|
198 |
/* End of class */
|
inc/class.metaseo-metabox.php
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
<?php
|
2 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-meta.php' );
|
3 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-snippet-preview.php' );
|
4 |
-
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class-metaseo-mutils.php' );
|
5 |
|
6 |
class WPMSEO_Metabox extends WPMSEO_Meta {
|
7 |
|
@@ -28,7 +27,6 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
28 |
$post = get_post($post_id);
|
29 |
|
30 |
if (!is_object($post)) {
|
31 |
-
// Non-existent post.
|
32 |
return false;
|
33 |
}
|
34 |
|
@@ -36,7 +34,6 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
36 |
|
37 |
$meta_boxes = apply_filters('wpmseo_save_metaboxes', array());
|
38 |
$meta_boxes = array_merge($meta_boxes, $this->get_meta_field_defs('general', $post->post_type), $this->get_meta_field_defs('advanced'),$this->get_meta_field_defs('social'));
|
39 |
-
|
40 |
foreach ($meta_boxes as $key => $meta_box) {
|
41 |
$data = null;
|
42 |
if ('checkbox' === $meta_box['type']) {
|
@@ -608,7 +605,6 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
608 |
|
609 |
$output = '';
|
610 |
$circliful = ceil(100*($this->perc_score)/7);
|
611 |
-
//$output .= '<div class="metaseo_right"><div id="metaseo_circliful"data-dimension="250" data-text="'.$circliful.'%" data-info="" data-width="20" data-fontsize="38" data-percent="'.$circliful.'" data-fgcolor="#7bd095" data-bgcolor="#e5e5e5" style="color:#7bd095" ></div><div>';
|
612 |
$output .= '<div class="metaseo_left">
|
613 |
<div class="metaseo-progress-bar" data-post_id="'.$post->ID.'">
|
614 |
<canvas id="inactiveProgress" class="metaseo-progress-inactive" height="275px" width="275px"></canvas>
|
@@ -708,11 +704,7 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
708 |
|
709 |
case 'multiselect':
|
710 |
if (isset($meta_field_def['options']) && is_array($meta_field_def['options']) && $meta_field_def['options'] !== array()) {
|
711 |
-
|
712 |
-
// Set $meta_value as $selected_arr.
|
713 |
$selected_arr = $meta_value;
|
714 |
-
|
715 |
-
// If the multiselect field is 'meta-robots-adv' we should explode on ,.
|
716 |
if ('meta-robots-adv' === $key) {
|
717 |
$selected_arr = explode(',', $meta_value);
|
718 |
}
|
@@ -723,7 +715,6 @@ class WPMSEO_Metabox extends WPMSEO_Meta {
|
|
723 |
|
724 |
$options_count = count($meta_field_def['options']);
|
725 |
|
726 |
-
// @todo [JRF => whomever] verify height calculation for older WP versions, was 16x, for WP3.8 20x is more appropriate.
|
727 |
$content .= '<select multiple="multiple" size="' . esc_attr($options_count) . '" style="height: ' . esc_attr(( $options_count * 20 ) + 4) . 'px;" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="metaseo' . $class . '">';
|
728 |
foreach ($meta_field_def['options'] as $val => $option) {
|
729 |
$selected = '';
|
1 |
<?php
|
2 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-meta.php' );
|
3 |
require_once( WPMETASEO_PLUGIN_DIR . 'inc/class.metaseo-snippet-preview.php' );
|
|
|
4 |
|
5 |
class WPMSEO_Metabox extends WPMSEO_Meta {
|
6 |
|
27 |
$post = get_post($post_id);
|
28 |
|
29 |
if (!is_object($post)) {
|
|
|
30 |
return false;
|
31 |
}
|
32 |
|
34 |
|
35 |
$meta_boxes = apply_filters('wpmseo_save_metaboxes', array());
|
36 |
$meta_boxes = array_merge($meta_boxes, $this->get_meta_field_defs('general', $post->post_type), $this->get_meta_field_defs('advanced'),$this->get_meta_field_defs('social'));
|
|
|
37 |
foreach ($meta_boxes as $key => $meta_box) {
|
38 |
$data = null;
|
39 |
if ('checkbox' === $meta_box['type']) {
|
605 |
|
606 |
$output = '';
|
607 |
$circliful = ceil(100*($this->perc_score)/7);
|
|
|
608 |
$output .= '<div class="metaseo_left">
|
609 |
<div class="metaseo-progress-bar" data-post_id="'.$post->ID.'">
|
610 |
<canvas id="inactiveProgress" class="metaseo-progress-inactive" height="275px" width="275px"></canvas>
|
704 |
|
705 |
case 'multiselect':
|
706 |
if (isset($meta_field_def['options']) && is_array($meta_field_def['options']) && $meta_field_def['options'] !== array()) {
|
|
|
|
|
707 |
$selected_arr = $meta_value;
|
|
|
|
|
708 |
if ('meta-robots-adv' === $key) {
|
709 |
$selected_arr = explode(',', $meta_value);
|
710 |
}
|
715 |
|
716 |
$options_count = count($meta_field_def['options']);
|
717 |
|
|
|
718 |
$content .= '<select multiple="multiple" size="' . esc_attr($options_count) . '" style="height: ' . esc_attr(( $options_count * 20 ) + 4) . 'px;" name="' . $esc_form_key . '[]" id="' . $esc_form_key . '" class="metaseo' . $class . '">';
|
719 |
foreach ($meta_field_def['options'] as $val => $option) {
|
720 |
$selected = '';
|
inc/class.metaseo-snippet-preview.php
CHANGED
@@ -21,17 +21,10 @@ class WPMSEO_Snippet_Preview {
|
|
21 |
$this->set_content();
|
22 |
}
|
23 |
|
24 |
-
/**
|
25 |
-
* Getter for $this->content
|
26 |
-
* @return string html for snippet preview
|
27 |
-
*/
|
28 |
public function get_content() {
|
29 |
return $this->content;
|
30 |
}
|
31 |
|
32 |
-
/**
|
33 |
-
* Sets date if available
|
34 |
-
*/
|
35 |
protected function set_date() {
|
36 |
if (is_object($this->post) && isset($this->options['showdate-' . $this->post->post_type]) && $this->options['showdate-' . $this->post->post_type] === true) {
|
37 |
$date = $this->get_post_date();
|
@@ -39,11 +32,6 @@ class WPMSEO_Snippet_Preview {
|
|
39 |
}
|
40 |
}
|
41 |
|
42 |
-
/**
|
43 |
-
* Retrieves a post date when post is published, or return current date when it's not.
|
44 |
-
*
|
45 |
-
* @return string
|
46 |
-
*/
|
47 |
protected function get_post_date() {
|
48 |
if (isset($this->post->post_date) && $this->post->post_status == 'publish') {
|
49 |
$date = date_i18n('j M Y', strtotime($this->post->post_date));
|
@@ -54,19 +42,11 @@ class WPMSEO_Snippet_Preview {
|
|
54 |
return (string) $date;
|
55 |
}
|
56 |
|
57 |
-
/**
|
58 |
-
* Generates the url that is displayed in the snippet preview.
|
59 |
-
*/
|
60 |
protected function set_url() {
|
61 |
$this->url = str_replace(array('http://', 'https://'), '', get_bloginfo('url')) . '/';
|
62 |
$this->set_slug();
|
63 |
}
|
64 |
|
65 |
-
/**
|
66 |
-
* Sets the slug and adds it to the url if the post has been published and the post name exists.
|
67 |
-
*
|
68 |
-
* If the post is set to be the homepage the slug is also not included.
|
69 |
-
*/
|
70 |
protected function set_slug() {
|
71 |
$frontpage_post_id = (int) ( get_option('page_on_front') );
|
72 |
|
@@ -76,9 +56,6 @@ class WPMSEO_Snippet_Preview {
|
|
76 |
}
|
77 |
}
|
78 |
|
79 |
-
/**
|
80 |
-
* Generates the html for the snippet preview and assign it to $this->content.
|
81 |
-
*/
|
82 |
protected function set_content() {
|
83 |
$content = <<<HTML
|
84 |
<div id="wpmseosnippet">
|
@@ -90,11 +67,6 @@ HTML;
|
|
90 |
$this->set_content_through_filter($content);
|
91 |
}
|
92 |
|
93 |
-
/**
|
94 |
-
* Sets the html for the snippet preview through a filter
|
95 |
-
*
|
96 |
-
* @param string $content
|
97 |
-
*/
|
98 |
protected function set_content_through_filter($content) {
|
99 |
$properties = get_object_vars($this);
|
100 |
$properties['desc'] = $properties['description'];
|
21 |
$this->set_content();
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
24 |
public function get_content() {
|
25 |
return $this->content;
|
26 |
}
|
27 |
|
|
|
|
|
|
|
28 |
protected function set_date() {
|
29 |
if (is_object($this->post) && isset($this->options['showdate-' . $this->post->post_type]) && $this->options['showdate-' . $this->post->post_type] === true) {
|
30 |
$date = $this->get_post_date();
|
32 |
}
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
protected function get_post_date() {
|
36 |
if (isset($this->post->post_date) && $this->post->post_status == 'publish') {
|
37 |
$date = date_i18n('j M Y', strtotime($this->post->post_date));
|
42 |
return (string) $date;
|
43 |
}
|
44 |
|
|
|
|
|
|
|
45 |
protected function set_url() {
|
46 |
$this->url = str_replace(array('http://', 'https://'), '', get_bloginfo('url')) . '/';
|
47 |
$this->set_slug();
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
50 |
protected function set_slug() {
|
51 |
$frontpage_post_id = (int) ( get_option('page_on_front') );
|
52 |
|
56 |
}
|
57 |
}
|
58 |
|
|
|
|
|
|
|
59 |
protected function set_content() {
|
60 |
$content = <<<HTML
|
61 |
<div id="wpmseosnippet">
|
67 |
$this->set_content_through_filter($content);
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
protected function set_content_through_filter($content) {
|
71 |
$properties = get_object_vars($this);
|
72 |
$properties['desc'] = $properties['description'];
|
inc/pages/dashboard.php
CHANGED
@@ -25,6 +25,8 @@ if(!empty($results_image['imgs_metas_statis'][1])){
|
|
25 |
$percent_imeta = 100;
|
26 |
}
|
27 |
|
|
|
|
|
28 |
?>
|
29 |
<h1 style="text-align: center;"><?php _e('WP Meta SEO dashboard', 'wp-meta-seo') ?></h1>
|
30 |
<div class="dashboard">
|
@@ -206,6 +208,59 @@ if(!empty($results_image['imgs_metas_statis'][1])){
|
|
206 |
</div>
|
207 |
</div>
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
</div>
|
210 |
</div>
|
211 |
|
25 |
$percent_imeta = 100;
|
26 |
}
|
27 |
|
28 |
+
$plugin_imgRecycle_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.php';
|
29 |
+
|
30 |
?>
|
31 |
<h1 style="text-align: center;"><?php _e('WP Meta SEO dashboard', 'wp-meta-seo') ?></h1>
|
32 |
<div class="dashboard">
|
208 |
</div>
|
209 |
</div>
|
210 |
|
211 |
+
<?php if (file_exists(WP_PLUGIN_DIR . '/imagerecycle-pdf-image-compression')) : ?>
|
212 |
+
<?php
|
213 |
+
if (!is_plugin_active($plugin_imgRecycle_file)) :
|
214 |
+
?>
|
215 |
+
|
216 |
+
<div class="col-sm-6 metaseo_tool" alt="<?php _e('Images represent around 60% of a web page weight. An image compression reduce the image size by up to 70% while preserving the same visual quality. Small loading time is great for SEO!','wp-meta-seo') ?>">
|
217 |
+
<div class="panel panel-updates">
|
218 |
+
<div class="panel-body">
|
219 |
+
<div class="row">
|
220 |
+
<div class="col-xs-7 col-lg-8">
|
221 |
+
<h4 class="panel-title text-success"><?php _e('Image compression','wp-meta-seo') ?></h4>
|
222 |
+
<h3>0%</h3>
|
223 |
+
<div class="progress">
|
224 |
+
<div style="width:0%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" class="progress-bar progress-bar-success">
|
225 |
+
<span class="sr-only">0% Complete (success)</span>
|
226 |
+
</div>
|
227 |
+
</div>
|
228 |
+
<p><?php _e('Use ImageRecycle image compression plugin to activate this feature','wp-meta-seo') ?>: 0%</p>
|
229 |
+
</div>
|
230 |
+
<div class="col-xs-5 col-lg-4 text-right">
|
231 |
+
<input type="text" value="0" class="dial-success">
|
232 |
+
</div>
|
233 |
+
</div>
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
|
238 |
+
<?php else: ?>
|
239 |
+
<?php $optimizer_results = $dashboard->wpmf_getImages_count(); ?>
|
240 |
+
<div class="col-sm-6 metaseo_tool" alt="<?php _e('Images represent around 60% of a web page weight. An image compression reduce the image size by up to 70% while preserving the same visual quality. Small loading time is great for SEO!','wp-meta-seo') ?>">
|
241 |
+
<div class="panel panel-updates">
|
242 |
+
<div class="panel-body">
|
243 |
+
<div class="row">
|
244 |
+
<div class="col-xs-7 col-lg-8">
|
245 |
+
<h4 class="panel-title text-success"><?php _e('Image compression','wp-meta-seo') ?></h4>
|
246 |
+
<h3><?php echo $optimizer_results['percent'].'%' ?></h3>
|
247 |
+
<div class="progress">
|
248 |
+
<div style="width: <?php echo $optimizer_results['percent'].'%' ?>" aria-valuemax="100" aria-valuemin="0" aria-valuenow="<?php echo $optimizer_results['percent'] ?>" role="progressbar" class="progress-bar progress-bar-success">
|
249 |
+
<span class="sr-only"><?php echo $optimizer_results['percent'].'%' ?> Complete (success)</span>
|
250 |
+
</div>
|
251 |
+
</div>
|
252 |
+
<p><?php _e('Compressed images','wp-meta-seo') ?>: <?php echo $optimizer_results['image_optimize'].'/'.$optimizer_results['count_image'] ?></p>
|
253 |
+
</div>
|
254 |
+
<div class="col-xs-5 col-lg-4 text-right">
|
255 |
+
<input type="text" value="<?php echo $optimizer_results['percent'] ?>" class="dial-success">
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
</div>
|
259 |
+
</div>
|
260 |
+
</div>
|
261 |
+
<?php endif; ?>
|
262 |
+
<?php endif; ?>
|
263 |
+
|
264 |
</div>
|
265 |
</div>
|
266 |
|
inc/pages/metaseo-image-compression.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if (!defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes')))
|
3 |
+
define('IFRAME_REQUEST', true);
|
4 |
+
|
5 |
+
require_once( ABSPATH . 'wp-admin/admin.php' );
|
6 |
+
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
|
7 |
+
|
8 |
+
$slug = 'imagerecycle-pdf-image-compression';
|
9 |
+
$plugin_file = 'imagerecycle-pdf-image-compression/wp-image-recycle.php';
|
10 |
+
if (isset($_GET['action'])) {
|
11 |
+
$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
|
12 |
+
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
|
13 |
+
if ('install-plugin' == $action) {
|
14 |
+
|
15 |
+
if (!current_user_can('install_plugins'))
|
16 |
+
wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
|
17 |
+
|
18 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
|
19 |
+
|
20 |
+
check_admin_referer('install-plugin_' . $plugin);
|
21 |
+
$api = plugins_api('plugin_information', array(
|
22 |
+
'slug' => $plugin,
|
23 |
+
'fields' => array(
|
24 |
+
'short_description' => false,
|
25 |
+
'sections' => false,
|
26 |
+
'requires' => false,
|
27 |
+
'rating' => false,
|
28 |
+
'ratings' => false,
|
29 |
+
'downloaded' => false,
|
30 |
+
'last_updated' => false,
|
31 |
+
'added' => false,
|
32 |
+
'tags' => false,
|
33 |
+
'compatibility' => false,
|
34 |
+
'homepage' => false,
|
35 |
+
'donate_link' => false,
|
36 |
+
),
|
37 |
+
));
|
38 |
+
|
39 |
+
if (is_wp_error($api)) {
|
40 |
+
wp_die($api);
|
41 |
+
}
|
42 |
+
|
43 |
+
$title = __('Plugin Install');
|
44 |
+
$parent_file = 'plugins.php';
|
45 |
+
$submenu_file = 'plugin-install.php';
|
46 |
+
// require_once(ABSPATH . 'wp-admin/admin-header.php');
|
47 |
+
|
48 |
+
$title = sprintf(__('Installing Plugin: %s'), $api->name . ' ' . $api->version);
|
49 |
+
$nonce = 'install-plugin_' . $plugin;
|
50 |
+
$url = 'update.php?action=install-plugin&plugin=' . urlencode($plugin);
|
51 |
+
if (isset($_GET['from']))
|
52 |
+
$url .= '&from=' . urlencode(stripslashes($_GET['from']));
|
53 |
+
|
54 |
+
$type = 'web'; //Install plugin type, From Web or an Upload.
|
55 |
+
|
56 |
+
$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
|
57 |
+
$upgrader->install($api->download_link);
|
58 |
+
// include(ABSPATH . 'wp-admin/admin-footer.php');
|
59 |
+
}elseif ('activate' == $action) {
|
60 |
+
if (!current_user_can('activate_plugins'))
|
61 |
+
wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
|
62 |
+
|
63 |
+
if (is_multisite() && !is_network_admin() && is_network_only_plugin($plugin)) {
|
64 |
+
wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
|
65 |
+
exit;
|
66 |
+
}
|
67 |
+
|
68 |
+
check_admin_referer('activate-plugin_' . $plugin);
|
69 |
+
|
70 |
+
$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin());
|
71 |
+
if (is_wp_error($result)) {
|
72 |
+
if ('unexpected_output' == $result->get_error_code()) {
|
73 |
+
$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
|
74 |
+
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
|
75 |
+
exit;
|
76 |
+
} else {
|
77 |
+
wp_die($result);
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
if (!is_network_admin()) {
|
82 |
+
$recent = (array) get_option('recently_activated');
|
83 |
+
unset($recent[$plugin]);
|
84 |
+
update_option('recently_activated', $recent);
|
85 |
+
} else {
|
86 |
+
$recent = (array) get_site_option('recently_activated');
|
87 |
+
unset($recent[$plugin]);
|
88 |
+
update_site_option('recently_activated', $recent);
|
89 |
+
}
|
90 |
+
|
91 |
+
if (isset($_GET['from']) && 'import' == $_GET['from']) {
|
92 |
+
wp_redirect(self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
|
93 |
+
} else {
|
94 |
+
wp_redirect(self_admin_url("admin.php?page=metaseo_image_compression&wpmsactive=imagerecycle")); // overrides the ?error=true one above
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
$button = '';
|
99 |
+
$check_install = false;
|
100 |
+
if (!file_exists(WP_PLUGIN_DIR . '/imagerecycle-pdf-image-compression')) {
|
101 |
+
$url = wp_nonce_url(self_admin_url('admin.php?page=metaseo_image_compression&action=install-plugin&plugin=' . $slug), 'install-plugin_' . $slug);
|
102 |
+
if (is_multisite()) {
|
103 |
+
if (current_user_can('manage_network_plugins')) {
|
104 |
+
$button = '<a style="float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center; color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 5px 20px; font-weight:bold;" target="_blank" class="edit" data-slug="imagerecycle-pdf-image-compression" href="' . $url . '" aria-label="Install ImageRecycle pdf & image compression 2.1.1 now" data-name="ImageRecycle pdf & image compression 2.1.1">' . __('Install ImageRecycle plugin', 'wp-meta-seo') . '</a>';
|
105 |
+
}
|
106 |
+
} else {
|
107 |
+
$button = '<a style="float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center;color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 5px 20px; font-weight:bold;" target="_blank" class="edit" data-slug="imagerecycle-pdf-image-compression" href="' . $url . '" aria-label="Install ImageRecycle pdf & image compression 2.1.1 now" data-name="ImageRecycle pdf & image compression 2.1.1">' . __('Install ImageRecycle plugin', 'wp-meta-seo') . '</a>';
|
108 |
+
}
|
109 |
+
} else {
|
110 |
+
if (!is_plugin_active($plugin_file)) {
|
111 |
+
$url = wp_nonce_url('admin.php?page=metaseo_image_compression&action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file);
|
112 |
+
if (is_multisite()) {
|
113 |
+
if (current_user_can('manage_network_plugins')) {
|
114 |
+
$button = '<a style="float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center; color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 5px 20px; font-weight:bold;" href="' . $url . '" class="edit" aria-label="Activate ImageRecycle pdf & image compression">' . __('Activate Plugin', 'wp-meta-seo') . '</a>';
|
115 |
+
}
|
116 |
+
} else {
|
117 |
+
$button = '<a style="float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center;color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 5px 20px; font-weight:bold;" href="' . $url . '" class="edit" aria-label="Activate ImageRecycle pdf & image compression">' . __('Activate Plugin', 'wp-meta-seo') . '</a>';
|
118 |
+
}
|
119 |
+
} else {
|
120 |
+
$check_install = true;
|
121 |
+
$button = '<a style="width: 250px; float: right; background: #554766; font-size: 12px; line-height: 18px; text-align: center; margin-left:4px;color: #fff;font-size: 14px;text-decoration: none; text-transform: uppercase; padding: 8px 20px; font-weight:bold;" class="edit" href="upload.php?page=wp-image-recycle-page" aria-label="Activate ImageRecycle pdf & image compression">' . __('ImageRecycle is properly installed: manage images', 'wp-meta-seo') . '</a>';
|
122 |
+
}
|
123 |
+
}
|
124 |
+
?>
|
125 |
+
|
126 |
+
<?php if($check_install == true): ?>
|
127 |
+
<div class="main-presentation" style="margin: 0px auto; max-width: 1200px; background-color:#f0f1f4;font-family: helvetica,arial,sans-serif;">
|
128 |
+
<div class="main-textcontent" style="margin: 0px auto; min-height: 400px; border-left: 1px dotted #d2d3d5; border-right: 1px dotted #d2d3d5; width: 840px; background-color:#fff;border-top: 5px solid #544766;" cellspacing="0" cellpadding="0" align="center">
|
129 |
+
<a href="https://www.imagerecycle.com/" target="_blank"> <img src="https://www.imagerecycle.com/images/Notification-mail/logo-image-recycle.png" alt="logo image recycle" width="500" height="84" class="CToWUd" style="display: block; outline: medium none; text-decoration: none; margin-left: auto; margin-right: auto; margin-top:15px;"> </a>
|
130 |
+
<p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 24px; line-height: 24px; padding-right: 10px; padding-left: 10px;" align="center"><strong>Great! ImageRecycle is installed<br></strong></p>
|
131 |
+
<p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 14px; line-height: 22px; padding-left: 20px; padding-right: 20px; text-align: center;">
|
132 |
+
<strong>Speed optimization of your WordPress website is highly recommended for SEO. The image compression is one of the tools that help to reduce your page size significantly while preserving the image quality.<br /><br />You can now manage all you images and compression from the ImageRecycle plugin, menu Media > ImageRecycle.<br /><br /></strong> ImageRecycle got a dedicated plugin for WordPress that run the images optimization automatically on your website & PDF
|
133 |
+
<br />In order to start the optimization process, please install the WordPress plugin. Enjoy!</p>
|
134 |
+
<p></p>
|
135 |
+
<p><?php echo $button; ?></p>
|
136 |
+
</div>
|
137 |
+
</div>
|
138 |
+
<?php else: ?>
|
139 |
+
|
140 |
+
<div class="main-presentation" style="margin: 0px auto; max-width: 1200px; background-color:#f0f1f4;font-family: helvetica,arial,sans-serif;">
|
141 |
+
<div class="main-textcontent" style="margin: 0px auto; min-height: 400px; border-left: 1px dotted #d2d3d5; border-right: 1px dotted #d2d3d5; width: 840px; background-color:#fff;border-top: 5px solid #544766;" cellspacing="0" cellpadding="0" align="center">
|
142 |
+
<a href="https://www.imagerecycle.com/" target="_blank"> <img src="https://www.imagerecycle.com/images/Notification-mail/logo-image-recycle.png" alt="logo image recycle" width="500" height="84" class="CToWUd" style="display: block; outline: medium none; text-decoration: none; margin-left: auto; margin-right: auto; margin-top:15px;"> </a>
|
143 |
+
<p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 24px; line-height: 24px; padding-right: 10px; padding-left: 10px;" align="center"><strong>Welcome on board!<br></strong></p>
|
144 |
+
<p style="background-color: #ffffff; color: #445566; font-family: helvetica,arial,sans-serif; font-size: 14px; line-height: 22px; padding-left: 20px; padding-right: 20px; text-align: center;">
|
145 |
+
<strong>Speed optimization of your WordPress website is highly recommended for SEO. The image compression is one of the tools that help to reduce your page size significantly while preserving the image quality.<br /><br />WP Meta SEO is fully integrated with ImageRecycle service, give a try, you have a free trial with no engagement or just make a test on an image here: <a href="https://www.imagerecycle.com/" target="_blank">www.imagerecycle.com</a><br /><br /></strong>
|
146 |
+
ImageRecycle got a dedicated plugin for WordPress that run the images optimization automatically on your website & PDF<br />In order to start the optimization process, please install the WordPress plugin. Enjoy!</p>
|
147 |
+
<p></p>
|
148 |
+
<p><?php echo $button; ?></p>
|
149 |
+
</div>
|
150 |
+
</div>
|
151 |
+
|
152 |
+
<?php endif; ?>
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: JoomUnited
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.
|
6 |
-
Stable tag: 2.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -89,7 +89,8 @@ The redirect manager will help you to fix all types of 404 errors you can encoun
|
|
89 |
* Custom post type meta edition
|
90 |
* All custom post type and WooCommerce SEO optimization
|
91 |
* Yoast SEO import & sync
|
92 |
-
* All in one SEO importer and sync
|
|
|
93 |
* Alexa traffic rank
|
94 |
* Meta content filtering by type
|
95 |
* Optimize images and replace all inside your content
|
@@ -202,6 +203,9 @@ This manual SEO validation on click on the reload analysis button.
|
|
202 |
|
203 |
== Changelog ==
|
204 |
|
|
|
|
|
|
|
205 |
= 2.0.3 =
|
206 |
* Fix On page analysis return wrong result on header title in content
|
207 |
* Fix Update language on image bluk edit view
|
@@ -306,10 +310,10 @@ You WON'T lose any SEO content: meta, alt, titles...
|
|
306 |
|
307 |
== Requirements ==
|
308 |
|
309 |
-
= !!NEW in latest & fresh 1
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
|
314 |
= SEO vision =
|
315 |
|
2 |
Contributors: JoomUnited
|
3 |
Tags: google, webmaster tools, keywords, meta, meta description, meta keywords, meta title, robots meta, search engine optimization, seo, wordpress seo, yahoo, image optimization, image resize, custom post seo, redirect, redirection, 301, broken link
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.5.0
|
6 |
+
Stable tag: 2.1.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
89 |
* Custom post type meta edition
|
90 |
* All custom post type and WooCommerce SEO optimization
|
91 |
* Yoast SEO import & sync
|
92 |
+
* All in one SEO importer and sync
|
93 |
+
* ImageRecycle image compression integration
|
94 |
* Alexa traffic rank
|
95 |
* Meta content filtering by type
|
96 |
* Optimize images and replace all inside your content
|
203 |
|
204 |
== Changelog ==
|
205 |
|
206 |
+
= 2.1.0 =
|
207 |
+
* Add ImageRecycle images and PDF compression integration (www.imagerecycle.com)
|
208 |
+
|
209 |
= 2.0.3 =
|
210 |
* Fix On page analysis return wrong result on header title in content
|
211 |
* Fix Update language on image bluk edit view
|
310 |
|
311 |
== Requirements ==
|
312 |
|
313 |
+
= !!NEW in latest & fresh 2.1 version!! =
|
314 |
+
Speed optimization of your WordPress website is highly recommended for SEO. The image compression is one of the tools that help to reduce your page size significantly while preserving the image quality.
|
315 |
+
You can now manage all you images and compression from the ImageRecycle plugin, menu Media > ImageRecycle.
|
316 |
+
ImageRecycle got a dedicated plugin for WordPress that run the images optimization automatically on your website & PDF. In order to start the optimization process, please install the WordPress plugin. Enjoy!
|
317 |
|
318 |
= SEO vision =
|
319 |
|
wp-meta-seo.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
-
* Version: 2.0
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
@@ -172,22 +172,33 @@ if (is_admin()) {
|
|
172 |
$meta_facebook_image = get_post_meta($wp_query->post->ID,'_metaseo_metaopengraph-image',true);
|
173 |
|
174 |
// check homepage is latest post
|
175 |
-
if(
|
176 |
-
$
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
$
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
|
|
|
|
|
|
189 |
}
|
190 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
if ( is_category() || is_tag() || is_tax() ) {
|
193 |
$term = $wp_query->get_queried_object();
|
@@ -220,7 +231,7 @@ if (is_admin()) {
|
|
220 |
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
221 |
'<meta name="twitter:title" content="' . $meta_twitter_title . '" />',
|
222 |
($meta_twitter_title != '' ? true : false)),
|
223 |
-
'_title' => array('
|
224 |
($meta_title != '' ? true : false)),
|
225 |
'facebook_admin' => array(
|
226 |
'#<meta property="fb:admins" [^<>]+ ?>#i',
|
4 |
* Plugin Name: WP Meta SEO
|
5 |
* Plugin URI: http://www.joomunited.com/wordpress-products/wp-meta-seo
|
6 |
* Description: WP Meta SEO is a plugin for WordPress to fill meta for content, images and main SEO info in a single view.
|
7 |
+
* Version: 2.1.0
|
8 |
* Text Domain: wp-meta-seo
|
9 |
* Domain Path: /languages
|
10 |
* Author: JoomUnited
|
172 |
$meta_facebook_image = get_post_meta($wp_query->post->ID,'_metaseo_metaopengraph-image',true);
|
173 |
|
174 |
// check homepage is latest post
|
175 |
+
if(is_home()){
|
176 |
+
if($mshow_on_front == 'posts'){
|
177 |
+
$settings_title_home = esc_attr($settings['metaseo_title_home']);
|
178 |
+
$settings_desc_home = esc_attr($settings['metaseo_desc_home']);
|
179 |
+
if($settings_title_home != maybe_unserialize($settings_title_home)) $settings_title_home = '';
|
180 |
+
if($settings_desc_home != maybe_unserialize($settings_desc_home)) $settings_desc_home = '';
|
181 |
+
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = $settings_title_home;
|
182 |
+
$meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = $settings_desc_home;
|
183 |
+
|
184 |
+
if($settings['metaseo_title_home'] == ''){
|
185 |
+
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = esc_attr(get_bloginfo('name').' - '.get_bloginfo('description'));
|
186 |
+
}
|
187 |
+
|
188 |
+
if($settings['metaseo_desc_home'] == ''){
|
189 |
+
$meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = esc_attr(get_bloginfo('description'));
|
190 |
+
}
|
191 |
+
}elseif($mshow_on_front == 'page'){ // is page posts
|
192 |
+
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metatitle', true));
|
193 |
+
$meta_description = $meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = esc_attr(get_post_meta($mpage_for_posts, '_metaseo_metadesc', true));
|
194 |
}
|
195 |
}
|
196 |
+
|
197 |
+
// is front page
|
198 |
+
if(is_front_page()){
|
199 |
+
$meta_title = $meta_title_esc = $meta_twitter_title = $meta_facebook_title = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metatitle', true));
|
200 |
+
$meta_description = $meta_description_esc = $meta_twitter_desc = $meta_facebook_desc = esc_attr(get_post_meta($mpage_on_front, '_metaseo_metadesc', true));
|
201 |
+
}
|
202 |
|
203 |
if ( is_category() || is_tag() || is_tax() ) {
|
204 |
$term = $wp_query->get_queried_object();
|
231 |
'#<meta name="twitter:title" [^<>]+ ?>#i',
|
232 |
'<meta name="twitter:title" content="' . $meta_twitter_title . '" />',
|
233 |
($meta_twitter_title != '' ? true : false)),
|
234 |
+
'_title' => array('/<title.*?\/title>/i', '<title>' . $meta_title . '</title>',
|
235 |
($meta_title != '' ? true : false)),
|
236 |
'facebook_admin' => array(
|
237 |
'#<meta property="fb:admins" [^<>]+ ?>#i',
|