PluginProbe
Booktics – Appointment Booking Calendar for Service Businesses / 1.0.22
Booktics – Appointment Booking Calendar for Service Businesses v1.0.22
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 / core / extensions / extension-icon.php

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

42 lines 980 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 if ( ! defined( 'ABSPATH' ) ) {
6 exit;
7 }
8
9 use Booktics\Booktics;
10
11 class Extension_Icon {
12 /**
13 * Get icon
14 *
15 * @param string $extension_name
16 *
17 * @return string
18 */
19 public static function get( string $extension_name ): string {
20 return self::get_svg( $extension_name );
21 }
22
23 /**
24 * Get svg icon
25 *
26 * @param string $file_name
27 */
28 public static function get_svg( string $file_name ) {
29 $extensions = array( 'svg', 'jpg', 'png', 'webp' );
30 $base_url = Booktics::assets_url() . 'images/addons/';
31 $base_path = BOOKTICS_DIR . '/assets/images/addons/';
32
33 foreach ( $extensions as $ext ) {
34 $file = $base_path . $file_name . '.' . $ext;
35 if ( file_exists( $file ) ) {
36 return $ext === 'svg' ? file_get_contents( $file ) : $base_url . $file_name . '.' . $ext;
37 }
38 }
39 return '';
40 }
41 }
42