Version Description
- New Feature - Advanced Mode: allows you to turn off the advanced features and simply upload SVG files like normal images. This addition also enables users to turn off the script added on front end by leaving Advanced Mode unchecked.
- New Feature - Featured Image Support: If your featured image is SVG, once the post is saved you will see a checkbox to render the SVG inline (advanced mode only).
- Performance - Stop inlining JS from running if image source is not SVG.
- Added new stylesheet for settings page.
- Moved SCSS files to their own folder.
- Changed donate link so I can track it and properly thank you for your generous donations.
- Added a rating link to the settings and media pages.
- Cleaned up code formatting, added more comments.
- Added a plugin version check.
- Added notice so people are aware they may need to turn on the advanced mode.
Download this release
Release Info
Developer | Benbodhi |
Plugin | SVG Support |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.5 to 2.3
- admin/admin-init.php +135 -23
- admin/admin-notice.php +52 -0
- admin/plugin-action-meta-links.php +14 -14
- admin/svgs-settings-page.php +60 -23
- css/svgs-admin-simple-mode.css +1 -0
- css/svgs-admin.css +1 -1
- css/svgs-attachment.css +1 -0
- functions/attachment-modal.php +4 -0
- functions/attribute-control.php +43 -19
- functions/enqueue.php +50 -30
- functions/featured-image.php +91 -0
- functions/localization.php +1 -3
- functions/mime-types.php +10 -8
- functions/thumbnail-display.php +4 -4
- js/min/svg-inline-min.js +0 -1
- js/min/svgs-admin-notice-update-min.js +1 -0
- js/min/svgs-inline-min.js +1 -0
- js/svg-inline.js +0 -46
- js/svgs-admin-notice-update.js +10 -0
- js/svgs-inline.js +51 -0
- languages/svgsupport-en_AU.mo +0 -0
- languages/svgsupport-en_AU.po +0 -298
- one-time-upgrade-activate.php +21 -0
- readme.txt +40 -11
- scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-admin-simple-mode.scssc +0 -0
- {css/.sass-cache/2d7711e41fe8fdd2638823a7fcb5fbf7b4fba050 → scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c}/svgs-admin.scssc +0 -0
- scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-attachment.scssc +0 -0
- scss/svgs-admin-simple-mode.scss +6 -0
- {css → scss}/svgs-admin.scss +1 -1
- scss/svgs-attachment.scss +3 -0
- svg-support.php +39 -25
admin/admin-init.php
CHANGED
@@ -1,48 +1,160 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
function bodhi_svgs_admin_menu() {
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
}
|
|
|
23 |
|
24 |
-
|
|
|
|
|
25 |
function bodhi_svg_support_settings_page() {
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
|
31 |
-
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
|
37 |
}
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
function bodhi_svgs_register_settings() {
|
43 |
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
}
|
47 |
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Admin init
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
}
|
8 |
|
9 |
+
/**
|
10 |
+
* Add menu item to wp-admin
|
11 |
+
*/
|
12 |
function bodhi_svgs_admin_menu() {
|
13 |
|
14 |
+
add_options_page(
|
15 |
+
__('SVG Support Options and Instructions', 'svg-support'),
|
16 |
+
__('SVG Support', 'svg-support'),
|
17 |
+
'manage_options',
|
18 |
+
'svg-support',
|
19 |
+
'bodhi_svg_support_settings_page'
|
20 |
+
);
|
21 |
|
22 |
}
|
23 |
+
add_action( 'admin_menu', 'bodhi_svgs_admin_menu' );
|
24 |
|
25 |
+
/**
|
26 |
+
* Create settings page
|
27 |
+
*/
|
28 |
function bodhi_svg_support_settings_page() {
|
29 |
|
30 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
31 |
|
32 |
+
wp_die( __('You can\'t play with this.', 'svg-support') );
|
33 |
|
34 |
+
}
|
35 |
|
36 |
+
global $bodhi_svgs_options;
|
37 |
|
38 |
+
require( BODHI_SVGS_PLUGIN_PATH . 'admin/svgs-settings-page.php' );
|
39 |
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Register settings in the database
|
44 |
+
*/
|
45 |
function bodhi_svgs_register_settings() {
|
46 |
|
47 |
+
register_setting( 'bodhi_svgs_settings_group', 'bodhi_svgs_settings' );
|
48 |
+
|
49 |
+
}
|
50 |
+
add_action( 'admin_init', 'bodhi_svgs_register_settings' );
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Advanced Mode Check
|
54 |
+
*
|
55 |
+
* Creates a usable function for conditionals around the plugin
|
56 |
+
*/
|
57 |
+
function bodhi_svgs_advanced_mode() {
|
58 |
+
|
59 |
+
global $bodhi_svgs_options;
|
60 |
+
|
61 |
+
if ( ! empty( $bodhi_svgs_options['advanced_mode'] ) ) {
|
62 |
+
|
63 |
+
return true;
|
64 |
+
|
65 |
+
} else {
|
66 |
+
|
67 |
+
return false;
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
add_action( 'admin_init', 'bodhi_svgs_advanced_mode' );
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Screen check function
|
76 |
+
* Checks if current page is SVG Support settings page
|
77 |
+
*/
|
78 |
+
function bodhi_svgs_specific_pages_settings() {
|
79 |
+
|
80 |
+
// check current page
|
81 |
+
$screen = get_current_screen();
|
82 |
+
|
83 |
+
// check if we're on SVG Support settings page
|
84 |
+
|
85 |
+
if ( is_object($screen) && $screen->id == 'settings_page_svg-support' ) {
|
86 |
+
|
87 |
+
return true;
|
88 |
+
|
89 |
+
} else {
|
90 |
+
|
91 |
+
return false;
|
92 |
+
|
93 |
+
}
|
94 |
|
95 |
}
|
96 |
|
97 |
+
/**
|
98 |
+
* Screen check function
|
99 |
+
* Checks if the current page is the Media Library page
|
100 |
+
*/
|
101 |
+
function bodhi_svgs_specific_pages_media_library() {
|
102 |
+
|
103 |
+
// check current page
|
104 |
+
$screen = get_current_screen();
|
105 |
+
|
106 |
+
// check if we're on Media Library page
|
107 |
+
if ( is_object($screen) && $screen->id == 'upload' ) {
|
108 |
+
|
109 |
+
return true;
|
110 |
+
|
111 |
+
} else {
|
112 |
+
|
113 |
+
return false;
|
114 |
+
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Screen check function
|
120 |
+
* Check if the current page is a post edit page
|
121 |
+
*/
|
122 |
+
function is_edit_page( $new_edit = null ) {
|
123 |
+
|
124 |
+
global $pagenow;
|
125 |
+
|
126 |
+
if ( ! is_admin() ) return false;
|
127 |
+
|
128 |
+
if ( $new_edit == 'edit' ) {
|
129 |
+
|
130 |
+
return in_array( $pagenow, array( 'post.php', ) );
|
131 |
+
|
132 |
+
} elseif ( $new_edit == "new" ) { //check for new post page
|
133 |
+
|
134 |
+
return in_array( $pagenow, array( 'post-new.php' ) );
|
135 |
+
|
136 |
+
} else { //check for either new or edit
|
137 |
+
|
138 |
+
return in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Add rating text to footer on settings page
|
146 |
+
*/
|
147 |
+
function bodhi_svgs_admin_footer_text( $default ) {
|
148 |
+
|
149 |
+
if ( bodhi_svgs_specific_pages_settings() || bodhi_svgs_specific_pages_media_library() ) {
|
150 |
+
|
151 |
+
printf( __( 'If you like <strong>SVG Support</strong> please leave a %s★★★★★%s rating. A huge thanks in advance!', 'svg-support' ), '<a href="https://wordpress.org/support/view/plugin-reviews/svg-support?filter=5#postform" target="_blank" class="svgs-rating-link">', '</a>' );
|
152 |
+
|
153 |
+
} else {
|
154 |
+
|
155 |
+
return $default;
|
156 |
+
|
157 |
+
}
|
158 |
+
|
159 |
+
}
|
160 |
+
add_filter( 'admin_footer_text', 'bodhi_svgs_admin_footer_text' );
|
admin/admin-notice.php
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Display admin notice to users who upgraded from less than 2.3
|
4 |
+
* Allow for dismissal by storing an option in the DB via AJAX
|
5 |
+
* Remove option from DB when plugin is deactivated or uninstalled
|
6 |
+
*/
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
+
exit; // Exit if accessed directly
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Admin notice markup
|
13 |
+
*/
|
14 |
+
function bodhi_svgs_admin_notice_upgrade() {
|
15 |
+
?>
|
16 |
+
<div class="notice notice-warning is-dismissible svgs-upgrade-notice">
|
17 |
+
<p><?php _e( 'If you updated SVG Support from any version prior to 2.3 and you use the inline SVG features, please ', 'svg-support' ); ?><a href="<?php echo get_admin_url( null, 'options-general.php?page=svg-support' ); ?>"><?php _e( 'Enable Advanced Mode', 'svg-support' ); ?></a></p>
|
18 |
+
</div>
|
19 |
+
<?php
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Check if notice has been dismissed before
|
24 |
+
*/
|
25 |
+
if ( empty( get_option( 'bodhi_svgs_admin_notice_dismissed' ) ) ) {
|
26 |
+
add_action( 'admin_notices', 'bodhi_svgs_admin_notice_upgrade' );
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Enqueue JS for click detection
|
31 |
+
*/
|
32 |
+
function bodhi_svgs_admin_notice_enqueue() {
|
33 |
+
wp_enqueue_script( 'svgs-admin-notice-update', BODHI_SVGS_PLUGIN_URL . '/js/min/svgs-admin-notice-update-min.js', array( 'jquery' ), '1.0', true );
|
34 |
+
}
|
35 |
+
add_action( 'admin_enqueue_scripts', 'bodhi_svgs_admin_notice_enqueue' );
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Ajax to set option of dismissed
|
39 |
+
*/
|
40 |
+
function dismiss_svgs_admin_notice() {
|
41 |
+
update_option( 'bodhi_svgs_admin_notice_dismissed', 1 );
|
42 |
+
}
|
43 |
+
add_action( 'wp_ajax_dismiss_svgs_admin_notice', 'dismiss_svgs_admin_notice' );
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Remove notice dismissed option when plugin is deactivated or uninstalled
|
47 |
+
*/
|
48 |
+
function bodhi_svgs_deactivated() {
|
49 |
+
delete_option( 'bodhi_svgs_admin_notice_dismissed' );
|
50 |
+
}
|
51 |
+
register_deactivation_hook( BODHI_SVGS_PLUGIN_PATH . '/svg-support.php', 'bodhi_svgs_deactivated' );
|
52 |
+
register_uninstall_hook( BODHI_SVGS_PLUGIN_PATH . '/svg-support.php', 'bodhi_svgs_deactivated' );
|
admin/plugin-action-meta-links.php
CHANGED
@@ -1,25 +1,26 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
function bodhi_svgs_plugin_action_links( $links ) {
|
13 |
|
14 |
-
|
15 |
-
//$links[] = '<a href="http://gowebben.com" target="_blank">More plugins by GoWebben</a>';
|
16 |
-
return $links;
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
add_filter( '
|
22 |
|
|
|
|
|
|
|
23 |
function bodhi_svgs_plugin_meta_links( $links, $file ) {
|
24 |
|
25 |
$plugin_file = 'svg-support/svg-support.php';
|
@@ -28,7 +29,7 @@ function bodhi_svgs_plugin_meta_links( $links, $file ) {
|
|
28 |
$links,
|
29 |
array(
|
30 |
'<a target="_blank" href="http://wordpress.org/support/plugin/svg-support">' . __( 'Get Support', 'svg-support') . '</a>',
|
31 |
-
'<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=
|
32 |
'<a target="_blank" href="https://secure.gowebben.com/cart.php?promocode=SVGSUPPORT">' . __( '$25 Free Credit from GoWebben', 'svg-support') . '</a>'
|
33 |
)
|
34 |
);
|
@@ -37,5 +38,4 @@ function bodhi_svgs_plugin_meta_links( $links, $file ) {
|
|
37 |
return $links;
|
38 |
|
39 |
}
|
40 |
-
|
41 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Plugin action and row meta links
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
}
|
8 |
|
9 |
+
/**
|
10 |
+
* Add plugin_action_links
|
11 |
+
*/
|
12 |
function bodhi_svgs_plugin_action_links( $links ) {
|
13 |
|
14 |
+
$links[] = '<a href="'. get_admin_url( null, 'options-general.php?page=svg-support' ) .'">Settings</a>';
|
|
|
|
|
15 |
|
16 |
+
return $links;
|
17 |
|
18 |
+
}
|
19 |
+
add_filter( 'plugin_action_links_' . $plugin_file, 'bodhi_svgs_plugin_action_links' );
|
20 |
|
21 |
+
/**
|
22 |
+
* Add plugin_row_meta links
|
23 |
+
*/
|
24 |
function bodhi_svgs_plugin_meta_links( $links, $file ) {
|
25 |
|
26 |
$plugin_file = 'svg-support/svg-support.php';
|
29 |
$links,
|
30 |
array(
|
31 |
'<a target="_blank" href="http://wordpress.org/support/plugin/svg-support">' . __( 'Get Support', 'svg-support') . '</a>',
|
32 |
+
'<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ">' . __( 'Donate to author', 'svg-support') . '</a>',
|
33 |
'<a target="_blank" href="https://secure.gowebben.com/cart.php?promocode=SVGSUPPORT">' . __( '$25 Free Credit from GoWebben', 'svg-support') . '</a>'
|
34 |
)
|
35 |
);
|
38 |
return $links;
|
39 |
|
40 |
}
|
41 |
+
add_filter( 'plugin_row_meta', 'bodhi_svgs_plugin_meta_links', 10, 2 );
|
|
admin/svgs-settings-page.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<div class="wrap">
|
2 |
|
3 |
<div id="icon-upload" class="icon32"></div>
|
4 |
-
<h2><?php _e( 'SVG Support Settings and Usage', 'svg-support' ); ?><span class="svgs-version">
|
5 |
|
6 |
<div id="poststuff">
|
7 |
|
@@ -13,8 +13,9 @@
|
|
13 |
<div class="inside">
|
14 |
|
15 |
<p><?php _e( 'When using SVG images on your WordPress site, it can be hard to style elements within the SVG using CSS. <strong>Now you can, easily!</strong>', 'svg-support' ); ?></p>
|
16 |
-
<p><?php _e( '
|
17 |
<p><?php _e( 'The main purpose of this is to allow styling of SVG elements. Usually your styling options are restricted when using <code>embed</code>, <code>object</code> or <code>img</code> tags alone.', 'svg-support' ); ?></p>
|
|
|
18 |
|
19 |
</div> <!-- .inside -->
|
20 |
|
@@ -39,11 +40,24 @@
|
|
39 |
|
40 |
<?php settings_fields('bodhi_svgs_settings_group'); ?>
|
41 |
|
42 |
-
<table class="form-table">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
<tr valign="top">
|
44 |
<!-- Swap with future feature: Multiselect Roles -->
|
45 |
<th scope="row">
|
46 |
-
<label for="bodhi_svgs_settings[restrict]"><strong><?php _e( 'Restrict to Administrators', 'svg-support' ); ?></strong></label>
|
47 |
</th>
|
48 |
<td>
|
49 |
<?php printf(
|
@@ -51,7 +65,7 @@
|
|
51 |
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Restricts SVG upload priveledges to Administrators.', 'svg-support' ); ?></small>
|
52 |
</td>
|
53 |
</tr>
|
54 |
-
<tr valign="top">
|
55 |
<!-- Allow choice of js in footer true or false -->
|
56 |
<th scope="row">
|
57 |
<label for="bodhi_svgs_settings[js_foot_choice]"><strong><?php _e( 'Output JS in Footer?', 'svg-support' ); ?></strong></label>
|
@@ -62,7 +76,7 @@
|
|
62 |
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Normally, scripts are placed in <code>head</code> of the HTML document. If this parameter is true, the script is placed before the closing <code>body</code> tag. This requires the theme to have the <code>wp_footer()</code> template tag in the appropriate place.', 'svg-support' ); ?></small>
|
63 |
</td>
|
64 |
</tr>
|
65 |
-
<tr valign="top">
|
66 |
<!-- Automatically insert class to target in images when inserting into posts/pages -->
|
67 |
<th scope="row">
|
68 |
<label for="bodhi_svgs_settings[auto_insert_class]"><strong><?php _e( 'Automatically insert class?', 'svg-support' ); ?></strong></label>
|
@@ -70,10 +84,10 @@
|
|
70 |
<td>
|
71 |
<?php printf(
|
72 |
'<input id="bodhi_svgs_settings[auto_insert_class]" name="bodhi_svgs_settings[auto_insert_class]" type="checkbox" %2$s />', 'bodhi_svgs_settings_auto_insert_class', checked( isset( $bodhi_svgs_options['auto_insert_class'] ), true, false ) ); ?>
|
73 |
-
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Checking this will make sure that either the default class or the custom one you set below is inserted into the style attributes of <code>img</code> tags when you insert images. Additionally, it will remove all of the default WordPress classes.', 'svg-support' ); ?></small>
|
74 |
</td>
|
75 |
</tr>
|
76 |
-
<tr valign="top">
|
77 |
<th scope="row">
|
78 |
<label for="bodhi_svgs_settings[css_target]"><strong><?php _e( 'CSS Class to target', 'svg-support' ); ?></strong></label>
|
79 |
</th>
|
@@ -81,6 +95,7 @@
|
|
81 |
<input id="bodhi_svgs_settings[css_target]" class="all-options code" name="bodhi_svgs_settings[css_target]" type="text" value="<?php echo $bodhi_svgs_options['css_target']; ?>"><br><small class="description"><?php _e( 'The default target class is <code>style-svg</code>. You can change it to your own class such as <code>my-class</code> by typing it here.<br />Leave blank to use the default class.', 'svg-support' ); ?></small>
|
82 |
</td>
|
83 |
</tr>
|
|
|
84 |
</table>
|
85 |
|
86 |
<p>
|
@@ -95,23 +110,39 @@
|
|
95 |
|
96 |
<div class="postbox">
|
97 |
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
<div class="inside">
|
100 |
|
101 |
-
<p><?php _e( 'You can simply upload SVG
|
102 |
-
|
103 |
-
|
|
|
|
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
|
109 |
-
|
110 |
-
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
115 |
|
116 |
</div> <!-- .inside -->
|
117 |
|
@@ -131,10 +162,16 @@
|
|
131 |
<h3><span><?php _e( 'Plugin Features', 'svg-support' ); ?></span></h3>
|
132 |
<div class="inside">
|
133 |
<ul>
|
|
|
134 |
<li><?php _e( 'SVG Support for your media library', 'svg-support' ); ?></li>
|
135 |
-
<li><?php _e( 'Style SVG elements directly using CSS', 'svg-support' ); ?></li>
|
136 |
<li><?php _e( 'Restrict to Administrators only', 'svg-support' ); ?></li>
|
137 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
</ul>
|
139 |
</div> <!-- .inside -->
|
140 |
|
@@ -146,7 +183,7 @@
|
|
146 |
<div class="inside">
|
147 |
<p><?php _e( 'You can read about this plugin in detail on', 'svg-support' ); ?> <a target="_blank" href="http://wordpress.org/plugins/svg-support/"><?php _e( 'The WordPress Plugin Repository', 'svg-support' ); ?></a>.</p>
|
148 |
<p><?php _e( 'Need help?', 'svg-support' ); ?> <a target="_blank" href="http://wordpress.org/support/plugin/svg-support"><?php _e( 'Visit Support', 'svg-support' ); ?></a>.</p>
|
149 |
-
<p><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=
|
150 |
<p>© <a target="_blank" href="http://benbodhi.com">Benbodhi</a> <?php _e( 'from', 'svg-support' ); ?> <a target="_blank" href="http://gowebben.com">GoWebben</a>.
|
151 |
</div> <!-- .inside -->
|
152 |
|
1 |
<div class="wrap">
|
2 |
|
3 |
<div id="icon-upload" class="icon32"></div>
|
4 |
+
<h2><?php _e( 'SVG Support Settings and Usage', 'svg-support' ); ?><span class="svgs-version">Version <?php global $svgs_plugin_version; echo $svgs_plugin_version; ?></span></h2>
|
5 |
|
6 |
<div id="poststuff">
|
7 |
|
13 |
<div class="inside">
|
14 |
|
15 |
<p><?php _e( 'When using SVG images on your WordPress site, it can be hard to style elements within the SVG using CSS. <strong>Now you can, easily!</strong>', 'svg-support' ); ?></p>
|
16 |
+
<p><?php _e( 'When you enable advanced mode, this plugin not only provides SVG Support like the name says, it also allows you to easily embed your full SVG file\'s code using a simple IMG tag. By adding the class <code>style-svg</code> to your IMG elements, this plugin dynamically replaces any IMG elements containing the <code>style-svg</code> class with your complete SVG.', 'svg-support' ); ?></p>
|
17 |
<p><?php _e( 'The main purpose of this is to allow styling of SVG elements. Usually your styling options are restricted when using <code>embed</code>, <code>object</code> or <code>img</code> tags alone.', 'svg-support' ); ?></p>
|
18 |
+
<p><strong><?php _e( 'Now with featured image support for inlining your featured images!</strong> (since 2.3)', 'svg-support' ); ?></p>
|
19 |
|
20 |
</div> <!-- .inside -->
|
21 |
|
40 |
|
41 |
<?php settings_fields('bodhi_svgs_settings_group'); ?>
|
42 |
|
43 |
+
<table class="form-table svg-settings">
|
44 |
+
|
45 |
+
<tr valign="top" class="svgs-simple">
|
46 |
+
<!-- simple mode selector -->
|
47 |
+
<th scope="row">
|
48 |
+
<label for="bodhi_svgs_settings[advanced_mode]"><strong><?php _e( 'Enable Advanced Mode?', 'svg-support' ); ?></strong></label>
|
49 |
+
</th>
|
50 |
+
<td>
|
51 |
+
<?php printf(
|
52 |
+
'<input id="bodhi_svgs_settings[advanced_mode]" name="bodhi_svgs_settings[advanced_mode]" type="checkbox" %2$s />', 'bodhi_svgs_settings_advanced_mode', checked( isset( $bodhi_svgs_options['advanced_mode'] ), true, false ) ); ?>
|
53 |
+
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' You don\'t need to enable this to simply use SVG files as images. Enabling this will trigger advanced options and SVG functionality such as inline rendering.', 'svg-support' ); ?></small>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
|
57 |
<tr valign="top">
|
58 |
<!-- Swap with future feature: Multiselect Roles -->
|
59 |
<th scope="row">
|
60 |
+
<label for="bodhi_svgs_settings[restrict]"><strong><?php _e( 'Restrict to Administrators?', 'svg-support' ); ?></strong></label>
|
61 |
</th>
|
62 |
<td>
|
63 |
<?php printf(
|
65 |
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Restricts SVG upload priveledges to Administrators.', 'svg-support' ); ?></small>
|
66 |
</td>
|
67 |
</tr>
|
68 |
+
<tr valign="top" class="svgs-advanced">
|
69 |
<!-- Allow choice of js in footer true or false -->
|
70 |
<th scope="row">
|
71 |
<label for="bodhi_svgs_settings[js_foot_choice]"><strong><?php _e( 'Output JS in Footer?', 'svg-support' ); ?></strong></label>
|
76 |
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Normally, scripts are placed in <code>head</code> of the HTML document. If this parameter is true, the script is placed before the closing <code>body</code> tag. This requires the theme to have the <code>wp_footer()</code> template tag in the appropriate place.', 'svg-support' ); ?></small>
|
77 |
</td>
|
78 |
</tr>
|
79 |
+
<tr valign="top" class="svgs-advanced">
|
80 |
<!-- Automatically insert class to target in images when inserting into posts/pages -->
|
81 |
<th scope="row">
|
82 |
<label for="bodhi_svgs_settings[auto_insert_class]"><strong><?php _e( 'Automatically insert class?', 'svg-support' ); ?></strong></label>
|
84 |
<td>
|
85 |
<?php printf(
|
86 |
'<input id="bodhi_svgs_settings[auto_insert_class]" name="bodhi_svgs_settings[auto_insert_class]" type="checkbox" %2$s />', 'bodhi_svgs_settings_auto_insert_class', checked( isset( $bodhi_svgs_options['auto_insert_class'] ), true, false ) ); ?>
|
87 |
+
<?php _e( 'Yes', 'svg-support' ); ?><br /><small class="description"><?php _e(' Checking this will make sure that either the default class or the custom one you set below is inserted into the style attributes of <code>img</code> tags when you insert images. Additionally, it will remove all of the default WordPress classes. Please note, it will currently also add the class to normal images (png, jpg, gif) that are not SVG files when you insert them.', 'svg-support' ); ?></small>
|
88 |
</td>
|
89 |
</tr>
|
90 |
+
<tr valign="top" class="svgs-advanced">
|
91 |
<th scope="row">
|
92 |
<label for="bodhi_svgs_settings[css_target]"><strong><?php _e( 'CSS Class to target', 'svg-support' ); ?></strong></label>
|
93 |
</th>
|
95 |
<input id="bodhi_svgs_settings[css_target]" class="all-options code" name="bodhi_svgs_settings[css_target]" type="text" value="<?php echo $bodhi_svgs_options['css_target']; ?>"><br><small class="description"><?php _e( 'The default target class is <code>style-svg</code>. You can change it to your own class such as <code>my-class</code> by typing it here.<br />Leave blank to use the default class.', 'svg-support' ); ?></small>
|
96 |
</td>
|
97 |
</tr>
|
98 |
+
|
99 |
</table>
|
100 |
|
101 |
<p>
|
110 |
|
111 |
<div class="postbox">
|
112 |
|
113 |
+
<?php
|
114 |
+
|
115 |
+
if ( empty( $bodhi_svgs_options['advanced_mode'] ) ) {
|
116 |
+
echo '<h3><span>';
|
117 |
+
_e( 'Advanced Usage', 'svg-support' );
|
118 |
+
echo '</span></h3>';
|
119 |
+
} else {
|
120 |
+
echo '<h3><span>';
|
121 |
+
_e( 'Usage', 'svg-support' );
|
122 |
+
echo '</span></h3>';
|
123 |
+
}
|
124 |
+
|
125 |
+
?>
|
126 |
+
|
127 |
<div class="inside">
|
128 |
|
129 |
+
<p><?php _e( 'You can simply upload SVG files to your media library like any other image. Make sure to select "Restrict to Administrators" if you only want to allow admins to upload SVG files.', 'svg-support' ); ?></p>
|
130 |
+
|
131 |
+
<div class="svgs-advanced">
|
132 |
+
<p><?php _e( 'Now, embed your SVG image like a standard image with the addition of adding the class <code>style-svg</code> (or your custom class from above) to any IMG tags that you want this plugin to swap out with your actual SVG code.', 'svg-support' ); ?><br />
|
133 |
+
<?php _e( 'For example:', 'svg-support' ); ?></p>
|
134 |
|
135 |
+
<pre><code><img class="style-svg" alt="alt-text" src="image-source.svg" /></code></pre>
|
136 |
+
<?php _e( 'or', 'svg-support' ); ?>
|
137 |
+
<pre><code><img class="your-custom-class" alt="alt-text" src="image-source.svg" /></code></pre>
|
138 |
|
139 |
+
<p><?php _e( 'The whole IMG tag element will now be dynamically replaced by the actual code of your SVG, making the inner content targetable.', 'svg-support' ); ?><br />
|
140 |
+
<?php _e( 'This allows you to target elements within your SVG using CSS.', 'svg-support' ); ?></p>
|
141 |
|
142 |
+
<p><em><?php _e( 'Please Note:', 'svg-support' ); ?></em>
|
143 |
+
<br><em><?php _e( '- You will need to set your own height and width in your CSS for SVG files to display correctly.', 'svg-support' ); ?></em>
|
144 |
+
<br><em><?php _e( '- Your uploaded image needs to be an SVG file for this plugin to replace the img tag with the inline SVG code. It will not create SVG files for you.', 'svg-support' ); ?></em></p>
|
145 |
+
</div>
|
146 |
|
147 |
</div> <!-- .inside -->
|
148 |
|
162 |
<h3><span><?php _e( 'Plugin Features', 'svg-support' ); ?></span></h3>
|
163 |
<div class="inside">
|
164 |
<ul>
|
165 |
+
<li><strong><?php _e( 'Basic Use', 'svg-support' ); ?></strong></li>
|
166 |
<li><?php _e( 'SVG Support for your media library', 'svg-support' ); ?></li>
|
|
|
167 |
<li><?php _e( 'Restrict to Administrators only', 'svg-support' ); ?></li>
|
168 |
+
<hr>
|
169 |
+
<li><strong><?php _e( 'Advanced Mode', 'svg-support' ); ?></strong></li>
|
170 |
+
<li><?php _e( 'Style SVG elements using CSS', 'svg-support' ); ?></li>
|
171 |
+
<li><?php _e( 'Animate SVG using CSS or JS', 'svg-support' ); ?></li>
|
172 |
+
<li><?php _e( 'Include multiple URL\'s inside single SVG', 'svg-support' ); ?></li>
|
173 |
+
<li><?php _e( 'Use odd shapes as links', 'svg-support' ); ?></li>
|
174 |
+
<li><?php _e( 'Inline SVG featured image support', 'svg-support' ); ?></li>
|
175 |
</ul>
|
176 |
</div> <!-- .inside -->
|
177 |
|
183 |
<div class="inside">
|
184 |
<p><?php _e( 'You can read about this plugin in detail on', 'svg-support' ); ?> <a target="_blank" href="http://wordpress.org/plugins/svg-support/"><?php _e( 'The WordPress Plugin Repository', 'svg-support' ); ?></a>.</p>
|
185 |
<p><?php _e( 'Need help?', 'svg-support' ); ?> <a target="_blank" href="http://wordpress.org/support/plugin/svg-support"><?php _e( 'Visit Support', 'svg-support' ); ?></a>.</p>
|
186 |
+
<p><a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ"><?php _e( 'Donate to author →', 'svg-support' ); ?></a>
|
187 |
<p>© <a target="_blank" href="http://benbodhi.com">Benbodhi</a> <?php _e( 'from', 'svg-support' ); ?> <a target="_blank" href="http://gowebben.com">GoWebben</a>.
|
188 |
</div> <!-- .inside -->
|
189 |
|
css/svgs-admin-simple-mode.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.svgs-advanced{display:none}
|
css/svgs-admin.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.svgs-version{font-size:10px;margin-left:7px}.postbox .inside a{text-decoration:none}h3{padding:0 12px}table.media .column-title .media-icon img{width:60px
|
1 |
+
.svgs-version{font-size:10px;margin-left:7px}.postbox .inside a{text-decoration:none}h3{padding:0 12px}table.media .column-title .media-icon img{width:60px}
|
css/svgs-attachment.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.attachment img[src$=".svg"]{width:100%}
|
functions/attachment-modal.php
CHANGED
@@ -2,6 +2,10 @@
|
|
2 |
/**
|
3 |
* Display SVG in attachment modal
|
4 |
*/
|
|
|
|
|
|
|
|
|
5 |
function bodhi_svgs_response_for_svg( $response, $attachment, $meta ) {
|
6 |
|
7 |
if( $response['mime'] == 'image/svg+xml' && empty( $response['sizes'] ) ) {
|
2 |
/**
|
3 |
* Display SVG in attachment modal
|
4 |
*/
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
+
}
|
8 |
+
|
9 |
function bodhi_svgs_response_for_svg( $response, $attachment, $meta ) {
|
10 |
|
11 |
if( $response['mime'] == 'image/svg+xml' && empty( $response['sizes'] ) ) {
|
functions/attribute-control.php
CHANGED
@@ -3,32 +3,56 @@
|
|
3 |
* Attribute Control
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
if ( !empty( $bodhi_svgs_options['css_target'] ) ) {
|
15 |
-
$classes = $bodhi_svgs_options['css_target'];
|
16 |
-
} else {
|
17 |
-
$classes = 'style-svg';
|
18 |
}
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
add_filter('get_image_tag_class', 'bodhi_svgs_image_class_filter');
|
24 |
-
}
|
25 |
|
26 |
-
// removes the width and height attributes during insertion of svg
|
27 |
-
function remove_dimensions_svg( $html='' ) {
|
28 |
-
if( preg_match( '/src="(.*[.]svg)"\s/', $html ) ) {
|
29 |
-
//$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
|
30 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
return str_ireplace( array( " width=\"1\"", " height=\"1\"" ), "", $html );
|
|
|
32 |
}
|
33 |
-
add_filter( 'post_thumbnail_html', '
|
34 |
-
add_filter( 'image_send_to_editor', '
|
3 |
* Attribute Control
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
}
|
8 |
|
9 |
+
/**
|
10 |
+
* If in Advanced Mode
|
11 |
+
*/
|
12 |
+
if ( bodhi_svgs_advanced_mode() ) {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Filter the img tag class during insertion and return SVG Support class
|
16 |
+
*/
|
17 |
+
function bodhi_svgs_image_class_filter( $classes ) {
|
18 |
+
|
19 |
+
global $bodhi_svgs_options;
|
20 |
+
|
21 |
+
if ( ! empty( $bodhi_svgs_options['css_target'] ) ) {
|
22 |
+
|
23 |
+
$classes = $bodhi_svgs_options['css_target'];
|
24 |
+
|
25 |
+
} else {
|
26 |
+
|
27 |
+
$classes = 'style-svg';
|
28 |
+
|
29 |
+
}
|
30 |
|
31 |
+
return $classes;
|
32 |
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
+
/**
|
35 |
+
* Check settings to see if we should add the class automatically
|
36 |
+
*/
|
37 |
+
if ( ! empty( $bodhi_svgs_options['auto_insert_class'] ) ) {
|
38 |
|
39 |
+
// add the class
|
40 |
+
add_filter( 'get_image_tag_class', 'bodhi_svgs_image_class_filter' );
|
|
|
|
|
41 |
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Remove the width and height attributes during insertion of svg
|
48 |
+
*/
|
49 |
+
function bodhi_svgs_remove_svg_dimensions( $html='' ) {
|
50 |
+
|
51 |
+
// if ( preg_match( '/src="(.*[.]svg)"\s/', $html ) ) {
|
52 |
+
// //$html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
|
53 |
+
// }
|
54 |
return str_ireplace( array( " width=\"1\"", " height=\"1\"" ), "", $html );
|
55 |
+
|
56 |
}
|
57 |
+
add_filter( 'post_thumbnail_html', 'bodhi_svgs_remove_svg_dimensions', 10 );
|
58 |
+
add_filter( 'image_send_to_editor', 'bodhi_svgs_remove_svg_dimensions', 10 );
|
functions/enqueue.php
CHANGED
@@ -1,57 +1,77 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
|
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
/**
|
10 |
-
* Enqueue
|
11 |
*/
|
12 |
-
|
13 |
-
|
14 |
-
function bodhi_svgs_inline() {
|
15 |
|
16 |
-
|
|
|
17 |
|
18 |
-
|
|
|
19 |
|
20 |
-
if ( ! empty( $bodhi_svgs_options['js_foot_choice'] ) ) {
|
21 |
-
wp_register_script('bodhi_svg_inline', plugins_url('svg-support/js/min/svg-inline-min.js'), array('jquery'), '1.0.0', true );
|
22 |
-
} else {
|
23 |
-
wp_register_script('bodhi_svg_inline', plugins_url('svg-support/js/min/svg-inline-min.js'), array('jquery'), '1.0.0', false );
|
24 |
}
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
}
|
|
|
30 |
|
31 |
/**
|
32 |
-
* Enqueue CSS for
|
33 |
*/
|
34 |
-
function
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
return true;
|
40 |
-
} else {
|
41 |
-
return false;
|
42 |
}
|
43 |
|
44 |
}
|
|
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
48 |
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
if( bodhi_svgs_specific_pages_only() ) {
|
52 |
-
wp_enqueue_style( 'bodhi_svgs_admin_css', plugins_url('svg-support/css/svgs-admin.css') );
|
53 |
}
|
54 |
|
55 |
}
|
56 |
-
|
57 |
-
?>
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Enqueue scripts and styles
|
4 |
+
* This file is to enqueue the scripts and styles both admin and front end
|
5 |
*/
|
6 |
if ( ! defined( 'ABSPATH' ) ) {
|
7 |
+
exit; // Exit if accessed directly
|
8 |
}
|
9 |
|
10 |
/**
|
11 |
+
* Enqueue the admin CSS using screen check functions
|
12 |
*/
|
13 |
+
function bodhi_svgs_admin_css() {
|
|
|
|
|
14 |
|
15 |
+
// check if user is on SVG Support settings page or media library page
|
16 |
+
if ( bodhi_svgs_specific_pages_settings() || bodhi_svgs_specific_pages_media_library() ) {
|
17 |
|
18 |
+
// enqueue the admin CSS
|
19 |
+
wp_enqueue_style( 'bodhi-svgs-admin', BODHI_SVGS_PLUGIN_URL . 'css/svgs-admin.css' );
|
20 |
|
|
|
|
|
|
|
|
|
21 |
}
|
22 |
|
23 |
+
// check if user is on SVG Support settings page and not in "Advanced Mode"
|
24 |
+
if ( bodhi_svgs_specific_pages_settings() && ! bodhi_svgs_advanced_mode() ) {
|
25 |
+
|
26 |
+
// enqueue the simple mode admin CSS
|
27 |
+
wp_enqueue_style( 'bodhi-svgs-admin-simple-mode', BODHI_SVGS_PLUGIN_URL . 'css/svgs-admin-simple-mode.css' );
|
28 |
+
|
29 |
+
}
|
30 |
|
31 |
}
|
32 |
+
add_action( 'admin_enqueue_scripts', 'bodhi_svgs_admin_css' );
|
33 |
|
34 |
/**
|
35 |
+
* Enqueue front end CSS for attachment pages
|
36 |
*/
|
37 |
+
function bodhi_svgs_frontend_css() {
|
38 |
+
|
39 |
+
// check if user is on attachment page
|
40 |
+
if ( is_attachment() ) {
|
41 |
+
wp_enqueue_style( 'bodhi-svgs-attachment', BODHI_SVGS_PLUGIN_URL . 'css/svgs-attachment.css' );
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
}
|
45 |
+
add_action( 'wp_enqueue_scripts', 'bodhi_svgs_frontend_css' );
|
46 |
|
47 |
+
/**
|
48 |
+
* Enqueue and localize JS for IMG tag replacement
|
49 |
+
*/
|
50 |
+
function bodhi_svgs_inline() {
|
51 |
|
52 |
+
if ( bodhi_svgs_advanced_mode() ) {
|
53 |
+
|
54 |
+
// get the settings
|
55 |
+
global $bodhi_svgs_options;
|
56 |
+
|
57 |
+
// set the custom class for use in JS
|
58 |
+
$css_target = 'img.'. $bodhi_svgs_options['css_target'];
|
59 |
+
|
60 |
+
// check where the JS should be placed
|
61 |
+
if ( ! empty( $bodhi_svgs_options['js_foot_choice'] ) ) {
|
62 |
+
|
63 |
+
wp_register_script( 'bodhi_svg_inline', BODHI_SVGS_PLUGIN_URL . 'js/min/svgs-inline-min.js', array( 'jquery' ), '1.0.0', true );
|
64 |
+
|
65 |
+
} else {
|
66 |
+
|
67 |
+
wp_register_script( 'bodhi_svg_inline', BODHI_SVGS_PLUGIN_URL . 'js/min/svgs-inline-min.js', array( 'jquery' ), '1.0.0', false );
|
68 |
+
|
69 |
+
}
|
70 |
+
|
71 |
+
wp_enqueue_script( 'bodhi_svg_inline' );
|
72 |
+
wp_localize_script( 'bodhi_svg_inline', 'cssTarget', $css_target );
|
73 |
|
|
|
|
|
74 |
}
|
75 |
|
76 |
}
|
77 |
+
add_action( 'wp_enqueue_scripts', 'bodhi_svgs_inline' );
|
|
functions/featured-image.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Featured image meta checkbox to inline SVG
|
4 |
+
*
|
5 |
+
* Allow users to select whether featured images should contain the SVG Support class
|
6 |
+
* Check if the featured image is SVG first, then display meta box for SVG only.
|
7 |
+
*/
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
+
exit; // Exit if accessed directly
|
10 |
+
}
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add checkbox to the featured image metabox
|
14 |
+
*/
|
15 |
+
function bodhi_svgs_featured_image_meta( $content ) {
|
16 |
+
|
17 |
+
global $post;
|
18 |
+
|
19 |
+
// check if featured image is set and has extension of .svg or .svgz
|
20 |
+
// need to make this check on the moment that the thumbnail shows up in the meta box.
|
21 |
+
if ( strpos( get_the_post_thumbnail(), '.svg' ) ) {
|
22 |
+
|
23 |
+
$text = __( 'Render this SVG inline (advanced)', 'svg-support' );
|
24 |
+
$id = 'inline_featured_image';
|
25 |
+
$value = esc_attr( get_post_meta( $post->ID, $id, true ) );
|
26 |
+
$label = '<label for="' . $id . '" class="selectit"><input name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $value . ' "'. checked( $value, 1, false) .'> ' . $text .'</label>';
|
27 |
+
|
28 |
+
return $content .= $label;
|
29 |
+
|
30 |
+
} else {
|
31 |
+
|
32 |
+
return $content;
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
if ( bodhi_svgs_advanced_mode() ) {
|
38 |
+
add_filter( 'admin_post_thumbnail_html', 'bodhi_svgs_featured_image_meta' );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Save featured image meta data when saved
|
43 |
+
*/
|
44 |
+
function bodhi_svgs_save_featured_image_meta( $post_id, $post, $update ) {
|
45 |
+
|
46 |
+
$value = 0;
|
47 |
+
if ( isset( $_REQUEST['inline_featured_image'] ) ) {
|
48 |
+
$value = 1;
|
49 |
+
}
|
50 |
+
|
51 |
+
// set meta value to either 1 or 0
|
52 |
+
update_post_meta( $post_id, 'inline_featured_image', $value );
|
53 |
+
|
54 |
+
}
|
55 |
+
add_action( 'save_post', 'bodhi_svgs_save_featured_image_meta', 10, 3 );
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Add class to the featured image output on front end
|
59 |
+
*/
|
60 |
+
function bodhi_svgs_add_class_to_thumbnail( $thumb ) {
|
61 |
+
|
62 |
+
$inline_featured_image = get_post_meta( get_the_ID(), 'inline_featured_image' );
|
63 |
+
|
64 |
+
if ( in_array( 1, $inline_featured_image ) ) {
|
65 |
+
|
66 |
+
global $bodhi_svgs_options;
|
67 |
+
|
68 |
+
if ( ! empty( $bodhi_svgs_options['css_target'] ) ) {
|
69 |
+
|
70 |
+
$target_class = $bodhi_svgs_options['css_target'];
|
71 |
+
|
72 |
+
} else {
|
73 |
+
|
74 |
+
$target_class = 'style-svg';
|
75 |
+
|
76 |
+
}
|
77 |
+
|
78 |
+
if ( is_single() ) {
|
79 |
+
|
80 |
+
$thumb = str_replace( 'attachment-', $target_class . ' attachment-', $thumb );
|
81 |
+
|
82 |
+
}
|
83 |
+
|
84 |
+
}
|
85 |
+
|
86 |
+
return $thumb;
|
87 |
+
|
88 |
+
}
|
89 |
+
if ( bodhi_svgs_advanced_mode() ) {
|
90 |
+
add_filter( 'post_thumbnail_html', 'bodhi_svgs_add_class_to_thumbnail' );
|
91 |
+
}
|
functions/localization.php
CHANGED
@@ -11,6 +11,4 @@ add_action( 'init', 'bodhi_svgs_localization' );
|
|
11 |
function bodhi_svgs_localization() {
|
12 |
load_plugin_textdomain( 'svg-support', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
13 |
|
14 |
-
}
|
15 |
-
|
16 |
-
?>
|
11 |
function bodhi_svgs_localization() {
|
12 |
load_plugin_textdomain( 'svg-support', false, basename( dirname( __FILE__ ) ) . '/languages' );
|
13 |
|
14 |
+
}
|
|
|
|
functions/mime-types.php
CHANGED
@@ -1,26 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
add_filter( 'upload_mimes', 'bodhi_svgs_upload_mimes' );
|
10 |
-
|
11 |
-
function bodhi_svgs_upload_mimes($mimes = array()) {
|
12 |
|
13 |
global $bodhi_svgs_options;
|
14 |
|
15 |
-
if( empty( $bodhi_svgs_options['restrict'] ) || current_user_can( 'administrator' ) ) {
|
|
|
16 |
// allow SVG file upload
|
17 |
$mimes['svg'] = 'image/svg+xml';
|
18 |
$mimes['svgz'] = 'image/svg+xml';
|
|
|
19 |
return $mimes;
|
|
|
20 |
} else {
|
|
|
21 |
return $mimes;
|
22 |
-
}
|
23 |
|
24 |
-
}
|
25 |
|
26 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Add SVG mime types
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
}
|
8 |
|
9 |
add_filter( 'upload_mimes', 'bodhi_svgs_upload_mimes' );
|
10 |
+
function bodhi_svgs_upload_mimes( $mimes = array() ) {
|
|
|
11 |
|
12 |
global $bodhi_svgs_options;
|
13 |
|
14 |
+
if ( empty( $bodhi_svgs_options['restrict'] ) || current_user_can( 'administrator' ) ) {
|
15 |
+
|
16 |
// allow SVG file upload
|
17 |
$mimes['svg'] = 'image/svg+xml';
|
18 |
$mimes['svgz'] = 'image/svg+xml';
|
19 |
+
|
20 |
return $mimes;
|
21 |
+
|
22 |
} else {
|
23 |
+
|
24 |
return $mimes;
|
|
|
25 |
|
26 |
+
}
|
27 |
|
28 |
+
}
|
functions/thumbnail-display.php
CHANGED
@@ -3,11 +3,10 @@
|
|
3 |
* ADD ABILITY TO VIEW THUMBNAILS IN WP 4.0+
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
-
|
7 |
}
|
8 |
|
9 |
-
add_action('admin_init', 'bodhi_svgs_display_thumbs');
|
10 |
-
|
11 |
function bodhi_svgs_display_thumbs() {
|
12 |
|
13 |
ob_start();
|
@@ -35,7 +34,7 @@ function bodhi_svgs_display_thumbs() {
|
|
35 |
'<# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
|
36 |
'<# } else if ( \'svg+xml\' === data.subtype ) { #>
|
37 |
<img class="details-image" src="{{ data.url }}" draggable="false" />
|
38 |
-
|
39 |
|
40 |
$content
|
41 |
);
|
@@ -54,4 +53,5 @@ function bodhi_svgs_display_thumbs() {
|
|
54 |
return $content;
|
55 |
|
56 |
}
|
|
|
57 |
}
|
3 |
* ADD ABILITY TO VIEW THUMBNAILS IN WP 4.0+
|
4 |
*/
|
5 |
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
}
|
8 |
|
9 |
+
add_action( 'admin_init', 'bodhi_svgs_display_thumbs' );
|
|
|
10 |
function bodhi_svgs_display_thumbs() {
|
11 |
|
12 |
ob_start();
|
34 |
'<# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
|
35 |
'<# } else if ( \'svg+xml\' === data.subtype ) { #>
|
36 |
<img class="details-image" src="{{ data.url }}" draggable="false" />
|
37 |
+
<# } else if ( \'image\' === data.type && data.sizes && data.sizes.full ) { #>',
|
38 |
|
39 |
$content
|
40 |
);
|
53 |
return $content;
|
54 |
|
55 |
}
|
56 |
+
|
57 |
}
|
js/min/svg-inline-min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function($){var e="img."!=cssTarget?cssTarget:"img.style-svg";jQuery(e).each(function(e){var t=jQuery(this),r=t.attr("id"),a=t.attr("class"),d=t.attr("src");jQuery.get(d,function(d){var s=jQuery(d).find("svg"),i=s.attr("id");"undefined"==typeof r?"undefined"==typeof i?(r="svg-replaced-"+e,s=s.attr("id",r)):r=i:s=s.attr("id",r),"undefined"!=typeof a&&(s=s.attr("class",a+" replaced-svg")),s=s.removeAttr("xmlns:a"),t.replaceWith(s),jQuery(document).trigger("svg.loaded",[r])},"xml")})});
|
|
js/min/svgs-admin-notice-update-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).on("click",".svgs-upgrade-notice .notice-dismiss",function(){jQuery.ajax({url:ajaxurl,data:{action:"dismiss_svgs_admin_notice"}})});
|
js/min/svgs-inline-min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready(function($){var e="img."!==cssTarget?cssTarget:"img.style-svg";$(e).each(function(e){var t=jQuery(this),r=t.attr("id"),a=t.attr("class"),d=t.attr("src");d.endsWith("svg")&&$.get(d,function(d){var s=$(d).find("svg"),i=s.attr("id");"undefined"==typeof r?"undefined"==typeof i?(r="svg-replaced-"+e,s=s.attr("id",r)):r=i:s=s.attr("id",r),"undefined"!=typeof a&&(s=s.attr("class",a+" replaced-svg svg-replaced-"+e)),s=s.removeAttr("xmlns:a"),t.replaceWith(s),$(document).trigger("svg.loaded",[r])},"xml")})});
|
js/svg-inline.js
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
|
3 |
-
// Check to see if user set alternate class
|
4 |
-
var target = ( cssTarget != 'img.' ? cssTarget : 'img.style-svg' );
|
5 |
-
|
6 |
-
jQuery(target).each(function(index){
|
7 |
-
var $img = jQuery(this);
|
8 |
-
var imgID = $img.attr('id');
|
9 |
-
var imgClass = $img.attr('class');
|
10 |
-
var imgURL = $img.attr('src');
|
11 |
-
|
12 |
-
jQuery.get(imgURL, function(data) {
|
13 |
-
|
14 |
-
// Get the SVG tag, ignore the rest
|
15 |
-
var $svg = jQuery(data).find('svg');
|
16 |
-
|
17 |
-
var svgID = $svg.attr('id');
|
18 |
-
|
19 |
-
// Add replaced image's ID to the new SVG if necessary
|
20 |
-
if(typeof imgID === 'undefined') {
|
21 |
-
if(typeof svgID === 'undefined') {
|
22 |
-
imgID = 'svg-replaced-'+index;
|
23 |
-
$svg = $svg.attr('id', imgID);
|
24 |
-
} else {
|
25 |
-
imgID = svgID;
|
26 |
-
}
|
27 |
-
} else {
|
28 |
-
$svg = $svg.attr('id', imgID);
|
29 |
-
}
|
30 |
-
|
31 |
-
// Add replaced image's classes to the new SVG
|
32 |
-
if(typeof imgClass !== 'undefined') {
|
33 |
-
$svg = $svg.attr('class', imgClass+' replaced-svg');
|
34 |
-
}
|
35 |
-
|
36 |
-
// Remove any invalid XML tags as per http://validator.w3.org
|
37 |
-
$svg = $svg.removeAttr('xmlns:a');
|
38 |
-
|
39 |
-
// Replace image with new SVG
|
40 |
-
$img.replaceWith($svg);
|
41 |
-
|
42 |
-
jQuery(document).trigger('svg.loaded', [imgID]);
|
43 |
-
|
44 |
-
}, 'xml');
|
45 |
-
});
|
46 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/svgs-admin-notice-update.js
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).on( 'click', '.svgs-upgrade-notice .notice-dismiss', function() {
|
2 |
+
|
3 |
+
jQuery.ajax({
|
4 |
+
url: ajaxurl,
|
5 |
+
data: {
|
6 |
+
action: 'dismiss_svgs_admin_notice'
|
7 |
+
}
|
8 |
+
});
|
9 |
+
|
10 |
+
});
|
js/svgs-inline.js
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
|
3 |
+
// Check to see if user set alternate class
|
4 |
+
var target = ( cssTarget !== 'img.' ? cssTarget : 'img.style-svg' );
|
5 |
+
|
6 |
+
$(target).each(function(index){
|
7 |
+
var $img = jQuery(this);
|
8 |
+
var imgID = $img.attr('id');
|
9 |
+
var imgClass = $img.attr('class');
|
10 |
+
var imgURL = $img.attr('src');
|
11 |
+
|
12 |
+
if (!imgURL.endsWith('svg')) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
|
16 |
+
$.get(imgURL, function(data) {
|
17 |
+
|
18 |
+
// Get the SVG tag, ignore the rest
|
19 |
+
var $svg = $(data).find('svg');
|
20 |
+
|
21 |
+
var svgID = $svg.attr('id');
|
22 |
+
|
23 |
+
// Add replaced image's ID to the new SVG if necessary
|
24 |
+
if(typeof imgID === 'undefined') {
|
25 |
+
if(typeof svgID === 'undefined') {
|
26 |
+
imgID = 'svg-replaced-'+index;
|
27 |
+
$svg = $svg.attr('id', imgID);
|
28 |
+
} else {
|
29 |
+
imgID = svgID;
|
30 |
+
}
|
31 |
+
} else {
|
32 |
+
$svg = $svg.attr('id', imgID);
|
33 |
+
}
|
34 |
+
|
35 |
+
// Add replaced image's classes to the new SVG
|
36 |
+
if(typeof imgClass !== 'undefined') {
|
37 |
+
$svg = $svg.attr('class', imgClass+' replaced-svg svg-replaced-'+index);
|
38 |
+
}
|
39 |
+
|
40 |
+
// Remove any invalid XML tags as per http://validator.w3.org
|
41 |
+
$svg = $svg.removeAttr('xmlns:a');
|
42 |
+
|
43 |
+
// Replace image with new SVG
|
44 |
+
$img.replaceWith($svg);
|
45 |
+
|
46 |
+
$(document).trigger('svg.loaded', [imgID]);
|
47 |
+
|
48 |
+
}, 'xml');
|
49 |
+
});
|
50 |
+
|
51 |
+
});
|
languages/svgsupport-en_AU.mo
DELETED
Binary file
|
languages/svgsupport-en_AU.po
DELETED
@@ -1,298 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: SVG Support 2.2.3.1\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2016-05-16 20:19:06+00:00\n"
|
6 |
-
"PO-Revision-Date: Mon May 16 2016 13:53:49 GMT-0700 (PDT)\n"
|
7 |
-
"Last-Translator: root <benbodhi@gmail.com>\n"
|
8 |
-
"Language-Team: Benbodhi <wp@benbodhi.com>\n"
|
9 |
-
"Language: English (Australia)\n"
|
10 |
-
"Plural-Forms: nplurals=2; plural=n != 1\n"
|
11 |
-
"MIME-Version: 1.0\n"
|
12 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
-
"Content-Transfer-Encoding: 8bit\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Generator: Loco - https://localise.biz/\n"
|
16 |
-
"X-Poedit-Language: English\n"
|
17 |
-
"X-Poedit-Country: AUSTRALIA\n"
|
18 |
-
"X-Poedit-KeywordsList: _:1;gettext:1;dgettext:2;ngettext:1,2;dngettext:2,3;"
|
19 |
-
"__:1;_e:1;_c:1;_n:1,2;_n_noop:1,2;_nc:1,2;__ngettext:1,2;__ngettext_noop:1,2;"
|
20 |
-
"_x:1,2c;_ex:1,2c;_nx:1,2,4c;_nx_noop:1,2,3c;_n_js:1,2;_nx_js:1,2,3c;"
|
21 |
-
"esc_attr__:1;esc_html__:1;esc_attr_e:1;esc_html_e:1;esc_attr_x:1,2c;"
|
22 |
-
"esc_html_x:1,2c;comments_number_link:2,3;t:1;st:1;trans:1;transChoice:1,2\n"
|
23 |
-
"X-Poedit-Basepath: ../\n"
|
24 |
-
"X-Poedit-Bookmarks: \n"
|
25 |
-
"X-Poedit-SearchPath-0: .\n"
|
26 |
-
"X-Textdomain-Support: yes\n"
|
27 |
-
"X-Loco-Target-Locale: en_AU"
|
28 |
-
|
29 |
-
#. URI of the plugin
|
30 |
-
msgid "http://wordpress.org/plugins/svg-support"
|
31 |
-
msgstr "http://wordpress.org/plugins/svg-support"
|
32 |
-
|
33 |
-
msgid "SVG Support"
|
34 |
-
msgstr "SVG Support"
|
35 |
-
|
36 |
-
msgid ""
|
37 |
-
"Allow SVG file uploads using the WordPress Media Library uploader plus "
|
38 |
-
"direct styling of SVG elements using CSS."
|
39 |
-
msgstr ""
|
40 |
-
"Allow SVG file uploads using the WordPress Media Library uploader plus "
|
41 |
-
"direct styling of SVG elements using CSS."
|
42 |
-
|
43 |
-
msgid "Benbodhi"
|
44 |
-
msgstr "Benbodhi"
|
45 |
-
|
46 |
-
msgid "http://benbodhi.com"
|
47 |
-
msgstr "http://benbodhi.com"
|
48 |
-
|
49 |
-
#: ../admin/admin-init.php:15
|
50 |
-
msgid "SVG Support Options and Instructions"
|
51 |
-
msgstr "SVG Support Options and Instructions"
|
52 |
-
|
53 |
-
#: ../admin/admin-init.php:29
|
54 |
-
msgid "You can't play with this."
|
55 |
-
msgstr "You can't play with this."
|
56 |
-
|
57 |
-
#: ../admin/plugin-action-meta-links.php:30
|
58 |
-
msgid "Get Support"
|
59 |
-
msgstr "Get Support"
|
60 |
-
|
61 |
-
#: ../admin/plugin-action-meta-links.php:31
|
62 |
-
msgid "Donate to author"
|
63 |
-
msgstr "Donate to author"
|
64 |
-
|
65 |
-
#: ../admin/plugin-action-meta-links.php:32
|
66 |
-
msgid "$25 Free Credit from GoWebben"
|
67 |
-
msgstr "$25 Free Credit from GoWebben"
|
68 |
-
|
69 |
-
#: ../admin/svgs-settings-page.php:4
|
70 |
-
msgid "SVG Support Settings and Usage"
|
71 |
-
msgstr "SVG Support Settings and Usage"
|
72 |
-
|
73 |
-
#: ../admin/svgs-settings-page.php:12
|
74 |
-
msgid "Introduction"
|
75 |
-
msgstr "Introduction"
|
76 |
-
|
77 |
-
#: ../admin/svgs-settings-page.php:15
|
78 |
-
msgid ""
|
79 |
-
"When using SVG images on your WordPress site, it can be hard to style "
|
80 |
-
"elements within the SVG using CSS. <strong>Now you can, easily!</strong>"
|
81 |
-
msgstr ""
|
82 |
-
"When using SVG images on your WordPress site, it can be hard to style "
|
83 |
-
"elements within the SVG using CSS. <strong>Now you can, easily!</strong>"
|
84 |
-
|
85 |
-
#: ../admin/svgs-settings-page.php:16
|
86 |
-
msgid ""
|
87 |
-
"This plugin not only provides SVG Support like the name says, it also allows "
|
88 |
-
"you to easily embed your full SVG file's code using a simple IMG tag. By "
|
89 |
-
"adding the class <code>style-svg</code> to your IMG elements, this plugin "
|
90 |
-
"dynamically replaces any IMG elements containing the <code>style-svg</code> "
|
91 |
-
"class with your complete SVG."
|
92 |
-
msgstr ""
|
93 |
-
"This plugin not only provides SVG Support like the name says, it also allows "
|
94 |
-
"you to easily embed your full SVG file's code using a simple IMG tag. By "
|
95 |
-
"adding the class <code>style-svg</code> to your IMG elements, this plugin "
|
96 |
-
"dynamically replaces any IMG elements containing the <code>style-svg</code> "
|
97 |
-
"class with your complete SVG."
|
98 |
-
|
99 |
-
#: ../admin/svgs-settings-page.php:17
|
100 |
-
msgid ""
|
101 |
-
"The main purpose of this is to allow styling of SVG elements. Usually your "
|
102 |
-
"styling options are restricted when using <code>embed</code>, "
|
103 |
-
"<code>object</code> or <code>img</code> tags alone."
|
104 |
-
msgstr ""
|
105 |
-
"The main purpose of this is to allow styling of SVG elements. Usually your "
|
106 |
-
"styling options are restricted when using <code>embed</code>, "
|
107 |
-
"<code>object</code> or <code>img</code> tags alone."
|
108 |
-
|
109 |
-
#: ../admin/svgs-settings-page.php:34
|
110 |
-
msgid "Settings"
|
111 |
-
msgstr "Settings"
|
112 |
-
|
113 |
-
#: ../admin/svgs-settings-page.php:46
|
114 |
-
msgid "Restrict to Administrators"
|
115 |
-
msgstr "Restrict to Administrators"
|
116 |
-
|
117 |
-
#: ../admin/svgs-settings-page.php:51 ../admin/svgs-settings-page.php:62 ..
|
118 |
-
#: admin/svgs-settings-page.php:73
|
119 |
-
msgid "Yes"
|
120 |
-
msgstr "Yes"
|
121 |
-
|
122 |
-
#: ../admin/svgs-settings-page.php:51
|
123 |
-
msgid " Restricts SVG upload priveledges to Administrators."
|
124 |
-
msgstr " Restricts SVG upload priveledges to Administrators."
|
125 |
-
|
126 |
-
#: ../admin/svgs-settings-page.php:57
|
127 |
-
msgid "Output JS in Footer?"
|
128 |
-
msgstr "Output JS in Footer?"
|
129 |
-
|
130 |
-
#: ../admin/svgs-settings-page.php:62
|
131 |
-
msgid ""
|
132 |
-
" Normally, scripts are placed in <code>head</code> of the HTML document. If "
|
133 |
-
"this parameter is true, the script is placed before the closing "
|
134 |
-
"<code>body</code> tag. This requires the theme to have the "
|
135 |
-
"<code>wp_footer()</code> template tag in the appropriate place."
|
136 |
-
msgstr ""
|
137 |
-
" Normally, scripts are placed in <code>head</code> of the HTML document. If "
|
138 |
-
"this parameter is true, the script is placed before the closing "
|
139 |
-
"<code>body</code> tag. This requires the theme to have the "
|
140 |
-
"<code>wp_footer()</code> template tag in the appropriate place."
|
141 |
-
|
142 |
-
#: ../admin/svgs-settings-page.php:68
|
143 |
-
msgid "Automatically insert class?"
|
144 |
-
msgstr "Automatically insert class?"
|
145 |
-
|
146 |
-
#: ../admin/svgs-settings-page.php:73
|
147 |
-
msgid ""
|
148 |
-
" Checking this will make sure that either the default class or the custom "
|
149 |
-
"one you set below is inserted into the style attributes of <code>img</code> "
|
150 |
-
"tags when you insert images. Additionally, it will remove all of the default "
|
151 |
-
"WordPress classes."
|
152 |
-
msgstr ""
|
153 |
-
" Checking this will make sure that either the default class or the custom "
|
154 |
-
"one you set below is inserted into the style attributes of <code>img</code> "
|
155 |
-
"tags when you insert images. Additionally, it will remove all of the default "
|
156 |
-
"WordPress classes."
|
157 |
-
|
158 |
-
#: ../admin/svgs-settings-page.php:78
|
159 |
-
msgid "CSS Class to target"
|
160 |
-
msgstr "CSS Class to target"
|
161 |
-
|
162 |
-
#: ../admin/svgs-settings-page.php:81
|
163 |
-
msgid ""
|
164 |
-
"The default target class is <code>style-svg</code>. You can change it to "
|
165 |
-
"your own class such as <code>my-class</code> by typing it here.<br />Leave "
|
166 |
-
"blank to use the default class."
|
167 |
-
msgstr ""
|
168 |
-
"The default target class is <code>style-svg</code>. You can change it to "
|
169 |
-
"your own class such as <code>my-class</code> by typing it here.<br />Leave "
|
170 |
-
"blank to use the default class."
|
171 |
-
|
172 |
-
#: ../admin/svgs-settings-page.php:87
|
173 |
-
msgid "Save Changes"
|
174 |
-
msgstr "Save Changes"
|
175 |
-
|
176 |
-
#: ../admin/svgs-settings-page.php:98
|
177 |
-
msgid "Usage"
|
178 |
-
msgstr "Usage"
|
179 |
-
|
180 |
-
#: ../admin/svgs-settings-page.php:101
|
181 |
-
msgid "You can simply upload SVG images to your media library like any other file."
|
182 |
-
msgstr "You can simply upload SVG images to your media library like any other file."
|
183 |
-
|
184 |
-
#: ../admin/svgs-settings-page.php:102
|
185 |
-
msgid ""
|
186 |
-
"Now, embed your SVG image like a standard image with the addition of adding "
|
187 |
-
"the class <code>style-svg</code> (or your custom class from above) to any "
|
188 |
-
"IMG tags that you want this plugin to swap out with your actual SVG code."
|
189 |
-
msgstr ""
|
190 |
-
"Now, embed your SVG image like a standard image with the addition of adding "
|
191 |
-
"the class <code>style-svg</code> (or your custom class from above) to any "
|
192 |
-
"IMG tags that you want this plugin to swap out with your actual SVG code."
|
193 |
-
|
194 |
-
#: ../admin/svgs-settings-page.php:103
|
195 |
-
msgid "For example:"
|
196 |
-
msgstr "For example:"
|
197 |
-
|
198 |
-
#: ../admin/svgs-settings-page.php:106
|
199 |
-
msgid "or"
|
200 |
-
msgstr "or"
|
201 |
-
|
202 |
-
#: ../admin/svgs-settings-page.php:109
|
203 |
-
msgid ""
|
204 |
-
"The whole IMG tag element will now be dynamically replaced by the actual "
|
205 |
-
"code of your SVG, making the inner content targetable."
|
206 |
-
msgstr ""
|
207 |
-
"The whole IMG tag element will now be dynamically replaced by the actual "
|
208 |
-
"code of your SVG, making the inner content targetable."
|
209 |
-
|
210 |
-
#: ../admin/svgs-settings-page.php:110
|
211 |
-
msgid "This allows you to target elements within your SVG using CSS."
|
212 |
-
msgstr "This allows you to target elements within your SVG using CSS."
|
213 |
-
|
214 |
-
#: ../admin/svgs-settings-page.php:112
|
215 |
-
msgid "Please Note:"
|
216 |
-
msgstr "Please Note:"
|
217 |
-
|
218 |
-
#: ../admin/svgs-settings-page.php:113
|
219 |
-
msgid ""
|
220 |
-
"- You will need to set your own height and width in your CSS for SVG files "
|
221 |
-
"to display correctly."
|
222 |
-
msgstr ""
|
223 |
-
"- You will need to set your own height and width in your CSS for SVG files "
|
224 |
-
"to display correctly."
|
225 |
-
|
226 |
-
#: ../admin/svgs-settings-page.php:114
|
227 |
-
msgid ""
|
228 |
-
"- Your uploaded image needs to be an SVG file for this plugin to replace the "
|
229 |
-
"img tag with the inline SVG code. It will not create SVG files for you."
|
230 |
-
msgstr ""
|
231 |
-
"- Your uploaded image needs to be an SVG file for this plugin to replace the "
|
232 |
-
"img tag with the inline SVG code. It will not create SVG files for you."
|
233 |
-
|
234 |
-
#: ../admin/svgs-settings-page.php:131
|
235 |
-
msgid "Plugin Features"
|
236 |
-
msgstr "Plugin Features"
|
237 |
-
|
238 |
-
#: ../admin/svgs-settings-page.php:134
|
239 |
-
msgid "SVG Support for your media library"
|
240 |
-
msgstr "SVG Support for your media library"
|
241 |
-
|
242 |
-
#: ../admin/svgs-settings-page.php:135
|
243 |
-
msgid "Style SVG elements directly using CSS"
|
244 |
-
msgstr "Style SVG elements directly using CSS"
|
245 |
-
|
246 |
-
#: ../admin/svgs-settings-page.php:136
|
247 |
-
msgid "Restrict to Administrators only"
|
248 |
-
msgstr "Restrict to Administrators only"
|
249 |
-
|
250 |
-
#: ../admin/svgs-settings-page.php:137
|
251 |
-
msgid "Extremely Simple To Use"
|
252 |
-
msgstr "Extremely Simple To Use"
|
253 |
-
|
254 |
-
#: ../admin/svgs-settings-page.php:145
|
255 |
-
msgid "About The Plugin"
|
256 |
-
msgstr "About The Plugin"
|
257 |
-
|
258 |
-
#: ../admin/svgs-settings-page.php:147
|
259 |
-
msgid "You can read about this plugin in detail on"
|
260 |
-
msgstr "You can read about this plugin in detail on"
|
261 |
-
|
262 |
-
#: ../admin/svgs-settings-page.php:147
|
263 |
-
msgid "The WordPress Plugin Repository"
|
264 |
-
msgstr "The WordPress Plugin Repository"
|
265 |
-
|
266 |
-
#: ../admin/svgs-settings-page.php:148
|
267 |
-
msgid "Need help?"
|
268 |
-
msgstr "Need help?"
|
269 |
-
|
270 |
-
#: ../admin/svgs-settings-page.php:148
|
271 |
-
msgid "Visit Support"
|
272 |
-
msgstr "Visit Support"
|
273 |
-
|
274 |
-
#: ../admin/svgs-settings-page.php:149
|
275 |
-
msgid "Buy Benbodhi a Beer →"
|
276 |
-
msgstr "Buy Benbodhi a Beer →"
|
277 |
-
|
278 |
-
#: ../admin/svgs-settings-page.php:150
|
279 |
-
msgid "from"
|
280 |
-
msgstr "from"
|
281 |
-
|
282 |
-
#: ../admin/svgs-settings-page.php:157
|
283 |
-
msgid "GoWebben Hosting"
|
284 |
-
msgstr "GoWebben Hosting"
|
285 |
-
|
286 |
-
#: ../admin/svgs-settings-page.php:159
|
287 |
-
msgid "Claim your FREE $25 credit from"
|
288 |
-
msgstr "Claim your FREE $25 credit from"
|
289 |
-
|
290 |
-
#: ../admin/svgs-settings-page.php:159
|
291 |
-
msgid ""
|
292 |
-
"No catch, just free credit for using this plugin! It will be applied "
|
293 |
-
"automatically using the link provided, but in any case you can simply use "
|
294 |
-
"code: SVGSUPPORT during checkout."
|
295 |
-
msgstr ""
|
296 |
-
"No catch, just free credit for using this plugin! It will be applied "
|
297 |
-
"automatically using the link provided, but in any case you can simply use "
|
298 |
-
"code: SVGSUPPORT during checkout."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
one-time-upgrade-activate.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* One time function to make sure new "Advanced Mode" setting is activated
|
4 |
+
*/
|
5 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
6 |
+
exit; // Exit if accessed directly
|
7 |
+
}
|
8 |
+
/**
|
9 |
+
* Update plugin settings on activate/update
|
10 |
+
*/
|
11 |
+
function bodhi_svgs_plugin_update() {
|
12 |
+
|
13 |
+
$new_option = array( 'advanced_mode' => 'on' );
|
14 |
+
$existing_settings = get_option( 'bodhi_svgs_settings' );
|
15 |
+
$new_settings = array_merge( $new_option, $existing_settings );
|
16 |
+
|
17 |
+
update_option( 'bodhi_svgs_settings', $new_settings );
|
18 |
+
|
19 |
+
}
|
20 |
+
register_activation_hook( BODHI_SVGS_PLUGIN_PATH . 'svg-support.php', 'bodhi_svgs_plugin_update' );
|
21 |
+
add_action( 'upgrader_process_complete', 'bodhi_svgs_plugin_update', 10, 2);
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== SVG Support ===
|
2 |
Contributors: Benbodhi
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ
|
4 |
-
Tags: svg, vector, css, style, mime, mime type, embed, img, inline
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.8-alpha-39901
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -38,7 +38,9 @@ Once activated, you can simply upload SVG images to your media library like any
|
|
38 |
|
39 |
As an administrator, you can go to the admin settings page 'Settings' > 'SVG Support' and restrict SVG file uploads to administrators only and even define a custom CSS class to target if you wish.
|
40 |
|
41 |
-
|
|
|
|
|
42 |
For example:
|
43 |
|
44 |
`<img class="style-svg" alt="alt-text" src="image-source.svg" />`
|
@@ -48,6 +50,8 @@ or
|
|
48 |
The whole IMG tag element will now be dynamically replaced by the actual code of your SVG, making the inner content targetable.<br />
|
49 |
This allows you to target elements within your SVG using CSS.
|
50 |
|
|
|
|
|
51 |
Please Note: You will need to set your own height and width in your CSS for SVG files to display correctly.
|
52 |
|
53 |
*If you are having any issues, please use the support tab and I will try my best to get back to you quickly*
|
@@ -58,17 +62,15 @@ As with allowing uploads of any files, there is potential risks involved. Only a
|
|
58 |
|
59 |
= Translations =
|
60 |
|
61 |
-
* English - default, always included
|
|
|
|
|
62 |
* Serbian - translated and submitted by Ogi Djuraskovic from [first site guide](http://firstsiteguide.com/)
|
63 |
* Spanish - translated and submitted by [Apasionados del Marketing](http://apasionados.es)
|
64 |
-
* *Your translation? - [Just send it in](http://gowebben.com/contact/)*
|
65 |
-
|
66 |
-
*Note:* This plugin is localized/translateable by default. This is very important for all users worldwide. So please contribute your language to the plugin to make it even more useful.<br />
|
67 |
-
For translating I recommend ["Loco Translate" plugin](https://wordpress.org/plugins/loco-translate/) and for validating the ["Poedit Editor"](http://www.poedit.net/).
|
68 |
|
69 |
= Feedback =
|
70 |
|
71 |
-
* I am open to your suggestions and feedback - Thanks for
|
72 |
* Drop me a line [@benbodhi](http://twitter.com/benbodhi) or [@GoWebben](http://twitter.com/gowebben) on Twitter
|
73 |
* Follow me on [my Facebook page](http://www.facebook.com/gowebben)
|
74 |
* Or circle [+GoWebben](https://plus.google.com/+Gowebben/) on Google Plus ;-)
|
@@ -99,6 +101,14 @@ or
|
|
99 |
|
100 |
== Frequently Asked Questions ==
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
= I'm trying to use SVG in the customizer but it's not working. =
|
103 |
|
104 |
To allow SVG to work in the customizer, you will need to modify/add some code in your child theme's function file. [Here is a great tutorial](https://thebrandid.com/using-svg-logos-wordpress-customizer/) on how to do that. The important part is
|
@@ -121,11 +131,26 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
|
|
121 |
|
122 |
== Screenshots ==
|
123 |
|
124 |
-
1.
|
125 |
-
2.
|
|
|
|
|
126 |
|
127 |
== Changelog ==
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
= 2.2.5 =
|
130 |
|
131 |
* FIX: Display SVG thumbnails in attachment modals.
|
@@ -222,6 +247,10 @@ If you are using SVG Support with Visual Composer or any other page builders, yo
|
|
222 |
|
223 |
== Upgrade Notice ==
|
224 |
|
|
|
|
|
|
|
|
|
225 |
= 2.2.5 =
|
226 |
|
227 |
* Fix to display SVG thumbnails in attachment modals. (NOTE: You can not edit SVG files like other images in WordPress)
|
1 |
=== SVG Support ===
|
2 |
Contributors: Benbodhi
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z9R7JERS82EQQ
|
4 |
+
Tags: svg, vector, css, style, mime, mime type, embed, img, inline, animation
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.8-alpha-39901
|
7 |
+
Stable tag: 2.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
38 |
|
39 |
As an administrator, you can go to the admin settings page 'Settings' > 'SVG Support' and restrict SVG file uploads to administrators only and even define a custom CSS class to target if you wish.
|
40 |
|
41 |
+
If you only need simple functionality to upload SVG files, then you don't need to enable "Advanced Mode" which will make sure that the frontend script is not enqueued for performance and will hide the unnecessary settings.
|
42 |
+
|
43 |
+
For advanced users, enable the "Advanced Mode" under Settings > SVG Support. Then you can embed your SVG images just like you would a standard image with the addition of adding (in text view) the class `"style-svg"` (or the custom class you defined) to your IMG tags that you want this plugin to swap out with your actual SVG code. You can also remove any other attributes from the tag and use CSS to manage the size. There is also a setting to automatically add your class to the IMG tag for you when you're inserting it in to a post or page.<br />
|
44 |
For example:
|
45 |
|
46 |
`<img class="style-svg" alt="alt-text" src="image-source.svg" />`
|
50 |
The whole IMG tag element will now be dynamically replaced by the actual code of your SVG, making the inner content targetable.<br />
|
51 |
This allows you to target elements within your SVG using CSS.
|
52 |
|
53 |
+
*Featured Images:* If a post/page is saved with your SVG as a featured image, a checkbox will display in the featured image meta box to allow you to render it inline (only if advanced mode is active).
|
54 |
+
|
55 |
Please Note: You will need to set your own height and width in your CSS for SVG files to display correctly.
|
56 |
|
57 |
*If you are having any issues, please use the support tab and I will try my best to get back to you quickly*
|
62 |
|
63 |
= Translations =
|
64 |
|
65 |
+
* US English - default, always included
|
66 |
+
* AU English - WordPress Language Packs
|
67 |
+
* NZ English - WordPress Language Packs
|
68 |
* Serbian - translated and submitted by Ogi Djuraskovic from [first site guide](http://firstsiteguide.com/)
|
69 |
* Spanish - translated and submitted by [Apasionados del Marketing](http://apasionados.es)
|
|
|
|
|
|
|
|
|
70 |
|
71 |
= Feedback =
|
72 |
|
73 |
+
* I am open to your suggestions and feedback - Thanks for using SVG Support!
|
74 |
* Drop me a line [@benbodhi](http://twitter.com/benbodhi) or [@GoWebben](http://twitter.com/gowebben) on Twitter
|
75 |
* Follow me on [my Facebook page](http://www.facebook.com/gowebben)
|
76 |
* Or circle [+GoWebben](https://plus.google.com/+Gowebben/) on Google Plus ;-)
|
101 |
|
102 |
== Frequently Asked Questions ==
|
103 |
|
104 |
+
= SVG not rendering inline since 2.3 update =
|
105 |
+
|
106 |
+
SVG Support 2.3 includes a new settings "Advanced Mode". Users that were inlining SVG files need to make sure this setting is checked. Go to your dashboard > Settings > SVG Support and check "Advanced Mode". All of your original settings should still be there.
|
107 |
+
|
108 |
+
= How do I disable the Javascript on the front end if I am not using inline SVG? =
|
109 |
+
|
110 |
+
If you go to `Settings > SVG Support` in your admin dashboard, you can choose to enable "Advanced Mode" or not. If you leave it disabled, the advanced functionality and extraneous script is removed.
|
111 |
+
|
112 |
= I'm trying to use SVG in the customizer but it's not working. =
|
113 |
|
114 |
To allow SVG to work in the customizer, you will need to modify/add some code in your child theme's function file. [Here is a great tutorial](https://thebrandid.com/using-svg-logos-wordpress-customizer/) on how to do that. The important part is
|
131 |
|
132 |
== Screenshots ==
|
133 |
|
134 |
+
1. Basic Settings
|
135 |
+
2. Advanced Settings
|
136 |
+
3. Featured Image checkbox to render SVG inline
|
137 |
+
4. Inline SVG in the front end markup
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 2.3 =
|
142 |
+
|
143 |
+
* New Feature - Advanced Mode: allows you to turn off the advanced features and simply upload SVG files like normal images. This addition also enables users to turn off the script added on front end by leaving Advanced Mode unchecked.
|
144 |
+
* New Feature - Featured Image Support: If your featured image is SVG, once the post is saved you will see a checkbox to render the SVG inline (advanced mode only).
|
145 |
+
* Performance - Stop inlining JS from running if image source is not SVG.
|
146 |
+
* Added new stylesheet for settings page.
|
147 |
+
* Moved SCSS files to their own folder.
|
148 |
+
* Changed donate link so I can track it and properly thank you for your generous donations.
|
149 |
+
* Added a rating link to the settings and media pages.
|
150 |
+
* Cleaned up code formatting, added more comments.
|
151 |
+
* Added a plugin version check.
|
152 |
+
* Added notice so people are aware they may need to turn on the advanced mode.
|
153 |
+
|
154 |
= 2.2.5 =
|
155 |
|
156 |
* FIX: Display SVG thumbnails in attachment modals.
|
247 |
|
248 |
== Upgrade Notice ==
|
249 |
|
250 |
+
= 2.3 =
|
251 |
+
|
252 |
+
IMPORTANT, MAJOR CHANGES, BACKUP BEFORE UPDATING: Users that are inlining SVG will need to make sure "Advanced Mode" is active under "Settings > SVG Support". Your settings should all still be there. Make sure you run a backup before updating just in case!!!
|
253 |
+
|
254 |
= 2.2.5 =
|
255 |
|
256 |
* Fix to display SVG thumbnails in attachment modals. (NOTE: You can not edit SVG files like other images in WordPress)
|
scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-admin-simple-mode.scssc
ADDED
Binary file
|
{css/.sass-cache/2d7711e41fe8fdd2638823a7fcb5fbf7b4fba050 → scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c}/svgs-admin.scssc
RENAMED
Binary file
|
scss/.sass-cache/19f648ba9a479ff856a119e87d48b4db48146d8c/svgs-attachment.scssc
ADDED
Binary file
|
scss/svgs-admin-simple-mode.scss
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Hide advanced features
|
3 |
+
*/
|
4 |
+
.svgs-advanced {
|
5 |
+
display: none;
|
6 |
+
}
|
{css → scss}/svgs-admin.scss
RENAMED
@@ -17,5 +17,5 @@ h3 {
|
|
17 |
*/
|
18 |
table.media .column-title .media-icon img {
|
19 |
width: 60px;
|
20 |
-
height: 60px;
|
21 |
}
|
17 |
*/
|
18 |
table.media .column-title .media-icon img {
|
19 |
width: 60px;
|
20 |
+
// height: 60px;
|
21 |
}
|
scss/svgs-attachment.scss
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.attachment img[src$=".svg"] {
|
2 |
+
width: 100%;
|
3 |
+
}
|
svg-support.php
CHANGED
@@ -2,55 +2,45 @@
|
|
2 |
/*
|
3 |
Plugin Name: SVG Support
|
4 |
Plugin URI: http://wordpress.org/plugins/svg-support/
|
5 |
-
Description: Allow SVG file uploads using the WordPress Media Library uploader plus direct
|
6 |
-
Version: 2.
|
7 |
Author: Benbodhi
|
8 |
Author URI: http://benbodhi.com
|
9 |
Text Domain: svg-support
|
10 |
Domain Path: /languages
|
11 |
-
License:
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
14 |
-
Copyright 2013
|
15 |
|
16 |
-
This program is free software; you can redistribute it and/or modify
|
17 |
-
it under the terms of the GNU General Public License, version 2,
|
18 |
-
as published by the Free Software Foundation.
|
19 |
-
|
20 |
-
This program is distributed in the hope that it will be useful,
|
21 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23 |
-
GNU General Public License for more details.
|
24 |
-
|
25 |
-
The license for this software can likely be found here:
|
26 |
-
http://www.gnu.org/licenses/gpl-2.0.html
|
27 |
-
If not, write to the Free Software Foundation Inc.
|
28 |
-
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
29 |
*/
|
30 |
|
31 |
if ( ! defined( 'ABSPATH' ) ) {
|
32 |
exit; // Exit if accessed directly
|
33 |
}
|
34 |
|
35 |
-
|
36 |
-
*
|
37 |
-
|
38 |
-
$svgs_plugin_version = '2.
|
39 |
$plugin_file = plugin_basename(__FILE__); // plugin file for reference
|
40 |
define( 'BODHI_SVGS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); // define the absolute plugin path for includes
|
|
|
41 |
$bodhi_svgs_options = get_option('bodhi_svgs_settings'); // retrieve our plugin settings from the options table
|
42 |
|
43 |
-
|
44 |
-
*
|
45 |
-
|
46 |
include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-init.php' ); // initialize admin menu & settings page
|
47 |
include( BODHI_SVGS_PLUGIN_PATH . 'admin/plugin-action-meta-links.php' ); // add links to the plugin on the plugins page
|
|
|
48 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/mime-types.php' ); // setup mime types support for SVG
|
49 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/thumbnail-display.php' ); // make SVG thumbnails display correctly in media library
|
50 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/attachment-modal.php' ); // make SVG thumbnails display correctly in attachment modals
|
51 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/enqueue.php' ); // enqueue js & css for inline replacement & admin
|
52 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/localization.php' ); // setup localization & languages
|
53 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
|
|
|
54 |
|
55 |
/**
|
56 |
* TEMP FIX FOR 4.7.1
|
@@ -67,4 +57,28 @@ function bodhi_svgs_disable_real_mime_check( $data, $file, $filename, $mimes ) {
|
|
67 |
}
|
68 |
add_filter( 'wp_check_filetype_and_ext', 'bodhi_svgs_disable_real_mime_check', 10, 4 );
|
69 |
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/*
|
3 |
Plugin Name: SVG Support
|
4 |
Plugin URI: http://wordpress.org/plugins/svg-support/
|
5 |
+
Description: Allow SVG file uploads using the WordPress Media Library uploader plus the ability to inline SVG files for direct targeting of SVG elements for CSS and JS.
|
6 |
+
Version: 2.3
|
7 |
Author: Benbodhi
|
8 |
Author URI: http://benbodhi.com
|
9 |
Text Domain: svg-support
|
10 |
Domain Path: /languages
|
11 |
+
License: GPLv2 or later
|
12 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
13 |
|
14 |
+
Copyright 2013 and beyond | Benbodhi (email : wp@benbodhi.com)
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
19 |
exit; // Exit if accessed directly
|
20 |
}
|
21 |
|
22 |
+
/**
|
23 |
+
* Global variables
|
24 |
+
*/
|
25 |
+
$svgs_plugin_version = '2.3'; // for use on admin pages
|
26 |
$plugin_file = plugin_basename(__FILE__); // plugin file for reference
|
27 |
define( 'BODHI_SVGS_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); // define the absolute plugin path for includes
|
28 |
+
define( 'BODHI_SVGS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // define the plugin url for use in enqueue
|
29 |
$bodhi_svgs_options = get_option('bodhi_svgs_settings'); // retrieve our plugin settings from the options table
|
30 |
|
31 |
+
/**
|
32 |
+
* Includes - keeping it modular
|
33 |
+
*/
|
34 |
include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-init.php' ); // initialize admin menu & settings page
|
35 |
include( BODHI_SVGS_PLUGIN_PATH . 'admin/plugin-action-meta-links.php' ); // add links to the plugin on the plugins page
|
36 |
+
include( BODHI_SVGS_PLUGIN_PATH . 'admin/admin-notice.php' ); // dismissable admin notice to warn users to update settings
|
37 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/mime-types.php' ); // setup mime types support for SVG
|
38 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/thumbnail-display.php' ); // make SVG thumbnails display correctly in media library
|
39 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/attachment-modal.php' ); // make SVG thumbnails display correctly in attachment modals
|
40 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/enqueue.php' ); // enqueue js & css for inline replacement & admin
|
41 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/localization.php' ); // setup localization & languages
|
42 |
include( BODHI_SVGS_PLUGIN_PATH . 'functions/attribute-control.php' ); // auto set SVG class & remove dimensions during insertion
|
43 |
+
include( BODHI_SVGS_PLUGIN_PATH . 'functions/featured-image.php' ); // allow inline SVG for featured images
|
44 |
|
45 |
/**
|
46 |
* TEMP FIX FOR 4.7.1
|
57 |
}
|
58 |
add_filter( 'wp_check_filetype_and_ext', 'bodhi_svgs_disable_real_mime_check', 10, 4 );
|
59 |
|
60 |
+
/**
|
61 |
+
* Version based conditional / Check for stored plugin version
|
62 |
+
*
|
63 |
+
* Versions prior to 2.3 did not store the version number,
|
64 |
+
* these older versions need to have the "Advanced Mode" switched on to retain inline functionality if upgrading to 2.3 or higher.
|
65 |
+
* If no version number is stored, load the one-time-upgrade-activate.php file and store current plugin version number.
|
66 |
+
* If there is a version number stored, update it with the new version number.
|
67 |
+
*/
|
68 |
+
// get the stored plugin version
|
69 |
+
$svgs_plugin_version_stored = get_option( 'bodhi_svgs_plugin_version' );
|
70 |
+
// only run this if there is no stored version number (have never stored the number in previous versions)
|
71 |
+
if ( empty( $svgs_plugin_version_stored ) ) {
|
72 |
+
|
73 |
+
// include the one time script to activate the new "Advanced Mode" setting
|
74 |
+
include( BODHI_SVGS_PLUGIN_PATH . 'one-time-upgrade-activate.php');
|
75 |
+
|
76 |
+
// add plugin version number to options table
|
77 |
+
update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
|
78 |
+
|
79 |
+
} else {
|
80 |
+
|
81 |
+
// update plugin version number in options table
|
82 |
+
update_option( 'bodhi_svgs_plugin_version', $svgs_plugin_version );
|
83 |
+
|
84 |
+
}
|