Version Description
- Code optimization and improvements
- Added a new auto title for links function (pro only)
=
Download this release
Release Info
Developer | PascalBajorat |
Plugin | PB SEO Friendly Images |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.0 to 1.3.0
- inc/pbSettingsFramework.php +75 -23
- inc/settings.php +29 -2
- lang/pb-seo-friendly-images-de_DE.mo +0 -0
- lang/pb-seo-friendly-images-de_DE.po +24 -6
- lang/pb-seo-friendly-images.pot +19 -5
- pb-seo-friendly-images.php +20 -21
- readme.txt +7 -3
inc/pbSettingsFramework.php
CHANGED
@@ -1,22 +1,26 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
*/
|
8 |
|
9 |
if( ! class_exists('pbSettingsFramework') ):
|
10 |
class pbSettingsFramework
|
11 |
{
|
12 |
-
const version = '1.
|
13 |
static $textDomain = false;
|
14 |
static $page = false;
|
15 |
static $section = false;
|
16 |
static $optionGroup = false;
|
17 |
-
static $args =
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
{
|
21 |
self::$textDomain = $args['text-domain'] || 'pbSettingsFramework';
|
22 |
self::$page = $args['page'];
|
@@ -25,15 +29,27 @@ if( ! class_exists('pbSettingsFramework') ):
|
|
25 |
self::$args = $args;
|
26 |
}
|
27 |
|
|
|
|
|
|
|
|
|
|
|
28 |
public static function registerSetting($setting)
|
29 |
{
|
30 |
-
if(
|
31 |
die(__FUNCTION__.': $args[\'option-group\'] not set!');
|
32 |
}
|
33 |
|
34 |
return register_setting(self::$args['option-group'], $setting);
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
public static function addSettingsSection($id, $title, $callback)
|
38 |
{
|
39 |
add_settings_section(
|
@@ -44,6 +60,15 @@ if( ! class_exists('pbSettingsFramework') ):
|
|
44 |
);
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
public static function addSettingsField($id, $title, $args, $callback=array(__CLASS__, 'fieldsHTML'), $register_setting=true)
|
48 |
{
|
49 |
if( $register_setting )
|
@@ -67,49 +92,76 @@ if( ! class_exists('pbSettingsFramework') ):
|
|
67 |
);
|
68 |
}
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
public static function fieldsHTML( $args )
|
71 |
{
|
72 |
$option = get_option($args['id']);
|
73 |
$html = '';
|
74 |
|
75 |
-
if(
|
76 |
|
77 |
if ( empty( $option ) ) {
|
78 |
-
$val =
|
79 |
} else {
|
80 |
$val = $option;
|
81 |
}
|
82 |
-
$html = '<input type="text" id="' . $args['id'] . '" name="' . $args['id'] . '" class="regular-text" value="' . $val . '" '.((
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
} elseif( $args['type'] == 'checkbox' ) {
|
88 |
|
89 |
if( $option === false ){
|
90 |
-
$val =
|
91 |
}else{
|
92 |
$val = $option;
|
93 |
}
|
94 |
-
$html = '<input type="checkbox" id="'.$args['id'].'" name="'.$args['id'].'" value="1" '.((
|
95 |
-
|
|
|
96 |
|
97 |
} elseif( $args['type'] == 'select' ) {
|
98 |
|
99 |
if ( empty( $option ) ) {
|
100 |
-
$val =
|
101 |
} else {
|
102 |
$val = $option;
|
103 |
}
|
104 |
|
105 |
$html = '<select id="'.$args['id'].'" name="'.$args['id'].'">';
|
106 |
foreach ($args['select'] as $name => $value ) {
|
107 |
-
$html .= '<option value="'.$name.'" '.(($val==$name)?'selected="selected"':'').' '.((
|
108 |
}
|
109 |
$html .= '</select>';
|
110 |
|
111 |
-
|
112 |
-
|
|
|
|
|
113 |
}
|
114 |
|
115 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
/* Security-Check */
|
4 |
+
if ( !class_exists('WP') ) {
|
5 |
+
die();
|
6 |
+
}
|
|
|
7 |
|
8 |
if( ! class_exists('pbSettingsFramework') ):
|
9 |
class pbSettingsFramework
|
10 |
{
|
11 |
+
const version = '1.1.0';
|
12 |
static $textDomain = false;
|
13 |
static $page = false;
|
14 |
static $section = false;
|
15 |
static $optionGroup = false;
|
16 |
+
static $args = array();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* pbSettingsFramework constructor.
|
20 |
+
*
|
21 |
+
* @param array $args
|
22 |
+
*/
|
23 |
+
public function __construct($args=array())
|
24 |
{
|
25 |
self::$textDomain = $args['text-domain'] || 'pbSettingsFramework';
|
26 |
self::$page = $args['page'];
|
29 |
self::$args = $args;
|
30 |
}
|
31 |
|
32 |
+
/**
|
33 |
+
* Register setting
|
34 |
+
*
|
35 |
+
* @param array $setting
|
36 |
+
*/
|
37 |
public static function registerSetting($setting)
|
38 |
{
|
39 |
+
if( ! isset(self::$args['option-group']) ) {
|
40 |
die(__FUNCTION__.': $args[\'option-group\'] not set!');
|
41 |
}
|
42 |
|
43 |
return register_setting(self::$args['option-group'], $setting);
|
44 |
}
|
45 |
|
46 |
+
/**
|
47 |
+
* Add settings section
|
48 |
+
*
|
49 |
+
* @param $id
|
50 |
+
* @param $title
|
51 |
+
* @param $callback
|
52 |
+
*/
|
53 |
public static function addSettingsSection($id, $title, $callback)
|
54 |
{
|
55 |
add_settings_section(
|
60 |
);
|
61 |
}
|
62 |
|
63 |
+
/**
|
64 |
+
* Add settings field
|
65 |
+
*
|
66 |
+
* @param $id
|
67 |
+
* @param $title
|
68 |
+
* @param $args
|
69 |
+
* @param array $callback
|
70 |
+
* @param bool $register_setting
|
71 |
+
*/
|
72 |
public static function addSettingsField($id, $title, $args, $callback=array(__CLASS__, 'fieldsHTML'), $register_setting=true)
|
73 |
{
|
74 |
if( $register_setting )
|
92 |
);
|
93 |
}
|
94 |
|
95 |
+
/**
|
96 |
+
* get array key
|
97 |
+
*
|
98 |
+
* @param $key
|
99 |
+
* @param $array
|
100 |
+
* @return bool
|
101 |
+
*/
|
102 |
+
public static function getArrayKey($key, $array)
|
103 |
+
{
|
104 |
+
if( array_key_exists($key, $array) ) {
|
105 |
+
return $array[$key];
|
106 |
+
} else {
|
107 |
+
return false;
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* html code for fields
|
113 |
+
*
|
114 |
+
* @param $args
|
115 |
+
*/
|
116 |
public static function fieldsHTML( $args )
|
117 |
{
|
118 |
$option = get_option($args['id']);
|
119 |
$html = '';
|
120 |
|
121 |
+
if( self::getArrayKey('type', $args) == 'text' ) {
|
122 |
|
123 |
if ( empty( $option ) ) {
|
124 |
+
$val = self::getArrayKey('default', $args);
|
125 |
} else {
|
126 |
$val = $option;
|
127 |
}
|
128 |
+
$html = '<input type="text" id="' . $args['id'] . '" name="' . $args['id'] . '" class="regular-text" value="' . $val . '" '.((self::getArrayKey('disabled', $args))?'disabled="disabled"':'').' />';
|
129 |
+
|
130 |
+
$desc = self::getArrayKey('desc', $args);
|
131 |
+
|
132 |
+
if ( ! empty( $desc ) ) {
|
133 |
+
$html .= '<p class="description">' . $desc . '</p>';
|
134 |
}
|
135 |
|
136 |
} elseif( $args['type'] == 'checkbox' ) {
|
137 |
|
138 |
if( $option === false ){
|
139 |
+
$val = self::getArrayKey('default', $args);
|
140 |
}else{
|
141 |
$val = $option;
|
142 |
}
|
143 |
+
$html = '<input type="checkbox" id="'.$args['id'].'" name="'.$args['id'].'" value="1" '.((self::getArrayKey('disabled', $args))?'disabled="disabled"':'').' '.checked(1, $val, false).'/>';
|
144 |
+
|
145 |
+
$html .= '<label for="'.$args['id'].'"> '. self::getArrayKey('desc', $args) .'</label>';
|
146 |
|
147 |
} elseif( $args['type'] == 'select' ) {
|
148 |
|
149 |
if ( empty( $option ) ) {
|
150 |
+
$val = self::getArrayKey('default', $args);
|
151 |
} else {
|
152 |
$val = $option;
|
153 |
}
|
154 |
|
155 |
$html = '<select id="'.$args['id'].'" name="'.$args['id'].'">';
|
156 |
foreach ($args['select'] as $name => $value ) {
|
157 |
+
$html .= '<option value="'.$name.'" '.(($val==$name)?'selected="selected"':'').' '.((self::getArrayKey('disabled', $args))?'disabled="disabled"':'').'>'.esc_html($value).'</option>';
|
158 |
}
|
159 |
$html .= '</select>';
|
160 |
|
161 |
+
$desc = self::getArrayKey('desc', $args);
|
162 |
+
|
163 |
+
if ( ! empty( $desc ) ) {
|
164 |
+
$html .= '<p class="description">' . $desc . '</p>';
|
165 |
}
|
166 |
|
167 |
}
|
inc/settings.php
CHANGED
@@ -10,7 +10,7 @@ if( !class_exists('pbSEOFriendlyImagesSettings') ):
|
|
10 |
{
|
11 |
public static $settings = false;
|
12 |
|
13 |
-
function addSettings()
|
14 |
{
|
15 |
add_action('admin_menu', array(__CLASS__, 'optionsPageMenu'));
|
16 |
add_action('admin_init', array(__CLASS__, 'initSettings'));
|
@@ -272,6 +272,33 @@ if( !class_exists('pbSEOFriendlyImagesSettings') ):
|
|
272 |
)
|
273 |
);
|
274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
self::$settings->addSettingsField(
|
276 |
'pbsfi_disable_srcset',
|
277 |
__('disable srcset', 'pb-seo-friendly-images'),
|
@@ -296,7 +323,7 @@ if( !class_exists('pbSEOFriendlyImagesSettings') ):
|
|
296 |
);
|
297 |
}
|
298 |
|
299 |
-
function optionsPage()
|
300 |
{
|
301 |
if (!current_user_can('manage_options')) {
|
302 |
return;
|
10 |
{
|
11 |
public static $settings = false;
|
12 |
|
13 |
+
public static function addSettings()
|
14 |
{
|
15 |
add_action('admin_menu', array(__CLASS__, 'optionsPageMenu'));
|
16 |
add_action('admin_init', array(__CLASS__, 'initSettings'));
|
272 |
)
|
273 |
);
|
274 |
|
275 |
+
/**
|
276 |
+
* Section Pro 2
|
277 |
+
*/
|
278 |
+
self::$settings = new pbSettingsFramework(array(
|
279 |
+
'text-domain' => 'pb-seo-friendly-images',
|
280 |
+
'page' => 'pb-seo-friendly-images',
|
281 |
+
'section' => 'pb-seo-friendly-images-pro2',
|
282 |
+
'option-group' => 'pb-seo-friendly-images'
|
283 |
+
));
|
284 |
+
|
285 |
+
self::$settings->addSettingsSection(
|
286 |
+
'pb-seo-friendly-images-pro2',
|
287 |
+
__('Additional features', 'pb-seo-friendly-images'),
|
288 |
+
function(){}
|
289 |
+
);
|
290 |
+
|
291 |
+
self::$settings->addSettingsField(
|
292 |
+
'pbsfi_link_title',
|
293 |
+
__('set title for links', 'pb-seo-friendly-images'),
|
294 |
+
array(
|
295 |
+
'type' => 'checkbox',
|
296 |
+
'default' => false,
|
297 |
+
'desc' => __('Use the power of PB SEO Friendly Images also for seo friendly links. This will set the title depending on the link text and only if there is no existing title', 'pb-seo-friendly-images'),
|
298 |
+
'disabled' => ((self::$proVersion)?false:true)
|
299 |
+
)
|
300 |
+
);
|
301 |
+
|
302 |
self::$settings->addSettingsField(
|
303 |
'pbsfi_disable_srcset',
|
304 |
__('disable srcset', 'pb-seo-friendly-images'),
|
323 |
);
|
324 |
}
|
325 |
|
326 |
+
public static function optionsPage()
|
327 |
{
|
328 |
if (!current_user_can('manage_options')) {
|
329 |
return;
|
lang/pb-seo-friendly-images-de_DE.mo
CHANGED
Binary file
|
lang/pb-seo-friendly-images-de_DE.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: PB SEO Friendly Images\n"
|
4 |
-
"POT-Creation-Date: 2017-01-
|
5 |
-
"PO-Revision-Date: 2017-01-
|
6 |
"Last-Translator: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
7 |
"Language-Team: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
8 |
"Language: de\n"
|
@@ -326,11 +326,29 @@ msgstr ""
|
|
326 |
"sagen wir 200px vor dem Viewport, dann müssen <code>200</code> als Feldwert "
|
327 |
"gesetzt werden."
|
328 |
|
329 |
-
#: inc/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
msgid "disable srcset"
|
331 |
msgstr "srcset ausschalten"
|
332 |
|
333 |
-
#: inc/settings.php:
|
334 |
msgid ""
|
335 |
"disable srcset attribute and responsive images in WordPress if you don't "
|
336 |
"need them"
|
@@ -339,11 +357,11 @@ msgstr ""
|
|
339 |
"diese nicht benötigst"
|
340 |
|
341 |
#. Plugin Name of the plugin/theme
|
342 |
-
#: inc/settings.php:
|
343 |
msgid "PB SEO Friendly Images"
|
344 |
msgstr "PB SEO Friendly Images"
|
345 |
|
346 |
-
#: inc/settings.php:
|
347 |
msgid "SEO Friendly Images"
|
348 |
msgstr "SEO Friendly Images"
|
349 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: PB SEO Friendly Images\n"
|
4 |
+
"POT-Creation-Date: 2017-01-27 18:11+0100\n"
|
5 |
+
"PO-Revision-Date: 2017-01-27 18:15+0100\n"
|
6 |
"Last-Translator: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
7 |
"Language-Team: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
8 |
"Language: de\n"
|
326 |
"sagen wir 200px vor dem Viewport, dann müssen <code>200</code> als Feldwert "
|
327 |
"gesetzt werden."
|
328 |
|
329 |
+
#: inc/settings.php:287
|
330 |
+
msgid "Additional features"
|
331 |
+
msgstr "Zusatzfunktionen"
|
332 |
+
|
333 |
+
#: inc/settings.php:293
|
334 |
+
msgid "set title for links"
|
335 |
+
msgstr "Title für Links setzen"
|
336 |
+
|
337 |
+
#: inc/settings.php:297
|
338 |
+
msgid ""
|
339 |
+
"Use the power of PB SEO Friendly Images also for seo friendly links. This "
|
340 |
+
"will set the title depending on the link text and only if there is no "
|
341 |
+
"existing title"
|
342 |
+
msgstr ""
|
343 |
+
"Nutze die Power von PB SEO Friendly Images ebenfalls für die Titel deiner "
|
344 |
+
"Links. Das Tool wird nicht vergebene Linktitel automatisch auf Basis der "
|
345 |
+
"Linktexte oder enthaltener Bilder setzen"
|
346 |
+
|
347 |
+
#: inc/settings.php:304
|
348 |
msgid "disable srcset"
|
349 |
msgstr "srcset ausschalten"
|
350 |
|
351 |
+
#: inc/settings.php:308
|
352 |
msgid ""
|
353 |
"disable srcset attribute and responsive images in WordPress if you don't "
|
354 |
"need them"
|
357 |
"diese nicht benötigst"
|
358 |
|
359 |
#. Plugin Name of the plugin/theme
|
360 |
+
#: inc/settings.php:318
|
361 |
msgid "PB SEO Friendly Images"
|
362 |
msgstr "PB SEO Friendly Images"
|
363 |
|
364 |
+
#: inc/settings.php:319
|
365 |
msgid "SEO Friendly Images"
|
366 |
msgstr "SEO Friendly Images"
|
367 |
|
lang/pb-seo-friendly-images.pot
CHANGED
@@ -3,7 +3,7 @@ msgid ""
|
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: PB SEO Friendly Images Pro\n"
|
6 |
-
"POT-Creation-Date: 2017-01-
|
7 |
"PO-Revision-Date: 2016-12-23 22:36+0100\n"
|
8 |
"Last-Translator: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
9 |
"Language-Team: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
@@ -274,22 +274,36 @@ msgid ""
|
|
274 |
"<code>200</code>."
|
275 |
msgstr ""
|
276 |
|
277 |
-
#: inc/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
msgid "disable srcset"
|
279 |
msgstr ""
|
280 |
|
281 |
-
#: inc/settings.php:
|
282 |
msgid ""
|
283 |
"disable srcset attribute and responsive images in WordPress if you don't need "
|
284 |
"them"
|
285 |
msgstr ""
|
286 |
|
287 |
#. Plugin Name of the plugin/theme
|
288 |
-
#: inc/settings.php:
|
289 |
msgid "PB SEO Friendly Images"
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: inc/settings.php:
|
293 |
msgid "SEO Friendly Images"
|
294 |
msgstr ""
|
295 |
|
3 |
msgstr ""
|
4 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
5 |
"Project-Id-Version: PB SEO Friendly Images Pro\n"
|
6 |
+
"POT-Creation-Date: 2017-01-27 18:15+0100\n"
|
7 |
"PO-Revision-Date: 2016-12-23 22:36+0100\n"
|
8 |
"Last-Translator: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
9 |
"Language-Team: Pascal Bajorat <pascal@pascal-bajorat.com>\n"
|
274 |
"<code>200</code>."
|
275 |
msgstr ""
|
276 |
|
277 |
+
#: inc/settings.php:287
|
278 |
+
msgid "Additional features"
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: inc/settings.php:293
|
282 |
+
msgid "set title for links"
|
283 |
+
msgstr ""
|
284 |
+
|
285 |
+
#: inc/settings.php:297
|
286 |
+
msgid ""
|
287 |
+
"Use the power of PB SEO Friendly Images also for seo friendly links. This will "
|
288 |
+
"set the title depending on the link text and only if there is no existing title"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: inc/settings.php:304
|
292 |
msgid "disable srcset"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: inc/settings.php:308
|
296 |
msgid ""
|
297 |
"disable srcset attribute and responsive images in WordPress if you don't need "
|
298 |
"them"
|
299 |
msgstr ""
|
300 |
|
301 |
#. Plugin Name of the plugin/theme
|
302 |
+
#: inc/settings.php:318
|
303 |
msgid "PB SEO Friendly Images"
|
304 |
msgstr ""
|
305 |
|
306 |
+
#: inc/settings.php:319
|
307 |
msgid "SEO Friendly Images"
|
308 |
msgstr ""
|
309 |
|
pb-seo-friendly-images.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
Plugin Name: PB SEO Friendly Images
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/pb-seo-friendly-images/
|
5 |
Description: This plugin is a full-featured solution for SEO friendly images. Optimize "alt" and "title" attributes for all images and post thumbnails. This plugin helps you to improve your traffic from search engines.
|
6 |
-
Version: 1.
|
7 |
Author: Pascal Bajorat
|
8 |
Author URI: https://www.pascal-bajorat.com
|
9 |
Text Domain: pb-seo-friendly-images
|
10 |
Domain Path: /lang
|
11 |
License: GNU General Public License v.3
|
12 |
|
13 |
-
Copyright (c) 2017 by Pascal
|
14 |
*/
|
15 |
|
16 |
/* Security-Check */
|
@@ -34,7 +34,7 @@ if( !class_exists('pbSEOFriendlyImages') ):
|
|
34 |
|
35 |
class pbSEOFriendlyImages
|
36 |
{
|
37 |
-
public static $verMajor = 1.
|
38 |
public static $verMinor = 0;
|
39 |
|
40 |
|
@@ -76,28 +76,22 @@ if( !class_exists('pbSEOFriendlyImages') ):
|
|
76 |
'enable_lazyload_acf' => get_option('pbsfi_enable_lazyload_acf', true),
|
77 |
'enable_lazyload_styles' => get_option('pbsfi_enable_lazyload_styles', false),
|
78 |
'lazyload_threshold' => get_option('pbsfi_lazyload_threshold', false),
|
79 |
-
'disable_srcset' => get_option('pbsfi_disable_srcset', false)
|
|
|
80 |
);
|
81 |
-
} else {
|
82 |
-
add_action( 'admin_enqueue_scripts', function(){
|
83 |
-
wp_register_style( 'pbsfi-admin-css', plugins_url(dirname(self::$basename)).'/css/admin.css', false, '1.0.0' );
|
84 |
-
wp_enqueue_style( 'pbsfi-admin-css' );
|
85 |
-
} );
|
86 |
-
}
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
if( ! is_admin() ) {
|
101 |
add_filter('acf/load_value/type=textarea', array(__CLASS__, 'prepareContentImages'), 20);
|
102 |
add_filter('acf/load_value/type=wysiwyg', array(__CLASS__, 'prepareContentImages'), 20);
|
103 |
|
@@ -105,6 +99,11 @@ if( !class_exists('pbSEOFriendlyImages') ):
|
|
105 |
add_filter('acf_load_value-textarea', array(__CLASS__, 'prepareContentImages'), 20);
|
106 |
add_filter('acf_load_value-wysiwyg', array(__CLASS__, 'prepareContentImages'), 20);
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
if( self::$proVersion && file_exists(pbsfi_plugin_path.'plugin-update-checker'.DIRECTORY_SEPARATOR.'plugin-update-checker.php') ) {
|
3 |
Plugin Name: PB SEO Friendly Images
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/pb-seo-friendly-images/
|
5 |
Description: This plugin is a full-featured solution for SEO friendly images. Optimize "alt" and "title" attributes for all images and post thumbnails. This plugin helps you to improve your traffic from search engines.
|
6 |
+
Version: 1.3.0
|
7 |
Author: Pascal Bajorat
|
8 |
Author URI: https://www.pascal-bajorat.com
|
9 |
Text Domain: pb-seo-friendly-images
|
10 |
Domain Path: /lang
|
11 |
License: GNU General Public License v.3
|
12 |
|
13 |
+
Copyright (c) 2017 by Pascal-Bajorat.com.
|
14 |
*/
|
15 |
|
16 |
/* Security-Check */
|
34 |
|
35 |
class pbSEOFriendlyImages
|
36 |
{
|
37 |
+
public static $verMajor = 1.3;
|
38 |
public static $verMinor = 0;
|
39 |
|
40 |
|
76 |
'enable_lazyload_acf' => get_option('pbsfi_enable_lazyload_acf', true),
|
77 |
'enable_lazyload_styles' => get_option('pbsfi_enable_lazyload_styles', false),
|
78 |
'lazyload_threshold' => get_option('pbsfi_lazyload_threshold', false),
|
79 |
+
'disable_srcset' => get_option('pbsfi_disable_srcset', false),
|
80 |
+
'link_title' => get_option('pbsfi_link_title', false)
|
81 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
// process post thumbnails
|
84 |
+
if( self::$userSettings['optimize_img'] == 'all' || self::$userSettings['optimize_img'] == 'thumbs' ) {
|
85 |
+
add_filter( 'wp_get_attachment_image_attributes', array(__CLASS__, 'addImgTitlePostThumbnail'), 10, 2 );
|
86 |
+
}
|
87 |
|
88 |
+
// process post images
|
89 |
+
if( self::$userSettings['optimize_img'] == 'all' || self::$userSettings['optimize_img'] == 'post' ) {
|
90 |
+
add_filter( 'the_content', array(__CLASS__, 'prepareContentImages'), 999, 1 );
|
91 |
|
92 |
+
/*
|
93 |
+
* Support for AdvancedCustomFields
|
94 |
+
*/
|
|
|
95 |
add_filter('acf/load_value/type=textarea', array(__CLASS__, 'prepareContentImages'), 20);
|
96 |
add_filter('acf/load_value/type=wysiwyg', array(__CLASS__, 'prepareContentImages'), 20);
|
97 |
|
99 |
add_filter('acf_load_value-textarea', array(__CLASS__, 'prepareContentImages'), 20);
|
100 |
add_filter('acf_load_value-wysiwyg', array(__CLASS__, 'prepareContentImages'), 20);
|
101 |
}
|
102 |
+
} else {
|
103 |
+
add_action( 'admin_enqueue_scripts', function(){
|
104 |
+
wp_register_style( 'pbsfi-admin-css', plugins_url(dirname(self::$basename)).'/css/admin.css', false, '1.0.0' );
|
105 |
+
wp_enqueue_style( 'pbsfi-admin-css' );
|
106 |
+
} );
|
107 |
}
|
108 |
|
109 |
if( self::$proVersion && file_exists(pbsfi_plugin_path.'plugin-update-checker'.DIRECTORY_SEPARATOR.'plugin-update-checker.php') ) {
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: pascalbajorat
|
|
3 |
Donate link: https://www.pascal-bajorat.com/spenden/
|
4 |
Tags: seo, images, Post, admin, google, attachment, optimize, photo, picture, image, media, photos, pictures, alt, title
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 4.7
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -51,6 +51,10 @@ If you have any questions or problems, you can ask me: [Pascal Bajorat - Webdesi
|
|
51 |
* Added a pro version of this plugin: [PB SEO Friendly Images Pro](http://bit.ly/seo-friendly-images-pro "PB SEO Friendly Images Pro")
|
52 |
* Some smaller bugfixes and translation issues fixed
|
53 |
|
|
|
|
|
|
|
|
|
54 |
== License ==
|
55 |
|
56 |
-
GNU General Public License v.3 - http://www.gnu.org/licenses/gpl-3.0.html
|
3 |
Donate link: https://www.pascal-bajorat.com/spenden/
|
4 |
Tags: seo, images, Post, admin, google, attachment, optimize, photo, picture, image, media, photos, pictures, alt, title
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 4.7.3
|
7 |
+
Stable tag: 1.3.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
51 |
* Added a pro version of this plugin: [PB SEO Friendly Images Pro](http://bit.ly/seo-friendly-images-pro "PB SEO Friendly Images Pro")
|
52 |
* Some smaller bugfixes and translation issues fixed
|
53 |
|
54 |
+
= 1.3.0 =
|
55 |
+
* Code optimization and improvements
|
56 |
+
* Added a new auto title for links function (pro only)
|
57 |
+
|
58 |
== License ==
|
59 |
|
60 |
+
GNU General Public License v.3 - http://www.gnu.org/licenses/gpl-3.0.html
|