Sindbad~EG File Manager
<?php
/**
* Add action and add filter
* Class Thim_Realpro_Include
*/
class Thim_Realpro_Include {
public function __construct() {
// action back to top
add_action( 'thim_space_body', array( $this, 'thim_back_to_top' ), 10, 0 );
// add preloading for site
add_action( 'thim_before_body', array( $this, 'thim_preloading' ), 10, 0 );
add_action( 'thim_ekit/header_footer/template/before_header', array( $this, 'thim_preloading' ), 5, 0 );
//Register widget area.
add_action( 'widgets_init', array( $this, 'thim_widgets_init' ), 10, 0 );
// after_setup_theme
add_action( 'after_setup_theme', array( $this, 'thim_setup_theme' ), 10, 0 );
// register style and script
add_action( 'wp_enqueue_scripts', array( $this, 'thim_frontend_scripts' ), 100, 0 );
add_action( 'admin_enqueue_scripts', array( $this, 'thim_admin_scripts' ), 10, 0 );
// Display Topbar
add_action( 'thim_topbar', array( $this, 'thim_topbar' ), 10, 0 );
// footer area
add_action( 'thim_footer_area', array( $this, 'thim_footer_layout' ), 10, 0 );
// Generate custom search form
add_filter( 'get_search_form', array( $this, 'thim_custom_search_form' ) );
// Override ajax-loader contact form
add_filter( 'wpcf7_ajax_loader', array( $this, 'thim_wpcf7_ajax_loader' ), 10, 0 );
// remove input website in comment form
add_filter( 'comment_form_default_fields', array( $this, 'thim_modify_comment_form_fields' ) );
add_filter( 'comment_form_fields', array( $this, 'thim_move_comment_field_to_bottom' ) );
//Edit: add custom class to tag
add_filter( 'the_tags', array( $this, 'thim_add_class_the_tags' ) );
//Edit: Widget Categories
add_filter( 'wp_list_categories', array( $this, 'thim_add_span_cat_count' ) );
// Define ajaxurl if not exist
add_action( 'wp_head', array( $this, 'thim_define_ajaxurl' ), 1000, 0 );
// change length excerpt
add_filter( 'excerpt_length', array( $this, 'thim_excerpt_length' ), 99999, 1 );
// add folder download data demo
add_filter( 'thim_prefix_folder_download_data_demo', function () {
return 'realpro';
}, 10, 0 );
// remove prefix of archive title
add_filter( 'get_the_archive_title_prefix', '__return_false', 10, 0 );
add_filter( 'thim_importer_basic_settings', array( $this, 'thim_import_add_basic_settings' ) );
add_filter( 'thim_importer_thim_enable_mega_menu', '__return_true', 10, 0 );
add_filter( 'thim_importer_page_id_settings', array( $this, 'thim_import_add_page_id_settings' ) );
}
public function thim_import_add_basic_settings( $settings ) {
$settings[] = 'realpro_option';
// $settings[] = 'thim_enable_mega_menu';
// $settings[] = 'thim_ekits_widget_settings';
$settings[] = 'elementor_css_print_method';
$settings[] = 'elementor_experiment-e_font_icon_svg';
$settings[] = 'elementor_experiment-container';
$settings[] = 'elementor_experiment-nested-elements';
$settings[] = 'elementor_google_font';
$settings[] = 'elementor_disable_typography_schemes';
// $settings[] = 'thim_ekits_advanced_settings';
return $settings;
}
function thim_import_add_page_id_settings( $settings ) {
$settings[] = 'elementor_active_kit';
return $settings;
}
public function thim_define_ajaxurl() {
?>
<script type="text/javascript">
if (typeof ajaxurl === 'undefined') {
/* <![CDATA[ */
var ajaxurl = "<?php echo esc_js( admin_url( 'admin-ajax.php' ) ); ?>";
/* ]]> */
}
</script>
<?php
}
/**
* Change default comment fields
*
* @param $fields
*
* @return string
*/
public function thim_modify_comment_form_fields( $fields ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? 'aria-required=true' : '' );
$fields = array(
'author' => '<p class="comment-form-author">' . '<input placeholder="' . esc_attr__( 'First & Last name', 'realpro' ) . ( $req ? ' *' : '' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" ' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email">' . '</label>' . '<input placeholder="' . esc_attr__( 'Info@example.com', 'realpro' ) . ( $req ? ' *' : '' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" ' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url">' . '</label>' . '<input placeholder="' . esc_attr__( 'Website', 'realpro' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>',
);
return $fields;
}
/**
* Move field comment bellow input fields
*
* @param $fields
*
*/
function thim_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
public function thim_add_class_the_tags( $html ) {
$html = str_replace( '<a', '<a class="tag-item"', $html );
return $html;
}
public function thim_add_span_cat_count( $links ) {
$links = str_replace( '<span class="count">(', '<span class="count">', $links );
$links = str_replace( ')</span>', '</span>', $links );
$links = str_replace( '(', '<span class="count">', $links );
$links = str_replace( ')', '</span>', $links );
return $links;
}
/**
* Override ajax-loader contact form
*
* $return mixed
*/
public function thim_wpcf7_ajax_loader() {
return THIM_URI . 'images/icons/ajax-loader.gif';
}
public function thim_custom_search_form( $form ) {
$form = '<form method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '" >
<label for="s"><input type="text" placeholder="' . esc_attr__( 'What are you looking for', 'realpro' ) . '" class="search-field" value="' . get_search_query() . '" name="s" id="s" /></label>
<button type="submit" class="search-submit">' . esc_html__( 'Search', 'realpro' ) . '</button>
</form>';
return $form;
}
/**
*
* Display Topbar
*
* @return void
*
*/
public function thim_topbar() {
if ( is_active_sidebar( 'topbar' ) ) {
echo '<ul class="header-topbar">';
dynamic_sidebar( 'topbar' );
echo '</ul>';
}
}
/**
* Turn on and get the back to top
*/
public function thim_back_to_top() {
if ( get_theme_mod( 'feature_backtotop', true ) ) {
get_template_part( 'templates/footer/back-to-top' );
}
}
public function thim_footer_layout() {
$template_name = 'templates/footer/' . get_theme_mod( 'footer_template', 'default' );
get_template_part( $template_name );
}
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
public function thim_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'realpro' ),
'id' => 'sidebar',
'description' => esc_html__( 'Appear on the Sidebar section of the site.', 'realpro' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
/**
* Sidebar for module Topbar
*/
register_sidebar(
array(
'name' => esc_html__( 'Topbar', 'realpro' ),
'id' => 'topbar',
'description' => esc_html__( 'Display in the topbar.', 'realpro' ),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Menu Right', 'realpro' ),
'id' => 'menu_right',
'description' => esc_html__( 'Display the item on the right menu.', 'realpro' ),
'before_widget' => '<div id="%1$s" class="widget-menu-item %2$s">',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer Sidebar', 'realpro' ),
'id' => 'footer-sidebar',
'description' => esc_html__( 'Display widgets in the sidebar.', 'realpro' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
)
);
if ( class_exists( 'WooCommerce' ) ) {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Shop', 'realpro' ),
'id' => 'sidebar_shop',
'description' => esc_html__( 'Sidebar Shop', 'realpro' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Sidebar Shop Detail', 'realpro' ),
'id' => 'sidebar_shop_single',
'description' => esc_html__( 'Sidebar Shop Detail', 'realpro' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
)
);
}
}
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
public function thim_setup_theme() {
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
$GLOBALS['content_width'] = apply_filters( 'thim_content_width', 640 );
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on this theme, use a find and replace
* to change 'realpro' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'realpro', THIM_DIR . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'primary' => esc_html__( 'Primary Menu', 'realpro' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
)
);
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support(
'post-formats', array(
'aside',
'image',
'video',
'audio',
'link',
'gallery',
)
);
// add_theme_support( 'custom-background' );
add_theme_support( 'custom-header' );
// Enqueue editor styles.
add_editor_style( 'style-editor.css' );
add_theme_support( 'thim-core' );
add_theme_support( 'thim-core-lite' );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-slider' );
/*
* Gutenberg
*/
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
// don't enqueue file css when save customizer
add_filter( 'thim_core_enqueue_file_css_customizer', '__return_false' );
// remove wp_global_styles_render_svg_filters
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
// Woocommerce
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
public function thim_custom_color_header_single_page() {
$css = '';
if ( is_page() || is_single() ) {
$bg_main_menu_color = get_post_meta( get_the_ID(), 'thim_mtb_bg_main_menu_color', true );
$main_menu_text_color = get_post_meta( get_the_ID(), 'thim_mtb_main_menu_text_color', true );
$main_menu_text_hover_color = get_post_meta( get_the_ID(), 'thim_mtb_main_menu_text_hover_color', true );
$var_css = $bg_main_menu_color ? '--thim-main_menu_color-background_color:' . $bg_main_menu_color . ';' : '';
$var_css .= $bg_main_menu_color ? '--thim-main_menu-color:' . $main_menu_text_color . ';' : '';
$var_css .= $bg_main_menu_color ? '--thim-main_menu_color-text_color_hover:' . $main_menu_text_hover_color . ';' : '';
$css .= $var_css ? '#masthead{' . $var_css . '}' : '';
}
return trim( $css );
}
/**
* thim_get_option_var_css
*/
public function thim_get_option_var_css() {
$css = '';
$theme_options = array(
// hearder
'width_logo' => '180px',
'logo_padding' => '0',
'body_container' => '1320px',
'body_primary_color' => '#254B86',
'body_color_seconds' => '#0370CB',
'body_color_third' => '#FFB800',
'font_body' => array(
'font-family' => 'Lato',
'variant' => '400',
'font-size' => '16px',
'line-height' => '1.5em',
'letter-spacing' => '0',
'color' => '#666666',
'text-transform' => 'none',
),
'font_title' => array(
'font-family' => 'Lato',
'color' => '#101010',
'variant' => '700',
),
'font_h1' => array(
'font-size' => '48px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'font_h2' => array(
'font-size' => '40px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'font_h3' => array(
'font-size' => '28px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'font_h4' => array(
'font-size' => '22px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'font_h5' => array(
'font-size' => '18px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'font_h6' => array(
'font-size' => '16px',
'line-height' => '1.25em',
'text-transform' => 'none',
),
'theme_feature_preloading_style' => array(
'background' => '#ffffff',
'color' => '#333333',
),
// Button Global
'button_global' => array(
'font-size' => '16px',
'line-height' => '1.5em',
'color' => '#fff',
'text-transform' => 'none',
),
'button_global_font_weight' => '600',
'button_global_padding' => array(
'top' => '10px',
'right' => '30px',
'bottom' => '10px',
'left' => '30px',
),
// background box
'background_main_color' => '#fff',
'background_main_image_repeat' => 'no-repeat',
'background_main_image_position' => 'center',
'background_main_image_attachment' => 'fixed',
);
//
foreach ( $theme_options as $key => $val ) {
$val_opt = thim_get_theme_option( $key, $val );
if ( is_array( $val_opt ) ) {
// get options default
foreach ( $val as $attr => $value ) {
$val_ar = isset( $val_opt[$attr] ) ? $val_opt[$attr] : $value;
$css .= '--thim-' . $key . '-' . $attr . ':' . $val_ar . ';';
}
} else {
if ( $val_opt != '' ) {
if ( in_array( $key, array( 'background_main_pattern_image', 'background_main_image' ) ) ) {
$val_opt = 'url("' . $val_opt . '")';
}
$css .= '--thim-' . $key . ':' . $val_opt . ';';
// convert primary color to rga
if ( $key == 'body_primary_color' ) {
list( $r, $g, $b ) = sscanf( $val_opt, "#%02x%02x%02x" );
$css .= '--thim-' . $key . '_rgb: ' . $r . ',' . $g . ',' . $b . ';';
}
}
}
// get data for on type is image
}
return apply_filters( 'thim_get_var_css_customizer', $css );
}
/**
* Enqueue scripts and styles.
*/
public function thim_frontend_scripts() {
// Enqueue Styles
wp_enqueue_style( 'slick', THIM_URI . 'assets/css/slick.css', array(), THIM_THEME_VERSION );
if ( ! class_exists( 'TP' ) ) {
wp_enqueue_style( 'thim-fontgoogle-default', 'https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap"', array(), THIM_THEME_VERSION );
}
if ( ! class_exists( '\RealPress\RealPress' ) ) {
wp_enqueue_style( 'thim-rp-font-icon', THIM_URI . 'assets/css/thim-rp-icons.css', array(), THIM_THEME_VERSION );
}
// RTL
if ( is_rtl() ) {
wp_enqueue_style( 'thim-style', THIM_URI . 'style-rtl.css', array(), THIM_THEME_VERSION );
} else {
wp_enqueue_style( 'thim-style', get_stylesheet_uri(), array(), THIM_THEME_VERSION );
}
$var_css = ':root{' . $this->thim_get_option_var_css() . '}';
$var_css .= $this->thim_custom_color_header_single_page();
wp_add_inline_style( 'thim-style', $var_css );
// Enqueue Scripts
wp_enqueue_script( 'cookie', THIM_URI . 'assets/js/cookie.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
wp_register_script( 'magnific-popup', THIM_URI . 'assets/js/jquery.magnific-popup.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
wp_enqueue_script( 'slick', THIM_URI . 'assets/js/slick.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
wp_enqueue_script( 'flexslider', THIM_URI . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
wp_enqueue_script( 'theia-sticky-sidebar', THIM_URI . 'assets/js/theia-sticky-sidebar.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
wp_enqueue_script( 'thim-custom', THIM_URI . 'assets/js/thim-custom.min.js', array( 'jquery' ), THIM_THEME_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Don't load Gutenberg-related stylesheets.
wp_dequeue_style( 'wp-block-library-theme' );
}
/**
* Enqueue admin scripts and styles.
*/
public function thim_admin_scripts() {
wp_enqueue_script( 'dismissible-notices', THIM_URI . 'inc/admin/assets/scripts.js', array( 'jquery', 'common' ), THIM_THEME_VERSION, true );
wp_enqueue_style( 'theme-admin', THIM_URI . 'assets/css/admin.css', array(), THIM_THEME_VERSION );
wp_localize_script( 'dismissible-notices', 'dismissible_notice', array( 'nonce' => wp_create_nonce( 'dismissible-notice' ), ) );
}
/**
* Theme Feature: Preload
*
* @return bool
* @return string HTML for preload
*/
public function thim_preloading() {
$preloading = get_theme_mod( 'theme_feature_preloading', 'off' );
if ( $preloading != 'off' ) {
echo '<div id="thim-preloading">';
switch ( $preloading ) {
default:
if ( locate_template( 'templates/features/preloading/' . $preloading . '.php' ) ) {
include locate_template( 'templates/features/preloading/' . $preloading . '.php' );
}
break;
}
echo '</div>';
}
}
/**
*
* Excerpt Length
* @return string
*/
public function thim_excerpt_length() {
return get_theme_mod( 'thim_archive_excerpt_length', 40 );
}
}
new Thim_Realpro_Include();
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists