<commit_before><?php
/**
* Common function.php functions to minimize the main functions.php
*
* Example usage to include this code (in your funtions.php):
* 
* class MyTheme extends Hyperion{
*		function __construct(){	
*			parent::__construct();
*	
*			/...your code.../
* 	}
*   
*   /...other functions.../
* }
* add_action( 'after_setup_theme', create_function( '', 'global $theme; $theme = new MyTheme();' ) );
*
*/

// Define theme-wide constants
define( 'THEME_PATH', get_bloginfo( 'stylesheet_directory' ) );
define( 'HOME_URL', home_url() );
if ( ! isset( $content_width ) ) $content_width = 1200;

/*
* Main theme class
* 
* Loads default settings for all themes 
*/
class Hyperion{
	
	function __construct() {
		// customise theme
		add_theme_support( 'automatic-feed-links' );
		add_theme_support( 'post-thumbnails' );
		set_post_thumbnail_size( 150, 150, true );
		add_theme_support( 'menus' );
		add_editor_style('css/editor-style.css');
			
			// add actions
		add_action( 'wp_enqueue_scripts', array( &$this, 'add_scripts') );  
		add_action( 'manage_media_custom_column', array( &$this, 'media_custom_columns', 0, 2));
		
		//add filters
		add_filter( 'manage_upload_columns', array( &$this, 'upload_columns'));
		add_filter( 'post_thumbnail_html', array( &$this, 'remove_thumbnail_dimensions' ), 10 );
		add_filter( 'image_send_to_editor', array( &$this, 'remove_thumbnail_dimensions' ), 10 );
		add_filter( 'the_content', array( &$this, 'remove_thumbnail_dimensions' ), 10 );	
		add_filter( 'the_content', array( &$this, 'filter_ptags_on_images' ));
		add_filter( 'admin_footer_text', array( &$this, 'remove_footer_admin' ));
		add_filter( "pre_update_option_category_base", array( &$this, "remove_blog_slug" ));
		add_filter( "pre_update_option_tag_base", array( &$this, "remove_blog_slug" ));
		add_filter( "pre_update_option_permalink_structure", array( &$this, "remove_blog_slug" ));
	}
	
	function add_scripts(){
		wp_enqueue_script( 'jquery' );
		wp_enqueue_script( 'modernizr', THEME_PATH.'/js/libs/modernizr-2.0.6.min.js', array(), '2.0.6', true ); 
		wp_enqueue_script( 'default', THEME_PATH.'/js/script.js', array( 'jquery' ), '1.0', true ); 
		wp_enqueue_script( 'plugins', THEME_PATH.'/js/plugins.js', array( 'jquery' ), '1.0', true ); 
		if(is_singular()){
			wp_enqueue_script( 'comment-reply' ); 
		}
	}

	// just check if the current structure begins with /blog/ remove that and return the stripped structure 
	function remove_blog_slug($tag_cat_permalink){
		if(!preg_match("/^\/blog\//",$tag_cat_permalink))
		return $tag_cat_permalink;
		$new_permalink=preg_replace ("/^\/blog\//","/",$tag_cat_permalink );
		return $new_permalink;
	}

	// Customise the footer in admin area
	function remove_footer_admin () {
		echo get_avatar('<EMAIL>' , '40' );
		echo 'Theme designed and developed by <a href="http://vilmosioo.co.uk" target="_blank"><NAME></a>';
	}
	
	// stop images getting wrapped up in p tags when they get dumped out with the_content() for easier theme styling
	function filter_ptags_on_images( $content ){
		return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
	}

	
	// remove attached image sizes 
	function remove_thumbnail_dimensions( $html ) {
		$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );<commit_msg>Remved modernizr from Hyperion<commit_after><?php
/**
* Common function.php functions to minimize the main functions.php
*
* Example usage to include this code (in your funtions.php):
* 
* class MyTheme extends Hyperion{
*		function __construct(){	
*			parent::__construct();
*	
*			/...your code.../
* 	}
*   
*   /...other functions.../
* }
* add_action( 'after_setup_theme', create_function( '', 'global $theme; $theme = new MyTheme();' ) );
*
*/

// Define theme-wide constants
define( 'THEME_PATH', get_bloginfo( 'stylesheet_directory' ) );
define( 'HOME_URL', home_url() );
if ( ! isset( $content_width ) ) $content_width = 1200;

/*
* Main theme class
* 
* Loads default settings for all themes 
*/
class Hyperion{
	
	function __construct() {
		// customise theme
		add_theme_support( 'automatic-feed-links' );
		add_theme_support( 'post-thumbnails' );
		set_post_thumbnail_size( 150, 150, true );
		add_theme_support( 'menus' );
		add_editor_style('css/editor-style.css');
			
			// add actions
		add_action( 'wp_enqueue_scripts', array( &$this, 'add_scripts') );  
		add_action( 'manage_media_custom_column', array( &$this, 'media_custom_columns', 0, 2));
		
		//add filters
		add_filter( 'manage_upload_columns', array( &$this, 'upload_columns'));
		add_filter( 'post_thumbnail_html', array( &$this, 'remove_thumbnail_dimensions' ), 10 );
		add_filter( 'image_send_to_editor', array( &$this, 'remove_thumbnail_dimensions' ), 10 );
		add_filter( 'the_content', array( &$this, 'remove_thumbnail_dimensions' ), 10 );	
		add_filter( 'the_content', array( &$this, 'filter_ptags_on_images' ));
		add_filter( 'admin_footer_text', array( &$this, 'remove_footer_admin' ));
		add_filter( "pre_update_option_category_base", array( &$this, "remove_blog_slug" ));
		add_filter( "pre_update_option_tag_base", array( &$this, "remove_blog_slug" ));
		add_filter( "pre_update_option_permalink_structure", array( &$this, "remove_blog_slug" ));
	}
	
	function add_scripts(){
		wp_enqueue_script( 'jquery' );
		wp_enqueue_script( 'default', THEME_PATH.'/js/script.js', array( 'jquery' ), '1.0', true ); 
		wp_enqueue_script( 'plugins', THEME_PATH.'/js/plugins.js', array( 'jquery' ), '1.0', true ); 
		if(is_singular()){
			wp_enqueue_script( 'comment-reply' ); 
		}
	}

	// just check if the current structure begins with /blog/ remove that and return the stripped structure 
	function remove_blog_slug($tag_cat_permalink){
		if(!preg_match("/^\/blog\//",$tag_cat_permalink))
		return $tag_cat_permalink;
		$new_permalink=preg_replace ("/^\/blog\//","/",$tag_cat_permalink );
		return $new_permalink;
	}

	// Customise the footer in admin area
	function remove_footer_admin () {
		echo get_avatar('<EMAIL>' , '40' );
		echo 'Theme designed and developed by <a href="http://vilmosioo.co.uk" target="_blank"><NAME></a>';
	}
	
	// stop images getting wrapped up in p tags when they get dumped out with the_content() for easier theme styling
	function filter_ptags_on_images( $content ){
		return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
	}

	
	// remove attached image sizes 
	function remove_thumbnail_dimensions( $html ) {
		$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
{'fraction_non_alphanumeric': 0.17073915699450215, 'fraction_numerical': 0.00916310323762981, 'mean_word_length': 4.7497805092186125, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1588638', 'n_tokens_mistral': 2501, 'n_tokens_neox': 2310, 'n_words': 503}