HEX
Server: Apache
System: Linux webm006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: slyfwmm (169339)
PHP: 8.1.34
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/slyfwmm/foar/wp-content/themes/flexfit/functions.php
<?php
/*-----------------------------------------------------------------------------------*/
/*	Load Translation Text Domain
/*-----------------------------------------------------------------------------------*/

load_theme_textdomain('framework');

/* ----------------------------------------------------- */
/* Include */
/* ----------------------------------------------------- */

include('framework/functions/sidebars.php');
include('framework/functions/scripts.php');
include('framework/functions/work-custom-post-type.php');
include('framework/functions/homeslider-custom-post-type.php');
include('framework/functions/sidebar_generator.php');

// Widgets
include('framework/functions/widgets/twitter.php');
include('framework/functions/widgets/flickr.php');
include('framework/functions/widgets/sponsor.php');
include('framework/functions/widgets/embed.php');

/* ----------------------------------------------------- */
/* Shortcodes */
/* ----------------------------------------------------- */

require_once ('framework/functions/shortcodes.php');

add_filter('widget_text', 'do_shortcode');
add_filter('widget_title', 'do_shortcode');
add_filter('textarea', 'do_shortcode');

/* ----------------------------------------------------- */
/* Custom Menu */
/* ----------------------------------------------------- */

add_action('init', 'register_custom_menu');
 
function register_custom_menu() {
register_nav_menu('custom_menu', __('Custom Menu'));
}

/* ----------------------------------------------------- */
/* General */
/* ----------------------------------------------------- */

// Post Thumbnails
if ( function_exists( 'add_image_size' ) ) add_theme_support( 'post-thumbnails' );

	if ( function_exists( 'add_image_size' ) ) {
	add_image_size( 'blog-thumb', 670, 250, true );
	add_image_size( 'work-thumb', 215, 140, true );
	add_image_size( 'work-thumb-col2', 450, 280, true );
	add_image_size( 'work-thumb-col3', 293, 210, true );
	add_image_size( 'work-detail', 920, 400, true );
	add_image_size( 'home-slider', 980, 370, true );
}

/* ----------------------------------------------------- */
/* Hex Darker */
/* ----------------------------------------------------- */
function hexDarker($hex,$factor = 30) {
	$new_hex = '';
	
	$base['R'] = hexdec($hex[0].$hex[1]);
	$base['G'] = hexdec($hex[2].$hex[3]);
	$base['B'] = hexdec($hex[4].$hex[5]);
	
	foreach ($base as $k => $v)
	        {
	        $amount = $v / 100;
	        $amount = round($amount * $factor);
	        $new_decimal = $v - $amount;
	
	        $new_hex_component = dechex($new_decimal);
	        if(strlen($new_hex_component) < 2)
	                { $new_hex_component = "0".$new_hex_component; }
	        $new_hex .= $new_hex_component;
	        }
	        
	return $new_hex;        
}

/* ----------------------------------------------------- */

// Blog excerpt
function wpe_excerptlength_blog($length) {
    return 50;
}

// Home excerpt
function wpe_excerptlength_index($length) {
    return 20;
}

// more link
function wpe_excerptmore($more) {
	$readmore = __('Leggi', 'framework');
    return '.. <br /><a href="'. get_permalink() . '" class="readmore">'.$readmore.'<span></span></a>';
}

// Excerpt function
function wpe_excerpt($length_callback='', $more_callback='') {
    global $post;
    if(function_exists($length_callback)){
    	add_filter('excerpt_length', $length_callback);
    }
    if(function_exists($more_callback)){
    	add_filter('excerpt_more', $more_callback);
    }
    $output = get_the_excerpt();
    $output = apply_filters('wptexturize', $output);
    $output = apply_filters('convert_chars', $output);
    $output = '<p>'.$output.'</p>';
    echo $output;
}

/* ----------------------------------------------------- */

// Max. Content Width
if ( ! isset( $content_width ) ) $content_width = 670;

/* ----------------------------------------------------- */

// Add Theme Support
add_theme_support('automatic-feed-links');

/* ----------------------------------------------------- */
/* Breadcrumb Navigation */
/* ----------------------------------------------------- */

function the_breadcrumb() {
	if (!is_home()) {
		echo '<a href="';
		echo home_url();
		echo '">';
		bloginfo('name');
		echo "</a>";
		if (is_category() || is_single()) {
			the_category(', ');
			if (is_single()) {
				echo'<span class="witharrow">';
				the_title();
				echo'</span>';
			}
		} elseif (is_page() && !is_page_template('page-home.php') && !is_page_template('page-work.php')) {
			echo the_title();
		}
		elseif (is_page() && is_page_template('page-home.php')) {
			_e('Home', 'framework');
		}
		elseif (is_page() && is_page_template('page-work.php')) {
			_e('Work', 'framework');
		}
		elseif (is_search()) {
			_e('Search', 'framework');
		}
		} elseif (is_home()) {
			echo '<a href="';
			echo home_url();
			echo '">';
			bloginfo('name');
			echo "</a>";
			_e('Blog', 'framework');
		}
}

/* ---------------------------------------------------- */
/* Styling Comments										*/
/* ---------------------------------------------------- */

function mytheme_comment( $comment, $args, $depth ) {
   $GLOBALS['comment'] = $comment; ?>

   <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
   <div class="comment-entry clearfix"> 
   		
   		<div class="avatar"><?php echo get_avatar( $comment,$size='34',$default='<path_to_url>' ); ?></div>
         
         <div class="comment-text">
         
			 <div class="author">
			 	<span><?php printf( __( '%s', 'framework'), get_comment_author_link() ) ?></span>
			 	<div class="date">
			 	<?php printf(__('%1$s at %2$s', 'framework'), get_comment_date(),  get_comment_time() ) ?></a><?php edit_comment_link( __( '(Edit)', 'framework'),'  ','' ) ?>
			   	ยท <?php comment_reply_link( array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ) ?>  </div>  
			 </div>
			 
			 <div class="text"><?php comment_text() ?></div>
			 
			 
			 <?php if ( $comment->comment_approved == '0' ) : ?>
	         <em><?php _e( 'Your comment is awaiting moderation.', 'framework' ) ?></em>
	         <br />
	      	<?php endif; ?>
	      	
      	</div>
      
   </div>
<?php
}

/* ----------------------------------------------------- */
/* Include Metabox Framework */
/* ----------------------------------------------------- */

class Works_Walker extends Walker_Category {
   function start_el(&$output, $category, $depth = 0, $args = array(),$id = 0) {
   
      $cat_name = esc_attr( $category->name);
	  $link = '<a href="#" data-filter=".term'.$category->term_id.'">' . $cat_name . '</a>';

      if ( 'list' == $args['style'] ) {
          $output .= '<li';
          $class = 'cat-item cat-item-'.$category->term_id;
          if ( isset($current_category) && $current_category && ($category->term_id == $current_category) )
             $class .=  ' current-cat';
          elseif ( isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent) )
             $class .=  ' current-cat-parent';
          $output .=  '';
          $output .= ">$link\n";
       } else {
          $output .= "\t$link<br />\n";
       }
       
   }
}

/* ----------------------------------------------------- */
/* Include Metabox Framework */
/* ----------------------------------------------------- */

// Re-define meta box path and URL
define( 'RWMB_URL', trailingslashit( get_stylesheet_directory_uri().'/framework/functions/meta-box' ) );
define( 'RWMB_DIR', trailingslashit( get_stylesheet_directory().'/framework/functions/meta-box' ) );

// Include the meta box script
require_once RWMB_DIR . 'meta-box.php';

// Include the meta box definition (This is the file where you define meta boxes, see `demo/demo.php`)
include get_stylesheet_directory().'/framework/functions/meta-box.php';


/* ----------------------------------------------------- */
/* Include Theme Options Framework */
/* ----------------------------------------------------- */

if ( !function_exists( 'optionsframework_init' ) ) {

	/* Set the file path based on whether we're in a child theme or parent theme */
	
	if ( STYLESHEETPATH == TEMPLATEPATH ) {
		define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');
		define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/');
	} else {
		define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');
		define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('stylesheet_directory') . '/admin/');
	}
	
	require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
}

/*
 * This is an example of how to override a default filter
 * for 'textarea' sanitization and $allowedposttags + embed and script.
 */
add_action('admin_init','optionscheck_change_santiziation', 100);
function optionscheck_change_santiziation() {
    remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
    add_filter( 'of_sanitize_textarea', 'custom_sanitize_textarea' );
}
function custom_sanitize_textarea($input) {
    global $allowedposttags;
    $custom_allowedtags["embed"] = array(
      "src" => array(),
      "type" => array(),
      "allowfullscreen" => array(),
      "allowscriptaccess" => array(),
      "height" => array(),
          "width" => array()
      );
      $custom_allowedtags["script"] = array();
      $custom_allowedtags = array_merge($custom_allowedtags, $allowedposttags);
      $output = wp_kses( $input, $custom_allowedtags);
    return $output;
}


/* ----------------------------------------------------- */
/* EOF */
/* ----------------------------------------------------- */

?>