Changeset 1995970
- Timestamp:
- 12/16/2018 07:42:45 PM (7 years ago)
- Location:
- wp-auto-links
- Files:
-
- 1 added
- 10 edited
- 8 copied
-
tags/1.2.0 (added)
-
tags/1.2.0/LICENSE (copied) (copied from wp-auto-links/trunk/LICENSE)
-
tags/1.2.0/composer.json (copied) (copied from wp-auto-links/trunk/composer.json)
-
tags/1.2.0/composer.lock (copied) (copied from wp-auto-links/trunk/composer.lock)
-
tags/1.2.0/readme.txt (copied) (copied from wp-auto-links/trunk/readme.txt)
-
tags/1.2.0/src (copied) (copied from wp-auto-links/trunk/src)
-
tags/1.2.0/src/class-wp-auto-links-helper.php (modified) (1 diff)
-
tags/1.2.0/templates (copied) (copied from wp-auto-links/trunk/templates)
-
tags/1.2.0/templates/admin.php (modified) (24 diffs)
-
tags/1.2.0/vendor (copied) (copied from wp-auto-links/trunk/vendor)
-
tags/1.2.0/vendor/autoload.php (modified) (1 diff)
-
tags/1.2.0/vendor/composer/autoload_real.php (modified) (3 diffs)
-
tags/1.2.0/vendor/composer/autoload_static.php (modified) (2 diffs)
-
tags/1.2.0/wp-auto-links.php (copied) (copied from wp-auto-links/trunk/wp-auto-links.php)
-
trunk/src/class-wp-auto-links-helper.php (modified) (1 diff)
-
trunk/templates/admin.php (modified) (24 diffs)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-auto-links/tags/1.2.0/src/class-wp-auto-links-helper.php
r1994755 r1995970 258 258 259 259 /** 260 * @param mixed $value 261 * @param int $null 262 * @return int 263 */ 264 public static function option_integer($value, int $null = 0): int 265 { 266 return (is_numeric($value) && $value > 0) ? (int) $value : $null; 267 } 268 269 /** 260 270 * Instantiate the filter. 261 271 * -
wp-auto-links/tags/1.2.0/templates/admin.php
r1994755 r1995970 5 5 */ 6 6 7 $ instance= WP_Auto_Links_Helper::get_instance();8 $options = $ instance->get_options();7 $helper = WP_Auto_Links_Helper::get_instance(); 8 $options = $helper->get_options(); 9 9 10 10 $boolean_options = [ … … 43 43 44 44 if (isset($_POST['submitted'])) { 45 check_admin_referer($instance::DOMAIN); 46 47 foreach ($integer_options + $boolean_options as $option_name) { 45 check_admin_referer($helper::DOMAIN); 46 47 foreach ($boolean_options as $option_name) { 48 $options[$option_name] = (isset($_POST[$option_name]) && !empty($_POST[$option_name])) ? (bool) $_POST[$option_name] : false; 49 } 50 51 foreach ($integer_options as $option_name) { 48 52 $val = (isset($_POST[$option_name]) && !empty($_POST[$option_name])) ? $_POST[$option_name] : 0; 49 53 $options[$option_name] = is_numeric($val) ? (int) $val : 1; … … 55 59 $options['term_ignore'] = array_filter(array_map('trim', explode(',', sanitize_text_field($_POST['term_ignore']))), 'is_numeric'); 56 60 57 $ instance->set_options($options);58 59 echo '<div class="updated"><p>' . __('Plugin settings saved.', $ instance::DOMAIN) . '</p></div>';61 $helper->set_options($options); 62 63 echo '<div class="updated"><p>' . __('Plugin settings saved.', $helper::DOMAIN) . '</p></div>'; 60 64 } 61 65 … … 72 76 $options['keywords'] = stripslashes($options['keywords']); 73 77 74 function not_null($value, int $null = 0): bool 75 { 76 return (is_numeric($value) && $value > 0) ? (int) $value : $null; 77 } 78 79 $options['max_links'] = not_null($options['max_links']); 80 $options['max_single_keyword'] = not_null($options['max_single_keyword'], -1); 81 $options['max_single_url'] = not_null($options['max_single_url']); 82 $options['min_term_usage'] = not_null($options['min_term_usage'], 1); 78 $options['max_links'] = $helper::option_integer($options['max_links']); 79 $options['max_single_keyword'] = $helper::option_integer($options['max_single_keyword'], -1); 80 $options['max_single_url'] = $helper::option_integer($options['max_single_url']); 81 $options['min_term_usage'] = $helper::option_integer($options['min_term_usage'], 1); 83 82 84 83 ?> … … 90 89 <input type="hidden" name="option_page" value="discussion"> 91 90 <input type="hidden" name="action" value="update"> 92 <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?= wp_create_nonce($ instance::DOMAIN); ?>"/>91 <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?= wp_create_nonce($helper::DOMAIN); ?>"/> 93 92 <input type="hidden" name="submitted" value="1"/> 94 93 95 94 <h2 class="title"><?php _e('Keywords'); ?></h2> 96 <p><?php _e('Which custom keywords to automatically link.', $ instance::DOMAIN); ?></p>95 <p><?php _e('Which custom keywords to automatically link.', $helper::DOMAIN); ?></p> 97 96 <table class="form-table"> 98 97 <tbody> … … 106 105 <textarea name="keywords" id="keywords" rows="10" cols="90"><?= $options['keywords']; ?></textarea> 107 106 <p class="description"> 108 <?php _e('Use comma to separate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.', $ instance::DOMAIN); ?>107 <?php _e('Use comma to separate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.', $helper::DOMAIN); ?> 109 108 </p> 110 109 <code>example,auto links,https://example.com</code><br/> … … 113 112 </tr> 114 113 <tr> 115 <th><?php _e('Duplicates', $ instance::DOMAIN); ?></th>114 <th><?php _e('Duplicates', $helper::DOMAIN); ?></th> 116 115 <td> 117 116 <label> 118 117 <input type="checkbox" name="prevent_duplicate_link" <?= $options['prevent_duplicate_link']; ?> /> 119 <strong><?php _e('Prevent a link to be used more than once in a content', $ instance::DOMAIN); ?></strong>120 </label> 121 </td> 122 </tr> 123 </tbody> 124 </table> 125 126 <h2 class="title"><?php _e('Placements', $ instance::DOMAIN); ?></h2>127 <p><?php _e('Where to automatically add links.', $ instance::DOMAIN); ?></p>118 <strong><?php _e('Prevent a link to be used more than once in a content', $helper::DOMAIN); ?></strong> 119 </label> 120 </td> 121 </tr> 122 </tbody> 123 </table> 124 125 <h2 class="title"><?php _e('Placements', $helper::DOMAIN); ?></h2> 126 <p><?php _e('Where to automatically add links.', $helper::DOMAIN); ?></p> 128 127 <table class="form-table"> 129 128 <tbody> … … 138 137 <label> 139 138 <input type="checkbox" name="on_post_self" <?= $options['on_post_self']; ?>/> 140 <strong><?php _e('Enable self linking for posts', $ instance::DOMAIN); ?></strong>139 <strong><?php _e('Enable self linking for posts', $helper::DOMAIN); ?></strong> 141 140 </label> 142 141 </td> … … 152 151 <label> 153 152 <input type="checkbox" name="on_page_self" <?= $options['on_page_self']; ?>/> 154 <strong><?php _e('Enable self linking for pages', $ instance::DOMAIN); ?></strong>153 <strong><?php _e('Enable self linking for pages', $helper::DOMAIN); ?></strong> 155 154 </label> 156 155 </td> … … 163 162 <strong><?php _e('Enable to link in comments'); ?></strong> 164 163 </label> 165 <?= $ instance->may_slow_down(); ?>166 </td> 167 </tr> 168 <tr> 169 <th><?php _e('Feeds', $ instance::DOMAIN); ?></th>164 <?= $helper->may_slow_down(); ?> 165 </td> 166 </tr> 167 <tr> 168 <th><?php _e('Feeds', $helper::DOMAIN); ?></th> 170 169 <td> 171 170 <label> 172 171 <input type="checkbox" name="on_feed" <?= $options['on_feed']; ?> /> 173 <strong><?php _e('Enable to link in feeds', $ instance::DOMAIN); ?></strong>174 </label> 175 <p class="description"> 176 177 </p> 178 </td> 179 </tr> 180 <tr> 181 <th><?php _e('Archives', $ instance::DOMAIN); ?></th>172 <strong><?php _e('Enable to link in feeds', $helper::DOMAIN); ?></strong> 173 </label> 174 <p class="description"> 175 176 </p> 177 </td> 178 </tr> 179 <tr> 180 <th><?php _e('Archives', $helper::DOMAIN); ?></th> 182 181 <td> 183 182 <label> 184 183 <input type="checkbox" name="on_archive" <?= $options['on_archive']; ?>/> 185 <strong><?php _e('Enable to link on archive and index pages (including home page)', $ instance::DOMAIN); ?></strong>186 </label> 187 <?= $ instance->may_slow_down(); ?>188 </td> 189 </tr> 190 <tr> 191 <th><?php _e('Heading', $ instance::DOMAIN); ?></th>184 <strong><?php _e('Enable to link on archive and index pages (including home page)', $helper::DOMAIN); ?></strong> 185 </label> 186 <?= $helper->may_slow_down(); ?> 187 </td> 188 </tr> 189 <tr> 190 <th><?php _e('Heading', $helper::DOMAIN); ?></th> 192 191 <td> 193 192 <label> 194 193 <input type="checkbox" name="on_heading" <?= $options['on_heading']; ?>/> 195 <strong><?php _e('Enable to link in heading tags (h1, h2, h3, h4, h5 and h6)', $ instance::DOMAIN); ?></strong>196 </label> 197 </td> 198 </tr> 199 </tbody> 200 </table> 201 202 <h2 class="title"><?php _e('Targeting', $ instance::DOMAIN); ?></h2>203 <p><?php _e('What to automatically link.', $ instance::DOMAIN); ?></p>194 <strong><?php _e('Enable to link in heading tags (h1, h2, h3, h4, h5 and h6)', $helper::DOMAIN); ?></strong> 195 </label> 196 </td> 197 </tr> 198 </tbody> 199 </table> 200 201 <h2 class="title"><?php _e('Targeting', $helper::DOMAIN); ?></h2> 202 <p><?php _e('What to automatically link.', $helper::DOMAIN); ?></p> 204 203 <table class="form-table"> 205 204 <tbody> … … 209 208 <label> 210 209 <input type="checkbox" name="keywords_enable" <?= $options['keywords_enable']; ?> /> 211 <strong><?php _e('Enable to link links with custom keywords', $ instance::DOMAIN); ?></strong>212 </label> 213 <?= $ instance->may_slow_down(); ?>210 <strong><?php _e('Enable to link links with custom keywords', $helper::DOMAIN); ?></strong> 211 </label> 212 <?= $helper->may_slow_down(); ?> 214 213 </td> 215 214 </tr> … … 219 218 <label> 220 219 <input type="checkbox" name="posts_enable" <?= $options['posts_enable']; ?> /> 221 <strong><?php _e('Enable to link internal links to posts', $ instance::DOMAIN); ?></strong>222 </label> 223 <?= $ instance->may_slow_down(); ?>220 <strong><?php _e('Enable to link internal links to posts', $helper::DOMAIN); ?></strong> 221 </label> 222 <?= $helper->may_slow_down(); ?> 224 223 </td> 225 224 </tr> … … 229 228 <label> 230 229 <input type="checkbox" name="pages_enable" <?= $options['pages_enable']; ?> /> 231 <strong><?php _e('Enable to link internal links to pages', $ instance::DOMAIN); ?></strong>232 </label> 233 <?= $ instance->may_slow_down(); ?>230 <strong><?php _e('Enable to link internal links to pages', $helper::DOMAIN); ?></strong> 231 </label> 232 <?= $helper->may_slow_down(); ?> 234 233 </td> 235 234 </tr> … … 239 238 <label> 240 239 <input type="checkbox" name="categories_enable" <?= $options['categories_enable']; ?> /> 241 <strong><?php _e('Enable to link internal links to categories', $ instance::DOMAIN); ?></strong>242 </label> 243 <?= $ instance->may_slow_down(); ?>240 <strong><?php _e('Enable to link internal links to categories', $helper::DOMAIN); ?></strong> 241 </label> 242 <?= $helper->may_slow_down(); ?> 244 243 </td> 245 244 </tr> … … 249 248 <label> 250 249 <input type="checkbox" name="tags_enable" <?= $options['tags_enable']; ?> /> 251 <strong><?php _e('Enable to link internal links to tags', $ instance::DOMAIN); ?></strong>252 </label> 253 <?= $ instance->may_slow_down(); ?>250 <strong><?php _e('Enable to link internal links to tags', $helper::DOMAIN); ?></strong> 251 </label> 252 <?= $helper->may_slow_down(); ?> 254 253 </td> 255 254 </tr> … … 257 256 <th> 258 257 <label for="min_term_usage"> 259 <?php _e('Minimum categories / tags', $ instance::DOMAIN); ?>258 <?php _e('Minimum categories / tags', $helper::DOMAIN); ?> 260 259 </label> 261 260 </th> … … 263 262 <input type="number" name="min_term_usage" id="min_term_usage" size="2" value="<?= $options['min_term_usage']; ?>"/> 264 263 <p class="description"> 265 <?php _e('Only link categories and tags that have been used the above number of times or more.', $ instance::DOMAIN); ?>266 </p> 267 </td> 268 </tr> 269 </tbody> 270 </table> 271 272 <h2 class="title"><?php _e('Excluding', $ instance::DOMAIN); ?></h2>273 <table class="form-table"> 274 <tbody> 275 <tr> 276 <th><?php _e('Exclude Keywords', $ instance::DOMAIN); ?></th>264 <?php _e('Only link categories and tags that have been used the above number of times or more.', $helper::DOMAIN); ?> 265 </p> 266 </td> 267 </tr> 268 </tbody> 269 </table> 270 271 <h2 class="title"><?php _e('Excluding', $helper::DOMAIN); ?></h2> 272 <table class="form-table"> 273 <tbody> 274 <tr> 275 <th><?php _e('Exclude Keywords', $helper::DOMAIN); ?></th> 277 276 <td> 278 277 <input type="text" name="keyword_ignore" size="90" 279 value="<?= $options['keyword_ignore']; ?>" placeholder="<?php _e('Add a word', $ instance::DOMAIN); ?>"/>280 <p class="description"> 281 <?php _e('You may wish to ignore certain words or phrases from automatic linking. Separate them by comma.', $ instance::DOMAIN); ?>282 </p> 283 </td> 284 </tr> 285 <tr> 286 <th><?php _e('Exclude Posts / Pages', $ instance::DOMAIN); ?></th>278 value="<?= $options['keyword_ignore']; ?>" placeholder="<?php _e('Add a word', $helper::DOMAIN); ?>"/> 279 <p class="description"> 280 <?php _e('You may wish to ignore certain words or phrases from automatic linking. Separate them by comma.', $helper::DOMAIN); ?> 281 </p> 282 </td> 283 </tr> 284 <tr> 285 <th><?php _e('Exclude Posts / Pages', $helper::DOMAIN); ?></th> 287 286 <td> 288 287 <input type="text" name="post_ignore" size="90" 289 288 value="<?= $options['post_ignore']; ?>" placeholder="<?php _e('Add an ID'); ?>"/> 290 289 <p class="description"> 291 <?php _e('You may wish to forbid automatic linking on certain posts or pages. Separate their ID by a comma.', $ instance::DOMAIN); ?>292 </p> 293 </td> 294 </tr> 295 <tr> 296 <th><?php _e('Exclude Categories / Tags', $ instance::DOMAIN); ?></th>290 <?php _e('You may wish to forbid automatic linking on certain posts or pages. Separate their ID by a comma.', $helper::DOMAIN); ?> 291 </p> 292 </td> 293 </tr> 294 <tr> 295 <th><?php _e('Exclude Categories / Tags', $helper::DOMAIN); ?></th> 297 296 <td> 298 297 <input type="text" name="term_ignore" size="90" 299 value="<?= $options['term_ignore']; ?>" placeholder="<?php _e('Add an ID', $ instance::DOMAIN); ?>"/>300 <p class="description"> 301 <?php _e('You may wish to forbid automatic linking on certain categories or tags. Separate their ID by a comma.', $ instance::DOMAIN); ?>298 value="<?= $options['term_ignore']; ?>" placeholder="<?php _e('Add an ID', $helper::DOMAIN); ?>"/> 299 <p class="description"> 300 <?php _e('You may wish to forbid automatic linking on certain categories or tags. Separate their ID by a comma.', $helper::DOMAIN); ?> 302 301 </p> 303 302 </td> … … 307 306 308 307 <h2 class="title"><?php _e('Options'); ?></h2> 309 <p><?php _e('How automatically link', $ instance::DOMAIN); ?></p>308 <p><?php _e('How automatically link', $helper::DOMAIN); ?></p> 310 309 <table class="form-table"> 311 310 <tbody> … … 313 312 <th> 314 313 <label for="max_links"> 315 <?php _e('Max Links', $ instance::DOMAIN); ?>314 <?php _e('Max Links', $helper::DOMAIN); ?> 316 315 </label> 317 316 </th> … … 319 318 <input type="number" name="max_links" id="max_links" size="2" value="<?= $options['max_links']; ?>"/> 320 319 <p class="description"> 321 <?php _e('You can limit the maximum number of different links that will be generated per post. Set to 0 for no limit.', $ instance::DOMAIN); ?>320 <?php _e('You can limit the maximum number of different links that will be generated per post. Set to 0 for no limit.', $helper::DOMAIN); ?> 322 321 </p> 323 322 </td> … … 326 325 <th> 327 326 <label for="max_single_keyword"> 328 <?php _e('Max Keyword Links', $ instance::DOMAIN); ?>327 <?php _e('Max Keyword Links', $helper::DOMAIN); ?> 329 328 </label> 330 329 </th> … … 332 331 <input type="number" name="max_single_keyword" id="max_single_keyword" size="2" value="<?= $options['max_single_keyword']; ?>"/> 333 332 <p class="description"> 334 <?php _e('You can limit the maximum number of links created with the same keyword. Set to 0 for no limit.', $ instance::DOMAIN); ?>333 <?php _e('You can limit the maximum number of links created with the same keyword. Set to 0 for no limit.', $helper::DOMAIN); ?> 335 334 </p> 336 335 </td> … … 339 338 <th> 340 339 <label for="max_single_url"> 341 <?php _e('Max Same URLs', $ instance::DOMAIN); ?>340 <?php _e('Max Same URLs', $helper::DOMAIN); ?> 342 341 </label> 343 342 </th> … … 345 344 <input type="number" name="max_single_url" id="max_single_url" size="2" value="<?= $options['max_single_url']; ?>"/> 346 345 <p class="description"> 347 <?php _e('Limit number of same URLs the plugin will link to. Works only when Max Keyword Links above is set to 1. Set to 0 for no limit.', $ instance::DOMAIN); ?>348 </p> 349 </td> 350 </tr> 351 <tr> 352 <th><?php _e('Case sensitive', $ instance::DOMAIN); ?></th>346 <?php _e('Limit number of same URLs the plugin will link to. Works only when Max Keyword Links above is set to 1. Set to 0 for no limit.', $helper::DOMAIN); ?> 347 </p> 348 </td> 349 </tr> 350 <tr> 351 <th><?php _e('Case sensitive', $helper::DOMAIN); ?></th> 353 352 <td> 354 353 <label> 355 354 <input type="checkbox" name="case_sensitive" <?= $options['case_sensitive']; ?> /> 356 <strong><?php _e('Enable case sensitivity', $ instance::DOMAIN); ?></strong>357 </label> 358 </td> 359 </tr> 360 <tr> 361 <th><?php _e('No follow', $ instance::DOMAIN); ?></th>355 <strong><?php _e('Enable case sensitivity', $helper::DOMAIN); ?></strong> 356 </label> 357 </td> 358 </tr> 359 <tr> 360 <th><?php _e('No follow', $helper::DOMAIN); ?></th> 362 361 <td> 363 362 <label> 364 363 <input type="checkbox" name="link_nofollow" <?= $options['link_nofollow']; ?>/> 365 <strong><?php _e('Add a nofollow attribute to the external links.', $ instance::DOMAIN); ?></strong>366 </label> 367 </td> 368 </tr> 369 <tr> 370 <th><?php _e('Open in new window', $ instance::DOMAIN); ?></th>364 <strong><?php _e('Add a nofollow attribute to the external links.', $helper::DOMAIN); ?></strong> 365 </label> 366 </td> 367 </tr> 368 <tr> 369 <th><?php _e('Open in new window', $helper::DOMAIN); ?></th> 371 370 <td> 372 371 <label> 373 372 <input type="checkbox" name="link_blank" <?= $options['link_blank']; ?>/> 374 <strong><?php _e('Open the external links in a new window.', $ instance::DOMAIN); ?></strong>373 <strong><?php _e('Open the external links in a new window.', $helper::DOMAIN); ?></strong> 375 374 </label> 376 375 </td> -
wp-auto-links/tags/1.2.0/vendor/autoload.php
r1994765 r1995970 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21::getLoader();7 return ComposerAutoloaderInit924981ff406542d5045ead6999706070::getLoader(); -
wp-auto-links/tags/1.2.0/vendor/composer/autoload_real.php
r1994765 r1995970 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be215 class ComposerAutoloaderInit924981ff406542d5045ead6999706070 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit924981ff406542d5045ead6999706070', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit924981ff406542d5045ead6999706070', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit924981ff406542d5045ead6999706070::getInitializer($loader)); 31 31 } else { 32 32 $map = require __DIR__ . '/autoload_namespaces.php'; -
wp-auto-links/tags/1.2.0/vendor/composer/autoload_static.php
r1994765 r1995970 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be217 class ComposerStaticInit924981ff406542d5045ead6999706070 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 122 122 { 123 123 return \Closure::bind(function () use ($loader) { 124 $loader->prefixLengthsPsr4 = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$prefixLengthsPsr4;125 $loader->prefixDirsPsr4 = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$prefixDirsPsr4;126 $loader->classMap = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$classMap;124 $loader->prefixLengthsPsr4 = ComposerStaticInit924981ff406542d5045ead6999706070::$prefixLengthsPsr4; 125 $loader->prefixDirsPsr4 = ComposerStaticInit924981ff406542d5045ead6999706070::$prefixDirsPsr4; 126 $loader->classMap = ComposerStaticInit924981ff406542d5045ead6999706070::$classMap; 127 127 128 128 }, null, ClassLoader::class); -
wp-auto-links/trunk/src/class-wp-auto-links-helper.php
r1994755 r1995970 258 258 259 259 /** 260 * @param mixed $value 261 * @param int $null 262 * @return int 263 */ 264 public static function option_integer($value, int $null = 0): int 265 { 266 return (is_numeric($value) && $value > 0) ? (int) $value : $null; 267 } 268 269 /** 260 270 * Instantiate the filter. 261 271 * -
wp-auto-links/trunk/templates/admin.php
r1994755 r1995970 5 5 */ 6 6 7 $ instance= WP_Auto_Links_Helper::get_instance();8 $options = $ instance->get_options();7 $helper = WP_Auto_Links_Helper::get_instance(); 8 $options = $helper->get_options(); 9 9 10 10 $boolean_options = [ … … 43 43 44 44 if (isset($_POST['submitted'])) { 45 check_admin_referer($instance::DOMAIN); 46 47 foreach ($integer_options + $boolean_options as $option_name) { 45 check_admin_referer($helper::DOMAIN); 46 47 foreach ($boolean_options as $option_name) { 48 $options[$option_name] = (isset($_POST[$option_name]) && !empty($_POST[$option_name])) ? (bool) $_POST[$option_name] : false; 49 } 50 51 foreach ($integer_options as $option_name) { 48 52 $val = (isset($_POST[$option_name]) && !empty($_POST[$option_name])) ? $_POST[$option_name] : 0; 49 53 $options[$option_name] = is_numeric($val) ? (int) $val : 1; … … 55 59 $options['term_ignore'] = array_filter(array_map('trim', explode(',', sanitize_text_field($_POST['term_ignore']))), 'is_numeric'); 56 60 57 $ instance->set_options($options);58 59 echo '<div class="updated"><p>' . __('Plugin settings saved.', $ instance::DOMAIN) . '</p></div>';61 $helper->set_options($options); 62 63 echo '<div class="updated"><p>' . __('Plugin settings saved.', $helper::DOMAIN) . '</p></div>'; 60 64 } 61 65 … … 72 76 $options['keywords'] = stripslashes($options['keywords']); 73 77 74 function not_null($value, int $null = 0): bool 75 { 76 return (is_numeric($value) && $value > 0) ? (int) $value : $null; 77 } 78 79 $options['max_links'] = not_null($options['max_links']); 80 $options['max_single_keyword'] = not_null($options['max_single_keyword'], -1); 81 $options['max_single_url'] = not_null($options['max_single_url']); 82 $options['min_term_usage'] = not_null($options['min_term_usage'], 1); 78 $options['max_links'] = $helper::option_integer($options['max_links']); 79 $options['max_single_keyword'] = $helper::option_integer($options['max_single_keyword'], -1); 80 $options['max_single_url'] = $helper::option_integer($options['max_single_url']); 81 $options['min_term_usage'] = $helper::option_integer($options['min_term_usage'], 1); 83 82 84 83 ?> … … 90 89 <input type="hidden" name="option_page" value="discussion"> 91 90 <input type="hidden" name="action" value="update"> 92 <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?= wp_create_nonce($ instance::DOMAIN); ?>"/>91 <input type="hidden" id="_wpnonce" name="_wpnonce" value="<?= wp_create_nonce($helper::DOMAIN); ?>"/> 93 92 <input type="hidden" name="submitted" value="1"/> 94 93 95 94 <h2 class="title"><?php _e('Keywords'); ?></h2> 96 <p><?php _e('Which custom keywords to automatically link.', $ instance::DOMAIN); ?></p>95 <p><?php _e('Which custom keywords to automatically link.', $helper::DOMAIN); ?></p> 97 96 <table class="form-table"> 98 97 <tbody> … … 106 105 <textarea name="keywords" id="keywords" rows="10" cols="90"><?= $options['keywords']; ?></textarea> 107 106 <p class="description"> 108 <?php _e('Use comma to separate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.', $ instance::DOMAIN); ?>107 <?php _e('Use comma to separate keywords and add target url at the end. Use a new line for new url and set of keywords. You can have these keywords link to any url, not only your site.', $helper::DOMAIN); ?> 109 108 </p> 110 109 <code>example,auto links,https://example.com</code><br/> … … 113 112 </tr> 114 113 <tr> 115 <th><?php _e('Duplicates', $ instance::DOMAIN); ?></th>114 <th><?php _e('Duplicates', $helper::DOMAIN); ?></th> 116 115 <td> 117 116 <label> 118 117 <input type="checkbox" name="prevent_duplicate_link" <?= $options['prevent_duplicate_link']; ?> /> 119 <strong><?php _e('Prevent a link to be used more than once in a content', $ instance::DOMAIN); ?></strong>120 </label> 121 </td> 122 </tr> 123 </tbody> 124 </table> 125 126 <h2 class="title"><?php _e('Placements', $ instance::DOMAIN); ?></h2>127 <p><?php _e('Where to automatically add links.', $ instance::DOMAIN); ?></p>118 <strong><?php _e('Prevent a link to be used more than once in a content', $helper::DOMAIN); ?></strong> 119 </label> 120 </td> 121 </tr> 122 </tbody> 123 </table> 124 125 <h2 class="title"><?php _e('Placements', $helper::DOMAIN); ?></h2> 126 <p><?php _e('Where to automatically add links.', $helper::DOMAIN); ?></p> 128 127 <table class="form-table"> 129 128 <tbody> … … 138 137 <label> 139 138 <input type="checkbox" name="on_post_self" <?= $options['on_post_self']; ?>/> 140 <strong><?php _e('Enable self linking for posts', $ instance::DOMAIN); ?></strong>139 <strong><?php _e('Enable self linking for posts', $helper::DOMAIN); ?></strong> 141 140 </label> 142 141 </td> … … 152 151 <label> 153 152 <input type="checkbox" name="on_page_self" <?= $options['on_page_self']; ?>/> 154 <strong><?php _e('Enable self linking for pages', $ instance::DOMAIN); ?></strong>153 <strong><?php _e('Enable self linking for pages', $helper::DOMAIN); ?></strong> 155 154 </label> 156 155 </td> … … 163 162 <strong><?php _e('Enable to link in comments'); ?></strong> 164 163 </label> 165 <?= $ instance->may_slow_down(); ?>166 </td> 167 </tr> 168 <tr> 169 <th><?php _e('Feeds', $ instance::DOMAIN); ?></th>164 <?= $helper->may_slow_down(); ?> 165 </td> 166 </tr> 167 <tr> 168 <th><?php _e('Feeds', $helper::DOMAIN); ?></th> 170 169 <td> 171 170 <label> 172 171 <input type="checkbox" name="on_feed" <?= $options['on_feed']; ?> /> 173 <strong><?php _e('Enable to link in feeds', $ instance::DOMAIN); ?></strong>174 </label> 175 <p class="description"> 176 177 </p> 178 </td> 179 </tr> 180 <tr> 181 <th><?php _e('Archives', $ instance::DOMAIN); ?></th>172 <strong><?php _e('Enable to link in feeds', $helper::DOMAIN); ?></strong> 173 </label> 174 <p class="description"> 175 176 </p> 177 </td> 178 </tr> 179 <tr> 180 <th><?php _e('Archives', $helper::DOMAIN); ?></th> 182 181 <td> 183 182 <label> 184 183 <input type="checkbox" name="on_archive" <?= $options['on_archive']; ?>/> 185 <strong><?php _e('Enable to link on archive and index pages (including home page)', $ instance::DOMAIN); ?></strong>186 </label> 187 <?= $ instance->may_slow_down(); ?>188 </td> 189 </tr> 190 <tr> 191 <th><?php _e('Heading', $ instance::DOMAIN); ?></th>184 <strong><?php _e('Enable to link on archive and index pages (including home page)', $helper::DOMAIN); ?></strong> 185 </label> 186 <?= $helper->may_slow_down(); ?> 187 </td> 188 </tr> 189 <tr> 190 <th><?php _e('Heading', $helper::DOMAIN); ?></th> 192 191 <td> 193 192 <label> 194 193 <input type="checkbox" name="on_heading" <?= $options['on_heading']; ?>/> 195 <strong><?php _e('Enable to link in heading tags (h1, h2, h3, h4, h5 and h6)', $ instance::DOMAIN); ?></strong>196 </label> 197 </td> 198 </tr> 199 </tbody> 200 </table> 201 202 <h2 class="title"><?php _e('Targeting', $ instance::DOMAIN); ?></h2>203 <p><?php _e('What to automatically link.', $ instance::DOMAIN); ?></p>194 <strong><?php _e('Enable to link in heading tags (h1, h2, h3, h4, h5 and h6)', $helper::DOMAIN); ?></strong> 195 </label> 196 </td> 197 </tr> 198 </tbody> 199 </table> 200 201 <h2 class="title"><?php _e('Targeting', $helper::DOMAIN); ?></h2> 202 <p><?php _e('What to automatically link.', $helper::DOMAIN); ?></p> 204 203 <table class="form-table"> 205 204 <tbody> … … 209 208 <label> 210 209 <input type="checkbox" name="keywords_enable" <?= $options['keywords_enable']; ?> /> 211 <strong><?php _e('Enable to link links with custom keywords', $ instance::DOMAIN); ?></strong>212 </label> 213 <?= $ instance->may_slow_down(); ?>210 <strong><?php _e('Enable to link links with custom keywords', $helper::DOMAIN); ?></strong> 211 </label> 212 <?= $helper->may_slow_down(); ?> 214 213 </td> 215 214 </tr> … … 219 218 <label> 220 219 <input type="checkbox" name="posts_enable" <?= $options['posts_enable']; ?> /> 221 <strong><?php _e('Enable to link internal links to posts', $ instance::DOMAIN); ?></strong>222 </label> 223 <?= $ instance->may_slow_down(); ?>220 <strong><?php _e('Enable to link internal links to posts', $helper::DOMAIN); ?></strong> 221 </label> 222 <?= $helper->may_slow_down(); ?> 224 223 </td> 225 224 </tr> … … 229 228 <label> 230 229 <input type="checkbox" name="pages_enable" <?= $options['pages_enable']; ?> /> 231 <strong><?php _e('Enable to link internal links to pages', $ instance::DOMAIN); ?></strong>232 </label> 233 <?= $ instance->may_slow_down(); ?>230 <strong><?php _e('Enable to link internal links to pages', $helper::DOMAIN); ?></strong> 231 </label> 232 <?= $helper->may_slow_down(); ?> 234 233 </td> 235 234 </tr> … … 239 238 <label> 240 239 <input type="checkbox" name="categories_enable" <?= $options['categories_enable']; ?> /> 241 <strong><?php _e('Enable to link internal links to categories', $ instance::DOMAIN); ?></strong>242 </label> 243 <?= $ instance->may_slow_down(); ?>240 <strong><?php _e('Enable to link internal links to categories', $helper::DOMAIN); ?></strong> 241 </label> 242 <?= $helper->may_slow_down(); ?> 244 243 </td> 245 244 </tr> … … 249 248 <label> 250 249 <input type="checkbox" name="tags_enable" <?= $options['tags_enable']; ?> /> 251 <strong><?php _e('Enable to link internal links to tags', $ instance::DOMAIN); ?></strong>252 </label> 253 <?= $ instance->may_slow_down(); ?>250 <strong><?php _e('Enable to link internal links to tags', $helper::DOMAIN); ?></strong> 251 </label> 252 <?= $helper->may_slow_down(); ?> 254 253 </td> 255 254 </tr> … … 257 256 <th> 258 257 <label for="min_term_usage"> 259 <?php _e('Minimum categories / tags', $ instance::DOMAIN); ?>258 <?php _e('Minimum categories / tags', $helper::DOMAIN); ?> 260 259 </label> 261 260 </th> … … 263 262 <input type="number" name="min_term_usage" id="min_term_usage" size="2" value="<?= $options['min_term_usage']; ?>"/> 264 263 <p class="description"> 265 <?php _e('Only link categories and tags that have been used the above number of times or more.', $ instance::DOMAIN); ?>266 </p> 267 </td> 268 </tr> 269 </tbody> 270 </table> 271 272 <h2 class="title"><?php _e('Excluding', $ instance::DOMAIN); ?></h2>273 <table class="form-table"> 274 <tbody> 275 <tr> 276 <th><?php _e('Exclude Keywords', $ instance::DOMAIN); ?></th>264 <?php _e('Only link categories and tags that have been used the above number of times or more.', $helper::DOMAIN); ?> 265 </p> 266 </td> 267 </tr> 268 </tbody> 269 </table> 270 271 <h2 class="title"><?php _e('Excluding', $helper::DOMAIN); ?></h2> 272 <table class="form-table"> 273 <tbody> 274 <tr> 275 <th><?php _e('Exclude Keywords', $helper::DOMAIN); ?></th> 277 276 <td> 278 277 <input type="text" name="keyword_ignore" size="90" 279 value="<?= $options['keyword_ignore']; ?>" placeholder="<?php _e('Add a word', $ instance::DOMAIN); ?>"/>280 <p class="description"> 281 <?php _e('You may wish to ignore certain words or phrases from automatic linking. Separate them by comma.', $ instance::DOMAIN); ?>282 </p> 283 </td> 284 </tr> 285 <tr> 286 <th><?php _e('Exclude Posts / Pages', $ instance::DOMAIN); ?></th>278 value="<?= $options['keyword_ignore']; ?>" placeholder="<?php _e('Add a word', $helper::DOMAIN); ?>"/> 279 <p class="description"> 280 <?php _e('You may wish to ignore certain words or phrases from automatic linking. Separate them by comma.', $helper::DOMAIN); ?> 281 </p> 282 </td> 283 </tr> 284 <tr> 285 <th><?php _e('Exclude Posts / Pages', $helper::DOMAIN); ?></th> 287 286 <td> 288 287 <input type="text" name="post_ignore" size="90" 289 288 value="<?= $options['post_ignore']; ?>" placeholder="<?php _e('Add an ID'); ?>"/> 290 289 <p class="description"> 291 <?php _e('You may wish to forbid automatic linking on certain posts or pages. Separate their ID by a comma.', $ instance::DOMAIN); ?>292 </p> 293 </td> 294 </tr> 295 <tr> 296 <th><?php _e('Exclude Categories / Tags', $ instance::DOMAIN); ?></th>290 <?php _e('You may wish to forbid automatic linking on certain posts or pages. Separate their ID by a comma.', $helper::DOMAIN); ?> 291 </p> 292 </td> 293 </tr> 294 <tr> 295 <th><?php _e('Exclude Categories / Tags', $helper::DOMAIN); ?></th> 297 296 <td> 298 297 <input type="text" name="term_ignore" size="90" 299 value="<?= $options['term_ignore']; ?>" placeholder="<?php _e('Add an ID', $ instance::DOMAIN); ?>"/>300 <p class="description"> 301 <?php _e('You may wish to forbid automatic linking on certain categories or tags. Separate their ID by a comma.', $ instance::DOMAIN); ?>298 value="<?= $options['term_ignore']; ?>" placeholder="<?php _e('Add an ID', $helper::DOMAIN); ?>"/> 299 <p class="description"> 300 <?php _e('You may wish to forbid automatic linking on certain categories or tags. Separate their ID by a comma.', $helper::DOMAIN); ?> 302 301 </p> 303 302 </td> … … 307 306 308 307 <h2 class="title"><?php _e('Options'); ?></h2> 309 <p><?php _e('How automatically link', $ instance::DOMAIN); ?></p>308 <p><?php _e('How automatically link', $helper::DOMAIN); ?></p> 310 309 <table class="form-table"> 311 310 <tbody> … … 313 312 <th> 314 313 <label for="max_links"> 315 <?php _e('Max Links', $ instance::DOMAIN); ?>314 <?php _e('Max Links', $helper::DOMAIN); ?> 316 315 </label> 317 316 </th> … … 319 318 <input type="number" name="max_links" id="max_links" size="2" value="<?= $options['max_links']; ?>"/> 320 319 <p class="description"> 321 <?php _e('You can limit the maximum number of different links that will be generated per post. Set to 0 for no limit.', $ instance::DOMAIN); ?>320 <?php _e('You can limit the maximum number of different links that will be generated per post. Set to 0 for no limit.', $helper::DOMAIN); ?> 322 321 </p> 323 322 </td> … … 326 325 <th> 327 326 <label for="max_single_keyword"> 328 <?php _e('Max Keyword Links', $ instance::DOMAIN); ?>327 <?php _e('Max Keyword Links', $helper::DOMAIN); ?> 329 328 </label> 330 329 </th> … … 332 331 <input type="number" name="max_single_keyword" id="max_single_keyword" size="2" value="<?= $options['max_single_keyword']; ?>"/> 333 332 <p class="description"> 334 <?php _e('You can limit the maximum number of links created with the same keyword. Set to 0 for no limit.', $ instance::DOMAIN); ?>333 <?php _e('You can limit the maximum number of links created with the same keyword. Set to 0 for no limit.', $helper::DOMAIN); ?> 335 334 </p> 336 335 </td> … … 339 338 <th> 340 339 <label for="max_single_url"> 341 <?php _e('Max Same URLs', $ instance::DOMAIN); ?>340 <?php _e('Max Same URLs', $helper::DOMAIN); ?> 342 341 </label> 343 342 </th> … … 345 344 <input type="number" name="max_single_url" id="max_single_url" size="2" value="<?= $options['max_single_url']; ?>"/> 346 345 <p class="description"> 347 <?php _e('Limit number of same URLs the plugin will link to. Works only when Max Keyword Links above is set to 1. Set to 0 for no limit.', $ instance::DOMAIN); ?>348 </p> 349 </td> 350 </tr> 351 <tr> 352 <th><?php _e('Case sensitive', $ instance::DOMAIN); ?></th>346 <?php _e('Limit number of same URLs the plugin will link to. Works only when Max Keyword Links above is set to 1. Set to 0 for no limit.', $helper::DOMAIN); ?> 347 </p> 348 </td> 349 </tr> 350 <tr> 351 <th><?php _e('Case sensitive', $helper::DOMAIN); ?></th> 353 352 <td> 354 353 <label> 355 354 <input type="checkbox" name="case_sensitive" <?= $options['case_sensitive']; ?> /> 356 <strong><?php _e('Enable case sensitivity', $ instance::DOMAIN); ?></strong>357 </label> 358 </td> 359 </tr> 360 <tr> 361 <th><?php _e('No follow', $ instance::DOMAIN); ?></th>355 <strong><?php _e('Enable case sensitivity', $helper::DOMAIN); ?></strong> 356 </label> 357 </td> 358 </tr> 359 <tr> 360 <th><?php _e('No follow', $helper::DOMAIN); ?></th> 362 361 <td> 363 362 <label> 364 363 <input type="checkbox" name="link_nofollow" <?= $options['link_nofollow']; ?>/> 365 <strong><?php _e('Add a nofollow attribute to the external links.', $ instance::DOMAIN); ?></strong>366 </label> 367 </td> 368 </tr> 369 <tr> 370 <th><?php _e('Open in new window', $ instance::DOMAIN); ?></th>364 <strong><?php _e('Add a nofollow attribute to the external links.', $helper::DOMAIN); ?></strong> 365 </label> 366 </td> 367 </tr> 368 <tr> 369 <th><?php _e('Open in new window', $helper::DOMAIN); ?></th> 371 370 <td> 372 371 <label> 373 372 <input type="checkbox" name="link_blank" <?= $options['link_blank']; ?>/> 374 <strong><?php _e('Open the external links in a new window.', $ instance::DOMAIN); ?></strong>373 <strong><?php _e('Open the external links in a new window.', $helper::DOMAIN); ?></strong> 375 374 </label> 376 375 </td> -
wp-auto-links/trunk/vendor/autoload.php
r1994765 r1995970 5 5 require_once __DIR__ . '/composer/autoload_real.php'; 6 6 7 return ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21::getLoader();7 return ComposerAutoloaderInit924981ff406542d5045ead6999706070::getLoader(); -
wp-auto-links/trunk/vendor/composer/autoload_real.php
r1994765 r1995970 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be215 class ComposerAutoloaderInit924981ff406542d5045ead6999706070 6 6 { 7 7 private static $loader; … … 20 20 } 21 21 22 spl_autoload_register(array('ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21', 'loadClassLoader'), true, true);22 spl_autoload_register(array('ComposerAutoloaderInit924981ff406542d5045ead6999706070', 'loadClassLoader'), true, true); 23 23 self::$loader = $loader = new \Composer\Autoload\ClassLoader(); 24 spl_autoload_unregister(array('ComposerAutoloaderInit ed7cf8d6445ccabd2c78f8bf66b1be21', 'loadClassLoader'));24 spl_autoload_unregister(array('ComposerAutoloaderInit924981ff406542d5045ead6999706070', 'loadClassLoader')); 25 25 26 26 $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); … … 28 28 require_once __DIR__ . '/autoload_static.php'; 29 29 30 call_user_func(\Composer\Autoload\ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::getInitializer($loader));30 call_user_func(\Composer\Autoload\ComposerStaticInit924981ff406542d5045ead6999706070::getInitializer($loader)); 31 31 } else { 32 32 $map = require __DIR__ . '/autoload_namespaces.php'; -
wp-auto-links/trunk/vendor/composer/autoload_static.php
r1994765 r1995970 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be217 class ComposerStaticInit924981ff406542d5045ead6999706070 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 122 122 { 123 123 return \Closure::bind(function () use ($loader) { 124 $loader->prefixLengthsPsr4 = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$prefixLengthsPsr4;125 $loader->prefixDirsPsr4 = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$prefixDirsPsr4;126 $loader->classMap = ComposerStaticInit ed7cf8d6445ccabd2c78f8bf66b1be21::$classMap;124 $loader->prefixLengthsPsr4 = ComposerStaticInit924981ff406542d5045ead6999706070::$prefixLengthsPsr4; 125 $loader->prefixDirsPsr4 = ComposerStaticInit924981ff406542d5045ead6999706070::$prefixDirsPsr4; 126 $loader->classMap = ComposerStaticInit924981ff406542d5045ead6999706070::$classMap; 127 127 128 128 }, null, ClassLoader::class);
Note: See TracChangeset
for help on using the changeset viewer.