Version Description
- Fixed bug checking internal links with https
- Fixed bug with REST API
- Fixed conflict Widget CSS Classes plugin (partially fixed)
Download this release
Release Info
| Developer | freelancephp |
| Plugin | |
| Version | 2.1.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.1.1 to 2.1.2
- data/json/dashicons.json +1 -1
- data/json/fontawesome.json +1 -1
- includes/.htaccess +1 -1
- includes/admin/class-wpel-network-page.php +181 -181
- includes/admin/class-wpel-settings-page.php +234 -234
- includes/admin/network-fields/class-wpel-network-admin-fields.php +116 -116
- includes/admin/network-fields/class-wpel-network-fields.php +132 -132
- includes/admin/settings-fields/class-wpel-admin-fields.php +80 -80
- includes/admin/settings-fields/class-wpel-exceptions-fields.php +231 -231
- includes/admin/settings-fields/class-wpel-excluded-link-fields.php +42 -42
- includes/admin/settings-fields/class-wpel-external-link-fields.php +97 -97
- includes/admin/settings-fields/class-wpel-internal-link-fields.php +42 -42
- includes/admin/settings-fields/class-wpel-link-fields-base.php +322 -322
- includes/class-wpel-front-ignore.php +146 -146
- includes/class-wpel-front.php +444 -422
- includes/class-wpel-link.php +104 -104
- includes/class-wpel-plugin.php +61 -98
- includes/class-wpel-register-hooks.php +0 -156
- includes/class-wpel-register-scripts.php +75 -75
- includes/class-wpel-template-tags.php +42 -46
- includes/class-wpel-update.php +140 -140
- includes/register-hooks/class-wpel-activation.php +74 -0
- includes/register-hooks/class-wpel-uninstall.php +51 -0
- languages/wp-external-links-de_DE.mo +0 -0
- languages/wp-external-links-de_DE.po +444 -0
- libs/fwp/class-fwp-debug.php +113 -112
- libs/fwp/class-fwp-html-element.php +280 -280
- libs/fwp/class-fwp-html-fields.php +264 -264
- libs/fwp/component-bases/class-fwp-plugin-base.php +93 -0
- libs/fwp/component-bases/class-fwp-register-hook-base.php +87 -0
- libs/fwp/{class-fwp-settings-section-fields.php → component-bases/class-fwp-settings-section-base.php} +275 -249
- libs/fwp/component-bases/class-fwp-template-tag-base.php +66 -0
- libs/fwp/filter-hooks/class-fwp-final-output.php +43 -43
- libs/fwp/filter-hooks/class-fwp-widget-output.php +80 -80
- libs/wprun/class-wprun-autoloader.php +159 -115
- libs/wprun/class-wprun-base.php +375 -400
- public/css/wpel-admin.css +127 -117
- public/css/wpel.css +58 -58
- public/js/wpel-admin.js +128 -106
- readme.txt +25 -2
- templates/network-page/help-tabs/under-construction.php +17 -17
- templates/network-page/main.php +63 -63
- templates/network-page/tab-contents/network-admin-settings.php +21 -21
- templates/network-page/tab-contents/network-settings.php +21 -21
- templates/partials/nav-tabs.php +30 -30
- templates/partials/tab-contents/fields-default.php +23 -23
- templates/partials/tab-contents/support.php +76 -76
- templates/requirements-notice.php +22 -22
- templates/settings-page/help-tabs/data-attributes.php +23 -23
- templates/settings-page/help-tabs/under-construction.php +17 -17
- templates/settings-page/main.php +51 -51
- templates/settings-page/tab-contents/admin.php +21 -21
- templates/settings-page/tab-contents/exceptions.php +24 -24
- templates/settings-page/tab-contents/excluded-links.php +21 -21
- templates/settings-page/tab-contents/external-links.php +21 -21
- templates/settings-page/tab-contents/internal-links.php +21 -21
- wp-external-links.php +92 -81
data/json/dashicons.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"icons":[{"unicode":"f333","className":"dashicons-menu"},{"unicode":"f319","className":"dashicons-admin-site"},{"unicode":"f226","className":"dashicons-dashboard"},{"unicode":"f109","className":"dashicons-admin-post"},{"unicode":"f104","className":"dashicons-admin-media"},{"unicode":"f103","className":"dashicons-admin-links"},{"unicode":"f105","className":"dashicons-admin-page"},{"unicode":"f101","className":"dashicons-admin-comments"},{"unicode":"f100","className":"dashicons-admin-appearance"},{"unicode":"f106","className":"dashicons-admin-plugins"},{"unicode":"f110","className":"dashicons-admin-users"},{"unicode":"f107","className":"dashicons-admin-tools"},{"unicode":"f108","className":"dashicons-admin-settings"},{"unicode":"f112","className":"dashicons-admin-network"},{"unicode":"f102","className":"dashicons-admin-home"},{"unicode":"f111","className":"dashicons-admin-generic"},{"unicode":"f148","className":"dashicons-admin-collapse"},{"unicode":"f536","className":"dashicons-filter"},{"unicode":"f540","className":"dashicons-admin-customizer"},{"unicode":"f541","className":"dashicons-admin-multisite"},{"unicode":"f119","className":"dashicons-welcome-write-blog"},{"unicode":"f133","className":"dashicons-welcome-add-page"},{"unicode":"f115","className":"dashicons-welcome-view-site"},{"unicode":"f116","className":"dashicons-welcome-widgets-menus"},{"unicode":"f117","className":"dashicons-welcome-comments"},{"unicode":"f118","className":"dashicons-welcome-learn-more"},{"unicode":"f123","className":"dashicons-format-aside"},{"unicode":"f128","className":"dashicons-format-image"},{"unicode":"f161","className":"dashicons-format-gallery"},{"unicode":"f126","className":"dashicons-format-video"},{"unicode":"f130","className":"dashicons-format-status"},{"unicode":"f122","className":"dashicons-format-quote"},{"unicode":"f125","className":"dashicons-format-chat"},{"unicode":"f127","className":"dashicons-format-audio"},{"unicode":"f306","className":"dashicons-camera"},{"unicode":"f232","className":"dashicons-images-alt"},{"unicode":"f233","className":"dashicons-images-alt2"},{"unicode":"f234","className":"dashicons-video-alt"},{"unicode":"f235","className":"dashicons-video-alt2"},{"unicode":"f236","className":"dashicons-video-alt3"},{"unicode":"f501","className":"dashicons-media-archive"},{"unicode":"f500","className":"dashicons-media-audio"},{"unicode":"f499","className":"dashicons-media-code"},{"unicode":"f498","className":"dashicons-media-default"},{"unicode":"f497","className":"dashicons-media-document"},{"unicode":"f496","className":"dashicons-media-interactive"},{"unicode":"f495","className":"dashicons-media-spreadsheet"},{"unicode":"f491","className":"dashicons-media-text"},{"unicode":"f490","className":"dashicons-media-video"},{"unicode":"f492","className":"dashicons-playlist-audio"},{"unicode":"f493","className":"dashicons-playlist-video"},{"unicode":"f522","className":"dashicons-controls-play"},{"unicode":"f523","className":"dashicons-controls-pause"},{"unicode":"f519","className":"dashicons-controls-forward"},{"unicode":"f517","className":"dashicons-controls-skipforward"},{"unicode":"f518","className":"dashicons-controls-back"},{"unicode":"f516","className":"dashicons-controls-skipback"},{"unicode":"f515","className":"dashicons-controls-repeat"},{"unicode":"f521","className":"dashicons-controls-volumeon"},{"unicode":"f520","className":"dashicons-controls-volumeoff"},{"unicode":"f165","className":"dashicons-image-crop"},{"unicode":"f531","className":"dashicons-image-rotate"},{"unicode":"f166","className":"dashicons-image-rotate-left"},{"unicode":"f167","className":"dashicons-image-rotate-right"},{"unicode":"f168","className":"dashicons-image-flip-vertical"},{"unicode":"f169","className":"dashicons-image-flip-horizontal"},{"unicode":"f533","className":"dashicons-image-filter"},{"unicode":"f171","className":"dashicons-undo"},{"unicode":"f172","className":"dashicons-redo"},{"unicode":"f200","className":"dashicons-editor-bold"},{"unicode":"f201","className":"dashicons-editor-italic"},{"unicode":"f203","className":"dashicons-editor-ul"},{"unicode":"f204","className":"dashicons-editor-ol"},{"unicode":"f205","className":"dashicons-editor-quote"},{"unicode":"f206","className":"dashicons-editor-alignleft"},{"unicode":"f207","className":"dashicons-editor-aligncenter"},{"unicode":"f208","className":"dashicons-editor-alignright"},{"unicode":"f209","className":"dashicons-editor-insertmore"},{"unicode":"f210","className":"dashicons-editor-spellcheck"},{"unicode":"f211","className":"dashicons-editor-expand"},{"unicode":"f506","className":"dashicons-editor-contract"},{"unicode":"f212","className":"dashicons-editor-kitchensink"},{"unicode":"f213","className":"dashicons-editor-underline"},{"unicode":"f214","className":"dashicons-editor-justify"},{"unicode":"f215","className":"dashicons-editor-textcolor"},{"unicode":"f216","className":"dashicons-editor-paste-word"},{"unicode":"f217","className":"dashicons-editor-paste-text"},{"unicode":"f218","className":"dashicons-editor-removeformatting"},{"unicode":"f219","className":"dashicons-editor-video"},{"unicode":"f220","className":"dashicons-editor-customchar"},{"unicode":"f221","className":"dashicons-editor-outdent"},{"unicode":"f222","className":"dashicons-editor-indent"},{"unicode":"f223","className":"dashicons-editor-help"},{"unicode":"f224","className":"dashicons-editor-strikethrough"},{"unicode":"f225","className":"dashicons-editor-unlink"},{"unicode":"f320","className":"dashicons-editor-rtl"},{"unicode":"f474","className":"dashicons-editor-break"},{"unicode":"f475","className":"dashicons-editor-code"},{"unicode":"f476","className":"dashicons-editor-paragraph"},{"unicode":"f535","className":"dashicons-editor-table"},{"unicode":"f135","className":"dashicons-align-left"},{"unicode":"f136","className":"dashicons-align-right"},{"unicode":"f134","className":"dashicons-align-center"},{"unicode":"f138","className":"dashicons-align-none"},{"unicode":"f160","className":"dashicons-lock"},{"unicode":"f528","className":"dashicons-unlock"},{"unicode":"f145","className":"dashicons-calendar"},{"unicode":"f508","className":"dashicons-calendar-alt"},{"unicode":"f177","className":"dashicons-visibility"},{"unicode":"f530","className":"dashicons-hidden"},{"unicode":"f173","className":"dashicons-post-status"},{"unicode":"f464","className":"dashicons-edit"},{"unicode":"f182","className":"dashicons-trash"},{"unicode":"f537","className":"dashicons-sticky"},{"unicode":"f504","className":"dashicons-external"},{"unicode":"f142","className":"dashicons-arrow-up"},{"unicode":"f140","className":"dashicons-arrow-down"},{"unicode":"f139","className":"dashicons-arrow-right"},{"unicode":"f141","className":"dashicons-arrow-left"},{"unicode":"f342","className":"dashicons-arrow-up-alt"},{"unicode":"f346","className":"dashicons-arrow-down-alt"},{"unicode":"f344","className":"dashicons-arrow-right-alt"},{"unicode":"f340","className":"dashicons-arrow-left-alt"},{"unicode":"f343","className":"dashicons-arrow-up-alt2"},{"unicode":"f347","className":"dashicons-arrow-down-alt2"},{"unicode":"f345","className":"dashicons-arrow-right-alt2"},{"unicode":"f341","className":"dashicons-arrow-left-alt2"},{"unicode":"f156","className":"dashicons-sort"},{"unicode":"f229","className":"dashicons-leftright"},{"unicode":"f503","className":"dashicons-randomize"},{"unicode":"f163","className":"dashicons-list-view"},{"unicode":"f164","className":"dashicons-exerpt-view"},{"unicode":"f509","className":"dashicons-grid-view"},{"unicode":"f237","className":"dashicons-share"},{"unicode":"f240","className":"dashicons-share-alt"},{"unicode":"f242","className":"dashicons-share-alt2"},{"unicode":"f301","className":"dashicons-twitter"},{"unicode":"f303","className":"dashicons-rss"},{"unicode":"f465","className":"dashicons-email"},{"unicode":"f466","className":"dashicons-email-alt"},{"unicode":"f304","className":"dashicons-facebook"},{"unicode":"f305","className":"dashicons-facebook-alt"},{"unicode":"f462","className":"dashicons-googleplus"},{"unicode":"f325","className":"dashicons-networking"},{"unicode":"f308","className":"dashicons-hammer"},{"unicode":"f309","className":"dashicons-art"},{"unicode":"f310","className":"dashicons-migrate"},{"unicode":"f311","className":"dashicons-performance"},{"unicode":"f483","className":"dashicons-universal-access"},{"unicode":"f507","className":"dashicons-universal-access-alt"},{"unicode":"f486","className":"dashicons-tickets"},{"unicode":"f484","className":"dashicons-nametag"},{"unicode":"f481","className":"dashicons-clipboard"},{"unicode":"f487","className":"dashicons-heart"},{"unicode":"f488","className":"dashicons-megaphone"},{"unicode":"f489","className":"dashicons-schedule"},{"unicode":"f120","className":"dashicons-wordpress"},{"unicode":"f324","className":"dashicons-wordpress-alt"},{"unicode":"f157","className":"dashicons-pressthis"},{"unicode":"f463","className":"dashicons-update"},{"unicode":"f180","className":"dashicons-screenoptions"},{"unicode":"f348","className":"dashicons-info"},{"unicode":"f174","className":"dashicons-cart"},{"unicode":"f175","className":"dashicons-feedback"},{"unicode":"f176","className":"dashicons-cloud"},{"unicode":"f326","className":"dashicons-translation"},{"unicode":"f323","className":"dashicons-tag"},{"unicode":"f318","className":"dashicons-category"},{"unicode":"f480","className":"dashicons-archive"},{"unicode":"f479","className":"dashicons-tagcloud"},{"unicode":"f478","className":"dashicons-text"},{"unicode":"f147","className":"dashicons-yes"},{"unicode":"f158","className":"dashicons-no"},{"unicode":"f335","className":"dashicons-no-alt"},{"unicode":"f132","className":"dashicons-plus"},{"unicode":"f502","className":"dashicons-plus-alt"},{"unicode":"f460","className":"dashicons-minus"},{"unicode":"f153","className":"dashicons-dismiss"},{"unicode":"f159","className":"dashicons-marker"},{"unicode":"f155","className":"dashicons-star-filled"},{"unicode":"f459","className":"dashicons-star-half"},{"unicode":"f154","className":"dashicons-star-empty"},{"unicode":"f227","className":"dashicons-flag"},{"unicode":"f534","className":"dashicons-warning"},{"unicode":"f230","className":"dashicons-location"},{"unicode":"f231","className":"dashicons-location-alt"},{"unicode":"f178","className":"dashicons-vault"},{"unicode":"f332","className":"dashicons-shield"},{"unicode":"f334","className":"dashicons-shield-alt"},{"unicode":"f468","className":"dashicons-sos"},{"unicode":"f179","className":"dashicons-search"},{"unicode":"f181","className":"dashicons-slides"},{"unicode":"f183","className":"dashicons-analytics"},{"unicode":"f184","className":"dashicons-chart-pie"},{"unicode":"f185","className":"dashicons-chart-bar"},{"unicode":"f238","className":"dashicons-chart-line"},{"unicode":"f239","className":"dashicons-chart-area"},{"unicode":"f307","className":"dashicons-groups"},{"unicode":"f338","className":"dashicons-businessman"},{"unicode":"f336","className":"dashicons-id"},{"unicode":"f337","className":"dashicons-id-alt"},{"unicode":"f312","className":"dashicons-products"},{"unicode":"f313","className":"dashicons-awards"},{"unicode":"f314","className":"dashicons-forms"},{"unicode":"f473","className":"dashicons-testimonial"},{"unicode":"f322","className":"dashicons-portfolio"},{"unicode":"f330","className":"dashicons-book"},{"unicode":"f331","className":"dashicons-book-alt"},{"unicode":"f316","className":"dashicons-download"},{"unicode":"f317","className":"dashicons-upload"},{"unicode":"f321","className":"dashicons-backup"},{"unicode":"f469","className":"dashicons-clock"},{"unicode":"f339","className":"dashicons-lightbulb"},{"unicode":"f482","className":"dashicons-microphone"},{"unicode":"f472","className":"dashicons-desktop"},{"unicode":"f471","className":"dashicons-tablet"},{"unicode":"f470","className":"dashicons-smartphone"},{"unicode":"f525","className":"dashicons-phone"},{"unicode":"f510","className":"dashicons-index-card"},{"unicode":"f511","className":"dashicons-carrot"},{"unicode":"f512","className":"dashicons-building"},{"unicode":"f513","className":"dashicons-store"},{"unicode":"f514","className":"dashicons-album"},{"unicode":"f527","className":"dashicons-palmtree"},{"unicode":"f524","className":"dashicons-tickets-alt"},{"unicode":"f526","className":"dashicons-money"},{"unicode":"f328","className":"dashicons-smiley"},{"unicode":"f529","className":"dashicons-thumbs-up"},{"unicode":"f542","className":"dashicons-thumbs-down"},{"unicode":"f538","className":"dashicons-layout"}]}
|
| 1 |
+
{"icons":[{"unicode":"f333","className":"dashicons-menu"},{"unicode":"f319","className":"dashicons-admin-site"},{"unicode":"f226","className":"dashicons-dashboard"},{"unicode":"f109","className":"dashicons-admin-post"},{"unicode":"f104","className":"dashicons-admin-media"},{"unicode":"f103","className":"dashicons-admin-links"},{"unicode":"f105","className":"dashicons-admin-page"},{"unicode":"f101","className":"dashicons-admin-comments"},{"unicode":"f100","className":"dashicons-admin-appearance"},{"unicode":"f106","className":"dashicons-admin-plugins"},{"unicode":"f110","className":"dashicons-admin-users"},{"unicode":"f107","className":"dashicons-admin-tools"},{"unicode":"f108","className":"dashicons-admin-settings"},{"unicode":"f112","className":"dashicons-admin-network"},{"unicode":"f102","className":"dashicons-admin-home"},{"unicode":"f111","className":"dashicons-admin-generic"},{"unicode":"f148","className":"dashicons-admin-collapse"},{"unicode":"f536","className":"dashicons-filter"},{"unicode":"f540","className":"dashicons-admin-customizer"},{"unicode":"f541","className":"dashicons-admin-multisite"},{"unicode":"f119","className":"dashicons-welcome-write-blog"},{"unicode":"f133","className":"dashicons-welcome-add-page"},{"unicode":"f115","className":"dashicons-welcome-view-site"},{"unicode":"f116","className":"dashicons-welcome-widgets-menus"},{"unicode":"f117","className":"dashicons-welcome-comments"},{"unicode":"f118","className":"dashicons-welcome-learn-more"},{"unicode":"f123","className":"dashicons-format-aside"},{"unicode":"f128","className":"dashicons-format-image"},{"unicode":"f161","className":"dashicons-format-gallery"},{"unicode":"f126","className":"dashicons-format-video"},{"unicode":"f130","className":"dashicons-format-status"},{"unicode":"f122","className":"dashicons-format-quote"},{"unicode":"f125","className":"dashicons-format-chat"},{"unicode":"f127","className":"dashicons-format-audio"},{"unicode":"f306","className":"dashicons-camera"},{"unicode":"f232","className":"dashicons-images-alt"},{"unicode":"f233","className":"dashicons-images-alt2"},{"unicode":"f234","className":"dashicons-video-alt"},{"unicode":"f235","className":"dashicons-video-alt2"},{"unicode":"f236","className":"dashicons-video-alt3"},{"unicode":"f501","className":"dashicons-media-archive"},{"unicode":"f500","className":"dashicons-media-audio"},{"unicode":"f499","className":"dashicons-media-code"},{"unicode":"f498","className":"dashicons-media-default"},{"unicode":"f497","className":"dashicons-media-document"},{"unicode":"f496","className":"dashicons-media-interactive"},{"unicode":"f495","className":"dashicons-media-spreadsheet"},{"unicode":"f491","className":"dashicons-media-text"},{"unicode":"f490","className":"dashicons-media-video"},{"unicode":"f492","className":"dashicons-playlist-audio"},{"unicode":"f493","className":"dashicons-playlist-video"},{"unicode":"f522","className":"dashicons-controls-play"},{"unicode":"f523","className":"dashicons-controls-pause"},{"unicode":"f519","className":"dashicons-controls-forward"},{"unicode":"f517","className":"dashicons-controls-skipforward"},{"unicode":"f518","className":"dashicons-controls-back"},{"unicode":"f516","className":"dashicons-controls-skipback"},{"unicode":"f515","className":"dashicons-controls-repeat"},{"unicode":"f521","className":"dashicons-controls-volumeon"},{"unicode":"f520","className":"dashicons-controls-volumeoff"},{"unicode":"f165","className":"dashicons-image-crop"},{"unicode":"f531","className":"dashicons-image-rotate"},{"unicode":"f166","className":"dashicons-image-rotate-left"},{"unicode":"f167","className":"dashicons-image-rotate-right"},{"unicode":"f168","className":"dashicons-image-flip-vertical"},{"unicode":"f169","className":"dashicons-image-flip-horizontal"},{"unicode":"f533","className":"dashicons-image-filter"},{"unicode":"f171","className":"dashicons-undo"},{"unicode":"f172","className":"dashicons-redo"},{"unicode":"f200","className":"dashicons-editor-bold"},{"unicode":"f201","className":"dashicons-editor-italic"},{"unicode":"f203","className":"dashicons-editor-ul"},{"unicode":"f204","className":"dashicons-editor-ol"},{"unicode":"f205","className":"dashicons-editor-quote"},{"unicode":"f206","className":"dashicons-editor-alignleft"},{"unicode":"f207","className":"dashicons-editor-aligncenter"},{"unicode":"f208","className":"dashicons-editor-alignright"},{"unicode":"f209","className":"dashicons-editor-insertmore"},{"unicode":"f210","className":"dashicons-editor-spellcheck"},{"unicode":"f211","className":"dashicons-editor-expand"},{"unicode":"f506","className":"dashicons-editor-contract"},{"unicode":"f212","className":"dashicons-editor-kitchensink"},{"unicode":"f213","className":"dashicons-editor-underline"},{"unicode":"f214","className":"dashicons-editor-justify"},{"unicode":"f215","className":"dashicons-editor-textcolor"},{"unicode":"f216","className":"dashicons-editor-paste-word"},{"unicode":"f217","className":"dashicons-editor-paste-text"},{"unicode":"f218","className":"dashicons-editor-removeformatting"},{"unicode":"f219","className":"dashicons-editor-video"},{"unicode":"f220","className":"dashicons-editor-customchar"},{"unicode":"f221","className":"dashicons-editor-outdent"},{"unicode":"f222","className":"dashicons-editor-indent"},{"unicode":"f223","className":"dashicons-editor-help"},{"unicode":"f224","className":"dashicons-editor-strikethrough"},{"unicode":"f225","className":"dashicons-editor-unlink"},{"unicode":"f320","className":"dashicons-editor-rtl"},{"unicode":"f474","className":"dashicons-editor-break"},{"unicode":"f475","className":"dashicons-editor-code"},{"unicode":"f476","className":"dashicons-editor-paragraph"},{"unicode":"f535","className":"dashicons-editor-table"},{"unicode":"f135","className":"dashicons-align-left"},{"unicode":"f136","className":"dashicons-align-right"},{"unicode":"f134","className":"dashicons-align-center"},{"unicode":"f138","className":"dashicons-align-none"},{"unicode":"f160","className":"dashicons-lock"},{"unicode":"f528","className":"dashicons-unlock"},{"unicode":"f145","className":"dashicons-calendar"},{"unicode":"f508","className":"dashicons-calendar-alt"},{"unicode":"f177","className":"dashicons-visibility"},{"unicode":"f530","className":"dashicons-hidden"},{"unicode":"f173","className":"dashicons-post-status"},{"unicode":"f464","className":"dashicons-edit"},{"unicode":"f182","className":"dashicons-trash"},{"unicode":"f537","className":"dashicons-sticky"},{"unicode":"f504","className":"dashicons-external"},{"unicode":"f142","className":"dashicons-arrow-up"},{"unicode":"f140","className":"dashicons-arrow-down"},{"unicode":"f139","className":"dashicons-arrow-right"},{"unicode":"f141","className":"dashicons-arrow-left"},{"unicode":"f342","className":"dashicons-arrow-up-alt"},{"unicode":"f346","className":"dashicons-arrow-down-alt"},{"unicode":"f344","className":"dashicons-arrow-right-alt"},{"unicode":"f340","className":"dashicons-arrow-left-alt"},{"unicode":"f343","className":"dashicons-arrow-up-alt2"},{"unicode":"f347","className":"dashicons-arrow-down-alt2"},{"unicode":"f345","className":"dashicons-arrow-right-alt2"},{"unicode":"f341","className":"dashicons-arrow-left-alt2"},{"unicode":"f156","className":"dashicons-sort"},{"unicode":"f229","className":"dashicons-leftright"},{"unicode":"f503","className":"dashicons-randomize"},{"unicode":"f163","className":"dashicons-list-view"},{"unicode":"f164","className":"dashicons-exerpt-view"},{"unicode":"f509","className":"dashicons-grid-view"},{"unicode":"f237","className":"dashicons-share"},{"unicode":"f240","className":"dashicons-share-alt"},{"unicode":"f242","className":"dashicons-share-alt2"},{"unicode":"f301","className":"dashicons-twitter"},{"unicode":"f303","className":"dashicons-rss"},{"unicode":"f465","className":"dashicons-email"},{"unicode":"f466","className":"dashicons-email-alt"},{"unicode":"f304","className":"dashicons-facebook"},{"unicode":"f305","className":"dashicons-facebook-alt"},{"unicode":"f462","className":"dashicons-googleplus"},{"unicode":"f325","className":"dashicons-networking"},{"unicode":"f308","className":"dashicons-hammer"},{"unicode":"f309","className":"dashicons-art"},{"unicode":"f310","className":"dashicons-migrate"},{"unicode":"f311","className":"dashicons-performance"},{"unicode":"f483","className":"dashicons-universal-access"},{"unicode":"f507","className":"dashicons-universal-access-alt"},{"unicode":"f486","className":"dashicons-tickets"},{"unicode":"f484","className":"dashicons-nametag"},{"unicode":"f481","className":"dashicons-clipboard"},{"unicode":"f487","className":"dashicons-heart"},{"unicode":"f488","className":"dashicons-megaphone"},{"unicode":"f489","className":"dashicons-schedule"},{"unicode":"f120","className":"dashicons-wordpress"},{"unicode":"f324","className":"dashicons-wordpress-alt"},{"unicode":"f157","className":"dashicons-pressthis"},{"unicode":"f463","className":"dashicons-update"},{"unicode":"f180","className":"dashicons-screenoptions"},{"unicode":"f348","className":"dashicons-info"},{"unicode":"f174","className":"dashicons-cart"},{"unicode":"f175","className":"dashicons-feedback"},{"unicode":"f176","className":"dashicons-cloud"},{"unicode":"f326","className":"dashicons-translation"},{"unicode":"f323","className":"dashicons-tag"},{"unicode":"f318","className":"dashicons-category"},{"unicode":"f480","className":"dashicons-archive"},{"unicode":"f479","className":"dashicons-tagcloud"},{"unicode":"f478","className":"dashicons-text"},{"unicode":"f147","className":"dashicons-yes"},{"unicode":"f158","className":"dashicons-no"},{"unicode":"f335","className":"dashicons-no-alt"},{"unicode":"f132","className":"dashicons-plus"},{"unicode":"f502","className":"dashicons-plus-alt"},{"unicode":"f460","className":"dashicons-minus"},{"unicode":"f153","className":"dashicons-dismiss"},{"unicode":"f159","className":"dashicons-marker"},{"unicode":"f155","className":"dashicons-star-filled"},{"unicode":"f459","className":"dashicons-star-half"},{"unicode":"f154","className":"dashicons-star-empty"},{"unicode":"f227","className":"dashicons-flag"},{"unicode":"f534","className":"dashicons-warning"},{"unicode":"f230","className":"dashicons-location"},{"unicode":"f231","className":"dashicons-location-alt"},{"unicode":"f178","className":"dashicons-vault"},{"unicode":"f332","className":"dashicons-shield"},{"unicode":"f334","className":"dashicons-shield-alt"},{"unicode":"f468","className":"dashicons-sos"},{"unicode":"f179","className":"dashicons-search"},{"unicode":"f181","className":"dashicons-slides"},{"unicode":"f183","className":"dashicons-analytics"},{"unicode":"f184","className":"dashicons-chart-pie"},{"unicode":"f185","className":"dashicons-chart-bar"},{"unicode":"f238","className":"dashicons-chart-line"},{"unicode":"f239","className":"dashicons-chart-area"},{"unicode":"f307","className":"dashicons-groups"},{"unicode":"f338","className":"dashicons-businessman"},{"unicode":"f336","className":"dashicons-id"},{"unicode":"f337","className":"dashicons-id-alt"},{"unicode":"f312","className":"dashicons-products"},{"unicode":"f313","className":"dashicons-awards"},{"unicode":"f314","className":"dashicons-forms"},{"unicode":"f473","className":"dashicons-testimonial"},{"unicode":"f322","className":"dashicons-portfolio"},{"unicode":"f330","className":"dashicons-book"},{"unicode":"f331","className":"dashicons-book-alt"},{"unicode":"f316","className":"dashicons-download"},{"unicode":"f317","className":"dashicons-upload"},{"unicode":"f321","className":"dashicons-backup"},{"unicode":"f469","className":"dashicons-clock"},{"unicode":"f339","className":"dashicons-lightbulb"},{"unicode":"f482","className":"dashicons-microphone"},{"unicode":"f472","className":"dashicons-desktop"},{"unicode":"f471","className":"dashicons-tablet"},{"unicode":"f470","className":"dashicons-smartphone"},{"unicode":"f525","className":"dashicons-phone"},{"unicode":"f510","className":"dashicons-index-card"},{"unicode":"f511","className":"dashicons-carrot"},{"unicode":"f512","className":"dashicons-building"},{"unicode":"f513","className":"dashicons-store"},{"unicode":"f514","className":"dashicons-album"},{"unicode":"f527","className":"dashicons-palmtree"},{"unicode":"f524","className":"dashicons-tickets-alt"},{"unicode":"f526","className":"dashicons-money"},{"unicode":"f328","className":"dashicons-smiley"},{"unicode":"f529","className":"dashicons-thumbs-up"},{"unicode":"f542","className":"dashicons-thumbs-down"},{"unicode":"f538","className":"dashicons-layout"}]}
|
data/json/fontawesome.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"icons":[{"unicode":"f26e","className":"fa-500px"},{"unicode":"f042","className":"fa-adjust"},{"unicode":"f170","className":"fa-adn"},{"unicode":"f037","className":"fa-align-center"},{"unicode":"f039","className":"fa-align-justify"},{"unicode":"f036","className":"fa-align-left"},{"unicode":"f038","className":"fa-align-right"},{"unicode":"f270","className":"fa-amazon"},{"unicode":"f0f9","className":"fa-ambulance"},{"unicode":"f13d","className":"fa-anchor"},{"unicode":"f17b","className":"fa-android"},{"unicode":"f209","className":"fa-angellist"},{"unicode":"f103","className":"fa-angle-double-down"},{"unicode":"f100","className":"fa-angle-double-left"},{"unicode":"f101","className":"fa-angle-double-right"},{"unicode":"f102","className":"fa-angle-double-up"},{"unicode":"f107","className":"fa-angle-down"},{"unicode":"f104","className":"fa-angle-left"},{"unicode":"f105","className":"fa-angle-right"},{"unicode":"f106","className":"fa-angle-up"},{"unicode":"f179","className":"fa-apple"},{"unicode":"f187","className":"fa-archive"},{"unicode":"f1fe","className":"fa-area-chart"},{"unicode":"f0ab","className":"fa-arrow-circle-down"},{"unicode":"f0a8","className":"fa-arrow-circle-left"},{"unicode":"f01a","className":"fa-arrow-circle-o-down"},{"unicode":"f190","className":"fa-arrow-circle-o-left"},{"unicode":"f18e","className":"fa-arrow-circle-o-right"},{"unicode":"f01b","className":"fa-arrow-circle-o-up"},{"unicode":"f0a9","className":"fa-arrow-circle-right"},{"unicode":"f0aa","className":"fa-arrow-circle-up"},{"unicode":"f063","className":"fa-arrow-down"},{"unicode":"f060","className":"fa-arrow-left"},{"unicode":"f061","className":"fa-arrow-right"},{"unicode":"f062","className":"fa-arrow-up"},{"unicode":"f047","className":"fa-arrows"},{"unicode":"f0b2","className":"fa-arrows-alt"},{"unicode":"f07e","className":"fa-arrows-h"},{"unicode":"f07d","className":"fa-arrows-v"},{"unicode":"f069","className":"fa-asterisk"},{"unicode":"f1fa","className":"fa-at"},{"unicode":"f1b9","className":"fa-automobile"},{"unicode":"f04a","className":"fa-backward"},{"unicode":"f24e","className":"fa-balance-scale"},{"unicode":"f05e","className":"fa-ban"},{"unicode":"f19c","className":"fa-bank"},{"unicode":"f080","className":"fa-bar-chart"},{"unicode":"f080","className":"fa-bar-chart-o"},{"unicode":"f02a","className":"fa-barcode"},{"unicode":"f0c9","className":"fa-bars"},{"unicode":"f244","className":"fa-battery-0"},{"unicode":"f243","className":"fa-battery-1"},{"unicode":"f242","className":"fa-battery-2"},{"unicode":"f241","className":"fa-battery-3"},{"unicode":"f240","className":"fa-battery-4"},{"unicode":"f244","className":"fa-battery-empty"},{"unicode":"f240","className":"fa-battery-full"},{"unicode":"f242","className":"fa-battery-half"},{"unicode":"f243","className":"fa-battery-quarter"},{"unicode":"f241","className":"fa-battery-three-quarters"},{"unicode":"f236","className":"fa-bed"},{"unicode":"f0fc","className":"fa-beer"},{"unicode":"f1b4","className":"fa-behance"},{"unicode":"f1b5","className":"fa-behance-square"},{"unicode":"f0f3","className":"fa-bell"},{"unicode":"f0a2","className":"fa-bell-o"},{"unicode":"f1f6","className":"fa-bell-slash"},{"unicode":"f1f7","className":"fa-bell-slash-o"},{"unicode":"f206","className":"fa-bicycle"},{"unicode":"f1e5","className":"fa-binoculars"},{"unicode":"f1fd","className":"fa-birthday-cake"},{"unicode":"f171","className":"fa-bitbucket"},{"unicode":"f172","className":"fa-bitbucket-square"},{"unicode":"f15a","className":"fa-bitcoin"},{"unicode":"f27e","className":"fa-black-tie"},{"unicode":"f293","className":"fa-bluetooth"},{"unicode":"f294","className":"fa-bluetooth-b"},{"unicode":"f032","className":"fa-bold"},{"unicode":"f0e7","className":"fa-bolt"},{"unicode":"f1e2","className":"fa-bomb"},{"unicode":"f02d","className":"fa-book"},{"unicode":"f02e","className":"fa-bookmark"},{"unicode":"f097","className":"fa-bookmark-o"},{"unicode":"f0b1","className":"fa-briefcase"},{"unicode":"f15a","className":"fa-btc"},{"unicode":"f188","className":"fa-bug"},{"unicode":"f1ad","className":"fa-building"},{"unicode":"f0f7","className":"fa-building-o"},{"unicode":"f0a1","className":"fa-bullhorn"},{"unicode":"f140","className":"fa-bullseye"},{"unicode":"f207","className":"fa-bus"},{"unicode":"f20d","className":"fa-buysellads"},{"unicode":"f1ba","className":"fa-cab"},{"unicode":"f1ec","className":"fa-calculator"},{"unicode":"f073","className":"fa-calendar"},{"unicode":"f274","className":"fa-calendar-check-o"},{"unicode":"f272","className":"fa-calendar-minus-o"},{"unicode":"f133","className":"fa-calendar-o"},{"unicode":"f271","className":"fa-calendar-plus-o"},{"unicode":"f273","className":"fa-calendar-times-o"},{"unicode":"f030","className":"fa-camera"},{"unicode":"f083","className":"fa-camera-retro"},{"unicode":"f1b9","className":"fa-car"},{"unicode":"f0d7","className":"fa-caret-down"},{"unicode":"f0d9","className":"fa-caret-left"},{"unicode":"f0da","className":"fa-caret-right"},{"unicode":"f150","className":"fa-caret-square-o-down"},{"unicode":"f191","className":"fa-caret-square-o-left"},{"unicode":"f152","className":"fa-caret-square-o-right"},{"unicode":"f151","className":"fa-caret-square-o-up"},{"unicode":"f0d8","className":"fa-caret-up"},{"unicode":"f218","className":"fa-cart-arrow-down"},{"unicode":"f217","className":"fa-cart-plus"},{"unicode":"f20a","className":"fa-cc"},{"unicode":"f1f3","className":"fa-cc-amex"},{"unicode":"f24c","className":"fa-cc-diners-club"},{"unicode":"f1f2","className":"fa-cc-discover"},{"unicode":"f24b","className":"fa-cc-jcb"},{"unicode":"f1f1","className":"fa-cc-mastercard"},{"unicode":"f1f4","className":"fa-cc-paypal"},{"unicode":"f1f5","className":"fa-cc-stripe"},{"unicode":"f1f0","className":"fa-cc-visa"},{"unicode":"f0a3","className":"fa-certificate"},{"unicode":"f0c1","className":"fa-chain"},{"unicode":"f127","className":"fa-chain-broken"},{"unicode":"f00c","className":"fa-check"},{"unicode":"f058","className":"fa-check-circle"},{"unicode":"f05d","className":"fa-check-circle-o"},{"unicode":"f14a","className":"fa-check-square"},{"unicode":"f046","className":"fa-check-square-o"},{"unicode":"f13a","className":"fa-chevron-circle-down"},{"unicode":"f137","className":"fa-chevron-circle-left"},{"unicode":"f138","className":"fa-chevron-circle-right"},{"unicode":"f139","className":"fa-chevron-circle-up"},{"unicode":"f078","className":"fa-chevron-down"},{"unicode":"f053","className":"fa-chevron-left"},{"unicode":"f054","className":"fa-chevron-right"},{"unicode":"f077","className":"fa-chevron-up"},{"unicode":"f1ae","className":"fa-child"},{"unicode":"f268","className":"fa-chrome"},{"unicode":"f111","className":"fa-circle"},{"unicode":"f10c","className":"fa-circle-o"},{"unicode":"f1ce","className":"fa-circle-o-notch"},{"unicode":"f1db","className":"fa-circle-thin"},{"unicode":"f0ea","className":"fa-clipboard"},{"unicode":"f017","className":"fa-clock-o"},{"unicode":"f24d","className":"fa-clone"},{"unicode":"f00d","className":"fa-close"},{"unicode":"f0c2","className":"fa-cloud"},{"unicode":"f0ed","className":"fa-cloud-download"},{"unicode":"f0ee","className":"fa-cloud-upload"},{"unicode":"f157","className":"fa-cny"},{"unicode":"f121","className":"fa-code"},{"unicode":"f126","className":"fa-code-fork"},{"unicode":"f1cb","className":"fa-codepen"},{"unicode":"f284","className":"fa-codiepie"},{"unicode":"f0f4","className":"fa-coffee"},{"unicode":"f013","className":"fa-cog"},{"unicode":"f085","className":"fa-cogs"},{"unicode":"f0db","className":"fa-columns"},{"unicode":"f075","className":"fa-comment"},{"unicode":"f0e5","className":"fa-comment-o"},{"unicode":"f27a","className":"fa-commenting"},{"unicode":"f27b","className":"fa-commenting-o"},{"unicode":"f086","className":"fa-comments"},{"unicode":"f0e6","className":"fa-comments-o"},{"unicode":"f14e","className":"fa-compass"},{"unicode":"f066","className":"fa-compress"},{"unicode":"f20e","className":"fa-connectdevelop"},{"unicode":"f26d","className":"fa-contao"},{"unicode":"f0c5","className":"fa-copy"},{"unicode":"f1f9","className":"fa-copyright"},{"unicode":"f25e","className":"fa-creative-commons"},{"unicode":"f09d","className":"fa-credit-card"},{"unicode":"f283","className":"fa-credit-card-alt"},{"unicode":"f125","className":"fa-crop"},{"unicode":"f05b","className":"fa-crosshairs"},{"unicode":"f13c","className":"fa-css3"},{"unicode":"f1b2","className":"fa-cube"},{"unicode":"f1b3","className":"fa-cubes"},{"unicode":"f0c4","className":"fa-cut"},{"unicode":"f0f5","className":"fa-cutlery"},{"unicode":"f0e4","className":"fa-dashboard"},{"unicode":"f210","className":"fa-dashcube"},{"unicode":"f1c0","className":"fa-database"},{"unicode":"f03b","className":"fa-dedent"},{"unicode":"f1a5","className":"fa-delicious"},{"unicode":"f108","className":"fa-desktop"},{"unicode":"f1bd","className":"fa-deviantart"},{"unicode":"f219","className":"fa-diamond"},{"unicode":"f1a6","className":"fa-digg"},{"unicode":"f155","className":"fa-dollar"},{"unicode":"f192","className":"fa-dot-circle-o"},{"unicode":"f019","className":"fa-download"},{"unicode":"f17d","className":"fa-dribbble"},{"unicode":"f16b","className":"fa-dropbox"},{"unicode":"f1a9","className":"fa-drupal"},{"unicode":"f282","className":"fa-edge"},{"unicode":"f044","className":"fa-edit"},{"unicode":"f052","className":"fa-eject"},{"unicode":"f141","className":"fa-ellipsis-h"},{"unicode":"f142","className":"fa-ellipsis-v"},{"unicode":"f1d1","className":"fa-empire"},{"unicode":"f0e0","className":"fa-envelope"},{"unicode":"f003","className":"fa-envelope-o"},{"unicode":"f199","className":"fa-envelope-square"},{"unicode":"f12d","className":"fa-eraser"},{"unicode":"f153","className":"fa-eur"},{"unicode":"f153","className":"fa-euro"},{"unicode":"f0ec","className":"fa-exchange"},{"unicode":"f12a","className":"fa-exclamation"},{"unicode":"f06a","className":"fa-exclamation-circle"},{"unicode":"f071","className":"fa-exclamation-triangle"},{"unicode":"f065","className":"fa-expand"},{"unicode":"f23e","className":"fa-expeditedssl"},{"unicode":"f08e","className":"fa-external-link"},{"unicode":"f14c","className":"fa-external-link-square"},{"unicode":"f06e","className":"fa-eye"},{"unicode":"f070","className":"fa-eye-slash"},{"unicode":"f1fb","className":"fa-eyedropper"},{"unicode":"f09a","className":"fa-facebook"},{"unicode":"f09a","className":"fa-facebook-f"},{"unicode":"f230","className":"fa-facebook-official"},{"unicode":"f082","className":"fa-facebook-square"},{"unicode":"f049","className":"fa-fast-backward"},{"unicode":"f050","className":"fa-fast-forward"},{"unicode":"f1ac","className":"fa-fax"},{"unicode":"f09e","className":"fa-feed"},{"unicode":"f182","className":"fa-female"},{"unicode":"f0fb","className":"fa-fighter-jet"},{"unicode":"f15b","className":"fa-file"},{"unicode":"f1c6","className":"fa-file-archive-o"},{"unicode":"f1c7","className":"fa-file-audio-o"},{"unicode":"f1c9","className":"fa-file-code-o"},{"unicode":"f1c3","className":"fa-file-excel-o"},{"unicode":"f1c5","className":"fa-file-image-o"},{"unicode":"f1c8","className":"fa-file-movie-o"},{"unicode":"f016","className":"fa-file-o"},{"unicode":"f1c1","className":"fa-file-pdf-o"},{"unicode":"f1c5","className":"fa-file-photo-o"},{"unicode":"f1c5","className":"fa-file-picture-o"},{"unicode":"f1c4","className":"fa-file-powerpoint-o"},{"unicode":"f1c7","className":"fa-file-sound-o"},{"unicode":"f15c","className":"fa-file-text"},{"unicode":"f0f6","className":"fa-file-text-o"},{"unicode":"f1c8","className":"fa-file-video-o"},{"unicode":"f1c2","className":"fa-file-word-o"},{"unicode":"f1c6","className":"fa-file-zip-o"},{"unicode":"f0c5","className":"fa-files-o"},{"unicode":"f008","className":"fa-film"},{"unicode":"f0b0","className":"fa-filter"},{"unicode":"f06d","className":"fa-fire"},{"unicode":"f134","className":"fa-fire-extinguisher"},{"unicode":"f269","className":"fa-firefox"},{"unicode":"f024","className":"fa-flag"},{"unicode":"f11e","className":"fa-flag-checkered"},{"unicode":"f11d","className":"fa-flag-o"},{"unicode":"f0e7","className":"fa-flash"},{"unicode":"f0c3","className":"fa-flask"},{"unicode":"f16e","className":"fa-flickr"},{"unicode":"f0c7","className":"fa-floppy-o"},{"unicode":"f07b","className":"fa-folder"},{"unicode":"f114","className":"fa-folder-o"},{"unicode":"f07c","className":"fa-folder-open"},{"unicode":"f115","className":"fa-folder-open-o"},{"unicode":"f031","className":"fa-font"},{"unicode":"f280","className":"fa-fonticons"},{"unicode":"f286","className":"fa-fort-awesome"},{"unicode":"f211","className":"fa-forumbee"},{"unicode":"f04e","className":"fa-forward"},{"unicode":"f180","className":"fa-foursquare"},{"unicode":"f119","className":"fa-frown-o"},{"unicode":"f1e3","className":"fa-futbol-o"},{"unicode":"f11b","className":"fa-gamepad"},{"unicode":"f0e3","className":"fa-gavel"},{"unicode":"f154","className":"fa-gbp"},{"unicode":"f1d1","className":"fa-ge"},{"unicode":"f013","className":"fa-gear"},{"unicode":"f085","className":"fa-gears"},{"unicode":"f22d","className":"fa-genderless"},{"unicode":"f265","className":"fa-get-pocket"},{"unicode":"f260","className":"fa-gg"},{"unicode":"f261","className":"fa-gg-circle"},{"unicode":"f06b","className":"fa-gift"},{"unicode":"f1d3","className":"fa-git"},{"unicode":"f1d2","className":"fa-git-square"},{"unicode":"f09b","className":"fa-github"},{"unicode":"f113","className":"fa-github-alt"},{"unicode":"f092","className":"fa-github-square"},{"unicode":"f184","className":"fa-gittip"},{"unicode":"f000","className":"fa-glass"},{"unicode":"f0ac","className":"fa-globe"},{"unicode":"f1a0","className":"fa-google"},{"unicode":"f0d5","className":"fa-google-plus"},{"unicode":"f0d4","className":"fa-google-plus-square"},{"unicode":"f1ee","className":"fa-google-wallet"},{"unicode":"f19d","className":"fa-graduation-cap"},{"unicode":"f184","className":"fa-gratipay"},{"unicode":"f0c0","className":"fa-group"},{"unicode":"f0fd","className":"fa-h-square"},{"unicode":"f1d4","className":"fa-hacker-news"},{"unicode":"f255","className":"fa-hand-grab-o"},{"unicode":"f258","className":"fa-hand-lizard-o"},{"unicode":"f0a7","className":"fa-hand-o-down"},{"unicode":"f0a5","className":"fa-hand-o-left"},{"unicode":"f0a4","className":"fa-hand-o-right"},{"unicode":"f0a6","className":"fa-hand-o-up"},{"unicode":"f256","className":"fa-hand-paper-o"},{"unicode":"f25b","className":"fa-hand-peace-o"},{"unicode":"f25a","className":"fa-hand-pointer-o"},{"unicode":"f255","className":"fa-hand-rock-o"},{"unicode":"f257","className":"fa-hand-scissors-o"},{"unicode":"f259","className":"fa-hand-spock-o"},{"unicode":"f256","className":"fa-hand-stop-o"},{"unicode":"f292","className":"fa-hashtag"},{"unicode":"f0a0","className":"fa-hdd-o"},{"unicode":"f1dc","className":"fa-header"},{"unicode":"f025","className":"fa-headphones"},{"unicode":"f004","className":"fa-heart"},{"unicode":"f08a","className":"fa-heart-o"},{"unicode":"f21e","className":"fa-heartbeat"},{"unicode":"f1da","className":"fa-history"},{"unicode":"f015","className":"fa-home"},{"unicode":"f0f8","className":"fa-hospital-o"},{"unicode":"f236","className":"fa-hotel"},{"unicode":"f254","className":"fa-hourglass"},{"unicode":"f251","className":"fa-hourglass-1"},{"unicode":"f252","className":"fa-hourglass-2"},{"unicode":"f253","className":"fa-hourglass-3"},{"unicode":"f253","className":"fa-hourglass-end"},{"unicode":"f252","className":"fa-hourglass-half"},{"unicode":"f250","className":"fa-hourglass-o"},{"unicode":"f251","className":"fa-hourglass-start"},{"unicode":"f27c","className":"fa-houzz"},{"unicode":"f13b","className":"fa-html5"},{"unicode":"f246","className":"fa-i-cursor"},{"unicode":"f20b","className":"fa-ils"},{"unicode":"f03e","className":"fa-image"},{"unicode":"f01c","className":"fa-inbox"},{"unicode":"f03c","className":"fa-indent"},{"unicode":"f275","className":"fa-industry"},{"unicode":"f129","className":"fa-info"},{"unicode":"f05a","className":"fa-info-circle"},{"unicode":"f156","className":"fa-inr"},{"unicode":"f16d","className":"fa-instagram"},{"unicode":"f19c","className":"fa-institution"},{"unicode":"f26b","className":"fa-internet-explorer"},{"unicode":"f224","className":"fa-intersex"},{"unicode":"f208","className":"fa-ioxhost"},{"unicode":"f033","className":"fa-italic"},{"unicode":"f1aa","className":"fa-joomla"},{"unicode":"f157","className":"fa-jpy"},{"unicode":"f1cc","className":"fa-jsfiddle"},{"unicode":"f084","className":"fa-key"},{"unicode":"f11c","className":"fa-keyboard-o"},{"unicode":"f159","className":"fa-krw"},{"unicode":"f1ab","className":"fa-language"},{"unicode":"f109","className":"fa-laptop"},{"unicode":"f202","className":"fa-lastfm"},{"unicode":"f203","className":"fa-lastfm-square"},{"unicode":"f06c","className":"fa-leaf"},{"unicode":"f212","className":"fa-leanpub"},{"unicode":"f0e3","className":"fa-legal"},{"unicode":"f094","className":"fa-lemon-o"},{"unicode":"f149","className":"fa-level-down"},{"unicode":"f148","className":"fa-level-up"},{"unicode":"f1cd","className":"fa-life-bouy"},{"unicode":"f1cd","className":"fa-life-buoy"},{"unicode":"f1cd","className":"fa-life-ring"},{"unicode":"f1cd","className":"fa-life-saver"},{"unicode":"f0eb","className":"fa-lightbulb-o"},{"unicode":"f201","className":"fa-line-chart"},{"unicode":"f0c1","className":"fa-link"},{"unicode":"f0e1","className":"fa-linkedin"},{"unicode":"f08c","className":"fa-linkedin-square"},{"unicode":"f17c","className":"fa-linux"},{"unicode":"f03a","className":"fa-list"},{"unicode":"f022","className":"fa-list-alt"},{"unicode":"f0cb","className":"fa-list-ol"},{"unicode":"f0ca","className":"fa-list-ul"},{"unicode":"f124","className":"fa-location-arrow"},{"unicode":"f023","className":"fa-lock"},{"unicode":"f175","className":"fa-long-arrow-down"},{"unicode":"f177","className":"fa-long-arrow-left"},{"unicode":"f178","className":"fa-long-arrow-right"},{"unicode":"f176","className":"fa-long-arrow-up"},{"unicode":"f0d0","className":"fa-magic"},{"unicode":"f076","className":"fa-magnet"},{"unicode":"f064","className":"fa-mail-forward"},{"unicode":"f112","className":"fa-mail-reply"},{"unicode":"f122","className":"fa-mail-reply-all"},{"unicode":"f183","className":"fa-male"},{"unicode":"f279","className":"fa-map"},{"unicode":"f041","className":"fa-map-marker"},{"unicode":"f278","className":"fa-map-o"},{"unicode":"f276","className":"fa-map-pin"},{"unicode":"f277","className":"fa-map-signs"},{"unicode":"f222","className":"fa-mars"},{"unicode":"f227","className":"fa-mars-double"},{"unicode":"f229","className":"fa-mars-stroke"},{"unicode":"f22b","className":"fa-mars-stroke-h"},{"unicode":"f22a","className":"fa-mars-stroke-v"},{"unicode":"f136","className":"fa-maxcdn"},{"unicode":"f20c","className":"fa-meanpath"},{"unicode":"f23a","className":"fa-medium"},{"unicode":"f0fa","className":"fa-medkit"},{"unicode":"f11a","className":"fa-meh-o"},{"unicode":"f223","className":"fa-mercury"},{"unicode":"f130","className":"fa-microphone"},{"unicode":"f131","className":"fa-microphone-slash"},{"unicode":"f068","className":"fa-minus"},{"unicode":"f056","className":"fa-minus-circle"},{"unicode":"f146","className":"fa-minus-square"},{"unicode":"f147","className":"fa-minus-square-o"},{"unicode":"f289","className":"fa-mixcloud"},{"unicode":"f10b","className":"fa-mobile"},{"unicode":"f10b","className":"fa-mobile-phone"},{"unicode":"f285","className":"fa-modx"},{"unicode":"f0d6","className":"fa-money"},{"unicode":"f186","className":"fa-moon-o"},{"unicode":"f19d","className":"fa-mortar-board"},{"unicode":"f21c","className":"fa-motorcycle"},{"unicode":"f245","className":"fa-mouse-pointer"},{"unicode":"f001","className":"fa-music"},{"unicode":"f0c9","className":"fa-navicon"},{"unicode":"f22c","className":"fa-neuter"},{"unicode":"f1ea","className":"fa-newspaper-o"},{"unicode":"f247","className":"fa-object-group"},{"unicode":"f248","className":"fa-object-ungroup"},{"unicode":"f263","className":"fa-odnoklassniki"},{"unicode":"f264","className":"fa-odnoklassniki-square"},{"unicode":"f23d","className":"fa-opencart"},{"unicode":"f19b","className":"fa-openid"},{"unicode":"f26a","className":"fa-opera"},{"unicode":"f23c","className":"fa-optin-monster"},{"unicode":"f03b","className":"fa-outdent"},{"unicode":"f18c","className":"fa-pagelines"},{"unicode":"f1fc","className":"fa-paint-brush"},{"unicode":"f1d8","className":"fa-paper-plane"},{"unicode":"f1d9","className":"fa-paper-plane-o"},{"unicode":"f0c6","className":"fa-paperclip"},{"unicode":"f1dd","className":"fa-paragraph"},{"unicode":"f0ea","className":"fa-paste"},{"unicode":"f04c","className":"fa-pause"},{"unicode":"f28b","className":"fa-pause-circle"},{"unicode":"f28c","className":"fa-pause-circle-o"},{"unicode":"f1b0","className":"fa-paw"},{"unicode":"f1ed","className":"fa-paypal"},{"unicode":"f040","className":"fa-pencil"},{"unicode":"f14b","className":"fa-pencil-square"},{"unicode":"f044","className":"fa-pencil-square-o"},{"unicode":"f295","className":"fa-percent"},{"unicode":"f095","className":"fa-phone"},{"unicode":"f098","className":"fa-phone-square"},{"unicode":"f03e","className":"fa-photo"},{"unicode":"f03e","className":"fa-picture-o"},{"unicode":"f200","className":"fa-pie-chart"},{"unicode":"f1a7","className":"fa-pied-piper"},{"unicode":"f1a8","className":"fa-pied-piper-alt"},{"unicode":"f0d2","className":"fa-pinterest"},{"unicode":"f231","className":"fa-pinterest-p"},{"unicode":"f0d3","className":"fa-pinterest-square"},{"unicode":"f072","className":"fa-plane"},{"unicode":"f04b","className":"fa-play"},{"unicode":"f144","className":"fa-play-circle"},{"unicode":"f01d","className":"fa-play-circle-o"},{"unicode":"f1e6","className":"fa-plug"},{"unicode":"f067","className":"fa-plus"},{"unicode":"f055","className":"fa-plus-circle"},{"unicode":"f0fe","className":"fa-plus-square"},{"unicode":"f196","className":"fa-plus-square-o"},{"unicode":"f011","className":"fa-power-off"},{"unicode":"f02f","className":"fa-print"},{"unicode":"f288","className":"fa-product-hunt"},{"unicode":"f12e","className":"fa-puzzle-piece"},{"unicode":"f1d6","className":"fa-qq"},{"unicode":"f029","className":"fa-qrcode"},{"unicode":"f128","className":"fa-question"},{"unicode":"f059","className":"fa-question-circle"},{"unicode":"f10d","className":"fa-quote-left"},{"unicode":"f10e","className":"fa-quote-right"},{"unicode":"f1d0","className":"fa-ra"},{"unicode":"f074","className":"fa-random"},{"unicode":"f1d0","className":"fa-rebel"},{"unicode":"f1b8","className":"fa-recycle"},{"unicode":"f1a1","className":"fa-reddit"},{"unicode":"f281","className":"fa-reddit-alien"},{"unicode":"f1a2","className":"fa-reddit-square"},{"unicode":"f021","className":"fa-refresh"},{"unicode":"f25d","className":"fa-registered"},{"unicode":"f00d","className":"fa-remove"},{"unicode":"f18b","className":"fa-renren"},{"unicode":"f0c9","className":"fa-reorder"},{"unicode":"f01e","className":"fa-repeat"},{"unicode":"f112","className":"fa-reply"},{"unicode":"f122","className":"fa-reply-all"},{"unicode":"f079","className":"fa-retweet"},{"unicode":"f157","className":"fa-rmb"},{"unicode":"f018","className":"fa-road"},{"unicode":"f135","className":"fa-rocket"},{"unicode":"f0e2","className":"fa-rotate-left"},{"unicode":"f01e","className":"fa-rotate-right"},{"unicode":"f158","className":"fa-rouble"},{"unicode":"f09e","className":"fa-rss"},{"unicode":"f143","className":"fa-rss-square"},{"unicode":"f158","className":"fa-rub"},{"unicode":"f158","className":"fa-ruble"},{"unicode":"f156","className":"fa-rupee"},{"unicode":"f267","className":"fa-safari"},{"unicode":"f0c7","className":"fa-save"},{"unicode":"f0c4","className":"fa-scissors"},{"unicode":"f28a","className":"fa-scribd"},{"unicode":"f002","className":"fa-search"},{"unicode":"f010","className":"fa-search-minus"},{"unicode":"f00e","className":"fa-search-plus"},{"unicode":"f213","className":"fa-sellsy"},{"unicode":"f1d8","className":"fa-send"},{"unicode":"f1d9","className":"fa-send-o"},{"unicode":"f233","className":"fa-server"},{"unicode":"f064","className":"fa-share"},{"unicode":"f1e0","className":"fa-share-alt"},{"unicode":"f1e1","className":"fa-share-alt-square"},{"unicode":"f14d","className":"fa-share-square"},{"unicode":"f045","className":"fa-share-square-o"},{"unicode":"f20b","className":"fa-shekel"},{"unicode":"f20b","className":"fa-sheqel"},{"unicode":"f132","className":"fa-shield"},{"unicode":"f21a","className":"fa-ship"},{"unicode":"f214","className":"fa-shirtsinbulk"},{"unicode":"f290","className":"fa-shopping-bag"},{"unicode":"f291","className":"fa-shopping-basket"},{"unicode":"f07a","className":"fa-shopping-cart"},{"unicode":"f090","className":"fa-sign-in"},{"unicode":"f08b","className":"fa-sign-out"},{"unicode":"f012","className":"fa-signal"},{"unicode":"f215","className":"fa-simplybuilt"},{"unicode":"f0e8","className":"fa-sitemap"},{"unicode":"f216","className":"fa-skyatlas"},{"unicode":"f17e","className":"fa-skype"},{"unicode":"f198","className":"fa-slack"},{"unicode":"f1de","className":"fa-sliders"},{"unicode":"f1e7","className":"fa-slideshare"},{"unicode":"f118","className":"fa-smile-o"},{"unicode":"f1e3","className":"fa-soccer-ball-o"},{"unicode":"f0dc","className":"fa-sort"},{"unicode":"f15d","className":"fa-sort-alpha-asc"},{"unicode":"f15e","className":"fa-sort-alpha-desc"},{"unicode":"f160","className":"fa-sort-amount-asc"},{"unicode":"f161","className":"fa-sort-amount-desc"},{"unicode":"f0de","className":"fa-sort-asc"},{"unicode":"f0dd","className":"fa-sort-desc"},{"unicode":"f0dd","className":"fa-sort-down"},{"unicode":"f162","className":"fa-sort-numeric-asc"},{"unicode":"f163","className":"fa-sort-numeric-desc"},{"unicode":"f0de","className":"fa-sort-up"},{"unicode":"f1be","className":"fa-soundcloud"},{"unicode":"f197","className":"fa-space-shuttle"},{"unicode":"f110","className":"fa-spinner"},{"unicode":"f1b1","className":"fa-spoon"},{"unicode":"f1bc","className":"fa-spotify"},{"unicode":"f0c8","className":"fa-square"},{"unicode":"f096","className":"fa-square-o"},{"unicode":"f18d","className":"fa-stack-exchange"},{"unicode":"f16c","className":"fa-stack-overflow"},{"unicode":"f005","className":"fa-star"},{"unicode":"f089","className":"fa-star-half"},{"unicode":"f123","className":"fa-star-half-empty"},{"unicode":"f123","className":"fa-star-half-full"},{"unicode":"f123","className":"fa-star-half-o"},{"unicode":"f006","className":"fa-star-o"},{"unicode":"f1b6","className":"fa-steam"},{"unicode":"f1b7","className":"fa-steam-square"},{"unicode":"f048","className":"fa-step-backward"},{"unicode":"f051","className":"fa-step-forward"},{"unicode":"f0f1","className":"fa-stethoscope"},{"unicode":"f249","className":"fa-sticky-note"},{"unicode":"f24a","className":"fa-sticky-note-o"},{"unicode":"f04d","className":"fa-stop"},{"unicode":"f28d","className":"fa-stop-circle"},{"unicode":"f28e","className":"fa-stop-circle-o"},{"unicode":"f21d","className":"fa-street-view"},{"unicode":"f0cc","className":"fa-strikethrough"},{"unicode":"f1a4","className":"fa-stumbleupon"},{"unicode":"f1a3","className":"fa-stumbleupon-circle"},{"unicode":"f12c","className":"fa-subscript"},{"unicode":"f239","className":"fa-subway"},{"unicode":"f0f2","className":"fa-suitcase"},{"unicode":"f185","className":"fa-sun-o"},{"unicode":"f12b","className":"fa-superscript"},{"unicode":"f1cd","className":"fa-support"},{"unicode":"f0ce","className":"fa-table"},{"unicode":"f10a","className":"fa-tablet"},{"unicode":"f0e4","className":"fa-tachometer"},{"unicode":"f02b","className":"fa-tag"},{"unicode":"f02c","className":"fa-tags"},{"unicode":"f0ae","className":"fa-tasks"},{"unicode":"f1ba","className":"fa-taxi"},{"unicode":"f26c","className":"fa-television"},{"unicode":"f1d5","className":"fa-tencent-weibo"},{"unicode":"f120","className":"fa-terminal"},{"unicode":"f034","className":"fa-text-height"},{"unicode":"f035","className":"fa-text-width"},{"unicode":"f00a","className":"fa-th"},{"unicode":"f009","className":"fa-th-large"},{"unicode":"f00b","className":"fa-th-list"},{"unicode":"f08d","className":"fa-thumb-tack"},{"unicode":"f165","className":"fa-thumbs-down"},{"unicode":"f088","className":"fa-thumbs-o-down"},{"unicode":"f087","className":"fa-thumbs-o-up"},{"unicode":"f164","className":"fa-thumbs-up"},{"unicode":"f145","className":"fa-ticket"},{"unicode":"f00d","className":"fa-times"},{"unicode":"f057","className":"fa-times-circle"},{"unicode":"f05c","className":"fa-times-circle-o"},{"unicode":"f043","className":"fa-tint"},{"unicode":"f150","className":"fa-toggle-down"},{"unicode":"f191","className":"fa-toggle-left"},{"unicode":"f204","className":"fa-toggle-off"},{"unicode":"f205","className":"fa-toggle-on"},{"unicode":"f152","className":"fa-toggle-right"},{"unicode":"f151","className":"fa-toggle-up"},{"unicode":"f25c","className":"fa-trademark"},{"unicode":"f238","className":"fa-train"},{"unicode":"f224","className":"fa-transgender"},{"unicode":"f225","className":"fa-transgender-alt"},{"unicode":"f1f8","className":"fa-trash"},{"unicode":"f014","className":"fa-trash-o"},{"unicode":"f1bb","className":"fa-tree"},{"unicode":"f181","className":"fa-trello"},{"unicode":"f262","className":"fa-tripadvisor"},{"unicode":"f091","className":"fa-trophy"},{"unicode":"f0d1","className":"fa-truck"},{"unicode":"f195","className":"fa-try"},{"unicode":"f1e4","className":"fa-tty"},{"unicode":"f173","className":"fa-tumblr"},{"unicode":"f174","className":"fa-tumblr-square"},{"unicode":"f195","className":"fa-turkish-lira"},{"unicode":"f26c","className":"fa-tv"},{"unicode":"f1e8","className":"fa-twitch"},{"unicode":"f099","className":"fa-twitter"},{"unicode":"f081","className":"fa-twitter-square"},{"unicode":"f0e9","className":"fa-umbrella"},{"unicode":"f0cd","className":"fa-underline"},{"unicode":"f0e2","className":"fa-undo"},{"unicode":"f19c","className":"fa-university"},{"unicode":"f127","className":"fa-unlink"},{"unicode":"f09c","className":"fa-unlock"},{"unicode":"f13e","className":"fa-unlock-alt"},{"unicode":"f0dc","className":"fa-unsorted"},{"unicode":"f093","className":"fa-upload"},{"unicode":"f287","className":"fa-usb"},{"unicode":"f155","className":"fa-usd"},{"unicode":"f007","className":"fa-user"},{"unicode":"f0f0","className":"fa-user-md"},{"unicode":"f234","className":"fa-user-plus"},{"unicode":"f21b","className":"fa-user-secret"},{"unicode":"f235","className":"fa-user-times"},{"unicode":"f0c0","className":"fa-users"},{"unicode":"f221","className":"fa-venus"},{"unicode":"f226","className":"fa-venus-double"},{"unicode":"f228","className":"fa-venus-mars"},{"unicode":"f237","className":"fa-viacoin"},{"unicode":"f03d","className":"fa-video-camera"},{"unicode":"f27d","className":"fa-vimeo"},{"unicode":"f194","className":"fa-vimeo-square"},{"unicode":"f1ca","className":"fa-vine"},{"unicode":"f189","className":"fa-vk"},{"unicode":"f027","className":"fa-volume-down"},{"unicode":"f026","className":"fa-volume-off"},{"unicode":"f028","className":"fa-volume-up"},{"unicode":"f071","className":"fa-warning"},{"unicode":"f1d7","className":"fa-wechat"},{"unicode":"f18a","className":"fa-weibo"},{"unicode":"f1d7","className":"fa-weixin"},{"unicode":"f232","className":"fa-whatsapp"},{"unicode":"f193","className":"fa-wheelchair"},{"unicode":"f1eb","className":"fa-wifi"},{"unicode":"f266","className":"fa-wikipedia-w"},{"unicode":"f17a","className":"fa-windows"},{"unicode":"f159","className":"fa-won"},{"unicode":"f19a","className":"fa-wordpress"},{"unicode":"f0ad","className":"fa-wrench"},{"unicode":"f168","className":"fa-xing"},{"unicode":"f169","className":"fa-xing-square"},{"unicode":"f23b","className":"fa-y-combinator"},{"unicode":"f1d4","className":"fa-y-combinator-square"},{"unicode":"f19e","className":"fa-yahoo"},{"unicode":"f23b","className":"fa-yc"},{"unicode":"f1d4","className":"fa-yc-square"},{"unicode":"f1e9","className":"fa-yelp"},{"unicode":"f157","className":"fa-yen"},{"unicode":"f167","className":"fa-youtube"},{"unicode":"f16a","className":"fa-youtube-play"},{"unicode":"f166","className":"fa-youtube-square"}]}
|
| 1 |
+
{"icons":[{"unicode":"f26e","className":"fa-500px"},{"unicode":"f042","className":"fa-adjust"},{"unicode":"f170","className":"fa-adn"},{"unicode":"f037","className":"fa-align-center"},{"unicode":"f039","className":"fa-align-justify"},{"unicode":"f036","className":"fa-align-left"},{"unicode":"f038","className":"fa-align-right"},{"unicode":"f270","className":"fa-amazon"},{"unicode":"f0f9","className":"fa-ambulance"},{"unicode":"f13d","className":"fa-anchor"},{"unicode":"f17b","className":"fa-android"},{"unicode":"f209","className":"fa-angellist"},{"unicode":"f103","className":"fa-angle-double-down"},{"unicode":"f100","className":"fa-angle-double-left"},{"unicode":"f101","className":"fa-angle-double-right"},{"unicode":"f102","className":"fa-angle-double-up"},{"unicode":"f107","className":"fa-angle-down"},{"unicode":"f104","className":"fa-angle-left"},{"unicode":"f105","className":"fa-angle-right"},{"unicode":"f106","className":"fa-angle-up"},{"unicode":"f179","className":"fa-apple"},{"unicode":"f187","className":"fa-archive"},{"unicode":"f1fe","className":"fa-area-chart"},{"unicode":"f0ab","className":"fa-arrow-circle-down"},{"unicode":"f0a8","className":"fa-arrow-circle-left"},{"unicode":"f01a","className":"fa-arrow-circle-o-down"},{"unicode":"f190","className":"fa-arrow-circle-o-left"},{"unicode":"f18e","className":"fa-arrow-circle-o-right"},{"unicode":"f01b","className":"fa-arrow-circle-o-up"},{"unicode":"f0a9","className":"fa-arrow-circle-right"},{"unicode":"f0aa","className":"fa-arrow-circle-up"},{"unicode":"f063","className":"fa-arrow-down"},{"unicode":"f060","className":"fa-arrow-left"},{"unicode":"f061","className":"fa-arrow-right"},{"unicode":"f062","className":"fa-arrow-up"},{"unicode":"f047","className":"fa-arrows"},{"unicode":"f0b2","className":"fa-arrows-alt"},{"unicode":"f07e","className":"fa-arrows-h"},{"unicode":"f07d","className":"fa-arrows-v"},{"unicode":"f069","className":"fa-asterisk"},{"unicode":"f1fa","className":"fa-at"},{"unicode":"f1b9","className":"fa-automobile"},{"unicode":"f04a","className":"fa-backward"},{"unicode":"f24e","className":"fa-balance-scale"},{"unicode":"f05e","className":"fa-ban"},{"unicode":"f19c","className":"fa-bank"},{"unicode":"f080","className":"fa-bar-chart"},{"unicode":"f080","className":"fa-bar-chart-o"},{"unicode":"f02a","className":"fa-barcode"},{"unicode":"f0c9","className":"fa-bars"},{"unicode":"f244","className":"fa-battery-0"},{"unicode":"f243","className":"fa-battery-1"},{"unicode":"f242","className":"fa-battery-2"},{"unicode":"f241","className":"fa-battery-3"},{"unicode":"f240","className":"fa-battery-4"},{"unicode":"f244","className":"fa-battery-empty"},{"unicode":"f240","className":"fa-battery-full"},{"unicode":"f242","className":"fa-battery-half"},{"unicode":"f243","className":"fa-battery-quarter"},{"unicode":"f241","className":"fa-battery-three-quarters"},{"unicode":"f236","className":"fa-bed"},{"unicode":"f0fc","className":"fa-beer"},{"unicode":"f1b4","className":"fa-behance"},{"unicode":"f1b5","className":"fa-behance-square"},{"unicode":"f0f3","className":"fa-bell"},{"unicode":"f0a2","className":"fa-bell-o"},{"unicode":"f1f6","className":"fa-bell-slash"},{"unicode":"f1f7","className":"fa-bell-slash-o"},{"unicode":"f206","className":"fa-bicycle"},{"unicode":"f1e5","className":"fa-binoculars"},{"unicode":"f1fd","className":"fa-birthday-cake"},{"unicode":"f171","className":"fa-bitbucket"},{"unicode":"f172","className":"fa-bitbucket-square"},{"unicode":"f15a","className":"fa-bitcoin"},{"unicode":"f27e","className":"fa-black-tie"},{"unicode":"f293","className":"fa-bluetooth"},{"unicode":"f294","className":"fa-bluetooth-b"},{"unicode":"f032","className":"fa-bold"},{"unicode":"f0e7","className":"fa-bolt"},{"unicode":"f1e2","className":"fa-bomb"},{"unicode":"f02d","className":"fa-book"},{"unicode":"f02e","className":"fa-bookmark"},{"unicode":"f097","className":"fa-bookmark-o"},{"unicode":"f0b1","className":"fa-briefcase"},{"unicode":"f15a","className":"fa-btc"},{"unicode":"f188","className":"fa-bug"},{"unicode":"f1ad","className":"fa-building"},{"unicode":"f0f7","className":"fa-building-o"},{"unicode":"f0a1","className":"fa-bullhorn"},{"unicode":"f140","className":"fa-bullseye"},{"unicode":"f207","className":"fa-bus"},{"unicode":"f20d","className":"fa-buysellads"},{"unicode":"f1ba","className":"fa-cab"},{"unicode":"f1ec","className":"fa-calculator"},{"unicode":"f073","className":"fa-calendar"},{"unicode":"f274","className":"fa-calendar-check-o"},{"unicode":"f272","className":"fa-calendar-minus-o"},{"unicode":"f133","className":"fa-calendar-o"},{"unicode":"f271","className":"fa-calendar-plus-o"},{"unicode":"f273","className":"fa-calendar-times-o"},{"unicode":"f030","className":"fa-camera"},{"unicode":"f083","className":"fa-camera-retro"},{"unicode":"f1b9","className":"fa-car"},{"unicode":"f0d7","className":"fa-caret-down"},{"unicode":"f0d9","className":"fa-caret-left"},{"unicode":"f0da","className":"fa-caret-right"},{"unicode":"f150","className":"fa-caret-square-o-down"},{"unicode":"f191","className":"fa-caret-square-o-left"},{"unicode":"f152","className":"fa-caret-square-o-right"},{"unicode":"f151","className":"fa-caret-square-o-up"},{"unicode":"f0d8","className":"fa-caret-up"},{"unicode":"f218","className":"fa-cart-arrow-down"},{"unicode":"f217","className":"fa-cart-plus"},{"unicode":"f20a","className":"fa-cc"},{"unicode":"f1f3","className":"fa-cc-amex"},{"unicode":"f24c","className":"fa-cc-diners-club"},{"unicode":"f1f2","className":"fa-cc-discover"},{"unicode":"f24b","className":"fa-cc-jcb"},{"unicode":"f1f1","className":"fa-cc-mastercard"},{"unicode":"f1f4","className":"fa-cc-paypal"},{"unicode":"f1f5","className":"fa-cc-stripe"},{"unicode":"f1f0","className":"fa-cc-visa"},{"unicode":"f0a3","className":"fa-certificate"},{"unicode":"f0c1","className":"fa-chain"},{"unicode":"f127","className":"fa-chain-broken"},{"unicode":"f00c","className":"fa-check"},{"unicode":"f058","className":"fa-check-circle"},{"unicode":"f05d","className":"fa-check-circle-o"},{"unicode":"f14a","className":"fa-check-square"},{"unicode":"f046","className":"fa-check-square-o"},{"unicode":"f13a","className":"fa-chevron-circle-down"},{"unicode":"f137","className":"fa-chevron-circle-left"},{"unicode":"f138","className":"fa-chevron-circle-right"},{"unicode":"f139","className":"fa-chevron-circle-up"},{"unicode":"f078","className":"fa-chevron-down"},{"unicode":"f053","className":"fa-chevron-left"},{"unicode":"f054","className":"fa-chevron-right"},{"unicode":"f077","className":"fa-chevron-up"},{"unicode":"f1ae","className":"fa-child"},{"unicode":"f268","className":"fa-chrome"},{"unicode":"f111","className":"fa-circle"},{"unicode":"f10c","className":"fa-circle-o"},{"unicode":"f1ce","className":"fa-circle-o-notch"},{"unicode":"f1db","className":"fa-circle-thin"},{"unicode":"f0ea","className":"fa-clipboard"},{"unicode":"f017","className":"fa-clock-o"},{"unicode":"f24d","className":"fa-clone"},{"unicode":"f00d","className":"fa-close"},{"unicode":"f0c2","className":"fa-cloud"},{"unicode":"f0ed","className":"fa-cloud-download"},{"unicode":"f0ee","className":"fa-cloud-upload"},{"unicode":"f157","className":"fa-cny"},{"unicode":"f121","className":"fa-code"},{"unicode":"f126","className":"fa-code-fork"},{"unicode":"f1cb","className":"fa-codepen"},{"unicode":"f284","className":"fa-codiepie"},{"unicode":"f0f4","className":"fa-coffee"},{"unicode":"f013","className":"fa-cog"},{"unicode":"f085","className":"fa-cogs"},{"unicode":"f0db","className":"fa-columns"},{"unicode":"f075","className":"fa-comment"},{"unicode":"f0e5","className":"fa-comment-o"},{"unicode":"f27a","className":"fa-commenting"},{"unicode":"f27b","className":"fa-commenting-o"},{"unicode":"f086","className":"fa-comments"},{"unicode":"f0e6","className":"fa-comments-o"},{"unicode":"f14e","className":"fa-compass"},{"unicode":"f066","className":"fa-compress"},{"unicode":"f20e","className":"fa-connectdevelop"},{"unicode":"f26d","className":"fa-contao"},{"unicode":"f0c5","className":"fa-copy"},{"unicode":"f1f9","className":"fa-copyright"},{"unicode":"f25e","className":"fa-creative-commons"},{"unicode":"f09d","className":"fa-credit-card"},{"unicode":"f283","className":"fa-credit-card-alt"},{"unicode":"f125","className":"fa-crop"},{"unicode":"f05b","className":"fa-crosshairs"},{"unicode":"f13c","className":"fa-css3"},{"unicode":"f1b2","className":"fa-cube"},{"unicode":"f1b3","className":"fa-cubes"},{"unicode":"f0c4","className":"fa-cut"},{"unicode":"f0f5","className":"fa-cutlery"},{"unicode":"f0e4","className":"fa-dashboard"},{"unicode":"f210","className":"fa-dashcube"},{"unicode":"f1c0","className":"fa-database"},{"unicode":"f03b","className":"fa-dedent"},{"unicode":"f1a5","className":"fa-delicious"},{"unicode":"f108","className":"fa-desktop"},{"unicode":"f1bd","className":"fa-deviantart"},{"unicode":"f219","className":"fa-diamond"},{"unicode":"f1a6","className":"fa-digg"},{"unicode":"f155","className":"fa-dollar"},{"unicode":"f192","className":"fa-dot-circle-o"},{"unicode":"f019","className":"fa-download"},{"unicode":"f17d","className":"fa-dribbble"},{"unicode":"f16b","className":"fa-dropbox"},{"unicode":"f1a9","className":"fa-drupal"},{"unicode":"f282","className":"fa-edge"},{"unicode":"f044","className":"fa-edit"},{"unicode":"f052","className":"fa-eject"},{"unicode":"f141","className":"fa-ellipsis-h"},{"unicode":"f142","className":"fa-ellipsis-v"},{"unicode":"f1d1","className":"fa-empire"},{"unicode":"f0e0","className":"fa-envelope"},{"unicode":"f003","className":"fa-envelope-o"},{"unicode":"f199","className":"fa-envelope-square"},{"unicode":"f12d","className":"fa-eraser"},{"unicode":"f153","className":"fa-eur"},{"unicode":"f153","className":"fa-euro"},{"unicode":"f0ec","className":"fa-exchange"},{"unicode":"f12a","className":"fa-exclamation"},{"unicode":"f06a","className":"fa-exclamation-circle"},{"unicode":"f071","className":"fa-exclamation-triangle"},{"unicode":"f065","className":"fa-expand"},{"unicode":"f23e","className":"fa-expeditedssl"},{"unicode":"f08e","className":"fa-external-link"},{"unicode":"f14c","className":"fa-external-link-square"},{"unicode":"f06e","className":"fa-eye"},{"unicode":"f070","className":"fa-eye-slash"},{"unicode":"f1fb","className":"fa-eyedropper"},{"unicode":"f09a","className":"fa-facebook"},{"unicode":"f09a","className":"fa-facebook-f"},{"unicode":"f230","className":"fa-facebook-official"},{"unicode":"f082","className":"fa-facebook-square"},{"unicode":"f049","className":"fa-fast-backward"},{"unicode":"f050","className":"fa-fast-forward"},{"unicode":"f1ac","className":"fa-fax"},{"unicode":"f09e","className":"fa-feed"},{"unicode":"f182","className":"fa-female"},{"unicode":"f0fb","className":"fa-fighter-jet"},{"unicode":"f15b","className":"fa-file"},{"unicode":"f1c6","className":"fa-file-archive-o"},{"unicode":"f1c7","className":"fa-file-audio-o"},{"unicode":"f1c9","className":"fa-file-code-o"},{"unicode":"f1c3","className":"fa-file-excel-o"},{"unicode":"f1c5","className":"fa-file-image-o"},{"unicode":"f1c8","className":"fa-file-movie-o"},{"unicode":"f016","className":"fa-file-o"},{"unicode":"f1c1","className":"fa-file-pdf-o"},{"unicode":"f1c5","className":"fa-file-photo-o"},{"unicode":"f1c5","className":"fa-file-picture-o"},{"unicode":"f1c4","className":"fa-file-powerpoint-o"},{"unicode":"f1c7","className":"fa-file-sound-o"},{"unicode":"f15c","className":"fa-file-text"},{"unicode":"f0f6","className":"fa-file-text-o"},{"unicode":"f1c8","className":"fa-file-video-o"},{"unicode":"f1c2","className":"fa-file-word-o"},{"unicode":"f1c6","className":"fa-file-zip-o"},{"unicode":"f0c5","className":"fa-files-o"},{"unicode":"f008","className":"fa-film"},{"unicode":"f0b0","className":"fa-filter"},{"unicode":"f06d","className":"fa-fire"},{"unicode":"f134","className":"fa-fire-extinguisher"},{"unicode":"f269","className":"fa-firefox"},{"unicode":"f024","className":"fa-flag"},{"unicode":"f11e","className":"fa-flag-checkered"},{"unicode":"f11d","className":"fa-flag-o"},{"unicode":"f0e7","className":"fa-flash"},{"unicode":"f0c3","className":"fa-flask"},{"unicode":"f16e","className":"fa-flickr"},{"unicode":"f0c7","className":"fa-floppy-o"},{"unicode":"f07b","className":"fa-folder"},{"unicode":"f114","className":"fa-folder-o"},{"unicode":"f07c","className":"fa-folder-open"},{"unicode":"f115","className":"fa-folder-open-o"},{"unicode":"f031","className":"fa-font"},{"unicode":"f280","className":"fa-fonticons"},{"unicode":"f286","className":"fa-fort-awesome"},{"unicode":"f211","className":"fa-forumbee"},{"unicode":"f04e","className":"fa-forward"},{"unicode":"f180","className":"fa-foursquare"},{"unicode":"f119","className":"fa-frown-o"},{"unicode":"f1e3","className":"fa-futbol-o"},{"unicode":"f11b","className":"fa-gamepad"},{"unicode":"f0e3","className":"fa-gavel"},{"unicode":"f154","className":"fa-gbp"},{"unicode":"f1d1","className":"fa-ge"},{"unicode":"f013","className":"fa-gear"},{"unicode":"f085","className":"fa-gears"},{"unicode":"f22d","className":"fa-genderless"},{"unicode":"f265","className":"fa-get-pocket"},{"unicode":"f260","className":"fa-gg"},{"unicode":"f261","className":"fa-gg-circle"},{"unicode":"f06b","className":"fa-gift"},{"unicode":"f1d3","className":"fa-git"},{"unicode":"f1d2","className":"fa-git-square"},{"unicode":"f09b","className":"fa-github"},{"unicode":"f113","className":"fa-github-alt"},{"unicode":"f092","className":"fa-github-square"},{"unicode":"f184","className":"fa-gittip"},{"unicode":"f000","className":"fa-glass"},{"unicode":"f0ac","className":"fa-globe"},{"unicode":"f1a0","className":"fa-google"},{"unicode":"f0d5","className":"fa-google-plus"},{"unicode":"f0d4","className":"fa-google-plus-square"},{"unicode":"f1ee","className":"fa-google-wallet"},{"unicode":"f19d","className":"fa-graduation-cap"},{"unicode":"f184","className":"fa-gratipay"},{"unicode":"f0c0","className":"fa-group"},{"unicode":"f0fd","className":"fa-h-square"},{"unicode":"f1d4","className":"fa-hacker-news"},{"unicode":"f255","className":"fa-hand-grab-o"},{"unicode":"f258","className":"fa-hand-lizard-o"},{"unicode":"f0a7","className":"fa-hand-o-down"},{"unicode":"f0a5","className":"fa-hand-o-left"},{"unicode":"f0a4","className":"fa-hand-o-right"},{"unicode":"f0a6","className":"fa-hand-o-up"},{"unicode":"f256","className":"fa-hand-paper-o"},{"unicode":"f25b","className":"fa-hand-peace-o"},{"unicode":"f25a","className":"fa-hand-pointer-o"},{"unicode":"f255","className":"fa-hand-rock-o"},{"unicode":"f257","className":"fa-hand-scissors-o"},{"unicode":"f259","className":"fa-hand-spock-o"},{"unicode":"f256","className":"fa-hand-stop-o"},{"unicode":"f292","className":"fa-hashtag"},{"unicode":"f0a0","className":"fa-hdd-o"},{"unicode":"f1dc","className":"fa-header"},{"unicode":"f025","className":"fa-headphones"},{"unicode":"f004","className":"fa-heart"},{"unicode":"f08a","className":"fa-heart-o"},{"unicode":"f21e","className":"fa-heartbeat"},{"unicode":"f1da","className":"fa-history"},{"unicode":"f015","className":"fa-home"},{"unicode":"f0f8","className":"fa-hospital-o"},{"unicode":"f236","className":"fa-hotel"},{"unicode":"f254","className":"fa-hourglass"},{"unicode":"f251","className":"fa-hourglass-1"},{"unicode":"f252","className":"fa-hourglass-2"},{"unicode":"f253","className":"fa-hourglass-3"},{"unicode":"f253","className":"fa-hourglass-end"},{"unicode":"f252","className":"fa-hourglass-half"},{"unicode":"f250","className":"fa-hourglass-o"},{"unicode":"f251","className":"fa-hourglass-start"},{"unicode":"f27c","className":"fa-houzz"},{"unicode":"f13b","className":"fa-html5"},{"unicode":"f246","className":"fa-i-cursor"},{"unicode":"f20b","className":"fa-ils"},{"unicode":"f03e","className":"fa-image"},{"unicode":"f01c","className":"fa-inbox"},{"unicode":"f03c","className":"fa-indent"},{"unicode":"f275","className":"fa-industry"},{"unicode":"f129","className":"fa-info"},{"unicode":"f05a","className":"fa-info-circle"},{"unicode":"f156","className":"fa-inr"},{"unicode":"f16d","className":"fa-instagram"},{"unicode":"f19c","className":"fa-institution"},{"unicode":"f26b","className":"fa-internet-explorer"},{"unicode":"f224","className":"fa-intersex"},{"unicode":"f208","className":"fa-ioxhost"},{"unicode":"f033","className":"fa-italic"},{"unicode":"f1aa","className":"fa-joomla"},{"unicode":"f157","className":"fa-jpy"},{"unicode":"f1cc","className":"fa-jsfiddle"},{"unicode":"f084","className":"fa-key"},{"unicode":"f11c","className":"fa-keyboard-o"},{"unicode":"f159","className":"fa-krw"},{"unicode":"f1ab","className":"fa-language"},{"unicode":"f109","className":"fa-laptop"},{"unicode":"f202","className":"fa-lastfm"},{"unicode":"f203","className":"fa-lastfm-square"},{"unicode":"f06c","className":"fa-leaf"},{"unicode":"f212","className":"fa-leanpub"},{"unicode":"f0e3","className":"fa-legal"},{"unicode":"f094","className":"fa-lemon-o"},{"unicode":"f149","className":"fa-level-down"},{"unicode":"f148","className":"fa-level-up"},{"unicode":"f1cd","className":"fa-life-bouy"},{"unicode":"f1cd","className":"fa-life-buoy"},{"unicode":"f1cd","className":"fa-life-ring"},{"unicode":"f1cd","className":"fa-life-saver"},{"unicode":"f0eb","className":"fa-lightbulb-o"},{"unicode":"f201","className":"fa-line-chart"},{"unicode":"f0c1","className":"fa-link"},{"unicode":"f0e1","className":"fa-linkedin"},{"unicode":"f08c","className":"fa-linkedin-square"},{"unicode":"f17c","className":"fa-linux"},{"unicode":"f03a","className":"fa-list"},{"unicode":"f022","className":"fa-list-alt"},{"unicode":"f0cb","className":"fa-list-ol"},{"unicode":"f0ca","className":"fa-list-ul"},{"unicode":"f124","className":"fa-location-arrow"},{"unicode":"f023","className":"fa-lock"},{"unicode":"f175","className":"fa-long-arrow-down"},{"unicode":"f177","className":"fa-long-arrow-left"},{"unicode":"f178","className":"fa-long-arrow-right"},{"unicode":"f176","className":"fa-long-arrow-up"},{"unicode":"f0d0","className":"fa-magic"},{"unicode":"f076","className":"fa-magnet"},{"unicode":"f064","className":"fa-mail-forward"},{"unicode":"f112","className":"fa-mail-reply"},{"unicode":"f122","className":"fa-mail-reply-all"},{"unicode":"f183","className":"fa-male"},{"unicode":"f279","className":"fa-map"},{"unicode":"f041","className":"fa-map-marker"},{"unicode":"f278","className":"fa-map-o"},{"unicode":"f276","className":"fa-map-pin"},{"unicode":"f277","className":"fa-map-signs"},{"unicode":"f222","className":"fa-mars"},{"unicode":"f227","className":"fa-mars-double"},{"unicode":"f229","className":"fa-mars-stroke"},{"unicode":"f22b","className":"fa-mars-stroke-h"},{"unicode":"f22a","className":"fa-mars-stroke-v"},{"unicode":"f136","className":"fa-maxcdn"},{"unicode":"f20c","className":"fa-meanpath"},{"unicode":"f23a","className":"fa-medium"},{"unicode":"f0fa","className":"fa-medkit"},{"unicode":"f11a","className":"fa-meh-o"},{"unicode":"f223","className":"fa-mercury"},{"unicode":"f130","className":"fa-microphone"},{"unicode":"f131","className":"fa-microphone-slash"},{"unicode":"f068","className":"fa-minus"},{"unicode":"f056","className":"fa-minus-circle"},{"unicode":"f146","className":"fa-minus-square"},{"unicode":"f147","className":"fa-minus-square-o"},{"unicode":"f289","className":"fa-mixcloud"},{"unicode":"f10b","className":"fa-mobile"},{"unicode":"f10b","className":"fa-mobile-phone"},{"unicode":"f285","className":"fa-modx"},{"unicode":"f0d6","className":"fa-money"},{"unicode":"f186","className":"fa-moon-o"},{"unicode":"f19d","className":"fa-mortar-board"},{"unicode":"f21c","className":"fa-motorcycle"},{"unicode":"f245","className":"fa-mouse-pointer"},{"unicode":"f001","className":"fa-music"},{"unicode":"f0c9","className":"fa-navicon"},{"unicode":"f22c","className":"fa-neuter"},{"unicode":"f1ea","className":"fa-newspaper-o"},{"unicode":"f247","className":"fa-object-group"},{"unicode":"f248","className":"fa-object-ungroup"},{"unicode":"f263","className":"fa-odnoklassniki"},{"unicode":"f264","className":"fa-odnoklassniki-square"},{"unicode":"f23d","className":"fa-opencart"},{"unicode":"f19b","className":"fa-openid"},{"unicode":"f26a","className":"fa-opera"},{"unicode":"f23c","className":"fa-optin-monster"},{"unicode":"f03b","className":"fa-outdent"},{"unicode":"f18c","className":"fa-pagelines"},{"unicode":"f1fc","className":"fa-paint-brush"},{"unicode":"f1d8","className":"fa-paper-plane"},{"unicode":"f1d9","className":"fa-paper-plane-o"},{"unicode":"f0c6","className":"fa-paperclip"},{"unicode":"f1dd","className":"fa-paragraph"},{"unicode":"f0ea","className":"fa-paste"},{"unicode":"f04c","className":"fa-pause"},{"unicode":"f28b","className":"fa-pause-circle"},{"unicode":"f28c","className":"fa-pause-circle-o"},{"unicode":"f1b0","className":"fa-paw"},{"unicode":"f1ed","className":"fa-paypal"},{"unicode":"f040","className":"fa-pencil"},{"unicode":"f14b","className":"fa-pencil-square"},{"unicode":"f044","className":"fa-pencil-square-o"},{"unicode":"f295","className":"fa-percent"},{"unicode":"f095","className":"fa-phone"},{"unicode":"f098","className":"fa-phone-square"},{"unicode":"f03e","className":"fa-photo"},{"unicode":"f03e","className":"fa-picture-o"},{"unicode":"f200","className":"fa-pie-chart"},{"unicode":"f1a7","className":"fa-pied-piper"},{"unicode":"f1a8","className":"fa-pied-piper-alt"},{"unicode":"f0d2","className":"fa-pinterest"},{"unicode":"f231","className":"fa-pinterest-p"},{"unicode":"f0d3","className":"fa-pinterest-square"},{"unicode":"f072","className":"fa-plane"},{"unicode":"f04b","className":"fa-play"},{"unicode":"f144","className":"fa-play-circle"},{"unicode":"f01d","className":"fa-play-circle-o"},{"unicode":"f1e6","className":"fa-plug"},{"unicode":"f067","className":"fa-plus"},{"unicode":"f055","className":"fa-plus-circle"},{"unicode":"f0fe","className":"fa-plus-square"},{"unicode":"f196","className":"fa-plus-square-o"},{"unicode":"f011","className":"fa-power-off"},{"unicode":"f02f","className":"fa-print"},{"unicode":"f288","className":"fa-product-hunt"},{"unicode":"f12e","className":"fa-puzzle-piece"},{"unicode":"f1d6","className":"fa-qq"},{"unicode":"f029","className":"fa-qrcode"},{"unicode":"f128","className":"fa-question"},{"unicode":"f059","className":"fa-question-circle"},{"unicode":"f10d","className":"fa-quote-left"},{"unicode":"f10e","className":"fa-quote-right"},{"unicode":"f1d0","className":"fa-ra"},{"unicode":"f074","className":"fa-random"},{"unicode":"f1d0","className":"fa-rebel"},{"unicode":"f1b8","className":"fa-recycle"},{"unicode":"f1a1","className":"fa-reddit"},{"unicode":"f281","className":"fa-reddit-alien"},{"unicode":"f1a2","className":"fa-reddit-square"},{"unicode":"f021","className":"fa-refresh"},{"unicode":"f25d","className":"fa-registered"},{"unicode":"f00d","className":"fa-remove"},{"unicode":"f18b","className":"fa-renren"},{"unicode":"f0c9","className":"fa-reorder"},{"unicode":"f01e","className":"fa-repeat"},{"unicode":"f112","className":"fa-reply"},{"unicode":"f122","className":"fa-reply-all"},{"unicode":"f079","className":"fa-retweet"},{"unicode":"f157","className":"fa-rmb"},{"unicode":"f018","className":"fa-road"},{"unicode":"f135","className":"fa-rocket"},{"unicode":"f0e2","className":"fa-rotate-left"},{"unicode":"f01e","className":"fa-rotate-right"},{"unicode":"f158","className":"fa-rouble"},{"unicode":"f09e","className":"fa-rss"},{"unicode":"f143","className":"fa-rss-square"},{"unicode":"f158","className":"fa-rub"},{"unicode":"f158","className":"fa-ruble"},{"unicode":"f156","className":"fa-rupee"},{"unicode":"f267","className":"fa-safari"},{"unicode":"f0c7","className":"fa-save"},{"unicode":"f0c4","className":"fa-scissors"},{"unicode":"f28a","className":"fa-scribd"},{"unicode":"f002","className":"fa-search"},{"unicode":"f010","className":"fa-search-minus"},{"unicode":"f00e","className":"fa-search-plus"},{"unicode":"f213","className":"fa-sellsy"},{"unicode":"f1d8","className":"fa-send"},{"unicode":"f1d9","className":"fa-send-o"},{"unicode":"f233","className":"fa-server"},{"unicode":"f064","className":"fa-share"},{"unicode":"f1e0","className":"fa-share-alt"},{"unicode":"f1e1","className":"fa-share-alt-square"},{"unicode":"f14d","className":"fa-share-square"},{"unicode":"f045","className":"fa-share-square-o"},{"unicode":"f20b","className":"fa-shekel"},{"unicode":"f20b","className":"fa-sheqel"},{"unicode":"f132","className":"fa-shield"},{"unicode":"f21a","className":"fa-ship"},{"unicode":"f214","className":"fa-shirtsinbulk"},{"unicode":"f290","className":"fa-shopping-bag"},{"unicode":"f291","className":"fa-shopping-basket"},{"unicode":"f07a","className":"fa-shopping-cart"},{"unicode":"f090","className":"fa-sign-in"},{"unicode":"f08b","className":"fa-sign-out"},{"unicode":"f012","className":"fa-signal"},{"unicode":"f215","className":"fa-simplybuilt"},{"unicode":"f0e8","className":"fa-sitemap"},{"unicode":"f216","className":"fa-skyatlas"},{"unicode":"f17e","className":"fa-skype"},{"unicode":"f198","className":"fa-slack"},{"unicode":"f1de","className":"fa-sliders"},{"unicode":"f1e7","className":"fa-slideshare"},{"unicode":"f118","className":"fa-smile-o"},{"unicode":"f1e3","className":"fa-soccer-ball-o"},{"unicode":"f0dc","className":"fa-sort"},{"unicode":"f15d","className":"fa-sort-alpha-asc"},{"unicode":"f15e","className":"fa-sort-alpha-desc"},{"unicode":"f160","className":"fa-sort-amount-asc"},{"unicode":"f161","className":"fa-sort-amount-desc"},{"unicode":"f0de","className":"fa-sort-asc"},{"unicode":"f0dd","className":"fa-sort-desc"},{"unicode":"f0dd","className":"fa-sort-down"},{"unicode":"f162","className":"fa-sort-numeric-asc"},{"unicode":"f163","className":"fa-sort-numeric-desc"},{"unicode":"f0de","className":"fa-sort-up"},{"unicode":"f1be","className":"fa-soundcloud"},{"unicode":"f197","className":"fa-space-shuttle"},{"unicode":"f110","className":"fa-spinner"},{"unicode":"f1b1","className":"fa-spoon"},{"unicode":"f1bc","className":"fa-spotify"},{"unicode":"f0c8","className":"fa-square"},{"unicode":"f096","className":"fa-square-o"},{"unicode":"f18d","className":"fa-stack-exchange"},{"unicode":"f16c","className":"fa-stack-overflow"},{"unicode":"f005","className":"fa-star"},{"unicode":"f089","className":"fa-star-half"},{"unicode":"f123","className":"fa-star-half-empty"},{"unicode":"f123","className":"fa-star-half-full"},{"unicode":"f123","className":"fa-star-half-o"},{"unicode":"f006","className":"fa-star-o"},{"unicode":"f1b6","className":"fa-steam"},{"unicode":"f1b7","className":"fa-steam-square"},{"unicode":"f048","className":"fa-step-backward"},{"unicode":"f051","className":"fa-step-forward"},{"unicode":"f0f1","className":"fa-stethoscope"},{"unicode":"f249","className":"fa-sticky-note"},{"unicode":"f24a","className":"fa-sticky-note-o"},{"unicode":"f04d","className":"fa-stop"},{"unicode":"f28d","className":"fa-stop-circle"},{"unicode":"f28e","className":"fa-stop-circle-o"},{"unicode":"f21d","className":"fa-street-view"},{"unicode":"f0cc","className":"fa-strikethrough"},{"unicode":"f1a4","className":"fa-stumbleupon"},{"unicode":"f1a3","className":"fa-stumbleupon-circle"},{"unicode":"f12c","className":"fa-subscript"},{"unicode":"f239","className":"fa-subway"},{"unicode":"f0f2","className":"fa-suitcase"},{"unicode":"f185","className":"fa-sun-o"},{"unicode":"f12b","className":"fa-superscript"},{"unicode":"f1cd","className":"fa-support"},{"unicode":"f0ce","className":"fa-table"},{"unicode":"f10a","className":"fa-tablet"},{"unicode":"f0e4","className":"fa-tachometer"},{"unicode":"f02b","className":"fa-tag"},{"unicode":"f02c","className":"fa-tags"},{"unicode":"f0ae","className":"fa-tasks"},{"unicode":"f1ba","className":"fa-taxi"},{"unicode":"f26c","className":"fa-television"},{"unicode":"f1d5","className":"fa-tencent-weibo"},{"unicode":"f120","className":"fa-terminal"},{"unicode":"f034","className":"fa-text-height"},{"unicode":"f035","className":"fa-text-width"},{"unicode":"f00a","className":"fa-th"},{"unicode":"f009","className":"fa-th-large"},{"unicode":"f00b","className":"fa-th-list"},{"unicode":"f08d","className":"fa-thumb-tack"},{"unicode":"f165","className":"fa-thumbs-down"},{"unicode":"f088","className":"fa-thumbs-o-down"},{"unicode":"f087","className":"fa-thumbs-o-up"},{"unicode":"f164","className":"fa-thumbs-up"},{"unicode":"f145","className":"fa-ticket"},{"unicode":"f00d","className":"fa-times"},{"unicode":"f057","className":"fa-times-circle"},{"unicode":"f05c","className":"fa-times-circle-o"},{"unicode":"f043","className":"fa-tint"},{"unicode":"f150","className":"fa-toggle-down"},{"unicode":"f191","className":"fa-toggle-left"},{"unicode":"f204","className":"fa-toggle-off"},{"unicode":"f205","className":"fa-toggle-on"},{"unicode":"f152","className":"fa-toggle-right"},{"unicode":"f151","className":"fa-toggle-up"},{"unicode":"f25c","className":"fa-trademark"},{"unicode":"f238","className":"fa-train"},{"unicode":"f224","className":"fa-transgender"},{"unicode":"f225","className":"fa-transgender-alt"},{"unicode":"f1f8","className":"fa-trash"},{"unicode":"f014","className":"fa-trash-o"},{"unicode":"f1bb","className":"fa-tree"},{"unicode":"f181","className":"fa-trello"},{"unicode":"f262","className":"fa-tripadvisor"},{"unicode":"f091","className":"fa-trophy"},{"unicode":"f0d1","className":"fa-truck"},{"unicode":"f195","className":"fa-try"},{"unicode":"f1e4","className":"fa-tty"},{"unicode":"f173","className":"fa-tumblr"},{"unicode":"f174","className":"fa-tumblr-square"},{"unicode":"f195","className":"fa-turkish-lira"},{"unicode":"f26c","className":"fa-tv"},{"unicode":"f1e8","className":"fa-twitch"},{"unicode":"f099","className":"fa-twitter"},{"unicode":"f081","className":"fa-twitter-square"},{"unicode":"f0e9","className":"fa-umbrella"},{"unicode":"f0cd","className":"fa-underline"},{"unicode":"f0e2","className":"fa-undo"},{"unicode":"f19c","className":"fa-university"},{"unicode":"f127","className":"fa-unlink"},{"unicode":"f09c","className":"fa-unlock"},{"unicode":"f13e","className":"fa-unlock-alt"},{"unicode":"f0dc","className":"fa-unsorted"},{"unicode":"f093","className":"fa-upload"},{"unicode":"f287","className":"fa-usb"},{"unicode":"f155","className":"fa-usd"},{"unicode":"f007","className":"fa-user"},{"unicode":"f0f0","className":"fa-user-md"},{"unicode":"f234","className":"fa-user-plus"},{"unicode":"f21b","className":"fa-user-secret"},{"unicode":"f235","className":"fa-user-times"},{"unicode":"f0c0","className":"fa-users"},{"unicode":"f221","className":"fa-venus"},{"unicode":"f226","className":"fa-venus-double"},{"unicode":"f228","className":"fa-venus-mars"},{"unicode":"f237","className":"fa-viacoin"},{"unicode":"f03d","className":"fa-video-camera"},{"unicode":"f27d","className":"fa-vimeo"},{"unicode":"f194","className":"fa-vimeo-square"},{"unicode":"f1ca","className":"fa-vine"},{"unicode":"f189","className":"fa-vk"},{"unicode":"f027","className":"fa-volume-down"},{"unicode":"f026","className":"fa-volume-off"},{"unicode":"f028","className":"fa-volume-up"},{"unicode":"f071","className":"fa-warning"},{"unicode":"f1d7","className":"fa-wechat"},{"unicode":"f18a","className":"fa-weibo"},{"unicode":"f1d7","className":"fa-weixin"},{"unicode":"f232","className":"fa-whatsapp"},{"unicode":"f193","className":"fa-wheelchair"},{"unicode":"f1eb","className":"fa-wifi"},{"unicode":"f266","className":"fa-wikipedia-w"},{"unicode":"f17a","className":"fa-windows"},{"unicode":"f159","className":"fa-won"},{"unicode":"f19a","className":"fa-wordpress"},{"unicode":"f0ad","className":"fa-wrench"},{"unicode":"f168","className":"fa-xing"},{"unicode":"f169","className":"fa-xing-square"},{"unicode":"f23b","className":"fa-y-combinator"},{"unicode":"f1d4","className":"fa-y-combinator-square"},{"unicode":"f19e","className":"fa-yahoo"},{"unicode":"f23b","className":"fa-yc"},{"unicode":"f1d4","className":"fa-yc-square"},{"unicode":"f1e9","className":"fa-yelp"},{"unicode":"f157","className":"fa-yen"},{"unicode":"f167","className":"fa-youtube"},{"unicode":"f16a","className":"fa-youtube-play"},{"unicode":"f166","className":"fa-youtube-square"}]}
|
includes/.htaccess
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
deny from all
|
| 1 |
+
deny from all
|
includes/admin/class-wpel-network-page.php
CHANGED
|
@@ -1,181 +1,181 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Network_Page
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Network_Page extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var string
|
| 18 |
-
*/
|
| 19 |
-
private $menu_slug = 'wpel-network-settings-page';
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @var string
|
| 23 |
-
*/
|
| 24 |
-
private $current_tab = null;
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* @var array
|
| 28 |
-
*/
|
| 29 |
-
private $tabs = array();
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* Initialize
|
| 33 |
-
*/
|
| 34 |
-
protected function init( array $fields_objects )
|
| 35 |
-
{
|
| 36 |
-
$this->tabs = array(
|
| 37 |
-
'network-settings' => array(
|
| 38 |
-
'title' => __( 'Multi Site Settings', 'wp-external-links' ),
|
| 39 |
-
'icon' => '<i class="fa fa-sitemap" aria-hidden="true"></i>',
|
| 40 |
-
'fields' => $fields_objects[ 'network-settings' ],
|
| 41 |
-
),
|
| 42 |
-
'network-admin-settings' => array(
|
| 43 |
-
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 44 |
-
'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
| 45 |
-
'fields' => $fields_objects[ 'network-admin-settings' ],
|
| 46 |
-
),
|
| 47 |
-
'support' => array(
|
| 48 |
-
'title' => __( 'Support', 'wp-external-links' ),
|
| 49 |
-
'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
|
| 50 |
-
),
|
| 51 |
-
);
|
| 52 |
-
|
| 53 |
-
// get current tab
|
| 54 |
-
$this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
|
| 55 |
-
|
| 56 |
-
// set default tab
|
| 57 |
-
if ( ! key_exists( $this->current_tab, $this->tabs ) ) {
|
| 58 |
-
reset( $this->tabs );
|
| 59 |
-
$this->current_tab = key( $this->tabs );
|
| 60 |
-
}
|
| 61 |
-
}
|
| 62 |
-
|
| 63 |
-
/**
|
| 64 |
-
* Get option value
|
| 65 |
-
* @param string $key
|
| 66 |
-
* @param string $type
|
| 67 |
-
* @return string
|
| 68 |
-
* @triggers E_USER_NOTICE Option value cannot be found
|
| 69 |
-
*/
|
| 70 |
-
public function get_option_value( $key, $type = null )
|
| 71 |
-
{
|
| 72 |
-
if ( null === $type ) {
|
| 73 |
-
foreach ( $this->tabs as $tab_key => $values ) {
|
| 74 |
-
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 75 |
-
continue;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
$option_values = $values[ 'fields' ]->get_option_values();
|
| 79 |
-
|
| 80 |
-
if ( ! isset( $option_values[ $key ] ) ) {
|
| 81 |
-
continue;
|
| 82 |
-
}
|
| 83 |
-
|
| 84 |
-
return $option_values[ $key ];
|
| 85 |
-
}
|
| 86 |
-
} else if ( isset( $this->tabs[ $type ][ 'fields' ] ) ) {
|
| 87 |
-
$option_values = $this->tabs[ $type ][ 'fields' ]->get_option_values();
|
| 88 |
-
return $option_values[ $key ];
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
trigger_error( 'Option value "'. $key .'" cannot be found.' );
|
| 92 |
-
}
|
| 93 |
-
|
| 94 |
-
/**
|
| 95 |
-
* Action for "network_admin_menu"
|
| 96 |
-
*/
|
| 97 |
-
protected function action_network_admin_menu()
|
| 98 |
-
{
|
| 99 |
-
$own_admin_menu = $this->get_option_value( 'own_admin_menu' );
|
| 100 |
-
|
| 101 |
-
if ( '1' === $own_admin_menu ) {
|
| 102 |
-
$this->page_hook = add_menu_page(
|
| 103 |
-
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 104 |
-
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 105 |
-
, 'manage_network' // capability
|
| 106 |
-
, $this->menu_slug // menu slug
|
| 107 |
-
, $this->get_callback( 'show_network_page' ) // callback
|
| 108 |
-
, 'none' // icon
|
| 109 |
-
, null // position
|
| 110 |
-
);
|
| 111 |
-
} else {
|
| 112 |
-
$this->page_hook = add_submenu_page(
|
| 113 |
-
'settings.php' // parent slug
|
| 114 |
-
, __( 'WP External Links' , 'wp-external-links' ) // page title
|
| 115 |
-
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 116 |
-
, 'manage_options' // capability
|
| 117 |
-
, $this->menu_slug // menu slug
|
| 118 |
-
, $this->get_callback( 'show_network_page' ) // callback
|
| 119 |
-
);
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
add_action( 'load-'. $this->page_hook, $this->get_callback( 'add_help_tabs' ) );
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
/**
|
| 126 |
-
* Action for "admin_enqueue_scripts"
|
| 127 |
-
*/
|
| 128 |
-
protected function action_admin_enqueue_scripts()
|
| 129 |
-
{
|
| 130 |
-
wp_enqueue_style( 'font-awesome' );
|
| 131 |
-
wp_enqueue_style( 'wpel-admin-style' );
|
| 132 |
-
wp_enqueue_script( 'wpel-admin-script' );
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
/**
|
| 136 |
-
* Show Admin Page
|
| 137 |
-
*/
|
| 138 |
-
protected function show_network_page()
|
| 139 |
-
{
|
| 140 |
-
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/network-page/main.php' );
|
| 141 |
-
$page = $this->get_option_value( 'own_admin_menu' ) ? 'admin.php' : 'settings.php';
|
| 142 |
-
$page_url = network_admin_url() . $page .'?page='. $this->menu_slug;
|
| 143 |
-
|
| 144 |
-
$template_vars = array(
|
| 145 |
-
'tabs' => $this->tabs,
|
| 146 |
-
'current_tab' => $this->current_tab,
|
| 147 |
-
'page_url' => $page_url,
|
| 148 |
-
'menu_slug' => $this->menu_slug,
|
| 149 |
-
'own_admin_menu' => $this->get_option_value( 'own_admin_menu' ),
|
| 150 |
-
);
|
| 151 |
-
|
| 152 |
-
$this->show_template( $template_file, $template_vars );
|
| 153 |
-
}
|
| 154 |
-
|
| 155 |
-
/**
|
| 156 |
-
* Add help tabs
|
| 157 |
-
*/
|
| 158 |
-
protected function add_help_tabs()
|
| 159 |
-
{
|
| 160 |
-
$screen = get_current_screen();
|
| 161 |
-
|
| 162 |
-
$screen->add_help_tab( array(
|
| 163 |
-
'id' => 'under-construction',
|
| 164 |
-
'title' => __( 'Under Construction', 'wp-external-links' ),
|
| 165 |
-
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 166 |
-
) );
|
| 167 |
-
}
|
| 168 |
-
|
| 169 |
-
/**
|
| 170 |
-
* @param WP_Screen $screen
|
| 171 |
-
* @param array $args
|
| 172 |
-
*/
|
| 173 |
-
protected function show_help_tab( $screen, array $args )
|
| 174 |
-
{
|
| 175 |
-
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/network-page/help-tabs/'. $args[ 'id' ] .'.php' );
|
| 176 |
-
$this->show_template( $template_file );
|
| 177 |
-
}
|
| 178 |
-
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Network_Page
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Network_Page extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
private $menu_slug = 'wpel-network-settings-page';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
private $current_tab = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @var array
|
| 28 |
+
*/
|
| 29 |
+
private $tabs = array();
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Initialize
|
| 33 |
+
*/
|
| 34 |
+
protected function init( array $fields_objects )
|
| 35 |
+
{
|
| 36 |
+
$this->tabs = array(
|
| 37 |
+
'network-settings' => array(
|
| 38 |
+
'title' => __( 'Multi Site Settings', 'wp-external-links' ),
|
| 39 |
+
'icon' => '<i class="fa fa-sitemap" aria-hidden="true"></i>',
|
| 40 |
+
'fields' => $fields_objects[ 'network-settings' ],
|
| 41 |
+
),
|
| 42 |
+
'network-admin-settings' => array(
|
| 43 |
+
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 44 |
+
'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
| 45 |
+
'fields' => $fields_objects[ 'network-admin-settings' ],
|
| 46 |
+
),
|
| 47 |
+
'support' => array(
|
| 48 |
+
'title' => __( 'Support', 'wp-external-links' ),
|
| 49 |
+
'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
|
| 50 |
+
),
|
| 51 |
+
);
|
| 52 |
+
|
| 53 |
+
// get current tab
|
| 54 |
+
$this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
|
| 55 |
+
|
| 56 |
+
// set default tab
|
| 57 |
+
if ( ! key_exists( $this->current_tab, $this->tabs ) ) {
|
| 58 |
+
reset( $this->tabs );
|
| 59 |
+
$this->current_tab = key( $this->tabs );
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Get option value
|
| 65 |
+
* @param string $key
|
| 66 |
+
* @param string $type
|
| 67 |
+
* @return string
|
| 68 |
+
* @triggers E_USER_NOTICE Option value cannot be found
|
| 69 |
+
*/
|
| 70 |
+
public function get_option_value( $key, $type = null )
|
| 71 |
+
{
|
| 72 |
+
if ( null === $type ) {
|
| 73 |
+
foreach ( $this->tabs as $tab_key => $values ) {
|
| 74 |
+
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 75 |
+
continue;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
$option_values = $values[ 'fields' ]->get_option_values();
|
| 79 |
+
|
| 80 |
+
if ( ! isset( $option_values[ $key ] ) ) {
|
| 81 |
+
continue;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
return $option_values[ $key ];
|
| 85 |
+
}
|
| 86 |
+
} else if ( isset( $this->tabs[ $type ][ 'fields' ] ) ) {
|
| 87 |
+
$option_values = $this->tabs[ $type ][ 'fields' ]->get_option_values();
|
| 88 |
+
return $option_values[ $key ];
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
trigger_error( 'Option value "'. $key .'" cannot be found.' );
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/**
|
| 95 |
+
* Action for "network_admin_menu"
|
| 96 |
+
*/
|
| 97 |
+
protected function action_network_admin_menu()
|
| 98 |
+
{
|
| 99 |
+
$own_admin_menu = $this->get_option_value( 'own_admin_menu' );
|
| 100 |
+
|
| 101 |
+
if ( '1' === $own_admin_menu ) {
|
| 102 |
+
$this->page_hook = add_menu_page(
|
| 103 |
+
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 104 |
+
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 105 |
+
, 'manage_network' // capability
|
| 106 |
+
, $this->menu_slug // menu slug
|
| 107 |
+
, $this->get_callback( 'show_network_page' ) // callback
|
| 108 |
+
, 'none' // icon
|
| 109 |
+
, null // position
|
| 110 |
+
);
|
| 111 |
+
} else {
|
| 112 |
+
$this->page_hook = add_submenu_page(
|
| 113 |
+
'settings.php' // parent slug
|
| 114 |
+
, __( 'WP External Links' , 'wp-external-links' ) // page title
|
| 115 |
+
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 116 |
+
, 'manage_options' // capability
|
| 117 |
+
, $this->menu_slug // menu slug
|
| 118 |
+
, $this->get_callback( 'show_network_page' ) // callback
|
| 119 |
+
);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
add_action( 'load-'. $this->page_hook, $this->get_callback( 'add_help_tabs' ) );
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
/**
|
| 126 |
+
* Action for "admin_enqueue_scripts"
|
| 127 |
+
*/
|
| 128 |
+
protected function action_admin_enqueue_scripts()
|
| 129 |
+
{
|
| 130 |
+
wp_enqueue_style( 'font-awesome' );
|
| 131 |
+
wp_enqueue_style( 'wpel-admin-style' );
|
| 132 |
+
wp_enqueue_script( 'wpel-admin-script' );
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
/**
|
| 136 |
+
* Show Admin Page
|
| 137 |
+
*/
|
| 138 |
+
protected function show_network_page()
|
| 139 |
+
{
|
| 140 |
+
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/network-page/main.php' );
|
| 141 |
+
$page = $this->get_option_value( 'own_admin_menu' ) ? 'admin.php' : 'settings.php';
|
| 142 |
+
$page_url = network_admin_url() . $page .'?page='. $this->menu_slug;
|
| 143 |
+
|
| 144 |
+
$template_vars = array(
|
| 145 |
+
'tabs' => $this->tabs,
|
| 146 |
+
'current_tab' => $this->current_tab,
|
| 147 |
+
'page_url' => $page_url,
|
| 148 |
+
'menu_slug' => $this->menu_slug,
|
| 149 |
+
'own_admin_menu' => $this->get_option_value( 'own_admin_menu' ),
|
| 150 |
+
);
|
| 151 |
+
|
| 152 |
+
$this->show_template( $template_file, $template_vars );
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
/**
|
| 156 |
+
* Add help tabs
|
| 157 |
+
*/
|
| 158 |
+
protected function add_help_tabs()
|
| 159 |
+
{
|
| 160 |
+
$screen = get_current_screen();
|
| 161 |
+
|
| 162 |
+
$screen->add_help_tab( array(
|
| 163 |
+
'id' => 'under-construction',
|
| 164 |
+
'title' => __( 'Under Construction', 'wp-external-links' ),
|
| 165 |
+
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 166 |
+
) );
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
/**
|
| 170 |
+
* @param WP_Screen $screen
|
| 171 |
+
* @param array $args
|
| 172 |
+
*/
|
| 173 |
+
protected function show_help_tab( $screen, array $args )
|
| 174 |
+
{
|
| 175 |
+
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/network-page/help-tabs/'. $args[ 'id' ] .'.php' );
|
| 176 |
+
$this->show_template( $template_file );
|
| 177 |
+
}
|
| 178 |
+
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/*?>*/
|
includes/admin/class-wpel-settings-page.php
CHANGED
|
@@ -1,234 +1,234 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Settings_Page
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Settings_Page extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var string
|
| 18 |
-
*/
|
| 19 |
-
private $menu_slug = 'wpel-settings-page';
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @var string
|
| 23 |
-
*/
|
| 24 |
-
private $current_tab = null;
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* @var array
|
| 28 |
-
*/
|
| 29 |
-
private $tabs = array();
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* @var WPEL_Network_Page
|
| 33 |
-
*/
|
| 34 |
-
private $network_page = null;
|
| 35 |
-
|
| 36 |
-
/**
|
| 37 |
-
* Initialize
|
| 38 |
-
*/
|
| 39 |
-
protected function init( $network_page, array $fields_objects )
|
| 40 |
-
{
|
| 41 |
-
$this->network_page = $network_page;
|
| 42 |
-
|
| 43 |
-
$this->tabs = array(
|
| 44 |
-
'external-links' => array(
|
| 45 |
-
'title' => __( 'External Links', 'wp-external-links' ),
|
| 46 |
-
'icon' => '<i class="fa fa-external-link-square" aria-hidden="true"></i>',
|
| 47 |
-
'fields' => $fields_objects[ 'external-links' ],
|
| 48 |
-
),
|
| 49 |
-
'internal-links' => array(
|
| 50 |
-
'title' => __( 'Internal Links', 'wp-external-links' ),
|
| 51 |
-
'icon' => '<i class="fa fa-square-o" aria-hidden="true"></i>',
|
| 52 |
-
'fields' => $fields_objects[ 'internal-links' ],
|
| 53 |
-
),
|
| 54 |
-
'excluded-links' => array(
|
| 55 |
-
'title' => __( 'Excluded Links', 'wp-external-links' ),
|
| 56 |
-
'icon' => '<i class="fa fa-share-square" aria-hidden="true"></i>',
|
| 57 |
-
'fields' => $fields_objects[ 'excluded-links' ],
|
| 58 |
-
),
|
| 59 |
-
'exceptions' => array(
|
| 60 |
-
'title' => __( 'Exceptions', 'wp-external-links' ),
|
| 61 |
-
'icon' => '<i class="fa fa-th-large" aria-hidden="true"></i>',
|
| 62 |
-
'fields' => $fields_objects[ 'exceptions' ],
|
| 63 |
-
),
|
| 64 |
-
'admin' => array(
|
| 65 |
-
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 66 |
-
'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
| 67 |
-
'fields' => $fields_objects[ 'admin' ],
|
| 68 |
-
),
|
| 69 |
-
'support' => array(
|
| 70 |
-
'title' => __( 'Support', 'wp-external-links' ),
|
| 71 |
-
'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
|
| 72 |
-
),
|
| 73 |
-
);
|
| 74 |
-
|
| 75 |
-
// check excluded links tab available
|
| 76 |
-
if ( $this->get_option_value( 'excludes_as_internal_links', 'exceptions' ) ) {
|
| 77 |
-
unset( $this->tabs[ 'excluded-links' ] );
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
// get current tab
|
| 81 |
-
$this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
|
| 82 |
-
|
| 83 |
-
// set default tab
|
| 84 |
-
if ( ! key_exists( $this->current_tab, $this->tabs ) ) {
|
| 85 |
-
reset( $this->tabs );
|
| 86 |
-
$this->current_tab = key( $this->tabs );
|
| 87 |
-
}
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
/**
|
| 91 |
-
* Get option value
|
| 92 |
-
* @param string $key
|
| 93 |
-
* @param string $type
|
| 94 |
-
* @return string
|
| 95 |
-
* @triggers E_USER_NOTICE Option value cannot be found
|
| 96 |
-
*/
|
| 97 |
-
public function get_option_value( $key, $type = null )
|
| 98 |
-
{
|
| 99 |
-
if ( null === $type ) {
|
| 100 |
-
foreach ( $this->tabs as $tab_key => $values ) {
|
| 101 |
-
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 102 |
-
continue;
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
$option_values = $values[ 'fields' ]->get_option_values();
|
| 106 |
-
|
| 107 |
-
if ( ! isset( $option_values[ $key ] ) ) {
|
| 108 |
-
continue;
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
return $option_values[ $key ];
|
| 112 |
-
}
|
| 113 |
-
} else if ( isset( $this->tabs[ $type ][ 'fields' ] ) ) {
|
| 114 |
-
$option_values = $this->tabs[ $type ][ 'fields' ]->get_option_values();
|
| 115 |
-
return $option_values[ $key ];
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
trigger_error( 'Option value "'. $key .'" cannot be found.' );
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
/**
|
| 122 |
-
* Action for "admin_menu"
|
| 123 |
-
*/
|
| 124 |
-
protected function action_admin_menu()
|
| 125 |
-
{
|
| 126 |
-
$capability = $this->network_page->get_option_value( 'capability' );
|
| 127 |
-
|
| 128 |
-
$own_admin_menu = $this->get_option_value( 'own_admin_menu', 'admin' );
|
| 129 |
-
|
| 130 |
-
if ( '1' === $own_admin_menu ) {
|
| 131 |
-
$this->page_hook = add_menu_page(
|
| 132 |
-
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 133 |
-
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 134 |
-
, $capability // capability
|
| 135 |
-
, $this->menu_slug // id
|
| 136 |
-
, $this->get_callback( 'show_admin_page' ) // callback
|
| 137 |
-
, 'none' // icon
|
| 138 |
-
, null // position
|
| 139 |
-
);
|
| 140 |
-
} else {
|
| 141 |
-
$this->page_hook = add_options_page(
|
| 142 |
-
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 143 |
-
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 144 |
-
, $capability // capability
|
| 145 |
-
, $this->menu_slug // id
|
| 146 |
-
, $this->get_callback( 'show_admin_page' ) // callback
|
| 147 |
-
);
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
add_action( 'load-'. $this->page_hook, $this->get_callback( 'add_help_tabs' ) );
|
| 151 |
-
}
|
| 152 |
-
|
| 153 |
-
/**
|
| 154 |
-
* Set default option values for new created sites
|
| 155 |
-
* @param integer $blog_id
|
| 156 |
-
*/
|
| 157 |
-
protected function action_wpmu_new_blog( $blog_id )
|
| 158 |
-
{
|
| 159 |
-
$default_site_id = $this->network_page->get_option_value( 'default_settings_site' );
|
| 160 |
-
|
| 161 |
-
foreach ( $this->tabs as $tab_key => $values ) {
|
| 162 |
-
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 163 |
-
continue;
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
$option_name = $values[ 'fields' ]->get_setting( 'option_name' );
|
| 167 |
-
|
| 168 |
-
$default_option_values = get_blog_option( $default_site_id, $option_name, array() );
|
| 169 |
-
update_blog_option( $blog_id, $option_name, $default_option_values );
|
| 170 |
-
}
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
/**
|
| 174 |
-
* Action for "admin_enqueue_scripts"
|
| 175 |
-
*/
|
| 176 |
-
protected function action_admin_enqueue_scripts()
|
| 177 |
-
{
|
| 178 |
-
wp_enqueue_style( 'font-awesome' );
|
| 179 |
-
wp_enqueue_style( 'wpel-admin-style' );
|
| 180 |
-
wp_enqueue_script( 'wpel-admin-script' );
|
| 181 |
-
}
|
| 182 |
-
|
| 183 |
-
/**
|
| 184 |
-
* Show Admin Page
|
| 185 |
-
*/
|
| 186 |
-
protected function show_admin_page()
|
| 187 |
-
{
|
| 188 |
-
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/settings-page/main.php' );
|
| 189 |
-
$page = $this->get_option_value( 'own_admin_menu' ) ? 'admin.php' : 'options-general.php';
|
| 190 |
-
$page_url = admin_url() . $page .'?page='. $this->menu_slug;
|
| 191 |
-
|
| 192 |
-
$template_vars = array(
|
| 193 |
-
'tabs' => $this->tabs,
|
| 194 |
-
'current_tab' => $this->current_tab,
|
| 195 |
-
'page_url' => $page_url,
|
| 196 |
-
'menu_slug' => $this->menu_slug,
|
| 197 |
-
'own_admin_menu' => $this->get_option_value( 'own_admin_menu', 'admin' ),
|
| 198 |
-
);
|
| 199 |
-
|
| 200 |
-
$this->show_template( $template_file, $template_vars );
|
| 201 |
-
}
|
| 202 |
-
|
| 203 |
-
/**
|
| 204 |
-
* Add help tabs
|
| 205 |
-
*/
|
| 206 |
-
protected function add_help_tabs()
|
| 207 |
-
{
|
| 208 |
-
$screen = get_current_screen();
|
| 209 |
-
|
| 210 |
-
$screen->add_help_tab( array(
|
| 211 |
-
'id' => 'under-construction',
|
| 212 |
-
'title' => __( 'Under Construction', 'wp-external-links' ),
|
| 213 |
-
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 214 |
-
) );
|
| 215 |
-
$screen->add_help_tab( array(
|
| 216 |
-
'id' => 'data-attributes',
|
| 217 |
-
'title' => __( 'Data Attributes', 'wp-external-links' ),
|
| 218 |
-
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 219 |
-
) );
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
/**
|
| 223 |
-
* @param WP_Screen $screen
|
| 224 |
-
* @param array $args
|
| 225 |
-
*/
|
| 226 |
-
protected function show_help_tab( $screen, array $args )
|
| 227 |
-
{
|
| 228 |
-
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/settings-page/help-tabs/'. $args[ 'id' ] .'.php' );
|
| 229 |
-
$this->show_template( $template_file );
|
| 230 |
-
}
|
| 231 |
-
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Settings_Page
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Settings_Page extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
private $menu_slug = 'wpel-settings-page';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
private $current_tab = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @var array
|
| 28 |
+
*/
|
| 29 |
+
private $tabs = array();
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* @var WPEL_Network_Page
|
| 33 |
+
*/
|
| 34 |
+
private $network_page = null;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Initialize
|
| 38 |
+
*/
|
| 39 |
+
protected function init( $network_page, array $fields_objects )
|
| 40 |
+
{
|
| 41 |
+
$this->network_page = $network_page;
|
| 42 |
+
|
| 43 |
+
$this->tabs = array(
|
| 44 |
+
'external-links' => array(
|
| 45 |
+
'title' => __( 'External Links', 'wp-external-links' ),
|
| 46 |
+
'icon' => '<i class="fa fa-external-link-square" aria-hidden="true"></i>',
|
| 47 |
+
'fields' => $fields_objects[ 'external-links' ],
|
| 48 |
+
),
|
| 49 |
+
'internal-links' => array(
|
| 50 |
+
'title' => __( 'Internal Links', 'wp-external-links' ),
|
| 51 |
+
'icon' => '<i class="fa fa-square-o" aria-hidden="true"></i>',
|
| 52 |
+
'fields' => $fields_objects[ 'internal-links' ],
|
| 53 |
+
),
|
| 54 |
+
'excluded-links' => array(
|
| 55 |
+
'title' => __( 'Excluded Links', 'wp-external-links' ),
|
| 56 |
+
'icon' => '<i class="fa fa-share-square" aria-hidden="true"></i>',
|
| 57 |
+
'fields' => $fields_objects[ 'excluded-links' ],
|
| 58 |
+
),
|
| 59 |
+
'exceptions' => array(
|
| 60 |
+
'title' => __( 'Exceptions', 'wp-external-links' ),
|
| 61 |
+
'icon' => '<i class="fa fa-th-large" aria-hidden="true"></i>',
|
| 62 |
+
'fields' => $fields_objects[ 'exceptions' ],
|
| 63 |
+
),
|
| 64 |
+
'admin' => array(
|
| 65 |
+
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 66 |
+
'icon' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
| 67 |
+
'fields' => $fields_objects[ 'admin' ],
|
| 68 |
+
),
|
| 69 |
+
'support' => array(
|
| 70 |
+
'title' => __( 'Support', 'wp-external-links' ),
|
| 71 |
+
'icon' => '<i class="fa fa-question" aria-hidden="true"></i>',
|
| 72 |
+
),
|
| 73 |
+
);
|
| 74 |
+
|
| 75 |
+
// check excluded links tab available
|
| 76 |
+
if ( $this->get_option_value( 'excludes_as_internal_links', 'exceptions' ) ) {
|
| 77 |
+
unset( $this->tabs[ 'excluded-links' ] );
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// get current tab
|
| 81 |
+
$this->current_tab = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_STRING );
|
| 82 |
+
|
| 83 |
+
// set default tab
|
| 84 |
+
if ( ! key_exists( $this->current_tab, $this->tabs ) ) {
|
| 85 |
+
reset( $this->tabs );
|
| 86 |
+
$this->current_tab = key( $this->tabs );
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Get option value
|
| 92 |
+
* @param string $key
|
| 93 |
+
* @param string $type
|
| 94 |
+
* @return string
|
| 95 |
+
* @triggers E_USER_NOTICE Option value cannot be found
|
| 96 |
+
*/
|
| 97 |
+
public function get_option_value( $key, $type = null )
|
| 98 |
+
{
|
| 99 |
+
if ( null === $type ) {
|
| 100 |
+
foreach ( $this->tabs as $tab_key => $values ) {
|
| 101 |
+
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 102 |
+
continue;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
$option_values = $values[ 'fields' ]->get_option_values();
|
| 106 |
+
|
| 107 |
+
if ( ! isset( $option_values[ $key ] ) ) {
|
| 108 |
+
continue;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
return $option_values[ $key ];
|
| 112 |
+
}
|
| 113 |
+
} else if ( isset( $this->tabs[ $type ][ 'fields' ] ) ) {
|
| 114 |
+
$option_values = $this->tabs[ $type ][ 'fields' ]->get_option_values();
|
| 115 |
+
return $option_values[ $key ];
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
trigger_error( 'Option value "'. $key .'" cannot be found.' );
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* Action for "admin_menu"
|
| 123 |
+
*/
|
| 124 |
+
protected function action_admin_menu()
|
| 125 |
+
{
|
| 126 |
+
$capability = $this->network_page->get_option_value( 'capability' );
|
| 127 |
+
|
| 128 |
+
$own_admin_menu = $this->get_option_value( 'own_admin_menu', 'admin' );
|
| 129 |
+
|
| 130 |
+
if ( '1' === $own_admin_menu ) {
|
| 131 |
+
$this->page_hook = add_menu_page(
|
| 132 |
+
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 133 |
+
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 134 |
+
, $capability // capability
|
| 135 |
+
, $this->menu_slug // id
|
| 136 |
+
, $this->get_callback( 'show_admin_page' ) // callback
|
| 137 |
+
, 'none' // icon
|
| 138 |
+
, null // position
|
| 139 |
+
);
|
| 140 |
+
} else {
|
| 141 |
+
$this->page_hook = add_options_page(
|
| 142 |
+
__( 'WP External Links' , 'wp-external-links' ) // page title
|
| 143 |
+
, __( 'External Links' , 'wp-external-links' ) // menu title
|
| 144 |
+
, $capability // capability
|
| 145 |
+
, $this->menu_slug // id
|
| 146 |
+
, $this->get_callback( 'show_admin_page' ) // callback
|
| 147 |
+
);
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
add_action( 'load-'. $this->page_hook, $this->get_callback( 'add_help_tabs' ) );
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
/**
|
| 154 |
+
* Set default option values for new created sites
|
| 155 |
+
* @param integer $blog_id
|
| 156 |
+
*/
|
| 157 |
+
protected function action_wpmu_new_blog( $blog_id )
|
| 158 |
+
{
|
| 159 |
+
$default_site_id = $this->network_page->get_option_value( 'default_settings_site' );
|
| 160 |
+
|
| 161 |
+
foreach ( $this->tabs as $tab_key => $values ) {
|
| 162 |
+
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 163 |
+
continue;
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
$option_name = $values[ 'fields' ]->get_setting( 'option_name' );
|
| 167 |
+
|
| 168 |
+
$default_option_values = get_blog_option( $default_site_id, $option_name, array() );
|
| 169 |
+
update_blog_option( $blog_id, $option_name, $default_option_values );
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
/**
|
| 174 |
+
* Action for "admin_enqueue_scripts"
|
| 175 |
+
*/
|
| 176 |
+
protected function action_admin_enqueue_scripts()
|
| 177 |
+
{
|
| 178 |
+
wp_enqueue_style( 'font-awesome' );
|
| 179 |
+
wp_enqueue_style( 'wpel-admin-style' );
|
| 180 |
+
wp_enqueue_script( 'wpel-admin-script' );
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
/**
|
| 184 |
+
* Show Admin Page
|
| 185 |
+
*/
|
| 186 |
+
protected function show_admin_page()
|
| 187 |
+
{
|
| 188 |
+
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/settings-page/main.php' );
|
| 189 |
+
$page = $this->get_option_value( 'own_admin_menu' ) ? 'admin.php' : 'options-general.php';
|
| 190 |
+
$page_url = admin_url() . $page .'?page='. $this->menu_slug;
|
| 191 |
+
|
| 192 |
+
$template_vars = array(
|
| 193 |
+
'tabs' => $this->tabs,
|
| 194 |
+
'current_tab' => $this->current_tab,
|
| 195 |
+
'page_url' => $page_url,
|
| 196 |
+
'menu_slug' => $this->menu_slug,
|
| 197 |
+
'own_admin_menu' => $this->get_option_value( 'own_admin_menu', 'admin' ),
|
| 198 |
+
);
|
| 199 |
+
|
| 200 |
+
$this->show_template( $template_file, $template_vars );
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
/**
|
| 204 |
+
* Add help tabs
|
| 205 |
+
*/
|
| 206 |
+
protected function add_help_tabs()
|
| 207 |
+
{
|
| 208 |
+
$screen = get_current_screen();
|
| 209 |
+
|
| 210 |
+
$screen->add_help_tab( array(
|
| 211 |
+
'id' => 'under-construction',
|
| 212 |
+
'title' => __( 'Under Construction', 'wp-external-links' ),
|
| 213 |
+
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 214 |
+
) );
|
| 215 |
+
$screen->add_help_tab( array(
|
| 216 |
+
'id' => 'data-attributes',
|
| 217 |
+
'title' => __( 'Data Attributes', 'wp-external-links' ),
|
| 218 |
+
'callback' => $this->get_callback( 'show_help_tab' ),
|
| 219 |
+
) );
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
/**
|
| 223 |
+
* @param WP_Screen $screen
|
| 224 |
+
* @param array $args
|
| 225 |
+
*/
|
| 226 |
+
protected function show_help_tab( $screen, array $args )
|
| 227 |
+
{
|
| 228 |
+
$template_file = WPEL_Plugin::get_plugin_dir( '/templates/settings-page/help-tabs/'. $args[ 'id' ] .'.php' );
|
| 229 |
+
$this->show_template( $template_file );
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/*?>*/
|
includes/admin/network-fields/class-wpel-network-admin-fields.php
CHANGED
|
@@ -1,116 +1,116 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Network_Admin_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Network_Admin_Fields extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$this->set_settings( array(
|
| 22 |
-
'section_id' => 'wpel-network-admin-fields',
|
| 23 |
-
'page_id' => 'wpel-network-admin-fields',
|
| 24 |
-
'option_name' => 'wpel-network-admin-settings',
|
| 25 |
-
'option_group' => 'wpel-network-admin-settings',
|
| 26 |
-
'title' => __( 'Network Admin Settings', 'wp-external-links' ),
|
| 27 |
-
'fields' => array(
|
| 28 |
-
'own_admin_menu' => array(
|
| 29 |
-
'label' => __( 'Main Network Admin Menu:', 'wp-external-links' ),
|
| 30 |
-
'default_value' => '1',
|
| 31 |
-
),
|
| 32 |
-
),
|
| 33 |
-
) );
|
| 34 |
-
|
| 35 |
-
if ( is_network_admin() ) {
|
| 36 |
-
add_action( 'network_admin_edit_'. $this->get_setting( 'option_group' ) , $this->get_callback( 'save_network_settings' ) );
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
parent::init();
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
protected function save_network_settings()
|
| 43 |
-
{
|
| 44 |
-
// when calling 'settings_fields' but we must add the '-options' postfix
|
| 45 |
-
check_admin_referer( $this->get_setting( 'option_group' ) .'-options' );
|
| 46 |
-
|
| 47 |
-
global $new_whitelist_options;
|
| 48 |
-
$option_names = $new_whitelist_options[ $this->get_setting( 'option_group' ) ];
|
| 49 |
-
|
| 50 |
-
foreach ( $option_names as $option_name ) {
|
| 51 |
-
if ( isset( $_POST[ $option_name ] ) ) {
|
| 52 |
-
$post_values = $_POST[ $option_name ];
|
| 53 |
-
$sanitized_values = $this->sanitize( $post_values );
|
| 54 |
-
|
| 55 |
-
update_site_option( $option_name, $sanitized_values );
|
| 56 |
-
} else {
|
| 57 |
-
delete_site_option( $option_name );
|
| 58 |
-
}
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
$redirect_url = filter_input( INPUT_POST, '_wp_http_referer', FILTER_SANITIZE_STRING );
|
| 62 |
-
|
| 63 |
-
wp_redirect( add_query_arg(
|
| 64 |
-
array(
|
| 65 |
-
'page' => 'wpel-network-settings-page',
|
| 66 |
-
'updated' => true
|
| 67 |
-
)
|
| 68 |
-
, $redirect_url
|
| 69 |
-
) );
|
| 70 |
-
|
| 71 |
-
exit;
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
/**
|
| 75 |
-
* Show field methods
|
| 76 |
-
*/
|
| 77 |
-
|
| 78 |
-
protected function show_own_admin_menu( array $args )
|
| 79 |
-
{
|
| 80 |
-
$this->get_html_fields()->check_with_label(
|
| 81 |
-
$args[ 'key' ]
|
| 82 |
-
, __( 'Create own network admin menu for this plugin', 'wp-external-links' )
|
| 83 |
-
, '1'
|
| 84 |
-
, ''
|
| 85 |
-
);
|
| 86 |
-
|
| 87 |
-
echo ' <p class="description">'
|
| 88 |
-
. __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
|
| 89 |
-
.'</p>';
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
/**
|
| 93 |
-
* Validate and sanitize user input before saving to databse
|
| 94 |
-
* @param array $new_values
|
| 95 |
-
* @param array $old_values
|
| 96 |
-
* @return array
|
| 97 |
-
*/
|
| 98 |
-
protected function before_update( array $new_values, array $old_values )
|
| 99 |
-
{
|
| 100 |
-
$update_values = $new_values;
|
| 101 |
-
$is_valid = true;
|
| 102 |
-
|
| 103 |
-
$is_valid = $is_valid && in_array( $new_values[ 'own_admin_menu' ], array( '', '1' ) );
|
| 104 |
-
|
| 105 |
-
if ( false === $is_valid ) {
|
| 106 |
-
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 107 |
-
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 108 |
-
return $old_values;
|
| 109 |
-
}
|
| 110 |
-
|
| 111 |
-
return $update_values;
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Network_Admin_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Network_Admin_Fields extends FWP_Settings_Section_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$this->set_settings( array(
|
| 22 |
+
'section_id' => 'wpel-network-admin-fields',
|
| 23 |
+
'page_id' => 'wpel-network-admin-fields',
|
| 24 |
+
'option_name' => 'wpel-network-admin-settings',
|
| 25 |
+
'option_group' => 'wpel-network-admin-settings',
|
| 26 |
+
'title' => __( 'Network Admin Settings', 'wp-external-links' ),
|
| 27 |
+
'fields' => array(
|
| 28 |
+
'own_admin_menu' => array(
|
| 29 |
+
'label' => __( 'Main Network Admin Menu:', 'wp-external-links' ),
|
| 30 |
+
'default_value' => '1',
|
| 31 |
+
),
|
| 32 |
+
),
|
| 33 |
+
) );
|
| 34 |
+
|
| 35 |
+
if ( is_network_admin() ) {
|
| 36 |
+
add_action( 'network_admin_edit_'. $this->get_setting( 'option_group' ) , $this->get_callback( 'save_network_settings' ) );
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
parent::init();
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
protected function save_network_settings()
|
| 43 |
+
{
|
| 44 |
+
// when calling 'settings_fields' but we must add the '-options' postfix
|
| 45 |
+
check_admin_referer( $this->get_setting( 'option_group' ) .'-options' );
|
| 46 |
+
|
| 47 |
+
global $new_whitelist_options;
|
| 48 |
+
$option_names = $new_whitelist_options[ $this->get_setting( 'option_group' ) ];
|
| 49 |
+
|
| 50 |
+
foreach ( $option_names as $option_name ) {
|
| 51 |
+
if ( isset( $_POST[ $option_name ] ) ) {
|
| 52 |
+
$post_values = $_POST[ $option_name ];
|
| 53 |
+
$sanitized_values = $this->sanitize( $post_values );
|
| 54 |
+
|
| 55 |
+
update_site_option( $option_name, $sanitized_values );
|
| 56 |
+
} else {
|
| 57 |
+
delete_site_option( $option_name );
|
| 58 |
+
}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
$redirect_url = filter_input( INPUT_POST, '_wp_http_referer', FILTER_SANITIZE_STRING );
|
| 62 |
+
|
| 63 |
+
wp_redirect( add_query_arg(
|
| 64 |
+
array(
|
| 65 |
+
'page' => 'wpel-network-settings-page',
|
| 66 |
+
'updated' => true
|
| 67 |
+
)
|
| 68 |
+
, $redirect_url
|
| 69 |
+
) );
|
| 70 |
+
|
| 71 |
+
exit;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Show field methods
|
| 76 |
+
*/
|
| 77 |
+
|
| 78 |
+
protected function show_own_admin_menu( array $args )
|
| 79 |
+
{
|
| 80 |
+
$this->get_html_fields()->check_with_label(
|
| 81 |
+
$args[ 'key' ]
|
| 82 |
+
, __( 'Create own network admin menu for this plugin', 'wp-external-links' )
|
| 83 |
+
, '1'
|
| 84 |
+
, ''
|
| 85 |
+
);
|
| 86 |
+
|
| 87 |
+
echo ' <p class="description">'
|
| 88 |
+
. __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
|
| 89 |
+
.'</p>';
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Validate and sanitize user input before saving to databse
|
| 94 |
+
* @param array $new_values
|
| 95 |
+
* @param array $old_values
|
| 96 |
+
* @return array
|
| 97 |
+
*/
|
| 98 |
+
protected function before_update( array $new_values, array $old_values )
|
| 99 |
+
{
|
| 100 |
+
$update_values = $new_values;
|
| 101 |
+
$is_valid = true;
|
| 102 |
+
|
| 103 |
+
$is_valid = $is_valid && in_array( $new_values[ 'own_admin_menu' ], array( '', '1' ) );
|
| 104 |
+
|
| 105 |
+
if ( false === $is_valid ) {
|
| 106 |
+
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 107 |
+
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 108 |
+
return $old_values;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
return $update_values;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/*?>*/
|
includes/admin/network-fields/class-wpel-network-fields.php
CHANGED
|
@@ -1,132 +1,132 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Network_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Network_Fields extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$this->set_settings( array(
|
| 22 |
-
'section_id' => 'wpel-network-fields',
|
| 23 |
-
'page_id' => 'wpel-network-fields',
|
| 24 |
-
'option_name' => 'wpel-network-settings',
|
| 25 |
-
'option_group' => 'wpel-network-settings',
|
| 26 |
-
'title' => __( 'Multi Site Settings', 'wp-external-links' ),
|
| 27 |
-
'fields' => array(
|
| 28 |
-
'capability' => array(
|
| 29 |
-
'label' => __( 'Capability for individual sites:', 'wp-external-links' ),
|
| 30 |
-
'default_value' => 'manage_options',
|
| 31 |
-
),
|
| 32 |
-
'default_settings_site' => array(
|
| 33 |
-
'label' => __( 'Use the settings of this site as default for new sites:', 'wp-external-links' ),
|
| 34 |
-
'default_value' => '',
|
| 35 |
-
),
|
| 36 |
-
),
|
| 37 |
-
) );
|
| 38 |
-
|
| 39 |
-
if ( is_network_admin() ) {
|
| 40 |
-
add_action( 'network_admin_edit_'. $this->get_setting( 'option_group' ) , $this->get_callback( 'save_network_settings' ) );
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
parent::init();
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
/**
|
| 47 |
-
* Save network settings
|
| 48 |
-
* @global type $new_whitelist_options
|
| 49 |
-
*/
|
| 50 |
-
protected function save_network_settings()
|
| 51 |
-
{
|
| 52 |
-
// when calling 'settings_fields' but we must add the '-options' postfix
|
| 53 |
-
check_admin_referer( $this->get_setting( 'option_group' ) .'-options' );
|
| 54 |
-
|
| 55 |
-
global $new_whitelist_options;
|
| 56 |
-
$option_names = $new_whitelist_options[ $this->get_setting( 'option_group' ) ];
|
| 57 |
-
|
| 58 |
-
foreach ( $option_names as $option_name ) {
|
| 59 |
-
if ( isset( $_POST[ $option_name ] ) ) {
|
| 60 |
-
$post_values = $_POST[ $option_name ];
|
| 61 |
-
$sanitized_values = $this->sanitize( $post_values );
|
| 62 |
-
|
| 63 |
-
update_site_option( $option_name, $sanitized_values );
|
| 64 |
-
} else {
|
| 65 |
-
delete_site_option( $option_name );
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
$redirect_url = filter_input( INPUT_POST, '_wp_http_referer', FILTER_SANITIZE_STRING );
|
| 70 |
-
|
| 71 |
-
wp_redirect( add_query_arg(
|
| 72 |
-
array(
|
| 73 |
-
'page' => $this->get_setting( 'option_group' ) .'-page',
|
| 74 |
-
'updated' => true
|
| 75 |
-
)
|
| 76 |
-
, $redirect_url
|
| 77 |
-
) );
|
| 78 |
-
|
| 79 |
-
exit;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
/**
|
| 83 |
-
* Show field methods
|
| 84 |
-
*/
|
| 85 |
-
|
| 86 |
-
protected function show_capability( array $args )
|
| 87 |
-
{
|
| 88 |
-
$this->get_html_fields()->select(
|
| 89 |
-
$args[ 'key' ]
|
| 90 |
-
, array(
|
| 91 |
-
'manage_options' => __( 'Site Admins and Super Admins', 'wp-external-links' ),
|
| 92 |
-
'manage_network' => __( 'Only Super Admins', 'wp-external-links' ),
|
| 93 |
-
)
|
| 94 |
-
);
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
protected function show_default_settings_site( array $args )
|
| 98 |
-
{
|
| 99 |
-
$sites = wp_get_sites();
|
| 100 |
-
|
| 101 |
-
$values = array();
|
| 102 |
-
$values[ '' ] = __( '- none -', 'wp-external-links' );
|
| 103 |
-
|
| 104 |
-
foreach ( $sites as $site ) {
|
| 105 |
-
$values[ $site[ 'blog_id' ] ] = 'blog_id: '. $site[ 'blog_id' ] .' - '. $site[ 'path' ];
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
$this->get_html_fields()->select(
|
| 109 |
-
$args[ 'key' ]
|
| 110 |
-
, $values
|
| 111 |
-
);
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
/**
|
| 115 |
-
* Validate and sanitize user input before saving to databse
|
| 116 |
-
* @param array $new_values
|
| 117 |
-
* @param array $old_values
|
| 118 |
-
* @return array
|
| 119 |
-
*/
|
| 120 |
-
protected function before_update( array $new_values, array $old_values )
|
| 121 |
-
{
|
| 122 |
-
$update_values = $new_values;
|
| 123 |
-
|
| 124 |
-
$update_values[ 'capability' ] = sanitize_text_field( $new_values[ 'capability' ] );
|
| 125 |
-
$update_values[ 'default_settings_site' ] = sanitize_text_field( $new_values[ 'default_settings_site' ] );
|
| 126 |
-
|
| 127 |
-
return $update_values;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
}
|
| 131 |
-
|
| 132 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Network_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Network_Fields extends FWP_Settings_Section_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$this->set_settings( array(
|
| 22 |
+
'section_id' => 'wpel-network-fields',
|
| 23 |
+
'page_id' => 'wpel-network-fields',
|
| 24 |
+
'option_name' => 'wpel-network-settings',
|
| 25 |
+
'option_group' => 'wpel-network-settings',
|
| 26 |
+
'title' => __( 'Multi Site Settings', 'wp-external-links' ),
|
| 27 |
+
'fields' => array(
|
| 28 |
+
'capability' => array(
|
| 29 |
+
'label' => __( 'Capability for individual sites:', 'wp-external-links' ),
|
| 30 |
+
'default_value' => 'manage_options',
|
| 31 |
+
),
|
| 32 |
+
'default_settings_site' => array(
|
| 33 |
+
'label' => __( 'Use the settings of this site as default for new sites:', 'wp-external-links' ),
|
| 34 |
+
'default_value' => '',
|
| 35 |
+
),
|
| 36 |
+
),
|
| 37 |
+
) );
|
| 38 |
+
|
| 39 |
+
if ( is_network_admin() ) {
|
| 40 |
+
add_action( 'network_admin_edit_'. $this->get_setting( 'option_group' ) , $this->get_callback( 'save_network_settings' ) );
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
parent::init();
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Save network settings
|
| 48 |
+
* @global type $new_whitelist_options
|
| 49 |
+
*/
|
| 50 |
+
protected function save_network_settings()
|
| 51 |
+
{
|
| 52 |
+
// when calling 'settings_fields' but we must add the '-options' postfix
|
| 53 |
+
check_admin_referer( $this->get_setting( 'option_group' ) .'-options' );
|
| 54 |
+
|
| 55 |
+
global $new_whitelist_options;
|
| 56 |
+
$option_names = $new_whitelist_options[ $this->get_setting( 'option_group' ) ];
|
| 57 |
+
|
| 58 |
+
foreach ( $option_names as $option_name ) {
|
| 59 |
+
if ( isset( $_POST[ $option_name ] ) ) {
|
| 60 |
+
$post_values = $_POST[ $option_name ];
|
| 61 |
+
$sanitized_values = $this->sanitize( $post_values );
|
| 62 |
+
|
| 63 |
+
update_site_option( $option_name, $sanitized_values );
|
| 64 |
+
} else {
|
| 65 |
+
delete_site_option( $option_name );
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
$redirect_url = filter_input( INPUT_POST, '_wp_http_referer', FILTER_SANITIZE_STRING );
|
| 70 |
+
|
| 71 |
+
wp_redirect( add_query_arg(
|
| 72 |
+
array(
|
| 73 |
+
'page' => $this->get_setting( 'option_group' ) .'-page',
|
| 74 |
+
'updated' => true
|
| 75 |
+
)
|
| 76 |
+
, $redirect_url
|
| 77 |
+
) );
|
| 78 |
+
|
| 79 |
+
exit;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Show field methods
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
protected function show_capability( array $args )
|
| 87 |
+
{
|
| 88 |
+
$this->get_html_fields()->select(
|
| 89 |
+
$args[ 'key' ]
|
| 90 |
+
, array(
|
| 91 |
+
'manage_options' => __( 'Site Admins and Super Admins', 'wp-external-links' ),
|
| 92 |
+
'manage_network' => __( 'Only Super Admins', 'wp-external-links' ),
|
| 93 |
+
)
|
| 94 |
+
);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
protected function show_default_settings_site( array $args )
|
| 98 |
+
{
|
| 99 |
+
$sites = wp_get_sites();
|
| 100 |
+
|
| 101 |
+
$values = array();
|
| 102 |
+
$values[ '' ] = __( '- none -', 'wp-external-links' );
|
| 103 |
+
|
| 104 |
+
foreach ( $sites as $site ) {
|
| 105 |
+
$values[ $site[ 'blog_id' ] ] = 'blog_id: '. $site[ 'blog_id' ] .' - '. $site[ 'path' ];
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
$this->get_html_fields()->select(
|
| 109 |
+
$args[ 'key' ]
|
| 110 |
+
, $values
|
| 111 |
+
);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* Validate and sanitize user input before saving to databse
|
| 116 |
+
* @param array $new_values
|
| 117 |
+
* @param array $old_values
|
| 118 |
+
* @return array
|
| 119 |
+
*/
|
| 120 |
+
protected function before_update( array $new_values, array $old_values )
|
| 121 |
+
{
|
| 122 |
+
$update_values = $new_values;
|
| 123 |
+
|
| 124 |
+
$update_values[ 'capability' ] = sanitize_text_field( $new_values[ 'capability' ] );
|
| 125 |
+
$update_values[ 'default_settings_site' ] = sanitize_text_field( $new_values[ 'default_settings_site' ] );
|
| 126 |
+
|
| 127 |
+
return $update_values;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-admin-fields.php
CHANGED
|
@@ -1,80 +1,80 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Admin_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Admin_Fields extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$this->set_settings( array(
|
| 22 |
-
'section_id' => 'wpel-admin-fields',
|
| 23 |
-
'page_id' => 'wpel-admin-fields',
|
| 24 |
-
'option_name' => 'wpel-admin-settings',
|
| 25 |
-
'option_group' => 'wpel-admin-settings',
|
| 26 |
-
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 27 |
-
'fields' => array(
|
| 28 |
-
'own_admin_menu' => array(
|
| 29 |
-
'label' => __( 'Main Admin Menu:', 'wp-external-links' ),
|
| 30 |
-
'default_value' => '1',
|
| 31 |
-
),
|
| 32 |
-
),
|
| 33 |
-
) );
|
| 34 |
-
|
| 35 |
-
parent::init();
|
| 36 |
-
}
|
| 37 |
-
|
| 38 |
-
/**
|
| 39 |
-
* Show field methods
|
| 40 |
-
*/
|
| 41 |
-
|
| 42 |
-
protected function show_own_admin_menu( array $args )
|
| 43 |
-
{
|
| 44 |
-
$this->get_html_fields()->check_with_label(
|
| 45 |
-
$args[ 'key' ]
|
| 46 |
-
, __( 'Create own admin menu for this plugin', 'wp-external-links' )
|
| 47 |
-
, '1'
|
| 48 |
-
, ''
|
| 49 |
-
);
|
| 50 |
-
|
| 51 |
-
echo ' <p class="description">'
|
| 52 |
-
. __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
|
| 53 |
-
.'</p>';
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
/**
|
| 57 |
-
* Validate and sanitize user input before saving to databse
|
| 58 |
-
* @param array $new_values
|
| 59 |
-
* @param array $old_values
|
| 60 |
-
* @return array
|
| 61 |
-
*/
|
| 62 |
-
protected function before_update( array $new_values, array $old_values )
|
| 63 |
-
{
|
| 64 |
-
$update_values = $new_values;
|
| 65 |
-
$is_valid = true;
|
| 66 |
-
|
| 67 |
-
$is_valid = $is_valid && in_array( $new_values[ 'own_admin_menu' ], array( '', '1' ) );
|
| 68 |
-
|
| 69 |
-
if ( false === $is_valid ) {
|
| 70 |
-
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 71 |
-
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 72 |
-
return $old_values;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
return $update_values;
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Admin_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Admin_Fields extends FWP_Settings_Section_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$this->set_settings( array(
|
| 22 |
+
'section_id' => 'wpel-admin-fields',
|
| 23 |
+
'page_id' => 'wpel-admin-fields',
|
| 24 |
+
'option_name' => 'wpel-admin-settings',
|
| 25 |
+
'option_group' => 'wpel-admin-settings',
|
| 26 |
+
'title' => __( 'Admin Settings', 'wp-external-links' ),
|
| 27 |
+
'fields' => array(
|
| 28 |
+
'own_admin_menu' => array(
|
| 29 |
+
'label' => __( 'Main Admin Menu:', 'wp-external-links' ),
|
| 30 |
+
'default_value' => '1',
|
| 31 |
+
),
|
| 32 |
+
),
|
| 33 |
+
) );
|
| 34 |
+
|
| 35 |
+
parent::init();
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Show field methods
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
protected function show_own_admin_menu( array $args )
|
| 43 |
+
{
|
| 44 |
+
$this->get_html_fields()->check_with_label(
|
| 45 |
+
$args[ 'key' ]
|
| 46 |
+
, __( 'Create own admin menu for this plugin', 'wp-external-links' )
|
| 47 |
+
, '1'
|
| 48 |
+
, ''
|
| 49 |
+
);
|
| 50 |
+
|
| 51 |
+
echo ' <p class="description">'
|
| 52 |
+
. __( 'Or else it will be added to the "Settings" menu', 'wp-external-links' )
|
| 53 |
+
.'</p>';
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Validate and sanitize user input before saving to databse
|
| 58 |
+
* @param array $new_values
|
| 59 |
+
* @param array $old_values
|
| 60 |
+
* @return array
|
| 61 |
+
*/
|
| 62 |
+
protected function before_update( array $new_values, array $old_values )
|
| 63 |
+
{
|
| 64 |
+
$update_values = $new_values;
|
| 65 |
+
$is_valid = true;
|
| 66 |
+
|
| 67 |
+
$is_valid = $is_valid && in_array( $new_values[ 'own_admin_menu' ], array( '', '1' ) );
|
| 68 |
+
|
| 69 |
+
if ( false === $is_valid ) {
|
| 70 |
+
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 71 |
+
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 72 |
+
return $old_values;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
return $update_values;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-exceptions-fields.php
CHANGED
|
@@ -1,231 +1,231 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Exceptions_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Exceptions_Fields extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$this->set_settings( array(
|
| 22 |
-
'section_id' => 'wpel-exceptions-fields',
|
| 23 |
-
'page_id' => 'wpel-exceptions-fields',
|
| 24 |
-
'option_name' => 'wpel-exceptions-settings',
|
| 25 |
-
'option_group' => 'wpel-exceptions-settings',
|
| 26 |
-
'title' => __( 'Exceptions', 'wp-external-links' ),
|
| 27 |
-
'fields' => array(
|
| 28 |
-
'apply_all' => array(
|
| 29 |
-
'label' => __( 'Apply settings on:', 'wp-external-links' ),
|
| 30 |
-
'class' => 'js-wpel-apply',
|
| 31 |
-
'default_value' => '1',
|
| 32 |
-
),
|
| 33 |
-
'apply_post_content' => array(
|
| 34 |
-
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label ',
|
| 35 |
-
'default_value' => '1',
|
| 36 |
-
),
|
| 37 |
-
'apply_comments' => array(
|
| 38 |
-
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
|
| 39 |
-
'default_value' => '1',
|
| 40 |
-
),
|
| 41 |
-
'apply_widgets' => array(
|
| 42 |
-
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
|
| 43 |
-
'default_value' => '1',
|
| 44 |
-
),
|
| 45 |
-
'subdomains_as_internal_links' => array(
|
| 46 |
-
'label' => __( 'Make subdomains internal:', 'wp-external-links' ),
|
| 47 |
-
),
|
| 48 |
-
'include_urls' => array(
|
| 49 |
-
'label' => __( 'Include external links by URL:', 'wp-external-links' ),
|
| 50 |
-
),
|
| 51 |
-
'exclude_urls' => array(
|
| 52 |
-
'label' => __( 'Exclude external links by URL:', 'wp-external-links' ),
|
| 53 |
-
),
|
| 54 |
-
'excludes_as_internal_links' => array(
|
| 55 |
-
'label' => __( 'Own settings for excluded links:', 'wp-external-links' ),
|
| 56 |
-
),
|
| 57 |
-
'ignore_script_tags' => array(
|
| 58 |
-
'label' => __( 'Skip <code><script></code>:', 'wp-external-links' ),
|
| 59 |
-
'default_value' => '1',
|
| 60 |
-
),
|
| 61 |
-
'ignore_mailto_links' => array(
|
| 62 |
-
'label' => __( 'Skip <code>mailto</code> links:', 'wp-external-links' ),
|
| 63 |
-
'default_value' => '1',
|
| 64 |
-
),
|
| 65 |
-
),
|
| 66 |
-
) );
|
| 67 |
-
|
| 68 |
-
parent::init();
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
/**
|
| 72 |
-
* Show field methods
|
| 73 |
-
*/
|
| 74 |
-
|
| 75 |
-
protected function show_apply_all( array $args )
|
| 76 |
-
{
|
| 77 |
-
$this->get_html_fields()->check_with_label(
|
| 78 |
-
$args[ 'key' ]
|
| 79 |
-
, __( 'All contents (the whole page)', 'wp-external-links' )
|
| 80 |
-
, '1'
|
| 81 |
-
, ''
|
| 82 |
-
);
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
protected function show_apply_post_content( array $args )
|
| 86 |
-
{
|
| 87 |
-
$this->get_html_fields()->check_with_label(
|
| 88 |
-
$args[ 'key' ]
|
| 89 |
-
, __( 'Post content', 'wp-external-links' )
|
| 90 |
-
, '1'
|
| 91 |
-
, ''
|
| 92 |
-
);
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
protected function show_apply_comments( array $args )
|
| 96 |
-
{
|
| 97 |
-
$this->get_html_fields()->check_with_label(
|
| 98 |
-
$args[ 'key' ]
|
| 99 |
-
, __( 'Comments', 'wp-external-links' )
|
| 100 |
-
, '1'
|
| 101 |
-
, ''
|
| 102 |
-
);
|
| 103 |
-
}
|
| 104 |
-
|
| 105 |
-
protected function show_apply_widgets( array $args )
|
| 106 |
-
{
|
| 107 |
-
$this->get_html_fields()->check_with_label(
|
| 108 |
-
$args[ 'key' ]
|
| 109 |
-
, __( 'All widgets', 'wp-external-links' )
|
| 110 |
-
, '1'
|
| 111 |
-
, ''
|
| 112 |
-
);
|
| 113 |
-
}
|
| 114 |
-
|
| 115 |
-
protected function show_subdomains_as_internal_links( array $args )
|
| 116 |
-
{
|
| 117 |
-
$this->get_html_fields()->check_with_label(
|
| 118 |
-
$args[ 'key' ]
|
| 119 |
-
, __( '
|
| 120 |
-
, '1'
|
| 121 |
-
, ''
|
| 122 |
-
);
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
protected function show_include_urls( array $args )
|
| 126 |
-
{
|
| 127 |
-
$this->show_urls_field( $args[ 'key' ] );
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
protected function show_exclude_urls( array $args )
|
| 131 |
-
{
|
| 132 |
-
$this->show_urls_field( $args[ 'key' ] );
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
protected function show_urls_field( $key )
|
| 136 |
-
{
|
| 137 |
-
$this->get_html_fields()->text_area( $key, array(
|
| 138 |
-
'class' => 'large-text',
|
| 139 |
-
'rows' => 4,
|
| 140 |
-
'placeholder' => __( 'For example:'. "\n"
|
| 141 |
-
.'somedomain.org, sub.domain.net/some-slug'. "\n"
|
| 142 |
-
.'http://sub.moredomain.net, http://www.domain.com/other-slug', 'wp-external-links' ),
|
| 143 |
-
) );
|
| 144 |
-
|
| 145 |
-
echo '<p class="description">'
|
| 146 |
-
. __( 'Separate url\'s by comma and/or a line break. '
|
| 147 |
-
.'Write the url\'s as specific as you want them to match.', 'wp-external-links' )
|
| 148 |
-
.'</p>';
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
protected function show_excludes_as_internal_links( array $args )
|
| 152 |
-
{
|
| 153 |
-
echo '<fieldset>';
|
| 154 |
-
|
| 155 |
-
$this->get_html_fields()->radio_with_label(
|
| 156 |
-
$args[ 'key' ]
|
| 157 |
-
, __( 'Treat excluded links as internal links', 'wp-external-links' )
|
| 158 |
-
, '1'
|
| 159 |
-
);
|
| 160 |
-
|
| 161 |
-
echo '<br>';
|
| 162 |
-
|
| 163 |
-
$this->get_html_fields()->radio_with_label(
|
| 164 |
-
$args[ 'key' ]
|
| 165 |
-
, __( 'Own settings for excluded links <span class="description">(extra tab)</span>', 'wp-external-links' )
|
| 166 |
-
, ''
|
| 167 |
-
);
|
| 168 |
-
|
| 169 |
-
echo '</fieldset>';
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
protected function show_ignore_script_tags( array $args )
|
| 173 |
-
{
|
| 174 |
-
$this->get_html_fields()->check_with_label(
|
| 175 |
-
$args[ 'key' ]
|
| 176 |
-
, __( 'Ignore all links in <code><script></code> blocks', 'wp-external-links' )
|
| 177 |
-
, '1'
|
| 178 |
-
, ''
|
| 179 |
-
);
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
protected function show_ignore_mailto_links( array $args )
|
| 183 |
-
{
|
| 184 |
-
$this->get_html_fields()->check_with_label(
|
| 185 |
-
$args[ 'key' ]
|
| 186 |
-
, __( 'Ignore all <code>mailto</code> links', 'wp-external-links' )
|
| 187 |
-
, '1'
|
| 188 |
-
, ''
|
| 189 |
-
);
|
| 190 |
-
}
|
| 191 |
-
|
| 192 |
-
/**
|
| 193 |
-
* Validate and sanitize user input before saving to databse
|
| 194 |
-
* @param array $new_values
|
| 195 |
-
* @param array $old_values
|
| 196 |
-
* @return array
|
| 197 |
-
*/
|
| 198 |
-
protected function before_update( array $new_values, array $old_values )
|
| 199 |
-
{
|
| 200 |
-
$update_values = $new_values;
|
| 201 |
-
$is_valid = true;
|
| 202 |
-
|
| 203 |
-
$is_valid = $is_valid && in_array( $new_values[ 'apply_post_content' ], array( '', '1' ) );
|
| 204 |
-
$is_valid = $is_valid && in_array( $new_values[ 'apply_comments' ], array( '', '1' ) );
|
| 205 |
-
$is_valid = $is_valid && in_array( $new_values[ 'apply_widgets' ], array( '', '1' ) );
|
| 206 |
-
$is_valid = $is_valid && in_array( $new_values[ 'apply_all' ], array( '', '1' ) );
|
| 207 |
-
$is_valid = $is_valid && in_array( $new_values[ 'subdomains_as_internal_links' ], array( '', '1' ) );
|
| 208 |
-
$is_valid = $is_valid && in_array( $new_values[ 'excludes_as_internal_links' ], array( '', '1' ) );
|
| 209 |
-
$is_valid = $is_valid && in_array( $new_values[ 'ignore_script_tags' ], array( '', '1' ) );
|
| 210 |
-
$is_valid = $is_valid && in_array( $new_values[ 'ignore_mailto_links' ], array( '', '1' ) );
|
| 211 |
-
|
| 212 |
-
if ( false === $is_valid ) {
|
| 213 |
-
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 214 |
-
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 215 |
-
return $old_values;
|
| 216 |
-
}
|
| 217 |
-
|
| 218 |
-
if ( '' !== trim( $new_values[ 'include_urls' ] ) ) {
|
| 219 |
-
$update_values[ 'include_urls' ] = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $new_values[ 'include_urls' ] ) ) );
|
| 220 |
-
}
|
| 221 |
-
|
| 222 |
-
if ( '' !== trim( $new_values[ 'exclude_urls' ] ) ) {
|
| 223 |
-
$update_values[ 'exclude_urls' ] = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $new_values[ 'exclude_urls' ] ) ) );
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
return $update_values;
|
| 227 |
-
}
|
| 228 |
-
|
| 229 |
-
}
|
| 230 |
-
|
| 231 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Exceptions_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Exceptions_Fields extends FWP_Settings_Section_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$this->set_settings( array(
|
| 22 |
+
'section_id' => 'wpel-exceptions-fields',
|
| 23 |
+
'page_id' => 'wpel-exceptions-fields',
|
| 24 |
+
'option_name' => 'wpel-exceptions-settings',
|
| 25 |
+
'option_group' => 'wpel-exceptions-settings',
|
| 26 |
+
'title' => __( 'Exceptions', 'wp-external-links' ),
|
| 27 |
+
'fields' => array(
|
| 28 |
+
'apply_all' => array(
|
| 29 |
+
'label' => __( 'Apply settings on:', 'wp-external-links' ),
|
| 30 |
+
'class' => 'js-wpel-apply',
|
| 31 |
+
'default_value' => '1',
|
| 32 |
+
),
|
| 33 |
+
'apply_post_content' => array(
|
| 34 |
+
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label ',
|
| 35 |
+
'default_value' => '1',
|
| 36 |
+
),
|
| 37 |
+
'apply_comments' => array(
|
| 38 |
+
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
|
| 39 |
+
'default_value' => '1',
|
| 40 |
+
),
|
| 41 |
+
'apply_widgets' => array(
|
| 42 |
+
'class' => 'js-wpel-apply-child wpel-hidden wpel-no-label',
|
| 43 |
+
'default_value' => '1',
|
| 44 |
+
),
|
| 45 |
+
'subdomains_as_internal_links' => array(
|
| 46 |
+
'label' => __( 'Make subdomains internal:', 'wp-external-links' ),
|
| 47 |
+
),
|
| 48 |
+
'include_urls' => array(
|
| 49 |
+
'label' => __( 'Include external links by URL:', 'wp-external-links' ),
|
| 50 |
+
),
|
| 51 |
+
'exclude_urls' => array(
|
| 52 |
+
'label' => __( 'Exclude external links by URL:', 'wp-external-links' ),
|
| 53 |
+
),
|
| 54 |
+
'excludes_as_internal_links' => array(
|
| 55 |
+
'label' => __( 'Own settings for excluded links:', 'wp-external-links' ),
|
| 56 |
+
),
|
| 57 |
+
'ignore_script_tags' => array(
|
| 58 |
+
'label' => __( 'Skip <code><script></code>:', 'wp-external-links' ),
|
| 59 |
+
'default_value' => '1',
|
| 60 |
+
),
|
| 61 |
+
'ignore_mailto_links' => array(
|
| 62 |
+
'label' => __( 'Skip <code>mailto</code> links:', 'wp-external-links' ),
|
| 63 |
+
'default_value' => '1',
|
| 64 |
+
),
|
| 65 |
+
),
|
| 66 |
+
) );
|
| 67 |
+
|
| 68 |
+
parent::init();
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Show field methods
|
| 73 |
+
*/
|
| 74 |
+
|
| 75 |
+
protected function show_apply_all( array $args )
|
| 76 |
+
{
|
| 77 |
+
$this->get_html_fields()->check_with_label(
|
| 78 |
+
$args[ 'key' ]
|
| 79 |
+
, __( 'All contents (the whole page)', 'wp-external-links' )
|
| 80 |
+
, '1'
|
| 81 |
+
, ''
|
| 82 |
+
);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
protected function show_apply_post_content( array $args )
|
| 86 |
+
{
|
| 87 |
+
$this->get_html_fields()->check_with_label(
|
| 88 |
+
$args[ 'key' ]
|
| 89 |
+
, __( 'Post content', 'wp-external-links' )
|
| 90 |
+
, '1'
|
| 91 |
+
, ''
|
| 92 |
+
);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
protected function show_apply_comments( array $args )
|
| 96 |
+
{
|
| 97 |
+
$this->get_html_fields()->check_with_label(
|
| 98 |
+
$args[ 'key' ]
|
| 99 |
+
, __( 'Comments', 'wp-external-links' )
|
| 100 |
+
, '1'
|
| 101 |
+
, ''
|
| 102 |
+
);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
protected function show_apply_widgets( array $args )
|
| 106 |
+
{
|
| 107 |
+
$this->get_html_fields()->check_with_label(
|
| 108 |
+
$args[ 'key' ]
|
| 109 |
+
, __( 'All widgets', 'wp-external-links' )
|
| 110 |
+
, '1'
|
| 111 |
+
, ''
|
| 112 |
+
);
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
protected function show_subdomains_as_internal_links( array $args )
|
| 116 |
+
{
|
| 117 |
+
$this->get_html_fields()->check_with_label(
|
| 118 |
+
$args[ 'key' ]
|
| 119 |
+
, __( 'Treat all links to the site\'s domain and subdomains as internal links', 'wp-external-links' )
|
| 120 |
+
, '1'
|
| 121 |
+
, ''
|
| 122 |
+
);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
protected function show_include_urls( array $args )
|
| 126 |
+
{
|
| 127 |
+
$this->show_urls_field( $args[ 'key' ] );
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
protected function show_exclude_urls( array $args )
|
| 131 |
+
{
|
| 132 |
+
$this->show_urls_field( $args[ 'key' ] );
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
protected function show_urls_field( $key )
|
| 136 |
+
{
|
| 137 |
+
$this->get_html_fields()->text_area( $key, array(
|
| 138 |
+
'class' => 'large-text',
|
| 139 |
+
'rows' => 4,
|
| 140 |
+
'placeholder' => __( 'For example:'. "\n"
|
| 141 |
+
.'somedomain.org, sub.domain.net/some-slug'. "\n"
|
| 142 |
+
.'http://sub.moredomain.net, http://www.domain.com/other-slug', 'wp-external-links' ),
|
| 143 |
+
) );
|
| 144 |
+
|
| 145 |
+
echo '<p class="description">'
|
| 146 |
+
. __( 'Separate url\'s by comma and/or a line break. '
|
| 147 |
+
.'Write the url\'s as specific as you want them to match.', 'wp-external-links' )
|
| 148 |
+
.'</p>';
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
protected function show_excludes_as_internal_links( array $args )
|
| 152 |
+
{
|
| 153 |
+
echo '<fieldset>';
|
| 154 |
+
|
| 155 |
+
$this->get_html_fields()->radio_with_label(
|
| 156 |
+
$args[ 'key' ]
|
| 157 |
+
, __( 'Treat excluded links as internal links', 'wp-external-links' )
|
| 158 |
+
, '1'
|
| 159 |
+
);
|
| 160 |
+
|
| 161 |
+
echo '<br>';
|
| 162 |
+
|
| 163 |
+
$this->get_html_fields()->radio_with_label(
|
| 164 |
+
$args[ 'key' ]
|
| 165 |
+
, __( 'Own settings for excluded links <span class="description">(extra tab)</span>', 'wp-external-links' )
|
| 166 |
+
, ''
|
| 167 |
+
);
|
| 168 |
+
|
| 169 |
+
echo '</fieldset>';
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
protected function show_ignore_script_tags( array $args )
|
| 173 |
+
{
|
| 174 |
+
$this->get_html_fields()->check_with_label(
|
| 175 |
+
$args[ 'key' ]
|
| 176 |
+
, __( 'Ignore all links in <code><script></code> blocks', 'wp-external-links' )
|
| 177 |
+
, '1'
|
| 178 |
+
, ''
|
| 179 |
+
);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
protected function show_ignore_mailto_links( array $args )
|
| 183 |
+
{
|
| 184 |
+
$this->get_html_fields()->check_with_label(
|
| 185 |
+
$args[ 'key' ]
|
| 186 |
+
, __( 'Ignore all <code>mailto</code> links', 'wp-external-links' )
|
| 187 |
+
, '1'
|
| 188 |
+
, ''
|
| 189 |
+
);
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
/**
|
| 193 |
+
* Validate and sanitize user input before saving to databse
|
| 194 |
+
* @param array $new_values
|
| 195 |
+
* @param array $old_values
|
| 196 |
+
* @return array
|
| 197 |
+
*/
|
| 198 |
+
protected function before_update( array $new_values, array $old_values )
|
| 199 |
+
{
|
| 200 |
+
$update_values = $new_values;
|
| 201 |
+
$is_valid = true;
|
| 202 |
+
|
| 203 |
+
$is_valid = $is_valid && in_array( $new_values[ 'apply_post_content' ], array( '', '1' ) );
|
| 204 |
+
$is_valid = $is_valid && in_array( $new_values[ 'apply_comments' ], array( '', '1' ) );
|
| 205 |
+
$is_valid = $is_valid && in_array( $new_values[ 'apply_widgets' ], array( '', '1' ) );
|
| 206 |
+
$is_valid = $is_valid && in_array( $new_values[ 'apply_all' ], array( '', '1' ) );
|
| 207 |
+
$is_valid = $is_valid && in_array( $new_values[ 'subdomains_as_internal_links' ], array( '', '1' ) );
|
| 208 |
+
$is_valid = $is_valid && in_array( $new_values[ 'excludes_as_internal_links' ], array( '', '1' ) );
|
| 209 |
+
$is_valid = $is_valid && in_array( $new_values[ 'ignore_script_tags' ], array( '', '1' ) );
|
| 210 |
+
$is_valid = $is_valid && in_array( $new_values[ 'ignore_mailto_links' ], array( '', '1' ) );
|
| 211 |
+
|
| 212 |
+
if ( false === $is_valid ) {
|
| 213 |
+
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 214 |
+
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 215 |
+
return $old_values;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
if ( '' !== trim( $new_values[ 'include_urls' ] ) ) {
|
| 219 |
+
$update_values[ 'include_urls' ] = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $new_values[ 'include_urls' ] ) ) );
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
if ( '' !== trim( $new_values[ 'exclude_urls' ] ) ) {
|
| 223 |
+
$update_values[ 'exclude_urls' ] = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", $new_values[ 'exclude_urls' ] ) ) );
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
return $update_values;
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-excluded-link-fields.php
CHANGED
|
@@ -1,42 +1,42 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Excluded_Link_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Excluded_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$option_name = 'wpel-excluded-link-settings';
|
| 22 |
-
$fields = $this->get_general_fields( $option_name );
|
| 23 |
-
|
| 24 |
-
// change some specific field labels
|
| 25 |
-
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for excluded links:', 'wp-external-links' );
|
| 26 |
-
$fields[ 'target' ][ 'label' ] = __( 'Open excluded links:', 'wp-external-links' );
|
| 27 |
-
|
| 28 |
-
$this->set_settings( array(
|
| 29 |
-
'section_id' => 'wpel-excluded-link-fields',
|
| 30 |
-
'page_id' => 'wpel-excluded-link-fields',
|
| 31 |
-
'option_name' => $option_name,
|
| 32 |
-
'option_group' => $option_name,
|
| 33 |
-
'title' => __( 'Excluded Links', 'wp-external-links' ),
|
| 34 |
-
'fields' => $fields,
|
| 35 |
-
) );
|
| 36 |
-
|
| 37 |
-
parent::init();
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Excluded_Link_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Excluded_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$option_name = 'wpel-excluded-link-settings';
|
| 22 |
+
$fields = $this->get_general_fields( $option_name );
|
| 23 |
+
|
| 24 |
+
// change some specific field labels
|
| 25 |
+
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for excluded links:', 'wp-external-links' );
|
| 26 |
+
$fields[ 'target' ][ 'label' ] = __( 'Open excluded links:', 'wp-external-links' );
|
| 27 |
+
|
| 28 |
+
$this->set_settings( array(
|
| 29 |
+
'section_id' => 'wpel-excluded-link-fields',
|
| 30 |
+
'page_id' => 'wpel-excluded-link-fields',
|
| 31 |
+
'option_name' => $option_name,
|
| 32 |
+
'option_group' => $option_name,
|
| 33 |
+
'title' => __( 'Excluded Links', 'wp-external-links' ),
|
| 34 |
+
'fields' => $fields,
|
| 35 |
+
) );
|
| 36 |
+
|
| 37 |
+
parent::init();
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-external-link-fields.php
CHANGED
|
@@ -1,97 +1,97 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_External_Link_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_External_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$option_name = 'wpel-external-link-settings';
|
| 22 |
-
$fields = $this->get_general_fields( $option_name );
|
| 23 |
-
|
| 24 |
-
// specific field settings
|
| 25 |
-
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for external links:', 'wp-external-links' );
|
| 26 |
-
$fields[ 'apply_settings' ][ 'default_value' ] = '1';
|
| 27 |
-
$fields[ 'target' ][ 'label' ] = __( 'Open external links:', 'wp-external-links' );
|
| 28 |
-
|
| 29 |
-
//
|
| 30 |
-
$index_prev = array_search( 'rel_noreferrer', array_keys( $fields ) );
|
| 31 |
-
$index_insert = $index_prev + 1;
|
| 32 |
-
|
| 33 |
-
$additional_fields = array(
|
| 34 |
-
'rel_external' => array(
|
| 35 |
-
'label' => '',
|
| 36 |
-
'class' => 'wpel-no-label wpel-hidden',
|
| 37 |
-
'default_value' => '1',
|
| 38 |
-
),
|
| 39 |
-
);
|
| 40 |
-
|
| 41 |
-
$fields = array_merge(
|
| 42 |
-
array_slice( $fields, 0, $index_insert )
|
| 43 |
-
, $additional_fields
|
| 44 |
-
, array_slice( $fields, $index_insert )
|
| 45 |
-
);
|
| 46 |
-
|
| 47 |
-
$this->set_settings( array(
|
| 48 |
-
'section_id' => 'wpel-external-link-fields',
|
| 49 |
-
'page_id' => 'wpel-external-link-fields',
|
| 50 |
-
'option_name' => $option_name,
|
| 51 |
-
'option_group' => $option_name,
|
| 52 |
-
'title' => __( 'External Links', 'wp-external-links' ),
|
| 53 |
-
'fields' => $fields,
|
| 54 |
-
) );
|
| 55 |
-
|
| 56 |
-
parent::init();
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
/**
|
| 60 |
-
* Show field methods
|
| 61 |
-
*/
|
| 62 |
-
|
| 63 |
-
protected function show_rel_external( array $args )
|
| 64 |
-
{
|
| 65 |
-
$this->get_html_fields()->check_with_label(
|
| 66 |
-
$args[ 'key' ]
|
| 67 |
-
, __( 'Add <code>"external"</code>', 'wp-external-links' )
|
| 68 |
-
, '1'
|
| 69 |
-
, ''
|
| 70 |
-
);
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
/**
|
| 74 |
-
* Validate and sanitize user input before saving to databse
|
| 75 |
-
* @param array $new_values
|
| 76 |
-
* @param array $old_values
|
| 77 |
-
* @return array
|
| 78 |
-
*/
|
| 79 |
-
protected function before_update( array $new_values, array $old_values )
|
| 80 |
-
{
|
| 81 |
-
$is_valid = true;
|
| 82 |
-
|
| 83 |
-
$is_valid = $is_valid && in_array( $new_values[ 'rel_external' ], array( '', '1' ) );
|
| 84 |
-
|
| 85 |
-
if ( false === $is_valid ) {
|
| 86 |
-
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 87 |
-
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 88 |
-
return $old_values;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
$update_values = parent::before_update( $new_values, $old_values );
|
| 92 |
-
return $update_values;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
}
|
| 96 |
-
|
| 97 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_External_Link_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_External_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$option_name = 'wpel-external-link-settings';
|
| 22 |
+
$fields = $this->get_general_fields( $option_name );
|
| 23 |
+
|
| 24 |
+
// specific field settings
|
| 25 |
+
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for external links:', 'wp-external-links' );
|
| 26 |
+
$fields[ 'apply_settings' ][ 'default_value' ] = '1';
|
| 27 |
+
$fields[ 'target' ][ 'label' ] = __( 'Open external links:', 'wp-external-links' );
|
| 28 |
+
|
| 29 |
+
//
|
| 30 |
+
$index_prev = array_search( 'rel_noreferrer', array_keys( $fields ) );
|
| 31 |
+
$index_insert = $index_prev + 1;
|
| 32 |
+
|
| 33 |
+
$additional_fields = array(
|
| 34 |
+
'rel_external' => array(
|
| 35 |
+
'label' => '',
|
| 36 |
+
'class' => 'wpel-no-label wpel-hidden',
|
| 37 |
+
'default_value' => '1',
|
| 38 |
+
),
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
$fields = array_merge(
|
| 42 |
+
array_slice( $fields, 0, $index_insert )
|
| 43 |
+
, $additional_fields
|
| 44 |
+
, array_slice( $fields, $index_insert )
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
$this->set_settings( array(
|
| 48 |
+
'section_id' => 'wpel-external-link-fields',
|
| 49 |
+
'page_id' => 'wpel-external-link-fields',
|
| 50 |
+
'option_name' => $option_name,
|
| 51 |
+
'option_group' => $option_name,
|
| 52 |
+
'title' => __( 'External Links', 'wp-external-links' ),
|
| 53 |
+
'fields' => $fields,
|
| 54 |
+
) );
|
| 55 |
+
|
| 56 |
+
parent::init();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* Show field methods
|
| 61 |
+
*/
|
| 62 |
+
|
| 63 |
+
protected function show_rel_external( array $args )
|
| 64 |
+
{
|
| 65 |
+
$this->get_html_fields()->check_with_label(
|
| 66 |
+
$args[ 'key' ]
|
| 67 |
+
, __( 'Add <code>"external"</code>', 'wp-external-links' )
|
| 68 |
+
, '1'
|
| 69 |
+
, ''
|
| 70 |
+
);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Validate and sanitize user input before saving to databse
|
| 75 |
+
* @param array $new_values
|
| 76 |
+
* @param array $old_values
|
| 77 |
+
* @return array
|
| 78 |
+
*/
|
| 79 |
+
protected function before_update( array $new_values, array $old_values )
|
| 80 |
+
{
|
| 81 |
+
$is_valid = true;
|
| 82 |
+
|
| 83 |
+
$is_valid = $is_valid && in_array( $new_values[ 'rel_external' ], array( '', '1' ) );
|
| 84 |
+
|
| 85 |
+
if ( false === $is_valid ) {
|
| 86 |
+
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 87 |
+
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 88 |
+
return $old_values;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
$update_values = parent::before_update( $new_values, $old_values );
|
| 92 |
+
return $update_values;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-internal-link-fields.php
CHANGED
|
@@ -1,42 +1,42 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Internal_Link_Fields
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Internal_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$option_name = 'wpel-internal-link-settings';
|
| 22 |
-
$fields = $this->get_general_fields( $option_name );
|
| 23 |
-
|
| 24 |
-
// change some specific field labels
|
| 25 |
-
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for internal links:', 'wp-external-links' );
|
| 26 |
-
$fields[ 'target' ][ 'label' ] = __( 'Open internal links:', 'wp-external-links' );
|
| 27 |
-
|
| 28 |
-
$this->set_settings( array(
|
| 29 |
-
'section_id' => 'wpel-internal-link-fields',
|
| 30 |
-
'page_id' => 'wpel-internal-link-fields',
|
| 31 |
-
'option_name' => $option_name,
|
| 32 |
-
'option_group' => $option_name,
|
| 33 |
-
'title' => __( 'Internal Links', 'wp-external-links' ),
|
| 34 |
-
'fields' => $fields,
|
| 35 |
-
) );
|
| 36 |
-
|
| 37 |
-
parent::init();
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
}
|
| 41 |
-
|
| 42 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Internal_Link_Fields
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Internal_Link_Fields extends WPEL_Link_Fields_Base
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$option_name = 'wpel-internal-link-settings';
|
| 22 |
+
$fields = $this->get_general_fields( $option_name );
|
| 23 |
+
|
| 24 |
+
// change some specific field labels
|
| 25 |
+
$fields[ 'apply_settings' ][ 'label' ] = __( 'Settings for internal links:', 'wp-external-links' );
|
| 26 |
+
$fields[ 'target' ][ 'label' ] = __( 'Open internal links:', 'wp-external-links' );
|
| 27 |
+
|
| 28 |
+
$this->set_settings( array(
|
| 29 |
+
'section_id' => 'wpel-internal-link-fields',
|
| 30 |
+
'page_id' => 'wpel-internal-link-fields',
|
| 31 |
+
'option_name' => $option_name,
|
| 32 |
+
'option_group' => $option_name,
|
| 33 |
+
'title' => __( 'Internal Links', 'wp-external-links' ),
|
| 34 |
+
'fields' => $fields,
|
| 35 |
+
) );
|
| 36 |
+
|
| 37 |
+
parent::init();
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/*?>*/
|
includes/admin/settings-fields/class-wpel-link-fields-base.php
CHANGED
|
@@ -1,322 +1,322 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Link_Fields_Base
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
abstract class WPEL_Link_Fields_Base extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Get general fields
|
| 18 |
-
* @return array
|
| 19 |
-
*/
|
| 20 |
-
final protected function get_general_fields()
|
| 21 |
-
{
|
| 22 |
-
return array(
|
| 23 |
-
'apply_settings' => array(
|
| 24 |
-
'label' => __( 'Settings for links:', 'wp-external-links' ),
|
| 25 |
-
'class' => 'js-apply-settings',
|
| 26 |
-
),
|
| 27 |
-
'target' => array(
|
| 28 |
-
'label' => __( 'Open links:', 'wp-external-links' ),
|
| 29 |
-
'class' => 'wpel-hidden',
|
| 30 |
-
'default_value' => '',
|
| 31 |
-
),
|
| 32 |
-
'target_overwrite' => array(
|
| 33 |
-
'label' => '',
|
| 34 |
-
'class' => 'wpel-no-label wpel-hidden',
|
| 35 |
-
),
|
| 36 |
-
'rel_follow' => array(
|
| 37 |
-
'label' => __( 'Set <code>follow</code> or <code>nofollow</code>:', 'wp-external-links' ),
|
| 38 |
-
'class' => 'wpel-hidden',
|
| 39 |
-
'default_value' => '',
|
| 40 |
-
),
|
| 41 |
-
'rel_follow_overwrite' => array(
|
| 42 |
-
'label' => '',
|
| 43 |
-
'class' => 'wpel-no-label wpel-hidden',
|
| 44 |
-
),
|
| 45 |
-
'rel_noopener' => array(
|
| 46 |
-
'label' => __( 'Also add to <code>rel</code> attribute:', 'wp-external-links' ),
|
| 47 |
-
'class' => 'wpel-hidden',
|
| 48 |
-
'default_value' => '1',
|
| 49 |
-
),
|
| 50 |
-
'rel_noreferrer' => array(
|
| 51 |
-
'label' => '',
|
| 52 |
-
'class' => 'wpel-no-label wpel-hidden',
|
| 53 |
-
'default_value' => '1',
|
| 54 |
-
),
|
| 55 |
-
'title' => array(
|
| 56 |
-
'label' => __( 'Set <code>title</code>:', 'wp-external-links' ),
|
| 57 |
-
'class' => 'wpel-hidden',
|
| 58 |
-
'default_value' => '{title}',
|
| 59 |
-
),
|
| 60 |
-
'class' => array(
|
| 61 |
-
'label' => __( 'Add CSS class(es):', 'wp-external-links' ),
|
| 62 |
-
'class' => 'wpel-hidden',
|
| 63 |
-
),
|
| 64 |
-
'icon_type' => array(
|
| 65 |
-
'label' => __( 'Choose icon type:', 'wp-external-links' ),
|
| 66 |
-
'class' => 'js-icon-type wpel-hidden',
|
| 67 |
-
),
|
| 68 |
-
'icon_image' => array(
|
| 69 |
-
'label' => __( 'Choose icon image:', 'wp-external-links' ),
|
| 70 |
-
'class' => 'js-icon-type-child js-icon-type-image wpel-hidden',
|
| 71 |
-
'default_value' => '1',
|
| 72 |
-
),
|
| 73 |
-
'icon_dashicon' => array(
|
| 74 |
-
'label' => __( 'Choose dashicon:', 'wp-external-links' ),
|
| 75 |
-
'class' => 'js-icon-type-child js-icon-type-dashicon wpel-hidden',
|
| 76 |
-
),
|
| 77 |
-
'icon_fontawesome' => array(
|
| 78 |
-
'label' => __( 'Choose FA icon:', 'wp-external-links' ),
|
| 79 |
-
'class' => 'js-icon-type-child js-icon-type-fontawesome wpel-hidden',
|
| 80 |
-
),
|
| 81 |
-
'icon_position' => array(
|
| 82 |
-
'label' => __( 'Icon position:', 'wp-external-links' ),
|
| 83 |
-
'class' => 'js-icon-type-depend wpel-hidden',
|
| 84 |
-
'default_value' => 'right',
|
| 85 |
-
),
|
| 86 |
-
'no_icon_for_img' => array(
|
| 87 |
-
'label' => __( 'Skip icon with <code><img></code>:', 'wp-external-links' ),
|
| 88 |
-
'class' => 'js-icon-type-depend wpel-hidden',
|
| 89 |
-
'default_value' => '1',
|
| 90 |
-
),
|
| 91 |
-
);
|
| 92 |
-
|
| 93 |
-
parent::init();
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
/**
|
| 97 |
-
* Show field methods
|
| 98 |
-
*/
|
| 99 |
-
|
| 100 |
-
protected function show_apply_settings( array $args )
|
| 101 |
-
{
|
| 102 |
-
$this->get_html_fields()->check_with_label(
|
| 103 |
-
$args[ 'key' ]
|
| 104 |
-
, __( 'Apply these settings', 'wp-external-links' )
|
| 105 |
-
, '1'
|
| 106 |
-
, ''
|
| 107 |
-
);
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
protected function show_target( array $args )
|
| 111 |
-
{
|
| 112 |
-
$this->get_html_fields()->select(
|
| 113 |
-
$args[ 'key' ]
|
| 114 |
-
, array(
|
| 115 |
-
'' => __( '- keep as is -', 'wp-external-links' ),
|
| 116 |
-
'_self' => __( 'in the same window, tab or frame', 'wp-external-links' ),
|
| 117 |
-
'_blank' => __( 'each in a separate new window or tab', 'wp-external-links' ),
|
| 118 |
-
'_new' => __( 'all in the same new window or tab', 'wp-external-links' ),
|
| 119 |
-
'_top' => __( 'in the topmost frame', 'wp-external-links' ),
|
| 120 |
-
)
|
| 121 |
-
);
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
protected function show_target_overwrite( array $args )
|
| 125 |
-
{
|
| 126 |
-
$this->get_html_fields()->check_with_label(
|
| 127 |
-
$args[ 'key' ]
|
| 128 |
-
, __( 'Overwrite existing values.', 'wp-external-links' )
|
| 129 |
-
, '1'
|
| 130 |
-
, ''
|
| 131 |
-
);
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
protected function show_rel_follow( array $args )
|
| 135 |
-
{
|
| 136 |
-
$this->get_html_fields()->select(
|
| 137 |
-
$args[ 'key' ]
|
| 138 |
-
, array(
|
| 139 |
-
'' => __( '- keep as is -', 'wp-external-links' ),
|
| 140 |
-
'follow' => __( 'follow', 'wp-external-links' ),
|
| 141 |
-
'nofollow' => __( 'nofollow', 'wp-external-links' ),
|
| 142 |
-
)
|
| 143 |
-
);
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
protected function show_rel_follow_overwrite( array $args )
|
| 147 |
-
{
|
| 148 |
-
$this->get_html_fields()->check_with_label(
|
| 149 |
-
$args[ 'key' ]
|
| 150 |
-
, __( 'Overwrite existing values.', 'wp-external-links' )
|
| 151 |
-
, '1'
|
| 152 |
-
, ''
|
| 153 |
-
);
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
protected function show_rel_noopener( array $args )
|
| 157 |
-
{
|
| 158 |
-
$this->get_html_fields()->check_with_label(
|
| 159 |
-
$args[ 'key' ]
|
| 160 |
-
, __( 'Add <code>"noopener"</code>', 'wp-external-links' )
|
| 161 |
-
, '1'
|
| 162 |
-
, ''
|
| 163 |
-
);
|
| 164 |
-
}
|
| 165 |
-
|
| 166 |
-
protected function show_rel_noreferrer( array $args )
|
| 167 |
-
{
|
| 168 |
-
$this->get_html_fields()->check_with_label(
|
| 169 |
-
$args[ 'key' ]
|
| 170 |
-
, __( 'Add <code>"noreferrer"</code>', 'wp-external-links' )
|
| 171 |
-
, '1'
|
| 172 |
-
, ''
|
| 173 |
-
);
|
| 174 |
-
}
|
| 175 |
-
|
| 176 |
-
protected function show_title( array $args )
|
| 177 |
-
{
|
| 178 |
-
$this->get_html_fields()->text( $args[ 'key' ], array(
|
| 179 |
-
'class' => 'regular-text',
|
| 180 |
-
) );
|
| 181 |
-
|
| 182 |
-
echo '<p class="description">'
|
| 183 |
-
. __( 'Use this <code>{title}</code> for the original title value '
|
| 184 |
-
.'and <code>{text}</code> for the link text as shown on the page', 'wp-external-links' )
|
| 185 |
-
.'</p>';
|
| 186 |
-
}
|
| 187 |
-
|
| 188 |
-
protected function show_class( array $args )
|
| 189 |
-
{
|
| 190 |
-
$this->get_html_fields()->text( $args[ 'key' ], array(
|
| 191 |
-
'class' => 'regular-text',
|
| 192 |
-
) );
|
| 193 |
-
}
|
| 194 |
-
|
| 195 |
-
protected function show_icon_type( array $args )
|
| 196 |
-
{
|
| 197 |
-
$this->get_html_fields()->select(
|
| 198 |
-
$args[ 'key' ]
|
| 199 |
-
, array(
|
| 200 |
-
'' => __( '- no icon -', 'wp-external-links' ),
|
| 201 |
-
'image' => __( 'Image', 'wp-external-links' ),
|
| 202 |
-
'dashicon' => __( 'Dashicon', 'wp-external-links' ),
|
| 203 |
-
'fontawesome' => __( 'Font Awesome', 'wp-external-links' ),
|
| 204 |
-
)
|
| 205 |
-
);
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
protected function show_icon_image( array $args )
|
| 209 |
-
{
|
| 210 |
-
echo '<fieldset>';
|
| 211 |
-
echo '<div class="wpel-icon-type-image-column">';
|
| 212 |
-
|
| 213 |
-
for ( $x = 1; $x <= 20; $x++ ) {
|
| 214 |
-
echo '<label>';
|
| 215 |
-
echo $this->get_html_fields()->radio( $args[ 'key' ], strval( $x ) );
|
| 216 |
-
echo '<img src="'. plugins_url( '/public/images/wpel-icons/icon-'. esc_attr( $x ) .'.png', WPEL_Plugin::get_plugin_file() ) .'">';
|
| 217 |
-
echo '</label>';
|
| 218 |
-
echo '<br>';
|
| 219 |
-
|
| 220 |
-
if ( $x % 5 === 0 ) {
|
| 221 |
-
echo '</div>';
|
| 222 |
-
echo '<div class="wpel-icon-type-image-column">';
|
| 223 |
-
}
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
echo '</div>';
|
| 227 |
-
echo '</fieldset>';
|
| 228 |
-
}
|
| 229 |
-
|
| 230 |
-
protected function show_icon_dashicon( array $args )
|
| 231 |
-
{
|
| 232 |
-
$dashicons_str = file_get_contents( WPEL_Plugin::get_plugin_dir( '/data/json/dashicons.json' ) );
|
| 233 |
-
$dashicons_json = json_decode( $dashicons_str, true );
|
| 234 |
-
$dashicons = $dashicons_json[ 'icons' ];
|
| 235 |
-
|
| 236 |
-
$options = array();
|
| 237 |
-
foreach ( $dashicons as $icon ) {
|
| 238 |
-
$options[ $icon[ 'className' ] ] = '&#x'. $icon[ 'unicode' ];
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
$this->get_html_fields()->select( $args[ 'key' ], $options, array(
|
| 242 |
-
'style' => 'font-family:dashicons',
|
| 243 |
-
) );
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
-
protected function show_icon_fontawesome( array $args )
|
| 247 |
-
{
|
| 248 |
-
$fa_icons_str = file_get_contents( WPEL_Plugin::get_plugin_dir( '/data/json/fontawesome.json' ) );
|
| 249 |
-
$fa_icons_json = json_decode( $fa_icons_str, true );
|
| 250 |
-
$fa_icons = $fa_icons_json[ 'icons' ];
|
| 251 |
-
|
| 252 |
-
$options = array();
|
| 253 |
-
foreach ( $fa_icons as $icon ) {
|
| 254 |
-
$options[ $icon[ 'className' ] ] = '&#x'. $icon[ 'unicode' ];
|
| 255 |
-
}
|
| 256 |
-
|
| 257 |
-
$this->get_html_fields()->select( $args[ 'key' ], $options, array(
|
| 258 |
-
'style' => 'font-family:FontAwesome',
|
| 259 |
-
) );
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
protected function show_icon_position( array $args )
|
| 263 |
-
{
|
| 264 |
-
$this->get_html_fields()->select(
|
| 265 |
-
$args[ 'key' ]
|
| 266 |
-
, array(
|
| 267 |
-
'left' => __( 'Left side of the link', 'wp-external-links' ),
|
| 268 |
-
'right' => __( 'Right side of the link', 'wp-external-links' ),
|
| 269 |
-
)
|
| 270 |
-
);
|
| 271 |
-
}
|
| 272 |
-
|
| 273 |
-
protected function show_no_icon_for_img( array $args )
|
| 274 |
-
{
|
| 275 |
-
$this->get_html_fields()->check_with_label(
|
| 276 |
-
$args[ 'key' ]
|
| 277 |
-
, __( 'No icon for links already containing an <code><img></code>-tag.', 'wp-external-links' )
|
| 278 |
-
, '1'
|
| 279 |
-
, ''
|
| 280 |
-
);
|
| 281 |
-
}
|
| 282 |
-
|
| 283 |
-
/**
|
| 284 |
-
* Validate and sanitize user input before saving to databse
|
| 285 |
-
* @param array $new_values
|
| 286 |
-
* @param array $old_values
|
| 287 |
-
* @return array
|
| 288 |
-
*/
|
| 289 |
-
protected function before_update( array $new_values, array $old_values )
|
| 290 |
-
{
|
| 291 |
-
$update_values = $new_values;
|
| 292 |
-
$is_valid = true;
|
| 293 |
-
|
| 294 |
-
$is_valid = $is_valid && in_array( $new_values[ 'apply_settings' ], array( '', '1' ) );
|
| 295 |
-
$is_valid = $is_valid && in_array( $new_values[ 'target_overwrite' ], array( '', '1' ) );
|
| 296 |
-
$is_valid = $is_valid && in_array( $new_values[ 'rel_follow_overwrite' ], array( '', '1' ) );
|
| 297 |
-
$is_valid = $is_valid && in_array( $new_values[ 'rel_noopener' ], array( '', '1' ) );
|
| 298 |
-
$is_valid = $is_valid && in_array( $new_values[ 'rel_noreferrer' ], array( '', '1' ) );
|
| 299 |
-
$is_valid = $is_valid && in_array( $new_values[ 'no_icon_for_img' ], array( '', '1' ) );
|
| 300 |
-
|
| 301 |
-
if ( false === $is_valid ) {
|
| 302 |
-
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 303 |
-
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 304 |
-
return $old_values;
|
| 305 |
-
}
|
| 306 |
-
|
| 307 |
-
$update_values[ 'target' ] = sanitize_text_field( $new_values[ 'target' ] );
|
| 308 |
-
$update_values[ 'rel_follow' ] = sanitize_text_field( $new_values[ 'rel_follow' ] );
|
| 309 |
-
$update_values[ 'title' ] = sanitize_text_field( $new_values[ 'title' ] );
|
| 310 |
-
$update_values[ 'class' ] = sanitize_text_field( $new_values[ 'class' ] );
|
| 311 |
-
$update_values[ 'icon_type' ] = sanitize_text_field( $new_values[ 'icon_type' ] );
|
| 312 |
-
$update_values[ 'icon_image' ] = sanitize_text_field( $new_values[ 'icon_image' ] );
|
| 313 |
-
$update_values[ 'icon_dashicon' ] = sanitize_text_field( $new_values[ 'icon_dashicon' ] );
|
| 314 |
-
$update_values[ 'icon_fontawesome' ] = sanitize_text_field( $new_values[ 'icon_fontawesome' ] );
|
| 315 |
-
$update_values[ 'icon_position' ] = sanitize_text_field( $new_values[ 'icon_position' ] );
|
| 316 |
-
|
| 317 |
-
return $update_values;
|
| 318 |
-
}
|
| 319 |
-
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Link_Fields_Base
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
abstract class WPEL_Link_Fields_Base extends FWP_Settings_Section_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Get general fields
|
| 18 |
+
* @return array
|
| 19 |
+
*/
|
| 20 |
+
final protected function get_general_fields()
|
| 21 |
+
{
|
| 22 |
+
return array(
|
| 23 |
+
'apply_settings' => array(
|
| 24 |
+
'label' => __( 'Settings for links:', 'wp-external-links' ),
|
| 25 |
+
'class' => 'js-apply-settings',
|
| 26 |
+
),
|
| 27 |
+
'target' => array(
|
| 28 |
+
'label' => __( 'Open links:', 'wp-external-links' ),
|
| 29 |
+
'class' => 'wpel-hidden',
|
| 30 |
+
'default_value' => '',
|
| 31 |
+
),
|
| 32 |
+
'target_overwrite' => array(
|
| 33 |
+
'label' => '',
|
| 34 |
+
'class' => 'wpel-no-label wpel-hidden',
|
| 35 |
+
),
|
| 36 |
+
'rel_follow' => array(
|
| 37 |
+
'label' => __( 'Set <code>follow</code> or <code>nofollow</code>:', 'wp-external-links' ),
|
| 38 |
+
'class' => 'wpel-hidden',
|
| 39 |
+
'default_value' => '',
|
| 40 |
+
),
|
| 41 |
+
'rel_follow_overwrite' => array(
|
| 42 |
+
'label' => '',
|
| 43 |
+
'class' => 'wpel-no-label wpel-hidden',
|
| 44 |
+
),
|
| 45 |
+
'rel_noopener' => array(
|
| 46 |
+
'label' => __( 'Also add to <code>rel</code> attribute:', 'wp-external-links' ),
|
| 47 |
+
'class' => 'wpel-hidden',
|
| 48 |
+
'default_value' => '1',
|
| 49 |
+
),
|
| 50 |
+
'rel_noreferrer' => array(
|
| 51 |
+
'label' => '',
|
| 52 |
+
'class' => 'wpel-no-label wpel-hidden',
|
| 53 |
+
'default_value' => '1',
|
| 54 |
+
),
|
| 55 |
+
'title' => array(
|
| 56 |
+
'label' => __( 'Set <code>title</code>:', 'wp-external-links' ),
|
| 57 |
+
'class' => 'wpel-hidden',
|
| 58 |
+
'default_value' => '{title}',
|
| 59 |
+
),
|
| 60 |
+
'class' => array(
|
| 61 |
+
'label' => __( 'Add CSS class(es):', 'wp-external-links' ),
|
| 62 |
+
'class' => 'wpel-hidden',
|
| 63 |
+
),
|
| 64 |
+
'icon_type' => array(
|
| 65 |
+
'label' => __( 'Choose icon type:', 'wp-external-links' ),
|
| 66 |
+
'class' => 'js-icon-type wpel-hidden',
|
| 67 |
+
),
|
| 68 |
+
'icon_image' => array(
|
| 69 |
+
'label' => __( 'Choose icon image:', 'wp-external-links' ),
|
| 70 |
+
'class' => 'js-icon-type-child js-icon-type-image wpel-hidden',
|
| 71 |
+
'default_value' => '1',
|
| 72 |
+
),
|
| 73 |
+
'icon_dashicon' => array(
|
| 74 |
+
'label' => __( 'Choose dashicon:', 'wp-external-links' ),
|
| 75 |
+
'class' => 'js-icon-type-child js-icon-type-dashicon wpel-hidden',
|
| 76 |
+
),
|
| 77 |
+
'icon_fontawesome' => array(
|
| 78 |
+
'label' => __( 'Choose FA icon:', 'wp-external-links' ),
|
| 79 |
+
'class' => 'js-icon-type-child js-icon-type-fontawesome wpel-hidden',
|
| 80 |
+
),
|
| 81 |
+
'icon_position' => array(
|
| 82 |
+
'label' => __( 'Icon position:', 'wp-external-links' ),
|
| 83 |
+
'class' => 'js-icon-type-depend wpel-hidden',
|
| 84 |
+
'default_value' => 'right',
|
| 85 |
+
),
|
| 86 |
+
'no_icon_for_img' => array(
|
| 87 |
+
'label' => __( 'Skip icon with <code><img></code>:', 'wp-external-links' ),
|
| 88 |
+
'class' => 'js-icon-type-depend wpel-hidden',
|
| 89 |
+
'default_value' => '1',
|
| 90 |
+
),
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
parent::init();
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Show field methods
|
| 98 |
+
*/
|
| 99 |
+
|
| 100 |
+
protected function show_apply_settings( array $args )
|
| 101 |
+
{
|
| 102 |
+
$this->get_html_fields()->check_with_label(
|
| 103 |
+
$args[ 'key' ]
|
| 104 |
+
, __( 'Apply these settings', 'wp-external-links' )
|
| 105 |
+
, '1'
|
| 106 |
+
, ''
|
| 107 |
+
);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
protected function show_target( array $args )
|
| 111 |
+
{
|
| 112 |
+
$this->get_html_fields()->select(
|
| 113 |
+
$args[ 'key' ]
|
| 114 |
+
, array(
|
| 115 |
+
'' => __( '- keep as is -', 'wp-external-links' ),
|
| 116 |
+
'_self' => __( 'in the same window, tab or frame', 'wp-external-links' ),
|
| 117 |
+
'_blank' => __( 'each in a separate new window or tab', 'wp-external-links' ),
|
| 118 |
+
'_new' => __( 'all in the same new window or tab (NOT recommended)', 'wp-external-links' ),
|
| 119 |
+
'_top' => __( 'in the topmost frame (NOT recommended)', 'wp-external-links' ),
|
| 120 |
+
)
|
| 121 |
+
);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
protected function show_target_overwrite( array $args )
|
| 125 |
+
{
|
| 126 |
+
$this->get_html_fields()->check_with_label(
|
| 127 |
+
$args[ 'key' ]
|
| 128 |
+
, __( 'Overwrite existing values.', 'wp-external-links' )
|
| 129 |
+
, '1'
|
| 130 |
+
, ''
|
| 131 |
+
);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
protected function show_rel_follow( array $args )
|
| 135 |
+
{
|
| 136 |
+
$this->get_html_fields()->select(
|
| 137 |
+
$args[ 'key' ]
|
| 138 |
+
, array(
|
| 139 |
+
'' => __( '- keep as is -', 'wp-external-links' ),
|
| 140 |
+
'follow' => __( 'follow', 'wp-external-links' ),
|
| 141 |
+
'nofollow' => __( 'nofollow', 'wp-external-links' ),
|
| 142 |
+
)
|
| 143 |
+
);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
protected function show_rel_follow_overwrite( array $args )
|
| 147 |
+
{
|
| 148 |
+
$this->get_html_fields()->check_with_label(
|
| 149 |
+
$args[ 'key' ]
|
| 150 |
+
, __( 'Overwrite existing values.', 'wp-external-links' )
|
| 151 |
+
, '1'
|
| 152 |
+
, ''
|
| 153 |
+
);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
protected function show_rel_noopener( array $args )
|
| 157 |
+
{
|
| 158 |
+
$this->get_html_fields()->check_with_label(
|
| 159 |
+
$args[ 'key' ]
|
| 160 |
+
, __( 'Add <code>"noopener"</code>', 'wp-external-links' )
|
| 161 |
+
, '1'
|
| 162 |
+
, ''
|
| 163 |
+
);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
protected function show_rel_noreferrer( array $args )
|
| 167 |
+
{
|
| 168 |
+
$this->get_html_fields()->check_with_label(
|
| 169 |
+
$args[ 'key' ]
|
| 170 |
+
, __( 'Add <code>"noreferrer"</code>', 'wp-external-links' )
|
| 171 |
+
, '1'
|
| 172 |
+
, ''
|
| 173 |
+
);
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
protected function show_title( array $args )
|
| 177 |
+
{
|
| 178 |
+
$this->get_html_fields()->text( $args[ 'key' ], array(
|
| 179 |
+
'class' => 'regular-text',
|
| 180 |
+
) );
|
| 181 |
+
|
| 182 |
+
echo '<p class="description">'
|
| 183 |
+
. __( 'Use this <code>{title}</code> for the original title value '
|
| 184 |
+
.'and <code>{text}</code> for the link text as shown on the page', 'wp-external-links' )
|
| 185 |
+
.'</p>';
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
protected function show_class( array $args )
|
| 189 |
+
{
|
| 190 |
+
$this->get_html_fields()->text( $args[ 'key' ], array(
|
| 191 |
+
'class' => 'regular-text',
|
| 192 |
+
) );
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
protected function show_icon_type( array $args )
|
| 196 |
+
{
|
| 197 |
+
$this->get_html_fields()->select(
|
| 198 |
+
$args[ 'key' ]
|
| 199 |
+
, array(
|
| 200 |
+
'' => __( '- no icon -', 'wp-external-links' ),
|
| 201 |
+
'image' => __( 'Image', 'wp-external-links' ),
|
| 202 |
+
'dashicon' => __( 'Dashicon', 'wp-external-links' ),
|
| 203 |
+
'fontawesome' => __( 'Font Awesome', 'wp-external-links' ),
|
| 204 |
+
)
|
| 205 |
+
);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
protected function show_icon_image( array $args )
|
| 209 |
+
{
|
| 210 |
+
echo '<fieldset>';
|
| 211 |
+
echo '<div class="wpel-icon-type-image-column">';
|
| 212 |
+
|
| 213 |
+
for ( $x = 1; $x <= 20; $x++ ) {
|
| 214 |
+
echo '<label>';
|
| 215 |
+
echo $this->get_html_fields()->radio( $args[ 'key' ], strval( $x ) );
|
| 216 |
+
echo '<img src="'. plugins_url( '/public/images/wpel-icons/icon-'. esc_attr( $x ) .'.png', WPEL_Plugin::get_plugin_file() ) .'">';
|
| 217 |
+
echo '</label>';
|
| 218 |
+
echo '<br>';
|
| 219 |
+
|
| 220 |
+
if ( $x % 5 === 0 ) {
|
| 221 |
+
echo '</div>';
|
| 222 |
+
echo '<div class="wpel-icon-type-image-column">';
|
| 223 |
+
}
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
echo '</div>';
|
| 227 |
+
echo '</fieldset>';
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
protected function show_icon_dashicon( array $args )
|
| 231 |
+
{
|
| 232 |
+
$dashicons_str = file_get_contents( WPEL_Plugin::get_plugin_dir( '/data/json/dashicons.json' ) );
|
| 233 |
+
$dashicons_json = json_decode( $dashicons_str, true );
|
| 234 |
+
$dashicons = $dashicons_json[ 'icons' ];
|
| 235 |
+
|
| 236 |
+
$options = array();
|
| 237 |
+
foreach ( $dashicons as $icon ) {
|
| 238 |
+
$options[ $icon[ 'className' ] ] = '&#x'. $icon[ 'unicode' ];
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
$this->get_html_fields()->select( $args[ 'key' ], $options, array(
|
| 242 |
+
'style' => 'font-family:dashicons',
|
| 243 |
+
) );
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
protected function show_icon_fontawesome( array $args )
|
| 247 |
+
{
|
| 248 |
+
$fa_icons_str = file_get_contents( WPEL_Plugin::get_plugin_dir( '/data/json/fontawesome.json' ) );
|
| 249 |
+
$fa_icons_json = json_decode( $fa_icons_str, true );
|
| 250 |
+
$fa_icons = $fa_icons_json[ 'icons' ];
|
| 251 |
+
|
| 252 |
+
$options = array();
|
| 253 |
+
foreach ( $fa_icons as $icon ) {
|
| 254 |
+
$options[ $icon[ 'className' ] ] = '&#x'. $icon[ 'unicode' ];
|
| 255 |
+
}
|
| 256 |
+
|
| 257 |
+
$this->get_html_fields()->select( $args[ 'key' ], $options, array(
|
| 258 |
+
'style' => 'font-family:FontAwesome',
|
| 259 |
+
) );
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
protected function show_icon_position( array $args )
|
| 263 |
+
{
|
| 264 |
+
$this->get_html_fields()->select(
|
| 265 |
+
$args[ 'key' ]
|
| 266 |
+
, array(
|
| 267 |
+
'left' => __( 'Left side of the link', 'wp-external-links' ),
|
| 268 |
+
'right' => __( 'Right side of the link', 'wp-external-links' ),
|
| 269 |
+
)
|
| 270 |
+
);
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
protected function show_no_icon_for_img( array $args )
|
| 274 |
+
{
|
| 275 |
+
$this->get_html_fields()->check_with_label(
|
| 276 |
+
$args[ 'key' ]
|
| 277 |
+
, __( 'No icon for links already containing an <code><img></code>-tag.', 'wp-external-links' )
|
| 278 |
+
, '1'
|
| 279 |
+
, ''
|
| 280 |
+
);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
/**
|
| 284 |
+
* Validate and sanitize user input before saving to databse
|
| 285 |
+
* @param array $new_values
|
| 286 |
+
* @param array $old_values
|
| 287 |
+
* @return array
|
| 288 |
+
*/
|
| 289 |
+
protected function before_update( array $new_values, array $old_values )
|
| 290 |
+
{
|
| 291 |
+
$update_values = $new_values;
|
| 292 |
+
$is_valid = true;
|
| 293 |
+
|
| 294 |
+
$is_valid = $is_valid && in_array( $new_values[ 'apply_settings' ], array( '', '1' ) );
|
| 295 |
+
$is_valid = $is_valid && in_array( $new_values[ 'target_overwrite' ], array( '', '1' ) );
|
| 296 |
+
$is_valid = $is_valid && in_array( $new_values[ 'rel_follow_overwrite' ], array( '', '1' ) );
|
| 297 |
+
$is_valid = $is_valid && in_array( $new_values[ 'rel_noopener' ], array( '', '1' ) );
|
| 298 |
+
$is_valid = $is_valid && in_array( $new_values[ 'rel_noreferrer' ], array( '', '1' ) );
|
| 299 |
+
$is_valid = $is_valid && in_array( $new_values[ 'no_icon_for_img' ], array( '', '1' ) );
|
| 300 |
+
|
| 301 |
+
if ( false === $is_valid ) {
|
| 302 |
+
// error when user input is not valid conform the UI, probably tried to "hack"
|
| 303 |
+
$this->add_error( __( 'Something went wrong. One or more values were invalid.', 'wp-external-links' ) );
|
| 304 |
+
return $old_values;
|
| 305 |
+
}
|
| 306 |
+
|
| 307 |
+
$update_values[ 'target' ] = sanitize_text_field( $new_values[ 'target' ] );
|
| 308 |
+
$update_values[ 'rel_follow' ] = sanitize_text_field( $new_values[ 'rel_follow' ] );
|
| 309 |
+
$update_values[ 'title' ] = sanitize_text_field( $new_values[ 'title' ] );
|
| 310 |
+
$update_values[ 'class' ] = sanitize_text_field( $new_values[ 'class' ] );
|
| 311 |
+
$update_values[ 'icon_type' ] = sanitize_text_field( $new_values[ 'icon_type' ] );
|
| 312 |
+
$update_values[ 'icon_image' ] = sanitize_text_field( $new_values[ 'icon_image' ] );
|
| 313 |
+
$update_values[ 'icon_dashicon' ] = sanitize_text_field( $new_values[ 'icon_dashicon' ] );
|
| 314 |
+
$update_values[ 'icon_fontawesome' ] = sanitize_text_field( $new_values[ 'icon_fontawesome' ] );
|
| 315 |
+
$update_values[ 'icon_position' ] = sanitize_text_field( $new_values[ 'icon_position' ] );
|
| 316 |
+
|
| 317 |
+
return $update_values;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
}
|
| 321 |
+
|
| 322 |
+
/*?>*/
|
includes/class-wpel-front-ignore.php
CHANGED
|
@@ -1,146 +1,146 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Front_Ignore
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Front_Ignore extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
private $content_placeholders = array();
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @var WPEL_Settings_Page
|
| 23 |
-
*/
|
| 24 |
-
private $settings_page = null;
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* Initialize
|
| 28 |
-
* @param WPEL_Settings_Page $settings_page
|
| 29 |
-
*/
|
| 30 |
-
protected function init( WPEL_Settings_Page $settings_page )
|
| 31 |
-
{
|
| 32 |
-
$this->settings_page = $settings_page;
|
| 33 |
-
}
|
| 34 |
-
|
| 35 |
-
/**
|
| 36 |
-
* Get option value
|
| 37 |
-
* @param string $key
|
| 38 |
-
* @param string|null $type
|
| 39 |
-
* @return string
|
| 40 |
-
* @triggers E_USER_NOTICE Option value cannot be found
|
| 41 |
-
*/
|
| 42 |
-
protected function opt( $key, $type = null )
|
| 43 |
-
{
|
| 44 |
-
return $this->settings_page->get_option_value( $key, $type );
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
/**
|
| 48 |
-
* Action for "wpel_before_apply_link"
|
| 49 |
-
* @param WPEL_Link $link
|
| 50 |
-
*/
|
| 51 |
-
protected function filter_wpel_before_apply_link_10000000000( WPEL_Link $link )
|
| 52 |
-
{
|
| 53 |
-
// ignore mailto links
|
| 54 |
-
if ( $this->opt( 'ignore_mailto_links' ) && $link->is_mailto() ) {
|
| 55 |
-
$link->set_ignore();
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
// ignore WP Admin Bar Links
|
| 59 |
-
if ( $link->has_attr_value( 'class', 'ab-item' ) ) {
|
| 60 |
-
$link->set_ignore();
|
| 61 |
-
}
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
/**
|
| 65 |
-
* Filter for "_wpel_before_filter"
|
| 66 |
-
* @param string $content
|
| 67 |
-
* @return string
|
| 68 |
-
*/
|
| 69 |
-
protected function filter__wpel_before_filter_10000000000( $content )
|
| 70 |
-
{
|
| 71 |
-
$ignore_tags = array( 'head' );
|
| 72 |
-
|
| 73 |
-
if ( $this->opt( 'ignore_script_tags' ) ) {
|
| 74 |
-
$ignore_tags[] = 'script';
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
foreach ( $ignore_tags as $tag_name ) {
|
| 78 |
-
$content = preg_replace_callback(
|
| 79 |
-
$this->get_tag_regexp( $tag_name )
|
| 80 |
-
, $this->get_callback( 'skip_tag' )
|
| 81 |
-
, $content
|
| 82 |
-
);
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
return $content;
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
/**
|
| 89 |
-
* Filter for "_wpel_after_filter"
|
| 90 |
-
* @param string $content
|
| 91 |
-
* @return string
|
| 92 |
-
*/
|
| 93 |
-
protected function filter__wpel_after_filter_10000000000( $content )
|
| 94 |
-
{
|
| 95 |
-
return $this->restore_content_placeholders( $content );
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
/**
|
| 99 |
-
* @param type $tag_name
|
| 100 |
-
* @return type
|
| 101 |
-
*/
|
| 102 |
-
protected function get_tag_regexp( $tag_name )
|
| 103 |
-
{
|
| 104 |
-
return '/<'. $tag_name .'[\s.*>|>](.*?)<\/'. $tag_name .'[\s+]*>/is';
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
/**
|
| 108 |
-
* Pregmatch callback
|
| 109 |
-
* @param array $matches
|
| 110 |
-
* @return string
|
| 111 |
-
*/
|
| 112 |
-
protected function skip_tag( $matches )
|
| 113 |
-
{
|
| 114 |
-
$skip_content = $matches[ 0 ];
|
| 115 |
-
return $this->get_placeholder( $skip_content );
|
| 116 |
-
}
|
| 117 |
-
|
| 118 |
-
/**
|
| 119 |
-
* Return placeholder text for given content
|
| 120 |
-
* @param string $placeholding_content
|
| 121 |
-
* @return string
|
| 122 |
-
*/
|
| 123 |
-
protected function get_placeholder( $placeholding_content )
|
| 124 |
-
{
|
| 125 |
-
$placeholder = '<!--- WPEL PLACEHOLDER '. count( $this->content_placeholders ) .' --->';
|
| 126 |
-
$this->content_placeholders[ $placeholder ] = $placeholding_content;
|
| 127 |
-
return $placeholder;
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
/**
|
| 131 |
-
* Restore placeholders with original content
|
| 132 |
-
* @param string $content
|
| 133 |
-
* @return string
|
| 134 |
-
*/
|
| 135 |
-
protected function restore_content_placeholders( $content )
|
| 136 |
-
{
|
| 137 |
-
foreach ( $this->content_placeholders as $placeholder => $placeholding_content ) {
|
| 138 |
-
$content = str_replace( $placeholder, $placeholding_content, $content );
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
return $content;
|
| 142 |
-
}
|
| 143 |
-
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Front_Ignore
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Front_Ignore extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var array
|
| 18 |
+
*/
|
| 19 |
+
private $content_placeholders = array();
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var WPEL_Settings_Page
|
| 23 |
+
*/
|
| 24 |
+
private $settings_page = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Initialize
|
| 28 |
+
* @param WPEL_Settings_Page $settings_page
|
| 29 |
+
*/
|
| 30 |
+
protected function init( WPEL_Settings_Page $settings_page )
|
| 31 |
+
{
|
| 32 |
+
$this->settings_page = $settings_page;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* Get option value
|
| 37 |
+
* @param string $key
|
| 38 |
+
* @param string|null $type
|
| 39 |
+
* @return string
|
| 40 |
+
* @triggers E_USER_NOTICE Option value cannot be found
|
| 41 |
+
*/
|
| 42 |
+
protected function opt( $key, $type = null )
|
| 43 |
+
{
|
| 44 |
+
return $this->settings_page->get_option_value( $key, $type );
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Action for "wpel_before_apply_link"
|
| 49 |
+
* @param WPEL_Link $link
|
| 50 |
+
*/
|
| 51 |
+
protected function filter_wpel_before_apply_link_10000000000( WPEL_Link $link )
|
| 52 |
+
{
|
| 53 |
+
// ignore mailto links
|
| 54 |
+
if ( $this->opt( 'ignore_mailto_links' ) && $link->is_mailto() ) {
|
| 55 |
+
$link->set_ignore();
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
// ignore WP Admin Bar Links
|
| 59 |
+
if ( $link->has_attr_value( 'class', 'ab-item' ) ) {
|
| 60 |
+
$link->set_ignore();
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Filter for "_wpel_before_filter"
|
| 66 |
+
* @param string $content
|
| 67 |
+
* @return string
|
| 68 |
+
*/
|
| 69 |
+
protected function filter__wpel_before_filter_10000000000( $content )
|
| 70 |
+
{
|
| 71 |
+
$ignore_tags = array( 'head' );
|
| 72 |
+
|
| 73 |
+
if ( $this->opt( 'ignore_script_tags' ) ) {
|
| 74 |
+
$ignore_tags[] = 'script';
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
foreach ( $ignore_tags as $tag_name ) {
|
| 78 |
+
$content = preg_replace_callback(
|
| 79 |
+
$this->get_tag_regexp( $tag_name )
|
| 80 |
+
, $this->get_callback( 'skip_tag' )
|
| 81 |
+
, $content
|
| 82 |
+
);
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
return $content;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Filter for "_wpel_after_filter"
|
| 90 |
+
* @param string $content
|
| 91 |
+
* @return string
|
| 92 |
+
*/
|
| 93 |
+
protected function filter__wpel_after_filter_10000000000( $content )
|
| 94 |
+
{
|
| 95 |
+
return $this->restore_content_placeholders( $content );
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/**
|
| 99 |
+
* @param type $tag_name
|
| 100 |
+
* @return type
|
| 101 |
+
*/
|
| 102 |
+
protected function get_tag_regexp( $tag_name )
|
| 103 |
+
{
|
| 104 |
+
return '/<'. $tag_name .'[\s.*>|>](.*?)<\/'. $tag_name .'[\s+]*>/is';
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Pregmatch callback
|
| 109 |
+
* @param array $matches
|
| 110 |
+
* @return string
|
| 111 |
+
*/
|
| 112 |
+
protected function skip_tag( $matches )
|
| 113 |
+
{
|
| 114 |
+
$skip_content = $matches[ 0 ];
|
| 115 |
+
return $this->get_placeholder( $skip_content );
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* Return placeholder text for given content
|
| 120 |
+
* @param string $placeholding_content
|
| 121 |
+
* @return string
|
| 122 |
+
*/
|
| 123 |
+
protected function get_placeholder( $placeholding_content )
|
| 124 |
+
{
|
| 125 |
+
$placeholder = '<!--- WPEL PLACEHOLDER '. count( $this->content_placeholders ) .' --->';
|
| 126 |
+
$this->content_placeholders[ $placeholder ] = $placeholding_content;
|
| 127 |
+
return $placeholder;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
/**
|
| 131 |
+
* Restore placeholders with original content
|
| 132 |
+
* @param string $content
|
| 133 |
+
* @return string
|
| 134 |
+
*/
|
| 135 |
+
protected function restore_content_placeholders( $content )
|
| 136 |
+
{
|
| 137 |
+
foreach ( $this->content_placeholders as $placeholder => $placeholding_content ) {
|
| 138 |
+
$content = str_replace( $placeholder, $placeholding_content, $content );
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
return $content;
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/*?>*/
|
includes/class-wpel-front.php
CHANGED
|
@@ -1,422 +1,444 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Front
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Front extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var WPEL_Settings_Page
|
| 18 |
-
*/
|
| 19 |
-
private $settings_page = null;
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* Initialize
|
| 23 |
-
* @param WPEL_Settings_Page $settings_page
|
| 24 |
-
*/
|
| 25 |
-
protected function init( WPEL_Settings_Page $settings_page )
|
| 26 |
-
{
|
| 27 |
-
$this->settings_page = $settings_page;
|
| 28 |
-
|
| 29 |
-
//
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
}
|
| 64 |
-
|
| 65 |
-
/**
|
| 66 |
-
*
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
-
/**
|
| 87 |
-
*
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
*
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
$
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
*
|
| 145 |
-
* @param
|
| 146 |
-
* @return string
|
| 147 |
-
*/
|
| 148 |
-
protected function
|
| 149 |
-
{
|
| 150 |
-
$
|
| 151 |
-
$
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
}
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
$
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
$
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
if ( '' ===
|
| 314 |
-
$
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
'
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Front
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Front extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var WPEL_Settings_Page
|
| 18 |
+
*/
|
| 19 |
+
private $settings_page = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Initialize
|
| 23 |
+
* @param WPEL_Settings_Page $settings_page
|
| 24 |
+
*/
|
| 25 |
+
protected function init( WPEL_Settings_Page $settings_page )
|
| 26 |
+
{
|
| 27 |
+
$this->settings_page = $settings_page;
|
| 28 |
+
|
| 29 |
+
// load front ignore
|
| 30 |
+
WPEL_Front_Ignore::create( $settings_page );
|
| 31 |
+
|
| 32 |
+
// load template tags
|
| 33 |
+
WPEL_Template_Tags::create( $this );
|
| 34 |
+
|
| 35 |
+
// apply page sections
|
| 36 |
+
if ( $this->opt( 'apply_all' ) ) {
|
| 37 |
+
// create final_output filterhook
|
| 38 |
+
FWP_Final_Output_1x0x0::create();
|
| 39 |
+
|
| 40 |
+
add_action( 'final_output', $this->get_callback( 'scan' ), 10000000000 );
|
| 41 |
+
} else {
|
| 42 |
+
$filter_hooks = array();
|
| 43 |
+
|
| 44 |
+
if ( $this->opt( 'apply_post_content' ) ) {
|
| 45 |
+
array_push( $filter_hooks, 'the_title', 'the_content', 'the_excerpt', 'get_the_excerpt' );
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
if ( $this->opt( 'apply_comments' ) ) {
|
| 49 |
+
array_push( $filter_hooks, 'comment_text', 'comment_excerpt' );
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
if ( $this->opt( 'apply_widgets' ) ) {
|
| 53 |
+
// create widget_output filterhook
|
| 54 |
+
FWP_Widget_Output_1x0x0::create();
|
| 55 |
+
|
| 56 |
+
array_push( $filter_hooks, 'widget_output' );
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
foreach ( $filter_hooks as $hook ) {
|
| 60 |
+
add_filter( $hook, $this->get_callback( 'scan' ), 10000000000 );
|
| 61 |
+
}
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* Turn off output buffer for REST API calls
|
| 67 |
+
* @param type $wp_rest_server
|
| 68 |
+
*/
|
| 69 |
+
protected function action_rest_api_init()
|
| 70 |
+
{
|
| 71 |
+
ob_end_clean();
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Get option value
|
| 76 |
+
* @param string $key
|
| 77 |
+
* @param string|null $type
|
| 78 |
+
* @return string
|
| 79 |
+
* @triggers E_USER_NOTICE Option value cannot be found
|
| 80 |
+
*/
|
| 81 |
+
protected function opt( $key, $type = null )
|
| 82 |
+
{
|
| 83 |
+
return $this->settings_page->get_option_value( $key, $type );
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Action for "wp_enqueue_scripts"
|
| 88 |
+
*/
|
| 89 |
+
protected function action_wp_enqueue_scripts()
|
| 90 |
+
{
|
| 91 |
+
$icon_type_int = $this->opt( 'icon_type', 'internal-links' );
|
| 92 |
+
$icon_type_ext = $this->opt( 'icon_type', 'external-links' );
|
| 93 |
+
|
| 94 |
+
if ( 'dashicon' === $icon_type_int || 'dashicon' === $icon_type_ext ) {
|
| 95 |
+
wp_enqueue_style( 'dashicons' );
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
if ( 'fontawesome' === $icon_type_int || 'fontawesome' === $icon_type_ext ) {
|
| 99 |
+
wp_enqueue_style( 'font-awesome' );
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
if ( $this->opt( 'icon_type', 'external-links' ) || $this->opt( 'icon_type', 'internal-links' ) ) {
|
| 103 |
+
wp_enqueue_style( 'wpel-style' );
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Scan content for links
|
| 109 |
+
* @param string $content
|
| 110 |
+
* @return string
|
| 111 |
+
*/
|
| 112 |
+
public function scan( $content )
|
| 113 |
+
{
|
| 114 |
+
/**
|
| 115 |
+
* Filter whether the plugin settings will be applied on links
|
| 116 |
+
* @param boolean $apply_settings
|
| 117 |
+
*/
|
| 118 |
+
$apply_settings = apply_filters( 'wpel_apply_settings', true );
|
| 119 |
+
|
| 120 |
+
if ( false === $apply_settings ) {
|
| 121 |
+
return $content;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
/**
|
| 125 |
+
* Filters before scanning content (for internal use)
|
| 126 |
+
* @param string $content
|
| 127 |
+
*/
|
| 128 |
+
$content = apply_filters( '_wpel_before_filter', $content );
|
| 129 |
+
|
| 130 |
+
$regexp_link = '/<a[^A-Za-z](.*?)>(.*?)<\/a[\s+]*>/is';
|
| 131 |
+
|
| 132 |
+
$content = preg_replace_callback( $regexp_link, $this->get_callback( 'match_link' ), $content );
|
| 133 |
+
|
| 134 |
+
/**
|
| 135 |
+
* Filters after scanning content (for internal use)
|
| 136 |
+
* @param string $content
|
| 137 |
+
*/
|
| 138 |
+
$content = apply_filters( '_wpel_after_filter', $content );
|
| 139 |
+
|
| 140 |
+
return $content;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
/**
|
| 144 |
+
* Pregmatch callback for handling link
|
| 145 |
+
* @param array $matches [ 0 ] => link, [ 1 ] => atts_string, [ 2 ] => label
|
| 146 |
+
* @return string
|
| 147 |
+
*/
|
| 148 |
+
protected function match_link( $matches )
|
| 149 |
+
{
|
| 150 |
+
$original_link = $matches[ 0 ];
|
| 151 |
+
$atts = $matches[ 1 ];
|
| 152 |
+
$label = $matches[ 2 ];
|
| 153 |
+
|
| 154 |
+
$created_link = $this->get_created_link( $label, $atts );
|
| 155 |
+
|
| 156 |
+
if ( false === $created_link ) {
|
| 157 |
+
return $original_link;
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
return $created_link;
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Create html link
|
| 165 |
+
* @param string $label
|
| 166 |
+
* @param string $atts
|
| 167 |
+
* @return string
|
| 168 |
+
*/
|
| 169 |
+
protected function get_created_link( $label, $atts )
|
| 170 |
+
{
|
| 171 |
+
$link = new WPEL_Link( 'a', $label );
|
| 172 |
+
$link->set_atts( $atts );
|
| 173 |
+
|
| 174 |
+
/**
|
| 175 |
+
* Action triggered before link settings will be applied
|
| 176 |
+
* @param WPEL_Link $link
|
| 177 |
+
* @return void
|
| 178 |
+
*/
|
| 179 |
+
do_action( 'wpel_before_apply_link', $link );
|
| 180 |
+
|
| 181 |
+
// has ignore flag
|
| 182 |
+
if ( $link->is_ignore() ) {
|
| 183 |
+
return false;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
$this->set_link( $link );
|
| 187 |
+
|
| 188 |
+
return $link->get_html( false );
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
/**
|
| 192 |
+
* Set link
|
| 193 |
+
* @param WPEL_Link $link
|
| 194 |
+
*/
|
| 195 |
+
protected function set_link( WPEL_Link $link )
|
| 196 |
+
{
|
| 197 |
+
$url = $link->get_attr( 'href' );
|
| 198 |
+
|
| 199 |
+
$excludes_as_internal_links = $this->opt( 'excludes_as_internal_links' );
|
| 200 |
+
|
| 201 |
+
// internal, external or excluded
|
| 202 |
+
$is_excluded = $link->is_exclude() || $this->is_excluded_url( $url );
|
| 203 |
+
$is_internal = $link->is_internal() || ( $this->is_internal_url( $url ) && ! $this->is_included_url( $url ) ) || ( $is_excluded && $excludes_as_internal_links );
|
| 204 |
+
$is_external = $link->is_external() || ( ! $is_internal && ! $is_excluded );
|
| 205 |
+
|
| 206 |
+
if ( $is_external ) {
|
| 207 |
+
$link->set_external();
|
| 208 |
+
$this->apply_link_settings( $link, 'external-links' );
|
| 209 |
+
} else if ( $is_internal ) {
|
| 210 |
+
$link->set_internal();
|
| 211 |
+
$this->apply_link_settings( $link, 'internal-links' );
|
| 212 |
+
} else if ( $is_excluded ) {
|
| 213 |
+
$link->set_exclude();
|
| 214 |
+
$this->apply_link_settings( $link, 'excluded-links' );
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* Action for changing link object
|
| 219 |
+
* @param WPEL_Link $link
|
| 220 |
+
* @return void
|
| 221 |
+
*/
|
| 222 |
+
do_action( 'wpel_link', $link );
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
/**
|
| 226 |
+
* @param WPEL_Link $link
|
| 227 |
+
* @param string $type
|
| 228 |
+
*/
|
| 229 |
+
protected function apply_link_settings( WPEL_Link $link, $type )
|
| 230 |
+
{
|
| 231 |
+
if ( ! $this->opt( 'apply_settings', $type ) ) {
|
| 232 |
+
return;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
// set target
|
| 236 |
+
$target = $this->opt( 'target', $type );
|
| 237 |
+
$target_overwrite = $this->opt( 'target_overwrite', $type );
|
| 238 |
+
$has_target = $link->has_attr( 'target' );
|
| 239 |
+
|
| 240 |
+
if ( $target && ( ! $has_target || $target_overwrite ) ) {
|
| 241 |
+
$link->set_attr( 'target', $target );
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
// add "follow" / "nofollow"
|
| 245 |
+
$follow = $this->opt( 'rel_follow', $type );
|
| 246 |
+
$follow_overwrite = $this->opt( 'rel_follow_overwrite', $type );
|
| 247 |
+
$has_follow = $link->has_attr_value( 'rel', 'follow' ) || $link->has_attr_value( 'rel', 'nofollow' );
|
| 248 |
+
|
| 249 |
+
if ( $follow && ( ! $has_follow || $follow_overwrite ) ) {
|
| 250 |
+
if ( $has_follow ) {
|
| 251 |
+
$link->remove_from_attr( 'rel', 'follow' );
|
| 252 |
+
$link->remove_from_attr( 'rel', 'nofollow' );
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
+
$link->add_to_attr( 'rel', $follow );
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
// add "external"
|
| 259 |
+
if ( 'external-links' === $type && $this->opt( 'rel_external', $type ) ) {
|
| 260 |
+
$link->add_to_attr( 'rel', 'external' );
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
// add "noopener"
|
| 264 |
+
if ( $this->opt( 'rel_noopener', $type ) ) {
|
| 265 |
+
$link->add_to_attr( 'rel', 'noopener' );
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
// add "noreferrer"
|
| 269 |
+
if ( $this->opt( 'rel_noreferrer', $type ) ) {
|
| 270 |
+
$link->add_to_attr( 'rel', 'noreferrer' );
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
// set title
|
| 274 |
+
$title_format = $this->opt( 'title', $type );
|
| 275 |
+
|
| 276 |
+
if ( $title_format ) {
|
| 277 |
+
$title = $link->get_attr( 'title' );
|
| 278 |
+
$text = $link->get_content();
|
| 279 |
+
$new_title = str_replace( array( '{title}', '{text}' ), array( esc_attr( $title ), esc_attr( $text ) ), $title_format );
|
| 280 |
+
|
| 281 |
+
if ( $new_title ) {
|
| 282 |
+
$link->set_attr( 'title', $new_title );
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
// add classes
|
| 287 |
+
$class = $this->opt( 'class', $type );
|
| 288 |
+
|
| 289 |
+
if ( $class ) {
|
| 290 |
+
$link->add_to_attr( 'class', $class );
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// add icon
|
| 294 |
+
$icon_type = $this->opt( 'icon_type', $type );
|
| 295 |
+
$no_icon_for_img = $this->opt( 'no_icon_for_img', $type );
|
| 296 |
+
$has_img = preg_match( '/<img([^>]*)>/is', $link->get_content() );
|
| 297 |
+
|
| 298 |
+
if ( $icon_type && ! ( $has_img && $no_icon_for_img ) && ! $link->has_attr_value( 'class', 'wpel-no-icon' ) ) {
|
| 299 |
+
if ( 'dashicon' === $icon_type ) {
|
| 300 |
+
$dashicon = $this->opt( 'icon_dashicon', $type );
|
| 301 |
+
$icon = '<i class="wpel-icon dashicons-before '. $dashicon .'" aria-hidden="true"></i>';
|
| 302 |
+
} else if ( 'fontawesome' === $icon_type ) {
|
| 303 |
+
$fa = $this->opt( 'icon_fontawesome', $type );
|
| 304 |
+
$icon = '<i class="wpel-icon fa '. $fa .'" aria-hidden="true"></i>';
|
| 305 |
+
} else if ( 'image' === $icon_type ) {
|
| 306 |
+
$image = $this->opt( 'icon_image', $type );
|
| 307 |
+
$icon = '<span class="wpel-icon wpel-image wpel-icon-'. $image .'"></span>';
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
if ( 'left' === $this->opt( 'icon_position', $type ) ) {
|
| 311 |
+
$link->add_to_attr( 'class', 'wpel-icon-left' );
|
| 312 |
+
$link->set_content( $icon . $link->get_content() );
|
| 313 |
+
} else if ( 'right' === $this->opt( 'icon_position', $type ) ) {
|
| 314 |
+
$link->add_to_attr( 'class', 'wpel-icon-right' );
|
| 315 |
+
$link->set_content( $link->get_content() . $icon );
|
| 316 |
+
}
|
| 317 |
+
}
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
/**
|
| 321 |
+
* Check if url is included as external link
|
| 322 |
+
* @param string $url
|
| 323 |
+
* @return boolean
|
| 324 |
+
*/
|
| 325 |
+
protected function is_included_url( $url )
|
| 326 |
+
{
|
| 327 |
+
// should be using private property, but static is more practical
|
| 328 |
+
static $include_urls_arr = null;
|
| 329 |
+
|
| 330 |
+
if ( null === $include_urls_arr ) {
|
| 331 |
+
$include_urls = $this->opt( 'include_urls' );
|
| 332 |
+
$include_urls = str_replace( "\n", ',', $include_urls );
|
| 333 |
+
|
| 334 |
+
if ( '' === trim( $include_urls ) ) {
|
| 335 |
+
$include_urls_arr = array();
|
| 336 |
+
} else {
|
| 337 |
+
$include_urls_arr = explode( ',', $include_urls );
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
$include_urls_arr = array_filter( $include_urls_arr, function ( $url ) {
|
| 341 |
+
return '' !== trim( $url );
|
| 342 |
+
} );
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
foreach ( $include_urls_arr as $include_url ) {
|
| 346 |
+
if ( false !== strpos( $url, $include_url ) ) {
|
| 347 |
+
return true;
|
| 348 |
+
}
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
return false;
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
/**
|
| 355 |
+
* Check if url is excluded as external link
|
| 356 |
+
* @param string $url
|
| 357 |
+
* @return boolean
|
| 358 |
+
*/
|
| 359 |
+
protected function is_excluded_url( $url )
|
| 360 |
+
{
|
| 361 |
+
// should be using private property, but static is more practical
|
| 362 |
+
static $exclude_urls_arr = null;
|
| 363 |
+
|
| 364 |
+
if ( null === $exclude_urls_arr ) {
|
| 365 |
+
$exclude_urls = $this->opt( 'exclude_urls' );
|
| 366 |
+
$exclude_urls = str_replace( "\n", ',', $exclude_urls );
|
| 367 |
+
|
| 368 |
+
if ( '' === trim( $exclude_urls ) ) {
|
| 369 |
+
$exclude_urls_arr = array();
|
| 370 |
+
} else {
|
| 371 |
+
$exclude_urls_arr = explode( ',', $exclude_urls );
|
| 372 |
+
}
|
| 373 |
+
|
| 374 |
+
$exclude_urls_arr = array_filter( $exclude_urls_arr, function ( $url ) {
|
| 375 |
+
return '' !== trim( $url );
|
| 376 |
+
} );
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
foreach ( $exclude_urls_arr as $exclude_url ) {
|
| 380 |
+
if ( false !== strpos( $url, $exclude_url ) ) {
|
| 381 |
+
return true;
|
| 382 |
+
}
|
| 383 |
+
}
|
| 384 |
+
|
| 385 |
+
return false;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
/**
|
| 389 |
+
* Check url is internal
|
| 390 |
+
* @param string $url
|
| 391 |
+
* @return boolean
|
| 392 |
+
*/
|
| 393 |
+
protected function is_internal_url( $url )
|
| 394 |
+
{
|
| 395 |
+
// all relative url's are internal
|
| 396 |
+
if ( substr( $url, 0, 7 ) !== 'http://'
|
| 397 |
+
&& substr( $url, 0, 8 ) !== 'https://'
|
| 398 |
+
&& substr( $url, 0, 6 ) !== 'ftp://'
|
| 399 |
+
&& substr( $url, 0, 2 ) !== '//' ) {
|
| 400 |
+
return true;
|
| 401 |
+
}
|
| 402 |
+
|
| 403 |
+
// is internal
|
| 404 |
+
if ( false !== strpos( $url, home_url( '' ) )
|
| 405 |
+
|| false !== strpos( $url, home_url( '', 'https' ) ) ) {
|
| 406 |
+
return true;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
// check subdomains
|
| 410 |
+
if ( $this->opt( 'subdomains_as_internal_links' ) && false !== strpos( $url, $this->get_domain() ) ) {
|
| 411 |
+
return true;
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
return false;
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
/**
|
| 418 |
+
* Get domain name
|
| 419 |
+
* @return string
|
| 420 |
+
*/
|
| 421 |
+
protected function get_domain() {
|
| 422 |
+
// should be using private property, but static is more practical
|
| 423 |
+
static $domain_name = null;
|
| 424 |
+
|
| 425 |
+
if ( null === $domain_name ) {
|
| 426 |
+
preg_match(
|
| 427 |
+
'/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/'
|
| 428 |
+
, parse_url( home_url(), PHP_URL_HOST )
|
| 429 |
+
, $domain_tld
|
| 430 |
+
);
|
| 431 |
+
|
| 432 |
+
if ( count( $domain_tld ) > 0 ) {
|
| 433 |
+
$domain_name = $domain_tld[ 0 ];
|
| 434 |
+
} else {
|
| 435 |
+
$domain_name = $_SERVER[ 'SERVER_NAME' ];
|
| 436 |
+
}
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
return $domain_name;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
/*?>*/
|
includes/class-wpel-link.php
CHANGED
|
@@ -1,104 +1,104 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Link
|
| 4 |
-
*
|
| 5 |
-
* This class extends DOMElement which uses the camelCase naming style.
|
| 6 |
-
* Therefore this class also contains camelCase names.
|
| 7 |
-
*
|
| 8 |
-
* @package WPEL
|
| 9 |
-
* @category WordPress Plugin
|
| 10 |
-
* @version 2.1.
|
| 11 |
-
* @author Victor Villaverde Laan
|
| 12 |
-
* @link http://www.finewebdev.com
|
| 13 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 14 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 15 |
-
*/
|
| 16 |
-
class WPEL_Link extends FWP_HTML_Element_1x0x0
|
| 17 |
-
{
|
| 18 |
-
|
| 19 |
-
/**
|
| 20 |
-
* Mark as external link (by setting data attribute)
|
| 21 |
-
*/
|
| 22 |
-
public function set_external()
|
| 23 |
-
{
|
| 24 |
-
$this->set_attr( 'data-wpel-link', 'external' );
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
/**
|
| 28 |
-
* Is marked as external link
|
| 29 |
-
* @return boolean
|
| 30 |
-
*/
|
| 31 |
-
public function is_external()
|
| 32 |
-
{
|
| 33 |
-
return 'external' === $this->get_attr( 'data-wpel-link' ) || $this->has_attr_value( 'rel', 'external' );
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
/**
|
| 37 |
-
* Mark as internal link (by setting data attribute)
|
| 38 |
-
*/
|
| 39 |
-
public function set_internal()
|
| 40 |
-
{
|
| 41 |
-
$this->set_attr( 'data-wpel-link', 'internal' );
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
/**
|
| 45 |
-
* Is marked as internal link
|
| 46 |
-
* @return boolean
|
| 47 |
-
*/
|
| 48 |
-
public function is_internal()
|
| 49 |
-
{
|
| 50 |
-
return 'internal' === $this->get_attr( 'data-wpel-link' );
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
/**
|
| 54 |
-
* Mark as excluded link (by setting data attribute)
|
| 55 |
-
*/
|
| 56 |
-
public function set_exclude()
|
| 57 |
-
{
|
| 58 |
-
$this->set_attr( 'data-wpel-link', 'exclude' );
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
/**
|
| 62 |
-
* Is marked as excluded link
|
| 63 |
-
* @return boolean
|
| 64 |
-
*/
|
| 65 |
-
public function is_exclude()
|
| 66 |
-
{
|
| 67 |
-
return 'exclude' === $this->get_attr( 'data-wpel-link' );
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
/**
|
| 71 |
-
* Mark as ignored link (by setting data attribute)
|
| 72 |
-
*/
|
| 73 |
-
public function set_ignore()
|
| 74 |
-
{
|
| 75 |
-
$this->set_attr( 'data-wpel-link', 'ignore' );
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
/**
|
| 79 |
-
* Is marked as ignored link
|
| 80 |
-
* @return boolean
|
| 81 |
-
*/
|
| 82 |
-
public function is_ignore()
|
| 83 |
-
{
|
| 84 |
-
return 'ignore' === $this->get_attr( 'data-wpel-link' );
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* Check url is mailto link
|
| 89 |
-
* @return boolean
|
| 90 |
-
*/
|
| 91 |
-
public function is_mailto()
|
| 92 |
-
{
|
| 93 |
-
$url = trim( $this->get_attr( 'href' ) );
|
| 94 |
-
|
| 95 |
-
if ( substr( $url, 0, 7 ) === 'mailto:' ) {
|
| 96 |
-
return true;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
return false;
|
| 100 |
-
}
|
| 101 |
-
|
| 102 |
-
}
|
| 103 |
-
|
| 104 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Link
|
| 4 |
+
*
|
| 5 |
+
* This class extends DOMElement which uses the camelCase naming style.
|
| 6 |
+
* Therefore this class also contains camelCase names.
|
| 7 |
+
*
|
| 8 |
+
* @package WPEL
|
| 9 |
+
* @category WordPress Plugin
|
| 10 |
+
* @version 2.1.2
|
| 11 |
+
* @author Victor Villaverde Laan
|
| 12 |
+
* @link http://www.finewebdev.com
|
| 13 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 14 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 15 |
+
*/
|
| 16 |
+
class WPEL_Link extends FWP_HTML_Element_1x0x0
|
| 17 |
+
{
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Mark as external link (by setting data attribute)
|
| 21 |
+
*/
|
| 22 |
+
public function set_external()
|
| 23 |
+
{
|
| 24 |
+
$this->set_attr( 'data-wpel-link', 'external' );
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
/**
|
| 28 |
+
* Is marked as external link
|
| 29 |
+
* @return boolean
|
| 30 |
+
*/
|
| 31 |
+
public function is_external()
|
| 32 |
+
{
|
| 33 |
+
return 'external' === $this->get_attr( 'data-wpel-link' ) || $this->has_attr_value( 'rel', 'external' );
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* Mark as internal link (by setting data attribute)
|
| 38 |
+
*/
|
| 39 |
+
public function set_internal()
|
| 40 |
+
{
|
| 41 |
+
$this->set_attr( 'data-wpel-link', 'internal' );
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Is marked as internal link
|
| 46 |
+
* @return boolean
|
| 47 |
+
*/
|
| 48 |
+
public function is_internal()
|
| 49 |
+
{
|
| 50 |
+
return 'internal' === $this->get_attr( 'data-wpel-link' );
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Mark as excluded link (by setting data attribute)
|
| 55 |
+
*/
|
| 56 |
+
public function set_exclude()
|
| 57 |
+
{
|
| 58 |
+
$this->set_attr( 'data-wpel-link', 'exclude' );
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Is marked as excluded link
|
| 63 |
+
* @return boolean
|
| 64 |
+
*/
|
| 65 |
+
public function is_exclude()
|
| 66 |
+
{
|
| 67 |
+
return 'exclude' === $this->get_attr( 'data-wpel-link' );
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/**
|
| 71 |
+
* Mark as ignored link (by setting data attribute)
|
| 72 |
+
*/
|
| 73 |
+
public function set_ignore()
|
| 74 |
+
{
|
| 75 |
+
$this->set_attr( 'data-wpel-link', 'ignore' );
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Is marked as ignored link
|
| 80 |
+
* @return boolean
|
| 81 |
+
*/
|
| 82 |
+
public function is_ignore()
|
| 83 |
+
{
|
| 84 |
+
return 'ignore' === $this->get_attr( 'data-wpel-link' );
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
* Check url is mailto link
|
| 89 |
+
* @return boolean
|
| 90 |
+
*/
|
| 91 |
+
public function is_mailto()
|
| 92 |
+
{
|
| 93 |
+
$url = trim( $this->get_attr( 'href' ) );
|
| 94 |
+
|
| 95 |
+
if ( substr( $url, 0, 7 ) === 'mailto:' ) {
|
| 96 |
+
return true;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
return false;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/*?>*/
|
includes/class-wpel-plugin.php
CHANGED
|
@@ -1,98 +1,61 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Plugin
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Plugin extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
*
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
*
|
| 30 |
-
*/
|
| 31 |
-
protected function
|
| 32 |
-
{
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
'
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
WPEL_Front_Ignore::create( $settings_page );
|
| 63 |
-
|
| 64 |
-
WPEL_Template_Tags::create();
|
| 65 |
-
}
|
| 66 |
-
|
| 67 |
-
// update procedures
|
| 68 |
-
WPEL_Update::create();
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
/**
|
| 72 |
-
* Action for "plugins_loaded"
|
| 73 |
-
*/
|
| 74 |
-
protected function action_plugins_loaded()
|
| 75 |
-
{
|
| 76 |
-
load_plugin_textdomain( 'wp-external-links', false, WPEL_Plugin::get_plugin_dir( '/languages' ) );
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/**
|
| 80 |
-
* @return string
|
| 81 |
-
*/
|
| 82 |
-
public static function get_plugin_file()
|
| 83 |
-
{
|
| 84 |
-
return self::$plugin_file;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
/**
|
| 88 |
-
* @param string $path Optional
|
| 89 |
-
* @return string
|
| 90 |
-
*/
|
| 91 |
-
public static function get_plugin_dir( $path = '' )
|
| 92 |
-
{
|
| 93 |
-
return self::$plugin_dir . $path;
|
| 94 |
-
}
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Plugin
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Plugin extends FWP_Plugin_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize plugin
|
| 18 |
+
* @param string $plugin_file
|
| 19 |
+
* @param string $plugin_dir
|
| 20 |
+
*/
|
| 21 |
+
protected function init( $plugin_file, $plugin_dir )
|
| 22 |
+
{
|
| 23 |
+
parent::init( $plugin_file, $plugin_dir );
|
| 24 |
+
|
| 25 |
+
$this->create_components();
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
/**
|
| 29 |
+
* Create components
|
| 30 |
+
*/
|
| 31 |
+
protected function create_components()
|
| 32 |
+
{
|
| 33 |
+
WPEL_Register_Scripts::create();
|
| 34 |
+
|
| 35 |
+
// network admin page
|
| 36 |
+
$network_page = WPEL_Network_Page::create( array(
|
| 37 |
+
'network-settings' => WPEL_Network_Fields::create(),
|
| 38 |
+
'network-admin-settings' => WPEL_Network_Admin_Fields::create(),
|
| 39 |
+
) );
|
| 40 |
+
|
| 41 |
+
// admin settings page
|
| 42 |
+
$settings_page = WPEL_Settings_Page::create( $network_page, array(
|
| 43 |
+
'external-links' => WPEL_External_Link_Fields::create(),
|
| 44 |
+
'internal-links' => WPEL_Internal_Link_Fields::create(),
|
| 45 |
+
'excluded-links' => WPEL_Excluded_Link_Fields::create(),
|
| 46 |
+
'admin' => WPEL_Admin_Fields::create(),
|
| 47 |
+
'exceptions' => WPEL_Exceptions_Fields::create(),
|
| 48 |
+
) );
|
| 49 |
+
|
| 50 |
+
// front site
|
| 51 |
+
if ( ! is_admin() ) {
|
| 52 |
+
WPEL_Front::create( $settings_page );
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// update procedures
|
| 56 |
+
WPEL_Update::create();
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/*?>*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wpel-register-hooks.php
DELETED
|
@@ -1,156 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Register_Hooks
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.1
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Register_Hooks extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
register_activation_hook(
|
| 22 |
-
WPEL_Plugin::get_plugin_file()
|
| 23 |
-
, $this->get_callback( 'activate' )
|
| 24 |
-
);
|
| 25 |
-
|
| 26 |
-
register_uninstall_hook(
|
| 27 |
-
WPEL_Plugin::get_plugin_file()
|
| 28 |
-
, $this->get_callback( 'uninstall' )
|
| 29 |
-
);
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
/**
|
| 33 |
-
* Plugin activation procedure
|
| 34 |
-
*/
|
| 35 |
-
protected function activate( $networkwide )
|
| 36 |
-
{
|
| 37 |
-
global $wpdb;
|
| 38 |
-
|
| 39 |
-
if ( is_multisite() && $networkwide ) {
|
| 40 |
-
// network activation
|
| 41 |
-
$sites = wp_get_sites();
|
| 42 |
-
$active_blog = $wpdb->blogid;
|
| 43 |
-
|
| 44 |
-
foreach ( $sites as $site ) {
|
| 45 |
-
switch_to_blog( $site[ 'blog_id' ] );
|
| 46 |
-
$this->activate_site();
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
// switch back to active blog
|
| 50 |
-
switch_to_blog( $active_blog );
|
| 51 |
-
|
| 52 |
-
$this->activate_network();
|
| 53 |
-
} else {
|
| 54 |
-
// single site activation
|
| 55 |
-
$this->activate_site();
|
| 56 |
-
}
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
/**
|
| 60 |
-
* Activate network
|
| 61 |
-
* @return void
|
| 62 |
-
*/
|
| 63 |
-
private function activate_network()
|
| 64 |
-
{
|
| 65 |
-
$network_already_set = get_site_option( 'wpel-network-settings' );
|
| 66 |
-
|
| 67 |
-
if ( $network_already_set ) {
|
| 68 |
-
return;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
// network default settings
|
| 72 |
-
$network_values = WPEL_Network_Fields::get_instance()->get_default_values();
|
| 73 |
-
$network_admin_values = WPEL_Network_Admin_Fields::get_instance()->get_default_values();
|
| 74 |
-
|
| 75 |
-
update_site_option( 'wpel-network-settings', $network_values );
|
| 76 |
-
update_site_option( 'wpel-network-admin-settings', $network_admin_values );
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
/**
|
| 80 |
-
* Activate site
|
| 81 |
-
* @return void
|
| 82 |
-
*/
|
| 83 |
-
private function activate_site()
|
| 84 |
-
{
|
| 85 |
-
$site_already_set = get_option( 'wpel-external-link-settings' );
|
| 86 |
-
|
| 87 |
-
if ( $site_already_set ) {
|
| 88 |
-
return;
|
| 89 |
-
}
|
| 90 |
-
|
| 91 |
-
// get default values
|
| 92 |
-
$external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
|
| 93 |
-
$internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
|
| 94 |
-
$excluded_link_values = WPEL_Excluded_Link_Fields::get_instance()->get_default_values();
|
| 95 |
-
$exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
|
| 96 |
-
$admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
|
| 97 |
-
|
| 98 |
-
// update new values
|
| 99 |
-
update_option( 'wpel-external-link-settings', $external_link_values );
|
| 100 |
-
update_option( 'wpel-internal-link-settings', $internal_link_values );
|
| 101 |
-
update_option( 'wpel-excluded-link-settings', $excluded_link_values );
|
| 102 |
-
update_option( 'wpel-exceptions-settings', $exceptions_link_values );
|
| 103 |
-
update_option( 'wpel-admin-settings', $admin_link_values );
|
| 104 |
-
|
| 105 |
-
// update meta data
|
| 106 |
-
$plugin_data = get_plugin_data( WPEL_Plugin::get_plugin_file() );
|
| 107 |
-
update_option( 'wpel-version', $plugin_data[ 'Version' ] );
|
| 108 |
-
}
|
| 109 |
-
|
| 110 |
-
/**
|
| 111 |
-
* Uninstall site
|
| 112 |
-
*/
|
| 113 |
-
protected function uninstall()
|
| 114 |
-
{
|
| 115 |
-
global $wpdb;
|
| 116 |
-
|
| 117 |
-
if ( is_multisite() ) {
|
| 118 |
-
// network activation
|
| 119 |
-
$sites = wp_get_sites();
|
| 120 |
-
$active_blog = $wpdb->blogid;
|
| 121 |
-
foreach ( $sites as $site ) {
|
| 122 |
-
switch_to_blog( $site[ 'blog_id' ] );
|
| 123 |
-
$this->uninstall_site();
|
| 124 |
-
}
|
| 125 |
-
|
| 126 |
-
// switch back to active blog
|
| 127 |
-
switch_to_blog( $active_blog );
|
| 128 |
-
|
| 129 |
-
// network settings
|
| 130 |
-
delete_site_option( 'wpel-network-settings' );
|
| 131 |
-
delete_site_option( 'wpel-network-admin-settings' );
|
| 132 |
-
} else {
|
| 133 |
-
// single site activation
|
| 134 |
-
$this->uninstall_site();
|
| 135 |
-
}
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
/**
|
| 139 |
-
* Plugin uninstall procedure
|
| 140 |
-
*/
|
| 141 |
-
protected function uninstall_site()
|
| 142 |
-
{
|
| 143 |
-
// delete options
|
| 144 |
-
delete_option( 'wpel-external-link-settings' );
|
| 145 |
-
delete_option( 'wpel-internal-link-settings' );
|
| 146 |
-
delete_option( 'wpel-excluded-link-settings' );
|
| 147 |
-
delete_option( 'wpel-exceptions-settings' );
|
| 148 |
-
delete_option( 'wpel-admin-settings' );
|
| 149 |
-
|
| 150 |
-
delete_option( 'wpel-version' );
|
| 151 |
-
delete_option( 'wpel-show-notice' );
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
}
|
| 155 |
-
|
| 156 |
-
/*?>*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wpel-register-scripts.php
CHANGED
|
@@ -1,75 +1,75 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Register_Scripts
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Register_Scripts extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Action for "wp_enqueue_scripts"
|
| 18 |
-
*/
|
| 19 |
-
protected function action_wp_enqueue_scripts()
|
| 20 |
-
{
|
| 21 |
-
$this->register_scripts();
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
/**
|
| 25 |
-
* Action for "admin_enqueue_scripts"
|
| 26 |
-
*/
|
| 27 |
-
protected function action_admin_enqueue_scripts()
|
| 28 |
-
{
|
| 29 |
-
$this->register_scripts();
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
/**
|
| 33 |
-
* Register styles and scripts
|
| 34 |
-
*/
|
| 35 |
-
protected function register_scripts()
|
| 36 |
-
{
|
| 37 |
-
$plugin_version = get_option( 'wpel-version' );
|
| 38 |
-
|
| 39 |
-
// set style font awesome icons
|
| 40 |
-
wp_register_style(
|
| 41 |
-
'font-awesome'
|
| 42 |
-
, 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'
|
| 43 |
-
, array()
|
| 44 |
-
, $plugin_version
|
| 45 |
-
);
|
| 46 |
-
|
| 47 |
-
// front style
|
| 48 |
-
wp_register_style(
|
| 49 |
-
'wpel-style'
|
| 50 |
-
, plugins_url( '/public/css/wpel.css', WPEL_Plugin::get_plugin_file() )
|
| 51 |
-
, array()
|
| 52 |
-
, $plugin_version
|
| 53 |
-
);
|
| 54 |
-
|
| 55 |
-
// set admin style
|
| 56 |
-
wp_register_style(
|
| 57 |
-
'wpel-admin-style'
|
| 58 |
-
, plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
|
| 59 |
-
, array()
|
| 60 |
-
, $plugin_version
|
| 61 |
-
);
|
| 62 |
-
|
| 63 |
-
// set wpel admin script
|
| 64 |
-
wp_register_script(
|
| 65 |
-
'wpel-admin-script'
|
| 66 |
-
, plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
|
| 67 |
-
, array( 'jquery' )
|
| 68 |
-
, $plugin_version
|
| 69 |
-
, true
|
| 70 |
-
);
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Register_Scripts
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Register_Scripts extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Action for "wp_enqueue_scripts"
|
| 18 |
+
*/
|
| 19 |
+
protected function action_wp_enqueue_scripts()
|
| 20 |
+
{
|
| 21 |
+
$this->register_scripts();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Action for "admin_enqueue_scripts"
|
| 26 |
+
*/
|
| 27 |
+
protected function action_admin_enqueue_scripts()
|
| 28 |
+
{
|
| 29 |
+
$this->register_scripts();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Register styles and scripts
|
| 34 |
+
*/
|
| 35 |
+
protected function register_scripts()
|
| 36 |
+
{
|
| 37 |
+
$plugin_version = get_option( 'wpel-version' );
|
| 38 |
+
|
| 39 |
+
// set style font awesome icons
|
| 40 |
+
wp_register_style(
|
| 41 |
+
'font-awesome'
|
| 42 |
+
, 'https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'
|
| 43 |
+
, array()
|
| 44 |
+
, $plugin_version
|
| 45 |
+
);
|
| 46 |
+
|
| 47 |
+
// front style
|
| 48 |
+
wp_register_style(
|
| 49 |
+
'wpel-style'
|
| 50 |
+
, plugins_url( '/public/css/wpel.css', WPEL_Plugin::get_plugin_file() )
|
| 51 |
+
, array()
|
| 52 |
+
, $plugin_version
|
| 53 |
+
);
|
| 54 |
+
|
| 55 |
+
// set admin style
|
| 56 |
+
wp_register_style(
|
| 57 |
+
'wpel-admin-style'
|
| 58 |
+
, plugins_url( '/public/css/wpel-admin.css', WPEL_Plugin::get_plugin_file() )
|
| 59 |
+
, array()
|
| 60 |
+
, $plugin_version
|
| 61 |
+
);
|
| 62 |
+
|
| 63 |
+
// set wpel admin script
|
| 64 |
+
wp_register_script(
|
| 65 |
+
'wpel-admin-script'
|
| 66 |
+
, plugins_url( '/public/js/wpel-admin.js', WPEL_Plugin::get_plugin_file() )
|
| 67 |
+
, array( 'jquery' )
|
| 68 |
+
, $plugin_version
|
| 69 |
+
, true
|
| 70 |
+
);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/*?>*/
|
includes/class-wpel-template-tags.php
CHANGED
|
@@ -1,46 +1,42 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Template_Tags
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Template_Tags extends
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
*
|
| 18 |
-
*/
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
}
|
| 45 |
-
|
| 46 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Template_Tags
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Template_Tags extends FWP_Template_Tag_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var WPEL_Front
|
| 18 |
+
*/
|
| 19 |
+
private $front = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Initialize
|
| 23 |
+
* @param WPEL_Front $front
|
| 24 |
+
*/
|
| 25 |
+
protected function init( WPEL_Front $front )
|
| 26 |
+
{
|
| 27 |
+
$this->front = $front;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Template tag funtion
|
| 32 |
+
* @param string $content
|
| 33 |
+
* @return string
|
| 34 |
+
*/
|
| 35 |
+
public function wpel_filter( $content )
|
| 36 |
+
{
|
| 37 |
+
return $this->front->scan( $content );
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/*?>*/
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wpel-update.php
CHANGED
|
@@ -1,140 +1,140 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPEL_Update
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
final class WPEL_Update extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* Initialize
|
| 18 |
-
*/
|
| 19 |
-
protected function init()
|
| 20 |
-
{
|
| 21 |
-
$this->update_to_v2();
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
/**
|
| 25 |
-
* Action for "admin_init"
|
| 26 |
-
*/
|
| 27 |
-
protected function action_admin_init()
|
| 28 |
-
{
|
| 29 |
-
$this->update_version();
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
/**
|
| 33 |
-
* Update version
|
| 34 |
-
* @return void
|
| 35 |
-
*/
|
| 36 |
-
private function update_version()
|
| 37 |
-
{
|
| 38 |
-
$plugin_data = get_plugin_data( WPEL_Plugin::get_plugin_file() );
|
| 39 |
-
|
| 40 |
-
$current_version = $plugin_data[ 'Version' ];
|
| 41 |
-
$saved_version = get_option( 'wpel-version' );
|
| 42 |
-
|
| 43 |
-
if ( $current_version !== $saved_version ) {
|
| 44 |
-
update_option( 'wpel-version', $current_version );
|
| 45 |
-
}
|
| 46 |
-
}
|
| 47 |
-
|
| 48 |
-
/**
|
| 49 |
-
* Update procedure to v2.x
|
| 50 |
-
* @return void
|
| 51 |
-
*/
|
| 52 |
-
private function update_to_v2()
|
| 53 |
-
{
|
| 54 |
-
$site_already_set = get_option( 'wpel-external-link-settings' );
|
| 55 |
-
|
| 56 |
-
if ( $site_already_set ) {
|
| 57 |
-
return;
|
| 58 |
-
}
|
| 59 |
-
|
| 60 |
-
// get default values
|
| 61 |
-
$external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
|
| 62 |
-
$internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
|
| 63 |
-
$excluded_link_values = WPEL_Excluded_Link_Fields::get_instance()->get_default_values();
|
| 64 |
-
$exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
|
| 65 |
-
$admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
|
| 66 |
-
|
| 67 |
-
// Upgrade to version 2
|
| 68 |
-
// check for old option values version < 2.0.0
|
| 69 |
-
$old_main = get_option( 'wp_external_links-main' );
|
| 70 |
-
$old_seo = get_option( 'wp_external_links-seo' );
|
| 71 |
-
$old_style = get_option( 'wp_external_links-style' );
|
| 72 |
-
$old_extra = get_option( 'wp_external_links-extra' );
|
| 73 |
-
$old_screen = get_option( 'wp_external_links-screen' );
|
| 74 |
-
|
| 75 |
-
// convert old to new db option values
|
| 76 |
-
if ( ! empty( $old_main ) || ! empty( $old_seo ) || ! empty( $old_style ) || ! empty( $old_extra ) || ! empty( $old_screen ) ) {
|
| 77 |
-
// helper function
|
| 78 |
-
$val = function ( $arr, $key, $default = '' ) {
|
| 79 |
-
if ( ! isset( $arr[ $key ] ) ) {
|
| 80 |
-
return $default;
|
| 81 |
-
}
|
| 82 |
-
|
| 83 |
-
return (string) $arr[ $key ];
|
| 84 |
-
};
|
| 85 |
-
|
| 86 |
-
// mapping
|
| 87 |
-
if ( ! empty( $old_main ) ) {
|
| 88 |
-
$target = $val( $old_main, 'target' );
|
| 89 |
-
$external_link_values[ 'target' ] = str_replace( '_none', '_self', $target );
|
| 90 |
-
|
| 91 |
-
$exceptions_link_values[ 'apply_all' ] = $val( $old_main, 'filter_page' );
|
| 92 |
-
$exceptions_link_values[ 'apply_post_content' ] = $val( $old_main, 'filter_posts' );
|
| 93 |
-
$exceptions_link_values[ 'apply_comments' ] = $val( $old_main, 'filter_comments' );
|
| 94 |
-
$exceptions_link_values[ 'apply_widgets' ] = $val( $old_main, 'filter_widgets' );
|
| 95 |
-
$exceptions_link_values[ 'exclude_urls' ] = $val( $old_main, 'ignore' );
|
| 96 |
-
$exceptions_link_values[ 'subdomains_as_internal_links' ] = $val( $old_main, 'ignore_subdomains' );
|
| 97 |
-
}
|
| 98 |
-
if ( ! empty( $old_seo ) ) {
|
| 99 |
-
$external_link_values[ 'rel_follow' ] = ( '1' == $val( $old_seo, 'nofollow' ) ) ? 'nofollow' : 'follow';
|
| 100 |
-
$external_link_values[ 'rel_follow_overwrite' ] = $val( $old_seo, 'overwrite_follow' );
|
| 101 |
-
$external_link_values[ 'rel_external' ] = $val( $old_seo, 'external' );
|
| 102 |
-
|
| 103 |
-
$title = $val( $old_seo, 'title' );
|
| 104 |
-
$external_link_values[ 'title' ] = str_replace( '%title%', '{title}', $title );
|
| 105 |
-
}
|
| 106 |
-
if ( ! empty( $old_style ) ) {
|
| 107 |
-
if ( $old_style[ 'icon' ] ) {
|
| 108 |
-
$external_link_values[ 'icon_type' ] = 'image';
|
| 109 |
-
$external_link_values[ 'icon_image' ] = $val( $old_style, 'icon', '1' );
|
| 110 |
-
}
|
| 111 |
-
$external_link_values[ 'class' ] = $val( $old_style, 'class_name' );
|
| 112 |
-
$external_link_values[ 'no_icon_for_img' ] = $val( $old_style, 'image_no_icon' );
|
| 113 |
-
}
|
| 114 |
-
if ( ! empty( $old_extra ) ) {
|
| 115 |
-
// nothing
|
| 116 |
-
}
|
| 117 |
-
if ( ! empty( $old_screen ) ) {
|
| 118 |
-
$admin_link_values[ 'own_admin_menu' ] = ( 'admin.php' == $val( $old_screen, 'menu_position' ) ) ? '1' : '';
|
| 119 |
-
}
|
| 120 |
-
|
| 121 |
-
// delete old values
|
| 122 |
-
delete_option( 'wp_external_links-meta' );
|
| 123 |
-
delete_option( 'wp_external_links-main' );
|
| 124 |
-
delete_option( 'wp_external_links-seo' );
|
| 125 |
-
delete_option( 'wp_external_links-style' );
|
| 126 |
-
delete_option( 'wp_external_links-extra' );
|
| 127 |
-
delete_option( 'wp_external_links-screen' );
|
| 128 |
-
}
|
| 129 |
-
|
| 130 |
-
// update new values
|
| 131 |
-
update_option( 'wpel-external-link-settings', $external_link_values );
|
| 132 |
-
update_option( 'wpel-internal-link-settings', $internal_link_values );
|
| 133 |
-
update_option( 'wpel-excluded-link-settings', $excluded_link_values );
|
| 134 |
-
update_option( 'wpel-exceptions-settings', $exceptions_link_values );
|
| 135 |
-
update_option( 'wpel-admin-settings', $admin_link_values );
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Update
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Update extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Initialize
|
| 18 |
+
*/
|
| 19 |
+
protected function init()
|
| 20 |
+
{
|
| 21 |
+
$this->update_to_v2();
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Action for "admin_init"
|
| 26 |
+
*/
|
| 27 |
+
protected function action_admin_init()
|
| 28 |
+
{
|
| 29 |
+
$this->update_version();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Update version
|
| 34 |
+
* @return void
|
| 35 |
+
*/
|
| 36 |
+
private function update_version()
|
| 37 |
+
{
|
| 38 |
+
$plugin_data = get_plugin_data( WPEL_Plugin::get_plugin_file() );
|
| 39 |
+
|
| 40 |
+
$current_version = $plugin_data[ 'Version' ];
|
| 41 |
+
$saved_version = get_option( 'wpel-version' );
|
| 42 |
+
|
| 43 |
+
if ( $current_version !== $saved_version ) {
|
| 44 |
+
update_option( 'wpel-version', $current_version );
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Update procedure to v2.x
|
| 50 |
+
* @return void
|
| 51 |
+
*/
|
| 52 |
+
private function update_to_v2()
|
| 53 |
+
{
|
| 54 |
+
$site_already_set = get_option( 'wpel-external-link-settings' );
|
| 55 |
+
|
| 56 |
+
if ( $site_already_set ) {
|
| 57 |
+
return;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
// get default values
|
| 61 |
+
$external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
|
| 62 |
+
$internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
|
| 63 |
+
$excluded_link_values = WPEL_Excluded_Link_Fields::get_instance()->get_default_values();
|
| 64 |
+
$exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
|
| 65 |
+
$admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
|
| 66 |
+
|
| 67 |
+
// Upgrade to version 2
|
| 68 |
+
// check for old option values version < 2.0.0
|
| 69 |
+
$old_main = get_option( 'wp_external_links-main' );
|
| 70 |
+
$old_seo = get_option( 'wp_external_links-seo' );
|
| 71 |
+
$old_style = get_option( 'wp_external_links-style' );
|
| 72 |
+
$old_extra = get_option( 'wp_external_links-extra' );
|
| 73 |
+
$old_screen = get_option( 'wp_external_links-screen' );
|
| 74 |
+
|
| 75 |
+
// convert old to new db option values
|
| 76 |
+
if ( ! empty( $old_main ) || ! empty( $old_seo ) || ! empty( $old_style ) || ! empty( $old_extra ) || ! empty( $old_screen ) ) {
|
| 77 |
+
// helper function
|
| 78 |
+
$val = function ( $arr, $key, $default = '' ) {
|
| 79 |
+
if ( ! isset( $arr[ $key ] ) ) {
|
| 80 |
+
return $default;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
return (string) $arr[ $key ];
|
| 84 |
+
};
|
| 85 |
+
|
| 86 |
+
// mapping
|
| 87 |
+
if ( ! empty( $old_main ) ) {
|
| 88 |
+
$target = $val( $old_main, 'target' );
|
| 89 |
+
$external_link_values[ 'target' ] = str_replace( '_none', '_self', $target );
|
| 90 |
+
|
| 91 |
+
$exceptions_link_values[ 'apply_all' ] = $val( $old_main, 'filter_page' );
|
| 92 |
+
$exceptions_link_values[ 'apply_post_content' ] = $val( $old_main, 'filter_posts' );
|
| 93 |
+
$exceptions_link_values[ 'apply_comments' ] = $val( $old_main, 'filter_comments' );
|
| 94 |
+
$exceptions_link_values[ 'apply_widgets' ] = $val( $old_main, 'filter_widgets' );
|
| 95 |
+
$exceptions_link_values[ 'exclude_urls' ] = $val( $old_main, 'ignore' );
|
| 96 |
+
$exceptions_link_values[ 'subdomains_as_internal_links' ] = $val( $old_main, 'ignore_subdomains' );
|
| 97 |
+
}
|
| 98 |
+
if ( ! empty( $old_seo ) ) {
|
| 99 |
+
$external_link_values[ 'rel_follow' ] = ( '1' == $val( $old_seo, 'nofollow' ) ) ? 'nofollow' : 'follow';
|
| 100 |
+
$external_link_values[ 'rel_follow_overwrite' ] = $val( $old_seo, 'overwrite_follow' );
|
| 101 |
+
$external_link_values[ 'rel_external' ] = $val( $old_seo, 'external' );
|
| 102 |
+
|
| 103 |
+
$title = $val( $old_seo, 'title' );
|
| 104 |
+
$external_link_values[ 'title' ] = str_replace( '%title%', '{title}', $title );
|
| 105 |
+
}
|
| 106 |
+
if ( ! empty( $old_style ) ) {
|
| 107 |
+
if ( $old_style[ 'icon' ] ) {
|
| 108 |
+
$external_link_values[ 'icon_type' ] = 'image';
|
| 109 |
+
$external_link_values[ 'icon_image' ] = $val( $old_style, 'icon', '1' );
|
| 110 |
+
}
|
| 111 |
+
$external_link_values[ 'class' ] = $val( $old_style, 'class_name' );
|
| 112 |
+
$external_link_values[ 'no_icon_for_img' ] = $val( $old_style, 'image_no_icon' );
|
| 113 |
+
}
|
| 114 |
+
if ( ! empty( $old_extra ) ) {
|
| 115 |
+
// nothing
|
| 116 |
+
}
|
| 117 |
+
if ( ! empty( $old_screen ) ) {
|
| 118 |
+
$admin_link_values[ 'own_admin_menu' ] = ( 'admin.php' == $val( $old_screen, 'menu_position' ) ) ? '1' : '';
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
// delete old values
|
| 122 |
+
delete_option( 'wp_external_links-meta' );
|
| 123 |
+
delete_option( 'wp_external_links-main' );
|
| 124 |
+
delete_option( 'wp_external_links-seo' );
|
| 125 |
+
delete_option( 'wp_external_links-style' );
|
| 126 |
+
delete_option( 'wp_external_links-extra' );
|
| 127 |
+
delete_option( 'wp_external_links-screen' );
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
// update new values
|
| 131 |
+
update_option( 'wpel-external-link-settings', $external_link_values );
|
| 132 |
+
update_option( 'wpel-internal-link-settings', $internal_link_values );
|
| 133 |
+
update_option( 'wpel-excluded-link-settings', $excluded_link_values );
|
| 134 |
+
update_option( 'wpel-exceptions-settings', $exceptions_link_values );
|
| 135 |
+
update_option( 'wpel-admin-settings', $admin_link_values );
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
/*?>*/
|
includes/register-hooks/class-wpel-activation.php
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Activation
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Activation extends FWP_Register_Hook_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
protected $hook_type = 'activation';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Activate network
|
| 23 |
+
* @return void
|
| 24 |
+
*/
|
| 25 |
+
protected function network_procedure()
|
| 26 |
+
{
|
| 27 |
+
$network_already_set = get_site_option( 'wpel-network-settings' );
|
| 28 |
+
|
| 29 |
+
if ( $network_already_set ) {
|
| 30 |
+
return;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
// network default settings
|
| 34 |
+
$network_values = WPEL_Network_Fields::get_instance()->get_default_values();
|
| 35 |
+
$network_admin_values = WPEL_Network_Admin_Fields::get_instance()->get_default_values();
|
| 36 |
+
|
| 37 |
+
update_site_option( 'wpel-network-settings', $network_values );
|
| 38 |
+
update_site_option( 'wpel-network-admin-settings', $network_admin_values );
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Activate site
|
| 43 |
+
* @return void
|
| 44 |
+
*/
|
| 45 |
+
protected function site_procedure()
|
| 46 |
+
{
|
| 47 |
+
$site_already_set = get_option( 'wpel-external-link-settings' );
|
| 48 |
+
|
| 49 |
+
if ( $site_already_set ) {
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// get default values
|
| 54 |
+
$external_link_values = WPEL_External_Link_Fields::get_instance()->get_default_values();
|
| 55 |
+
$internal_link_values = WPEL_Internal_Link_Fields::get_instance()->get_default_values();
|
| 56 |
+
$excluded_link_values = WPEL_Excluded_Link_Fields::get_instance()->get_default_values();
|
| 57 |
+
$exceptions_link_values = WPEL_Exceptions_Fields::get_instance()->get_default_values();
|
| 58 |
+
$admin_link_values = WPEL_Admin_Fields::get_instance()->get_default_values();
|
| 59 |
+
|
| 60 |
+
// update new values
|
| 61 |
+
update_option( 'wpel-external-link-settings', $external_link_values );
|
| 62 |
+
update_option( 'wpel-internal-link-settings', $internal_link_values );
|
| 63 |
+
update_option( 'wpel-excluded-link-settings', $excluded_link_values );
|
| 64 |
+
update_option( 'wpel-exceptions-settings', $exceptions_link_values );
|
| 65 |
+
update_option( 'wpel-admin-settings', $admin_link_values );
|
| 66 |
+
|
| 67 |
+
// update meta data
|
| 68 |
+
$plugin_data = get_plugin_data( WPEL_Plugin::get_plugin_file() );
|
| 69 |
+
update_option( 'wpel-version', $plugin_data[ 'Version' ] );
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/*?>*/
|
includes/register-hooks/class-wpel-uninstall.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPEL_Uninstall
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
final class WPEL_Uninstall extends FWP_Register_Hook_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
protected $hook_type = 'uninstall';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Activate network
|
| 23 |
+
* @return void
|
| 24 |
+
*/
|
| 25 |
+
protected function network_procedure()
|
| 26 |
+
{
|
| 27 |
+
// network settings
|
| 28 |
+
delete_site_option( 'wpel-network-settings' );
|
| 29 |
+
delete_site_option( 'wpel-network-admin-settings' );
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Activate site
|
| 34 |
+
* @return void
|
| 35 |
+
*/
|
| 36 |
+
protected function site_procedure()
|
| 37 |
+
{
|
| 38 |
+
// delete options
|
| 39 |
+
delete_option( 'wpel-external-link-settings' );
|
| 40 |
+
delete_option( 'wpel-internal-link-settings' );
|
| 41 |
+
delete_option( 'wpel-excluded-link-settings' );
|
| 42 |
+
delete_option( 'wpel-exceptions-settings' );
|
| 43 |
+
delete_option( 'wpel-admin-settings' );
|
| 44 |
+
|
| 45 |
+
delete_option( 'wpel-version' );
|
| 46 |
+
delete_option( 'wpel-show-notice' );
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/*?>*/
|
languages/wp-external-links-de_DE.mo
ADDED
|
Binary file
|
languages/wp-external-links-de_DE.po
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Translation of Development (trunk) in German
|
| 2 |
+
# This file is distributed under the same license as the Development (trunk) package.
|
| 3 |
+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"PO-Revision-Date: 2016-02-27 09:47:58+0000\n"
|
| 6 |
+
"MIME-Version: 1.0\n"
|
| 7 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 8 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 9 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
| 10 |
+
"X-Generator: GlotPress/2.1.0-alpha\n"
|
| 11 |
+
"Project-Id-Version: Development (trunk)\n"
|
| 12 |
+
|
| 13 |
+
#: includes/admin/class-wpel-network-page.php:38
|
| 14 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:26
|
| 15 |
+
msgid "Multi Site Settings"
|
| 16 |
+
msgstr "Multisite-Einstellungen"
|
| 17 |
+
|
| 18 |
+
#: includes/admin/class-wpel-network-page.php:48
|
| 19 |
+
#: includes/admin/class-wpel-settings-page.php:70
|
| 20 |
+
#: templates/partials/tab-contents/support.php:17
|
| 21 |
+
msgid "Support"
|
| 22 |
+
msgstr "Support"
|
| 23 |
+
|
| 24 |
+
#: includes/admin/class-wpel-network-page.php:185
|
| 25 |
+
#: includes/admin/class-wpel-settings-page.php:233
|
| 26 |
+
#: templates/network-page/help-tabs/under-construction.php:14
|
| 27 |
+
#: templates/settings-page/help-tabs/under-construction.php:14
|
| 28 |
+
msgid "Under Construction"
|
| 29 |
+
msgstr "In Arbeit"
|
| 30 |
+
|
| 31 |
+
#: includes/admin/class-wpel-settings-page.php:50
|
| 32 |
+
#: includes/admin/settings-fields/class-wpel-internal-link-fields.php:33
|
| 33 |
+
msgid "Internal Links"
|
| 34 |
+
msgstr "Interne Links"
|
| 35 |
+
|
| 36 |
+
#: includes/admin/class-wpel-settings-page.php:55
|
| 37 |
+
#: includes/admin/settings-fields/class-wpel-excluded-link-fields.php:33
|
| 38 |
+
msgid "Excluded Links"
|
| 39 |
+
msgstr "Ausgeschlossene Links"
|
| 40 |
+
|
| 41 |
+
#: includes/admin/class-wpel-settings-page.php:60
|
| 42 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:26
|
| 43 |
+
msgid "Exceptions"
|
| 44 |
+
msgstr "Ausnahmen"
|
| 45 |
+
|
| 46 |
+
#: includes/admin/class-wpel-settings-page.php:238
|
| 47 |
+
msgid "Data Attributes"
|
| 48 |
+
msgstr "Data Attributes"
|
| 49 |
+
|
| 50 |
+
#: includes/admin/network-fields/class-wpel-network-admin-fields.php:26
|
| 51 |
+
msgid "Network Admin Settings"
|
| 52 |
+
msgstr "Netzwerk-Admin-Einstellungen"
|
| 53 |
+
|
| 54 |
+
#: includes/admin/network-fields/class-wpel-network-admin-fields.php:29
|
| 55 |
+
msgid "Main Network Admin Menu:"
|
| 56 |
+
msgstr "Netzwerk-Admin-Menü:"
|
| 57 |
+
|
| 58 |
+
#: includes/admin/network-fields/class-wpel-network-admin-fields.php:80
|
| 59 |
+
msgid "Create own network admin menu for this plugin"
|
| 60 |
+
msgstr "Erstelle eigenen Netzwerk-Admin-Menüpunkt für das Plugin"
|
| 61 |
+
|
| 62 |
+
#: includes/admin/network-fields/class-wpel-network-admin-fields.php:86
|
| 63 |
+
#: includes/admin/settings-fields/class-wpel-admin-fields.php:50
|
| 64 |
+
msgid "Or else it will be added to the \"Settings\" menu"
|
| 65 |
+
msgstr "Andernfalls wird es unter \"Einstellungen\" angezeigt."
|
| 66 |
+
|
| 67 |
+
#: includes/admin/network-fields/class-wpel-network-admin-fields.php:105
|
| 68 |
+
#: includes/admin/settings-fields/class-wpel-admin-fields.php:69
|
| 69 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:212
|
| 70 |
+
#: includes/admin/settings-fields/class-wpel-external-link-fields.php:85
|
| 71 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:301
|
| 72 |
+
msgid "Something went wrong. One or more values were invalid."
|
| 73 |
+
msgstr "Ein Fehler ist aufgetreten. Ein oder mehrere Werte sind ungültig."
|
| 74 |
+
|
| 75 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:29
|
| 76 |
+
msgid "Capability for individual sites:"
|
| 77 |
+
msgstr "Berechtigung für individuelle Sites:"
|
| 78 |
+
|
| 79 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:33
|
| 80 |
+
msgid "Use the settings of this site as default for new sites:"
|
| 81 |
+
msgstr "Verwende die Einstellungen dieser Site als Standard für neue Sites:"
|
| 82 |
+
|
| 83 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:89
|
| 84 |
+
msgid "Site Admins and Super Admins"
|
| 85 |
+
msgstr "Admins oder Super Admins"
|
| 86 |
+
|
| 87 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:90
|
| 88 |
+
msgid "Only Super Admins"
|
| 89 |
+
msgstr "Nur Super-Admins"
|
| 90 |
+
|
| 91 |
+
#: includes/admin/network-fields/class-wpel-network-fields.php:100
|
| 92 |
+
msgid "- none -"
|
| 93 |
+
msgstr "- keine -"
|
| 94 |
+
|
| 95 |
+
#: includes/admin/settings-fields/class-wpel-admin-fields.php:29
|
| 96 |
+
msgid "Main Admin Menu:"
|
| 97 |
+
msgstr "Admin-Menü:"
|
| 98 |
+
|
| 99 |
+
#: includes/admin/settings-fields/class-wpel-admin-fields.php:44
|
| 100 |
+
msgid "Create own admin menu for this plugin"
|
| 101 |
+
msgstr "Erstelle eigenen Admin-Menüpunkt für das Plugin"
|
| 102 |
+
|
| 103 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:29
|
| 104 |
+
msgid "Apply settings on:"
|
| 105 |
+
msgstr "Einstellungen anwenden auf:"
|
| 106 |
+
|
| 107 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:49
|
| 108 |
+
msgid "Include external links by URL:"
|
| 109 |
+
msgstr "Externe URLs einschließen: "
|
| 110 |
+
|
| 111 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:52
|
| 112 |
+
msgid "Exclude external links by URL:"
|
| 113 |
+
msgstr "Externe URLs ausschließen:"
|
| 114 |
+
|
| 115 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:55
|
| 116 |
+
msgid "Own settings for excluded links:"
|
| 117 |
+
msgstr "Ausgeschlossene Links:"
|
| 118 |
+
|
| 119 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:58
|
| 120 |
+
msgid "Skip <code><script></code>:"
|
| 121 |
+
msgstr "Ignoriere <code><script></code>:"
|
| 122 |
+
|
| 123 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:62
|
| 124 |
+
msgid "Skip <code>mailto</code> links:"
|
| 125 |
+
msgstr "Ignoriere <code>mailto</code>-Links:"
|
| 126 |
+
|
| 127 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:77
|
| 128 |
+
msgid "All contents (the whole page)"
|
| 129 |
+
msgstr "Alle Inhalte (die ganze Seite)"
|
| 130 |
+
|
| 131 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:155
|
| 132 |
+
msgid "Treat excluded links as internal links"
|
| 133 |
+
msgstr "Behandle ausgeschlossene Links wie interne Links"
|
| 134 |
+
|
| 135 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:163
|
| 136 |
+
msgid "Own settings for excluded links <span class=\"description\">(extra tab)</span>"
|
| 137 |
+
msgstr "Eigene Einstellungen <span class=\"description\">(extra Tab)</span>"
|
| 138 |
+
|
| 139 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:174
|
| 140 |
+
msgid "Ignore all links in <code><script></code> blocks"
|
| 141 |
+
msgstr "Ignoriere Links in <code><script></code>-Blöcken"
|
| 142 |
+
|
| 143 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:184
|
| 144 |
+
msgid "Ignore all <code>mailto</code> links"
|
| 145 |
+
msgstr "Ignoriere <code>mailto</code>-Links"
|
| 146 |
+
|
| 147 |
+
#: includes/admin/settings-fields/class-wpel-excluded-link-fields.php:25
|
| 148 |
+
msgid "Settings for excluded links:"
|
| 149 |
+
msgstr "Einstellungen für ausgeschlossene Links:"
|
| 150 |
+
|
| 151 |
+
#: includes/admin/settings-fields/class-wpel-excluded-link-fields.php:26
|
| 152 |
+
msgid "Open excluded links:"
|
| 153 |
+
msgstr "Öffne ausgeschlossene Links:"
|
| 154 |
+
|
| 155 |
+
#: includes/admin/settings-fields/class-wpel-external-link-fields.php:25
|
| 156 |
+
msgid "Settings for external links:"
|
| 157 |
+
msgstr "Einstellungen für externe Links:"
|
| 158 |
+
|
| 159 |
+
#: includes/admin/settings-fields/class-wpel-external-link-fields.php:27
|
| 160 |
+
msgid "Open external links:"
|
| 161 |
+
msgstr "Öffne externe Links:"
|
| 162 |
+
|
| 163 |
+
#: includes/admin/settings-fields/class-wpel-internal-link-fields.php:25
|
| 164 |
+
msgid "Settings for internal links:"
|
| 165 |
+
msgstr "Einstellungen für interne Links:"
|
| 166 |
+
|
| 167 |
+
#: includes/admin/settings-fields/class-wpel-internal-link-fields.php:26
|
| 168 |
+
msgid "Open internal links:"
|
| 169 |
+
msgstr "Öffne interne Links:"
|
| 170 |
+
|
| 171 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:24
|
| 172 |
+
msgid "Settings for links:"
|
| 173 |
+
msgstr "Einstellungen für Links:"
|
| 174 |
+
|
| 175 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:28
|
| 176 |
+
msgid "Open links:"
|
| 177 |
+
msgstr "Öffne Links:"
|
| 178 |
+
|
| 179 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:37
|
| 180 |
+
msgid "Set <code>follow</code> or <code>nofollow</code>:"
|
| 181 |
+
msgstr "Setze <code>follow</code> oder <code>nofollow</code>:"
|
| 182 |
+
|
| 183 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:56
|
| 184 |
+
msgid "Set <code>title</code>:"
|
| 185 |
+
msgstr "Setze <code>title</code>:"
|
| 186 |
+
|
| 187 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:61
|
| 188 |
+
msgid "Add CSS class(es):"
|
| 189 |
+
msgstr "CSS-Klasse(n):"
|
| 190 |
+
|
| 191 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:65
|
| 192 |
+
msgid "Choose icon type:"
|
| 193 |
+
msgstr "Wähle Icon-Typ:"
|
| 194 |
+
|
| 195 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:69
|
| 196 |
+
msgid "Choose icon image:"
|
| 197 |
+
msgstr "Wähle Icon-Datei:"
|
| 198 |
+
|
| 199 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:74
|
| 200 |
+
msgid "Choose dashicon:"
|
| 201 |
+
msgstr "Wähle Dashicon:"
|
| 202 |
+
|
| 203 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:78
|
| 204 |
+
msgid "Choose FA icon:"
|
| 205 |
+
msgstr "Wähle FA-Icon:"
|
| 206 |
+
|
| 207 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:82
|
| 208 |
+
msgid "Icon position:"
|
| 209 |
+
msgstr "Icon-Position:"
|
| 210 |
+
|
| 211 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:87
|
| 212 |
+
msgid "Skip icon with <code><img></code>:"
|
| 213 |
+
msgstr "Kein Icon für <code><img></code>-Links:"
|
| 214 |
+
|
| 215 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:102
|
| 216 |
+
msgid "Apply these settings"
|
| 217 |
+
msgstr "Einstellungen aktivieren"
|
| 218 |
+
|
| 219 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:113
|
| 220 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:137
|
| 221 |
+
msgid "- keep as is -"
|
| 222 |
+
msgstr "- keine Änderung -"
|
| 223 |
+
|
| 224 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:114
|
| 225 |
+
msgid "in the same window, tab or frame"
|
| 226 |
+
msgstr "im selben Fenster/Tab oder Frame"
|
| 227 |
+
|
| 228 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:115
|
| 229 |
+
msgid "each in a separate new window or tab"
|
| 230 |
+
msgstr "jeden in neuem Fenster/Tab"
|
| 231 |
+
|
| 232 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:116
|
| 233 |
+
msgid "all in the same new window or tab"
|
| 234 |
+
msgstr "alle im selben Fenster/Tab"
|
| 235 |
+
|
| 236 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:117
|
| 237 |
+
msgid "in the topmost frame"
|
| 238 |
+
msgstr "im obersten Frame"
|
| 239 |
+
|
| 240 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:126
|
| 241 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:148
|
| 242 |
+
msgid "Overwrite existing values."
|
| 243 |
+
msgstr "Überschreibe vorhandene Werte."
|
| 244 |
+
|
| 245 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:138
|
| 246 |
+
msgid "follow"
|
| 247 |
+
msgstr "follow"
|
| 248 |
+
|
| 249 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:139
|
| 250 |
+
msgid "nofollow"
|
| 251 |
+
msgstr "nofollow"
|
| 252 |
+
|
| 253 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:158
|
| 254 |
+
msgid "Add <code>\"noopener\"</code>"
|
| 255 |
+
msgstr "Füge <code>\"noopener\"</code> hinzu"
|
| 256 |
+
|
| 257 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:168
|
| 258 |
+
msgid "Add <code>\"noreferrer\"</code>"
|
| 259 |
+
msgstr "Füge <code>\"noreferrer\"</code> hinzu"
|
| 260 |
+
|
| 261 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:198
|
| 262 |
+
msgid "- no icon -"
|
| 263 |
+
msgstr "- kein Icon -"
|
| 264 |
+
|
| 265 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:199
|
| 266 |
+
msgid "Image"
|
| 267 |
+
msgstr "Icon-Datei"
|
| 268 |
+
|
| 269 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:200
|
| 270 |
+
msgid "Dashicon"
|
| 271 |
+
msgstr "Dashicon"
|
| 272 |
+
|
| 273 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:201
|
| 274 |
+
msgid "Font Awesome"
|
| 275 |
+
msgstr "FontAwesome"
|
| 276 |
+
|
| 277 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:265
|
| 278 |
+
msgid "Left side of the link"
|
| 279 |
+
msgstr "vor dem Link"
|
| 280 |
+
|
| 281 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:266
|
| 282 |
+
msgid "Right side of the link"
|
| 283 |
+
msgstr "nach dem Link"
|
| 284 |
+
|
| 285 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:275
|
| 286 |
+
msgid "No icon for links already containing an <code><img></code>-tag."
|
| 287 |
+
msgstr "Kein Icon für Links mit <code><img></code>-Tag."
|
| 288 |
+
|
| 289 |
+
#: templates/network-page/help-tabs/under-construction.php:16
|
| 290 |
+
#: templates/settings-page/help-tabs/under-construction.php:16
|
| 291 |
+
msgid "Still working on the documentation..."
|
| 292 |
+
msgstr "Wir arbeiten hart an der Dokumentation..."
|
| 293 |
+
|
| 294 |
+
#: templates/partials/tab-contents/support.php:19
|
| 295 |
+
msgid "Documentation"
|
| 296 |
+
msgstr "Dokumentation"
|
| 297 |
+
|
| 298 |
+
#: templates/partials/tab-contents/support.php:20
|
| 299 |
+
msgid "Take a look at the <a href=\"#\" data-wpel-help>help section</a> for documentation"
|
| 300 |
+
msgstr "Wirf einen Blick in die <a href=\"#\" data-wpel-help>Hilfe-Sektion</a> für weiterführende Dokumentation."
|
| 301 |
+
|
| 302 |
+
#: templates/partials/tab-contents/support.php:22
|
| 303 |
+
msgid "FAQ"
|
| 304 |
+
msgstr "FAQ"
|
| 305 |
+
|
| 306 |
+
#: templates/partials/tab-contents/support.php:23
|
| 307 |
+
msgid "On the <a href=\"https://wordpress.org/plugins/wp-external-links/faq/\" target=\"_blank\">FAQ page</a> you can find some additional tips & trics."
|
| 308 |
+
msgstr "Auf der <a href=\"https://wordpress.org/plugins/wp-external-links/faq/\" target=\"_blank\">FAQ-Seite</a> des Plugins findest du weitere Tipps & Informationen."
|
| 309 |
+
|
| 310 |
+
#: templates/partials/tab-contents/support.php:25
|
| 311 |
+
msgid "Reported issues"
|
| 312 |
+
msgstr "Bisher gemeldete Fälle"
|
| 313 |
+
|
| 314 |
+
#: templates/partials/tab-contents/support.php:26
|
| 315 |
+
msgid "When you experience problems using this plugin please look if your problem was <a href=\"https://wordpress.org/support/plugin/wp-external-links\" target=\"_blank\">already reported</a>."
|
| 316 |
+
msgstr "Wenn du Probleme bei der Verwendung des Plugins hast besuche bitte unser Support-Forum und prüfe, ob das/ein ähnliches Problem nicht <a href=\"https://wordpress.org/support/plugin/wp-external-links\" target=\"_blank\">bereits gemeldet</a> wurde."
|
| 317 |
+
|
| 318 |
+
#: templates/partials/tab-contents/support.php:28
|
| 319 |
+
msgid "Send your issue"
|
| 320 |
+
msgstr "Melde dein Problem"
|
| 321 |
+
|
| 322 |
+
#: templates/partials/tab-contents/support.php:29
|
| 323 |
+
msgid "If it wasn't yet reported then you can <a href=\"https://wordpress.org/support/plugin/wp-external-links#postform\" target=\"_blank\">send your problem</a>."
|
| 324 |
+
msgstr "Wenn du im Support-Forum nicht fündig wirst, <a href=\"https://wordpress.org/support/plugin/wp-external-links#postform\" target=\"_blank\">melde uns dein Problem</a>."
|
| 325 |
+
|
| 326 |
+
#: templates/partials/tab-contents/support.php:30
|
| 327 |
+
msgid "Please after reporting send me the following technical information <a href=\"http://www.finewebdev.com/contact\" target=\"_blank\">by mail</a>. That will make it easier to solve the problem."
|
| 328 |
+
msgstr "Nach der Meldung eines Problems sende bitte die folgende techn. Information <a href=\"http://www.finewebdev.com/contact\" target=\"_blank\">per E-Mail</a> an uns. Das macht es leichter, das Problem zu lösen."
|
| 329 |
+
|
| 330 |
+
#: templates/partials/tab-contents/support.php:33
|
| 331 |
+
msgid "Copy Technical Info"
|
| 332 |
+
msgstr "Kopiere tech. Info"
|
| 333 |
+
|
| 334 |
+
#: templates/partials/tab-contents/support.php:37
|
| 335 |
+
msgid "WP url:"
|
| 336 |
+
msgstr "WordPress-URL:"
|
| 337 |
+
|
| 338 |
+
#: templates/partials/tab-contents/support.php:39
|
| 339 |
+
msgid "WP version:"
|
| 340 |
+
msgstr "WordPress-Version:"
|
| 341 |
+
|
| 342 |
+
#: templates/partials/tab-contents/support.php:41
|
| 343 |
+
msgid "PHP version:"
|
| 344 |
+
msgstr "PHP-Version:"
|
| 345 |
+
|
| 346 |
+
#: templates/partials/tab-contents/support.php:43
|
| 347 |
+
msgid "Active Plugins:"
|
| 348 |
+
msgstr "Aktivierte Plugins:"
|
| 349 |
+
|
| 350 |
+
#: templates/partials/tab-contents/support.php:57
|
| 351 |
+
msgid "WPEL Settings:"
|
| 352 |
+
msgstr "WP External Links - Einstellungen:"
|
| 353 |
+
|
| 354 |
+
#: templates/settings-page/help-tabs/data-attributes.php:14
|
| 355 |
+
msgid "Exclude or include by data-attribute"
|
| 356 |
+
msgstr "Anhand Data Attribute aus- bzw. einschließen"
|
| 357 |
+
|
| 358 |
+
#: templates/settings-page/help-tabs/data-attributes.php:16
|
| 359 |
+
msgid "The <code>data-wpel-link</code> attribute can be set on links and forces the plugin to treat those links that way."
|
| 360 |
+
msgstr "Das <code>data-wpel-link</code>-Attribut kann für Links vergeben werden und zwingt das Plugin, diese Links gesondert zu behandeln."
|
| 361 |
+
|
| 362 |
+
#: templates/settings-page/help-tabs/data-attributes.php:19
|
| 363 |
+
msgid "Links with <code>data-wpel-link=\"internal\"</code> will be treated as internal links."
|
| 364 |
+
msgstr "Links mit <code>data-wpel-link=\"internal\"</code> werden wie interne Links behandelt."
|
| 365 |
+
|
| 366 |
+
#: templates/settings-page/help-tabs/data-attributes.php:20
|
| 367 |
+
msgid "Links with <code>data-wpel-link=\"external\"</code> will be treated as external links."
|
| 368 |
+
msgstr "Links mit <code>data-wpel-link=\"external\"</code> werden wie externe Links behandelt."
|
| 369 |
+
|
| 370 |
+
#: templates/settings-page/help-tabs/data-attributes.php:21
|
| 371 |
+
msgid "Links with <code>data-wpel-link=\"exclude\"</code> will be treated as excluded links (which have their own settings or will be treated as internal links)."
|
| 372 |
+
msgstr "Links mit <code>data-wpel-link=\"exclude\"</code> werden wie ausgeschlossene Links behandelt (mit eigenen Einstellungen oder wie interne Links)."
|
| 373 |
+
|
| 374 |
+
#: templates/settings-page/help-tabs/data-attributes.php:22
|
| 375 |
+
msgid "Links with <code>data-wpel-link=\"ignore\"</code> will be completely ignored by this plugin."
|
| 376 |
+
msgstr "Links mit <code>data-wpel-link=\"ignore\"</code> werden ignoriert."
|
| 377 |
+
|
| 378 |
+
#: templates/settings-page/tab-contents/exceptions.php:22
|
| 379 |
+
msgid "The data-attribute <a href=\"#\" data-wpel-help=\"data-attributes\"><code>data-wpel-link</code></a> can be set on individual links to treat them as internal, external or excluded, or to completely ignore links form being processed by this plugin."
|
| 380 |
+
msgstr "Das Data Attribute <a href=\"#\" data-wpel-help=\"data-attributes\"><code>data-wpel-link</code></a> kann für individuelle Links vergeben werden, um diese wie interne, externe oder ausgeschlossene Links zu behandeln, oder um sie vollständig zu ignorieren."
|
| 381 |
+
|
| 382 |
+
#. Plugin URI of the plugin/theme
|
| 383 |
+
msgid "https://wordpress.org/plugins/wp-external-links/"
|
| 384 |
+
msgstr "https://wordpress.org/plugins/wp-external-links/"
|
| 385 |
+
|
| 386 |
+
#. Description of the plugin/theme
|
| 387 |
+
msgid "Open external links in a new tab or window, adding \"nofollow\" and \"noopener\", set font icon, SEO friendly options and more."
|
| 388 |
+
msgstr "Bietet Optionen, um externe und interne Verknüpfungen (\"Links\") gesondert zu behandeln; ermöglicht das Hinzufügen von \"nofollow\"/\"noopener\", Auszeichnung von Links mit Icons, SEO-freundlichen Einstellungen und mehr."
|
| 389 |
+
|
| 390 |
+
#. Author URI of the plugin/theme
|
| 391 |
+
msgid "http://www.finewebdev.com"
|
| 392 |
+
msgstr "http://www.finewebdev.com"
|
| 393 |
+
|
| 394 |
+
#. #-#-#-#-# tmp-wp-external-links.pot (WP External Links 2.1.0) #-#-#-#-#
|
| 395 |
+
#. Plugin Name of the plugin/theme
|
| 396 |
+
#: includes/admin/class-wpel-network-page.php:103
|
| 397 |
+
#: includes/admin/class-wpel-network-page.php:114
|
| 398 |
+
#: includes/admin/class-wpel-settings-page.php:132
|
| 399 |
+
#: includes/admin/class-wpel-settings-page.php:142
|
| 400 |
+
msgid "WP External Links"
|
| 401 |
+
msgstr "WP External Links"
|
| 402 |
+
|
| 403 |
+
#: includes/admin/class-wpel-network-page.php:104
|
| 404 |
+
#: includes/admin/class-wpel-network-page.php:115
|
| 405 |
+
#: includes/admin/class-wpel-settings-page.php:45
|
| 406 |
+
#: includes/admin/class-wpel-settings-page.php:133
|
| 407 |
+
#: includes/admin/class-wpel-settings-page.php:143
|
| 408 |
+
#: includes/admin/settings-fields/class-wpel-external-link-fields.php:52
|
| 409 |
+
msgid "External Links"
|
| 410 |
+
msgstr "Externe Links"
|
| 411 |
+
|
| 412 |
+
#: includes/admin/class-wpel-network-page.php:43
|
| 413 |
+
#: includes/admin/class-wpel-settings-page.php:65
|
| 414 |
+
#: includes/admin/settings-fields/class-wpel-admin-fields.php:26
|
| 415 |
+
msgid "Admin Settings"
|
| 416 |
+
msgstr "Admin-Einstellungen"
|
| 417 |
+
|
| 418 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:87
|
| 419 |
+
msgid "Post content"
|
| 420 |
+
msgstr "Beiträge/Seiten"
|
| 421 |
+
|
| 422 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:107
|
| 423 |
+
msgid "All widgets"
|
| 424 |
+
msgstr "Alle Widgets"
|
| 425 |
+
|
| 426 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:46
|
| 427 |
+
msgid "Make subdomains internal:"
|
| 428 |
+
msgstr "Behandle Subdomains als interne Links:"
|
| 429 |
+
|
| 430 |
+
#: includes/admin/settings-fields/class-wpel-exceptions-fields.php:117
|
| 431 |
+
msgid "Treat all links to the site's domain and subdomains as internal links"
|
| 432 |
+
msgstr "Behandle alle Links zur eigenen Domain und Subdomains wie interne Links"
|
| 433 |
+
|
| 434 |
+
#: includes/admin/settings-fields/class-wpel-link-fields-base.php:46
|
| 435 |
+
msgid "Also add to <code>rel</code> attribute:"
|
| 436 |
+
msgstr "<code>rel</code>-Attribut:"
|
| 437 |
+
|
| 438 |
+
#: includes/admin/settings-fields/class-wpel-external-link-fields.php:65
|
| 439 |
+
msgid "Add <code>\"external\"</code>"
|
| 440 |
+
msgstr "Füge <code>\"external\"</code> hinzu"
|
| 441 |
+
|
| 442 |
+
#. Author of the plugin/theme
|
| 443 |
+
msgid "Victor Villaverde Laan"
|
| 444 |
+
msgstr "Victor Villaverde Laan"
|
libs/fwp/class-fwp-debug.php
CHANGED
|
@@ -1,112 +1,113 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class FWP_Debug_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* @package FWP
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
class FWP_Debug_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
private $settings = array(
|
| 20 |
-
'debug_func_name' => 'debug',
|
| 21 |
-
'log_hooks' => false,
|
| 22 |
-
);
|
| 23 |
-
|
| 24 |
-
/**
|
| 25 |
-
* @var array
|
| 26 |
-
*/
|
| 27 |
-
private static $benchmarks = array();
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Initialize
|
| 31 |
-
* @param array $settings Optional
|
| 32 |
-
*/
|
| 33 |
-
protected function init( array $settings = array() )
|
| 34 |
-
{
|
| 35 |
-
$this->settings = wp_parse_args( $settings, $this->settings );
|
| 36 |
-
|
| 37 |
-
$this->create_func();
|
| 38 |
-
|
| 39 |
-
if ( $this->settings[ 'log_hooks' ] ) {
|
| 40 |
-
register_shutdown_function( $this->get_callback( 'log_hooks' ) );
|
| 41 |
-
}
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
-
/**
|
| 45 |
-
* Create logbal debug function
|
| 46 |
-
* @return void
|
| 47 |
-
*/
|
| 48 |
-
private function create_func()
|
| 49 |
-
{
|
| 50 |
-
$func = $this->settings[ 'debug_func_name' ];
|
| 51 |
-
|
| 52 |
-
if ( function_exists( $func ) || !is_callable( $func, true ) ) {
|
| 53 |
-
return;
|
| 54 |
-
}
|
| 55 |
-
|
| 56 |
-
eval( 'function '. $func .'( $entry, $title = "" ) { FWP_Debug_1x0x0::log( $entry, $title ); }' );
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
/**
|
| 60 |
-
* @param mixed $entry
|
| 61 |
-
*/
|
| 62 |
-
public static function log( $entry, $title = '' )
|
| 63 |
-
{
|
| 64 |
-
$content = '';
|
| 65 |
-
|
| 66 |
-
if ( !empty($title) ) {
|
| 67 |
-
$content = $title . ': ';
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
$content .= var_export( $entry, true );
|
| 71 |
-
|
| 72 |
-
error_log( $content );
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
/**
|
| 76 |
-
* Log all hooks being applied
|
| 77 |
-
* @global
|
| 78 |
-
*/
|
| 79 |
-
protected function log_hooks()
|
| 80 |
-
{
|
| 81 |
-
global $
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Debug_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
class FWP_Debug_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var array
|
| 18 |
+
*/
|
| 19 |
+
private $settings = array(
|
| 20 |
+
'debug_func_name' => 'debug',
|
| 21 |
+
'log_hooks' => false,
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* @var array
|
| 26 |
+
*/
|
| 27 |
+
private static $benchmarks = array();
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Initialize
|
| 31 |
+
* @param array $settings Optional
|
| 32 |
+
*/
|
| 33 |
+
protected function init( array $settings = array() )
|
| 34 |
+
{
|
| 35 |
+
$this->settings = wp_parse_args( $settings, $this->settings );
|
| 36 |
+
|
| 37 |
+
$this->create_func();
|
| 38 |
+
|
| 39 |
+
if ( $this->settings[ 'log_hooks' ] ) {
|
| 40 |
+
register_shutdown_function( $this->get_callback( 'log_hooks' ) );
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/**
|
| 45 |
+
* Create logbal debug function
|
| 46 |
+
* @return void
|
| 47 |
+
*/
|
| 48 |
+
private function create_func()
|
| 49 |
+
{
|
| 50 |
+
$func = $this->settings[ 'debug_func_name' ];
|
| 51 |
+
|
| 52 |
+
if ( function_exists( $func ) || !is_callable( $func, true ) ) {
|
| 53 |
+
return;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
eval( 'function '. $func .'( $entry, $title = "" ) { FWP_Debug_1x0x0::log( $entry, $title ); }' );
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* @param mixed $entry
|
| 61 |
+
*/
|
| 62 |
+
public static function log( $entry, $title = '' )
|
| 63 |
+
{
|
| 64 |
+
$content = '';
|
| 65 |
+
|
| 66 |
+
if ( !empty($title) ) {
|
| 67 |
+
$content = $title . ': ';
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
$content .= var_export( $entry, true );
|
| 71 |
+
|
| 72 |
+
error_log( $content );
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Log all hooks being applied
|
| 77 |
+
* @global array $wp_filter
|
| 78 |
+
*/
|
| 79 |
+
protected function log_hooks()
|
| 80 |
+
{
|
| 81 |
+
global $wp_filter;
|
| 82 |
+
|
| 83 |
+
$hooks = array_keys( $wp_filter );
|
| 84 |
+
self::log( $hooks, 'WP Hooks' );
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/**
|
| 88 |
+
*
|
| 89 |
+
*/
|
| 90 |
+
public static function start_benchmark( $label = 'benchmark' )
|
| 91 |
+
{
|
| 92 |
+
self::$benchmarks[ $label ][ 'start' ] = microtime( true );
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
/**
|
| 96 |
+
*
|
| 97 |
+
*/
|
| 98 |
+
public static function end_benchmark( $label = 'benchmark' )
|
| 99 |
+
{
|
| 100 |
+
$end_time = microtime( true );
|
| 101 |
+
self::$benchmarks[ $label ][ 'end' ] = $end_time;
|
| 102 |
+
$start_time = self::$benchmarks[ $label ][ 'start' ];
|
| 103 |
+
|
| 104 |
+
$total_time = $end_time - $start_time;
|
| 105 |
+
|
| 106 |
+
self::log( $total_time, $label );
|
| 107 |
+
|
| 108 |
+
return $total_time;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
/*?>*/
|
libs/fwp/class-fwp-html-element.php
CHANGED
|
@@ -1,280 +1,280 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class FWP_HTML_Element_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* @package FWP
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
class FWP_HTML_Element_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var string
|
| 18 |
-
*/
|
| 19 |
-
private $tag_name = null;
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @var string
|
| 23 |
-
*/
|
| 24 |
-
private $content = null;
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* @var array
|
| 28 |
-
*/
|
| 29 |
-
private $atts = array();
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* @param string $tag_name
|
| 33 |
-
* @param string $content Optional
|
| 34 |
-
*/
|
| 35 |
-
public function __construct( $tag_name, $content = null )
|
| 36 |
-
{
|
| 37 |
-
$this->tag_name = $tag_name;
|
| 38 |
-
$this->content = $content;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
/**
|
| 42 |
-
* @param string $content
|
| 43 |
-
*/
|
| 44 |
-
public function set_content( $content )
|
| 45 |
-
{
|
| 46 |
-
$this->content = $content;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
/**
|
| 50 |
-
* @return string
|
| 51 |
-
*/
|
| 52 |
-
public function get_content()
|
| 53 |
-
{
|
| 54 |
-
return $this->content;
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
/**
|
| 58 |
-
* Set attributes
|
| 59 |
-
* @param array|string $atts
|
| 60 |
-
*/
|
| 61 |
-
public function set_atts( $atts ) {
|
| 62 |
-
if ( is_string( $atts ) ) {
|
| 63 |
-
$this->atts = $this->parse_atts( $atts );
|
| 64 |
-
} else if ( is_array( $atts ) ) {
|
| 65 |
-
$this->atts = $atts;
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
/**
|
| 70 |
-
* @return string
|
| 71 |
-
*/
|
| 72 |
-
public function get_tag_name()
|
| 73 |
-
{
|
| 74 |
-
return $this->tag_name;
|
| 75 |
-
}
|
| 76 |
-
|
| 77 |
-
/**
|
| 78 |
-
* @param string $name
|
| 79 |
-
* @return string|null
|
| 80 |
-
*/
|
| 81 |
-
public function get_attr( $name )
|
| 82 |
-
{
|
| 83 |
-
if ( ! isset( $this->atts[ $name ] ) ) {
|
| 84 |
-
return null;
|
| 85 |
-
}
|
| 86 |
-
|
| 87 |
-
return $this->atts[ $name ];
|
| 88 |
-
}
|
| 89 |
-
|
| 90 |
-
/**
|
| 91 |
-
* @param string $name
|
| 92 |
-
* @param string $value Optional
|
| 93 |
-
*/
|
| 94 |
-
public function set_attr( $name, $value = null )
|
| 95 |
-
{
|
| 96 |
-
$this->atts[ $name ] = $value;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
-
/**
|
| 100 |
-
* @param string $name
|
| 101 |
-
* @return boolean
|
| 102 |
-
*/
|
| 103 |
-
public function has_attr( $name )
|
| 104 |
-
{
|
| 105 |
-
return isset( $this->atts[ $name ] );
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
/**
|
| 109 |
-
* @param string $name
|
| 110 |
-
*/
|
| 111 |
-
public function remove_attr( $name )
|
| 112 |
-
{
|
| 113 |
-
unset( $this->atts[ $name ] );
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
/**
|
| 117 |
-
* @param string $name
|
| 118 |
-
* @param string $value
|
| 119 |
-
* @return boolean
|
| 120 |
-
*/
|
| 121 |
-
public function has_attr_value( $name, $value )
|
| 122 |
-
{
|
| 123 |
-
if ( ! $this->has_attr( $name ) ) {
|
| 124 |
-
return false;
|
| 125 |
-
}
|
| 126 |
-
|
| 127 |
-
$attr_values = explode( ' ', $this->get_attr( $name ) );
|
| 128 |
-
return in_array( $value, $attr_values );
|
| 129 |
-
}
|
| 130 |
-
|
| 131 |
-
/**
|
| 132 |
-
* @param string $name
|
| 133 |
-
* @param string $value
|
| 134 |
-
* @return void
|
| 135 |
-
*/
|
| 136 |
-
public function add_to_attr( $name, $value )
|
| 137 |
-
{
|
| 138 |
-
if ( empty( $this->atts[ $name ] ) ) {
|
| 139 |
-
$this->set_attr( $name, $value );
|
| 140 |
-
return;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
if ( $this->has_attr_value( $name, $value ) ) {
|
| 144 |
-
return;
|
| 145 |
-
}
|
| 146 |
-
|
| 147 |
-
$this->atts[ $name ] .= ' '. $value;
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
/**
|
| 151 |
-
* @param string $name
|
| 152 |
-
* @param string $value
|
| 153 |
-
* @return void
|
| 154 |
-
*/
|
| 155 |
-
public function remove_from_attr( $name, $value )
|
| 156 |
-
{
|
| 157 |
-
if ( ! $this->has_attr_value( $name, $value ) ) {
|
| 158 |
-
return;
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
-
$attr_values = explode( ' ', $this->atts[ $name ] );
|
| 162 |
-
$new_attr_values = array_diff( $attr_values , array( $value ) );
|
| 163 |
-
|
| 164 |
-
$this->atts[ $name ] = implode( ' ', $new_attr_values );
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
/**
|
| 168 |
-
* @return string
|
| 169 |
-
*/
|
| 170 |
-
public function get_html( $escape_content = true )
|
| 171 |
-
{
|
| 172 |
-
$link = '<'. esc_attr( $this->tag_name );
|
| 173 |
-
|
| 174 |
-
foreach ( $this->atts AS $key => $value ) {
|
| 175 |
-
if ( null === $value ) {
|
| 176 |
-
$link .= ' '. $key;
|
| 177 |
-
} else {
|
| 178 |
-
$link .= ' '. esc_attr( $key ) .'="'. esc_attr( $value ) .'"';
|
| 179 |
-
}
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
$link .= '>';
|
| 183 |
-
|
| 184 |
-
if ( null !== $this->content ) {
|
| 185 |
-
if ( true === $escape_content ) {
|
| 186 |
-
$link .= esc_html( $this->content );
|
| 187 |
-
} else {
|
| 188 |
-
$link .= $this->content;
|
| 189 |
-
}
|
| 190 |
-
|
| 191 |
-
$link .= '</'. esc_attr( $this->tag_name ) .'>';
|
| 192 |
-
}
|
| 193 |
-
|
| 194 |
-
return $link;
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
/**
|
| 198 |
-
* Parse an attributes string into an array. If the string starts with a tag,
|
| 199 |
-
* then the attributes on the first tag are parsed. This parses via a manual
|
| 200 |
-
* loop and is designed to be safer than using DOMDocument.
|
| 201 |
-
*
|
| 202 |
-
* @param string $atts
|
| 203 |
-
* @return array
|
| 204 |
-
*
|
| 205 |
-
* @example parse_attrs( 'src="example.jpg" alt="example"' )
|
| 206 |
-
* @example parse_attrs( '<img src="example.jpg" alt="example">' )
|
| 207 |
-
* @example parse_attrs( '<a href="example"></a>' )
|
| 208 |
-
*
|
| 209 |
-
* @link http://dev.airve.com/demo/speed_tests/php/parse_attrs.php
|
| 210 |
-
*/
|
| 211 |
-
final protected function parse_atts( $atts ) {
|
| 212 |
-
$atts = str_split( trim( $atts ) );
|
| 213 |
-
|
| 214 |
-
if ( '<' === $atts[0] ) { // looks like a tag so strip the tagname
|
| 215 |
-
while ( $atts && ! ctype_space( $atts[0] ) && $atts[0] !== '>' ) {
|
| 216 |
-
array_shift($atts);
|
| 217 |
-
}
|
| 218 |
-
}
|
| 219 |
-
|
| 220 |
-
$arr = array(); // output
|
| 221 |
-
$name = ''; // for the current attr being parsed
|
| 222 |
-
$value = ''; // for the current attr being parsed
|
| 223 |
-
$mode = 0; // whether current char is part of the name (-), the value (+), or neither (0)
|
| 224 |
-
$stop = false; // delimiter for the current $value being parsed
|
| 225 |
-
$space = ' '; // a single space
|
| 226 |
-
|
| 227 |
-
foreach ( $atts as $j => $curr ) {
|
| 228 |
-
if ( $mode < 0 ) { // name
|
| 229 |
-
if ( '=' === $curr ) {
|
| 230 |
-
$mode = 1;
|
| 231 |
-
$stop = false;
|
| 232 |
-
} elseif ( '>' === $curr ) {
|
| 233 |
-
'' === $name or $arr[ $name ] = $value;
|
| 234 |
-
break;
|
| 235 |
-
} elseif ( ! ctype_space( $curr ) ) {
|
| 236 |
-
if ( ctype_space( $atts[ $j - 1 ] ) ) { // previous char
|
| 237 |
-
'' === $name or $arr[ $name ] = ''; // previous name
|
| 238 |
-
$name = $curr; // initiate new
|
| 239 |
-
} else {
|
| 240 |
-
$name .= $curr;
|
| 241 |
-
}
|
| 242 |
-
}
|
| 243 |
-
} elseif ( $mode > 0 ) { // value
|
| 244 |
-
if ( $stop === false ) {
|
| 245 |
-
if ( ! ctype_space( $curr ) ) {
|
| 246 |
-
if ( '"' === $curr || "'" === $curr ) {
|
| 247 |
-
$value = '';
|
| 248 |
-
$stop = $curr;
|
| 249 |
-
} else {
|
| 250 |
-
$value = $curr;
|
| 251 |
-
$stop = $space;
|
| 252 |
-
}
|
| 253 |
-
}
|
| 254 |
-
} elseif ( $stop === $space ? ctype_space( $curr ) : $curr === $stop ) {
|
| 255 |
-
$arr[ $name ] = $value;
|
| 256 |
-
$mode = 0;
|
| 257 |
-
$name = $value = '';
|
| 258 |
-
} else {
|
| 259 |
-
$value .= $curr;
|
| 260 |
-
}
|
| 261 |
-
} else { // neither
|
| 262 |
-
if ( '>' === $curr )
|
| 263 |
-
break;
|
| 264 |
-
if ( ! ctype_space( $curr ) ) {
|
| 265 |
-
// initiate
|
| 266 |
-
$name = $curr;
|
| 267 |
-
$mode = -1;
|
| 268 |
-
}
|
| 269 |
-
}
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
// incl the final pair if it was quoteless
|
| 273 |
-
'' === $name or $arr[ $name ] = $value;
|
| 274 |
-
|
| 275 |
-
return $arr;
|
| 276 |
-
}
|
| 277 |
-
|
| 278 |
-
}
|
| 279 |
-
|
| 280 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_HTML_Element_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
class FWP_HTML_Element_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
private $tag_name = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
private $content = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @var array
|
| 28 |
+
*/
|
| 29 |
+
private $atts = array();
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* @param string $tag_name
|
| 33 |
+
* @param string $content Optional
|
| 34 |
+
*/
|
| 35 |
+
public function __construct( $tag_name, $content = null )
|
| 36 |
+
{
|
| 37 |
+
$this->tag_name = $tag_name;
|
| 38 |
+
$this->content = $content;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* @param string $content
|
| 43 |
+
*/
|
| 44 |
+
public function set_content( $content )
|
| 45 |
+
{
|
| 46 |
+
$this->content = $content;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* @return string
|
| 51 |
+
*/
|
| 52 |
+
public function get_content()
|
| 53 |
+
{
|
| 54 |
+
return $this->content;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Set attributes
|
| 59 |
+
* @param array|string $atts
|
| 60 |
+
*/
|
| 61 |
+
public function set_atts( $atts ) {
|
| 62 |
+
if ( is_string( $atts ) ) {
|
| 63 |
+
$this->atts = $this->parse_atts( $atts );
|
| 64 |
+
} else if ( is_array( $atts ) ) {
|
| 65 |
+
$this->atts = $atts;
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* @return string
|
| 71 |
+
*/
|
| 72 |
+
public function get_tag_name()
|
| 73 |
+
{
|
| 74 |
+
return $this->tag_name;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
/**
|
| 78 |
+
* @param string $name
|
| 79 |
+
* @return string|null
|
| 80 |
+
*/
|
| 81 |
+
public function get_attr( $name )
|
| 82 |
+
{
|
| 83 |
+
if ( ! isset( $this->atts[ $name ] ) ) {
|
| 84 |
+
return null;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
return $this->atts[ $name ];
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* @param string $name
|
| 92 |
+
* @param string $value Optional
|
| 93 |
+
*/
|
| 94 |
+
public function set_attr( $name, $value = null )
|
| 95 |
+
{
|
| 96 |
+
$this->atts[ $name ] = $value;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/**
|
| 100 |
+
* @param string $name
|
| 101 |
+
* @return boolean
|
| 102 |
+
*/
|
| 103 |
+
public function has_attr( $name )
|
| 104 |
+
{
|
| 105 |
+
return isset( $this->atts[ $name ] );
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/**
|
| 109 |
+
* @param string $name
|
| 110 |
+
*/
|
| 111 |
+
public function remove_attr( $name )
|
| 112 |
+
{
|
| 113 |
+
unset( $this->atts[ $name ] );
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/**
|
| 117 |
+
* @param string $name
|
| 118 |
+
* @param string $value
|
| 119 |
+
* @return boolean
|
| 120 |
+
*/
|
| 121 |
+
public function has_attr_value( $name, $value )
|
| 122 |
+
{
|
| 123 |
+
if ( ! $this->has_attr( $name ) ) {
|
| 124 |
+
return false;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
$attr_values = explode( ' ', $this->get_attr( $name ) );
|
| 128 |
+
return in_array( $value, $attr_values );
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* @param string $name
|
| 133 |
+
* @param string $value
|
| 134 |
+
* @return void
|
| 135 |
+
*/
|
| 136 |
+
public function add_to_attr( $name, $value )
|
| 137 |
+
{
|
| 138 |
+
if ( empty( $this->atts[ $name ] ) ) {
|
| 139 |
+
$this->set_attr( $name, $value );
|
| 140 |
+
return;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
if ( $this->has_attr_value( $name, $value ) ) {
|
| 144 |
+
return;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
$this->atts[ $name ] .= ' '. $value;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
/**
|
| 151 |
+
* @param string $name
|
| 152 |
+
* @param string $value
|
| 153 |
+
* @return void
|
| 154 |
+
*/
|
| 155 |
+
public function remove_from_attr( $name, $value )
|
| 156 |
+
{
|
| 157 |
+
if ( ! $this->has_attr_value( $name, $value ) ) {
|
| 158 |
+
return;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
$attr_values = explode( ' ', $this->atts[ $name ] );
|
| 162 |
+
$new_attr_values = array_diff( $attr_values , array( $value ) );
|
| 163 |
+
|
| 164 |
+
$this->atts[ $name ] = implode( ' ', $new_attr_values );
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* @return string
|
| 169 |
+
*/
|
| 170 |
+
public function get_html( $escape_content = true )
|
| 171 |
+
{
|
| 172 |
+
$link = '<'. esc_attr( $this->tag_name );
|
| 173 |
+
|
| 174 |
+
foreach ( $this->atts AS $key => $value ) {
|
| 175 |
+
if ( null === $value ) {
|
| 176 |
+
$link .= ' '. $key;
|
| 177 |
+
} else {
|
| 178 |
+
$link .= ' '. esc_attr( $key ) .'="'. esc_attr( $value ) .'"';
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
$link .= '>';
|
| 183 |
+
|
| 184 |
+
if ( null !== $this->content ) {
|
| 185 |
+
if ( true === $escape_content ) {
|
| 186 |
+
$link .= esc_html( $this->content );
|
| 187 |
+
} else {
|
| 188 |
+
$link .= $this->content;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
$link .= '</'. esc_attr( $this->tag_name ) .'>';
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
return $link;
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
/**
|
| 198 |
+
* Parse an attributes string into an array. If the string starts with a tag,
|
| 199 |
+
* then the attributes on the first tag are parsed. This parses via a manual
|
| 200 |
+
* loop and is designed to be safer than using DOMDocument.
|
| 201 |
+
*
|
| 202 |
+
* @param string $atts
|
| 203 |
+
* @return array
|
| 204 |
+
*
|
| 205 |
+
* @example parse_attrs( 'src="example.jpg" alt="example"' )
|
| 206 |
+
* @example parse_attrs( '<img src="example.jpg" alt="example">' )
|
| 207 |
+
* @example parse_attrs( '<a href="example"></a>' )
|
| 208 |
+
*
|
| 209 |
+
* @link http://dev.airve.com/demo/speed_tests/php/parse_attrs.php
|
| 210 |
+
*/
|
| 211 |
+
final protected function parse_atts( $atts ) {
|
| 212 |
+
$atts = str_split( trim( $atts ) );
|
| 213 |
+
|
| 214 |
+
if ( '<' === $atts[0] ) { // looks like a tag so strip the tagname
|
| 215 |
+
while ( $atts && ! ctype_space( $atts[0] ) && $atts[0] !== '>' ) {
|
| 216 |
+
array_shift($atts);
|
| 217 |
+
}
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
$arr = array(); // output
|
| 221 |
+
$name = ''; // for the current attr being parsed
|
| 222 |
+
$value = ''; // for the current attr being parsed
|
| 223 |
+
$mode = 0; // whether current char is part of the name (-), the value (+), or neither (0)
|
| 224 |
+
$stop = false; // delimiter for the current $value being parsed
|
| 225 |
+
$space = ' '; // a single space
|
| 226 |
+
|
| 227 |
+
foreach ( $atts as $j => $curr ) {
|
| 228 |
+
if ( $mode < 0 ) { // name
|
| 229 |
+
if ( '=' === $curr ) {
|
| 230 |
+
$mode = 1;
|
| 231 |
+
$stop = false;
|
| 232 |
+
} elseif ( '>' === $curr ) {
|
| 233 |
+
'' === $name or $arr[ $name ] = $value;
|
| 234 |
+
break;
|
| 235 |
+
} elseif ( ! ctype_space( $curr ) ) {
|
| 236 |
+
if ( ctype_space( $atts[ $j - 1 ] ) ) { // previous char
|
| 237 |
+
'' === $name or $arr[ $name ] = ''; // previous name
|
| 238 |
+
$name = $curr; // initiate new
|
| 239 |
+
} else {
|
| 240 |
+
$name .= $curr;
|
| 241 |
+
}
|
| 242 |
+
}
|
| 243 |
+
} elseif ( $mode > 0 ) { // value
|
| 244 |
+
if ( $stop === false ) {
|
| 245 |
+
if ( ! ctype_space( $curr ) ) {
|
| 246 |
+
if ( '"' === $curr || "'" === $curr ) {
|
| 247 |
+
$value = '';
|
| 248 |
+
$stop = $curr;
|
| 249 |
+
} else {
|
| 250 |
+
$value = $curr;
|
| 251 |
+
$stop = $space;
|
| 252 |
+
}
|
| 253 |
+
}
|
| 254 |
+
} elseif ( $stop === $space ? ctype_space( $curr ) : $curr === $stop ) {
|
| 255 |
+
$arr[ $name ] = $value;
|
| 256 |
+
$mode = 0;
|
| 257 |
+
$name = $value = '';
|
| 258 |
+
} else {
|
| 259 |
+
$value .= $curr;
|
| 260 |
+
}
|
| 261 |
+
} else { // neither
|
| 262 |
+
if ( '>' === $curr )
|
| 263 |
+
break;
|
| 264 |
+
if ( ! ctype_space( $curr ) ) {
|
| 265 |
+
// initiate
|
| 266 |
+
$name = $curr;
|
| 267 |
+
$mode = -1;
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
// incl the final pair if it was quoteless
|
| 273 |
+
'' === $name or $arr[ $name ] = $value;
|
| 274 |
+
|
| 275 |
+
return $arr;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
/*?>*/
|
libs/fwp/class-fwp-html-fields.php
CHANGED
|
@@ -1,264 +1,264 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class FWP_HTML_Fields_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* @package FWP
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
class FWP_HTML_Fields_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
private $values = array();
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* @var string
|
| 23 |
-
*/
|
| 24 |
-
private $field_id_format = '%s';
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* @var string
|
| 28 |
-
*/
|
| 29 |
-
private $field_name_format = '%s';
|
| 30 |
-
|
| 31 |
-
/**
|
| 32 |
-
* Constructor
|
| 33 |
-
*/
|
| 34 |
-
public function __construct( array $values = array(), $field_id_format = null, $field_name_format = null )
|
| 35 |
-
{
|
| 36 |
-
$this->values = $values;
|
| 37 |
-
$this->field_id_format = $field_id_format;
|
| 38 |
-
$this->field_name_format = $field_name_format;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
/**
|
| 42 |
-
* Get form field id
|
| 43 |
-
* @param string $key
|
| 44 |
-
* @return string
|
| 45 |
-
*/
|
| 46 |
-
public function get_field_id( $key )
|
| 47 |
-
{
|
| 48 |
-
return sprintf( $this->field_id_format, $key );
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
/**
|
| 52 |
-
* Get form field name
|
| 53 |
-
* @param string $key
|
| 54 |
-
* @return string
|
| 55 |
-
*/
|
| 56 |
-
public function get_field_name( $key )
|
| 57 |
-
{
|
| 58 |
-
return sprintf( $this->field_name_format, $key );
|
| 59 |
-
}
|
| 60 |
-
|
| 61 |
-
/**
|
| 62 |
-
* Get value
|
| 63 |
-
* @param string $key
|
| 64 |
-
* @param mixed $default_value Optional
|
| 65 |
-
* @return mixed|null
|
| 66 |
-
*/
|
| 67 |
-
public function get_value( $key, $default_value = null )
|
| 68 |
-
{
|
| 69 |
-
$values = $this->values;
|
| 70 |
-
|
| 71 |
-
if ( !isset( $values[ $key ] ) ) {
|
| 72 |
-
return $default_value;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
return $values[ $key ];
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
/**
|
| 79 |
-
* Show html label
|
| 80 |
-
* @param string $key
|
| 81 |
-
* @param string $label_text
|
| 82 |
-
* @param array $atts Optional
|
| 83 |
-
*/
|
| 84 |
-
public function label( $key, $label_text, array $atts = array() )
|
| 85 |
-
{
|
| 86 |
-
echo '<label for="' . $this->get_field_id( $key ) . '"
|
| 87 |
-
' . $this->get_html_atts( $atts ) . '
|
| 88 |
-
>' . $label_text . '
|
| 89 |
-
</label>';
|
| 90 |
-
}
|
| 91 |
-
|
| 92 |
-
/**
|
| 93 |
-
* Show text input field
|
| 94 |
-
* @param string $key
|
| 95 |
-
* @param array $atts Optional
|
| 96 |
-
*/
|
| 97 |
-
public function text( $key, array $atts = array() )
|
| 98 |
-
{
|
| 99 |
-
echo '<input type="text"
|
| 100 |
-
id="' . $this->get_field_id( $key ) . '"
|
| 101 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 102 |
-
value="' . esc_attr( $this->get_value( $key ) ) . '"
|
| 103 |
-
' . $this->get_html_atts( $atts ) . '
|
| 104 |
-
>';
|
| 105 |
-
}
|
| 106 |
-
|
| 107 |
-
/**
|
| 108 |
-
* Show text input field
|
| 109 |
-
* @param string $key
|
| 110 |
-
* @param array $atts Optional
|
| 111 |
-
*/
|
| 112 |
-
public function text_area( $key, array $atts = array() )
|
| 113 |
-
{
|
| 114 |
-
echo '<textarea id="' . $this->get_field_id( $key ) . '"
|
| 115 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 116 |
-
' . $this->get_html_atts( $atts ) . '
|
| 117 |
-
>'. esc_textarea( $this->get_value( $key ) ) .'</textarea>';
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
/**
|
| 121 |
-
* Show a check field
|
| 122 |
-
* @param string $key
|
| 123 |
-
* @param mixed $checked_value
|
| 124 |
-
* @param mixed $unchecked_value
|
| 125 |
-
* @param array $atts Optional
|
| 126 |
-
*/
|
| 127 |
-
public function check( $key, $checked_value = '1', $unchecked_value = '', array $atts = array() )
|
| 128 |
-
{
|
| 129 |
-
// workaround for also posting a value when checkbox is unchecked
|
| 130 |
-
if ( null !== $unchecked_value ) {
|
| 131 |
-
echo '<input type="hidden"
|
| 132 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 133 |
-
value="' . esc_attr( $unchecked_value ) . '"
|
| 134 |
-
>';
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
echo '<input type="checkbox"
|
| 138 |
-
id="' . $this->get_field_id( $key ) . '"
|
| 139 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 140 |
-
value="' . esc_attr( $checked_value ) . '"
|
| 141 |
-
' . $this->get_checked_attr( $key, $checked_value ) . '
|
| 142 |
-
' . $this->get_html_atts( $atts ) . '
|
| 143 |
-
>';
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
/**
|
| 147 |
-
* Show a check field with label
|
| 148 |
-
* @param string $key
|
| 149 |
-
* @param string $label_text
|
| 150 |
-
* @param mixed $checked_value
|
| 151 |
-
* @param mixed $unchecked_value
|
| 152 |
-
* @param array $atts Optional
|
| 153 |
-
*/
|
| 154 |
-
public function check_with_label( $key, $label_text, $checked_value, $unchecked_value = null, array $atts = array() )
|
| 155 |
-
{
|
| 156 |
-
echo '<label>';
|
| 157 |
-
$this->check( $key, $checked_value, $unchecked_value, $atts );
|
| 158 |
-
echo $label_text;
|
| 159 |
-
echo '</label>';
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
/**
|
| 163 |
-
* Show a radio field
|
| 164 |
-
* @param string $key
|
| 165 |
-
* @param mixed $checked_value
|
| 166 |
-
* @param array $atts Optional
|
| 167 |
-
*/
|
| 168 |
-
public function radio( $key, $checked_value, array $atts = array() )
|
| 169 |
-
{
|
| 170 |
-
$id = $this->get_field_id( $key ) . '-' . sanitize_key( $checked_value );
|
| 171 |
-
|
| 172 |
-
echo '<input type="radio"
|
| 173 |
-
id="' . $id . '"
|
| 174 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 175 |
-
value="' . esc_attr( $checked_value ) . '"
|
| 176 |
-
' . $this->get_checked_attr( $key, $checked_value ) . '
|
| 177 |
-
' . $this->get_html_atts( $atts ) . '
|
| 178 |
-
>';
|
| 179 |
-
}
|
| 180 |
-
|
| 181 |
-
/**
|
| 182 |
-
* Show a check field with label
|
| 183 |
-
* @param string $key
|
| 184 |
-
* @param string $label_text
|
| 185 |
-
* @param mixed $checked_value
|
| 186 |
-
* @param array $atts Optional
|
| 187 |
-
*/
|
| 188 |
-
public function radio_with_label( $key, $label_text, $checked_value, array $atts = array() )
|
| 189 |
-
{
|
| 190 |
-
echo '<label>';
|
| 191 |
-
$this->radio( $key, $checked_value, $atts );
|
| 192 |
-
echo $label_text;
|
| 193 |
-
echo '</label>';
|
| 194 |
-
}
|
| 195 |
-
|
| 196 |
-
/**
|
| 197 |
-
* Show select field with or without options
|
| 198 |
-
* @param string $key
|
| 199 |
-
* @param mixed $checked_value
|
| 200 |
-
* @param array $options
|
| 201 |
-
* @param array $atts Optional
|
| 202 |
-
*/
|
| 203 |
-
public function select( $key, array $options = array(), array $atts = array() )
|
| 204 |
-
{
|
| 205 |
-
$value = $this->get_value( $key );
|
| 206 |
-
|
| 207 |
-
echo '<select id="' . $this->get_field_id( $key ) . '"
|
| 208 |
-
name="' . $this->get_field_name( $key ) . '"
|
| 209 |
-
' . $this->get_html_atts( $atts ) . '
|
| 210 |
-
>';
|
| 211 |
-
|
| 212 |
-
foreach ( $options as $option_value => $option_text ) {
|
| 213 |
-
$this->select_option( $option_text, $option_value, ( $value == $option_value ) );
|
| 214 |
-
}
|
| 215 |
-
|
| 216 |
-
echo '</select>';
|
| 217 |
-
}
|
| 218 |
-
|
| 219 |
-
/**
|
| 220 |
-
* Show a select option
|
| 221 |
-
* @param string $text
|
| 222 |
-
* @param string $value
|
| 223 |
-
* @param boolean $selected
|
| 224 |
-
*/
|
| 225 |
-
public function select_option( $text, $value, $selected = false )
|
| 226 |
-
{
|
| 227 |
-
echo '<option value="' . esc_attr( $value ) . '"' . ( $selected ? ' selected' : '' ) . '>
|
| 228 |
-
' . $text . '
|
| 229 |
-
</option>';
|
| 230 |
-
}
|
| 231 |
-
|
| 232 |
-
/**
|
| 233 |
-
* @param array $atts
|
| 234 |
-
* @return string
|
| 235 |
-
*/
|
| 236 |
-
private function get_html_atts( array $atts )
|
| 237 |
-
{
|
| 238 |
-
$html_atts = '';
|
| 239 |
-
|
| 240 |
-
foreach ( $atts as $key => $value ) {
|
| 241 |
-
if ( null === $value ) {
|
| 242 |
-
$html_atts .= ' '. $key;
|
| 243 |
-
} else {
|
| 244 |
-
$html_atts .= ' '. $key .'="'. esc_attr( $value ) .'"';
|
| 245 |
-
}
|
| 246 |
-
}
|
| 247 |
-
|
| 248 |
-
return $html_atts;
|
| 249 |
-
}
|
| 250 |
-
|
| 251 |
-
/**
|
| 252 |
-
* Get the checked attribute
|
| 253 |
-
* @param string $key
|
| 254 |
-
* @param mixed $checked_value
|
| 255 |
-
* @return string
|
| 256 |
-
*/
|
| 257 |
-
private function get_checked_attr( $key, $checked_value )
|
| 258 |
-
{
|
| 259 |
-
return ( $this->get_value( $key ) == $checked_value ) ? ' checked' : '';
|
| 260 |
-
}
|
| 261 |
-
|
| 262 |
-
}
|
| 263 |
-
|
| 264 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_HTML_Fields_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
class FWP_HTML_Fields_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var array
|
| 18 |
+
*/
|
| 19 |
+
private $values = array();
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
private $field_id_format = '%s';
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* @var string
|
| 28 |
+
*/
|
| 29 |
+
private $field_name_format = '%s';
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Constructor
|
| 33 |
+
*/
|
| 34 |
+
public function __construct( array $values = array(), $field_id_format = null, $field_name_format = null )
|
| 35 |
+
{
|
| 36 |
+
$this->values = $values;
|
| 37 |
+
$this->field_id_format = $field_id_format;
|
| 38 |
+
$this->field_name_format = $field_name_format;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Get form field id
|
| 43 |
+
* @param string $key
|
| 44 |
+
* @return string
|
| 45 |
+
*/
|
| 46 |
+
public function get_field_id( $key )
|
| 47 |
+
{
|
| 48 |
+
return sprintf( $this->field_id_format, $key );
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* Get form field name
|
| 53 |
+
* @param string $key
|
| 54 |
+
* @return string
|
| 55 |
+
*/
|
| 56 |
+
public function get_field_name( $key )
|
| 57 |
+
{
|
| 58 |
+
return sprintf( $this->field_name_format, $key );
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Get value
|
| 63 |
+
* @param string $key
|
| 64 |
+
* @param mixed $default_value Optional
|
| 65 |
+
* @return mixed|null
|
| 66 |
+
*/
|
| 67 |
+
public function get_value( $key, $default_value = null )
|
| 68 |
+
{
|
| 69 |
+
$values = $this->values;
|
| 70 |
+
|
| 71 |
+
if ( !isset( $values[ $key ] ) ) {
|
| 72 |
+
return $default_value;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
return $values[ $key ];
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Show html label
|
| 80 |
+
* @param string $key
|
| 81 |
+
* @param string $label_text
|
| 82 |
+
* @param array $atts Optional
|
| 83 |
+
*/
|
| 84 |
+
public function label( $key, $label_text, array $atts = array() )
|
| 85 |
+
{
|
| 86 |
+
echo '<label for="' . $this->get_field_id( $key ) . '"
|
| 87 |
+
' . $this->get_html_atts( $atts ) . '
|
| 88 |
+
>' . $label_text . '
|
| 89 |
+
</label>';
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
/**
|
| 93 |
+
* Show text input field
|
| 94 |
+
* @param string $key
|
| 95 |
+
* @param array $atts Optional
|
| 96 |
+
*/
|
| 97 |
+
public function text( $key, array $atts = array() )
|
| 98 |
+
{
|
| 99 |
+
echo '<input type="text"
|
| 100 |
+
id="' . $this->get_field_id( $key ) . '"
|
| 101 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 102 |
+
value="' . esc_attr( $this->get_value( $key ) ) . '"
|
| 103 |
+
' . $this->get_html_atts( $atts ) . '
|
| 104 |
+
>';
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Show text input field
|
| 109 |
+
* @param string $key
|
| 110 |
+
* @param array $atts Optional
|
| 111 |
+
*/
|
| 112 |
+
public function text_area( $key, array $atts = array() )
|
| 113 |
+
{
|
| 114 |
+
echo '<textarea id="' . $this->get_field_id( $key ) . '"
|
| 115 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 116 |
+
' . $this->get_html_atts( $atts ) . '
|
| 117 |
+
>'. esc_textarea( $this->get_value( $key ) ) .'</textarea>';
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
/**
|
| 121 |
+
* Show a check field
|
| 122 |
+
* @param string $key
|
| 123 |
+
* @param mixed $checked_value
|
| 124 |
+
* @param mixed $unchecked_value
|
| 125 |
+
* @param array $atts Optional
|
| 126 |
+
*/
|
| 127 |
+
public function check( $key, $checked_value = '1', $unchecked_value = '', array $atts = array() )
|
| 128 |
+
{
|
| 129 |
+
// workaround for also posting a value when checkbox is unchecked
|
| 130 |
+
if ( null !== $unchecked_value ) {
|
| 131 |
+
echo '<input type="hidden"
|
| 132 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 133 |
+
value="' . esc_attr( $unchecked_value ) . '"
|
| 134 |
+
>';
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
echo '<input type="checkbox"
|
| 138 |
+
id="' . $this->get_field_id( $key ) . '"
|
| 139 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 140 |
+
value="' . esc_attr( $checked_value ) . '"
|
| 141 |
+
' . $this->get_checked_attr( $key, $checked_value ) . '
|
| 142 |
+
' . $this->get_html_atts( $atts ) . '
|
| 143 |
+
>';
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/**
|
| 147 |
+
* Show a check field with label
|
| 148 |
+
* @param string $key
|
| 149 |
+
* @param string $label_text
|
| 150 |
+
* @param mixed $checked_value
|
| 151 |
+
* @param mixed $unchecked_value
|
| 152 |
+
* @param array $atts Optional
|
| 153 |
+
*/
|
| 154 |
+
public function check_with_label( $key, $label_text, $checked_value, $unchecked_value = null, array $atts = array() )
|
| 155 |
+
{
|
| 156 |
+
echo '<label>';
|
| 157 |
+
$this->check( $key, $checked_value, $unchecked_value, $atts );
|
| 158 |
+
echo $label_text;
|
| 159 |
+
echo '</label>';
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
/**
|
| 163 |
+
* Show a radio field
|
| 164 |
+
* @param string $key
|
| 165 |
+
* @param mixed $checked_value
|
| 166 |
+
* @param array $atts Optional
|
| 167 |
+
*/
|
| 168 |
+
public function radio( $key, $checked_value, array $atts = array() )
|
| 169 |
+
{
|
| 170 |
+
$id = $this->get_field_id( $key ) . '-' . sanitize_key( $checked_value );
|
| 171 |
+
|
| 172 |
+
echo '<input type="radio"
|
| 173 |
+
id="' . $id . '"
|
| 174 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 175 |
+
value="' . esc_attr( $checked_value ) . '"
|
| 176 |
+
' . $this->get_checked_attr( $key, $checked_value ) . '
|
| 177 |
+
' . $this->get_html_atts( $atts ) . '
|
| 178 |
+
>';
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
/**
|
| 182 |
+
* Show a check field with label
|
| 183 |
+
* @param string $key
|
| 184 |
+
* @param string $label_text
|
| 185 |
+
* @param mixed $checked_value
|
| 186 |
+
* @param array $atts Optional
|
| 187 |
+
*/
|
| 188 |
+
public function radio_with_label( $key, $label_text, $checked_value, array $atts = array() )
|
| 189 |
+
{
|
| 190 |
+
echo '<label>';
|
| 191 |
+
$this->radio( $key, $checked_value, $atts );
|
| 192 |
+
echo $label_text;
|
| 193 |
+
echo '</label>';
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
/**
|
| 197 |
+
* Show select field with or without options
|
| 198 |
+
* @param string $key
|
| 199 |
+
* @param mixed $checked_value
|
| 200 |
+
* @param array $options
|
| 201 |
+
* @param array $atts Optional
|
| 202 |
+
*/
|
| 203 |
+
public function select( $key, array $options = array(), array $atts = array() )
|
| 204 |
+
{
|
| 205 |
+
$value = $this->get_value( $key );
|
| 206 |
+
|
| 207 |
+
echo '<select id="' . $this->get_field_id( $key ) . '"
|
| 208 |
+
name="' . $this->get_field_name( $key ) . '"
|
| 209 |
+
' . $this->get_html_atts( $atts ) . '
|
| 210 |
+
>';
|
| 211 |
+
|
| 212 |
+
foreach ( $options as $option_value => $option_text ) {
|
| 213 |
+
$this->select_option( $option_text, $option_value, ( $value == $option_value ) );
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
echo '</select>';
|
| 217 |
+
}
|
| 218 |
+
|
| 219 |
+
/**
|
| 220 |
+
* Show a select option
|
| 221 |
+
* @param string $text
|
| 222 |
+
* @param string $value
|
| 223 |
+
* @param boolean $selected
|
| 224 |
+
*/
|
| 225 |
+
public function select_option( $text, $value, $selected = false )
|
| 226 |
+
{
|
| 227 |
+
echo '<option value="' . esc_attr( $value ) . '"' . ( $selected ? ' selected' : '' ) . '>
|
| 228 |
+
' . $text . '
|
| 229 |
+
</option>';
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
/**
|
| 233 |
+
* @param array $atts
|
| 234 |
+
* @return string
|
| 235 |
+
*/
|
| 236 |
+
private function get_html_atts( array $atts )
|
| 237 |
+
{
|
| 238 |
+
$html_atts = '';
|
| 239 |
+
|
| 240 |
+
foreach ( $atts as $key => $value ) {
|
| 241 |
+
if ( null === $value ) {
|
| 242 |
+
$html_atts .= ' '. $key;
|
| 243 |
+
} else {
|
| 244 |
+
$html_atts .= ' '. $key .'="'. esc_attr( $value ) .'"';
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
return $html_atts;
|
| 249 |
+
}
|
| 250 |
+
|
| 251 |
+
/**
|
| 252 |
+
* Get the checked attribute
|
| 253 |
+
* @param string $key
|
| 254 |
+
* @param mixed $checked_value
|
| 255 |
+
* @return string
|
| 256 |
+
*/
|
| 257 |
+
private function get_checked_attr( $key, $checked_value )
|
| 258 |
+
{
|
| 259 |
+
return ( $this->get_value( $key ) == $checked_value ) ? ' checked' : '';
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/*?>*/
|
libs/fwp/component-bases/class-fwp-plugin-base.php
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Plugin_Base
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
abstract class FWP_Plugin_Base_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
private $plugin_file = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var string
|
| 23 |
+
*/
|
| 24 |
+
private $plugin_dir = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Initialize plugin
|
| 28 |
+
* @param string $plugin_file
|
| 29 |
+
* @param string $plugin_dir
|
| 30 |
+
*/
|
| 31 |
+
protected function init( $plugin_file, $plugin_dir )
|
| 32 |
+
{
|
| 33 |
+
$this->set_plugin_file( $plugin_file );
|
| 34 |
+
$this->set_plugin_dir( $plugin_dir );
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/**
|
| 38 |
+
* Action for "plugins_loaded"
|
| 39 |
+
*/
|
| 40 |
+
protected function action_plugins_loaded()
|
| 41 |
+
{
|
| 42 |
+
$plugin_data = get_file_data( $this->plugin_file, array(
|
| 43 |
+
'TextDomain' => 'Text Domain',
|
| 44 |
+
'DomainPath' => 'Domain Path',
|
| 45 |
+
) );
|
| 46 |
+
|
| 47 |
+
if ( ! $plugin_data[ 'TextDomain' ] || ! $plugin_data[ 'DomainPath' ] ) {
|
| 48 |
+
return;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
load_plugin_textdomain(
|
| 52 |
+
$plugin_data[ 'TextDomain' ]
|
| 53 |
+
, false
|
| 54 |
+
, $this->get_plugin_dir( $plugin_data[ 'DomainPath' ] )
|
| 55 |
+
);
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* @param string $plugin_file
|
| 60 |
+
*/
|
| 61 |
+
final protected function set_plugin_file( $plugin_file )
|
| 62 |
+
{
|
| 63 |
+
$this->plugin_file = $plugin_file;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/**
|
| 67 |
+
* @param string $plugin_dir
|
| 68 |
+
*/
|
| 69 |
+
final protected function set_plugin_dir( $plugin_dir )
|
| 70 |
+
{
|
| 71 |
+
$this->plugin_dir = untrailingslashit( $plugin_dir );;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* @return string
|
| 76 |
+
*/
|
| 77 |
+
final public static function get_plugin_file()
|
| 78 |
+
{
|
| 79 |
+
return self::get_instance()->plugin_file;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* @param string $path Optional
|
| 84 |
+
* @return string
|
| 85 |
+
*/
|
| 86 |
+
final public static function get_plugin_dir( $path = '' )
|
| 87 |
+
{
|
| 88 |
+
return self::get_instance()->plugin_dir . $path;
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/*?>*/
|
libs/fwp/component-bases/class-fwp-register-hook-base.php
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Register_Hook_Base_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
abstract class FWP_Register_Hook_Base_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var string
|
| 18 |
+
*/
|
| 19 |
+
protected $hook_type = null;
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* @var wpdb
|
| 23 |
+
*/
|
| 24 |
+
private $wpdb = null;
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Initialize
|
| 28 |
+
* @triggers E_USER_NOTICE Hook function does not exist
|
| 29 |
+
*/
|
| 30 |
+
protected function init( $plugin_file, wpdb $wpdb )
|
| 31 |
+
{
|
| 32 |
+
$this->wpdb = $wpdb;
|
| 33 |
+
|
| 34 |
+
$wp_hook_function = 'register_'. $this->hook_type .'_hook';
|
| 35 |
+
|
| 36 |
+
if ( ! function_exists( $wp_hook_function ) ) {
|
| 37 |
+
trigger_error( 'Register hook function "'. $wp_hook_function .'" does not exist.' );
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
$wp_hook_function(
|
| 41 |
+
$plugin_file
|
| 42 |
+
, $this->get_callback( 'procedure' )
|
| 43 |
+
);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Plugin activation procedure
|
| 48 |
+
*/
|
| 49 |
+
protected function procedure( $networkwide = null )
|
| 50 |
+
{
|
| 51 |
+
if ( is_multisite() && $networkwide ) {
|
| 52 |
+
// network activation
|
| 53 |
+
$sites = wp_get_sites();
|
| 54 |
+
$active_blog = $this->wpdb->blogid;
|
| 55 |
+
|
| 56 |
+
foreach ( $sites as $site ) {
|
| 57 |
+
switch_to_blog( $site[ 'blog_id' ] );
|
| 58 |
+
$this->site_procedure();
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
// switch back to active blog
|
| 62 |
+
switch_to_blog( $active_blog );
|
| 63 |
+
|
| 64 |
+
$this->network_procedure();
|
| 65 |
+
} else {
|
| 66 |
+
// single site activation
|
| 67 |
+
$this->site_procedure();
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/**
|
| 72 |
+
* Network hook procedure
|
| 73 |
+
* @return void
|
| 74 |
+
*/
|
| 75 |
+
protected function network_procedure()
|
| 76 |
+
{
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Site hook procedure
|
| 81 |
+
* @return void
|
| 82 |
+
*/
|
| 83 |
+
abstract protected function site_procedure();
|
| 84 |
+
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/*?>*/
|
libs/fwp/{class-fwp-settings-section-fields.php → component-bases/class-fwp-settings-section-base.php}
RENAMED
|
@@ -1,249 +1,275 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class
|
| 4 |
-
*
|
| 5 |
-
* @package FWP
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
abstract class
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
protected $default_settings = array(
|
| 20 |
-
'section_id' => '',
|
| 21 |
-
'title' => '',
|
| 22 |
-
'description' => '',
|
| 23 |
-
'page_id' => '',
|
| 24 |
-
'option_name' => '',
|
| 25 |
-
'option_group' => '',
|
| 26 |
-
'html_fields_class' => 'FWP_HTML_Fields_1x0x0',
|
| 27 |
-
'fields' => array(
|
| 28 |
-
//'key' => array(
|
| 29 |
-
// 'label' => '',
|
| 30 |
-
// 'class' => '',
|
| 31 |
-
// 'default_value' => '',
|
| 32 |
-
//),
|
| 33 |
-
),
|
| 34 |
-
);
|
| 35 |
-
|
| 36 |
-
/**
|
| 37 |
-
* @var array
|
| 38 |
-
*/
|
| 39 |
-
private $
|
| 40 |
-
|
| 41 |
-
/**
|
| 42 |
-
* @var
|
| 43 |
-
*/
|
| 44 |
-
private $
|
| 45 |
-
|
| 46 |
-
/**
|
| 47 |
-
* @var
|
| 48 |
-
*/
|
| 49 |
-
private $
|
| 50 |
-
|
| 51 |
-
/**
|
| 52 |
-
*
|
| 53 |
-
*/
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
$
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
$
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
*
|
| 192 |
-
* @param array $
|
| 193 |
-
* @return array
|
| 194 |
-
*/
|
| 195 |
-
protected function
|
| 196 |
-
{
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
}
|
| 225 |
-
|
| 226 |
-
/**
|
| 227 |
-
*
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
$
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Settings_Section_Base_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
abstract class FWP_Settings_Section_Base_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var array
|
| 18 |
+
*/
|
| 19 |
+
protected $default_settings = array(
|
| 20 |
+
'section_id' => '',
|
| 21 |
+
'title' => '',
|
| 22 |
+
'description' => '',
|
| 23 |
+
'page_id' => '',
|
| 24 |
+
'option_name' => '',
|
| 25 |
+
'option_group' => '',
|
| 26 |
+
'html_fields_class' => 'FWP_HTML_Fields_1x0x0',
|
| 27 |
+
'fields' => array(
|
| 28 |
+
//'key' => array(
|
| 29 |
+
// 'label' => '',
|
| 30 |
+
// 'class' => '',
|
| 31 |
+
// 'default_value' => '',
|
| 32 |
+
//),
|
| 33 |
+
),
|
| 34 |
+
);
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* @var array
|
| 38 |
+
*/
|
| 39 |
+
private $settings = array();
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* @var array
|
| 43 |
+
*/
|
| 44 |
+
private $field_errors = array();
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* @var FWP_HTML_Fields_1x0x0
|
| 48 |
+
*/
|
| 49 |
+
private $html_fields = null;
|
| 50 |
+
|
| 51 |
+
/**
|
| 52 |
+
* @var array
|
| 53 |
+
*/
|
| 54 |
+
private $option_values = array();
|
| 55 |
+
|
| 56 |
+
/**
|
| 57 |
+
* Init
|
| 58 |
+
*/
|
| 59 |
+
protected function init()
|
| 60 |
+
{
|
| 61 |
+
$this->set_option_values();
|
| 62 |
+
$this->set_html_fields();
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
/**
|
| 66 |
+
* @param string $key
|
| 67 |
+
* @return mixed
|
| 68 |
+
*/
|
| 69 |
+
final public function get_setting( $key )
|
| 70 |
+
{
|
| 71 |
+
return $this->settings[ $key ];
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* @param array $settings
|
| 76 |
+
*/
|
| 77 |
+
final protected function set_settings( array $settings )
|
| 78 |
+
{
|
| 79 |
+
if ( empty( $this->settings ) ) {
|
| 80 |
+
$this->settings = $this->default_settings;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
$this->settings = wp_parse_args( $settings, $this->settings );
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
/**
|
| 87 |
+
* Action for "admin_init"
|
| 88 |
+
*/
|
| 89 |
+
protected function action_admin_init()
|
| 90 |
+
{
|
| 91 |
+
$description = $this->get_setting( 'description' );
|
| 92 |
+
|
| 93 |
+
add_settings_section(
|
| 94 |
+
$this->get_setting( 'section_id' ) // id
|
| 95 |
+
, $this->get_setting( 'title' ) // title
|
| 96 |
+
, function () use ( $description ) { // callback
|
| 97 |
+
echo $description;
|
| 98 |
+
}
|
| 99 |
+
, $this->get_setting( 'page_id' ) // page id
|
| 100 |
+
);
|
| 101 |
+
|
| 102 |
+
register_setting(
|
| 103 |
+
$this->get_setting( 'option_group' )
|
| 104 |
+
, $this->get_setting( 'option_name' )
|
| 105 |
+
, $this->get_callback( 'sanitize' )
|
| 106 |
+
);
|
| 107 |
+
|
| 108 |
+
$this->add_fields();
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
/**
|
| 112 |
+
* Set option values
|
| 113 |
+
*/
|
| 114 |
+
private function set_option_values()
|
| 115 |
+
{
|
| 116 |
+
$saved_values = $this->get_saved_values();
|
| 117 |
+
$default_values = $this->get_default_values();
|
| 118 |
+
|
| 119 |
+
$values = wp_parse_args( $saved_values, $default_values );
|
| 120 |
+
$this->option_values = $values;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/**
|
| 124 |
+
* Get option values
|
| 125 |
+
* @return array
|
| 126 |
+
*/
|
| 127 |
+
final public function get_option_values()
|
| 128 |
+
{
|
| 129 |
+
return $this->option_values;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/**
|
| 133 |
+
* Get the default option values
|
| 134 |
+
* @return array
|
| 135 |
+
*/
|
| 136 |
+
final public function get_default_values()
|
| 137 |
+
{
|
| 138 |
+
$fields = $this->get_setting( 'fields' );
|
| 139 |
+
|
| 140 |
+
$default_values = array_map( function ( $arr ) {
|
| 141 |
+
if ( ! isset( $arr[ 'default_value' ] ) ) {
|
| 142 |
+
return '';
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
return $arr[ 'default_value' ];
|
| 146 |
+
}, $fields );
|
| 147 |
+
|
| 148 |
+
return $default_values;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Get saved option values from database
|
| 153 |
+
* @return type
|
| 154 |
+
*/
|
| 155 |
+
final public function get_saved_values()
|
| 156 |
+
{
|
| 157 |
+
if ( is_network_admin() ) {
|
| 158 |
+
$option = get_site_option( $this->get_setting( 'option_name' ) );
|
| 159 |
+
} else {
|
| 160 |
+
$option = get_option( $this->get_setting( 'option_name' ) );
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
$saved_values = is_array( $option ) ? $option : array();
|
| 164 |
+
return $saved_values;
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* Create html fields
|
| 169 |
+
*/
|
| 170 |
+
private function set_html_fields()
|
| 171 |
+
{
|
| 172 |
+
$option_name = $this->get_setting( 'option_name' );
|
| 173 |
+
|
| 174 |
+
$html_fields_class = $this->get_setting( 'html_fields_class' );
|
| 175 |
+
$this->html_fields = new $html_fields_class(
|
| 176 |
+
$this->option_values
|
| 177 |
+
, $option_name .'-%s'
|
| 178 |
+
, $option_name .'[%s]'
|
| 179 |
+
);
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
/**
|
| 183 |
+
* @return FWP_HTML_Fields_1x0x0
|
| 184 |
+
*/
|
| 185 |
+
final protected function get_html_fields()
|
| 186 |
+
{
|
| 187 |
+
return $this->html_fields;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/**
|
| 191 |
+
* Sanitize settings callback
|
| 192 |
+
* @param array $values
|
| 193 |
+
* @return array
|
| 194 |
+
*/
|
| 195 |
+
protected function sanitize( $values )
|
| 196 |
+
{
|
| 197 |
+
$old_values = $this->option_values;
|
| 198 |
+
|
| 199 |
+
$this->field_errors = array();
|
| 200 |
+
|
| 201 |
+
$new_values = $this->before_update( $values, $old_values );
|
| 202 |
+
|
| 203 |
+
if ( count ( $this->field_errors ) > 0 ) {
|
| 204 |
+
add_settings_error(
|
| 205 |
+
$this->get_setting( 'option_group' )
|
| 206 |
+
, 'settings_updated'
|
| 207 |
+
, implode( '<br>', $this->field_errors )
|
| 208 |
+
, 'error'
|
| 209 |
+
);
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
return $new_values;
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
/**
|
| 216 |
+
* Validate and sanitize user input before saving to databse
|
| 217 |
+
* @param array $new_values
|
| 218 |
+
* @param array $old_values
|
| 219 |
+
* @return array
|
| 220 |
+
*/
|
| 221 |
+
protected function before_update( array $new_values, array $old_values )
|
| 222 |
+
{
|
| 223 |
+
return $new_values;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
/**
|
| 227 |
+
* Add fields
|
| 228 |
+
*/
|
| 229 |
+
protected function add_fields()
|
| 230 |
+
{
|
| 231 |
+
$fields = $this->get_setting( 'fields' );
|
| 232 |
+
|
| 233 |
+
foreach ( $fields as $key => $field_settings ) {
|
| 234 |
+
$label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : '';
|
| 235 |
+
$class = isset( $field_settings[ 'class' ] ) ? $field_settings[ 'class' ] : '';
|
| 236 |
+
|
| 237 |
+
add_settings_field(
|
| 238 |
+
$key
|
| 239 |
+
, $label
|
| 240 |
+
, $this->get_callback( 'field_callback' )
|
| 241 |
+
, $this->get_setting( 'page_id' )
|
| 242 |
+
, $this->get_setting( 'section_id' )
|
| 243 |
+
, array(
|
| 244 |
+
'key' => $key,
|
| 245 |
+
'label_for' => $this->html_fields->get_field_id( $key ),
|
| 246 |
+
'class' => $class,
|
| 247 |
+
)
|
| 248 |
+
);
|
| 249 |
+
}
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
/**
|
| 253 |
+
* Show field callback
|
| 254 |
+
* @param array $args
|
| 255 |
+
*/
|
| 256 |
+
final protected function field_callback( array $args )
|
| 257 |
+
{
|
| 258 |
+
$field_method = 'show_'. $args[ 'key' ];
|
| 259 |
+
|
| 260 |
+
if ( is_callable( array( $this, $field_method ) ) ) {
|
| 261 |
+
$this->{ $field_method }( $args );
|
| 262 |
+
}
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
/**
|
| 266 |
+
* @param string $message
|
| 267 |
+
*/
|
| 268 |
+
final protected function add_error( $message )
|
| 269 |
+
{
|
| 270 |
+
$this->field_errors[] = $message;
|
| 271 |
+
}
|
| 272 |
+
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
/*?>*/
|
libs/fwp/component-bases/class-fwp-template-tag-base.php
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Template_Tag_Base_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* Public methods implemented in concrete subclasses will be automatically
|
| 6 |
+
* created as template tags.
|
| 7 |
+
*
|
| 8 |
+
* @package FWP
|
| 9 |
+
* @category WordPress Library
|
| 10 |
+
* @version 1.0.0
|
| 11 |
+
* @author Victor Villaverde Laan
|
| 12 |
+
* @link http://www.finewebdev.com
|
| 13 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 14 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 15 |
+
*/
|
| 16 |
+
abstract class FWP_Template_Tag_Base_1x0x0 extends WPRun_Base_1x0x0
|
| 17 |
+
{
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Action for "wp"
|
| 21 |
+
* Create template tags
|
| 22 |
+
*/
|
| 23 |
+
protected function action_wp()
|
| 24 |
+
{
|
| 25 |
+
// get public methods of parent class
|
| 26 |
+
$parent_class = get_parent_class( $this );
|
| 27 |
+
$reflection_parent_class = new ReflectionClass( $parent_class );
|
| 28 |
+
$parent_methods = $reflection_parent_class->getMethods( ReflectionMethod::IS_PUBLIC );
|
| 29 |
+
|
| 30 |
+
// get public methods of current class
|
| 31 |
+
$reflection_class = new ReflectionClass( get_called_class() );
|
| 32 |
+
$class_methods = $reflection_class->getMethods( ReflectionMethod::IS_PUBLIC );
|
| 33 |
+
|
| 34 |
+
// get only the public methods implemented in concrete class
|
| 35 |
+
// these are the template tags
|
| 36 |
+
$template_tag_refl_methods = array_diff( $class_methods, $parent_methods );
|
| 37 |
+
|
| 38 |
+
foreach ( $template_tag_refl_methods as $refl_method ) {
|
| 39 |
+
$this->create_template_tag( $refl_method->name );
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* Create template tag
|
| 45 |
+
* @return void
|
| 46 |
+
*/
|
| 47 |
+
protected function create_template_tag( $template_tag )
|
| 48 |
+
{
|
| 49 |
+
if ( function_exists( $template_tag ) ) {
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// create global function
|
| 54 |
+
$func_code = '';
|
| 55 |
+
$func_code .= 'function '. $template_tag .'()';
|
| 56 |
+
$func_code .= '{';
|
| 57 |
+
$func_code .= ' $callable = array( '. get_called_class() .'::get_instance(), "'. $template_tag .'" );';
|
| 58 |
+
$func_code .= ' return call_user_func_array( $callable, func_get_args() );';
|
| 59 |
+
$func_code .= '}';
|
| 60 |
+
|
| 61 |
+
eval( $func_code );
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/*?>*/
|
libs/fwp/filter-hooks/class-fwp-final-output.php
CHANGED
|
@@ -1,43 +1,43 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class FWP_Final_Output_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* @package FWP
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
class FWP_Final_Output_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
const FILTER_NAME = 'final_output';
|
| 17 |
-
|
| 18 |
-
/**
|
| 19 |
-
* Action for "init"
|
| 20 |
-
*/
|
| 21 |
-
protected function action_init()
|
| 22 |
-
{
|
| 23 |
-
ob_start( $this->get_callback( 'apply' ) );
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
/**
|
| 27 |
-
* Apply filters
|
| 28 |
-
* @param string $content
|
| 29 |
-
* @return string
|
| 30 |
-
*/
|
| 31 |
-
protected function apply( $content )
|
| 32 |
-
{
|
| 33 |
-
$filtered_content = apply_filters( self::FILTER_NAME, $content );
|
| 34 |
-
|
| 35 |
-
// remove filters after applying to prevent multiple applies
|
| 36 |
-
remove_all_filters( self::FILTER_NAME );
|
| 37 |
-
|
| 38 |
-
return $filtered_content;
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class FWP_Final_Output_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package FWP
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
class FWP_Final_Output_1x0x0 extends WPRun_Base_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
const FILTER_NAME = 'final_output';
|
| 17 |
+
|
| 18 |
+
/**
|
| 19 |
+
* Action for "init"
|
| 20 |
+
*/
|
| 21 |
+
protected function action_init()
|
| 22 |
+
{
|
| 23 |
+
ob_start( $this->get_callback( 'apply' ) );
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
/**
|
| 27 |
+
* Apply filters
|
| 28 |
+
* @param string $content
|
| 29 |
+
* @return string
|
| 30 |
+
*/
|
| 31 |
+
protected function apply( $content )
|
| 32 |
+
{
|
| 33 |
+
$filtered_content = apply_filters( self::FILTER_NAME, $content );
|
| 34 |
+
|
| 35 |
+
// remove filters after applying to prevent multiple applies
|
| 36 |
+
remove_all_filters( self::FILTER_NAME );
|
| 37 |
+
|
| 38 |
+
return $filtered_content;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/*?>*/
|
libs/fwp/filter-hooks/class-fwp-widget-output.php
CHANGED
|
@@ -1,80 +1,80 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class Widget_Output_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* This component was inspired by the 'widget_content' filter of
|
| 6 |
-
* Widget Logic Plugin by Alan Trewartha (http://freakytrigger.co.uk/author/alan/)
|
| 7 |
-
*
|
| 8 |
-
* @package FWP
|
| 9 |
-
* @category WordPress Library
|
| 10 |
-
* @version 1.0.0
|
| 11 |
-
* @author Victor Villaverde Laan
|
| 12 |
-
* @link http://www.finewebdev.com
|
| 13 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 14 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 15 |
-
*/
|
| 16 |
-
class FWP_Widget_Output_1x0x0 extends WPRun_Base_1x0x0
|
| 17 |
-
{
|
| 18 |
-
|
| 19 |
-
const FILTER_NAME = 'widget_output';
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* Filter for "dynamic_sidebar_params"
|
| 23 |
-
*
|
| 24 |
-
* @global array $wp_registered_widgets
|
| 25 |
-
* @param array $sidebar_params
|
| 26 |
-
* @return array
|
| 27 |
-
*/
|
| 28 |
-
protected function filter_dynamic_sidebar_params( $sidebar_params )
|
| 29 |
-
{
|
| 30 |
-
global $wp_registered_widgets;
|
| 31 |
-
|
| 32 |
-
if ( is_admin() ) {
|
| 33 |
-
return $sidebar_params;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
$widget_id = $sidebar_params[ 0 ][ 'widget_id' ];
|
| 37 |
-
|
| 38 |
-
// prevent overwriting when already set by another version of the widget output class
|
| 39 |
-
if ( isset( $wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ] ) ) {
|
| 40 |
-
return $sidebar_params;
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
$wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ] = $wp_registered_widgets[ $widget_id ][ 'callback' ];
|
| 44 |
-
$wp_registered_widgets[ $widget_id ][ 'callback' ] = $this->get_callback( 'widget_callback' );
|
| 45 |
-
|
| 46 |
-
return $sidebar_params;
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
/**
|
| 50 |
-
* Widget Callback
|
| 51 |
-
* @global array $wp_registered_widgets
|
| 52 |
-
* @return void
|
| 53 |
-
*/
|
| 54 |
-
protected function widget_callback()
|
| 55 |
-
{
|
| 56 |
-
global $wp_registered_widgets;
|
| 57 |
-
|
| 58 |
-
$original_callback_params = func_get_args();
|
| 59 |
-
$widget_id = $original_callback_params[ 0 ][ 'widget_id' ];
|
| 60 |
-
|
| 61 |
-
$original_callback = $wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ];
|
| 62 |
-
$wp_registered_widgets[ $widget_id ][ 'callback' ] = $original_callback;
|
| 63 |
-
|
| 64 |
-
$widget_id_base = $wp_registered_widgets[ $widget_id ][ 'callback' ][ 0 ]->id_base;
|
| 65 |
-
|
| 66 |
-
if ( ! is_callable( $original_callback ) ) {
|
| 67 |
-
return;
|
| 68 |
-
}
|
| 69 |
-
|
| 70 |
-
ob_start();
|
| 71 |
-
|
| 72 |
-
call_user_func_array( $original_callback, $original_callback_params );
|
| 73 |
-
$widget_output = ob_get_clean();
|
| 74 |
-
|
| 75 |
-
echo apply_filters( self::FILTER_NAME, $widget_output, $widget_id_base, $widget_id );
|
| 76 |
-
}
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class Widget_Output_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* This component was inspired by the 'widget_content' filter of
|
| 6 |
+
* Widget Logic Plugin by Alan Trewartha (http://freakytrigger.co.uk/author/alan/)
|
| 7 |
+
*
|
| 8 |
+
* @package FWP
|
| 9 |
+
* @category WordPress Library
|
| 10 |
+
* @version 1.0.0
|
| 11 |
+
* @author Victor Villaverde Laan
|
| 12 |
+
* @link http://www.finewebdev.com
|
| 13 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 14 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 15 |
+
*/
|
| 16 |
+
class FWP_Widget_Output_1x0x0 extends WPRun_Base_1x0x0
|
| 17 |
+
{
|
| 18 |
+
|
| 19 |
+
const FILTER_NAME = 'widget_output';
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Filter for "dynamic_sidebar_params"
|
| 23 |
+
*
|
| 24 |
+
* @global array $wp_registered_widgets
|
| 25 |
+
* @param array $sidebar_params
|
| 26 |
+
* @return array
|
| 27 |
+
*/
|
| 28 |
+
protected function filter_dynamic_sidebar_params( $sidebar_params )
|
| 29 |
+
{
|
| 30 |
+
global $wp_registered_widgets;
|
| 31 |
+
|
| 32 |
+
if ( is_admin() ) {
|
| 33 |
+
return $sidebar_params;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
$widget_id = $sidebar_params[ 0 ][ 'widget_id' ];
|
| 37 |
+
|
| 38 |
+
// prevent overwriting when already set by another version of the widget output class
|
| 39 |
+
if ( isset( $wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ] ) ) {
|
| 40 |
+
return $sidebar_params;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
$wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ] = $wp_registered_widgets[ $widget_id ][ 'callback' ];
|
| 44 |
+
$wp_registered_widgets[ $widget_id ][ 'callback' ] = $this->get_callback( 'widget_callback' );
|
| 45 |
+
|
| 46 |
+
return $sidebar_params;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
/**
|
| 50 |
+
* Widget Callback
|
| 51 |
+
* @global array $wp_registered_widgets
|
| 52 |
+
* @return void
|
| 53 |
+
*/
|
| 54 |
+
protected function widget_callback()
|
| 55 |
+
{
|
| 56 |
+
global $wp_registered_widgets;
|
| 57 |
+
|
| 58 |
+
$original_callback_params = func_get_args();
|
| 59 |
+
$widget_id = $original_callback_params[ 0 ][ 'widget_id' ];
|
| 60 |
+
|
| 61 |
+
$original_callback = $wp_registered_widgets[ $widget_id ][ '_wo_original_callback' ];
|
| 62 |
+
$wp_registered_widgets[ $widget_id ][ 'callback' ] = $original_callback;
|
| 63 |
+
|
| 64 |
+
$widget_id_base = $wp_registered_widgets[ $widget_id ][ 'callback' ][ 0 ]->id_base;
|
| 65 |
+
|
| 66 |
+
if ( ! is_callable( $original_callback ) ) {
|
| 67 |
+
return;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
ob_start();
|
| 71 |
+
|
| 72 |
+
call_user_func_array( $original_callback, $original_callback_params );
|
| 73 |
+
$widget_output = ob_get_clean();
|
| 74 |
+
|
| 75 |
+
echo apply_filters( self::FILTER_NAME, $widget_output, $widget_id_base, $widget_id );
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/*?>*/
|
libs/wprun/class-wprun-autoloader.php
CHANGED
|
@@ -1,115 +1,159 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPRun_Autoloader_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* @package WPRun
|
| 6 |
-
* @category WordPress Library
|
| 7 |
-
* @version 1.0.0
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
class WPRun_Autoloader_1x0x0
|
| 14 |
-
{
|
| 15 |
-
|
| 16 |
-
/**
|
| 17 |
-
* @var array
|
| 18 |
-
*/
|
| 19 |
-
private $settings = array(
|
| 20 |
-
'file_name_prefix' => 'class-',
|
| 21 |
-
'replace_dashes_with' => '-',
|
| 22 |
-
);
|
| 23 |
-
|
| 24 |
-
/**
|
| 25 |
-
* @var array
|
| 26 |
-
*/
|
| 27 |
-
private $paths = array();
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Constructor
|
| 31 |
-
* @param array $settings Optional
|
| 32 |
-
*/
|
| 33 |
-
final public function __construct( array $settings = array() )
|
| 34 |
-
{
|
| 35 |
-
$this->settings = wp_parse_args( $settings, $this->settings );
|
| 36 |
-
|
| 37 |
-
spl_autoload_register( array( $this, 'load_class' ) );
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
/**
|
| 41 |
-
* Add path to folder containing classes
|
| 42 |
-
* @param string $path
|
| 43 |
-
* @param boolean $include_subfolders Optional
|
| 44 |
-
* @return void
|
| 45 |
-
*/
|
| 46 |
-
final public function add_path( $path, $include_subfolders = false )
|
| 47 |
-
{
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
if (
|
| 66 |
-
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
*
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPRun_Autoloader_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* @package WPRun
|
| 6 |
+
* @category WordPress Library
|
| 7 |
+
* @version 1.0.0
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
class WPRun_Autoloader_1x0x0
|
| 14 |
+
{
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* @var array
|
| 18 |
+
*/
|
| 19 |
+
private $settings = array(
|
| 20 |
+
'file_name_prefix' => 'class-',
|
| 21 |
+
'replace_dashes_with' => '-',
|
| 22 |
+
);
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* @var array
|
| 26 |
+
*/
|
| 27 |
+
private $paths = array();
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Constructor
|
| 31 |
+
* @param array $settings Optional
|
| 32 |
+
*/
|
| 33 |
+
final public function __construct( array $settings = array() )
|
| 34 |
+
{
|
| 35 |
+
$this->settings = wp_parse_args( $settings, $this->settings );
|
| 36 |
+
|
| 37 |
+
spl_autoload_register( array( $this, 'load_class' ) );
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
/**
|
| 41 |
+
* Add path to folder containing classes
|
| 42 |
+
* @param string $path
|
| 43 |
+
* @param boolean $include_subfolders Optional
|
| 44 |
+
* @return void
|
| 45 |
+
*/
|
| 46 |
+
final public function add_path( $path, $include_subfolders = false )
|
| 47 |
+
{
|
| 48 |
+
$absolute_path = self::get_absolute_path( $path );
|
| 49 |
+
|
| 50 |
+
if ( ! is_dir( $absolute_path ) ) {
|
| 51 |
+
return;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if ( in_array( $absolute_path, $this->paths ) ) {
|
| 55 |
+
return;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
$this->paths[] = $absolute_path;
|
| 59 |
+
|
| 60 |
+
// include subfolders
|
| 61 |
+
if ( true === $include_subfolders ) {
|
| 62 |
+
$entries = scandir( $absolute_path );
|
| 63 |
+
|
| 64 |
+
foreach ( $entries as $entry ) {
|
| 65 |
+
if ( '.' === $entry || '..' === $entry ) {
|
| 66 |
+
continue;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
$item = $absolute_path . DIRECTORY_SEPARATOR . $entry;
|
| 70 |
+
|
| 71 |
+
if ( ! is_dir( $item ) ) {
|
| 72 |
+
continue;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
$this->add_path( $item, true );
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Get all paths
|
| 82 |
+
* @return array
|
| 83 |
+
*/
|
| 84 |
+
final public function get_paths()
|
| 85 |
+
{
|
| 86 |
+
return $this->paths;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* Loads a class file
|
| 91 |
+
* @param string $class_name
|
| 92 |
+
* @return void
|
| 93 |
+
*/
|
| 94 |
+
public function load_class( $class_name )
|
| 95 |
+
{
|
| 96 |
+
// remove version postfix
|
| 97 |
+
$pure_class_name = preg_replace( '/_\d+x\d+x\d+/', '', $class_name );
|
| 98 |
+
|
| 99 |
+
$file_name = '';
|
| 100 |
+
$file_name .= $this->settings[ 'file_name_prefix' ];
|
| 101 |
+
$file_name .= str_replace( '_', $this->settings[ 'replace_dashes_with' ], $pure_class_name );
|
| 102 |
+
$file_name .= '.php';
|
| 103 |
+
|
| 104 |
+
$lower_file_name = strtolower( $file_name );
|
| 105 |
+
|
| 106 |
+
foreach ( $this->paths as $path ) {
|
| 107 |
+
$file_path = $path . DIRECTORY_SEPARATOR . $lower_file_name;
|
| 108 |
+
|
| 109 |
+
if ( file_exists( $file_path ) ) {
|
| 110 |
+
require_once $file_path;
|
| 111 |
+
|
| 112 |
+
// return if class is available else it was probably
|
| 113 |
+
// the wrong version (postfix) and should continue looking
|
| 114 |
+
if ( class_exists( $class_name ) ) {
|
| 115 |
+
return;
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
/**
|
| 122 |
+
* Convert to clean absolute path
|
| 123 |
+
* @param string $path
|
| 124 |
+
* @return string
|
| 125 |
+
*/
|
| 126 |
+
final static protected function get_absolute_path( $path )
|
| 127 |
+
{
|
| 128 |
+
// convert to OS directory separator
|
| 129 |
+
$clean_path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
|
| 130 |
+
|
| 131 |
+
$parts = array_filter( explode( DIRECTORY_SEPARATOR, $clean_path ), 'strlen' );
|
| 132 |
+
|
| 133 |
+
$absolutes = array();
|
| 134 |
+
|
| 135 |
+
foreach ( $parts as $part ) {
|
| 136 |
+
if ( '.' === $part ) {
|
| 137 |
+
continue;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
if ( '..' === $part ) {
|
| 141 |
+
array_pop( $absolutes );
|
| 142 |
+
} else {
|
| 143 |
+
$absolutes[] = $part;
|
| 144 |
+
}
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
$absolute_path = implode( DIRECTORY_SEPARATOR, $absolutes );
|
| 148 |
+
|
| 149 |
+
// check if given path started with directory separator
|
| 150 |
+
if ( DIRECTORY_SEPARATOR === $clean_path[ 0 ] ) {
|
| 151 |
+
$absolute_path = DIRECTORY_SEPARATOR . $absolute_path;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
return $absolute_path;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/*?>*/
|
libs/wprun/class-wprun-base.php
CHANGED
|
@@ -1,400 +1,375 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Class WPRun_Base_1x0x0
|
| 4 |
-
*
|
| 5 |
-
* Base class for
|
| 6 |
-
* All subclasses are singletons and can be instantiated with
|
| 7 |
-
*
|
| 8 |
-
*
|
| 9 |
-
* @package WPRun
|
| 10 |
-
* @category WordPress Library
|
| 11 |
-
* @version 1.0.0
|
| 12 |
-
* @author Victor Villaverde Laan
|
| 13 |
-
* @link http://www.finewebdev.com
|
| 14 |
-
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 15 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 16 |
-
*/
|
| 17 |
-
abstract class WPRun_Base_1x0x0
|
| 18 |
-
{
|
| 19 |
-
|
| 20 |
-
const RETURN_VOID = '__VOID__';
|
| 21 |
-
|
| 22 |
-
/**
|
| 23 |
-
* Page hook
|
| 24 |
-
*
|
| 25 |
-
*
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
*
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
* @
|
| 70 |
-
*/
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
$
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
}
|
| 111 |
-
|
| 112 |
-
//
|
| 113 |
-
$
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
* @
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
*
|
| 192 |
-
* @param
|
| 193 |
-
* @
|
| 194 |
-
*/
|
| 195 |
-
final
|
| 196 |
-
{
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
$return_value
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
$
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
$
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
if (
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
*
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
*
|
| 335 |
-
* @
|
| 336 |
-
*/
|
| 337 |
-
|
| 338 |
-
{
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
if (
|
| 344 |
-
$
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
} else {
|
| 377 |
-
trigger_error( '"' . $hook_type . '" is not a valid hookType.' );
|
| 378 |
-
}
|
| 379 |
-
}
|
| 380 |
-
|
| 381 |
-
/**
|
| 382 |
-
* @param string $prefix
|
| 383 |
-
* @param string $name
|
| 384 |
-
* @return string|null
|
| 385 |
-
*/
|
| 386 |
-
private static function fetch_name_containing_prefix( $prefix, $name )
|
| 387 |
-
{
|
| 388 |
-
$prefix_length = strlen( $prefix );
|
| 389 |
-
|
| 390 |
-
if ( $prefix !== substr( $name, 0, $prefix_length) ) {
|
| 391 |
-
return null;
|
| 392 |
-
}
|
| 393 |
-
|
| 394 |
-
$fetchedName = substr( $name, $prefix_length );
|
| 395 |
-
return $fetchedName;
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
}
|
| 399 |
-
|
| 400 |
-
/*?>*/
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Class WPRun_Base_1x0x0
|
| 4 |
+
*
|
| 5 |
+
* Base abstract class can be extended for easy WP Plugin and Theme development.
|
| 6 |
+
* All subclasses are singletons and can be instantiated with the static
|
| 7 |
+
* "create()" factory method.
|
| 8 |
+
*
|
| 9 |
+
* @package WPRun
|
| 10 |
+
* @category WordPress Library
|
| 11 |
+
* @version 1.0.0
|
| 12 |
+
* @author Victor Villaverde Laan
|
| 13 |
+
* @link http://www.finewebdev.com
|
| 14 |
+
* @link https://github.com/freelancephp/WPRun-WordPress-Development
|
| 15 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 16 |
+
*/
|
| 17 |
+
abstract class WPRun_Base_1x0x0
|
| 18 |
+
{
|
| 19 |
+
|
| 20 |
+
const RETURN_VOID = '__VOID__';
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Page hook
|
| 24 |
+
* Page hook can be set by subclasses, in that case filter and action methods
|
| 25 |
+
* will only be set if page hook is the current screen id
|
| 26 |
+
* @var string
|
| 27 |
+
*/
|
| 28 |
+
protected $page_hook = null;
|
| 29 |
+
|
| 30 |
+
/**
|
| 31 |
+
* Automatically set action and filter methods
|
| 32 |
+
* @var boolean
|
| 33 |
+
*/
|
| 34 |
+
protected $autoset_hook_methods = true;
|
| 35 |
+
|
| 36 |
+
/**
|
| 37 |
+
* @var string
|
| 38 |
+
*/
|
| 39 |
+
protected $action_prefix = 'action_';
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* @var string
|
| 43 |
+
*/
|
| 44 |
+
protected $filter_prefix = 'filter_';
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Only for internal use (to recognize a callback call)
|
| 48 |
+
* @var string
|
| 49 |
+
*/
|
| 50 |
+
private $internal_callback_prefix = '_cb_';
|
| 51 |
+
|
| 52 |
+
/**
|
| 53 |
+
* List of (singleton) instances
|
| 54 |
+
* Only for internal use
|
| 55 |
+
* @var array
|
| 56 |
+
*/
|
| 57 |
+
private static $instances = array();
|
| 58 |
+
|
| 59 |
+
/**
|
| 60 |
+
* @var array
|
| 61 |
+
*/
|
| 62 |
+
private $arguments = array();
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Factory method
|
| 66 |
+
* @param mixed $param1 Optional, will be passed on to the constructor and init() method
|
| 67 |
+
* @param mixed $paramN Optional, will be passed on to the constructor and init() method
|
| 68 |
+
* @return WPRun_Base_1x0x0
|
| 69 |
+
* @triggers E_USER_NOTICE Class already created
|
| 70 |
+
*/
|
| 71 |
+
final public static function create()
|
| 72 |
+
{
|
| 73 |
+
$class_name = get_called_class();
|
| 74 |
+
$arguments = func_get_args();
|
| 75 |
+
|
| 76 |
+
// check if instance of this class already exists
|
| 77 |
+
if ( key_exists( $class_name, self::$instances ) ) {
|
| 78 |
+
trigger_error( 'Class "'. $class_name .'" was already created.' );
|
| 79 |
+
return;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// pass all arguments to constructor
|
| 83 |
+
$instance = new $class_name( $arguments );
|
| 84 |
+
|
| 85 |
+
return $instance;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Constructor
|
| 90 |
+
* @triggers E_USER_NOTICE
|
| 91 |
+
*/
|
| 92 |
+
private function __construct( array $arguments )
|
| 93 |
+
{
|
| 94 |
+
$class_name = get_called_class();
|
| 95 |
+
self::$instances[ $class_name ] = $this;
|
| 96 |
+
|
| 97 |
+
$this->arguments = $arguments;
|
| 98 |
+
|
| 99 |
+
// call init method
|
| 100 |
+
$method_name = 'init';
|
| 101 |
+
|
| 102 |
+
if ( method_exists( $this, $method_name ) ) {
|
| 103 |
+
$method_reflection = new ReflectionMethod( get_called_class(), $method_name );
|
| 104 |
+
|
| 105 |
+
if ( $method_reflection->isProtected() ) {
|
| 106 |
+
call_user_func_array( array( $this, $method_name ), $this->arguments );
|
| 107 |
+
} else {
|
| 108 |
+
trigger_error( 'Method "'. $method_name .'" should be made protected in class "'. get_called_class() .'".' );
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
// automatically set methods as callback for WP hooks
|
| 113 |
+
if ( true === $this->autoset_hook_methods ) {
|
| 114 |
+
$this->set_hook_methods();
|
| 115 |
+
}
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
/**
|
| 119 |
+
* @return WPRun_Base_1x0x0
|
| 120 |
+
* @triggers E_USER_NOTICE Instance not yet created
|
| 121 |
+
*/
|
| 122 |
+
final public static function get_instance()
|
| 123 |
+
{
|
| 124 |
+
$class_name = get_called_class();
|
| 125 |
+
|
| 126 |
+
if ( ! isset( self::$instances[ $class_name ] ) ) {
|
| 127 |
+
trigger_error( 'Instance of "'. $class_name .'" was not created.' );
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
return self::$instances[ $class_name ];
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/**
|
| 134 |
+
* Get argument passed on to the constructor
|
| 135 |
+
* @param integer $index Optional, when null return all arguments
|
| 136 |
+
* @return mixed|null
|
| 137 |
+
*/
|
| 138 |
+
final protected function get_argument( $index = null )
|
| 139 |
+
{
|
| 140 |
+
// return all arguments when no index given
|
| 141 |
+
if ( null === $index ) {
|
| 142 |
+
return $this->arguments;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
if ( !isset( $this->arguments[ $index ] ) ) {
|
| 146 |
+
return null;
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
return $this->arguments[ $index ];
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
/**
|
| 153 |
+
* @param string $template_file_path
|
| 154 |
+
* @param array $vars Optional
|
| 155 |
+
* @triggers E_USER_NOTICE Template file not readable
|
| 156 |
+
*/
|
| 157 |
+
final public static function show_template( $template_file_path, array $vars = array() )
|
| 158 |
+
{
|
| 159 |
+
if ( is_readable( $template_file_path ) ) {
|
| 160 |
+
// show file
|
| 161 |
+
include $template_file_path;
|
| 162 |
+
} else {
|
| 163 |
+
trigger_error( 'Template file "' . $template_file_path . '" is not readable or may not exists.' );
|
| 164 |
+
}
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/**
|
| 168 |
+
* @param string $template_file_path
|
| 169 |
+
* @param array $vars Optional
|
| 170 |
+
* @triggers E_USER_NOTICE Template file not readable
|
| 171 |
+
*/
|
| 172 |
+
final public static function render_template( $template_file_path, array $vars = array() )
|
| 173 |
+
{
|
| 174 |
+
// start output buffer
|
| 175 |
+
ob_start();
|
| 176 |
+
|
| 177 |
+
// output template
|
| 178 |
+
self::show_template( $template_file_path, $vars );
|
| 179 |
+
|
| 180 |
+
// get the view content
|
| 181 |
+
$content = ob_get_contents();
|
| 182 |
+
|
| 183 |
+
// clean output buffer
|
| 184 |
+
ob_end_clean();
|
| 185 |
+
|
| 186 |
+
return $content;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
/**
|
| 190 |
+
* Get a callable to a method in current instance, when called will be
|
| 191 |
+
* caught by __callStatic(), were the magic happens
|
| 192 |
+
* @param string $method_name
|
| 193 |
+
* @return callable
|
| 194 |
+
*/
|
| 195 |
+
final protected function get_callback( $method_name )
|
| 196 |
+
{
|
| 197 |
+
return array( get_called_class(), $this->internal_callback_prefix . $method_name );
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
/**
|
| 201 |
+
* @param string $method_name
|
| 202 |
+
* @param array $arguments
|
| 203 |
+
* @return mixed|void
|
| 204 |
+
* @triggers E_USER_NOTICE Method name not exists/callable
|
| 205 |
+
*/
|
| 206 |
+
public function __call( $method_name, $arguments )
|
| 207 |
+
{
|
| 208 |
+
$return_value = self::magic_call( $method_name, $arguments );
|
| 209 |
+
|
| 210 |
+
if ( self::RETURN_VOID === $return_value ) {
|
| 211 |
+
trigger_error( 'Method name "'. $method_name .'" does not exists or cannot be called.' );
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
return $return_value;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
/**
|
| 218 |
+
* @param string $method_name
|
| 219 |
+
* @param array $arguments
|
| 220 |
+
* @return mixed|void
|
| 221 |
+
* @triggers E_USER_NOTICE Method name not exists/callable
|
| 222 |
+
*/
|
| 223 |
+
public static function __callStatic( $method_name, $arguments )
|
| 224 |
+
{
|
| 225 |
+
$return_value = self::magic_call( $method_name, $arguments );
|
| 226 |
+
|
| 227 |
+
if ( self::RETURN_VOID === $return_value ) {
|
| 228 |
+
trigger_error( 'Method name "'. $method_name .'" does not exists or cannot be called.' );
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
return $return_value;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/**
|
| 235 |
+
* @param string $method_name
|
| 236 |
+
* @param array $arguments
|
| 237 |
+
* @return mixed|void
|
| 238 |
+
*/
|
| 239 |
+
final protected static function magic_call( $method_name, $arguments )
|
| 240 |
+
{
|
| 241 |
+
$class_name = get_called_class();
|
| 242 |
+
$instance = self::$instances[ $class_name ];
|
| 243 |
+
|
| 244 |
+
// catch callbacks set by get_callback() method
|
| 245 |
+
// this way callbacks can also be implemented as protected
|
| 246 |
+
$given_callback_name = self::fetch_name_containing_prefix( $instance->internal_callback_prefix, $method_name );
|
| 247 |
+
|
| 248 |
+
// normal callback
|
| 249 |
+
if ( null !== $given_callback_name ) {
|
| 250 |
+
$real_args = $arguments;
|
| 251 |
+
|
| 252 |
+
$given_method_name = $given_callback_name;
|
| 253 |
+
|
| 254 |
+
$callable = array( $instance, $given_method_name );
|
| 255 |
+
|
| 256 |
+
if ( is_callable( $callable ) ) {
|
| 257 |
+
return call_user_func_array( $callable, $real_args );
|
| 258 |
+
}
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
return self::RETURN_VOID;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/**
|
| 265 |
+
* Check and auto-initialize methods for hooks
|
| 266 |
+
*/
|
| 267 |
+
final protected function set_hook_methods()
|
| 268 |
+
{
|
| 269 |
+
$methods = get_class_methods( $this );
|
| 270 |
+
|
| 271 |
+
foreach ( $methods as $method_name ) {
|
| 272 |
+
$action_name = self::fetch_name_containing_prefix( $this->action_prefix, $method_name );
|
| 273 |
+
if ( null !== $action_name ) {
|
| 274 |
+
$this->add_to_hook( 'action', $action_name, $method_name );
|
| 275 |
+
continue;
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
$filter_name = self::fetch_name_containing_prefix( $this->filter_prefix, $method_name );
|
| 279 |
+
if ( null !== $filter_name ) {
|
| 280 |
+
$this->add_to_hook( 'filter', $filter_name, $method_name );
|
| 281 |
+
continue;
|
| 282 |
+
}
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
/**
|
| 287 |
+
* @param string $hook_type "action" or "filter"
|
| 288 |
+
* @param string $hook_name
|
| 289 |
+
* @param string $method_name
|
| 290 |
+
* @triggers E_USER_NOTICE
|
| 291 |
+
*/
|
| 292 |
+
private function add_to_hook( $hook_type, $hook_name, $method_name )
|
| 293 |
+
{
|
| 294 |
+
// fetch priority outof method name
|
| 295 |
+
$split_method_Name = explode( '_', $method_name );
|
| 296 |
+
$last = end( $split_method_Name );
|
| 297 |
+
|
| 298 |
+
if ( is_numeric( $last ) ) {
|
| 299 |
+
$priority = (int) $last;
|
| 300 |
+
$wp_hook_name = str_replace( '_' . $last, '', $hook_name );
|
| 301 |
+
} else {
|
| 302 |
+
$priority = 10;
|
| 303 |
+
$wp_hook_name = $hook_name;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// get the method's number of params
|
| 307 |
+
$method_reflection = new ReflectionMethod( get_called_class(), $method_name );
|
| 308 |
+
$accepted_args = $method_reflection->getNumberOfParameters();
|
| 309 |
+
|
| 310 |
+
// set internal wp hook action or filter callback
|
| 311 |
+
$method_callback = $this->get_callback( $method_name );
|
| 312 |
+
$check_call_hook = $this->get_callback( 'check_call_hook' );
|
| 313 |
+
|
| 314 |
+
$callback = function () use ( $method_callback, $check_call_hook ) {
|
| 315 |
+
$call_hook = call_user_func( $check_call_hook );
|
| 316 |
+
|
| 317 |
+
if ( false === $call_hook ) {
|
| 318 |
+
return;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
return call_user_func_array( $method_callback, func_get_args() );
|
| 322 |
+
};
|
| 323 |
+
|
| 324 |
+
if ( 'action' === $hook_type ) {
|
| 325 |
+
add_action( $wp_hook_name, $callback, $priority, $accepted_args );
|
| 326 |
+
} elseif ('filter' === $hook_type) {
|
| 327 |
+
add_filter( $wp_hook_name, $callback, $priority, $accepted_args );
|
| 328 |
+
} else {
|
| 329 |
+
trigger_error( '"' . $hook_type . '" is not a valid hookType.' );
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
/**
|
| 334 |
+
* Check if an action or filter hook should be called (correct page hook)
|
| 335 |
+
* @return boolean
|
| 336 |
+
*/
|
| 337 |
+
final protected function check_call_hook()
|
| 338 |
+
{
|
| 339 |
+
if ( null === $this->page_hook ) {
|
| 340 |
+
return true;
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
if ( is_network_admin() ) {
|
| 344 |
+
$page_hook = $this->page_hook .'-network';
|
| 345 |
+
} else {
|
| 346 |
+
$page_hook = $this->page_hook;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
if ( get_current_screen()->id === $page_hook ) {
|
| 350 |
+
return true;
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
return false;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
/**
|
| 357 |
+
* @param string $prefix
|
| 358 |
+
* @param string $name
|
| 359 |
+
* @return string|null
|
| 360 |
+
*/
|
| 361 |
+
private static function fetch_name_containing_prefix( $prefix, $name )
|
| 362 |
+
{
|
| 363 |
+
$prefix_length = strlen( $prefix );
|
| 364 |
+
|
| 365 |
+
if ( $prefix !== substr( $name, 0, $prefix_length) ) {
|
| 366 |
+
return null;
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
$fetchedName = substr( $name, $prefix_length );
|
| 370 |
+
return $fetchedName;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
/*?>*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public/css/wpel-admin.css
CHANGED
|
@@ -1,117 +1,127 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* WP External Links Plugin
|
| 3 |
-
* Admin Style
|
| 4 |
-
*/
|
| 5 |
-
|
| 6 |
-
.wpel-no-label,
|
| 7 |
-
.wpel-no-label th,
|
| 8 |
-
.wpel-no-label td {
|
| 9 |
-
padding-top: 0;
|
| 10 |
-
}
|
| 11 |
-
.wpel-no-label th:after {
|
| 12 |
-
content: '\00a0';
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
a.toplevel_page_wpel-
|
| 24 |
-
font-family: FontAwesome;
|
| 25 |
-
content: '\f14c';
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
.
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
.wpel-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
.
|
| 44 |
-
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
.wpel-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
.wpel-
|
| 108 |
-
content: "\
|
| 109 |
-
}
|
| 110 |
-
.wpel-
|
| 111 |
-
content: "\f085";
|
| 112 |
-
}
|
| 113 |
-
.wpel-
|
| 114 |
-
content: "\f128";
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* WP External Links Plugin
|
| 3 |
+
* Admin Style
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
.wpel-no-label,
|
| 7 |
+
.wpel-no-label th,
|
| 8 |
+
.wpel-no-label td {
|
| 9 |
+
padding-top: 0;
|
| 10 |
+
}
|
| 11 |
+
.wpel-no-label th:after {
|
| 12 |
+
content: '\00a0';
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
.wpel-hidden {
|
| 16 |
+
display: none;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Menu Icon
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
a.toplevel_page_wpel-settings-page .wp-menu-image:before {
|
| 24 |
+
font-family: FontAwesome;
|
| 25 |
+
content: '\f14c';
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
a.toplevel_page_wpel-network-settings-page .wp-menu-image:before {
|
| 29 |
+
font-family: FontAwesome;
|
| 30 |
+
content: '\f14c';
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
/**
|
| 34 |
+
* Tabs
|
| 35 |
+
*/
|
| 36 |
+
|
| 37 |
+
.wpel-settings-page .nav-tab i,
|
| 38 |
+
.wpel-network-page .nav-tab i {
|
| 39 |
+
margin-right: 5px;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.wpel-settings-page .nav-tab-support,
|
| 43 |
+
.wpel-network-page .nav-tab-support {
|
| 44 |
+
float: right;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.wpel-settings-page form,
|
| 48 |
+
.wpel-network-page form {
|
| 49 |
+
position: relative;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
.js-wpel-apply-child td {
|
| 53 |
+
padding-left: 30px;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
.wpel-icon-type-image-column {
|
| 57 |
+
min-width: 10em;
|
| 58 |
+
float: left;
|
| 59 |
+
}
|
| 60 |
+
.wpel-icon-type-image-column:after {
|
| 61 |
+
clear: both;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
::-webkit-input-placeholder {
|
| 65 |
+
color: #ccc;
|
| 66 |
+
font-style: italic;
|
| 67 |
+
}
|
| 68 |
+
:-moz-placeholder { /* Firefox 18- */
|
| 69 |
+
color: #ccc;
|
| 70 |
+
font-style: italic;
|
| 71 |
+
}
|
| 72 |
+
::-moz-placeholder { /* Firefox 19+ */
|
| 73 |
+
color: #ccc;
|
| 74 |
+
font-style: italic;
|
| 75 |
+
}
|
| 76 |
+
:-ms-input-placeholder {
|
| 77 |
+
color: #ccc;
|
| 78 |
+
font-style: italic;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
/**
|
| 83 |
+
* Background Icon
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
.wpel-settings-page form:before,
|
| 87 |
+
.wpel-network-page form:before {
|
| 88 |
+
font-family: FontAwesome;
|
| 89 |
+
opacity: 0.2;
|
| 90 |
+
color: #aaa;
|
| 91 |
+
font-size: 200pt;
|
| 92 |
+
position: absolute;
|
| 93 |
+
top: 140px;
|
| 94 |
+
right: 40px;
|
| 95 |
+
z-index: -1;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.wpel-settings-page-external-links form:before {
|
| 99 |
+
content: "\f14c";
|
| 100 |
+
}
|
| 101 |
+
.wpel-settings-page-internal-links form:before {
|
| 102 |
+
content: "\f096";
|
| 103 |
+
}
|
| 104 |
+
.wpel-settings-page-excluded-links form:before {
|
| 105 |
+
content: "\f14d";
|
| 106 |
+
}
|
| 107 |
+
.wpel-settings-page-exceptions form:before {
|
| 108 |
+
content: "\f009";
|
| 109 |
+
}
|
| 110 |
+
.wpel-settings-page-admin form:before {
|
| 111 |
+
content: "\f085";
|
| 112 |
+
}
|
| 113 |
+
.wpel-settings-page-support form:before {
|
| 114 |
+
content: "\f128";
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.wpel-network-page-network-settings form:before {
|
| 118 |
+
content: "\f0e8";
|
| 119 |
+
}
|
| 120 |
+
.wpel-network-page-network-admin-settings form:before {
|
| 121 |
+
content: "\f085";
|
| 122 |
+
}
|
| 123 |
+
.wpel-network-page-support form:before {
|
| 124 |
+
content: "\f128";
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
public/css/wpel.css
CHANGED
|
@@ -1,58 +1,58 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* WP External Links Plugin
|
| 3 |
-
* Front Style
|
| 4 |
-
*/
|
| 5 |
-
|
| 6 |
-
.wpel-icon.dashicons-before:before {
|
| 7 |
-
font-size: inherit;
|
| 8 |
-
line-height: inherit;
|
| 9 |
-
width: auto;
|
| 10 |
-
}
|
| 11 |
-
|
| 12 |
-
.wpel-icon-left i.wpel-icon.dashicons-before {
|
| 13 |
-
margin-right: 0.2em;
|
| 14 |
-
}
|
| 15 |
-
.wpel-icon-right i.wpel-icon.dashicons-before {
|
| 16 |
-
margin-left: 0.2em;
|
| 17 |
-
}
|
| 18 |
-
.wpel-icon-left i.wpel-icon {
|
| 19 |
-
margin-right: 0.3em;
|
| 20 |
-
}
|
| 21 |
-
.wpel-icon-right i.wpel-icon {
|
| 22 |
-
margin-left: 0.3em;
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
.wpel-icon.wpel-image {
|
| 26 |
-
display: inline-block;
|
| 27 |
-
width: 10px;
|
| 28 |
-
height: 10px;
|
| 29 |
-
background-repeat: no-repeat;
|
| 30 |
-
background-position: 100% 50%;
|
| 31 |
-
}
|
| 32 |
-
.wpel-icon-left .wpel-icon.wpel-image {
|
| 33 |
-
margin-right: 0.3em;
|
| 34 |
-
}
|
| 35 |
-
.wpel-icon-right .wpel-icon.wpel-image {
|
| 36 |
-
margin-left: 0.3em;
|
| 37 |
-
}
|
| 38 |
-
|
| 39 |
-
.wpel-icon-1 { background-image: url('../images/wpel-icons/icon-1.png'); }
|
| 40 |
-
.wpel-icon-2 { background-image: url('../images/wpel-icons/icon-2.png'); }
|
| 41 |
-
.wpel-icon-3 { background-image: url('../images/wpel-icons/icon-3.png'); }
|
| 42 |
-
.wpel-icon-4 { background-image: url('../images/wpel-icons/icon-4.png'); }
|
| 43 |
-
.wpel-icon-5 { background-image: url('../images/wpel-icons/icon-5.png'); }
|
| 44 |
-
.wpel-icon-6 { background-image: url('../images/wpel-icons/icon-6.png'); }
|
| 45 |
-
.wpel-icon-7 { background-image: url('../images/wpel-icons/icon-7.png'); }
|
| 46 |
-
.wpel-icon-8 { background-image: url('../images/wpel-icons/icon-8.png'); }
|
| 47 |
-
.wpel-icon-9 { background-image: url('../images/wpel-icons/icon-9.png'); }
|
| 48 |
-
.wpel-icon-10 { background-image: url('../images/wpel-icons/icon-10.png'); }
|
| 49 |
-
.wpel-icon-11 { background-image: url('../images/wpel-icons/icon-11.png'); }
|
| 50 |
-
.wpel-icon-12 { background-image: url('../images/wpel-icons/icon-12.png'); }
|
| 51 |
-
.wpel-icon-13 { background-image: url('../images/wpel-icons/icon-13.png'); }
|
| 52 |
-
.wpel-icon-14 { background-image: url('../images/wpel-icons/icon-14.png'); }
|
| 53 |
-
.wpel-icon-15 { background-image: url('../images/wpel-icons/icon-15.png'); }
|
| 54 |
-
.wpel-icon-16 { background-image: url('../images/wpel-icons/icon-16.png'); }
|
| 55 |
-
.wpel-icon-17 { background-image: url('../images/wpel-icons/icon-17.png'); }
|
| 56 |
-
.wpel-icon-18 { background-image: url('../images/wpel-icons/icon-18.png'); }
|
| 57 |
-
.wpel-icon-19 { background-image: url('../images/wpel-icons/icon-19.png'); }
|
| 58 |
-
.wpel-icon-20 { background-image: url('../images/wpel-icons/icon-20.png'); }
|
| 1 |
+
/**
|
| 2 |
+
* WP External Links Plugin
|
| 3 |
+
* Front Style
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
.wpel-icon.dashicons-before:before {
|
| 7 |
+
font-size: inherit;
|
| 8 |
+
line-height: inherit;
|
| 9 |
+
width: auto;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
.wpel-icon-left i.wpel-icon.dashicons-before {
|
| 13 |
+
margin-right: 0.2em;
|
| 14 |
+
}
|
| 15 |
+
.wpel-icon-right i.wpel-icon.dashicons-before {
|
| 16 |
+
margin-left: 0.2em;
|
| 17 |
+
}
|
| 18 |
+
.wpel-icon-left i.wpel-icon {
|
| 19 |
+
margin-right: 0.3em;
|
| 20 |
+
}
|
| 21 |
+
.wpel-icon-right i.wpel-icon {
|
| 22 |
+
margin-left: 0.3em;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
.wpel-icon.wpel-image {
|
| 26 |
+
display: inline-block;
|
| 27 |
+
width: 10px;
|
| 28 |
+
height: 10px;
|
| 29 |
+
background-repeat: no-repeat;
|
| 30 |
+
background-position: 100% 50%;
|
| 31 |
+
}
|
| 32 |
+
.wpel-icon-left .wpel-icon.wpel-image {
|
| 33 |
+
margin-right: 0.3em;
|
| 34 |
+
}
|
| 35 |
+
.wpel-icon-right .wpel-icon.wpel-image {
|
| 36 |
+
margin-left: 0.3em;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.wpel-icon-1 { background-image: url('../images/wpel-icons/icon-1.png'); }
|
| 40 |
+
.wpel-icon-2 { background-image: url('../images/wpel-icons/icon-2.png'); }
|
| 41 |
+
.wpel-icon-3 { background-image: url('../images/wpel-icons/icon-3.png'); }
|
| 42 |
+
.wpel-icon-4 { background-image: url('../images/wpel-icons/icon-4.png'); }
|
| 43 |
+
.wpel-icon-5 { background-image: url('../images/wpel-icons/icon-5.png'); }
|
| 44 |
+
.wpel-icon-6 { background-image: url('../images/wpel-icons/icon-6.png'); }
|
| 45 |
+
.wpel-icon-7 { background-image: url('../images/wpel-icons/icon-7.png'); }
|
| 46 |
+
.wpel-icon-8 { background-image: url('../images/wpel-icons/icon-8.png'); }
|
| 47 |
+
.wpel-icon-9 { background-image: url('../images/wpel-icons/icon-9.png'); }
|
| 48 |
+
.wpel-icon-10 { background-image: url('../images/wpel-icons/icon-10.png'); }
|
| 49 |
+
.wpel-icon-11 { background-image: url('../images/wpel-icons/icon-11.png'); }
|
| 50 |
+
.wpel-icon-12 { background-image: url('../images/wpel-icons/icon-12.png'); }
|
| 51 |
+
.wpel-icon-13 { background-image: url('../images/wpel-icons/icon-13.png'); }
|
| 52 |
+
.wpel-icon-14 { background-image: url('../images/wpel-icons/icon-14.png'); }
|
| 53 |
+
.wpel-icon-15 { background-image: url('../images/wpel-icons/icon-15.png'); }
|
| 54 |
+
.wpel-icon-16 { background-image: url('../images/wpel-icons/icon-16.png'); }
|
| 55 |
+
.wpel-icon-17 { background-image: url('../images/wpel-icons/icon-17.png'); }
|
| 56 |
+
.wpel-icon-18 { background-image: url('../images/wpel-icons/icon-18.png'); }
|
| 57 |
+
.wpel-icon-19 { background-image: url('../images/wpel-icons/icon-19.png'); }
|
| 58 |
+
.wpel-icon-20 { background-image: url('../images/wpel-icons/icon-20.png'); }
|
public/js/wpel-admin.js
CHANGED
|
@@ -1,106 +1,128 @@
|
|
| 1 |
-
/**
|
| 2 |
-
* WP External Links Plugin
|
| 3 |
-
* Admin
|
| 4 |
-
*/
|
| 5 |
-
/*global jQuery, window*/
|
| 6 |
-
jQuery(function ($) {
|
| 7 |
-
'use strict';
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
*
|
| 31 |
-
*/
|
| 32 |
-
$wrapper.on('change', '.js-
|
| 33 |
-
var
|
| 34 |
-
var $
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
if (
|
| 57 |
-
$
|
| 58 |
-
$
|
| 59 |
-
} else {
|
| 60 |
-
$
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
var
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* WP External Links Plugin
|
| 3 |
+
* Admin
|
| 4 |
+
*/
|
| 5 |
+
/*global jQuery, window*/
|
| 6 |
+
jQuery(function ($) {
|
| 7 |
+
'use strict';
|
| 8 |
+
|
| 9 |
+
// add custom jQuery show/hide function
|
| 10 |
+
$.extend($.fn, {
|
| 11 |
+
wpelShow: function () {
|
| 12 |
+
var self = this;
|
| 13 |
+
this.stop({ clearQueue: true, jumpToEnd: true });
|
| 14 |
+
this.fadeIn({ duration: 500, queue: false, complete: function () {
|
| 15 |
+
self.removeClass('wpel-hidden');
|
| 16 |
+
}});
|
| 17 |
+
},
|
| 18 |
+
wpelHide: function () {
|
| 19 |
+
var self = this;
|
| 20 |
+
this.stop({ clearQueue: true, jumpToEnd: true });
|
| 21 |
+
this.fadeOut({ duration: 500, queue: false, complete: function () {
|
| 22 |
+
self.addClass('wpel-hidden');
|
| 23 |
+
}});
|
| 24 |
+
}
|
| 25 |
+
});
|
| 26 |
+
|
| 27 |
+
var $wrapper = $('.wpel-settings-page');
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Apply Sections Settings
|
| 31 |
+
*/
|
| 32 |
+
$wrapper.on('change', '.js-wpel-apply input', function () {
|
| 33 |
+
var applyAll = $(this).is(':checked');
|
| 34 |
+
var $items = $wrapper.find('.js-wpel-apply-child');
|
| 35 |
+
|
| 36 |
+
if (applyAll) {
|
| 37 |
+
$items.wpelHide();
|
| 38 |
+
} else {
|
| 39 |
+
$items.wpelShow();
|
| 40 |
+
}
|
| 41 |
+
});
|
| 42 |
+
|
| 43 |
+
// trigger immediatly
|
| 44 |
+
$wrapper.find('.js-wpel-apply input[type="checkbox"]').change();
|
| 45 |
+
|
| 46 |
+
/**
|
| 47 |
+
* Link Settings
|
| 48 |
+
*/
|
| 49 |
+
$wrapper.on('change', '.js-icon-type select', function () {
|
| 50 |
+
var iconType = $(this).val();
|
| 51 |
+
var $itemsChild = $wrapper.find('.js-icon-type-child');
|
| 52 |
+
var $itemsDepend = $wrapper.find('.js-icon-type-depend');
|
| 53 |
+
|
| 54 |
+
$itemsChild.hide();
|
| 55 |
+
|
| 56 |
+
if (iconType === 'image') {
|
| 57 |
+
$itemsDepend.wpelShow();
|
| 58 |
+
$itemsChild.filter('.js-icon-type-image').wpelShow();
|
| 59 |
+
} else if (iconType === 'dashicon') {
|
| 60 |
+
$itemsDepend.wpelShow();
|
| 61 |
+
$itemsChild.filter('.js-icon-type-dashicon').wpelShow();
|
| 62 |
+
} else if (iconType === 'fontawesome') {
|
| 63 |
+
$itemsDepend.wpelShow();
|
| 64 |
+
$itemsChild.filter('.js-icon-type-fontawesome').wpelShow();
|
| 65 |
+
} else {
|
| 66 |
+
$itemsDepend.wpelHide();
|
| 67 |
+
}
|
| 68 |
+
});
|
| 69 |
+
|
| 70 |
+
$wrapper.on('change', '.js-apply-settings input[type="checkbox"]', function () {
|
| 71 |
+
var $items = $wrapper.find('.form-table tr').not('.js-apply-settings');
|
| 72 |
+
|
| 73 |
+
if ($(this).prop('checked')) {
|
| 74 |
+
$items.wpelShow();
|
| 75 |
+
$wrapper.find('.js-icon-type select').change();
|
| 76 |
+
} else {
|
| 77 |
+
$items.wpelHide();
|
| 78 |
+
}
|
| 79 |
+
});
|
| 80 |
+
|
| 81 |
+
// trigger immediatly
|
| 82 |
+
$wrapper.find('.js-apply-settings input[type="checkbox"]').change();
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
/**
|
| 86 |
+
* Support
|
| 87 |
+
* Copy to clipboard
|
| 88 |
+
*/
|
| 89 |
+
$wrapper.on('click', '.js-wpel-copy', function (e) {
|
| 90 |
+
e.preventDefault();
|
| 91 |
+
|
| 92 |
+
var node = $wrapper.find('.js-wpel-copy-target').get(0);
|
| 93 |
+
node.select();
|
| 94 |
+
|
| 95 |
+
var range = document.createRange();
|
| 96 |
+
range.selectNode(node);
|
| 97 |
+
window.getSelection().addRange(range);
|
| 98 |
+
|
| 99 |
+
try {
|
| 100 |
+
document.execCommand('copy');
|
| 101 |
+
} catch(err) {
|
| 102 |
+
console.log('Unable to copy');
|
| 103 |
+
}
|
| 104 |
+
});
|
| 105 |
+
|
| 106 |
+
/**
|
| 107 |
+
* Help documentation links/buttons
|
| 108 |
+
*/
|
| 109 |
+
$wrapper.on('click', '[data-wpel-help]', function () {
|
| 110 |
+
var helpKey = $(this).data('wpel-help');
|
| 111 |
+
|
| 112 |
+
if (helpKey) {
|
| 113 |
+
// activate given tab
|
| 114 |
+
$('#tab-link-'+ helpKey +' a').click();
|
| 115 |
+
} else {
|
| 116 |
+
// activate first tab
|
| 117 |
+
$('.contextual-help-tabs li a').first().click();
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
$('#contextual-help-link[aria-expanded="false"]').click();
|
| 121 |
+
});
|
| 122 |
+
|
| 123 |
+
// show current tab
|
| 124 |
+
$wrapper.find('form').wpelShow();
|
| 125 |
+
// for network pages
|
| 126 |
+
$('.wpel-network-page').find('form').wpelShow();
|
| 127 |
+
|
| 128 |
+
});
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
Contributors: freelancephp
|
| 3 |
Tags: links, new window, new tab, external links, nofollow, follow, seo, noopener, noreferrer, internal links, link icon, link target, _blank, wpmu
|
| 4 |
Requires at least: 4.2.0
|
| 5 |
-
Tested up to: 4.7.
|
| 6 |
-
Stable tag: 2.1.
|
| 7 |
|
| 8 |
Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.
|
| 9 |
|
|
@@ -154,6 +154,24 @@ Add this JavaScript code to your site:
|
|
| 154 |
|
| 155 |
});`
|
| 156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
= I am a plugin developer and my plugin conflicts with WPEL. How can I solve the problem? =
|
| 158 |
|
| 159 |
If your plugin contains links it might be filtered by the WPEL plugin as well, causing a conflict.
|
|
@@ -239,6 +257,11 @@ See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more info.
|
|
| 239 |
|
| 240 |
== Changelog ==
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
= 2.1.1 =
|
| 243 |
* Fixed updating old plugin values
|
| 244 |
* Fixed links containing rel="external" will also be treated as external
|
| 2 |
Contributors: freelancephp
|
| 3 |
Tags: links, new window, new tab, external links, nofollow, follow, seo, noopener, noreferrer, internal links, link icon, link target, _blank, wpmu
|
| 4 |
Requires at least: 4.2.0
|
| 5 |
+
Tested up to: 4.7.5
|
| 6 |
+
Stable tag: 2.1.2
|
| 7 |
|
| 8 |
Open external links in a new tab / window, add "nofollow", "noopener" and font icons, SEO and more. Also for internal links.
|
| 9 |
|
| 154 |
|
| 155 |
});`
|
| 156 |
|
| 157 |
+
= How to open f.e. PDF files in a new window? =
|
| 158 |
+
|
| 159 |
+
Use some JavaScript code for opening PDF files in a new window:
|
| 160 |
+
|
| 161 |
+
`jQuery(function ($) {
|
| 162 |
+
$('a[href$=".pdf"]').prop('target', '_blank');
|
| 163 |
+
});`
|
| 164 |
+
|
| 165 |
+
= How to set another icon for secure sites (using https)? =
|
| 166 |
+
|
| 167 |
+
Use some CSS style to change the icon for secure sites using https:
|
| 168 |
+
|
| 169 |
+
`a[href^="https"] .wpel-icon:before {
|
| 170 |
+
content: "\f023" !important;
|
| 171 |
+
}`
|
| 172 |
+
|
| 173 |
+
The code `\f023` refers to a dashicon or font awesome icon.
|
| 174 |
+
|
| 175 |
= I am a plugin developer and my plugin conflicts with WPEL. How can I solve the problem? =
|
| 176 |
|
| 177 |
If your plugin contains links it might be filtered by the WPEL plugin as well, causing a conflict.
|
| 257 |
|
| 258 |
== Changelog ==
|
| 259 |
|
| 260 |
+
= 2.1.2 =
|
| 261 |
+
* Fixed bug checking internal links with https
|
| 262 |
+
* Fixed bug with REST API
|
| 263 |
+
* Fixed conflict Widget CSS Classes plugin (partially fixed)
|
| 264 |
+
|
| 265 |
= 2.1.1 =
|
| 266 |
* Fixed updating old plugin values
|
| 267 |
* Fixed links containing rel="external" will also be treated as external
|
templates/network-page/help-tabs/under-construction.php
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Help Tab: Data Attributes
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
?>
|
| 14 |
-
<h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
|
| 15 |
-
<p>
|
| 16 |
-
<?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
|
| 17 |
-
</p>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Help Tab: Data Attributes
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
?>
|
| 14 |
+
<h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
|
| 15 |
+
<p>
|
| 16 |
+
<?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
|
| 17 |
+
</p>
|
templates/network-page/main.php
CHANGED
|
@@ -1,63 +1,63 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Network Admin Settings
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
* @option string "page_url"
|
| 17 |
-
* @option string "menu_url"
|
| 18 |
-
* @option string "own_admin_menu"
|
| 19 |
-
*/
|
| 20 |
-
?>
|
| 21 |
-
<div class="wrap wpel-network-page wpel-network-page-<?php echo $vars[ 'current_tab' ]; ?>">
|
| 22 |
-
<h1><?php echo get_admin_page_title(); ?></h1>
|
| 23 |
-
<?php
|
| 24 |
-
if ( $vars[ 'own_admin_menu' ] ):
|
| 25 |
-
settings_errors();
|
| 26 |
-
endif;
|
| 27 |
-
|
| 28 |
-
// nav tabs
|
| 29 |
-
$nav_tabs_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/nav-tabs.php' );
|
| 30 |
-
WPEL_Plugin::show_template( $nav_tabs_template, $vars );
|
| 31 |
-
|
| 32 |
-
// get current option group
|
| 33 |
-
$tab = $vars[ 'tabs' ][ $vars[ 'current_tab' ] ];
|
| 34 |
-
|
| 35 |
-
if ( isset( $tab[ 'fields' ] ) ) {
|
| 36 |
-
$option_group = $tab[ 'fields' ]->get_setting( 'option_group' );
|
| 37 |
-
$action_url = 'edit.php?action='. $option_group;
|
| 38 |
-
} else {
|
| 39 |
-
$action_url = '';
|
| 40 |
-
}
|
| 41 |
-
?>
|
| 42 |
-
|
| 43 |
-
<form method="post" action="<?php echo $action_url; ?>">
|
| 44 |
-
<?php
|
| 45 |
-
wp_referer_field();
|
| 46 |
-
|
| 47 |
-
$content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php';
|
| 48 |
-
$default_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/'. $vars[ 'current_tab' ] .'.php' );
|
| 49 |
-
|
| 50 |
-
if ( is_readable( $content_tab_template ) ):
|
| 51 |
-
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 52 |
-
elseif ( is_readable( $default_tab_template ) ):
|
| 53 |
-
WPEL_Plugin::show_template( $default_tab_template, $vars );
|
| 54 |
-
else:
|
| 55 |
-
$content_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 56 |
-
|
| 57 |
-
if ( is_readable( $content_tab_template ) ):
|
| 58 |
-
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 59 |
-
endif;
|
| 60 |
-
endif;
|
| 61 |
-
?>
|
| 62 |
-
</form>
|
| 63 |
-
</div>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Network Admin Settings
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
* @option string "page_url"
|
| 17 |
+
* @option string "menu_url"
|
| 18 |
+
* @option string "own_admin_menu"
|
| 19 |
+
*/
|
| 20 |
+
?>
|
| 21 |
+
<div class="wrap wpel-network-page wpel-network-page-<?php echo $vars[ 'current_tab' ]; ?>">
|
| 22 |
+
<h1><?php echo get_admin_page_title(); ?></h1>
|
| 23 |
+
<?php
|
| 24 |
+
if ( $vars[ 'own_admin_menu' ] ):
|
| 25 |
+
settings_errors();
|
| 26 |
+
endif;
|
| 27 |
+
|
| 28 |
+
// nav tabs
|
| 29 |
+
$nav_tabs_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/nav-tabs.php' );
|
| 30 |
+
WPEL_Plugin::show_template( $nav_tabs_template, $vars );
|
| 31 |
+
|
| 32 |
+
// get current option group
|
| 33 |
+
$tab = $vars[ 'tabs' ][ $vars[ 'current_tab' ] ];
|
| 34 |
+
|
| 35 |
+
if ( isset( $tab[ 'fields' ] ) ) {
|
| 36 |
+
$option_group = $tab[ 'fields' ]->get_setting( 'option_group' );
|
| 37 |
+
$action_url = 'edit.php?action='. $option_group;
|
| 38 |
+
} else {
|
| 39 |
+
$action_url = '';
|
| 40 |
+
}
|
| 41 |
+
?>
|
| 42 |
+
|
| 43 |
+
<form method="post" action="<?php echo $action_url; ?>">
|
| 44 |
+
<?php
|
| 45 |
+
wp_referer_field();
|
| 46 |
+
|
| 47 |
+
$content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php';
|
| 48 |
+
$default_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/'. $vars[ 'current_tab' ] .'.php' );
|
| 49 |
+
|
| 50 |
+
if ( is_readable( $content_tab_template ) ):
|
| 51 |
+
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 52 |
+
elseif ( is_readable( $default_tab_template ) ):
|
| 53 |
+
WPEL_Plugin::show_template( $default_tab_template, $vars );
|
| 54 |
+
else:
|
| 55 |
+
$content_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 56 |
+
|
| 57 |
+
if ( is_readable( $content_tab_template ) ):
|
| 58 |
+
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 59 |
+
endif;
|
| 60 |
+
endif;
|
| 61 |
+
?>
|
| 62 |
+
</form>
|
| 63 |
+
</div>
|
templates/network-page/tab-contents/network-admin-settings.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Network Admin Settings
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Network Admin Settings
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
templates/network-page/tab-contents/network-settings.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Network Settings
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Network Settings
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
templates/partials/nav-tabs.php
CHANGED
|
@@ -1,30 +1,30 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Nav
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
* @option string "page_url"
|
| 17 |
-
*/
|
| 18 |
-
$set_tab_active_class = function ( $tab ) use ( $vars ) {
|
| 19 |
-
if ( $tab === $vars[ 'current_tab' ] ) {
|
| 20 |
-
echo ' nav-tab-active';
|
| 21 |
-
}
|
| 22 |
-
};
|
| 23 |
-
?>
|
| 24 |
-
<h2 class="nav-tab-wrapper">
|
| 25 |
-
<?php foreach ( $vars[ 'tabs' ] as $tab_key => $tab_values ): ?>
|
| 26 |
-
<a class="nav-tab<?php $set_tab_active_class( $tab_key ); ?> nav-tab-<?php echo $tab_key; ?>" href="<?php echo $vars[ 'page_url' ]; ?>&tab=<?php echo $tab_key; ?>">
|
| 27 |
-
<?php echo $tab_values[ 'icon' ]; ?> <?php echo $tab_values[ 'title' ]; ?>
|
| 28 |
-
</a>
|
| 29 |
-
<?php endforeach; ?>
|
| 30 |
-
</h2>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Nav
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
* @option string "page_url"
|
| 17 |
+
*/
|
| 18 |
+
$set_tab_active_class = function ( $tab ) use ( $vars ) {
|
| 19 |
+
if ( $tab === $vars[ 'current_tab' ] ) {
|
| 20 |
+
echo ' nav-tab-active';
|
| 21 |
+
}
|
| 22 |
+
};
|
| 23 |
+
?>
|
| 24 |
+
<h2 class="nav-tab-wrapper">
|
| 25 |
+
<?php foreach ( $vars[ 'tabs' ] as $tab_key => $tab_values ): ?>
|
| 26 |
+
<a class="nav-tab<?php $set_tab_active_class( $tab_key ); ?> nav-tab-<?php echo $tab_key; ?>" href="<?php echo $vars[ 'page_url' ]; ?>&tab=<?php echo $tab_key; ?>">
|
| 27 |
+
<?php echo $tab_values[ 'icon' ]; ?> <?php echo $tab_values[ 'title' ]; ?>
|
| 28 |
+
</a>
|
| 29 |
+
<?php endforeach; ?>
|
| 30 |
+
</h2>
|
templates/partials/tab-contents/fields-default.php
CHANGED
|
@@ -1,23 +1,23 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Default Content
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$current_tab = $vars [ 'current_tab' ];
|
| 19 |
-
$tab_values = $vars[ 'tabs' ][ $current_tab ];
|
| 20 |
-
$fields = $tab_values[ 'fields' ];
|
| 21 |
-
|
| 22 |
-
settings_fields( $fields->get_setting( 'option_group' ) );
|
| 23 |
-
do_settings_sections( $fields->get_setting( 'page_id' ) );
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Default Content
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$current_tab = $vars [ 'current_tab' ];
|
| 19 |
+
$tab_values = $vars[ 'tabs' ][ $current_tab ];
|
| 20 |
+
$fields = $tab_values[ 'fields' ];
|
| 21 |
+
|
| 22 |
+
settings_fields( $fields->get_setting( 'option_group' ) );
|
| 23 |
+
do_settings_sections( $fields->get_setting( 'page_id' ) );
|
templates/partials/tab-contents/support.php
CHANGED
|
@@ -1,76 +1,76 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Support
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
*/
|
| 16 |
-
?>
|
| 17 |
-
<h2><?php _e( 'Support', 'wp-external-links' ); ?></h2>
|
| 18 |
-
|
| 19 |
-
<h3><?php _e( 'Documentation', 'wp-external-links' ); ?></h3>
|
| 20 |
-
<p><?php _e( 'Take a look at the <a href="#" data-wpel-help>help section</a> for documentation', 'wp-external-links' ); ?></p>
|
| 21 |
-
|
| 22 |
-
<h3><?php _e( 'FAQ', 'wp-external-links' ); ?></h3>
|
| 23 |
-
<p><?php _e( 'On the <a href="https://wordpress.org/plugins/wp-external-links/faq/" target="_blank">FAQ page</a> you can find some additional tips & trics.', 'wp-external-links' ); ?></p>
|
| 24 |
-
|
| 25 |
-
<h3><?php _e( 'Reported issues', 'wp-external-links' ); ?></h3>
|
| 26 |
-
<p><?php _e( 'When you experience problems using this plugin please look if your problem was <a href="https://wordpress.org/support/plugin/wp-external-links" target="_blank">already reported</a>.', 'wp-external-links' ); ?></p>
|
| 27 |
-
|
| 28 |
-
<h3><?php _e( 'Send your issue', 'wp-external-links' ); ?></h3>
|
| 29 |
-
<p><?php _e( 'If it wasn\'t yet reported then you can <a href="https://wordpress.org/support/plugin/wp-external-links#postform" target="_blank">send your problem</a>.', 'wp-external-links' ); ?>
|
| 30 |
-
<?php _e( 'Please after reporting send me the following technical information <a href="http://www.finewebdev.com/contact" target="_blank">by mail</a>. That will make it easier to solve the problem.', 'wp-external-links' ); ?>
|
| 31 |
-
</p>
|
| 32 |
-
<p>
|
| 33 |
-
<button class="button js-wpel-copy"><?php _e( 'Copy Technical Info', 'wp-external-links' ); ?></button>
|
| 34 |
-
</p>
|
| 35 |
-
<p>
|
| 36 |
-
<textarea id="plugin-settings" class="large-text js-wpel-copy-target" rows="8" readonly="readonly">
|
| 37 |
-
<?php _e( 'WP url:', 'wp-external-links' ); ?> <?php bloginfo( 'wpurl' ); ?>
|
| 38 |
-
|
| 39 |
-
<?php _e( 'WP version:', 'wp-external-links' ); ?> <?php bloginfo( 'version' ); ?>
|
| 40 |
-
|
| 41 |
-
<?php _e( 'PHP version:', 'wp-external-links' ); ?> <?php echo phpversion(); ?>
|
| 42 |
-
|
| 43 |
-
<?php _e( 'Active Plugins:', 'wp-external-links' ); ?>
|
| 44 |
-
|
| 45 |
-
<?php
|
| 46 |
-
$plugins = get_plugins() ;
|
| 47 |
-
|
| 48 |
-
foreach ( $plugins as $plugin => $plugin_values ) {
|
| 49 |
-
if ( ! is_plugin_active( $plugin ) ) {
|
| 50 |
-
continue;
|
| 51 |
-
}
|
| 52 |
-
|
| 53 |
-
echo ' - '. $plugin_values[ 'Name' ] .', version: '. $plugin_values[ 'Version' ] . "\n";
|
| 54 |
-
}
|
| 55 |
-
?>
|
| 56 |
-
|
| 57 |
-
<?php _e( 'WPEL Settings:', 'wp-external-links' ); ?>
|
| 58 |
-
|
| 59 |
-
array(
|
| 60 |
-
<?php
|
| 61 |
-
foreach ( $vars[ 'tabs' ] as $tab_key => $values ) {
|
| 62 |
-
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 63 |
-
continue;
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
$option_values = $values[ 'fields' ]->get_option_values();
|
| 67 |
-
$option_name = $values[ 'fields' ]->get_setting( 'option_name' );
|
| 68 |
-
|
| 69 |
-
echo "'$option_name' => ";
|
| 70 |
-
var_export( $option_values );
|
| 71 |
-
echo ",\n";
|
| 72 |
-
}
|
| 73 |
-
?>
|
| 74 |
-
);
|
| 75 |
-
</textarea>
|
| 76 |
-
</p>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Support
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
*/
|
| 16 |
+
?>
|
| 17 |
+
<h2><?php _e( 'Support', 'wp-external-links' ); ?></h2>
|
| 18 |
+
|
| 19 |
+
<h3><?php _e( 'Documentation', 'wp-external-links' ); ?></h3>
|
| 20 |
+
<p><?php _e( 'Take a look at the <a href="#" data-wpel-help>help section</a> for documentation', 'wp-external-links' ); ?></p>
|
| 21 |
+
|
| 22 |
+
<h3><?php _e( 'FAQ', 'wp-external-links' ); ?></h3>
|
| 23 |
+
<p><?php _e( 'On the <a href="https://wordpress.org/plugins/wp-external-links/faq/" target="_blank">FAQ page</a> you can find some additional tips & trics.', 'wp-external-links' ); ?></p>
|
| 24 |
+
|
| 25 |
+
<h3><?php _e( 'Reported issues', 'wp-external-links' ); ?></h3>
|
| 26 |
+
<p><?php _e( 'When you experience problems using this plugin please look if your problem was <a href="https://wordpress.org/support/plugin/wp-external-links" target="_blank">already reported</a>.', 'wp-external-links' ); ?></p>
|
| 27 |
+
|
| 28 |
+
<h3><?php _e( 'Send your issue', 'wp-external-links' ); ?></h3>
|
| 29 |
+
<p><?php _e( 'If it wasn\'t yet reported then you can <a href="https://wordpress.org/support/plugin/wp-external-links#postform" target="_blank">send your problem</a>.', 'wp-external-links' ); ?>
|
| 30 |
+
<?php _e( 'Please after reporting send me the following technical information <a href="http://www.finewebdev.com/contact" target="_blank">by mail</a>. That will make it easier to solve the problem.', 'wp-external-links' ); ?>
|
| 31 |
+
</p>
|
| 32 |
+
<p>
|
| 33 |
+
<button class="button js-wpel-copy"><?php _e( 'Copy Technical Info', 'wp-external-links' ); ?></button>
|
| 34 |
+
</p>
|
| 35 |
+
<p>
|
| 36 |
+
<textarea id="plugin-settings" class="large-text js-wpel-copy-target" rows="8" readonly="readonly">
|
| 37 |
+
<?php _e( 'WP url:', 'wp-external-links' ); ?> <?php bloginfo( 'wpurl' ); ?>
|
| 38 |
+
|
| 39 |
+
<?php _e( 'WP version:', 'wp-external-links' ); ?> <?php bloginfo( 'version' ); ?>
|
| 40 |
+
|
| 41 |
+
<?php _e( 'PHP version:', 'wp-external-links' ); ?> <?php echo phpversion(); ?>
|
| 42 |
+
|
| 43 |
+
<?php _e( 'Active Plugins:', 'wp-external-links' ); ?>
|
| 44 |
+
|
| 45 |
+
<?php
|
| 46 |
+
$plugins = get_plugins() ;
|
| 47 |
+
|
| 48 |
+
foreach ( $plugins as $plugin => $plugin_values ) {
|
| 49 |
+
if ( ! is_plugin_active( $plugin ) ) {
|
| 50 |
+
continue;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
echo ' - '. $plugin_values[ 'Name' ] .', version: '. $plugin_values[ 'Version' ] . "\n";
|
| 54 |
+
}
|
| 55 |
+
?>
|
| 56 |
+
|
| 57 |
+
<?php _e( 'WPEL Settings:', 'wp-external-links' ); ?>
|
| 58 |
+
|
| 59 |
+
array(
|
| 60 |
+
<?php
|
| 61 |
+
foreach ( $vars[ 'tabs' ] as $tab_key => $values ) {
|
| 62 |
+
if ( ! isset( $values[ 'fields' ] ) ) {
|
| 63 |
+
continue;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
$option_values = $values[ 'fields' ]->get_option_values();
|
| 67 |
+
$option_name = $values[ 'fields' ]->get_setting( 'option_name' );
|
| 68 |
+
|
| 69 |
+
echo "'$option_name' => ";
|
| 70 |
+
var_export( $option_values );
|
| 71 |
+
echo ",\n";
|
| 72 |
+
}
|
| 73 |
+
?>
|
| 74 |
+
);
|
| 75 |
+
</textarea>
|
| 76 |
+
</p>
|
templates/requirements-notice.php
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Requirements Notice
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
?>
|
| 14 |
-
<div class="notice notice-error is-dismissible">
|
| 15 |
-
<p>
|
| 16 |
-
<?php _e('The plugin <strong>WP External Links</strong> requires'
|
| 17 |
-
.' PHP version 5.3 or up and WordPress version 3.6 or up.'
|
| 18 |
-
.'<br>Please upgrade your PHP and/or WordPress.'
|
| 19 |
-
.' Deactivate the plugin to remove this message.', 'wp-external-links' );
|
| 20 |
-
?>
|
| 21 |
-
</p>
|
| 22 |
-
</div>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Requirements Notice
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
?>
|
| 14 |
+
<div class="notice notice-error is-dismissible">
|
| 15 |
+
<p>
|
| 16 |
+
<?php _e('The plugin <strong>WP External Links</strong> requires'
|
| 17 |
+
.' PHP version 5.3 or up and WordPress version 3.6 or up.'
|
| 18 |
+
.'<br>Please upgrade your PHP and/or WordPress.'
|
| 19 |
+
.' Deactivate the plugin to remove this message.', 'wp-external-links' );
|
| 20 |
+
?>
|
| 21 |
+
</p>
|
| 22 |
+
</div>
|
templates/settings-page/help-tabs/data-attributes.php
CHANGED
|
@@ -1,23 +1,23 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Help Tab: Data Attributes
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
?>
|
| 14 |
-
<h3><?php _e( 'Exclude or include by data-attribute', 'wp-external-links' ) ?></h3>
|
| 15 |
-
<p>
|
| 16 |
-
<?php _e( 'The <code>data-wpel-link</code> attribute can be set on links and forces the plugin to treat those links that way.', 'wp-external-links' ); ?>
|
| 17 |
-
</p>
|
| 18 |
-
<ul>
|
| 19 |
-
<li><?php _e( 'Links with <code>data-wpel-link="internal"</code> will be treated as internal links.', 'wp-external-links' ); ?></li>
|
| 20 |
-
<li><?php _e( 'Links with <code>data-wpel-link="external"</code> will be treated as external links.', 'wp-external-links' ); ?></li>
|
| 21 |
-
<li><?php _e( 'Links with <code>data-wpel-link="exclude"</code> will be treated as excluded links (which have their own settings or will be treated as internal links).', 'wp-external-links' ); ?></li>
|
| 22 |
-
<li><?php _e( 'Links with <code>data-wpel-link="ignore"</code> will be completely ignored by this plugin.', 'wp-external-links' ); ?></li>
|
| 23 |
-
</ul>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Help Tab: Data Attributes
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
?>
|
| 14 |
+
<h3><?php _e( 'Exclude or include by data-attribute', 'wp-external-links' ) ?></h3>
|
| 15 |
+
<p>
|
| 16 |
+
<?php _e( 'The <code>data-wpel-link</code> attribute can be set on links and forces the plugin to treat those links that way.', 'wp-external-links' ); ?>
|
| 17 |
+
</p>
|
| 18 |
+
<ul>
|
| 19 |
+
<li><?php _e( 'Links with <code>data-wpel-link="internal"</code> will be treated as internal links.', 'wp-external-links' ); ?></li>
|
| 20 |
+
<li><?php _e( 'Links with <code>data-wpel-link="external"</code> will be treated as external links.', 'wp-external-links' ); ?></li>
|
| 21 |
+
<li><?php _e( 'Links with <code>data-wpel-link="exclude"</code> will be treated as excluded links (which have their own settings or will be treated as internal links).', 'wp-external-links' ); ?></li>
|
| 22 |
+
<li><?php _e( 'Links with <code>data-wpel-link="ignore"</code> will be completely ignored by this plugin.', 'wp-external-links' ); ?></li>
|
| 23 |
+
</ul>
|
templates/settings-page/help-tabs/under-construction.php
CHANGED
|
@@ -1,17 +1,17 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Help Tab: Data Attributes
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*/
|
| 13 |
-
?>
|
| 14 |
-
<h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
|
| 15 |
-
<p>
|
| 16 |
-
<?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
|
| 17 |
-
</p>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Help Tab: Data Attributes
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*/
|
| 13 |
+
?>
|
| 14 |
+
<h3><?php _e( 'Under Construction', 'wp-external-links' ) ?></h3>
|
| 15 |
+
<p>
|
| 16 |
+
<?php _e( 'Still working on the documentation...', 'wp-external-links' ); ?>
|
| 17 |
+
</p>
|
templates/settings-page/main.php
CHANGED
|
@@ -1,51 +1,51 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Admin Settings
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
* @option string "page_url"
|
| 17 |
-
* @option string "menu_url"
|
| 18 |
-
* @option string "own_admin_menu"
|
| 19 |
-
*/
|
| 20 |
-
?>
|
| 21 |
-
<div class="wrap wpel-settings-page wpel-settings-page-<?php echo $vars[ 'current_tab' ]; ?>">
|
| 22 |
-
<h1><?php echo get_admin_page_title(); ?></h1>
|
| 23 |
-
<?php
|
| 24 |
-
if ( $vars[ 'own_admin_menu' ] ):
|
| 25 |
-
settings_errors();
|
| 26 |
-
endif;
|
| 27 |
-
|
| 28 |
-
// nav tabs
|
| 29 |
-
$nav_tabs_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/nav-tabs.php' );
|
| 30 |
-
WPEL_Plugin::show_template( $nav_tabs_template, $vars );
|
| 31 |
-
?>
|
| 32 |
-
|
| 33 |
-
<form method="post" action="options.php">
|
| 34 |
-
<?php
|
| 35 |
-
$content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php';
|
| 36 |
-
$default_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/'. $vars[ 'current_tab' ] .'.php' );
|
| 37 |
-
|
| 38 |
-
if ( is_readable( $content_tab_template ) ):
|
| 39 |
-
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 40 |
-
elseif ( is_readable( $default_tab_template ) ):
|
| 41 |
-
WPEL_Plugin::show_template( $default_tab_template, $vars );
|
| 42 |
-
else:
|
| 43 |
-
$content_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 44 |
-
|
| 45 |
-
if ( is_readable( $content_tab_template ) ):
|
| 46 |
-
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 47 |
-
endif;
|
| 48 |
-
endif;
|
| 49 |
-
?>
|
| 50 |
-
</form>
|
| 51 |
-
</div>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Admin Settings
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
* @option string "page_url"
|
| 17 |
+
* @option string "menu_url"
|
| 18 |
+
* @option string "own_admin_menu"
|
| 19 |
+
*/
|
| 20 |
+
?>
|
| 21 |
+
<div class="wrap wpel-settings-page wpel-settings-page-<?php echo $vars[ 'current_tab' ]; ?>">
|
| 22 |
+
<h1><?php echo get_admin_page_title(); ?></h1>
|
| 23 |
+
<?php
|
| 24 |
+
if ( $vars[ 'own_admin_menu' ] ):
|
| 25 |
+
settings_errors();
|
| 26 |
+
endif;
|
| 27 |
+
|
| 28 |
+
// nav tabs
|
| 29 |
+
$nav_tabs_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/nav-tabs.php' );
|
| 30 |
+
WPEL_Plugin::show_template( $nav_tabs_template, $vars );
|
| 31 |
+
?>
|
| 32 |
+
|
| 33 |
+
<form method="post" action="options.php" class="wpel-hidden">
|
| 34 |
+
<?php
|
| 35 |
+
$content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php';
|
| 36 |
+
$default_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/'. $vars[ 'current_tab' ] .'.php' );
|
| 37 |
+
|
| 38 |
+
if ( is_readable( $content_tab_template ) ):
|
| 39 |
+
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 40 |
+
elseif ( is_readable( $default_tab_template ) ):
|
| 41 |
+
WPEL_Plugin::show_template( $default_tab_template, $vars );
|
| 42 |
+
else:
|
| 43 |
+
$content_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 44 |
+
|
| 45 |
+
if ( is_readable( $content_tab_template ) ):
|
| 46 |
+
WPEL_Plugin::show_template( $content_tab_template, $vars );
|
| 47 |
+
endif;
|
| 48 |
+
endif;
|
| 49 |
+
?>
|
| 50 |
+
</form>
|
| 51 |
+
</div>
|
templates/settings-page/tab-contents/admin.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Admin
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Admin
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
templates/settings-page/tab-contents/exceptions.php
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Exception
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
?>
|
| 21 |
-
|
| 22 |
-
<p class="description"><?php _e( 'The data-attribute <a href="#" data-wpel-help="data-attributes"><code>data-wpel-link</code></a> can be set on individual links to treat them as internal, external or excluded, or to completely ignore links form being processed by this plugin.' ); ?></p>
|
| 23 |
-
|
| 24 |
-
<?php submit_button(); ?>
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Exception
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
?>
|
| 21 |
+
|
| 22 |
+
<p class="description"><?php _e( 'The data-attribute <a href="#" data-wpel-help="data-attributes"><code>data-wpel-link</code></a> can be set on individual links to treat them as internal, external or excluded, or to completely ignore links form being processed by this plugin.' ); ?></p>
|
| 23 |
+
|
| 24 |
+
<?php submit_button(); ?>
|
templates/settings-page/tab-contents/excluded-links.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Excluded Links
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Excluded Links
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
templates/settings-page/tab-contents/external-links.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab External Links
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab External Links
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
templates/settings-page/tab-contents/internal-links.php
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* Tab Internal Links
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link http://www.finewebdev.com
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @var array $vars
|
| 14 |
-
* @option array "tabs"
|
| 15 |
-
* @option string "current_tab"
|
| 16 |
-
*/
|
| 17 |
-
|
| 18 |
-
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
-
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
-
|
| 21 |
-
submit_button();
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Tab Internal Links
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link http://www.finewebdev.com
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @var array $vars
|
| 14 |
+
* @option array "tabs"
|
| 15 |
+
* @option string "current_tab"
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
$default_fields_file = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' );
|
| 19 |
+
WPEL_Plugin::show_template( $default_fields_file, $vars );
|
| 20 |
+
|
| 21 |
+
submit_button();
|
wp-external-links.php
CHANGED
|
@@ -1,81 +1,92 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* WP External Links Plugin
|
| 4 |
-
*
|
| 5 |
-
* @package WPEL
|
| 6 |
-
* @category WordPress Plugin
|
| 7 |
-
* @version 2.1.
|
| 8 |
-
* @author Victor Villaverde Laan
|
| 9 |
-
* @link https://wordpress.org/plugins/wp-external-links/
|
| 10 |
-
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
-
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
-
*
|
| 13 |
-
* @wordpress-plugin
|
| 14 |
-
* Plugin Name: WP External Links
|
| 15 |
-
* Version: 2.1.
|
| 16 |
-
* Plugin URI: https://wordpress.org/plugins/wp-external-links/
|
| 17 |
-
* Description: Open external links in a new tab or window, adding "nofollow" and "noopener", set font icon, SEO friendly options and more.
|
| 18 |
-
* Author: Victor Villaverde Laan
|
| 19 |
-
* Author URI: http://www.finewebdev.com
|
| 20 |
-
* License: Dual licensed under the MIT and GPLv2+ licenses
|
| 21 |
-
* Text Domain: wp-external-links
|
| 22 |
-
* Domain Path: /languages
|
| 23 |
-
*/
|
| 24 |
-
if ( ! function_exists( 'wpel_init' ) ):
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
$
|
| 34 |
-
$
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* WP External Links Plugin
|
| 4 |
+
*
|
| 5 |
+
* @package WPEL
|
| 6 |
+
* @category WordPress Plugin
|
| 7 |
+
* @version 2.1.2
|
| 8 |
+
* @author Victor Villaverde Laan
|
| 9 |
+
* @link https://wordpress.org/plugins/wp-external-links/
|
| 10 |
+
* @link https://github.com/freelancephp/WP-External-Links
|
| 11 |
+
* @license Dual licensed under the MIT and GPLv2+ licenses
|
| 12 |
+
*
|
| 13 |
+
* @wordpress-plugin
|
| 14 |
+
* Plugin Name: WP External Links
|
| 15 |
+
* Version: 2.1.2
|
| 16 |
+
* Plugin URI: https://wordpress.org/plugins/wp-external-links/
|
| 17 |
+
* Description: Open external links in a new tab or window, adding "nofollow" and "noopener", set font icon, SEO friendly options and more.
|
| 18 |
+
* Author: Victor Villaverde Laan
|
| 19 |
+
* Author URI: http://www.finewebdev.com
|
| 20 |
+
* License: Dual licensed under the MIT and GPLv2+ licenses
|
| 21 |
+
* Text Domain: wp-external-links
|
| 22 |
+
* Domain Path: /languages
|
| 23 |
+
*/
|
| 24 |
+
if ( ! function_exists( 'wpel_init' ) ):
|
| 25 |
+
|
| 26 |
+
function wpel_init()
|
| 27 |
+
{
|
| 28 |
+
// only load in WP environment
|
| 29 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 30 |
+
die();
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
$plugin_file = defined( 'TEST_WPEL_PLUGIN_FILE' ) ? TEST_WPEL_PLUGIN_FILE : __FILE__;
|
| 34 |
+
$plugin_dir = dirname( __FILE__ );
|
| 35 |
+
|
| 36 |
+
// check requirements
|
| 37 |
+
$wp_version = get_bloginfo( 'version' );
|
| 38 |
+
$php_version = phpversion();
|
| 39 |
+
|
| 40 |
+
if ( version_compare( $wp_version, '4.2', '<' ) || version_compare( $php_version, '5.3', '<' ) ) {
|
| 41 |
+
if ( ! function_exists( 'wpel_requirements_notice' ) ) {
|
| 42 |
+
function wpel_requirements_notice()
|
| 43 |
+
{
|
| 44 |
+
include dirname( __FILE__ ) .'/templates/requirements-notice.php';
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
add_action( 'admin_notices', 'wpel_requirements_notice' );
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
return;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/**
|
| 54 |
+
* Autoloader
|
| 55 |
+
*/
|
| 56 |
+
if ( ! class_exists( 'WPRun_Autoloader_1x0x0' ) ) {
|
| 57 |
+
require_once $plugin_dir . '/libs/wprun/class-wprun-autoloader.php';
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
$autoloader = new WPRun_Autoloader_1x0x0();
|
| 61 |
+
$autoloader->add_path( $plugin_dir . '/libs/', true );
|
| 62 |
+
$autoloader->add_path( $plugin_dir . '/includes/', true );
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* Load debugger
|
| 66 |
+
*/
|
| 67 |
+
if ( true === constant( 'WP_DEBUG' ) ) {
|
| 68 |
+
FWP_Debug_1x0x0::create( array(
|
| 69 |
+
'log_hooks' => false,
|
| 70 |
+
) );
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/**
|
| 74 |
+
* Register Hooks
|
| 75 |
+
*/
|
| 76 |
+
global $wpdb;
|
| 77 |
+
WPEL_Activation::create( $plugin_file, $wpdb );
|
| 78 |
+
WPEL_Uninstall::create( $plugin_file, $wpdb );
|
| 79 |
+
|
| 80 |
+
/**
|
| 81 |
+
* Set plugin vars
|
| 82 |
+
*/
|
| 83 |
+
WPEL_Plugin::create( $plugin_file, $plugin_dir );
|
| 84 |
+
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
wpel_init();
|
| 88 |
+
|
| 89 |
+
endif;
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
/*?>*/
|
