* @copyright Copyright (c) 2013, Nicolas GUILLAUME
* @link http://themesandco.com/customizr
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
if ( ! class_exists( 'TC_init' ) ) :
class TC_init {
//declares the filtered default settings
public $global_layout;
public $tc_thumb_size;
public $slider_full_size;
public $slider_size;
public $skins;
public $fp_ids;
public $socials;
public $sidebar_widgets;
public $footer_widgets;
public $widgets;
public $post_list_layout;
public $post_formats_with_no_header;
public $content_404;
public $content_no_results;
public $default_slides;
//Access any method or var of the class with classname::$instance -> var or method():
static $instance;
function __construct () {
self::$instance =& $this;
//Default layout settings
$this -> global_layout = array(
'r' => array(
'content' => 'span9',
'sidebar' => 'span3',
'customizer' => __( 'Right sidebar' , 'customizr' ),
'metabox' => __( 'Right sidebar' , 'customizr' ),
),
'l' => array(
'content' => 'span9',
'sidebar' => 'span3',
'customizer' => __( 'Left sidebar' , 'customizr' ),
'metabox' => __( 'Left sidebar' , 'customizr' ),
),
'b' => array(
'content' => 'span6',
'sidebar' => 'span3',
'customizer' => __( '2 sidebars : Right and Left' , 'customizr' ),
'metabox' => __( '2 sidebars : Right and Left' , 'customizr' ),
),
'f' => array(
'content' => 'span12',
'sidebar' => false,
'customizer' => __( 'No sidebars : full width layout', 'customizr' ),
'metabox' => __( 'No sidebars : full width layout' , 'customizr' ),
),
);
//Default images sizes
$this -> tc_thumb_size = array('width' => 270 , 'height' => 250, 'crop' => true );
$this -> slider_full_size = array('width' => 9999 , 'height' => 500, 'crop' => true );
$this -> slider_size = array('width' => 1170 , 'height' => 500, 'crop' => true );
//Default skins array
$this -> skins = array(
'blue.css' => __( 'Blue' , 'customizr' ),
'blue2.css' => __( 'Light blue ' , 'customizr' ),
'blue3.css' => __( 'Green blue' , 'customizr'),
'green.css' => __( 'Green' , 'customizr' ),
'green2.css' => __( 'Light green' , 'customizr'),
'yellow.css' => __( 'Yellow' , 'customizr' ),
'yellow2.css' => __( 'Flat yellow' , 'customizr' ),
'orange.css' => __( 'Orange' , 'customizr' ),
'orange2.css' => __( 'Flat orange' , 'customizr'),
'red.css' => __( 'Red' , 'customizr' ),
'red2.css' => __( 'Flat red' , 'customizr' ),
'purple.css' => __( 'Purple' , 'customizr' ),
'purple2.css' => __( 'Flat purple' , 'customizr' ),
'grey.css' => __( 'Grey' , 'customizr' ),
'grey2.css' => __( 'Ligth grey' , 'customizr' ),
'black.css' => __( 'Black' , 'customizr' ),
'black2.css' => __( 'Flat black' , 'customizr' )
);
//Default featured pages ids
$this -> fp_ids = array( 'one' , 'two' , 'three' );
//Default social networks
$this -> socials = array(
'tc_rss' => array(
'link_title' => __( 'Subscribe to my rss feed' , 'customizr' ),
'option_label' => __( 'RSS feed (default is the wordpress feed)' , 'customizr' ),
'default' => get_bloginfo( 'rss_url' )
),
'tc_twitter' => array(
'link_title' => __( 'Follow me on Twitter' , 'customizr' ),
'option_label' => __( 'Twitter profile url' , 'customizr' ),
'default' => null
),
'tc_facebook' => array(
'link_title' => __( 'Follow me on Facebook' , 'customizr' ),
'option_label' => __( 'Facebook profile url' , 'customizr' ),
'default' => null
),
'tc_google' => array(
'link_title' => __( 'Follow me on Google+' , 'customizr' ),
'option_label' => __( 'Google+ profile url' , 'customizr' ),
'default' => null
),
'tc_instagram' => array(
'link_title' => __( 'Follow me on Instagram' , 'customizr' ),
'option_label' => __( 'Instagram profile url' , 'customizr' ),
'default' => null
),
'tc_wordpress' => array(
'link_title' => __( 'Follow me on WordPress' , 'customizr' ),
'option_label' => __( 'WordPress profile url' , 'customizr' ),
'default' => null
),
'tc_youtube' => array(
'link_title' => __( 'Follow me on Youtube' , 'customizr' ),
'option_label' => __( 'Youtube profile url' , 'customizr' ),
'default' => null
),
'tc_pinterest' => array(
'link_title' => __( 'Pin me on Pinterest' , 'customizr' ),
'option_label' => __( 'Pinterest profile url' , 'customizr' ),
'default' => null
),
'tc_github' => array(
'link_title' => __( 'Follow me on Github' , 'customizr' ),
'option_label' => __( 'Github profile url' , 'customizr' ),
'default' => null
),
'tc_dribbble' => array(
'link_title' => __( 'Follow me on Dribbble' , 'customizr' ),
'option_label' => __( 'Dribbble profile url' , 'customizr' ),
'default' => null
),
'tc_linkedin' => array(
'link_title' => __( 'Follow me on LinkedIn' , 'customizr' ),
'option_label' => __( 'LinkedIn profile url' , 'customizr' ),
'default' => null
)
);//end of social array
//Default sidebar widgets
$this -> sidebar_widgets = array(
'right' => array(
'name' => __( 'Right Sidebar' , 'customizr' ),
'description' => __( 'Appears on posts, static pages, archives and search pages' , 'customizr' )
),
'left' => array(
'name' => __( 'Left Sidebar' , 'customizr' ),
'description' => __( 'Appears on posts, static pages, archives and search pages' , 'customizr' )
)
);//end of array
//Default footer widgets
$this -> footer_widgets = array(
'footer_one' => array(
'name' => __( 'Footer Widget Area One' , 'customizr' ),
'description' => __( 'Just use it as you want !' , 'customizr' )
),
'footer_two' => array(
'name' => __( 'Footer Widget Area Two' , 'customizr' ),
'description' => __( 'Just use it as you want !' , 'customizr' )
),
'footer_three' => array(
'name' => __( 'Footer Widget Area Three' , 'customizr' ),
'description' => __( 'Just use it as you want !' , 'customizr' )
)
);//end of array
//Default post list layout
$this -> post_list_layout = array(
'content' => 'span8',
'thumb' => 'span4',
'show_thumb_first' => false,
'alternate' => true
);
//Defines post formats with no headers
$this -> post_formats_with_no_header = array( 'aside' , 'status' , 'link' , 'quote' );
//Default 404 content
$this -> content_404 = array(
'quote' => __( 'Speaking the Truth in times of universal deceit is a revolutionary act.' , 'customizr' ),
'author' => __( 'George Orwell' , 'customizr' ),
'text' => __( 'Sorry, but the requested page is not found. You might try a search below.' , 'customizr' )
);
//Default no search result content
$this -> content_no_results = array(
'quote' => __( 'Success is the ability to go from one failure to another with no loss of enthusiasm...' , 'customizr' ),
'author' => __( 'Sir Winston Churchill' , 'customizr' ),
'text' => __( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.' , 'customizr' )
);
//Default slides content
$this -> default_slides = array(
1 => array(
'title' => '',
'text' => '',
'button_text' => '',
'link_id' => null,
'link_url' => null,
'active' => 'active',
'color_style' => '',
'slide_background' => sprintf('',
TC_BASE_URL.'inc/assets/img/customizr.jpg',
__( 'Customizr is a clean responsive theme' , 'customizr' )
)
),
2 => array(
'title' => __( 'Style your WordPress site live!' , 'customizr' ),
'text' => __( 'Many layout and design options are available from the WordPress customizer screen : see your changes live !' , 'customizr' ),
'button_text' => __( 'Just try it!' , 'customizr' ),
'link_id' => null,
'link_url' => null,
'active' => '',
'color_style' => '',
'slide_background' => sprintf('
',
TC_BASE_URL.'inc/assets/img/phare.jpg',
__( 'Style your WordPress site live!' , 'customizr' )
)
),
3 => array(
'title' => __( 'Create beautiful sliders' , 'customizr' ),
'text' => __( 'Customizr comes with a cool slider generator : add a slider to any post or page!' , 'customizr' ),
'button_text' => __( 'Discover the features' , 'customizr' ),
'link_id' => null,
'link_url' => null,
'active' => '',
'color_style' => '',
'slide_background' => sprintf('
',
TC_BASE_URL.'inc/assets/img/chevrolet.jpg',
__( 'Create beautiful sliders' , 'customizr' )
)
)
);///end of slides array
//adds the text domain, various theme supports : editor style, automatic-feed-links, post formats, navigation menu, post-thumbnails
add_action ( 'after_setup_theme' , array( $this , 'tc_customizr_setup' ) );
//adds various plugins compatibilty (Jetpack, Bbpress, Qtranslate, Woocommerce, ...)
add_action ( 'after_setup_theme' , array( $this , 'tc_plugins_compatibility'), 20 );
//adds retina support for high resolution devices
add_filter ( 'wp_generate_attachment_metadata' , array( $this , 'tc_add_retina_support') , 10 , 2 );
add_filter ( 'delete_attachment' , array( $this , 'tc_clean_retina_images') );
}
/**
* Sets up theme defaults and registers the various WordPress features
*
*
* @package Customizr
* @since Customizr 1.0
*/
function tc_customizr_setup() {
/* Set default content width for post images and media. */
global $content_width;
if( ! isset( $content_width ) ) { $content_width = apply_filters( 'tc_content_width' , 1170 ); }
/*
* Makes Customizr available for translation.
* Translations can be added to the /inc/lang/ directory.
*/
load_theme_textdomain( 'customizr' , TC_BASE . '/inc/lang' );
/*
* Customizr styles the visual editor to resemble the theme style,
* Loads the editor-style specific (post formats and RTL), the active skin, the user style.css
*/
add_editor_style( array( TC_BASE_URL.'inc/admin/css/editor-style.css', $this -> tc_active_skin() , get_stylesheet_uri() ) );
/* Adds RSS feed links to