𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /home/builxejc/public_html/wp-content/plugins/kinsley-plugin/elementor//functions.php
<?php
/**
* Kinsley Elementor Layout Builder
*
* @package Kinsley
* @since 1.0
*/
// We check if the Elementor plugin has been installed / activated.
if( !in_array( 'elementor/elementor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return;
class Kinsley_Elementor_Widget {
private static $instance = null;
/**
* @since 1.0
*/
public static function get_instance() {
if ( ! self::$instance )
self::$instance = new self;
return self::$instance;
}
/**
* @since 1.0
*/
public function init(){
add_action( 'elementor/widgets/register', array( $this, 'kinsley_elementor_register_widgets' ) );
add_action('elementor/frontend/after_register_styles', array($this, 'kinsley_elementor_frontend_styles'), 10);
add_action('elementor/frontend/after_register_scripts', array($this, 'kinsley_elementor_frontend_scripts'), 10);
add_action( 'elementor/elements/categories_registered', array( $this, 'kinsley_elementor_widgets_category' ) );
if ( class_exists( 'HotelBookingPlugin' ) ) {
add_action('elementor/init', array($this, 'addAvailableRoomsData'));
}
}
/**
* @since 1.0
*/
public function kinsley_elementor_register_widgets() {
//Require all PHP files in the /elementor/widgets directory
foreach( glob( plugin_dir_path( __FILE__ ) . "widgets/*.php" ) as $file ) {
require $file;
}
if ( class_exists( 'HotelBookingPlugin' ) ) {
require plugin_dir_path( __FILE__ ) . 'widgets/mphb/abstract/abstract-widget.php';
require plugin_dir_path( __FILE__ ) . 'widgets/mphb/abstract/abstract-calendar-widget.php';
foreach( glob( plugin_dir_path( __FILE__ ) . "widgets/mphb/*.php" ) as $file ) {
require $file;
}
}
}
/**
* @since 1.0
*/
public function kinsley_elementor_frontend_scripts() {
wp_enqueue_script( 'kinsley-plugin-frontend-widget-scripts', plugin_dir_url( __FILE__ ) . 'assets/js/front-end-widget.js', array('jquery'), false, true);
}
/**
* @since 1.0
*/
public function kinsley_elementor_frontend_styles() {
wp_enqueue_style( 'kinsley-plugin-frontend-widget-style', plugin_dir_url( __FILE__ ) . 'assets/css/style.css', null, 1.0 );
}
/**
* @since 1.0
*/
public function kinsley_elementor_widgets_category( $elements_manager ) {
$elements_manager->add_category(
'kinsley-category',
[
'title' => esc_html__( 'Kinsley Theme', 'kinsley-plugin' ),
'icon' => 'fa fa-plug',
]
);
}
public function addAvailableRoomsData()
{
$readableStatuses = array('publish');
if (current_user_can('read_private_posts')) {
$readableStatuses[] = 'private';
}
$roomTypes = MPHB()->getRoomTypePersistence()->getPosts(array(
'post_status' => $readableStatuses
));
array_walk($roomTypes, array(MPHB()->getPublicScriptManager(), 'addRoomTypeData'));
}
}
Kinsley_Elementor_Widget::get_instance()->init();
function kinsley_get_topmenu( $menu_name = '' ) {
$output = '';
if ( has_nav_menu( 'primary' ) ) :
$output = wp_nav_menu( array(
'theme_location' => 'primary',
'menu' => $menu_name,
'container' => 'nav',
'container_class' => 'top-menu-nav',
'menu_class' => 'top-menu-nav-inner',
'walker' => new Kinsley_Topmenu_Walker(),
) );
endif;
return $output;
}
function kinsley_get_footermenu( $menu_name = '' ) {
$output = '';
//if ( has_nav_menu( 'primary' ) ) :
$output = wp_nav_menu( array(
//'theme_location' => 'primary',
'menu' => $menu_name,
'container' => '',
'menu_class' => 'knsl-footer-menu',
'walker' => new Kinsley_Topmenu_Walker(),
) );
//endif;
return $output;
}
function kinsley_mphb_room_getPrice() {
if ( class_exists( 'HotelBookingPlugin' ) && !( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) ) {
return \MPHB\Views\SingleRoomTypeView::renderPrice();
} else {
return;
}
}
function kinsley_mphb_room_getAttributes() {
if ( class_exists( 'HotelBookingPlugin' ) && !( is_admin() || (defined( 'REST_REQUEST' ) && REST_REQUEST) ) ) {
return \MPHB\Views\SingleRoomTypeView::renderAttributes();
} else {
return;
}
}