Version Description
- Added action hook wpel_ready
- Added filter hook wpel_external_link
- Added output flush on wp_footer
- Fixed Bug: spaces before url in href-attribute not recognized as external link
- Fixed Bug: external links not processed (regexpr tag conflict starting with an a, like
- Cosmetic changes: added "Admin Settings", replaced help icon, restyled tooltip texts, removed "About this plugin" box
Download this release
Release Info
| Developer | freelancephp |
| Plugin | |
| Version | 1.40 |
| Comparing to | |
| See all releases | |
Code changes from version 1.31 to 1.40
- css/admin-wp-external-links.css +37 -0
- css/external-links.css +0 -21
- css/tipsy.css +0 -7
- css/wp-external-links.css +21 -0
- images/{external-1.png → ext-icons/ext-icon-1.png} +0 -0
- images/{external-10.png → ext-icons/ext-icon-10.png} +0 -0
- images/{external-11.png → ext-icons/ext-icon-11.png} +0 -0
- images/{external-12.png → ext-icons/ext-icon-12.png} +0 -0
- images/{external-13.png → ext-icons/ext-icon-13.png} +0 -0
- images/{external-14.png → ext-icons/ext-icon-14.png} +0 -0
- images/{external-15.png → ext-icons/ext-icon-15.png} +0 -0
- images/{external-16.png → ext-icons/ext-icon-16.png} +0 -0
- images/{external-17.png → ext-icons/ext-icon-17.png} +0 -0
- images/{external-18.png → ext-icons/ext-icon-18.png} +0 -0
- images/{external-19.png → ext-icons/ext-icon-19.png} +0 -0
- images/{external-2.png → ext-icons/ext-icon-2.png} +0 -0
- images/{external-20.png → ext-icons/ext-icon-20.png} +0 -0
- images/{external-3.png → ext-icons/ext-icon-3.png} +0 -0
- images/{external-4.png → ext-icons/ext-icon-4.png} +0 -0
- images/{external-5.png → ext-icons/ext-icon-5.png} +0 -0
- images/{external-6.png → ext-icons/ext-icon-6.png} +0 -0
- images/{external-7.png → ext-icons/ext-icon-7.png} +0 -0
- images/{external-8.png → ext-icons/ext-icon-8.png} +0 -0
- images/{external-9.png → ext-icons/ext-icon-9.png} +0 -0
- images/external-12_1.png +0 -0
- images/external-13_1.png +0 -0
- images/external-14_1.png +0 -0
- images/external-15_1.png +0 -0
- images/help-icon.png +0 -0
- images/icon-email-encoder-bundle-32.png +0 -0
- images/icon-email-encoder-bundle.png +0 -0
- images/icon-wp-16.gif +0 -0
- images/icon-wp-external-links.png +0 -0
- images/icon-wp-mailto-links-32.png +0 -0
- images/icon-wp-mailto-links.png +0 -0
- images/icon.png +0 -0
- includes/admin-external-links.php +0 -511
- includes/class-admin-external-links.php +67 -24
- includes/class-wp-external-links.php +27 -6
- includes/wp-plugin-dev-classes/class-wp-meta-box-page.php +2 -0
- includes/wp-plugin-dev-classes/class-wp-option-forms.php +2 -0
- includes/wp-plugin-dev-classes/wp-option-forms.js +3 -0
- js/admin-external-links.js +0 -61
- js/admin-wp-external-links.js +158 -0
- js/jquery.tipsy.js +0 -104
- js/{external-links.js → wp-external-links.js} +0 -0
- readme.txt +48 -12
- wp-external-links.php +4 -2
css/admin-wp-external-links.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Admin - WP External Links Plugin */
|
| 2 |
+
.tooltip-help { text-decoration: none; }
|
| 3 |
+
|
| 4 |
+
/* Tipsy Plugin */
|
| 5 |
+
.tipsy {
|
| 6 |
+
padding: 5px;
|
| 7 |
+
/*
|
| 8 |
+
opacity: 0.9;
|
| 9 |
+
filter: alpha(opacity=90);
|
| 10 |
+
background-repeat: no-repeat;
|
| 11 |
+
background-image: url(../images/tipsy.gif);
|
| 12 |
+
*/
|
| 13 |
+
}
|
| 14 |
+
.tipsy-inner {
|
| 15 |
+
padding: 5px 8px 4px 8px;
|
| 16 |
+
color: white;
|
| 17 |
+
max-width: 200px;
|
| 18 |
+
text-align: center;
|
| 19 |
+
text-shadow: 0 -1px 0 #333;
|
| 20 |
+
/* background-position: top right;*/
|
| 21 |
+
border-top:1px solid #808080;
|
| 22 |
+
border-botom:1px solid #6d6d6d;
|
| 23 |
+
-webkit-border-radius: 3px;
|
| 24 |
+
-moz-border-radius: 3px;
|
| 25 |
+
border-radius: 3px;
|
| 26 |
+
background-color:#777;
|
| 27 |
+
background-image:-ms-linear-gradient(bottom,#6d6d6d,#808080);
|
| 28 |
+
background-image:-moz-linear-gradient(bottom,#6d6d6d,#808080);
|
| 29 |
+
background-image:-o-linear-gradient(bottom,#6d6d6d,#808080);
|
| 30 |
+
background-image:-webkit-gradient(linear,left bottom,left top,from(#6d6d6d),to(#808080));
|
| 31 |
+
background-image:-webkit-linear-gradient(bottom,#6d6d6d,#808080);
|
| 32 |
+
background-image:linear-gradient(bottom,#6d6d6d,#808080);
|
| 33 |
+
}
|
| 34 |
+
.tipsy-north { background-position: top center; }
|
| 35 |
+
.tipsy-south { background-position: bottom center; }
|
| 36 |
+
.tipsy-east { background-position: right center; }
|
| 37 |
+
.tipsy-west { background-position: center bottom; }
|
css/external-links.css
DELETED
|
@@ -1,21 +0,0 @@
|
|
| 1 |
-
/* WP External Links Plugin */
|
| 2 |
-
.ext-icon-1 { background: url( ../images/external-1.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 3 |
-
.ext-icon-2 { background: url( ../images/external-2.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 4 |
-
.ext-icon-3 { background: url( ../images/external-3.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 5 |
-
.ext-icon-4 { background: url( ../images/external-4.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 6 |
-
.ext-icon-5 { background: url( ../images/external-5.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 7 |
-
.ext-icon-6 { background: url( ../images/external-6.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 8 |
-
.ext-icon-7 { background: url( ../images/external-7.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 9 |
-
.ext-icon-8 { background: url( ../images/external-8.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 10 |
-
.ext-icon-9 { background: url( ../images/external-9.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 11 |
-
.ext-icon-10 { background: url( ../images/external-10.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 12 |
-
.ext-icon-11 { background: url( ../images/external-11.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 13 |
-
.ext-icon-12 { background: url( ../images/external-12.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 14 |
-
.ext-icon-13 { background: url( ../images/external-13.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 15 |
-
.ext-icon-14 { background: url( ../images/external-14.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 16 |
-
.ext-icon-15 { background: url( ../images/external-15.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 17 |
-
.ext-icon-16 { background: url( ../images/external-16.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 18 |
-
.ext-icon-17 { background: url( ../images/external-17.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 19 |
-
.ext-icon-18 { background: url( ../images/external-18.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 20 |
-
.ext-icon-19 { background: url( ../images/external-19.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 21 |
-
.ext-icon-20 { background: url( ../images/external-20.png ) no-repeat 100% 0; padding-right: 12px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/tipsy.css
DELETED
|
@@ -1,7 +0,0 @@
|
|
| 1 |
-
.tipsy { padding: 5px; font-size: 11px; opacity: 0.8; filter: alpha(opacity=80); background-repeat: no-repeat; background-image: url(../images/tipsy.gif); }
|
| 2 |
-
.tipsy-inner { padding: 5px 8px 4px 8px; background-color: black; color: white; max-width: 200px; text-align: center; }
|
| 3 |
-
.tipsy-inner { -moz-border-radius:3px; -webkit-border-radius:3px; }
|
| 4 |
-
.tipsy-north { background-position: top center; }
|
| 5 |
-
.tipsy-south { background-position: bottom center; }
|
| 6 |
-
.tipsy-east { background-position: right center; }
|
| 7 |
-
.tipsy-west { background-position: left center; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/wp-external-links.css
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* WP External Links Plugin */
|
| 2 |
+
.ext-icon-1 { background: url( ../images/ext-icons/ext-icon-1.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 3 |
+
.ext-icon-2 { background: url( ../images/ext-icons/ext-icon-2.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 4 |
+
.ext-icon-3 { background: url( ../images/ext-icons/ext-icon-3.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 5 |
+
.ext-icon-4 { background: url( ../images/ext-icons/ext-icon-4.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 6 |
+
.ext-icon-5 { background: url( ../images/ext-icons/ext-icon-5.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 7 |
+
.ext-icon-6 { background: url( ../images/ext-icons/ext-icon-6.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 8 |
+
.ext-icon-7 { background: url( ../images/ext-icons/ext-icon-7.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 9 |
+
.ext-icon-8 { background: url( ../images/ext-icons/ext-icon-8.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 10 |
+
.ext-icon-9 { background: url( ../images/ext-icons/ext-icon-9.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 11 |
+
.ext-icon-10 { background: url( ../images/ext-icons/ext-icon-10.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 12 |
+
.ext-icon-11 { background: url( ../images/ext-icons/ext-icon-11.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 13 |
+
.ext-icon-12 { background: url( ../images/ext-icons/ext-icon-12.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 14 |
+
.ext-icon-13 { background: url( ../images/ext-icons/ext-icon-13.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 15 |
+
.ext-icon-14 { background: url( ../images/ext-icons/ext-icon-14.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 16 |
+
.ext-icon-15 { background: url( ../images/ext-icons/ext-icon-15.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 17 |
+
.ext-icon-16 { background: url( ../images/ext-icons/ext-icon-16.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 18 |
+
.ext-icon-17 { background: url( ../images/ext-icons/ext-icon-17.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 19 |
+
.ext-icon-18 { background: url( ../images/ext-icons/ext-icon-18.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 20 |
+
.ext-icon-19 { background: url( ../images/ext-icons/ext-icon-19.png ) no-repeat 100% 50%; padding-right: 15px; }
|
| 21 |
+
.ext-icon-20 { background: url( ../images/ext-icons/ext-icon-20.png ) no-repeat 100% 0; padding-right: 12px; }
|
images/{external-1.png → ext-icons/ext-icon-1.png}
RENAMED
|
File without changes
|
images/{external-10.png → ext-icons/ext-icon-10.png}
RENAMED
|
File without changes
|
images/{external-11.png → ext-icons/ext-icon-11.png}
RENAMED
|
File without changes
|
images/{external-12.png → ext-icons/ext-icon-12.png}
RENAMED
|
File without changes
|
images/{external-13.png → ext-icons/ext-icon-13.png}
RENAMED
|
File without changes
|
images/{external-14.png → ext-icons/ext-icon-14.png}
RENAMED
|
File without changes
|
images/{external-15.png → ext-icons/ext-icon-15.png}
RENAMED
|
File without changes
|
images/{external-16.png → ext-icons/ext-icon-16.png}
RENAMED
|
File without changes
|
images/{external-17.png → ext-icons/ext-icon-17.png}
RENAMED
|
File without changes
|
images/{external-18.png → ext-icons/ext-icon-18.png}
RENAMED
|
File without changes
|
images/{external-19.png → ext-icons/ext-icon-19.png}
RENAMED
|
File without changes
|
images/{external-2.png → ext-icons/ext-icon-2.png}
RENAMED
|
File without changes
|
images/{external-20.png → ext-icons/ext-icon-20.png}
RENAMED
|
File without changes
|
images/{external-3.png → ext-icons/ext-icon-3.png}
RENAMED
|
File without changes
|
images/{external-4.png → ext-icons/ext-icon-4.png}
RENAMED
|
File without changes
|
images/{external-5.png → ext-icons/ext-icon-5.png}
RENAMED
|
File without changes
|
images/{external-6.png → ext-icons/ext-icon-6.png}
RENAMED
|
File without changes
|
images/{external-7.png → ext-icons/ext-icon-7.png}
RENAMED
|
File without changes
|
images/{external-8.png → ext-icons/ext-icon-8.png}
RENAMED
|
File without changes
|
images/{external-9.png → ext-icons/ext-icon-9.png}
RENAMED
|
File without changes
|
images/external-12_1.png
DELETED
|
Binary file
|
images/external-13_1.png
DELETED
|
Binary file
|
images/external-14_1.png
DELETED
|
Binary file
|
images/external-15_1.png
DELETED
|
Binary file
|
images/help-icon.png
DELETED
|
Binary file
|
images/icon-email-encoder-bundle-32.png
DELETED
|
Binary file
|
images/icon-email-encoder-bundle.png
DELETED
|
Binary file
|
images/icon-wp-16.gif
DELETED
|
Binary file
|
images/icon-wp-external-links.png
DELETED
|
Binary file
|
images/icon-wp-mailto-links-32.png
DELETED
|
Binary file
|
images/icon-wp-mailto-links.png
DELETED
|
Binary file
|
images/icon.png
DELETED
|
Binary file
|
includes/admin-external-links.php
DELETED
|
@@ -1,511 +0,0 @@
|
|
| 1 |
-
<?php defined( 'ABSPATH' ) OR die( 'No direct access.' );
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Class Admin_External_Links
|
| 5 |
-
* @category WordPress Plugins
|
| 6 |
-
*/
|
| 7 |
-
final class Admin_External_Links {
|
| 8 |
-
|
| 9 |
-
/**
|
| 10 |
-
* Used as text domain (for translations)
|
| 11 |
-
* @var string
|
| 12 |
-
*/
|
| 13 |
-
protected $domain = 'wp_external_links';
|
| 14 |
-
|
| 15 |
-
/**
|
| 16 |
-
* Options to be saved and their default values
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
protected $save_options = array(
|
| 20 |
-
'general' => array(
|
| 21 |
-
'target' => '_none',
|
| 22 |
-
'use_js' => 1,
|
| 23 |
-
'external' => 1,
|
| 24 |
-
'nofollow' => 1,
|
| 25 |
-
'title' => '%title%',
|
| 26 |
-
'filter_page' => 1,
|
| 27 |
-
'filter_posts' => 1,
|
| 28 |
-
'filter_comments' => 1,
|
| 29 |
-
'filter_widgets' => 1,
|
| 30 |
-
'class_name' => 'ext-link',
|
| 31 |
-
'filter_excl_sel' => '.excl-ext-link',
|
| 32 |
-
),
|
| 33 |
-
'style' => array(
|
| 34 |
-
'icon' => 0,
|
| 35 |
-
'no_icon_class' => 'no-ext-icon',
|
| 36 |
-
'no_icon_same_window' => 0,
|
| 37 |
-
),
|
| 38 |
-
'screen' => array(
|
| 39 |
-
'menu_position' => NULL,
|
| 40 |
-
),
|
| 41 |
-
);
|
| 42 |
-
|
| 43 |
-
/**
|
| 44 |
-
* Meta box page object
|
| 45 |
-
* @var WP_Meta_Box_Page
|
| 46 |
-
*/
|
| 47 |
-
public $meta_box_page = NULL;
|
| 48 |
-
|
| 49 |
-
/**
|
| 50 |
-
* Ajax form object
|
| 51 |
-
* @var WP_Ajax_Option_Form
|
| 52 |
-
*/
|
| 53 |
-
public $form = NULL;
|
| 54 |
-
|
| 55 |
-
/**
|
| 56 |
-
* Location of the plugin file
|
| 57 |
-
* @var string
|
| 58 |
-
*/
|
| 59 |
-
protected $plugin_file = NULL;
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
/**
|
| 63 |
-
* Constructor
|
| 64 |
-
* @param string $file Location of the plugin file
|
| 65 |
-
*/
|
| 66 |
-
public function __construct( $plugin_file = NULL ) {
|
| 67 |
-
// set location of plugin file
|
| 68 |
-
$this->plugin_file = ( $plugin_file === NULL ) ? __FILE__ : $plugin_file;
|
| 69 |
-
|
| 70 |
-
// set meta box page
|
| 71 |
-
$this->meta_box_page = new WP_Meta_Box_Page_01();
|
| 72 |
-
|
| 73 |
-
// set ajax forms (also used by front-end)
|
| 74 |
-
$this->form = new WP_Option_Forms_01( $this->domain, $this->save_options );
|
| 75 |
-
|
| 76 |
-
// init admin
|
| 77 |
-
if ( is_admin() )
|
| 78 |
-
$this->init();
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
/**
|
| 82 |
-
* Initialize Admin
|
| 83 |
-
*/
|
| 84 |
-
public function init() {
|
| 85 |
-
// load text domain for translations
|
| 86 |
-
load_plugin_textdomain( $this->domain, FALSE, dirname( plugin_basename( $this->plugin_file ) ) . '/lang/' );
|
| 87 |
-
|
| 88 |
-
// set activation hook
|
| 89 |
-
register_activation_hook( $this->plugin_file, array( $this, 'call_activation' ) );
|
| 90 |
-
|
| 91 |
-
// set deactivation hook
|
| 92 |
-
register_deactivation_hook( $this->plugin_file, array( $this, 'call_deactivation' ) );
|
| 93 |
-
|
| 94 |
-
// set options for add_page_method
|
| 95 |
-
$menu_pos = $this->form->set_current_option( 'screen' )->value( 'menu_position' );
|
| 96 |
-
|
| 97 |
-
// init meta box page
|
| 98 |
-
$this->meta_box_page->init(
|
| 99 |
-
// settings
|
| 100 |
-
array(
|
| 101 |
-
'menu_title' => $this->__( 'External Links' ),
|
| 102 |
-
'page_slug' => strtolower( $this->domain ),
|
| 103 |
-
'add_page_method' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? 'add_submenu_page' : 'add_menu_page',
|
| 104 |
-
'parent_slug' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? $menu_pos : NULL,
|
| 105 |
-
'column_widths' => array(
|
| 106 |
-
1 => array( 99 ),
|
| 107 |
-
2 => array( 69, 29 ),
|
| 108 |
-
),
|
| 109 |
-
'icon_url' => plugins_url( 'images/icon-wp-external-links-16.png', $this->plugin_file ),
|
| 110 |
-
),
|
| 111 |
-
// load callback
|
| 112 |
-
array( $this, 'call_load_meta_box' )
|
| 113 |
-
);
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/**
|
| 117 |
-
* Translate text in current domain
|
| 118 |
-
* @param string $text
|
| 119 |
-
* @return string
|
| 120 |
-
*/
|
| 121 |
-
public function __( $text ) {
|
| 122 |
-
return translate( $text, $this->domain );
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
/**
|
| 126 |
-
* Translate text in current domain
|
| 127 |
-
* @param string $text
|
| 128 |
-
* @return string
|
| 129 |
-
*/
|
| 130 |
-
public function _e( $text ) {
|
| 131 |
-
echo translate( $text, $this->domain );
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
/**
|
| 135 |
-
* Load meta box action
|
| 136 |
-
*/
|
| 137 |
-
public function call_load_meta_box( $meta_box ) {
|
| 138 |
-
// add filters
|
| 139 |
-
$meta_box->add_title_filter( array( $this, 'call_page_title' ) )
|
| 140 |
-
->add_screen_settings_filter( array( $this, 'call_screen_settings' ) )
|
| 141 |
-
->add_contextual_help_filter( array( $this, 'call_contextual_help' ) );
|
| 142 |
-
|
| 143 |
-
// add meta boxes
|
| 144 |
-
// add_meta_box( $title, $callback, $context = 'normal', $id = NULL, $priority = 'default', $callback_args = NULL )
|
| 145 |
-
$meta_box->add_meta_box( $this->__( 'General Settings' ), array( $this, 'call_box_general_settings' ), 1 )
|
| 146 |
-
->add_meta_box( $this->__( 'Style Settings' ), array( $this, 'call_box_style_settings' ), 1 )
|
| 147 |
-
->add_meta_box( $this->__( 'About this Plugin' ), array( $this, 'call_box_about' ), 2 )
|
| 148 |
-
->add_meta_box( $this->__( 'Other Plugins' ), array( $this, 'call_box_other_plugins' ), 2 );
|
| 149 |
-
|
| 150 |
-
// stylesheets
|
| 151 |
-
wp_enqueue_style( 'jquery-tipsy', plugins_url( 'css/tipsy.css', $this->plugin_file ), FALSE, WP_EXTERNAL_LINKS_VERSION );
|
| 152 |
-
|
| 153 |
-
// scripts
|
| 154 |
-
wp_enqueue_script( 'jquery-tipsy', plugins_url( '/js/jquery.tipsy.js', $this->plugin_file ), array( 'jquery' ), WP_EXTERNAL_LINKS_VERSION );
|
| 155 |
-
wp_enqueue_script( 'admin-external-links', plugins_url( '/js/admin-external-links.js', $this->plugin_file ), array( 'postbox', 'option-forms' ), WP_EXTERNAL_LINKS_VERSION );
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
/**
|
| 159 |
-
* Screen settings
|
| 160 |
-
* @param string $content
|
| 161 |
-
* @return string
|
| 162 |
-
*/
|
| 163 |
-
public function call_screen_settings( $content ) {
|
| 164 |
-
$content .= '<h5>'. $this->__( 'Menu Setting' ) .'</h5>' . "\n";
|
| 165 |
-
$content .= '<div class="extra-prfs">' . "\n";
|
| 166 |
-
$content .= $this->__( 'Admin menu position' ) . ': ' . "\n";
|
| 167 |
-
$content .= $this->form->open_screen_option( 'screen', 'menu_position' );
|
| 168 |
-
$content .= $this->form->select( 'menu_position', array(
|
| 169 |
-
'admin.php' => 'Main menu',
|
| 170 |
-
'index.php' => $this->__( 'Subitem of Dashboard' ),
|
| 171 |
-
'edit.php' => $this->__( 'Subitem of Posts' ),
|
| 172 |
-
'upload.php' => $this->__( 'Subitem of Media' ),
|
| 173 |
-
'link-manager.php' => $this->__( 'Subitem of Links' ),
|
| 174 |
-
'edit.php?post_type=page' => $this->__( 'Subitem of Pages' ),
|
| 175 |
-
'edit-comments.php' => $this->__( 'Subitem of Comments' ),
|
| 176 |
-
'themes.php' => $this->__( 'Subitem of Appearance' ),
|
| 177 |
-
'plugins.php' => $this->__( 'Subitem of Plugins' ),
|
| 178 |
-
'users.php' => $this->__( 'Subitem of Users' ),
|
| 179 |
-
'tools.php' => $this->__( 'Subitem of Tools' ),
|
| 180 |
-
'options-general.php' => $this->__( 'Subitem of Settings' ),
|
| 181 |
-
)) . "\n";
|
| 182 |
-
$content .= '</div>' . "\n";
|
| 183 |
-
|
| 184 |
-
return $content;
|
| 185 |
-
}
|
| 186 |
-
|
| 187 |
-
/**
|
| 188 |
-
* Contextual_help (callback)
|
| 189 |
-
* @param string $content
|
| 190 |
-
* @return string
|
| 191 |
-
*/
|
| 192 |
-
public function call_contextual_help( $content ) {
|
| 193 |
-
$help = '';
|
| 194 |
-
$help .= $this->meta_box_page->get_ob_callback( array( $this, 'call_box_about' ) );
|
| 195 |
-
$help .= $this->hr();
|
| 196 |
-
$help .= '<h4><img src="'. plugins_url( 'images/icon-wp-16.gif', $this->plugin_file ) .'" width="16" height="16" /> '
|
| 197 |
-
. $this->__( 'WordPress' ) .'</h4>';
|
| 198 |
-
return $help . $content;
|
| 199 |
-
}
|
| 200 |
-
|
| 201 |
-
/**
|
| 202 |
-
* Add icon to page title
|
| 203 |
-
* @return string
|
| 204 |
-
*/
|
| 205 |
-
public function call_page_title( $title ) {
|
| 206 |
-
// when updated set update message
|
| 207 |
-
if ( $_GET[ 'settings-updated' ] == 'true' ) {
|
| 208 |
-
$title .= '<div class="updated settings-error" id="setting-error-settings_updated" style="display:none">'
|
| 209 |
-
. '<p><strong>' . __( 'Settings saved.' ) .'</strong></p>'
|
| 210 |
-
. '</div>';
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
-
$title = '<div class="icon32" id="icon-options-custom" style="background:url( '. plugins_url( 'images/icon-wp-external-links-32.png', $this->plugin_file ) .' ) no-repeat 50% 50%"><br></div>'
|
| 214 |
-
. $title;
|
| 215 |
-
|
| 216 |
-
return $title;
|
| 217 |
-
}
|
| 218 |
-
|
| 219 |
-
/**
|
| 220 |
-
* Meta Box: General Settings
|
| 221 |
-
*/
|
| 222 |
-
public function call_box_general_settings() {
|
| 223 |
-
echo $this->form->set_current_option( 'general' )->open_form();
|
| 224 |
-
?>
|
| 225 |
-
<fieldset class="options">
|
| 226 |
-
<table class="form-table">
|
| 227 |
-
<tr>
|
| 228 |
-
<th style="width:300px;"><?php $this->_e( 'Set <code>target</code> for external links' ) ?>
|
| 229 |
-
<?php echo $this->tooltip_help( 'Specify the target (window or tab) for opening external links.' ) ?></th>
|
| 230 |
-
<td class="target_external_links">
|
| 231 |
-
<label><?php echo $this->form->radio( 'target', '_blank', array( 'class' => 'field_target' ) ); ?>
|
| 232 |
-
<span><?php $this->_e( '<code>_blank</code>, new window' ) ?></span></label>
|
| 233 |
-
<?php echo $this->tooltip_help( 'Open every external link in a new window or tab.' ) ?>
|
| 234 |
-
<br/>
|
| 235 |
-
<label><?php echo $this->form->radio( 'target', '_top', array( 'class' => 'field_target' ) ); ?>
|
| 236 |
-
<span><?php $this->_e( '<code>_top</code>, topmost frame' ) ?></span></label>
|
| 237 |
-
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the topmost frame.' ) ?>
|
| 238 |
-
<br/>
|
| 239 |
-
<label><?php echo $this->form->radio( 'target', '_new', array( 'class' => 'field_target' ) ); ?>
|
| 240 |
-
<span><?php $this->_e( '<code>_new</code>, seperate window' ) ?></span></label>
|
| 241 |
-
<?php echo $this->tooltip_help( 'Open new window the first time and use this window for each external link.' ) ?>
|
| 242 |
-
<br/>
|
| 243 |
-
<label><?php echo $this->form->radio( 'target', '_none', array( 'class' => 'field_target' ) ); ?>
|
| 244 |
-
<span><?php $this->_e( '<code>_none</code>, current window' ) ?></span></label>
|
| 245 |
-
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the same frame.' ) ?>
|
| 246 |
-
</td>
|
| 247 |
-
</tr>
|
| 248 |
-
<tr>
|
| 249 |
-
<th><?php $this->_e( 'Add to <code>rel</code>-attribute' ) ?>
|
| 250 |
-
<?php echo $this->tooltip_help( 'Set values for the "rel"-atribute of external links.' ) ?></th>
|
| 251 |
-
<td><label><?php echo $this->form->checkbox( 'external', 1 ); ?>
|
| 252 |
-
<span><?php $this->_e( 'Add <code>"external"</code>' ) ?></span></label>
|
| 253 |
-
<?php echo $this->tooltip_help( 'Add "external" to the "rel"-attribute of external links.' ) ?>
|
| 254 |
-
<br/><label><?php echo $this->form->checkbox( 'nofollow', 1 ); ?>
|
| 255 |
-
<span><?php $this->_e( 'Add <code>"nofollow"</code>' ) ?></span></label>
|
| 256 |
-
<?php echo $this->tooltip_help( 'Add "nofollow" to the "rel"-attribute of external links (unless link already has "follow").' ) ?>
|
| 257 |
-
</td>
|
| 258 |
-
</tr>
|
| 259 |
-
<tr>
|
| 260 |
-
<th><?php $this->_e( 'Add to <code>class</code>-attribute' ) ?>
|
| 261 |
-
<?php echo $this->tooltip_help( 'Add one or more extra classes to the external links, seperated by a space. It is optional, else just leave field blank.' ) ?></th>
|
| 262 |
-
<td><label><?php echo $this->form->text( 'class_name' ); ?></label></td>
|
| 263 |
-
</tr>
|
| 264 |
-
<tr>
|
| 265 |
-
<th><?php $this->_e( 'Set <code>title</code>-attribute' ) ?>
|
| 266 |
-
<?php echo $this->tooltip_help( 'Set title attribute for external links. Use %title% for the original title value.' ) ?></th>
|
| 267 |
-
<td><label><?php echo $this->form->text( 'title' ); ?>
|
| 268 |
-
<span class="description"><?php _e( 'Use <code>%title%</code> for the original title value.' ) ?></span></label></td>
|
| 269 |
-
</tr>
|
| 270 |
-
</table>
|
| 271 |
-
|
| 272 |
-
<?php echo $this->hr(); ?>
|
| 273 |
-
|
| 274 |
-
<table class="form-table">
|
| 275 |
-
<tr>
|
| 276 |
-
<th style="width:300px;"><?php $this->_e( 'Valid XHTML Strict' ) ?>
|
| 277 |
-
<?php echo $this->tooltip_help( 'The "target"-attribute is not valid XHTML strict code. Enable this option to remove the target from external links and use the JavaScript method (built-in this plugin) for opening links.' ) ?></th>
|
| 278 |
-
<td>
|
| 279 |
-
<label><?php echo $this->form->checkbox( 'use_js', 1, array( 'class' => 'field_use_js' ) ); ?>
|
| 280 |
-
<span><?php $this->_e( 'Use JavaScript for opening links in given target, instead of setting <code>target</code>-attribute <em>(recommended)</em>' ) ?></span></label>
|
| 281 |
-
</td>
|
| 282 |
-
</tr>
|
| 283 |
-
</table>
|
| 284 |
-
|
| 285 |
-
<?php echo $this->hr(); ?>
|
| 286 |
-
|
| 287 |
-
<table class="form-table">
|
| 288 |
-
<tr>
|
| 289 |
-
<th style="width:300px;"><?php $this->_e( 'Apply settings to external links on...' ) ?>
|
| 290 |
-
<?php echo $this->tooltip_help( 'Choose contents for applying settings to external links.' ) ?></th>
|
| 291 |
-
<td>
|
| 292 |
-
<label><?php echo $this->form->checkbox( 'filter_page', 1 ); ?>
|
| 293 |
-
<span><?php $this->_e( 'All contents' ) ?></span></label>
|
| 294 |
-
<br/> <label><?php echo $this->form->checkbox( 'filter_posts', 1 ); ?>
|
| 295 |
-
<span><?php $this->_e( 'Post contents' ) ?></span></label>
|
| 296 |
-
<br/> <label><?php echo $this->form->checkbox( 'filter_comments', 1 ); ?>
|
| 297 |
-
<span><?php $this->_e( 'Comments' ) ?></span></label>
|
| 298 |
-
<br/> <label><?php echo $this->form->checkbox( 'filter_widgets', 1 ); ?>
|
| 299 |
-
<span><?php
|
| 300 |
-
if ( self::check_widget_content_filter() ):
|
| 301 |
-
$this->_e( 'All widgets' );
|
| 302 |
-
echo $this->tooltip_help( 'Applied to all widgets by using the "widget_content" filter of the Widget Logic plugin' );
|
| 303 |
-
else:
|
| 304 |
-
$this->_e( 'All text widgets' );
|
| 305 |
-
echo $this->tooltip_help( 'Only the text widget will be applied. To apply to all widget you should select "All contents" option.' );
|
| 306 |
-
endif;
|
| 307 |
-
?></span></label>
|
| 308 |
-
</td>
|
| 309 |
-
</tr>
|
| 310 |
-
<tr class="filter_excl_sel">
|
| 311 |
-
<th><?php $this->_e( 'Do NOT apply settings on...' ) ?>
|
| 312 |
-
<?php echo $this->tooltip_help( 'The external links of these selection will be excluded for the settings of this plugin. Define the selection by using CSS selectors.' ) ?></th>
|
| 313 |
-
<td><label><?php echo $this->form->textarea( 'filter_excl_sel' ); ?>
|
| 314 |
-
<span class="description"><?php _e( 'Define selection by using CSS selectors, f.e.: <code>.excl-ext-link, .entry-title, #comments-title</code> (look <a href="http://code.google.com/p/phpquery/wiki/Selectors" target="_blank">here</a> for available selectors).' ) ?></span></label>
|
| 315 |
-
</td>
|
| 316 |
-
</tr>
|
| 317 |
-
</table>
|
| 318 |
-
</fieldset>
|
| 319 |
-
|
| 320 |
-
<p style="position:absolute;"><a id="admin_menu_position" href="#"><?php _e( 'Change menu position in "Screen Options"' ) ?></a></p>
|
| 321 |
-
<?php
|
| 322 |
-
echo $this->form->submit();
|
| 323 |
-
echo $this->form->close_form();
|
| 324 |
-
}
|
| 325 |
-
|
| 326 |
-
/**
|
| 327 |
-
* Meta Box: Style Settings
|
| 328 |
-
*/
|
| 329 |
-
public function call_box_style_settings() {
|
| 330 |
-
echo $this->form->set_current_option( 'style' )->open_form();
|
| 331 |
-
?>
|
| 332 |
-
<fieldset class="options">
|
| 333 |
-
<table class="form-table">
|
| 334 |
-
<tr>
|
| 335 |
-
<th style="width:300px;"><?php $this->_e( 'Set icon for external link' ) ?>
|
| 336 |
-
<?php echo $this->tooltip_help( 'Set an icon that wll be shown for external links. See example on the right side.' ) ?></th>
|
| 337 |
-
<td>
|
| 338 |
-
<div>
|
| 339 |
-
<div style="width:15%;float:left">
|
| 340 |
-
<label><?php echo $this->form->radio( 'icon', 0 ); ?>
|
| 341 |
-
<span><?php $this->_e( 'No icon' ) ?></span></label>
|
| 342 |
-
<?php for ( $x = 1; $x <= 20; $x++ ): ?>
|
| 343 |
-
<br/>
|
| 344 |
-
<label title="<?php echo sprintf( $this->__( 'Icon %1$s: choose this icon to show for all external links or add the class \'ext-icon-%1$s\' to a specific link.' ), $x ) ?>">
|
| 345 |
-
<?php echo $this->form->radio( 'icon', $x ); ?>
|
| 346 |
-
<img src="<?php echo plugins_url( 'images/external-'. $x .'.png', $this->plugin_file ) ?>" /></label>
|
| 347 |
-
<?php if ( $x % 5 == 0 ): ?>
|
| 348 |
-
</div>
|
| 349 |
-
<div style="width:15%;float:left">
|
| 350 |
-
<?php endif; ?>
|
| 351 |
-
<?php endfor; ?>
|
| 352 |
-
</div>
|
| 353 |
-
<div style="width:29%;float:left;"><span class="description"><?php $this->_e( 'Example:' ) ?></span>
|
| 354 |
-
<br/><img src="<?php echo plugins_url( 'images/link-icon-example.png', $this->plugin_file ) ?>" />
|
| 355 |
-
</div>
|
| 356 |
-
<br style="clear:both" />
|
| 357 |
-
</div>
|
| 358 |
-
</td>
|
| 359 |
-
</tr>
|
| 360 |
-
<tr>
|
| 361 |
-
<th style="width:300px;"><?php $this->_e( 'Set no-icon class' ) ?>
|
| 362 |
-
<?php echo $this->tooltip_help( 'Set this class for links, that should not have the external link icon.' ) ?></th>
|
| 363 |
-
<td><label><?php echo $this->form->text( 'no_icon_class', array( 'class' => '' ) ); ?></label>
|
| 364 |
-
<label><?php echo $this->form->checkbox( 'no_icon_same_window', 1 ); ?>
|
| 365 |
-
<span><?php $this->_e( 'Always open links with no-icon class in same window or tab' ) ?></span></label>
|
| 366 |
-
<?php echo $this->tooltip_help( 'When enabled external links containing the no-icon class will always be opened in the current window or tab. No matter which target is set.' ) ?>
|
| 367 |
-
</td>
|
| 368 |
-
</tr>
|
| 369 |
-
</table>
|
| 370 |
-
</fieldset>
|
| 371 |
-
<?php
|
| 372 |
-
echo $this->form->submit();
|
| 373 |
-
echo $this->form->close_form();
|
| 374 |
-
}
|
| 375 |
-
|
| 376 |
-
/**
|
| 377 |
-
* Meta Box: About...
|
| 378 |
-
*/
|
| 379 |
-
public function call_box_about() {
|
| 380 |
-
?>
|
| 381 |
-
<h4><img src="<?php echo plugins_url( 'images/icon-wp-external-links-16.png', $this->plugin_file ) ?>" width="16" height="16" /> <?php $this->_e( 'WP External Links' ) ?></h4>
|
| 382 |
-
<div>
|
| 383 |
-
<p><?php printf( $this->__( 'Current version: <strong>%1$s</strong>' ), WP_EXTERNAL_LINKS_VERSION ) ?></p>
|
| 384 |
-
<p><?php $this->_e( 'Manage external links on your site: open in new window/tab, set link icon, add "external", add "nofollow" and more.' ) ?></p>
|
| 385 |
-
<p><a href="http://www.freelancephp.net/contact/" target="_blank"><?php $this->_e( 'Questions or suggestions?' ) ?></a></p>
|
| 386 |
-
<p><?php $this->_e( 'If you like this plugin please send your rating at WordPress.org.' ) ?></p>
|
| 387 |
-
<p><?php _e( 'More info' ) ?>: <a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank">FreelancePHP.net</a></p>
|
| 388 |
-
</div>
|
| 389 |
-
<?php
|
| 390 |
-
}
|
| 391 |
-
|
| 392 |
-
/**
|
| 393 |
-
* Meta Box: Other Plugins
|
| 394 |
-
*/
|
| 395 |
-
public function call_box_other_plugins() {
|
| 396 |
-
?>
|
| 397 |
-
<h4><img src="<?php echo plugins_url( 'images/icon-email-encoder-bundle-16.png', $this->plugin_file ); ?>" width="16" height="16" /> Email Encoder Bundle</h4>
|
| 398 |
-
<div>
|
| 399 |
-
<?php if ( is_plugin_active( 'email-encoder-bundle/email-encoder-bundle.php' ) ): ?>
|
| 400 |
-
<p><?php $this->_e( 'This plugin is already activated.' ) ?> <a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/options-general.php?page=email-encoder-bundle/email-encoder-bundle.php"><?php $this->_e( 'Settings' ) ?></a></p>
|
| 401 |
-
<?php elseif( file_exists( WP_PLUGIN_DIR . '/email-encoder-bundle/email-encoder-bundle.php' ) ): ?>
|
| 402 |
-
<p><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugins.php?plugin_status=inactive"><?php $this->_e( 'Activate this plugin.' ) ?></a></p>
|
| 403 |
-
<?php else: ?>
|
| 404 |
-
<p><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=Email+Encoder+Bundle+freelancephp&plugin-search-input=Search+Plugins"><?php $this->_e( 'Get this plugin now' ) ?></a></p>
|
| 405 |
-
<?php endif; ?>
|
| 406 |
-
|
| 407 |
-
<p><?php $this->_e( 'Protect email addresses on your site from spambots and being used for spamming by using one of the encoding methods.' ) ?></p>
|
| 408 |
-
<p><?php _e( 'More info' ) ?>: <a href="http://wordpress.org/extend/plugins/email-encoder-bundle/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/" target="_blank">FreelancePHP.net</a></p>
|
| 409 |
-
</div>
|
| 410 |
-
|
| 411 |
-
<?php echo $this->hr(); ?>
|
| 412 |
-
|
| 413 |
-
<h4><img src="<?php echo plugins_url( 'images/icon-wp-mailto-links-16.png', $this->plugin_file ); ?>" width="16" height="16" /> WP Mailto Links</h4>
|
| 414 |
-
<div>
|
| 415 |
-
<?php if ( is_plugin_active( 'wp-mailto-links/wp-mailto-links.php' ) ): ?>
|
| 416 |
-
<p><?php $this->_e( 'This plugin is already activated.' ) ?> <a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/options-general.php?page=wp-mailto-links/wp-mailto-links.php"><?php $this->_e( 'Settings' ) ?></a></p>
|
| 417 |
-
<?php elseif( file_exists( WP_PLUGIN_DIR . '/wp-mailto-links/wp-mailto-links.php' ) ): ?>
|
| 418 |
-
<p><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugins.php?plugin_status=inactive"><?php $this->_e( 'Activate this plugin.' ) ?></a></p>
|
| 419 |
-
<?php else: ?>
|
| 420 |
-
<p><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+Mailto+Links+freelancephp&plugin-search-input=Search+Plugins"><?php $this->_e( 'Get this plugin now' ) ?></a></p>
|
| 421 |
-
<?php endif; ?>
|
| 422 |
-
|
| 423 |
-
<p><?php $this->_e( 'Manage mailto links on your site and protect emails from spambots, set mail icon and more.' ) ?></p>
|
| 424 |
-
<p><?php _e( 'More info' ) ?>: <a href="http://wordpress.org/extend/plugins/wp-mailto-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-mailto-links-plugin/" target="_blank">FreelancePHP.net</a></p>
|
| 425 |
-
</div>
|
| 426 |
-
<?php
|
| 427 |
-
}
|
| 428 |
-
|
| 429 |
-
/**
|
| 430 |
-
* Activation plugin callback
|
| 431 |
-
*/
|
| 432 |
-
public function call_activation() {
|
| 433 |
-
// check for upgrading saved options to v1.00
|
| 434 |
-
$old_options = get_option( 'WP_External_Links_options' );
|
| 435 |
-
|
| 436 |
-
if ( ! empty( $old_options ) ) {
|
| 437 |
-
$new_options = $this->save_options;
|
| 438 |
-
|
| 439 |
-
foreach ( $old_options AS $option ) {
|
| 440 |
-
$new_options[ 'general' ][ 'target' ] = $old_options[ 'target' ];
|
| 441 |
-
$new_options[ 'general' ][ 'use_js' ] = $old_options[ 'use_js' ];
|
| 442 |
-
$new_options[ 'general' ][ 'external' ] = $old_options[ 'external' ];
|
| 443 |
-
$new_options[ 'general' ][ 'nofollow' ] = $old_options[ 'nofollow' ];
|
| 444 |
-
$new_options[ 'general' ][ 'filter_page' ] = $old_options[ 'filter_whole_page' ];
|
| 445 |
-
$new_options[ 'general' ][ 'filter_posts' ] = $old_options[ 'filter_posts' ];
|
| 446 |
-
$new_options[ 'general' ][ 'filter_comments' ] = $old_options[ 'filter_comments' ];
|
| 447 |
-
$new_options[ 'general' ][ 'filter_widgets' ] = $old_options[ 'filter_widgets' ];
|
| 448 |
-
$new_options[ 'general' ][ 'class_name' ] = $old_options[ 'class_name' ];
|
| 449 |
-
$new_options[ 'style' ][ 'icon' ] = $old_options[ 'icon' ];
|
| 450 |
-
$new_options[ 'style' ][ 'no_icon_class' ] = $old_options[ 'no_icon_class' ];
|
| 451 |
-
$new_options[ 'style' ][ 'no_icon_same_window' ] = $old_options[ 'no_icon_same_window' ];
|
| 452 |
-
}
|
| 453 |
-
|
| 454 |
-
// save new format option values
|
| 455 |
-
update_option( 'wp_external_links-general', $new_options[ 'general' ] );
|
| 456 |
-
update_option( 'wp_external_links-style', $new_options[ 'style' ] );
|
| 457 |
-
|
| 458 |
-
// delete old format option values
|
| 459 |
-
delete_option( 'WP_External_Links_options' );
|
| 460 |
-
unregister_setting( 'WP_External_Links', 'WP_External_Links_options' );
|
| 461 |
-
}
|
| 462 |
-
}
|
| 463 |
-
|
| 464 |
-
/**
|
| 465 |
-
* Deactivation plugin callback
|
| 466 |
-
*/
|
| 467 |
-
public function call_deactivation() {
|
| 468 |
-
$this->form->delete_options();
|
| 469 |
-
}
|
| 470 |
-
|
| 471 |
-
/**
|
| 472 |
-
* Set tooltip help
|
| 473 |
-
* @param string $text
|
| 474 |
-
* @return string
|
| 475 |
-
*/
|
| 476 |
-
public function tooltip_help( $text ) {
|
| 477 |
-
$text = $this->__( $text );
|
| 478 |
-
$text = htmlentities( $text );
|
| 479 |
-
|
| 480 |
-
$html = '';
|
| 481 |
-
$html .= '<a href="#" class="tooltip-help" title="'. $text .'">';
|
| 482 |
-
$html .= '<img alt="" title="" src="'. plugins_url( '/images/help-icon.png', $this->plugin_file ) .'" />';
|
| 483 |
-
$html .= '</a>';
|
| 484 |
-
return $html;
|
| 485 |
-
}
|
| 486 |
-
|
| 487 |
-
/**
|
| 488 |
-
* Get html seperator
|
| 489 |
-
* @return string
|
| 490 |
-
*/
|
| 491 |
-
protected function hr() {
|
| 492 |
-
return '<hr style="border:1px solid #FFF; border-top:1px solid #EEE;" />';
|
| 493 |
-
}
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
/**
|
| 497 |
-
* Check if widget_content filter is available (Widget Logic Plugin)
|
| 498 |
-
* @return boolean
|
| 499 |
-
* @static
|
| 500 |
-
*/
|
| 501 |
-
public static function check_widget_content_filter() {
|
| 502 |
-
// set widget_content filter of Widget Logic plugin
|
| 503 |
-
$widget_logic_opts = get_option( 'widget_logic' );
|
| 504 |
-
|
| 505 |
-
if ( function_exists( 'widget_logic_expand_control' ) AND is_array( $widget_logic_opts ) AND key_exists( 'widget_logic-options-filter', $widget_logic_opts ) )
|
| 506 |
-
return ( $widget_logic_opts[ 'widget_logic-options-filter' ] == 'checked' );
|
| 507 |
-
|
| 508 |
-
return FALSE;
|
| 509 |
-
}
|
| 510 |
-
|
| 511 |
-
} // End Admin_External_Links Class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-admin-external-links.php
CHANGED
|
@@ -84,6 +84,7 @@ final class Admin_External_Links {
|
|
| 84 |
$this->meta_box_page->init(
|
| 85 |
// settings
|
| 86 |
array(
|
|
|
|
| 87 |
'menu_title' => $this->__( 'External Links' ),
|
| 88 |
'page_slug' => strtolower( WP_EXTERNAL_LINKS_KEY ),
|
| 89 |
'add_page_method' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? 'add_submenu_page' : 'add_menu_page',
|
|
@@ -135,7 +136,7 @@ final class Admin_External_Links {
|
|
| 135 |
public function call_load_meta_box( $meta_box ) {
|
| 136 |
// add filters
|
| 137 |
$meta_box->add_title_filter( array( $this, 'call_page_title' ) )
|
| 138 |
-
->add_screen_settings_filter( array( $this, 'call_screen_settings' ) )
|
| 139 |
->add_contextual_help_filter( array( $this, 'call_contextual_help' ) );
|
| 140 |
|
| 141 |
// add meta boxes
|
|
@@ -144,22 +145,22 @@ final class Admin_External_Links {
|
|
| 144 |
->add_meta_box( $this->__( 'SEO Settings' ), array( $this, 'call_box_seo_settings' ), 1 )
|
| 145 |
->add_meta_box( $this->__( 'Style Settings' ), array( $this, 'call_box_style_settings' ), 1 )
|
| 146 |
->add_meta_box( $this->__( 'Extra Settings' ), array( $this, 'call_box_extra_settings' ), 1 )
|
| 147 |
-
->add_meta_box( $this->__( '
|
|
|
|
| 148 |
->add_meta_box( $this->__( 'Other Plugins' ), array( $this, 'call_box_other_plugins' ), 2 );
|
| 149 |
|
| 150 |
// stylesheets
|
| 151 |
-
wp_enqueue_style( '
|
|
|
|
| 152 |
|
| 153 |
// scripts
|
| 154 |
-
wp_enqueue_script( '
|
| 155 |
-
wp_enqueue_script( 'admin-external-links', plugins_url( '/js/admin-external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'postbox', 'option-forms' ), WP_EXTERNAL_LINKS_VERSION );
|
| 156 |
}
|
| 157 |
|
| 158 |
/**
|
| 159 |
* Screen settings
|
| 160 |
* @param string $content
|
| 161 |
* @return string
|
| 162 |
-
*/
|
| 163 |
public function call_screen_settings( $content ) {
|
| 164 |
$content .= '<h5>'. $this->__( 'Menu Setting' ) .'</h5>' . "\n";
|
| 165 |
$content .= '<div class="extra-prfs">' . "\n";
|
|
@@ -183,6 +184,7 @@ final class Admin_External_Links {
|
|
| 183 |
|
| 184 |
return $content;
|
| 185 |
}
|
|
|
|
| 186 |
|
| 187 |
/**
|
| 188 |
* Contextual_help (callback)
|
|
@@ -192,9 +194,6 @@ final class Admin_External_Links {
|
|
| 192 |
public function call_contextual_help( $content ) {
|
| 193 |
$help = '';
|
| 194 |
$help .= $this->meta_box_page->get_ob_callback( array( $this, 'call_box_about' ) );
|
| 195 |
-
$help .= $this->hr();
|
| 196 |
-
$help .= '<h4><img src="'. plugins_url( 'images/icon-wp-16.gif', WP_EXTERNAL_LINKS_FILE ) .'" width="16" height="16" /> '
|
| 197 |
-
. $this->__( 'WordPress' ) .'</h4>';
|
| 198 |
return $help . $content;
|
| 199 |
}
|
| 200 |
|
|
@@ -205,7 +204,7 @@ final class Admin_External_Links {
|
|
| 205 |
public function call_page_title( $title ) {
|
| 206 |
// when updated set the update message
|
| 207 |
if ( isset($_GET[ 'settings-updated' ]) && $_GET[ 'settings-updated' ] == 'true' ) {
|
| 208 |
-
$title .= '<div class="updated settings-error" id="setting-error-settings_updated"
|
| 209 |
. '<p><strong>' . __( 'Settings saved.' ) .'</strong></p>'
|
| 210 |
. '</div>';
|
| 211 |
}
|
|
@@ -251,7 +250,7 @@ final class Admin_External_Links {
|
|
| 251 |
</th>
|
| 252 |
<td>
|
| 253 |
<label><?php echo $this->form->checkbox( 'use_js', 1, array( 'class' => 'field_use_js' ) ); ?>
|
| 254 |
-
<span><?php $this->_e( 'Use JavaScript for opening links (valid
|
| 255 |
</td>
|
| 256 |
</tr>
|
| 257 |
</table>
|
|
@@ -265,7 +264,7 @@ final class Admin_External_Links {
|
|
| 265 |
<?php echo $this->tooltip_help( 'Choose contents for applying settings to external links.' ) ?></th>
|
| 266 |
<td>
|
| 267 |
<label><?php echo $this->form->checkbox( 'filter_page', 1 ); ?>
|
| 268 |
-
<span><?php $this->_e( 'All contents' ) ?></span></label>
|
| 269 |
<br/> <label><?php echo $this->form->checkbox( 'filter_posts', 1 ); ?>
|
| 270 |
<span><?php $this->_e( 'Post contents' ) ?></span></label>
|
| 271 |
<br/> <label><?php echo $this->form->checkbox( 'filter_comments', 1 ); ?>
|
|
@@ -350,7 +349,7 @@ final class Admin_External_Links {
|
|
| 350 |
<br/>
|
| 351 |
<label title="<?php echo sprintf( $this->__( 'Icon %1$s: choose this icon to show for all external links or add the class \'ext-icon-%1$s\' to a specific link.' ), $x ) ?>">
|
| 352 |
<?php echo $this->form->radio( 'icon', $x ); ?>
|
| 353 |
-
<
|
| 354 |
<?php if ( $x % 5 == 0 ): ?>
|
| 355 |
</div>
|
| 356 |
<div style="width:15%;float:left">
|
|
@@ -423,12 +422,43 @@ final class Admin_External_Links {
|
|
| 423 |
<span class="description"><?php _e( 'Define selection by using CSS selectors, f.e.: <code>.excl-ext-link, .entry-title, #comments-title</code> (look <a href="http://code.google.com/p/phpquery/wiki/Selectors" target="_blank">here</a> for available selectors).' ) ?></span></label>
|
| 424 |
</td>
|
| 425 |
</tr>
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 432 |
</table>
|
| 433 |
</fieldset>
|
| 434 |
<?php
|
|
@@ -577,6 +607,19 @@ final class Admin_External_Links {
|
|
| 577 |
}
|
| 578 |
}
|
| 579 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 580 |
/**
|
| 581 |
* Uninstall callback
|
| 582 |
*/
|
|
@@ -593,10 +636,8 @@ final class Admin_External_Links {
|
|
| 593 |
$text = $this->__( $text );
|
| 594 |
$text = htmlentities( $text );
|
| 595 |
|
| 596 |
-
$html = '';
|
| 597 |
-
|
| 598 |
-
$html .= '<img alt="" title="" src="'. plugins_url( '/images/help-icon.png', WP_EXTERNAL_LINKS_FILE ) .'" />';
|
| 599 |
-
$html .= '</a>';
|
| 600 |
return $html;
|
| 601 |
}
|
| 602 |
|
|
@@ -626,4 +667,6 @@ final class Admin_External_Links {
|
|
| 626 |
|
| 627 |
} // End Admin_External_Links Class
|
| 628 |
|
| 629 |
-
endif;
|
|
|
|
|
|
| 84 |
$this->meta_box_page->init(
|
| 85 |
// settings
|
| 86 |
array(
|
| 87 |
+
'page_title' => $this->__( 'WP External Links' ),
|
| 88 |
'menu_title' => $this->__( 'External Links' ),
|
| 89 |
'page_slug' => strtolower( WP_EXTERNAL_LINKS_KEY ),
|
| 90 |
'add_page_method' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? 'add_submenu_page' : 'add_menu_page',
|
| 136 |
public function call_load_meta_box( $meta_box ) {
|
| 137 |
// add filters
|
| 138 |
$meta_box->add_title_filter( array( $this, 'call_page_title' ) )
|
| 139 |
+
// ->add_screen_settings_filter( array( $this, 'call_screen_settings' ) )
|
| 140 |
->add_contextual_help_filter( array( $this, 'call_contextual_help' ) );
|
| 141 |
|
| 142 |
// add meta boxes
|
| 145 |
->add_meta_box( $this->__( 'SEO Settings' ), array( $this, 'call_box_seo_settings' ), 1 )
|
| 146 |
->add_meta_box( $this->__( 'Style Settings' ), array( $this, 'call_box_style_settings' ), 1 )
|
| 147 |
->add_meta_box( $this->__( 'Extra Settings' ), array( $this, 'call_box_extra_settings' ), 1 )
|
| 148 |
+
->add_meta_box( $this->__( 'Admin Settings' ), array( $this, 'call_box_admin_settings' ), 1 )
|
| 149 |
+
//->add_meta_box( $this->__( 'About this Plugin' ), array( $this, 'call_box_about' ), 2 )
|
| 150 |
->add_meta_box( $this->__( 'Other Plugins' ), array( $this, 'call_box_other_plugins' ), 2 );
|
| 151 |
|
| 152 |
// stylesheets
|
| 153 |
+
wp_enqueue_style( 'wp-external-links', plugins_url( 'css/wp-external-links.css', WP_EXTERNAL_LINKS_FILE ), FALSE, WP_EXTERNAL_LINKS_VERSION );
|
| 154 |
+
wp_enqueue_style( 'admin-wp-external-links', plugins_url( 'css/admin-wp-external-links.css', WP_EXTERNAL_LINKS_FILE ), FALSE, WP_EXTERNAL_LINKS_VERSION );
|
| 155 |
|
| 156 |
// scripts
|
| 157 |
+
wp_enqueue_script( 'admin-wp-external-links', plugins_url( '/js/admin-wp-external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'postbox', 'option-forms' ), WP_EXTERNAL_LINKS_VERSION );
|
|
|
|
| 158 |
}
|
| 159 |
|
| 160 |
/**
|
| 161 |
* Screen settings
|
| 162 |
* @param string $content
|
| 163 |
* @return string
|
|
|
|
| 164 |
public function call_screen_settings( $content ) {
|
| 165 |
$content .= '<h5>'. $this->__( 'Menu Setting' ) .'</h5>' . "\n";
|
| 166 |
$content .= '<div class="extra-prfs">' . "\n";
|
| 184 |
|
| 185 |
return $content;
|
| 186 |
}
|
| 187 |
+
*/
|
| 188 |
|
| 189 |
/**
|
| 190 |
* Contextual_help (callback)
|
| 194 |
public function call_contextual_help( $content ) {
|
| 195 |
$help = '';
|
| 196 |
$help .= $this->meta_box_page->get_ob_callback( array( $this, 'call_box_about' ) );
|
|
|
|
|
|
|
|
|
|
| 197 |
return $help . $content;
|
| 198 |
}
|
| 199 |
|
| 204 |
public function call_page_title( $title ) {
|
| 205 |
// when updated set the update message
|
| 206 |
if ( isset($_GET[ 'settings-updated' ]) && $_GET[ 'settings-updated' ] == 'true' ) {
|
| 207 |
+
$title .= '<div class="updated settings-error" id="setting-error-settings_updated">'
|
| 208 |
. '<p><strong>' . __( 'Settings saved.' ) .'</strong></p>'
|
| 209 |
. '</div>';
|
| 210 |
}
|
| 250 |
</th>
|
| 251 |
<td>
|
| 252 |
<label><?php echo $this->form->checkbox( 'use_js', 1, array( 'class' => 'field_use_js' ) ); ?>
|
| 253 |
+
<span><?php $this->_e( 'Use JavaScript for opening links' ) ?></span> <span class="description"><?php $this->_e( '(valid xhtml strict)' ) ?></span>
|
| 254 |
</td>
|
| 255 |
</tr>
|
| 256 |
</table>
|
| 264 |
<?php echo $this->tooltip_help( 'Choose contents for applying settings to external links.' ) ?></th>
|
| 265 |
<td>
|
| 266 |
<label><?php echo $this->form->checkbox( 'filter_page', 1 ); ?>
|
| 267 |
+
<span><?php $this->_e( 'All contents' ) ?></span> <span class="description"><?php $this->_e('(the whole <code><body></code>)') ?></span></label>
|
| 268 |
<br/> <label><?php echo $this->form->checkbox( 'filter_posts', 1 ); ?>
|
| 269 |
<span><?php $this->_e( 'Post contents' ) ?></span></label>
|
| 270 |
<br/> <label><?php echo $this->form->checkbox( 'filter_comments', 1 ); ?>
|
| 349 |
<br/>
|
| 350 |
<label title="<?php echo sprintf( $this->__( 'Icon %1$s: choose this icon to show for all external links or add the class \'ext-icon-%1$s\' to a specific link.' ), $x ) ?>">
|
| 351 |
<?php echo $this->form->radio( 'icon', $x ); ?>
|
| 352 |
+
<span class="ext-icon-<?php echo $x ?>" /><?php echo $x ?>) </span></label>
|
| 353 |
<?php if ( $x % 5 == 0 ): ?>
|
| 354 |
</div>
|
| 355 |
<div style="width:15%;float:left">
|
| 422 |
<span class="description"><?php _e( 'Define selection by using CSS selectors, f.e.: <code>.excl-ext-link, .entry-title, #comments-title</code> (look <a href="http://code.google.com/p/phpquery/wiki/Selectors" target="_blank">here</a> for available selectors).' ) ?></span></label>
|
| 423 |
</td>
|
| 424 |
</tr>
|
| 425 |
+
</table>
|
| 426 |
+
</fieldset>
|
| 427 |
+
<?php
|
| 428 |
+
echo $this->form->submit();
|
| 429 |
+
echo $this->form->close_form();
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
/**
|
| 433 |
+
* Meta Box: Extra Settings
|
| 434 |
+
*/
|
| 435 |
+
public function call_box_admin_settings() {
|
| 436 |
+
echo $this->form->set_current_option( 'screen' )->open_form();
|
| 437 |
+
?>
|
| 438 |
+
<fieldset class="options">
|
| 439 |
+
<table class="form-table">
|
| 440 |
+
<tr>
|
| 441 |
+
<th><?php $this->_e('Admin menu position') ?>
|
| 442 |
+
<?php echo $this->tooltip_help( 'Change the menu position of this plugin in "Screen Options".' ) ?></th>
|
| 443 |
+
<td><label>
|
| 444 |
+
<?php
|
| 445 |
+
echo $this->form->select( 'menu_position', array(
|
| 446 |
+
'admin.php' => 'Main menu',
|
| 447 |
+
'index.php' => $this->__( 'Subitem of Dashboard' ),
|
| 448 |
+
'edit.php' => $this->__( 'Subitem of Posts' ),
|
| 449 |
+
'upload.php' => $this->__( 'Subitem of Media' ),
|
| 450 |
+
'link-manager.php' => $this->__( 'Subitem of Links' ),
|
| 451 |
+
'edit.php?post_type=page' => $this->__( 'Subitem of Pages' ),
|
| 452 |
+
'edit-comments.php' => $this->__( 'Subitem of Comments' ),
|
| 453 |
+
'themes.php' => $this->__( 'Subitem of Appearance' ),
|
| 454 |
+
'plugins.php' => $this->__( 'Subitem of Plugins' ),
|
| 455 |
+
'users.php' => $this->__( 'Subitem of Users' ),
|
| 456 |
+
'tools.php' => $this->__( 'Subitem of Tools' ),
|
| 457 |
+
'options-general.php' => $this->__( 'Subitem of Settings' ),
|
| 458 |
+
));
|
| 459 |
+
?>
|
| 460 |
+
</label></td>
|
| 461 |
+
</tr>
|
| 462 |
</table>
|
| 463 |
</fieldset>
|
| 464 |
<?php
|
| 607 |
}
|
| 608 |
}
|
| 609 |
|
| 610 |
+
/**
|
| 611 |
+
* Method for test purpuses
|
| 612 |
+
*/
|
| 613 |
+
public function __options($values = null) {
|
| 614 |
+
if (class_exists('Test_WP_Mailto_Links') && constant('WP_DEBUG') === true) {
|
| 615 |
+
if ($values !== null) {
|
| 616 |
+
$this->set_options($values);
|
| 617 |
+
}
|
| 618 |
+
|
| 619 |
+
return $this->options;
|
| 620 |
+
}
|
| 621 |
+
}
|
| 622 |
+
|
| 623 |
/**
|
| 624 |
* Uninstall callback
|
| 625 |
*/
|
| 636 |
$text = $this->__( $text );
|
| 637 |
$text = htmlentities( $text );
|
| 638 |
|
| 639 |
+
$html = '<a href="#" class="tooltip-help" title="'. $text .'">[?]</a>';
|
| 640 |
+
//$html = '<img alt="" title="" src="'. plugins_url( '/images/help-icon.png', WP_EXTERNAL_LINKS_FILE ) .'" />';
|
|
|
|
|
|
|
| 641 |
return $html;
|
| 642 |
}
|
| 643 |
|
| 667 |
|
| 668 |
} // End Admin_External_Links Class
|
| 669 |
|
| 670 |
+
endif;
|
| 671 |
+
|
| 672 |
+
/* ommit PHP closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
includes/class-wp-external-links.php
CHANGED
|
@@ -13,7 +13,7 @@ final class WP_External_Links {
|
|
| 13 |
* Admin object
|
| 14 |
* @var Admin_External_Links
|
| 15 |
*/
|
| 16 |
-
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Array of ignored links
|
|
@@ -65,17 +65,20 @@ final class WP_External_Links {
|
|
| 65 |
add_action( 'wp_head', array( $this, 'call_wp_head' ) );
|
| 66 |
|
| 67 |
// add stylesheet
|
| 68 |
-
wp_enqueue_style( 'wp-external-links', plugins_url( 'css/external-links.css', WP_EXTERNAL_LINKS_FILE ), FALSE, WP_EXTERNAL_LINKS_VERSION );
|
| 69 |
|
| 70 |
// set js file
|
| 71 |
if ( $this->get_opt( 'use_js' ) )
|
| 72 |
-
wp_enqueue_script( 'wp-external-links', plugins_url( 'js/external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'jquery' ), WP_EXTERNAL_LINKS_VERSION );
|
| 73 |
|
| 74 |
// filters
|
| 75 |
if ( $this->get_opt( 'filter_page' ) ) {
|
| 76 |
// filter body
|
| 77 |
ob_start( array( $this, 'call_filter_content' ) );
|
| 78 |
|
|
|
|
|
|
|
|
|
|
| 79 |
} else {
|
| 80 |
// set filter priority
|
| 81 |
$priority = 1000000000;
|
|
@@ -118,6 +121,16 @@ final class WP_External_Links {
|
|
| 118 |
}
|
| 119 |
}
|
| 120 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
}
|
| 122 |
|
| 123 |
/**
|
|
@@ -200,7 +213,7 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 200 |
*/
|
| 201 |
private function filter( $content ) {
|
| 202 |
// replace links
|
| 203 |
-
$content = preg_replace_callback( '/<a
|
| 204 |
|
| 205 |
// remove style when no icon classes are found
|
| 206 |
if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
|
|
@@ -221,8 +234,11 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 221 |
$attrs = stripslashes( $attrs );
|
| 222 |
$attrs = shortcode_parse_atts( $attrs );
|
| 223 |
|
| 224 |
-
$href = strtolower( $attrs[ 'href' ] );
|
| 225 |
$rel = ( isset( $attrs[ 'rel' ] ) ) ? strtolower( $attrs[ 'rel' ] ) : '';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
// check if it is an external link and not excluded
|
| 228 |
if ( ! $this->is_external( $href, $rel ) )
|
|
@@ -276,6 +292,9 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 276 |
|
| 277 |
$link .= '>'. $matches[ 2 ] .'</a>';
|
| 278 |
|
|
|
|
|
|
|
|
|
|
| 279 |
return $link;
|
| 280 |
}
|
| 281 |
|
|
@@ -470,4 +489,6 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 470 |
|
| 471 |
} // End WP_External_Links Class
|
| 472 |
|
| 473 |
-
endif;
|
|
|
|
|
|
| 13 |
* Admin object
|
| 14 |
* @var Admin_External_Links
|
| 15 |
*/
|
| 16 |
+
public $admin = NULL;
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Array of ignored links
|
| 65 |
add_action( 'wp_head', array( $this, 'call_wp_head' ) );
|
| 66 |
|
| 67 |
// add stylesheet
|
| 68 |
+
wp_enqueue_style( 'wp-external-links', plugins_url( 'css/wp-external-links.css', WP_EXTERNAL_LINKS_FILE ), FALSE, WP_EXTERNAL_LINKS_VERSION );
|
| 69 |
|
| 70 |
// set js file
|
| 71 |
if ( $this->get_opt( 'use_js' ) )
|
| 72 |
+
wp_enqueue_script( 'wp-external-links', plugins_url( 'js/wp-external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'jquery' ), WP_EXTERNAL_LINKS_VERSION );
|
| 73 |
|
| 74 |
// filters
|
| 75 |
if ( $this->get_opt( 'filter_page' ) ) {
|
| 76 |
// filter body
|
| 77 |
ob_start( array( $this, 'call_filter_content' ) );
|
| 78 |
|
| 79 |
+
// set ob flush
|
| 80 |
+
add_action('wp_footer', array($this, 'callback_flush_buffer'), 10000);
|
| 81 |
+
|
| 82 |
} else {
|
| 83 |
// set filter priority
|
| 84 |
$priority = 1000000000;
|
| 121 |
}
|
| 122 |
}
|
| 123 |
}
|
| 124 |
+
|
| 125 |
+
// hook
|
| 126 |
+
do_action('wpel_ready', array($this, 'call_filter_content'), $this);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
/**
|
| 130 |
+
* End output buffer
|
| 131 |
+
*/
|
| 132 |
+
public function callback_flush_buffer() {
|
| 133 |
+
ob_end_flush();
|
| 134 |
}
|
| 135 |
|
| 136 |
/**
|
| 213 |
*/
|
| 214 |
private function filter( $content ) {
|
| 215 |
// replace links
|
| 216 |
+
$content = preg_replace_callback( '/<a[^A-Za-z](.*?)>(.*?)<\/a[\s+]*>/is', array( $this, 'call_parse_link' ), $content );
|
| 217 |
|
| 218 |
// remove style when no icon classes are found
|
| 219 |
if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
|
| 234 |
$attrs = stripslashes( $attrs );
|
| 235 |
$attrs = shortcode_parse_atts( $attrs );
|
| 236 |
|
|
|
|
| 237 |
$rel = ( isset( $attrs[ 'rel' ] ) ) ? strtolower( $attrs[ 'rel' ] ) : '';
|
| 238 |
+
// href
|
| 239 |
+
$href = $attrs[ 'href' ];
|
| 240 |
+
$href = strtolower( $href );
|
| 241 |
+
$href = trim( $href );
|
| 242 |
|
| 243 |
// check if it is an external link and not excluded
|
| 244 |
if ( ! $this->is_external( $href, $rel ) )
|
| 292 |
|
| 293 |
$link .= '>'. $matches[ 2 ] .'</a>';
|
| 294 |
|
| 295 |
+
// filter
|
| 296 |
+
$link = apply_filters('wpel_external_link', $link, $matches[ 2 ], $email, $attrs);
|
| 297 |
+
|
| 298 |
return $link;
|
| 299 |
}
|
| 300 |
|
| 489 |
|
| 490 |
} // End WP_External_Links Class
|
| 491 |
|
| 492 |
+
endif;
|
| 493 |
+
|
| 494 |
+
/* ommit PHP closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
includes/wp-plugin-dev-classes/class-wp-meta-box-page.php
CHANGED
|
@@ -660,3 +660,5 @@ jQuery( document ).ready( function( $ ){
|
|
| 660 |
} // End WP_Meta_Box_Page_01 Class
|
| 661 |
|
| 662 |
endif;
|
|
|
|
|
|
| 660 |
} // End WP_Meta_Box_Page_01 Class
|
| 661 |
|
| 662 |
endif;
|
| 663 |
+
|
| 664 |
+
/* ommit PHP closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
includes/wp-plugin-dev-classes/class-wp-option-forms.php
CHANGED
|
@@ -356,3 +356,5 @@ class WP_Option_Forms_01 {
|
|
| 356 |
} // End WP_Option_Forms_01
|
| 357 |
|
| 358 |
endif;
|
|
|
|
|
|
| 356 |
} // End WP_Option_Forms_01
|
| 357 |
|
| 358 |
endif;
|
| 359 |
+
|
| 360 |
+
/* ommit PHP closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
includes/wp-plugin-dev-classes/wp-option-forms.js
CHANGED
|
@@ -40,6 +40,9 @@ jQuery(function ($) {
|
|
| 40 |
|
| 41 |
// hide ajax loader
|
| 42 |
$form.find('.ajax-feedback').css('visibility', 'hidden');
|
|
|
|
|
|
|
|
|
|
| 43 |
});
|
| 44 |
};
|
| 45 |
|
| 40 |
|
| 41 |
// hide ajax loader
|
| 42 |
$form.find('.ajax-feedback').css('visibility', 'hidden');
|
| 43 |
+
|
| 44 |
+
// trigger ajax_saved_options
|
| 45 |
+
$form.trigger('ajax_saved_options', [result]);
|
| 46 |
});
|
| 47 |
};
|
| 48 |
|
js/admin-external-links.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
| 1 |
-
/* WP External Links Plugin - Admin */
|
| 2 |
-
jQuery(function( $ ){
|
| 3 |
-
|
| 4 |
-
// option filter page
|
| 5 |
-
$( 'input#filter_page' )
|
| 6 |
-
.change(function(){
|
| 7 |
-
var $i = $( 'input#filter_posts, input#filter_comments, input#filter_widgets' );
|
| 8 |
-
|
| 9 |
-
if ( $( this ).attr( 'checked' ) ) {
|
| 10 |
-
$i.attr( 'disabled', true )
|
| 11 |
-
.attr( 'checked', true );
|
| 12 |
-
} else {
|
| 13 |
-
$i.attr( 'disabled', false )
|
| 14 |
-
}
|
| 15 |
-
})
|
| 16 |
-
.change();
|
| 17 |
-
|
| 18 |
-
// option filter_excl_sel
|
| 19 |
-
$( 'input#phpquery' )
|
| 20 |
-
.change(function(){
|
| 21 |
-
if ( $( this ).attr( 'checked' ) ) {
|
| 22 |
-
$( '.filter_excl_sel' ).fadeIn();
|
| 23 |
-
} else {
|
| 24 |
-
$( '.filter_excl_sel' ).fadeOut();
|
| 25 |
-
}
|
| 26 |
-
})
|
| 27 |
-
.change();
|
| 28 |
-
|
| 29 |
-
// refresh page when updated menu position screen option
|
| 30 |
-
$( '#screen-meta #menu_position' ).bind( 'ajax_updated', function(){
|
| 31 |
-
var s = $( this ).val() || '';
|
| 32 |
-
window.location.href = s + ( s.indexOf( '?' ) > -1 ? '&' : '?' ) + 'page=wp_external_links&settings-updated=true';
|
| 33 |
-
});
|
| 34 |
-
|
| 35 |
-
// set menu position
|
| 36 |
-
$( '#admin_menu_position' ).click(function(){
|
| 37 |
-
$( '#show-settings-link' ).click();
|
| 38 |
-
});
|
| 39 |
-
|
| 40 |
-
// set tooltips
|
| 41 |
-
$( '.tooltip-help' ).css( 'margin', '0 5px' ).tipsy({ fade:true, live:true, fallback: 'No help text.' });
|
| 42 |
-
|
| 43 |
-
// slide postbox
|
| 44 |
-
$( '.postbox' ).find( '.handlediv, .hndle' ).click(function(){
|
| 45 |
-
var $inside = $( this ).parent().find( '.inside' );
|
| 46 |
-
|
| 47 |
-
if ( $inside.css( 'display' ) == 'block' ) {
|
| 48 |
-
$inside.css({ display:'block' }).fadeOut();
|
| 49 |
-
} else {
|
| 50 |
-
$inside.css({ display:'none' }).fadeIn();
|
| 51 |
-
}
|
| 52 |
-
});
|
| 53 |
-
|
| 54 |
-
// remove message
|
| 55 |
-
$( '.settings-error:first' )
|
| 56 |
-
.slideDown()
|
| 57 |
-
.delay( 3000 )
|
| 58 |
-
.slideUp()
|
| 59 |
-
.fadeOut();
|
| 60 |
-
|
| 61 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/admin-wp-external-links.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* WP External Links Plugin - Admin */
|
| 2 |
+
jQuery(function ($) {
|
| 3 |
+
|
| 4 |
+
/* Tipsy Plugin */
|
| 5 |
+
(function () {
|
| 6 |
+
$.fn.tipsy = function(options) {
|
| 7 |
+
options = $.extend({}, $.fn.tipsy.defaults, options);
|
| 8 |
+
|
| 9 |
+
return this.each(function() {
|
| 10 |
+
var opts = $.fn.tipsy.elementOptions(this, options);
|
| 11 |
+
|
| 12 |
+
$(this).hover(function() {
|
| 13 |
+
$.data(this, 'cancel.tipsy', true);
|
| 14 |
+
|
| 15 |
+
var tip = $.data(this, 'active.tipsy');
|
| 16 |
+
if (!tip) {
|
| 17 |
+
tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
|
| 18 |
+
tip.css({position: 'absolute', zIndex: 100000});
|
| 19 |
+
$.data(this, 'active.tipsy', tip);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
if ($(this).attr('title') || typeof($(this).attr('original-title')) != 'string') {
|
| 23 |
+
$(this).attr('original-title', $(this).attr('title') || '').removeAttr('title');
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
var title;
|
| 27 |
+
if (typeof opts.title == 'string') {
|
| 28 |
+
title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title);
|
| 29 |
+
} else if (typeof opts.title == 'function') {
|
| 30 |
+
title = opts.title.call(this);
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
|
| 34 |
+
|
| 35 |
+
var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
|
| 36 |
+
tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
|
| 37 |
+
tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
|
| 38 |
+
var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
|
| 39 |
+
var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity;
|
| 40 |
+
|
| 41 |
+
switch (gravity.charAt(0)) {
|
| 42 |
+
case 'n':
|
| 43 |
+
tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north');
|
| 44 |
+
break;
|
| 45 |
+
case 's':
|
| 46 |
+
tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south');
|
| 47 |
+
break;
|
| 48 |
+
case 'e':
|
| 49 |
+
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east');
|
| 50 |
+
break;
|
| 51 |
+
case 'w':
|
| 52 |
+
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west');
|
| 53 |
+
break;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
if (opts.fade) {
|
| 57 |
+
tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.9});
|
| 58 |
+
} else {
|
| 59 |
+
tip.css({visibility: 'visible'});
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
}, function() {
|
| 63 |
+
$.data(this, 'cancel.tipsy', false);
|
| 64 |
+
var self = this;
|
| 65 |
+
setTimeout(function() {
|
| 66 |
+
if ($.data(this, 'cancel.tipsy')) return;
|
| 67 |
+
var tip = $.data(self, 'active.tipsy');
|
| 68 |
+
if (opts.fade) {
|
| 69 |
+
tip.stop().fadeOut(function() { $(this).remove(); });
|
| 70 |
+
} else {
|
| 71 |
+
tip.remove();
|
| 72 |
+
}
|
| 73 |
+
}, 100);
|
| 74 |
+
|
| 75 |
+
});
|
| 76 |
+
});
|
| 77 |
+
};
|
| 78 |
+
|
| 79 |
+
// Overwrite this method to provide options on a per-element basis.
|
| 80 |
+
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
| 81 |
+
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
| 82 |
+
// (remember - do not modify 'options' in place!)
|
| 83 |
+
$.fn.tipsy.elementOptions = function(ele, options) {
|
| 84 |
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
| 85 |
+
};
|
| 86 |
+
|
| 87 |
+
$.fn.tipsy.defaults = {
|
| 88 |
+
fade: false,
|
| 89 |
+
fallback: '',
|
| 90 |
+
gravity: 'w',
|
| 91 |
+
html: false,
|
| 92 |
+
title: 'title'
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
$.fn.tipsy.autoNS = function() {
|
| 96 |
+
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
| 97 |
+
};
|
| 98 |
+
|
| 99 |
+
$.fn.tipsy.autoWE = function() {
|
| 100 |
+
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
| 101 |
+
};
|
| 102 |
+
|
| 103 |
+
})(); // End Tipsy Plugin
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
$('#setting-error-settings_updated').click(function () {
|
| 107 |
+
$(this).hide();
|
| 108 |
+
});
|
| 109 |
+
|
| 110 |
+
// option filter page
|
| 111 |
+
$( 'input#filter_page' )
|
| 112 |
+
.change(function(){
|
| 113 |
+
var $i = $( 'input#filter_posts, input#filter_comments, input#filter_widgets' );
|
| 114 |
+
|
| 115 |
+
if ( $( this ).attr( 'checked' ) ) {
|
| 116 |
+
$i.attr( 'disabled', true )
|
| 117 |
+
.attr( 'checked', true );
|
| 118 |
+
} else {
|
| 119 |
+
$i.attr( 'disabled', false )
|
| 120 |
+
}
|
| 121 |
+
})
|
| 122 |
+
.change();
|
| 123 |
+
|
| 124 |
+
// option filter_excl_sel
|
| 125 |
+
$( 'input#phpquery' )
|
| 126 |
+
.change(function(){
|
| 127 |
+
if ( $( this ).attr( 'checked' ) ) {
|
| 128 |
+
$( '.filter_excl_sel' ).fadeIn();
|
| 129 |
+
} else {
|
| 130 |
+
$( '.filter_excl_sel' ).fadeOut();
|
| 131 |
+
}
|
| 132 |
+
})
|
| 133 |
+
.change();
|
| 134 |
+
|
| 135 |
+
// refresh page when updated menu position
|
| 136 |
+
$('#menu_position').parents( 'form.ajax-form' ).on( 'ajax_saved_options', function(result){
|
| 137 |
+
var s = $( this ).val() || '';
|
| 138 |
+
window.location.href = s + ( s.indexOf( '?' ) > -1 ? '&' : '?' ) + 'page=wp_external_links&settings-updated=true';
|
| 139 |
+
});
|
| 140 |
+
|
| 141 |
+
// set tooltips
|
| 142 |
+
$( '.tooltip-help' ).css( 'margin', '0 5px' ).tipsy({ fade:true, live:true, gravity:'w', fallback: 'No help text.' });
|
| 143 |
+
|
| 144 |
+
// remove class to fix button background
|
| 145 |
+
$('*[type="submit"]').removeClass('submit');
|
| 146 |
+
|
| 147 |
+
// slide postbox
|
| 148 |
+
$( '.postbox' ).find( '.handlediv, .hndle' ).click(function(){
|
| 149 |
+
var $inside = $( this ).parent().find( '.inside' );
|
| 150 |
+
|
| 151 |
+
if ( $inside.css( 'display' ) == 'block' ) {
|
| 152 |
+
$inside.css({ display:'none' });
|
| 153 |
+
} else {
|
| 154 |
+
$inside.css({ display:'block' });
|
| 155 |
+
}
|
| 156 |
+
});
|
| 157 |
+
|
| 158 |
+
});
|
js/jquery.tipsy.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
| 1 |
-
(function($) {
|
| 2 |
-
$.fn.tipsy = function(options) {
|
| 3 |
-
|
| 4 |
-
options = $.extend({}, $.fn.tipsy.defaults, options);
|
| 5 |
-
|
| 6 |
-
return this.each(function() {
|
| 7 |
-
|
| 8 |
-
var opts = $.fn.tipsy.elementOptions(this, options);
|
| 9 |
-
|
| 10 |
-
$(this).hover(function() {
|
| 11 |
-
|
| 12 |
-
$.data(this, 'cancel.tipsy', true);
|
| 13 |
-
|
| 14 |
-
var tip = $.data(this, 'active.tipsy');
|
| 15 |
-
if (!tip) {
|
| 16 |
-
tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
|
| 17 |
-
tip.css({position: 'absolute', zIndex: 100000});
|
| 18 |
-
$.data(this, 'active.tipsy', tip);
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
if ($(this).attr('title') || typeof($(this).attr('original-title')) != 'string') {
|
| 22 |
-
$(this).attr('original-title', $(this).attr('title') || '').removeAttr('title');
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
var title;
|
| 26 |
-
if (typeof opts.title == 'string') {
|
| 27 |
-
title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title);
|
| 28 |
-
} else if (typeof opts.title == 'function') {
|
| 29 |
-
title = opts.title.call(this);
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
|
| 33 |
-
|
| 34 |
-
var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
|
| 35 |
-
tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
|
| 36 |
-
tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
|
| 37 |
-
var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
|
| 38 |
-
var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity;
|
| 39 |
-
|
| 40 |
-
switch (gravity.charAt(0)) {
|
| 41 |
-
case 'n':
|
| 42 |
-
tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north');
|
| 43 |
-
break;
|
| 44 |
-
case 's':
|
| 45 |
-
tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south');
|
| 46 |
-
break;
|
| 47 |
-
case 'e':
|
| 48 |
-
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east');
|
| 49 |
-
break;
|
| 50 |
-
case 'w':
|
| 51 |
-
tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west');
|
| 52 |
-
break;
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
if (opts.fade) {
|
| 56 |
-
tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.8});
|
| 57 |
-
} else {
|
| 58 |
-
tip.css({visibility: 'visible'});
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
}, function() {
|
| 62 |
-
$.data(this, 'cancel.tipsy', false);
|
| 63 |
-
var self = this;
|
| 64 |
-
setTimeout(function() {
|
| 65 |
-
if ($.data(this, 'cancel.tipsy')) return;
|
| 66 |
-
var tip = $.data(self, 'active.tipsy');
|
| 67 |
-
if (opts.fade) {
|
| 68 |
-
tip.stop().fadeOut(function() { $(this).remove(); });
|
| 69 |
-
} else {
|
| 70 |
-
tip.remove();
|
| 71 |
-
}
|
| 72 |
-
}, 100);
|
| 73 |
-
|
| 74 |
-
});
|
| 75 |
-
|
| 76 |
-
});
|
| 77 |
-
|
| 78 |
-
};
|
| 79 |
-
|
| 80 |
-
// Overwrite this method to provide options on a per-element basis.
|
| 81 |
-
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
| 82 |
-
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
| 83 |
-
// (remember - do not modify 'options' in place!)
|
| 84 |
-
$.fn.tipsy.elementOptions = function(ele, options) {
|
| 85 |
-
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
| 86 |
-
};
|
| 87 |
-
|
| 88 |
-
$.fn.tipsy.defaults = {
|
| 89 |
-
fade: false,
|
| 90 |
-
fallback: '',
|
| 91 |
-
gravity: 'n',
|
| 92 |
-
html: false,
|
| 93 |
-
title: 'title'
|
| 94 |
-
};
|
| 95 |
-
|
| 96 |
-
$.fn.tipsy.autoNS = function() {
|
| 97 |
-
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
| 98 |
-
};
|
| 99 |
-
|
| 100 |
-
$.fn.tipsy.autoWE = function() {
|
| 101 |
-
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
| 102 |
-
};
|
| 103 |
-
|
| 104 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/{external-links.js → wp-external-links.js}
RENAMED
|
File without changes
|
readme.txt
CHANGED
|
@@ -1,27 +1,37 @@
|
|
| 1 |
=== WP External Links ===
|
| 2 |
Contributors: freelancephp
|
| 3 |
Tags: links, external, icon, target, _blank, _new, _none, rel, nofollow, new window, new tab, javascript, xhtml, seo
|
| 4 |
-
Requires at least: 3.
|
| 5 |
Tested up to: 3.5.1
|
| 6 |
-
Stable tag: 1.
|
| 7 |
|
| 8 |
-
Open external links in a new window or tab,
|
| 9 |
|
| 10 |
== Description ==
|
| 11 |
|
| 12 |
-
Configure
|
| 13 |
|
| 14 |
= Features =
|
| 15 |
-
|
| 16 |
* Open external links in new window or tab
|
| 17 |
-
* Add "nofollow"
|
| 18 |
-
*
|
| 19 |
-
*
|
|
|
|
| 20 |
* Set no-icon class
|
| 21 |
-
*
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
This latest version requires PHP 5.2+ and WP 3.0+.
|
| 25 |
|
| 26 |
== Installation ==
|
| 27 |
|
|
@@ -39,7 +49,25 @@ This latest version requires PHP 5.2+ and WP 3.0+.
|
|
| 39 |
1. Link Icon on the Site
|
| 40 |
1. Admin Settings Page
|
| 41 |
|
| 42 |
-
==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
= Credits =
|
| 45 |
* [jQuery Tipsy Plugin](http://plugins.jquery.com/project/tipsy) made by [Jason Frame](http://onehackoranother.com/)
|
|
@@ -48,6 +76,14 @@ This latest version requires PHP 5.2+ and WP 3.0+.
|
|
| 48 |
|
| 49 |
== Changelog ==
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
= 1.31 =
|
| 52 |
* Fixed passing arguments by reference using & (deprecated for PHP 5.4+)
|
| 53 |
* Fixed options save failure by adding a non-ajax submit fallback
|
| 1 |
=== WP External Links ===
|
| 2 |
Contributors: freelancephp
|
| 3 |
Tags: links, external, icon, target, _blank, _new, _none, rel, nofollow, new window, new tab, javascript, xhtml, seo
|
| 4 |
+
Requires at least: 3.2.0
|
| 5 |
Tested up to: 3.5.1
|
| 6 |
+
Stable tag: 1.40
|
| 7 |
|
| 8 |
+
Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.
|
| 9 |
|
| 10 |
== Description ==
|
| 11 |
|
| 12 |
+
Configure settings for all external links on your site.
|
| 13 |
|
| 14 |
= Features =
|
|
|
|
| 15 |
* Open external links in new window or tab
|
| 16 |
+
* Add "nofollow"
|
| 17 |
+
* Set link title
|
| 18 |
+
* Set link icon
|
| 19 |
+
* Set classes (for your own styling)
|
| 20 |
* Set no-icon class
|
| 21 |
+
* SEO friendly
|
| 22 |
+
|
| 23 |
+
= Easy to use =
|
| 24 |
+
After activating the plugin all options are already set to make your external links SEO friendly. Optionally you can also set the target for opening in a new window or tab or styling options, like adding an icon.
|
| 25 |
+
|
| 26 |
+
[See more documentation](http://wordpress.org/extend/plugins/wp-external-links/other_notes/).
|
| 27 |
+
|
| 28 |
+
= Support =
|
| 29 |
+
This plugin has the same [requirements](http://wordpress.org/about/requirements/) as WordPress.
|
| 30 |
+
If you are experiencing any problems, just take a look at the [FAQ](http://wordpress.org/extend/plugins/wp-external-links/faq/) or report it in the [support section](http://wordpress.org/support/plugin/wp-external-links). You can also send me a mail with [this contactform](http://www.freelancephp.net/contact/).
|
| 31 |
+
|
| 32 |
+
= Like this plugin? =
|
| 33 |
+
This plugin is free and does not need any donations. You could show your appreciation by rating this plugin and/or [posting a comment](http://www.freelancephp.net/wp-external-links-plugin/) on my blog.
|
| 34 |
|
|
|
|
| 35 |
|
| 36 |
== Installation ==
|
| 37 |
|
| 49 |
1. Link Icon on the Site
|
| 50 |
1. Admin Settings Page
|
| 51 |
|
| 52 |
+
== Documentation ==
|
| 53 |
+
|
| 54 |
+
After activating the plugin all options are already set to make your external links SEO friendly. Optionally you can also set the target for opening in a new window or tab or styling options, like adding an icon.
|
| 55 |
+
|
| 56 |
+
= Action hook =
|
| 57 |
+
The plugin also has a hook when ready, f.e. to add extra filters:
|
| 58 |
+
`function extra_filters($filter_callback, $object) {
|
| 59 |
+
add_filter('some_filter', $filter_callback);
|
| 60 |
+
}
|
| 61 |
+
add_action('wpel_ready', 'extra_filters');`
|
| 62 |
+
|
| 63 |
+
= Filter hook =
|
| 64 |
+
The wpel_external_link filter gives you the possibility to manipulate output of the mailto created by the plugin. F.e. make all external links bold:
|
| 65 |
+
`public function special_external_link($original_link, $created_link, $label, $attrs = array()) {
|
| 66 |
+
return '<b>'. $created_link .'</b>';
|
| 67 |
+
}
|
| 68 |
+
add_filter('wpel_external_link', 'special_external_link', 10, 4);`
|
| 69 |
+
|
| 70 |
+
Now all external links will be processed and wrapped around a `<b>`-tag.
|
| 71 |
|
| 72 |
= Credits =
|
| 73 |
* [jQuery Tipsy Plugin](http://plugins.jquery.com/project/tipsy) made by [Jason Frame](http://onehackoranother.com/)
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
| 79 |
+
= 1.40 =
|
| 80 |
+
* Added action hook wpel_ready
|
| 81 |
+
* Added filter hook wpel_external_link
|
| 82 |
+
* Added output flush on wp_footer
|
| 83 |
+
* Fixed Bug: spaces before url in href-attribute not recognized as external link
|
| 84 |
+
* Fixed Bug: external links not processed (regexpr tag conflict starting with an a, like <aside> or <article>)
|
| 85 |
+
* Cosmetic changes: added "Admin Settings", replaced help icon, restyled tooltip texts, removed "About this plugin" box
|
| 86 |
+
|
| 87 |
= 1.31 =
|
| 88 |
* Fixed passing arguments by reference using & (deprecated for PHP 5.4+)
|
| 89 |
* Fixed options save failure by adding a non-ajax submit fallback
|
wp-external-links.php
CHANGED
|
@@ -4,13 +4,13 @@ Plugin Name: WP External Links
|
|
| 4 |
Plugin URI: http://www.freelancephp.net/wp-external-links-plugin
|
| 5 |
Description: Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
|
| 6 |
Author: Victor Villaverde Laan
|
| 7 |
-
Version: 1.
|
| 8 |
Author URI: http://www.freelancephp.net
|
| 9 |
License: Dual licensed under the MIT and GPL licenses
|
| 10 |
*/
|
| 11 |
|
| 12 |
// plugin version
|
| 13 |
-
define( 'WP_EXTERNAL_LINKS_VERSION', '1.
|
| 14 |
|
| 15 |
// plugin key (used as translation domain, option_group, page_slug etc)
|
| 16 |
define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );
|
|
@@ -45,3 +45,5 @@ if ( isset( $wp_version ) AND version_compare( preg_replace( '/-.*$/', '', $wp_v
|
|
| 45 |
add_action( 'admin_notices', 'wp_external_links_error_notice' );
|
| 46 |
|
| 47 |
}
|
|
|
|
|
|
| 4 |
Plugin URI: http://www.freelancephp.net/wp-external-links-plugin
|
| 5 |
Description: Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
|
| 6 |
Author: Victor Villaverde Laan
|
| 7 |
+
Version: 1.40
|
| 8 |
Author URI: http://www.freelancephp.net
|
| 9 |
License: Dual licensed under the MIT and GPL licenses
|
| 10 |
*/
|
| 11 |
|
| 12 |
// plugin version
|
| 13 |
+
define( 'WP_EXTERNAL_LINKS_VERSION', '1.40' );
|
| 14 |
|
| 15 |
// plugin key (used as translation domain, option_group, page_slug etc)
|
| 16 |
define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );
|
| 45 |
add_action( 'admin_notices', 'wp_external_links_error_notice' );
|
| 46 |
|
| 47 |
}
|
| 48 |
+
|
| 49 |
+
/* ommit PHP closing tag, to prevent unwanted whitespace at the end of the parts generated by the included files */
|
