PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.3
Booktics – Appointment Booking Calendar for Service Businesses v1.0.3
1.0.29 1.0.28 1.0.27 1.0.26 1.0.25 1.0.24 1.0.23 1.0.22 1.0.21 1.0.20 1.0.19 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.2 1.0.3 All 31 releases
booktics / trunk / core / extensions / extension-icon.php

extension-icon.php in Booktics – Appointment Booking Calendar for Service Businesses 1.0.3, at trunk/core/extensions/extension-icon.php

38 lines 935 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Booktics\Extensions;
4
5 use Booktics\Booktics;
6
7 class Extension_Icon {
8 /**
9 * Get icon
10 *
11 * @param string $extension_name
12 *
13 * @return string
14 */
15 public static function get( string $extension_name ): string {
16 return self::get_svg( $extension_name );
17 }
18
19 /**
20 * Get svg icon
21 *
22 * @param string $file_name
23 */
24 public static function get_svg( string $file_name ) {
25 $extensions = array( 'svg', 'jpg', 'png', 'webp' );
26 $base_url = Booktics::assets_url() . 'images/addons/';
27 $base_path = BOOKTICS_DIR . '/assets/images/addons/';
28
29 foreach ( $extensions as $ext ) {
30 $file = $base_path . $file_name . '.' . $ext;
31 if ( file_exists( $file ) ) {
32 return $ext === 'svg' ? file_get_contents( $file ) : $base_url . $file_name . '.' . $ext;
33 }
34 }
35 return '';
36 }
37 }
38