Converter for Media – Optimize images | Convert WebP & AVIF - Version 1.2.2

Version Description

(2020-04-08) = * [Changed] Moving rules for modules mod_mime and mod_expires to /uploads-webp/.htaccess file * [Changed] New argument for filter webpc_htaccess_rules with server path of file

Download this release

Release Info

Developer mateuszgbiorczyk
Plugin Icon 128x128 Converter for Media – Optimize images | Convert WebP & AVIF
Version 1.2.2
Comparing to
See all releases

Code changes from version 1.2.1 to 1.2.2

app/Admin/Activation.php CHANGED
@@ -7,6 +7,7 @@
7
  public function __construct()
8
  {
9
  register_activation_hook(WEBPC_FILE, [$this, 'disablePluginForOldPhp']);
 
10
  register_activation_hook(WEBPC_FILE, [$this, 'addDefaultOptions']);
11
  register_activation_hook(WEBPC_FILE, [$this, 'refreshRewriteRules']);
12
  }
@@ -28,6 +29,12 @@
28
  ));
29
  }
30
 
 
 
 
 
 
 
31
  public function addDefaultOptions()
32
  {
33
  if (get_option('webpc_notice_hidden', false) !== false) return;
7
  public function __construct()
8
  {
9
  register_activation_hook(WEBPC_FILE, [$this, 'disablePluginForOldPhp']);
10
+ register_activation_hook(WEBPC_FILE, [$this, 'createDirectoryForUploadsWebp']);
11
  register_activation_hook(WEBPC_FILE, [$this, 'addDefaultOptions']);
12
  register_activation_hook(WEBPC_FILE, [$this, 'refreshRewriteRules']);
13
  }
29
  ));
30
  }
31
 
32
+ public function createDirectoryForUploadsWebp()
33
+ {
34
+ $path = apply_filters('webpc_uploads_webp', '');
35
+ if (is_writable(dirname($path))) mkdir($path);
36
+ }
37
+
38
  public function addDefaultOptions()
39
  {
40
  if (get_option('webpc_notice_hidden', false) !== false) return;
app/Admin/Uninstall.php CHANGED
@@ -19,9 +19,16 @@
19
  delete_option('webpc_notice_hidden');
20
  delete_option('webpc_latest_version');
21
 
 
22
  self::removeWebpFiles();
23
  }
24
 
 
 
 
 
 
 
25
  public static function removeWebpFiles()
26
  {
27
  $path = apply_filters('webpc_uploads_webp', '');
19
  delete_option('webpc_notice_hidden');
20
  delete_option('webpc_latest_version');
21
 
22
+ self::removeHtaccessFile();
23
  self::removeWebpFiles();
24
  }
25
 
26
+ private static function removeHtaccessFile()
27
+ {
28
+ $path = sprintf('%s/.htaccess', apply_filters('webpc_uploads_webp', ''));
29
+ if (is_writable($path)) unlink($path);
30
+ }
31
+
32
  public static function removeWebpFiles()
33
  {
34
  $path = apply_filters('webpc_uploads_webp', '');
app/Media/Htaccess.php CHANGED
@@ -6,45 +6,43 @@
6
  {
7
  public function __construct()
8
  {
9
- add_action('webpc_rewrite_htaccess', [$this, 'addRewriteRules'], 10, 1);
 
10
  }
11
 
12
  /* ---
13
  Functions
14
  --- */
15
 
16
- public function addRewriteRules($isActive)
17
  {
18
- $rules = $this->getRewriteRules($isActive);
19
- $this->saveRewritesInUploads($rules);
20
- }
21
-
22
- private function getRewriteRules($isActive)
23
- {
24
- if (!$isActive) return '';
25
 
26
  $values = apply_filters('webpc_get_values', []);
27
- $rows = [];
28
- $rows[] = $this->getModMimeRules($values);
29
- $rows[] = $this->getModRewriteRules($values);
30
- $rows[] = $this->getModExpiresRules($values);
31
- $rows = array_filter($rows);
32
 
33
  $content = $this->addCommentsToRules($rows);
34
- return apply_filters('webpc_htaccess_rules', $content);
 
35
  }
36
 
37
- private function getModMimeRules($settings)
38
  {
39
- $content = '';
40
- if (!$settings['extensions']) return $content;
41
 
42
- $content .= '<IfModule mod_mime.c>' . PHP_EOL;
43
- $content .= ' AddType image/webp .webp' . PHP_EOL;
44
- $content .= '</IfModule>';
 
 
45
 
46
- $content = apply_filters('webpc_htaccess_mod_mime', $content);
47
- return $content;
 
48
  }
49
 
50
  private function getModRewriteRules($settings)
@@ -82,6 +80,19 @@
82
  return $content;
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  private function addCommentsToRules($rules)
86
  {
87
  if (!$rules) return '';
@@ -90,7 +101,7 @@
90
  $rows[] = '';
91
  $rows[] = '# BEGIN WebP Converter';
92
  $rows[] = '# ! --- DO NOT EDIT PREVIOUS LINE --- !';
93
- $rows = array_merge($rows, $rules);
94
  $rows[] = '# ! --- DO NOT EDIT NEXT LINE --- !';
95
  $rows[] = '# END WebP Converter';
96
  $rows[] = '';
@@ -98,9 +109,8 @@
98
  return implode(PHP_EOL, $rows);
99
  }
100
 
101
- private function saveRewritesInUploads($rules)
102
  {
103
- $pathDir = apply_filters('webpc_uploads_path', '');
104
  $pathFile = $pathDir . '/.htaccess';
105
 
106
  $code = (is_readable($pathFile)) ? file_get_contents($pathFile) : '';
6
  {
7
  public function __construct()
8
  {
9
+ add_action('webpc_rewrite_htaccess', [$this, 'addRewriteRulesToUploads'], 10, 1);
10
+ add_action('webpc_rewrite_htaccess', [$this, 'addRewriteRulesToUploadsWebp'], 10, 1);
11
  }
12
 
13
  /* ---
14
  Functions
15
  --- */
16
 
17
+ public function addRewriteRulesToUploads($isActive)
18
  {
19
+ $path = apply_filters('webpc_uploads_path', '');
20
+ if (!$isActive) return $this->saveRewritesInHtaccesss($path);
 
 
 
 
 
21
 
22
  $values = apply_filters('webpc_get_values', []);
23
+ $rows = [
24
+ $this->getModRewriteRules($values),
25
+ ];
 
 
26
 
27
  $content = $this->addCommentsToRules($rows);
28
+ $content = apply_filters('webpc_htaccess_rules', $content, $path . '/.htaccess');
29
+ $this->saveRewritesInHtaccesss($path, $content);
30
  }
31
 
32
+ public function addRewriteRulesToUploadsWebp($isActive)
33
  {
34
+ $path = apply_filters('webpc_uploads_webp', '');
35
+ if (!$isActive) return $this->saveRewritesInHtaccesss($path);
36
 
37
+ $values = apply_filters('webpc_get_values', []);
38
+ $rows = [
39
+ $this->getModMimeRules($values),
40
+ $this->getModExpiresRules($values),
41
+ ];
42
 
43
+ $content = $this->addCommentsToRules($rows);
44
+ $content = apply_filters('webpc_htaccess_rules', $content, $path . '/.htaccess');
45
+ $this->saveRewritesInHtaccesss($path, $content);
46
  }
47
 
48
  private function getModRewriteRules($settings)
80
  return $content;
81
  }
82
 
83
+ private function getModMimeRules($settings)
84
+ {
85
+ $content = '';
86
+ if (!$settings['extensions']) return $content;
87
+
88
+ $content .= '<IfModule mod_mime.c>' . PHP_EOL;
89
+ $content .= ' AddType image/webp .webp' . PHP_EOL;
90
+ $content .= '</IfModule>';
91
+
92
+ $content = apply_filters('webpc_htaccess_mod_mime', $content);
93
+ return $content;
94
+ }
95
+
96
  private function addCommentsToRules($rules)
97
  {
98
  if (!$rules) return '';
101
  $rows[] = '';
102
  $rows[] = '# BEGIN WebP Converter';
103
  $rows[] = '# ! --- DO NOT EDIT PREVIOUS LINE --- !';
104
+ $rows = array_merge($rows, array_filter($rules));
105
  $rows[] = '# ! --- DO NOT EDIT NEXT LINE --- !';
106
  $rows[] = '# END WebP Converter';
107
  $rows[] = '';
109
  return implode(PHP_EOL, $rows);
110
  }
111
 
112
+ private function saveRewritesInHtaccesss($pathDir, $rules = '')
113
  {
 
114
  $pathFile = $pathDir . '/.htaccess';
115
 
116
  $code = (is_readable($pathFile)) ? file_get_contents($pathFile) : '';
app/Settings/Errors.php CHANGED
@@ -16,11 +16,12 @@
16
  public function getServerErrors()
17
  {
18
  $list = [
19
- 'path_uploads' => ($this->ifUploadsPathExists() !== true),
20
- 'path_htaccess' => ($this->ifHtaccessWriteAble() !== true),
21
- 'path_webp' => ($this->ifWebpPathExists() !== true),
22
- 'rest_api' => ($this->ifRestApiEnabled() !== true),
23
- 'methods' => ($this->ifMethodsAvailable() !== true),
 
24
  ];
25
  return array_keys(array_filter($list));
26
  }
@@ -42,7 +43,14 @@
42
  private function ifWebpPathExists()
43
  {
44
  $path = apply_filters('webpc_uploads_webp', '');
45
- return ((is_dir($path) || is_writable(dirname($path))) && ($path !== ABSPATH));
 
 
 
 
 
 
 
46
  }
47
 
48
  private function ifRestApiEnabled()
16
  public function getServerErrors()
17
  {
18
  $list = [
19
+ 'path_uploads' => ($this->ifUploadsPathExists() !== true),
20
+ 'path_htaccess' => ($this->ifHtaccessWriteAble() !== true),
21
+ 'path_webp' => ($this->ifWebpPathExists() !== true),
22
+ 'path_duplicated' => ($this->ifPathsAreDifferent() !== true),
23
+ 'rest_api' => ($this->ifRestApiEnabled() !== true),
24
+ 'methods' => ($this->ifMethodsAvailable() !== true),
25
  ];
26
  return array_keys(array_filter($list));
27
  }
43
  private function ifWebpPathExists()
44
  {
45
  $path = apply_filters('webpc_uploads_webp', '');
46
+ return (is_dir($path) || is_writable(dirname($path)));
47
+ }
48
+
49
+ private function ifPathsAreDifferent()
50
+ {
51
+ $pathUploads = apply_filters('webpc_uploads_path', '');
52
+ $pathWebp = apply_filters('webpc_uploads_webp', '');
53
+ return ($pathUploads !== $pathWebp);
54
  }
55
 
56
  private function ifRestApiEnabled()
readme.txt CHANGED
@@ -25,10 +25,12 @@ This will be a profit both for your users who will not have to download so much
25
 
26
  - By adding images to your media library, they are automatically converted and saved in a separate directory.
27
  - If you have just installed the plugin, you can convert all existing images with one click.
 
28
  - Images are converted using PHP `GD` or `Imagick` extension *(you can modify the compression level)*.
29
  - When the browser tries to download an image file, the server verifies if it supports `image/webp` files and if the file exists.
30
  - If everything is OK, instead of the original image, the browser will receive its equivalent in WebP format.
31
  - **The plugin does not change image URLs, so there are no problems with saving the HTML code of website to the cache and time of its generation does not increase.** It does not matter if the image display as an `img` HTML tag or you use `background-image`. It works always!
 
32
  - Image URLs are modified using the module `mod_rewrite` on the server, i.e. the same, and thanks to this we can use friendly links in WordPress. Additionally, the MIME type of the sent file is modified to `image/webp`.
33
  - The final result is that your users download less than half of the data, and the website itself loads faster!
34
 
@@ -100,7 +102,7 @@ Then follow these steps:
100
 
101
  Send a screenshot from console if an error occurred while converting images. Of you have errors in `/wp-content/debug.log` send their?
102
 
103
- **6.** Content of your `.htaccess` file from the `/wp-content/uploads` directory *(pasting the code using the `CODE` shortcode in the editor)*.
104
 
105
  **7.** What plugin version are you using? If it is not the latest then update and check everything again. Please also provide the version of WordPress and the list of plugins you use.
106
 
@@ -231,7 +233,7 @@ add_filter('webpc_uploads_webp', function($path) {
231
  return '/';
232
  });`
233
 
234
- After setting the filters go to `Settings -> WebP Converter` in the admin panel and click the `Save Changes` button. `.htaccess` file with appropriate rules should be created in the `/uploads` directory.
235
 
236
  = How to run manually conversion? =
237
 
@@ -261,9 +263,9 @@ Below is a list of filters that allow you to modify all rules. Remember that it'
261
 
262
  Returning an empty string will delete these rules the next time you save the plugin settings. You must do this after each filter edit.
263
 
264
- All rules from the .htaccess file: *(returns rules for modules: `mod_mime`, `mod_rewrite` and `mod_expires`)*:
265
 
266
- `add_filter('webpc_htaccess_rules', function($rules) {
267
  return '';
268
  });`
269
 
@@ -273,17 +275,19 @@ Rules for `image/webp` MIME type: *(returns rules for `mod_mime` module)*:
273
  return '';
274
  });`
275
 
276
- Rules for redirects: *(returns rules for `mod_rewrite` module)*:
277
 
278
- `add_filter('webpc_htaccess_mod_rewrite', function($rules) {
279
  return '';
280
  });`
281
 
282
- Rules for Browser Caching: *(returns rules for `mod_expires` module)*:
283
 
284
- `add_filter('webpc_htaccess_mod_expires', function($rules) {
285
  return '';
286
- });`
 
 
287
 
288
  = What is Browser Caching? =
289
 
@@ -338,16 +342,13 @@ and add below code in this file:
338
 
339
  = Configuration for Multisite Network =
340
 
341
- Yes, with one exception. In this mode it is not possible to automatically generate the contents of .htaccess file.
342
 
343
  Please manually paste the following code **at the beginning of .htaccess file** in the `/wp-content/uploads` directory:
344
 
345
  `# BEGIN WebP Converter`
346
  `# ! --- DO NOT EDIT PREVIOUS LINE --- !`
347
- `<IfModule mod_mime.c>
348
- AddType image/webp .webp
349
- </IfModule>
350
- <IfModule mod_rewrite.c>
351
  RewriteEngine On
352
  RewriteCond %{HTTP_ACCEPT} image/webp
353
  RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
@@ -358,6 +359,16 @@ Please manually paste the following code **at the beginning of .htaccess file**
358
  RewriteCond %{HTTP_ACCEPT} image/webp
359
  RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
360
  RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [T=image/webp]
 
 
 
 
 
 
 
 
 
 
361
  </IfModule>
362
  <IfModule mod_expires.c>
363
  ExpiresActive On
@@ -385,6 +396,10 @@ This is all very important to us and allows us to do even better things for you!
385
 
386
  == Changelog ==
387
 
 
 
 
 
388
  = 1.2.1 (2020-04-07) =
389
  * `[Removed]` Filter `webpc_option_disabled`
390
  * `[Fixed]` Converting images multiple times when uploading to media library
25
 
26
  - By adding images to your media library, they are automatically converted and saved in a separate directory.
27
  - If you have just installed the plugin, you can convert all existing images with one click.
28
+ - Converting to WebP format works for all image sizes. As WebP you will see all the images added to the media library.
29
  - Images are converted using PHP `GD` or `Imagick` extension *(you can modify the compression level)*.
30
  - When the browser tries to download an image file, the server verifies if it supports `image/webp` files and if the file exists.
31
  - If everything is OK, instead of the original image, the browser will receive its equivalent in WebP format.
32
  - **The plugin does not change image URLs, so there are no problems with saving the HTML code of website to the cache and time of its generation does not increase.** It does not matter if the image display as an `img` HTML tag or you use `background-image`. It works always!
33
+ - The name of the loaded image does not contain the WebP extension. Only the source of the loaded file changes to a WebP file. As a result, you always have one URL to a file. Regardless of whether the browser supports WebP or not.
34
  - Image URLs are modified using the module `mod_rewrite` on the server, i.e. the same, and thanks to this we can use friendly links in WordPress. Additionally, the MIME type of the sent file is modified to `image/webp`.
35
  - The final result is that your users download less than half of the data, and the website itself loads faster!
36
 
102
 
103
  Send a screenshot from console if an error occurred while converting images. Of you have errors in `/wp-content/debug.log` send their?
104
 
105
+ **6.** Content of your `.htaccess` files from directories `/wp-content/uploads` and `/wp-content/uploads-webp` *(pasting the code using the `CODE` shortcode in the editor)*.
106
 
107
  **7.** What plugin version are you using? If it is not the latest then update and check everything again. Please also provide the version of WordPress and the list of plugins you use.
108
 
233
  return '/';
234
  });`
235
 
236
+ After setting the filters go to `Settings -> WebP Converter` in the admin panel and click the `Save Changes` button. `.htaccess` files with appropriate rules should be created in the directories `/uploads` and `/uploads-webpc`.
237
 
238
  = How to run manually conversion? =
239
 
263
 
264
  Returning an empty string will delete these rules the next time you save the plugin settings. You must do this after each filter edit.
265
 
266
+ Rules for redirects: *(returns rules for `mod_rewrite` module)*:
267
 
268
+ `add_filter('webpc_htaccess_mod_rewrite', function($rules) {
269
  return '';
270
  });`
271
 
275
  return '';
276
  });`
277
 
278
+ Rules for Browser Caching: *(returns rules for `mod_expires` module)*:
279
 
280
+ `add_filter('webpc_htaccess_mod_expires', function($rules) {
281
  return '';
282
  });`
283
 
284
+ All rules from the files `/uploads/.htaccess` and `/uploads-webp/.htaccess`: *(returns rules for modules: `mod_rewrite`, `mod_mime` and `mod_expires`)*:
285
 
286
+ `add_filter('webpc_htaccess_rules', function($rules, $path) {
287
  return '';
288
+ }, 10, 2);`
289
+
290
+ Argument `$path` is absolute server path for `.htaccess` file.
291
 
292
  = What is Browser Caching? =
293
 
342
 
343
  = Configuration for Multisite Network =
344
 
345
+ Yes, with one exception. In this mode it is not possible to automatically generate the contents of .htaccess files.
346
 
347
  Please manually paste the following code **at the beginning of .htaccess file** in the `/wp-content/uploads` directory:
348
 
349
  `# BEGIN WebP Converter`
350
  `# ! --- DO NOT EDIT PREVIOUS LINE --- !`
351
+ `<IfModule mod_rewrite.c>
 
 
 
352
  RewriteEngine On
353
  RewriteCond %{HTTP_ACCEPT} image/webp
354
  RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
359
  RewriteCond %{HTTP_ACCEPT} image/webp
360
  RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f
361
  RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [T=image/webp]
362
+ </IfModule>`
363
+ `# ! --- DO NOT EDIT NEXT LINE --- !`
364
+ `# END WebP Converter`
365
+
366
+ And the following code **at the beginning of .htaccess file** in the `/wp-content/uploads-webp` directory:
367
+
368
+ `# BEGIN WebP Converter`
369
+ `# ! --- DO NOT EDIT PREVIOUS LINE --- !`
370
+ `<IfModule mod_mime.c>
371
+ AddType image/webp .webp
372
  </IfModule>
373
  <IfModule mod_expires.c>
374
  ExpiresActive On
396
 
397
  == Changelog ==
398
 
399
+ = 1.2.2 (2020-04-08) =
400
+ * `[Changed]` Moving rules for modules `mod_mime` and `mod_expires` to `/uploads-webp/.htaccess` file
401
+ * `[Changed]` New argument for filter `webpc_htaccess_rules` with server path of file
402
+
403
  = 1.2.1 (2020-04-07) =
404
  * `[Removed]` Filter `webpc_option_disabled`
405
  * `[Fixed]` Converting images multiple times when uploading to media library
resources/components/widgets/errors.php CHANGED
@@ -7,25 +7,35 @@
7
  <?php if (in_array('path_uploads', $errors)) : ?>
8
  <p>
9
  <?= sprintf(
10
- __('The path for uploads files does not exist. Please use the %s filter to set the correct path. The default path is: %s.', 'webp-converter'),
11
  '<strong>webpc_uploads_path</strong>',
12
- '<strong>' . ABSPATH . 'wp-content/uploads/</strong>'
13
  ); ?>
14
  </p>
15
  <?php endif; ?>
16
  <?php if (in_array('path_htaccess', $errors)) : ?>
17
  <p>
18
  <?= sprintf(
19
- __('Unable to create or edit .htaccess file. Please change directory permissions. The default path of file is: %s.', 'webp-converter'),
20
- '<strong>' . ABSPATH . 'wp-content/uploads/.htaccess</strong>'
21
  ); ?>
22
  </p>
23
  <?php endif; ?>
24
  <?php if (in_array('path_webp', $errors)) : ?>
25
  <p>
26
  <?= sprintf(
27
- __('The path for saving converted WebP files does not exist and cannot be created. Please check your server configuration and try again. The default path is: %s.', 'webp-converter'),
28
- '<strong>' . ABSPATH . 'wp-content/uploads-webpc/</strong>'
 
 
 
 
 
 
 
 
 
 
29
  ); ?>
30
  </p>
31
  <?php endif; ?>
7
  <?php if (in_array('path_uploads', $errors)) : ?>
8
  <p>
9
  <?= sprintf(
10
+ __('The path for /uploads files does not exist. Please use the %s filter to set the correct path. The current path is: %s.', 'webp-converter'),
11
  '<strong>webpc_uploads_path</strong>',
12
+ '<strong>' . apply_filters('webpc_uploads_path', '') . '</strong>'
13
  ); ?>
14
  </p>
15
  <?php endif; ?>
16
  <?php if (in_array('path_htaccess', $errors)) : ?>
17
  <p>
18
  <?= sprintf(
19
+ __('Unable to create or edit .htaccess file. Please change directory permissions. The current path of file is: %s.', 'webp-converter'),
20
+ '<strong>' . apply_filters('webpc_uploads_path', '') . '/.htaccess</strong>'
21
  ); ?>
22
  </p>
23
  <?php endif; ?>
24
  <?php if (in_array('path_webp', $errors)) : ?>
25
  <p>
26
  <?= sprintf(
27
+ __('The path for saving converted WebP files does not exist and cannot be created. Please check your server configuration and try again. The current path is: %s.', 'webp-converter'),
28
+ '<strong>' . apply_filters('webpc_uploads_webp', '') . '</strong>'
29
+ ); ?>
30
+ </p>
31
+ <?php endif; ?>
32
+ <?php if (in_array('path_duplicated', $errors)) : ?>
33
+ <p>
34
+ <?= sprintf(
35
+ __('The paths for /uploads files and for saving converted WebP files are the same. Please change them using filters %s or %s. The current path for them is: %s.', 'webp-converter'),
36
+ '<strong>webpc_uploads_path</strong>',
37
+ '<strong>webpc_uploads_webp</strong>',
38
+ '<strong>' . apply_filters('webpc_uploads_path', '') . '</strong>'
39
  ); ?>
40
  </p>
41
  <?php endif; ?>
webp-converter-for-media.php CHANGED
@@ -3,13 +3,13 @@
3
  /*
4
  Plugin Name: WebP Converter for Media
5
  Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
6
- Version: 1.2.1
7
  Author: Mateusz Gbiorczyk
8
  Author URI: https://gbiorczyk.pl/
9
  Text Domain: webp-converter
10
  */
11
 
12
- define('WEBPC_VERSION', '1.2.1');
13
  define('WEBPC_FILE', __FILE__);
14
  define('WEBPC_NAME', plugin_basename(__FILE__));
15
  define('WEBPC_PATH', plugin_dir_path(__FILE__));
3
  /*
4
  Plugin Name: WebP Converter for Media
5
  Description: Speed up your website by serving WebP images instead of standard formats JPEG, PNG and GIF.
6
+ Version: 1.2.2
7
  Author: Mateusz Gbiorczyk
8
  Author URI: https://gbiorczyk.pl/
9
  Text Domain: webp-converter
10
  */
11
 
12
+ define('WEBPC_VERSION', '1.2.2');
13
  define('WEBPC_FILE', __FILE__);
14
  define('WEBPC_NAME', plugin_basename(__FILE__));
15
  define('WEBPC_PATH', plugin_dir_path(__FILE__));