| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package |
| 4 |
* @category Core |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://wpbookingcalendar.com/ |
| 8 |
* @email info@wpbookingcalendar.com |
| 9 |
* |
| 10 |
* @modified 2013.10.16 |
| 11 |
*/ |
| 12 |
|
| 13 |
class WPBC_CSS extends WPBC_JS_CSS{ |
| 14 |
|
| 15 |
public function define() { |
| 16 |
|
| 17 |
$this->setType('css'); |
| 18 |
|
| 19 |
/* |
| 20 |
// Exmaples of usage Font Avesome: http://fontawesome.io/icons/ |
| 21 |
|
| 22 |
$this->add( array( |
| 23 |
'handle' => 'font-awesome', |
| 24 |
'src' => WPBC_PLUGIN_URL . 'assets/libs/font-awesome-4.3.0/css/font-awesome.css' , |
| 25 |
'deps' => false, |
| 26 |
'version' => '4.3.0', |
| 27 |
'where_to_load' => array( 'admin' ), |
| 28 |
'condition' => false |
| 29 |
) ); |
| 30 |
|
| 31 |
// Exmaples of usage Font Avesome 3.2.1 (benefits of this version - support IE7): http://fontawesome.io/3.2.1/examples/ |
| 32 |
$this->add( array( |
| 33 |
'handle' => 'font-awesome', |
| 34 |
'src' => WPBC_PLUGIN_URL . '/assets/libs/font-awesome/css/font-awesome.css' , |
| 35 |
'deps' => false, |
| 36 |
'version' => '3.2.1', |
| 37 |
'where_to_load' => array( 'admin' ), |
| 38 |
'condition' => false |
| 39 |
) ); |
| 40 |
$this->add( array( |
| 41 |
'handle' => 'font-awesome-ie7', |
| 42 |
'src' => WPBC_PLUGIN_URL . '/assets/libs/font-awesome/css/font-awesome-ie7.css' , |
| 43 |
'deps' => array('font-awesome'), |
| 44 |
'version' => '3.2.1', |
| 45 |
'where_to_load' => array( 'admin' ), |
| 46 |
'condition' => 'IE 7' // CSS condition. Exmaple: <!--[if IE 7]> |
| 47 |
) ); |
| 48 |
*/ |
| 49 |
|
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
public function enqueue( $where_to_load ) { |
| 54 |
//FixIn: 9.8.1 |
| 55 |
wp_enqueue_style( 'wpdevelop-bts', wpbc_plugin_url( '/assets/libs/bootstrap-css/css/bootstrap.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.0.1.1.1 |
| 56 |
wp_enqueue_style( 'wpdevelop-bts-theme', wpbc_plugin_url( '/assets/libs/bootstrap-css/css/bootstrap-theme.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.0.1.1.1 |
| 57 |
wp_enqueue_style( 'wpbc-tippy-popover', wpbc_plugin_url( '/assets/libs/tippy.js/themes/wpbc-tippy-popover.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.0.1.1 |
| 58 |
wp_enqueue_style( 'wpbc-tippy-times', wpbc_plugin_url( '/assets/libs/tippy.js/themes/wpbc-tippy-times.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.0.1.1 |
| 59 |
wp_enqueue_style( 'wpbc-material-design-icons', wpbc_plugin_url( '/assets/libs/material-design-icons/material-design-icons.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.2.1.4 //FixIn: 9.0.1.1 |
| 60 |
wp_enqueue_style( 'wpbc-ui-both', wpbc_plugin_url( '/css/wpbc_ui_both.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 10.0.0.25 |
| 61 |
|
| 62 |
if ( $where_to_load == 'admin' ) { // Admin CSS files |
| 63 |
//Icons |
| 64 |
wp_enqueue_style( 'wpbc-bootstrap-icons', wpbc_plugin_url( '/assets/libs/bootstrap-icons/bootstrap-icons.css' ), array(), WP_BK_VERSION_NUM ); //FixIn: 9.0.1.1 |
| 65 |
|
| 66 |
wp_enqueue_style( 'wpbc-chosen', wpbc_plugin_url( '/assets/libs/chosen/chosen.css' ), array(), WP_BK_VERSION_NUM); |
| 67 |
wp_enqueue_style( 'wpbc-admin-support', wpbc_plugin_url( '/core/any/css/admin-support.css' ), array(), WP_BK_VERSION_NUM); |
| 68 |
wp_enqueue_style( 'wpbc-admin-menu', wpbc_plugin_url( '/core/any/css/admin-menu.css' ), array(), WP_BK_VERSION_NUM); |
| 69 |
wp_enqueue_style( 'wpbc-admin-toolbar', wpbc_plugin_url( '/core/any/css/admin-toolbar.css' ), array(), WP_BK_VERSION_NUM); |
| 70 |
wp_enqueue_style( 'wpbc-settings-page', wpbc_plugin_url( '/core/any/css/settings-page.css' ), array(), WP_BK_VERSION_NUM); |
| 71 |
wp_enqueue_style( 'wpbc-admin-listing-table', wpbc_plugin_url( '/core/any/css/admin-listing-table.css' ), array(), WP_BK_VERSION_NUM); |
| 72 |
wp_enqueue_style( 'wpbc-br-table', wpbc_plugin_url( '/core/any/css/admin-br-table.css' ), array(), WP_BK_VERSION_NUM); |
| 73 |
wp_enqueue_style( 'wpbc-flex-table', wpbc_plugin_url( '/core/any/css/wpbc_flextable.css' ), array(), WP_BK_VERSION_NUM); // Flex: Booking resources Table //FixIn: 9.9.0.7 |
| 74 |
wp_enqueue_style( 'wpbc-admin-modal-popups', wpbc_plugin_url( '/css/modal.css' ), array(), WP_BK_VERSION_NUM); |
| 75 |
wp_enqueue_style( 'wpbc-admin-pages', wpbc_plugin_url( '/css/admin.css' ), array(), WP_BK_VERSION_NUM); |
| 76 |
wp_enqueue_style( 'wpbc-admin-skin', wpbc_plugin_url( '/css/admin-skin.css' ), array( 'wpbc-admin-pages' ), WP_BK_VERSION_NUM); //FixIn: 8.0.2.4 |
| 77 |
//FixIn: 9.6.3.5 |
| 78 |
//if ( 'legacy' != get_bk_option( 'booking_admin_panel_skin' ) ) { //FixIn: 9.5.5.7 |
| 79 |
wp_enqueue_style( 'wpbc-admin-skin-modern_1', wpbc_plugin_url( '/css/admin-skin-modern_1.css' ), array( 'wpbc-admin-skin' ), WP_BK_VERSION_NUM ); //FixIn: 9.5.5.1 |
| 80 |
//} |
| 81 |
|
| 82 |
global $wp_version; |
| 83 |
|
| 84 |
if ( ( version_compare( $wp_version, '5.3', '>=' ) ) |
| 85 |
|| ( version_compare( $wp_version, '5.3-RC2-46574', '>=' ) ) |
| 86 |
){ |
| 87 |
/* The SVG is arrow-down-alt2 from Dashicons. */ |
| 88 |
$css = " |
| 89 |
.wp-core-ui .wpdevelop .control-group .btn-toolbar .input-group > select, |
| 90 |
.wp-core-ui .wpdevelop select.form-control { |
| 91 |
background: #fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20width%3D%2220%22%20height%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M5%206l5%205%205-5%202%201-7%207-7-7%202-1z%22%20fill%3D%22%23555%22%2F%3E%3C%2Fsvg%3E') no-repeat right 5px top 55%; |
| 92 |
padding: 2px 30px 2px 10px; |
| 93 |
} |
| 94 |
"; |
| 95 |
wp_add_inline_style( 'wpbc-admin-pages', $css ); |
| 96 |
} |
| 97 |
|
| 98 |
$wpbc_inline_css = ''; |
| 99 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 100 |
// Mark 2 last items in menu with line |
| 101 |
// $wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(3) a { border-top: 1px dashed #707070;margin-top: 6px; } "; |
| 102 |
// $wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { border-top: 1px solid #535454; padding-top: 10px; margin-top: 6px; font-weight: 600; font-size: 1em; } "; |
| 103 |
// Mark last item in menu 'Get Pro' with green color |
| 104 |
|
| 105 |
//FixIn: 10.1.3.1 |
| 106 |
//$wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(-n+1) a { color: #adc636; } "; |
| 107 |
if ( 'hide' !== get_bk_option( 'booking_menu_go_pro' ) ) { |
| 108 |
// Get Pro as a button |
| 109 |
//$wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { font-weight: 600;background-color: #0b9300;color: #fff;margin: 10px 10px 0;display: block;text-align: center;border-radius: 3px;transition: all .3s;box-shadow: none; } "; |
| 110 |
$wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { font-weight: 600;background-color: #075c00;color: #fff;margin: 10px 10px 0;display: block;text-align: center;border-radius: 3px;transition: all .3s;box-shadow: none; } "; |
| 111 |
$wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) { margin-top: 10px;border-top: 1px solid #535454; } "; |
| 112 |
} |
| 113 |
} else { |
| 114 |
// Mark 2 last items in menu with line |
| 115 |
// $wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(2) a { border-top: 1px solid #535454;padding-top: 10px;margin-top: 6px; } "; |
| 116 |
//FixIn: 10.1.3.1 |
| 117 |
$wpbc_inline_css .= " #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { border-top: 1px solid #535454;padding-top: 10px;margin-top: 6px; } "; |
| 118 |
} |
| 119 |
|
| 120 |
wp_add_inline_style( 'wpbc-admin-pages', $wpbc_inline_css ); |
| 121 |
|
| 122 |
} |
| 123 |
|
| 124 |
if ( |
| 125 |
( $where_to_load != 'admin' ) |
| 126 |
|| ( wpbc_is_new_booking_page() ) |
| 127 |
|| ( wpbc_is_settings_form_page() ) |
| 128 |
// || ( wpbc_is_availability_page() ) //FixIn: 10.0.0.5 Error at -> WP Booking Calendar > Availability > Season Availability page |
| 129 |
|| ( ( wpbc_is_settings_page() ) && ( strpos( $_SERVER['REQUEST_URI'], 'tab=payment' ) !== false ) ) |
| 130 |
){ // Client or Add New Booking page |
| 131 |
|
| 132 |
if ( 'On' === get_bk_option( 'booking_timeslot_picker' ) ) { //FixIn: 8.7.11.10 |
| 133 |
wp_enqueue_style( 'wpbc-time_picker', wpbc_plugin_url( '/css/wpbc_time-selector.css' ), array(), WP_BK_VERSION_NUM ); |
| 134 |
|
| 135 |
$time_picker_skin_path = wpbc_get_time_picker_skin_url(); |
| 136 |
if ( ! empty( $time_picker_skin_path ) ) { |
| 137 |
wp_enqueue_style('wpbc-time_picker-skin', $time_picker_skin_path , array('wpbc-time_picker'), WP_BK_VERSION_NUM); |
| 138 |
} |
| 139 |
} |
| 140 |
wp_enqueue_style( 'wpbc-client-pages', wpbc_plugin_url( '/css/client.css' ), array(), WP_BK_VERSION_NUM ); |
| 141 |
} |
| 142 |
|
| 143 |
wp_enqueue_style('wpbc-calendar', wpbc_plugin_url( '/css/calendar.css' ), array(), WP_BK_VERSION_NUM); |
| 144 |
// Calendar Skins |
| 145 |
$calendar_skin_path = wpbc_get_calendar_skin_url(); |
| 146 |
if ( ! empty( $calendar_skin_path ) ) |
| 147 |
wp_enqueue_style('wpbc-calendar-skin', $calendar_skin_path , array(), WP_BK_VERSION_NUM); |
| 148 |
|
| 149 |
do_action( 'wpbc_enqueue_css_files', $where_to_load ); |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
public function remove_conflicts( $where_to_load ) { |
| 154 |
|
| 155 |
//FixIn: 8.1.3.12 |
| 156 |
if ( |
| 157 |
wpbc_is_bookings_page() |
| 158 |
|| wpbc_is_new_booking_page() |
| 159 |
|| wpbc_is_settings_form_page() |
| 160 |
|| wpbc_is_resources_page() |
| 161 |
|| wpbc_is_settings_page() |
| 162 |
) { |
| 163 |
if (function_exists('wp_dequeue_style')) { |
| 164 |
/* |
| 165 |
wp_dequeue_style( 'cs-alert' ); |
| 166 |
wp_dequeue_style( 'cs-framework' ); |
| 167 |
wp_dequeue_style( 'cs-font-awesome' ); |
| 168 |
wp_dequeue_style( 'icomoon' ); |
| 169 |
*/ |
| 170 |
wp_dequeue_style( 'chosen'); |
| 171 |
wp_dequeue_style( 'toolset-font-awesome-css' ); // Remove this script sitepress-multilingual-cms/res/css/font-awesome.min.css?ver=3.1.6, which is load by the "sitepress-multilingual-cms" |
| 172 |
wp_dequeue_style( 'toolset-font-awesome' ); //FixIn: 5.4.5.8 |
| 173 |
wp_dequeue_style( 'the7-fontello-css' ); |
| 174 |
wp_dequeue_style( 'dt-awsome-fonts-back-css' ); //FixIn: 8.2.1.10 fix conflict with https://the7.io/ |
| 175 |
wp_dequeue_style( 'dt-awsome-fonts-css' ); |
| 176 |
wp_dequeue_style( 'dt-fontello-css' ); |
| 177 |
wp_dequeue_style( 'cs_icons_data_css_default'); //FixIn: 8.1.3.12 |
| 178 |
wp_dequeue_style( 'icons-style' ); //FixIn: 8.2.1.22 |
| 179 |
wp_dequeue_style( 'fontawesome-style' ); //FixIn: 8.2.1.22 |
| 180 |
wp_dequeue_style( 'bootstrap-style' ); //FixIn: 8.2.1.22 |
| 181 |
wp_dequeue_style( 'bootstrap-theme-style' ); //FixIn: 8.2.1.22 |
| 182 |
|
| 183 |
} |
| 184 |
} |
| 185 |
} |
| 186 |
} |
| 187 |
|
| 188 |
|
| 189 |
/** |
| 190 |
* Get URL to Calendar Skin ( CSS file ) |
| 191 |
* |
| 192 |
* @return string - URL to calendar skin |
| 193 |
*/ |
| 194 |
function wpbc_get_calendar_skin_url() { |
| 195 |
|
| 196 |
// Calendar Skin /////////////////////////////////////////////////////// |
| 197 |
$calendar_skin_path = false; |
| 198 |
|
| 199 |
//FixIn: 8.7.11.11 |
| 200 |
$check_skin_path = get_bk_option( 'booking_skin' ); |
| 201 |
if ( false !== strpos( $check_skin_path, 'inc/skins/' ) ) { |
| 202 |
$check_skin_path = str_replace( 'inc/skins/', 'css/skins/', $check_skin_path ); |
| 203 |
update_bk_option( 'booking_skin', $check_skin_path ); |
| 204 |
} |
| 205 |
//FixIn: 8.9.4.8 |
| 206 |
if ( false !== strpos( $check_skin_path, WPBC_PLUGIN_DIR ) ) { |
| 207 |
$check_skin_path = str_replace( WPBC_PLUGIN_DIR, '', $check_skin_path ); |
| 208 |
update_bk_option( 'booking_skin', $check_skin_path ); |
| 209 |
} |
| 210 |
|
| 211 |
// Check if this skin exist in the plugin folder ////////////////////// |
| 212 |
if ( file_exists( WPBC_PLUGIN_DIR . str_replace( WPBC_PLUGIN_URL, '', get_bk_option( 'booking_skin') ) ) ) { |
| 213 |
$calendar_skin_path = WPBC_PLUGIN_URL . str_replace( WPBC_PLUGIN_URL, '', get_bk_option( 'booking_skin') ); |
| 214 |
} |
| 215 |
|
| 216 |
// Check if this skin exist int he Custom User folder at the http://example.com/wp-content/uploads/wpbc_skins/ |
| 217 |
$upload_dir = wp_upload_dir(); |
| 218 |
$custom_user_skin_folder = $upload_dir['basedir'] ; |
| 219 |
$custom_user_skin_url = $upload_dir['baseurl'] ; |
| 220 |
//$custom_user_skin_url = str_replace( 'http:', 'https:', $custom_user_skin_url ); |
| 221 |
|
| 222 |
if ( file_exists( $custom_user_skin_folder . str_replace( array( WPBC_PLUGIN_URL , $custom_user_skin_url ), '', get_bk_option( 'booking_skin') ) ) ) { |
| 223 |
$calendar_skin_path = $custom_user_skin_url . str_replace( array(WPBC_PLUGIN_URL, $custom_user_skin_url ), '', get_bk_option( 'booking_skin') ); |
| 224 |
} |
| 225 |
//debuge( wpbc_dir_list( array( WPBC_PLUGIN_DIR . '/css/skins/', $upload_dir['basedir'].'/wpbc_skins/' ) ) ); |
| 226 |
// debuge( |
| 227 |
// get_bk_option( 'booking_skin') |
| 228 |
// , WPBC_PLUGIN_DIR |
| 229 |
// , WPBC_PLUGIN_URL |
| 230 |
// , $upload_dir |
| 231 |
// ); |
| 232 |
return $calendar_skin_path; |
| 233 |
} |
| 234 |
|
| 235 |
//FixIn: 8.7.11.10 |
| 236 |
function wpbc_get_time_picker_skin_url(){ |
| 237 |
|
| 238 |
// time_picker Skin /////////////////////////////////////////////////////// |
| 239 |
$time_picker_skin_path = false; |
| 240 |
|
| 241 |
// Just default value, if previously was not saved any options. |
| 242 |
if ( empty( get_bk_option( 'booking_timeslot_picker_skin' ) ) ) { |
| 243 |
update_bk_option( 'booking_timeslot_picker_skin', '/css/time_picker_skins/grey.css' ); |
| 244 |
} |
| 245 |
|
| 246 |
// Check if this skin exist in the plugin folder ////////////////////// |
| 247 |
if ( file_exists( WPBC_PLUGIN_DIR . str_replace( WPBC_PLUGIN_URL, '', get_bk_option( 'booking_timeslot_picker_skin') ) ) ) { |
| 248 |
$time_picker_skin_path = WPBC_PLUGIN_URL . str_replace( WPBC_PLUGIN_URL, '', get_bk_option( 'booking_timeslot_picker_skin') ); |
| 249 |
} |
| 250 |
|
| 251 |
// Check if this skin exist int he Custom User folder at the http://example.com/wp-content/uploads/wpbc_skins/ |
| 252 |
$upload_dir = wp_upload_dir(); |
| 253 |
$custom_user_skin_folder = $upload_dir['basedir'] ; |
| 254 |
$custom_user_skin_url = $upload_dir['baseurl'] ; |
| 255 |
if ( file_exists( $custom_user_skin_folder . str_replace( array( WPBC_PLUGIN_URL , $custom_user_skin_url ), '', get_bk_option( 'booking_timeslot_picker_skin') ) ) ) { |
| 256 |
$time_picker_skin_path = $custom_user_skin_url . str_replace( array(WPBC_PLUGIN_URL, $custom_user_skin_url ), '', get_bk_option( 'booking_timeslot_picker_skin') ); |
| 257 |
} |
| 258 |
|
| 259 |
return $time_picker_skin_path; |
| 260 |
} |