| Server IP : 27.254.66.5 / Your IP : 216.73.217.39 Web Server : Apache/2 System : Linux cs82.hostneverdie.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64 User : technic2 ( 1951) PHP Version : 7.4.30 Disable Function : apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd,exec, fp, fput, highlight_file, ini_alter, ini_restore, inject_code, passthru,phpAds_remoteInfo, phpAds_XmlRpc,phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid,posix_setuid, posix_setuid, posix_uname,proc_open,proc_close, proc_get_status, proc_nice, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode, show_source,sleep,pcntl_exec,virtual,suexec,dbmopen,dl,symlink,disk_free_space,diskfreespace,leak MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/technic2/public_html/old-website/wp-content/themes/synapse/framework/ |
Upload File : |
<?php
/*
* @package synapse, Copyright Rohit Tripathi, rohitink.com
* This file contains Custom Theme Related Functions.
*/
/*
* @package madhat, Copyright Rohit Tripathi, rohitink.com
* This file contains Custom Theme Related Functions.
*/
//Import Admin Modules
require get_template_directory() . '/framework/admin_modules/register_styles.php';
require get_template_directory() . '/framework/admin_modules/register_widgets.php';
require get_template_directory() . '/framework/admin_modules/theme_setup.php';
require get_template_directory() . '/framework/admin_modules/admin_styles.php';
require get_template_directory() . '/framework/admin_modules/excerpt_length.php';
require get_template_directory() . '/framework/admin_modules/compatibility_function.php';
class Synapse_Menu_With_Description extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="' . esc_attr( $class_names ) . '"';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$fontIcon = ! empty( $item->attr_title ) ? ' <i class="fa ' . esc_attr( $item->attr_title ) .'">' : '';
$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>'.$fontIcon.'</i>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '<br /><span class="menu-desc">' . $item->description . '</span>';
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args, $id );
}
}
class Synapse_Menu_With_Icon extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="' . esc_attr( $class_names ) . '"';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$fontIcon = ! empty( $item->attr_title ) ? ' <i class="fa ' . esc_attr( $item->attr_title ) .'">' : '';
$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'>'.$fontIcon.'</i>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args, $id );
}
}
class Synapse_Menu_With_Hover extends Walker_Nav_Menu {
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = ' class="' . esc_attr( $class_names ) . '"';
$output .= $indent . '<li id="menu-item-'. $item->ID . '"' . $value . $class_names .'>';
$attributes = ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$attributes .= ! empty( $item->title ) ? ' data-hover="' . esc_attr( $item->title ) .'"' : '';
$item_output = $args->before;
$item_output .= '<a'. $attributes .'><span>';
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</span></a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args, $id );
}
}
/*
* Pagination Function. Implements core paginate_links function.
*/
function synapse_pagination() {
the_posts_pagination( array( 'mid_size' => 2 ) );
}
/*
** Customizer Controls
*/
if (class_exists('WP_Customize_Control')) {
class Synapse_WP_Customize_Category_Control extends WP_Customize_Control {
/**
* Render the control's content.
*/
public function render_content() {
$dropdown = wp_dropdown_categories(
array(
'name' => '_customize-dropdown-categories-' . $this->id,
'echo' => 0,
'show_option_none' => __( '— Select —', 'synapse' ),
'option_none_value' => '0',
'selected' => $this->value(),
)
);
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
printf(
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
$this->label,
$dropdown
);
}
}
}
if ( class_exists('WP_Customize_Control') && class_exists('woocommerce') ) {
class Synapse_WP_Customize_Product_Category_Control extends WP_Customize_Control {
/**
* Render the control's content.
*/
public function render_content() {
$dropdown = wp_dropdown_categories(
array(
'name' => '_customize-dropdown-categories-' . $this->id,
'echo' => 0,
'show_option_none' => __( '— Select —', 'synapse' ),
'option_none_value' => '0',
'taxonomy' => 'product_cat',
'selected' => $this->value(),
)
);
$dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown );
printf(
'<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>',
$this->label,
$dropdown
);
}
}
}
if (class_exists('WP_Customize_Control')) {
class Synapse_WP_Customize_Upgrade_Control extends WP_Customize_Control {
/**
* Render the control's content.
*/
public function render_content() {
printf(
'<label class="customize-control-upgrade"><span class="customize-control-title">%s</span> %s</label>',
$this->label,
$this->description
);
}
}
}
/*
** Function to check if Sidebar is enabled on Current Page
*/
function synapse_load_sidebar() {
$load_sidebar = true;
if ( get_theme_mod('synapse_disable_sidebar') ) :
$load_sidebar = false;
elseif( get_theme_mod('synapse_disable_sidebar_home') && is_home() ) :
$load_sidebar = false;
elseif( get_theme_mod('synapse_disable_sidebar_front') && is_front_page() ) :
$load_sidebar = false;
endif;
return $load_sidebar;
}
/*
** Determining Sidebar and Primary Width
*/
function synapse_primary_class() {
$sw = esc_html(get_theme_mod('synapse_sidebar_width',4));
$class = "col-md-".(12-$sw);
if ( !synapse_load_sidebar() )
$class = "col-md-12";
echo esc_attr($class);
}
add_action('synapse_primary-width', 'synapse_primary_class');
function synapse_secondary_class() {
$sw = esc_html(get_theme_mod('synapse_sidebar_width',4));
$class = "col-md-".$sw;
echo esc_attr($class);
}
add_action('synapse_secondary-width', 'synapse_secondary_class');
/*
** Helper Function to Convert Colors
*/
function synapse_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
return implode(",", $rgb); // returns the rgb values separated by commas
//return $rgb; // returns an array with the rgb values
}
function synapse_fade($color, $val) {
return "rgba(".synapse_hex2rgb($color).",". $val.")";
}
/*
** Function to Get Theme Layout
*/
function synapse_get_blog_layout(){
$ldir = 'framework/layouts/content';
if (get_theme_mod('synapse_blog_layout') ) :
get_template_part( $ldir , get_theme_mod('synapse_blog_layout') );
else :
get_template_part( $ldir ,'synapse');
endif;
}
add_action('synapse_blog_layout', 'synapse_get_blog_layout');
/*
** Function to Set Main Class
*/
function synapse_get_main_class(){
$layout = get_theme_mod('synapse_blog_layout');
if (strpos($layout,'synapse') !== false) {
echo 'synapse-main';
}
}
add_action('synapse_main-class', 'synapse_get_main_class');
/*
** Load WooCommerce Compatibility FIle
*/
if ( class_exists('woocommerce') ) :
require get_template_directory() . '/framework/woocommerce.php';
endif;
/*
** Load Custom Widgets
*/
require get_template_directory() . '/framework/widgets/recent-posts.php';