11<?php
22/*
3- Plugin Name: Easy SVG Support
3+ Plugin Name: Easy SVG Support
44Plugin URI: https://wordpress.org/plugins/easy-svg/
55Description: Add SVG Support for WordPress.
6- Version: 2.1
6+ Version: 2.2
77Author: Benjamin Zekavica
88Author URI: http://www.benjamin-zekavica.de
99Text Domain: easy-svg
2424along with Easy SVG. If not, see license.txt .
2525
2626
27- Copyright by:
28- (c) 2017 - 2018 by Benjamin Zekavica. All rights reserved.
27+ Copyright by:
28+ (c) 2017 - 2018 by Benjamin Zekavica. All rights reserved.
2929
30- Imprint:
30+ Imprint:
3131Benjamin Zekavica
3232Oranienstrasse 12
33- 52066 Aachen
33+ 52066 Aachen
3434
3535E-Mail: info@benjamin-zekavica.de
3636Web: www.benjamin-zekavica.de
3737
38- I don't give support by Mail. Please write in the
39- community forum for questions and problems.
38+ I don't give support by Mail. Please write in the
39+ community forum for questions and problems.
4040
4141
4242*/
4343
4444/* ========================================
45- Upload SVG Support
45+ Upload SVG Support
4646 ======================================== */
4747
4848add_filter ( 'upload_mimes ' , 'esw_add_support ' );
4949
5050
5151function esw_add_support ( $ svg_editing ){
52-
52+
5353 $ svg_editing ['svg ' ] = 'image/svg+xml ' ;
54-
54+
5555 // Echo the svg file
5656 return $ svg_editing ;
5757}
@@ -70,14 +70,14 @@ function esw_upload_check($checked, $file, $filename, $mimes){
7070 $ type = $ esw_upload_check ['type ' ];
7171 $ proper_filename = $ filename ;
7272
73- /* ========================================
74- Upload checking filename
75- ======================================== */
73+ /* ========================================
74+ Upload checking filename
75+ ======================================== */
7676
7777 if ($ type && 0 === strpos ($ type , 'image/ ' ) && $ ext !== 'svg ' ){
7878 $ ext = $ type = false ;
7979 }
80-
80+
8181 // Check the filename
8282 $ checked = compact ('ext ' ,'type ' ,'proper_filename ' );
8383
@@ -91,50 +91,50 @@ function esw_upload_check($checked, $file, $filename, $mimes){
9191
9292
9393
94- /* ========================================
95- Register activation hook.
94+ /* ========================================
95+ Register activation hook.
9696 ======================================== */
9797
9898register_activation_hook ( __FILE__ , 'esw_admin_notice_example_activation_hook ' );
99-
99+
100100
101101/* ========================================
102102 Runs only when the plugin is activated.
103103 ======================================== */
104104
105105function esw_admin_notice_example_activation_hook () {
106-
107- /* ========================================
108- Create transient data
106+
107+ /* ========================================
108+ Create transient data
109109 ======================================== */
110110
111111 set_transient ( 'esw-admin-notice-example ' , true , 5 );
112112}
113-
114-
113+
114+
115115/* Add admin notice */
116116
117117add_action ( 'admin_notices ' , 'esw_admin_notice_example_notice ' );
118-
119-
118+
119+
120120/* ========================================
121- Admin Notice on Activation.
121+ Admin Notice on Activation.
122122 ======================================= */
123123
124124function esw_admin_notice_example_notice (){
125-
125+
126126 /* ==============================================
127- Check transient, if available display notice
127+ Check transient, if available display notice
128128 ============================================== */
129129
130130 if ( get_transient ( 'esw-admin-notice-example ' ) ){ ?>
131131
132132 <div class="updated notice is-dismissible">
133133 <p>
134134 <strong>
135- <?php _e ( 'Thank you for using this plugin! ' , 'easy-svg ' ) ; ?>
135+ <?php _e ( 'Thank you for using this plugin! ' , 'easy-svg ' ) ; ?>
136136 </strong><br />
137- <?php _e ( 'Go now to the Media Libary and upload your SVG Files. ' , 'easy-svg ' ); ?>
137+ <?php _e ( 'Go now to the Media Libary and upload your SVG Files. ' , 'easy-svg ' ); ?>
138138 <br /><br />
139139 <?php _e ( 'Kind Regards ' , 'easy-svg ' ); ?>
140140 <br />
@@ -158,11 +158,11 @@ function esw_admin_notice_example_notice(){
158158
159159 // Add Hook for Actived Plugin
160160
161- add_action ('esw_welcome_message_active_plugin ' , 'esw_admin_notice_example_notice ' );
162-
163- /* ========================================
164- Load Text Domain for languages files
165- ======================================= */
161+ add_action ('esw_welcome_message_active_plugin ' , 'esw_admin_notice_example_notice ' );
162+
163+ /* ========================================
164+ Load Text Domain for languages files
165+ ======================================= */
166166
167167
168168 if ( ! function_exists ( 'esw_multiligual_textdomain ' ) ) :
@@ -173,50 +173,50 @@ function esw_multiligual_textdomain() {
173173
174174 }
175175
176- // Add action for the translation file
176+ // Add action for the translation file
177177
178178 add_action ( 'plugins_loaded ' , 'esw_multiligual_textdomain ' );
179179
180- // Finishing the if loop
180+ // Finishing the if loop
181181
182182 endif ;
183183
184184
185185
186- /* ========================================
187- Add WordPress Widget
188- ======================================= */
186+ /* ========================================
187+ Add WordPress Widget
188+ ======================================= */
189189
190190
191191 add_action ('wp_dashboard_setup ' , 'esw_dashboard_widget ' );
192-
192+
193193 function esw_dashboard_widget () {
194194 global $ wp_meta_boxes ;
195-
195+
196196 wp_add_dashboard_widget ('custom_help_widget ' , 'Easy SVG Support ' , 'esw_support_dashbord_widget_text ' );
197197 }
198-
198+
199199
200200 function esw_support_dashbord_widget_text () {
201201
202202 _e ( '<h2>Welcome to EASY SVG!</h2><br /> Thank you for your installtion of my custom plugin! Do you want to Upload SVG Files? Than go to the Media Libary and Upload it! <br /><br /> Best Regards <br /> <strong>Benjamin Zekavica<strong> ' , 'easy-svg ' );
203203 echo "<br /><br /> " ;
204204
205- _e ( 'Version Number ' , 'easy-svg ' );
206- echo " 2.0.3 " ;
207-
205+ _e ( 'Version Number ' , 'easy-svg ' );
206+ echo " 2.2 " ;
207+
208208 }
209209
210- // Add Hook for Messages
210+ // Add Hook for Messages
211211
212212 add_action ('esw_support_welcome_widget_text ' , 'esw_support_dashbord_widget_text ' );
213213
214- /* ========================================
215- Display SVG Files in Backend
216- ======================================= */
214+ /* ========================================
215+ Display SVG Files in Backend
216+ ======================================= */
217217
218218
219- // Add JavaScipt to Backend
219+ // Add JavaScipt to Backend
220220
221221
222222 function esw_add_javascript_for_backend () {
@@ -227,7 +227,7 @@ function esw_add_javascript_for_backend() {
227227 add_action ( 'admin_enqueue_scripts ' , 'esw_add_javascript_for_backend ' );
228228
229229
230- // Echo
230+ // Echo
231231
232232
233233 add_action ('wp_AJAX_svg_get_attachment_url ' , 'esw_display_svg_files_backend ' );
@@ -239,12 +239,12 @@ function esw_display_svg_files_backend(){
239239 $ url = '' ;
240240
241241 $ attachmentID = isset ($ _REQUEST ['attachmentID ' ]) ? $ _REQUEST ['attachmentID ' ] : '' ;
242-
242+
243243 if ($ attachmentID ){
244244 $ url = wp_get_attachment_url ($ attachmentID );
245245 }
246246
247247 echo $ url ;
248248
249249 die ();
250- }
250+ }
0 commit comments