/*
* splite_notice_dismissable
* Ajax action to do tasks on notice dismissable
* Require class: splite-dismissable
*/
add_action( 'wp_ajax_splite_notice_dismissable', 'splite_notice_dismissable' );
function splite_notice_dismissable() {
if(!isset($_POST['security']) || !isset($_POST['dataBtn'])) {
wp_send_json_error('Security check failed, please refresh and try again');
wp_die();
}
// Sanitize string for added security
$data_btn = isset($_POST['dataBtn']) ? sanitize_text_field($_POST['dataBtn']) : '';
$nonce = ($data_btn=='ask-later') ? 'splite_ask_later' : 'splite_ask_never';
if(!wp_verify_nonce($_POST['security'], $nonce) || !current_user_can('manage_options')) {
wp_send_json_error('Security check failed, please refresh and try again');
wp_die();
}
$today = DateTime::createFromFormat('U', current_time('U'));
switch($data_btn) {
case 'ask-later':
$ask_later = get_option('splite_review_notice') ? get_option('splite_review_notice') : 0;
update_option('splite_review_notice', ++$ask_later);
break;
case 'ask-never':
update_option('splite_review_notice', 0);
break;
}
wp_send_json_success();
wp_die();
}
/**
* Show a notice to anyone who has to give a review after using the plugin for 14 days
* This notice shouldn't display to who has to given a review already
**/
function splite_admin_notices() {
$install_date = get_option('splite_install_date', 0);
$install_date_object = DateTime::createFromFormat('Y-m-d H:i:s', $install_date);
// review_notice - numeric counter for multiplying 14 days
$review_notice = get_option('splite_review_notice', 1);
if($review_notice == 0) {
return;
}
if(! $install_date OR ! is_a($install_date_object, 'DATETIME')) {
update_option('splite_install_date', current_time('Y-m-d H:i:s'));
return;
}
$today = DateTime::createFromFormat('U', current_time('U'));
$diff = $today->diff($install_date_object);
//print_r($diff);
if($diff->d >= 14*$review_notice) {
echo '
Hope you are enjoying - Slick Popup Lite '.get_option('splite_review_notice').'
'.esc_html__( 'Thanks for using one of the best WordPress Popup Plugin for Contact Form 7. We hope that it has been useful for you and would like you to leave review on WordPres.org website, it will help us improve the product features.', 'slick-popup' ).'
';
}
}
add_action( 'admin_notices', 'splite_admin_notices' );
/**
* Show a notice to anyone who has just updated this plugin
* This notice shouldn't display to anyone who has just installed the plugin for the first time
**/
function splite_display_update_notice() {
// Check the transient to see if we've just updated the plugin
if(get_transient( 'splite_updated' ) ) {
echo '
';
// Save splite_install_date for already existing users (before: 1.5.3)
if(!get_option('splite_install_date'))
update_option('splite_install_date', current_time('Y-m-d H:i:s'));
delete_transient( 'splite_updated' );
}
}
add_action( 'admin_notices', 'splite_display_update_notice' );
/**
* Show a notice to anyone who has just installed the plugin for the first time
* This notice shouldn't display to anyone who has just updated this plugin
**/
function splite_display_install_notice() {
// Check the transient to see if we've just activated the plugin
if(get_transient( 'splite_activated' ) ) {
echo '
';
// Delete the transient so we don't keep displaying the activation message
delete_transient( 'splite_activated' );
}
}
add_action( 'admin_notices', 'splite_display_install_notice' );
/**
* Show a notice for the user who has kept the temporary grant access on for more than 14 days
* This notice shouldn't display to anyone who has removed the temporary access
**/
function splite_grant_access_alert() {
if(!username_exists('slickpopupteam') OR !email_exists('poke@slickpopup.com')) {
return;
}
$access_granted = get_option('splite_grant_access_time') ? get_option('splite_grant_access_time') : current_time('Y-m-d H:i:s');
$access_granted_object = DateTime::createFromFormat('Y-m-d H:i:s', $access_granted);
$today = DateTime::createFromFormat('U', current_time('U'));
$diff = $today->diff($access_granted_object);
if($diff->days >=14) {
echo '
';
echo '
';
echo '
';
echo '';
echo '
';
echo '
';
echo '
'.esc_html__('Support Team Access','slick-popup').' - Slick Popup
';
echo '
'.esc_html__('Dear User, it has been ','slick-popup').''.esc_html__('more than 14 days','slick-popup').''.esc_html__(' since you have granted access to the Support Team. We advice you to click on the revoke access button.', 'slick-popup' );
echo '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Top Column 2', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the second column of top footer area', 'mediclinic'),
'id' => 'footer_top_column_2',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Top Column 3', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the third column of top footer area', 'mediclinic'),
'id' => 'footer_top_column_3',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Top Column 4', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the fourth column of top footer area', 'mediclinic'),
'id' => 'footer_top_column_4',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Bottom Column 1', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the first column of bottom footer area', 'mediclinic'),
'id' => 'footer_bottom_column_1',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Bottom Column 2', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the second column of bottom footer area', 'mediclinic'),
'id' => 'footer_bottom_column_2',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
register_sidebar(array(
'name' => esc_html__('Footer Bottom Column 3', 'mediclinic'),
'description' => esc_html__('Widgets added here will appear in the third column of bottom footer area', 'mediclinic'),
'id' => 'footer_bottom_column_3',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
'
));
}
add_action('widgets_init', 'mediclinic_mikado_register_footer_sidebar');
}
if (!function_exists('mediclinic_mikado_get_footer')) {
/**
* Loads footer HTML
*/
function mediclinic_mikado_get_footer() {
$parameters = array();
$page_id = mediclinic_mikado_get_page_id();
$disable_footer_meta = get_post_meta($page_id, 'mkdf_disable_footer_meta', true);
$parameters['display_footer'] = $disable_footer_meta === 'yes' ? false : true;
$parameters['display_footer_top'] = mediclinic_mikado_show_footer_top();
$parameters['display_footer_bottom'] = mediclinic_mikado_show_footer_bottom();
mediclinic_mikado_get_module_template_part('templates/footer', 'footer', '', $parameters);
}
add_action('mediclinic_mikado_get_footer_template', 'mediclinic_mikado_get_footer');
}
if(!function_exists('mediclinic_mikado_show_footer_top')){
/**
* Check footer top showing
* Function check value from options and checks if footer columns are empty.
* return bool
*/
function mediclinic_mikado_show_footer_top(){
$footer_top_flag = false;
//check value from options and meta field on current page
$option_flag = (mediclinic_mikado_get_meta_field_intersect('show_footer_top') === 'yes') ? true : false;
//check footer columns.If they are empty, disable footer top
$columns_flag = false;
for($i = 1; $i <= 4; $i++){
$footer_columns_id = 'footer_top_column_'.$i;
if(is_active_sidebar($footer_columns_id)) {
$columns_flag = true;
break;
}
}
if($option_flag && $columns_flag){
$footer_top_flag = true;
}
return $footer_top_flag;
}
}
if(!function_exists('mediclinic_mikado_show_footer_bottom')){
/**
* Check footer bottom showing
* Function check value from options and checks if footer columns are empty.
* return bool
*/
function mediclinic_mikado_show_footer_bottom(){
$footer_bottom_flag = false;
//check value from options and meta field on current page
$option_flag = (mediclinic_mikado_get_meta_field_intersect('show_footer_bottom') === 'yes') ? true : false;
//check footer columns.If they are empty, disable footer bottom
$columns_flag = false;
for($i = 1; $i <= 3; $i++){
$footer_columns_id = 'footer_bottom_column_'.$i;
if(is_active_sidebar($footer_columns_id)) {
$columns_flag = true;
break;
}
}
if($option_flag && $columns_flag){
$footer_bottom_flag = true;
}
return $footer_bottom_flag;
}
}
if (!function_exists('mediclinic_mikado_get_content_bottom_area')) {
/**
* Loads content bottom area HTML with all needed parameters
*/
function mediclinic_mikado_get_content_bottom_area() {
$parameters = array();
//Current page id
$id = mediclinic_mikado_get_page_id();
//is content bottom area enabled for current page?
$parameters['content_bottom_area'] = mediclinic_mikado_get_meta_field_intersect('enable_content_bottom_area', $id);
if ($parameters['content_bottom_area'] === 'yes') {
//Sidebar for content bottom area
$parameters['content_bottom_area_sidebar'] = mediclinic_mikado_get_meta_field_intersect('content_bottom_sidebar_custom_display', $id);
//Content bottom area in grid
$parameters['grid_class'] = (mediclinic_mikado_get_meta_field_intersect('content_bottom_in_grid', $id)) === 'yes' ? 'mkdf-grid' : 'mkdf-full-width';
$parameters['content_bottom_style'] = array();
//Content bottom area background color
$background_color = mediclinic_mikado_get_meta_field_intersect('content_bottom_background_color', $id);
if ($background_color !== '') {
$parameters['content_bottom_style'][] = 'background-color: ' . $background_color . ';';
}
if(is_active_sidebar($parameters['content_bottom_area_sidebar'])){
mediclinic_mikado_get_module_template_part('templates/parts/content-bottom-area', 'footer', '', $parameters);
}
}
}
}
if (!function_exists('mediclinic_mikado_get_footer_top')) {
/**
* Return footer top HTML
*/
function mediclinic_mikado_get_footer_top() {
$parameters = array();
//get number of top footer columns
$parameters['footer_top_columns'] = mediclinic_mikado_options()->getOptionValue('footer_top_columns');
//get footer top grid/full width class
$parameters['footer_top_grid_class'] = mediclinic_mikado_options()->getOptionValue('footer_in_grid') === 'yes' ? 'mkdf-grid' : 'mkdf-full-width';
//get footer top other classes
$footer_top_classes = array();
//footer alignment
$footer_top_alignment = mediclinic_mikado_options()->getOptionValue('footer_top_columns_alignment');
$footer_top_classes[] = !empty($footer_top_alignment) ? 'mkdf-footer-top-alignment-'.esc_attr($footer_top_alignment) : '';
$footer_top_classes = apply_filters('mediclinic_mikado_footer_top_classes', $footer_top_classes);
$parameters['footer_top_classes'] = implode(' ', $footer_top_classes);
mediclinic_mikado_get_module_template_part('templates/parts/footer-top', 'footer', '', $parameters);
}
}
if (!function_exists('mediclinic_mikado_get_footer_bottom')) {
/**
* Return footer bottom HTML
*/
function mediclinic_mikado_get_footer_bottom() {
$parameters = array();
//get number of bottom footer columns
$parameters['footer_bottom_columns'] = mediclinic_mikado_options()->getOptionValue('footer_bottom_columns');
//get footer top grid/full width class
$parameters['footer_bottom_grid_class'] = mediclinic_mikado_options()->getOptionValue('footer_in_grid') === 'yes' ? 'mkdf-grid' : 'mkdf-full-width';
//get footer top other classes
$footer_bottom_classes = array();
$footer_bottom_classes = apply_filters('mediclinic_mikado_footer_bottom_classes', $footer_bottom_classes);
$parameters['footer_bottom_classes'] = implode(' ', $footer_bottom_classes);
mediclinic_mikado_get_module_template_part('templates/parts/footer-bottom', 'footer', '', $parameters);
}
}use MediclinicMikado\Modules\Header\Lib;
if(!function_exists('mediclinic_mikado_get_header_type_options')) {
/**
* This function collect all header types values and forward them to header factory file for further processing
*/
function mediclinic_mikado_get_header_type_options() {
do_action('mediclinic_mikado_before_header_function_init');
$header_types_option = apply_filters('mediclinic_mikado_register_header_type_class', $header_types_option = array());
return $header_types_option;
}
}
if(!function_exists('mediclinic_mikado_set_default_logo_height_for_header_types')) {
/**
* This function set default logo area height for header types
*/
function mediclinic_mikado_set_default_logo_height_for_header_types() {
$logo_height_meta = mediclinic_mikado_filter_px( mediclinic_mikado_options()->getOptionValue( 'logo_area_height' ) );
$logo_height = !empty($logo_height_meta) ? intval( $logo_height_meta ) : 90;
return apply_filters('mediclinic_mikado_set_default_logo_height_value_for_header_types', $logo_height);
}
}
if(!function_exists('mediclinic_mikado_set_default_menu_height_for_header_types')) {
/**
* This function set default menu area height for header types
*/
function mediclinic_mikado_set_default_menu_height_for_header_types() {
$menu_height_meta = mediclinic_mikado_filter_px( mediclinic_mikado_options()->getOptionValue( 'menu_area_height' ) );
$menu_height = !empty($menu_height_meta) ? intval( $menu_height_meta ) : 90;
return apply_filters('mediclinic_mikado_set_default_menu_height_value_for_header_types', $menu_height);
}
}
if(!function_exists('mediclinic_mikado_set_default_mobile_menu_height_for_header_types')) {
/**
* This function set default mobile menu area height for header types
*/
function mediclinic_mikado_set_default_mobile_menu_height_for_header_types() {
$mobile_menu_height_meta = mediclinic_mikado_filter_px( mediclinic_mikado_options()->getOptionValue( 'mobile_header_height' ) );
$mobile_menu_height = !empty($mobile_menu_height_meta) ? intval( $mobile_menu_height_meta ) : 70;
return apply_filters('mediclinic_mikado_set_default_mobile_menu_height_value_for_header_types', $mobile_menu_height);
}
}
if(!function_exists('mediclinic_mikado_set_header_object')) {
/**
* This function is used to instance header type object
*/
function mediclinic_mikado_set_header_object() {
$header_type = mediclinic_mikado_get_meta_field_intersect('header_type', mediclinic_mikado_get_page_id());
$header_types_option = mediclinic_mikado_get_header_type_options();
$object = Lib\HeaderFactory::getInstance()->build($header_type, $header_types_option);
if(Lib\HeaderFactory::getInstance()->validHeaderObject()) {
$header_connector = new Lib\HeaderConnector($object);
$header_connector->connect($object->getConnectConfig());
}
}
add_action('wp', 'mediclinic_mikado_set_header_object', 1);
}if(!function_exists('mediclinic_mikado_include_header_types')) {
/**
* Load's all header types by going through all folders that are placed directly in header types folder
*/
function mediclinic_mikado_include_header_types() {
foreach(glob(MIKADO_FRAMEWORK_HEADER_ROOT_DIR.'/types/*/load.php') as $module_load) {
include_once $module_load;
}
}
add_action('init', 'mediclinic_mikado_include_header_types', 0); // 0 is set so we can be able to register widgets for header types because of widget_ini action
}
if(!function_exists('mediclinic_mikado_include_header_types_for_global_options')) {
/**
* Load's all header types before load files by going through all folders that are placed directly in header types folder.
* Functions from this files before-load are used to set all hooks and variables before global options map are init
*/
function mediclinic_mikado_include_header_types_for_global_options() {
foreach(glob(MIKADO_FRAMEWORK_HEADER_ROOT_DIR.'/types/*/before-load.php') as $module_load) {
include_once $module_load;
}
}
add_action('mediclinic_mikado_options_map', 'mediclinic_mikado_include_header_types_for_global_options', 1); // 1 is set to just be before header option map init
}
if(!function_exists('mediclinic_mikado_header_register_main_navigation')) {
/**
* Registers main navigation
*/
function mediclinic_mikado_header_register_main_navigation() {
$headers_menu_array = apply_filters('mediclinic_mikado_register_headers_menu', array('main-navigation' => esc_html__('Main Navigation', 'mediclinic')));
register_nav_menus($headers_menu_array);
}
add_action('init', 'mediclinic_mikado_header_register_main_navigation');
}
if(!function_exists('mediclinic_mikado_header_widget_areas')) {
/**
* Registers widget areas for header types
*/
function mediclinic_mikado_header_widget_areas() {
if( mediclinic_mikado_core_plugin_installed()) {
register_sidebar(
array(
'name' => esc_html__('Header Widget Logo Area', 'mediclinic'),
'id' => 'mkdf-header-widget-logo-area',
'before_widget' => '
',
'after_widget' => '
',
'description' => esc_html__('Widgets added here will appear in the logo area', 'mediclinic')
)
);
register_sidebar(
array(
'name' => esc_html__('Header Widget Menu Area', 'mediclinic'),
'id' => 'mkdf-header-widget-menu-area',
'before_widget' => '
'
));
}
add_action('widgets_init', 'mediclinic_mikado_register_side_area_sidebar');
}
if (!function_exists('mediclinic_mikado_side_menu_body_class')) {
/**
* Function that adds body classes for different side menu styles
*
* @param $classes array original array of body classes
*
* @return array modified array of classes
*/
function mediclinic_mikado_side_menu_body_class($classes) {
if (is_active_widget(false, false, 'mkdf_side_area_opener')) {
$classes[] = 'mkdf-side-menu-slide-from-right';
}
return $classes;
}
add_filter('body_class', 'mediclinic_mikado_side_menu_body_class');
}
if (!function_exists('mediclinic_mikado_get_side_area')) {
/**
* Loads side area HTML
*/
function mediclinic_mikado_get_side_area() {
if (is_active_widget(false, false, 'mkdf_side_area_opener')) {
mediclinic_mikado_get_module_template_part('templates/sidearea', 'sidearea');
}
}
add_action('mediclinic_mikado_after_body_tag', 'mediclinic_mikado_get_side_area', 10);
}if(!function_exists('mediclinic_mikado_title_classes')) {
/**
* Function that adds classes to title div.
* All other functions are tied to it with add_filter function
* @param array $classes array of classes
* @param string $module name of module calling title
*/
function mediclinic_mikado_title_classes($classes = array()) {
$classes = array();
$classes = apply_filters('mediclinic_mikado_title_classes', $classes);
if(is_array($classes) && count($classes)) {
echo implode(' ', $classes);
}
}
}
if(!function_exists('mediclinic_mikado_title_type_class')) {
/**
* Function that adds class on title based on title type option
* @param $classes original array of classes
* @return array changed array of classes
*/
function mediclinic_mikado_title_type_class($classes) {
$title_type = mediclinic_mikado_get_meta_field_intersect('title_area_type', mediclinic_mikado_get_page_id());
if(!empty($title_type)) {
$classes[] = 'mkdf-'.$title_type.'-type';
}
return $classes;
}
add_filter('mediclinic_mikado_title_classes', 'mediclinic_mikado_title_type_class');
}
if(!function_exists('mediclinic_mikado_title_content_alignment_class')) {
/**
* Function that adds class on title based on title content alignmnt option
* Could be left, centered or right
* @param $classes original array of classes
* @return array changed array of classes
*/
function mediclinic_mikado_title_content_alignment_class($classes) {
$title_content_alignment = mediclinic_mikado_get_meta_field_intersect('title_area_content_alignment', mediclinic_mikado_get_page_id());
if(!empty($title_content_alignment)) {
$classes[] = 'mkdf-content-'.$title_content_alignment.'-alignment';
}
return $classes;
}
add_filter('mediclinic_mikado_title_classes', 'mediclinic_mikado_title_content_alignment_class');
}
if(!function_exists('mediclinic_mikado_title_background_image_classes')) {
function mediclinic_mikado_title_background_image_classes($classes) {
//init variables
$id = mediclinic_mikado_get_page_id();
$title_img = apply_filters('mediclinic_mikado_title_image_exists', mediclinic_mikado_get_meta_field_intersect('title_area_background_image', $id));
$is_img_responsive = mediclinic_mikado_get_meta_field_intersect('title_area_background_image_responsive', $id);
$is_image_parallax = mediclinic_mikado_get_meta_field_intersect('title_area_background_image_parallax', $id);
$is_image_parallax_array = array('yes', 'yes_zoom');
$hide_title_img = get_post_meta($id, "mkdf_hide_background_image_meta", true) == 'yes' ? true : false;
// Is title image visible and responsive?
// Removed check for is title image set because of blog single module title (featured image used as title image). Added css for container auto heihgt.
if($title_img != '' && !$hide_title_img) {
//is image not responsive and parallax title is set?
$classes[] = 'mkdf-preload-background';
$classes[] = 'mkdf-has-background';
if($is_img_responsive == 'no' && in_array($is_image_parallax, $is_image_parallax_array)) {
$classes[] = 'mkdf-has-parallax-background';
if($is_image_parallax == 'yes_zoom') {
$classes[] = 'mkdf-zoom-out';
}
}
//is image not responsive
elseif($is_img_responsive == 'yes'){
$classes[] = 'mkdf-has-responsive-background';
}
}
return $classes;
}
add_filter('mediclinic_mikado_title_classes', 'mediclinic_mikado_title_background_image_classes');
}
if(!function_exists('mediclinic_mikado_title_background_image_div_classes')) {
function mediclinic_mikado_title_background_image_div_classes($classes) {
//init variables
$id = mediclinic_mikado_get_page_id();
$title_img = apply_filters('mediclinic_mikado_title_image_exists', mediclinic_mikado_get_meta_field_intersect('title_area_background_image', $id));
$is_img_responsive = mediclinic_mikado_get_meta_field_intersect('title_area_background_image_responsive', $id);
$hide_title_img = get_post_meta($id, "mkdf_hide_background_image_meta", true) == 'yes' ? true : false;
// Is title image visible and responsive?
// Removed check for is title image set because of blog single module title (featured image used as title image). Added css for container auto heihgt.
if($title_img != '' && !$hide_title_img) {
//is image responsive?
if($is_img_responsive == 'yes') {
$classes[] = 'mkdf-title-image-responsive';
}
//is image not responsive?
elseif($is_img_responsive == 'no') {
$classes[] = 'mkdf-title-image-not-responsive';
}
}
return $classes;
}
add_filter('mediclinic_mikado_title_classes', 'mediclinic_mikado_title_background_image_div_classes');
}if ( ! function_exists( 'mediclinic_mikado_register_blog_standard_template_file' ) ) {
/**
* Function that register blog standard template
*/
function mediclinic_mikado_register_blog_standard_template_file( $templates ) {
$templates['blog-standard'] = esc_html__( 'Blog: Standard', 'mediclinic' );
return $templates;
}
add_filter( 'mediclinic_mikado_register_blog_templates', 'mediclinic_mikado_register_blog_standard_template_file' );
}/**
* Appending the wp-block-heading to before rendering the stored `core/heading` block contents.
*
* @package WordPress
*/
/**
* Adds a wp-block-heading class to the heading block content.
*
* For example, the following block content:
*
Hello World
*
* Would be transformed to:
*
Hello World
*
* @since 6.2.0
*
* @param array $attributes Attributes of the block being rendered.
* @param string $content Content of the block being rendered.
*
* @return string The content of the block being rendered.
*/
function gutenberg_block_core_heading_render( $attributes, $content ) {
if ( ! $content ) {
return $content;
}
$p = new WP_HTML_Tag_Processor( $content );
$header_tags = array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' );
while ( $p->next_tag() ) {
if ( in_array( $p->get_tag(), $header_tags, true ) ) {
$p->add_class( 'wp-block-heading' );
break;
}
}
return $p->get_updated_html();
}
/**
* Registers the `core/heading` block on server.
*
* @since 6.2.0
*/
function gutenberg_register_block_core_heading() {
register_block_type_from_metadata(
__DIR__ . '/heading',
array(
'render_callback' => 'gutenberg_block_core_heading_render',
)
);
}
add_action( 'init', 'gutenberg_register_block_core_heading', 20 );