__construct(); } /** * Constructor method for the Easy class. This method adds other methods of the class to * specific hooks within WordPress. It controls the load order of the required files for running * the framework. * * @since 1.0.0 */ function __construct() { /* Define framework, parent theme, and child theme constants. */ add_action( 'after_setup_theme', array( &$this, 'constants' ), 1 ); /* Load the core functions required by the rest of the framework. */ add_action( 'after_setup_theme', array( &$this, 'core' ), 2 ); /* Initialize the framework's default actions and filters. */ add_action( 'after_setup_theme', array( &$this, 'default_filters' ), 3 ); /* Language functions and translations setup. */ add_action( 'after_setup_theme', array( &$this, 'locale' ), 4 ); /* Load the framework functions. */ add_action( 'after_setup_theme', array( &$this, 'functions' ), 12 ); /* Load the framework extensions. */ add_action( 'after_setup_theme', array( &$this, 'extensions' ), 13 ); /* Load admin files. */ add_action( 'wp_loaded', array( &$this, 'admin' ) ); } /** * Defines the constant paths for use within the core framework, parent theme, and * child theme. Constants prefixed with 'Easy_' are for use only within the core * framework and don't reference other areas of the parent or child theme. * * @since 0.7.0 */ function constants() { /* Sets the path to the parent theme directory. */ define( 'THEME_DIR', get_template_directory() ); /* Sets the path to the parent theme directory URI. */ define( 'THEME_URI', get_template_directory_uri() ); /* Sets the path to the child theme directory. */ define( 'CHILD_THEME_DIR', get_stylesheet_directory() ); /* Sets the path to the child theme directory URI. */ define( 'CHILD_THEME_URI', get_stylesheet_directory_uri() ); /* Sets the path to the core framework directory. */ define( 'Easy_DIR', trailingslashit( THEME_DIR ) . basename( dirname( __FILE__ ) ) ); /* Sets the path to the core framework directory URI. */ define( 'Easy_URI', trailingslashit( THEME_URI ) . basename( dirname( __FILE__ ) ) ); /* Sets the path to the core framework admin directory. */ define( 'Easy_ADMIN', trailingslashit( Easy_DIR ) . 'admin' ); /* Sets the path to the core framework classes directory. */ define( 'Easy_CLASSES', trailingslashit( Easy_DIR ) . 'classes' ); /* Sets the path to the core framework extensions directory. */ define( 'Easy_EXTENSIONS', trailingslashit( Easy_DIR ) . 'extensions' ); /* Sets the path to the core framework functions directory. */ define( 'Easy_FUNCTIONS', trailingslashit( Easy_DIR ) . 'functions' ); /* Sets the path to the core framework images directory URI. */ define( 'Easy_IMAGES', trailingslashit( Easy_URI ) . 'images' ); /* Sets the path to the core framework CSS directory URI. */ define( 'Easy_CSS', trailingslashit( Easy_URI ) . 'css' ); /* Sets the path to the core framework JavaScript directory URI. */ define( 'Easy_JS', trailingslashit( Easy_URI ) . 'js' ); } /** * Loads the core framework functions. These files are needed before loading anything else in the * framework because they have required functions for use. * * @since 1.0.0 */ function core() { /* Load the core framework functions. */ require_once( trailingslashit( Easy_FUNCTIONS ) . 'core.php' ); /* Load the context-based functions. */ require_once( trailingslashit( Easy_FUNCTIONS ) . 'context.php' ); } /** * Handles the locale functions file and translations. * * @since 1.0.0 */ function locale() { /* Load theme textdomain. */ load_theme_textdomain( Easy_get_textdomain() ); /* Get the user's locale. */ $locale = get_locale(); /* Locate a locale-specific functions file. */ $locale_functions = locate_template( array( "languages/{$locale}.php", "{$locale}.php" ) ); /* If the locale file exists and is readable, load it. */ if ( !empty( $locale_functions ) && is_readable( $locale_functions ) ) require_once( $locale_functions ); } /** * Loads the framework functions. Many of these functions are needed to properly run the * framework. Some components are only loaded if the theme supports them. * * @since 0.7.0 */ function functions() { /* Load the comments functions. */ require_once( trailingslashit( Easy_FUNCTIONS ) . 'comments.php' ); /* Load media-related functions. */ require_once( trailingslashit( Easy_FUNCTIONS ) . 'media.php' ); /* Load the utility functions. */ require_once( trailingslashit( Easy_FUNCTIONS ) . 'utility.php' ); /* Load the menus functions if supported. */ require_if_theme_supports( 'Easy-core-menus', trailingslashit( Easy_FUNCTIONS ) . 'menus.php' ); /* Load the core SEO component. */ require_if_theme_supports( 'Easy-core-seo', trailingslashit( Easy_FUNCTIONS ) . 'core-seo.php' ); /* Load the shortcodes if supported. */ require_if_theme_supports( 'Easy-core-shortcodes', trailingslashit( Easy_FUNCTIONS ) . 'shortcodes.php' ); /* Load the sidebars if supported. */ require_if_theme_supports( 'Easy-core-sidebars', trailingslashit( Easy_FUNCTIONS ) . 'sidebars.php' ); /* Load the widgets if supported. */ require_if_theme_supports( 'Easy-core-widgets', trailingslashit( Easy_FUNCTIONS ) . 'widgets.php' ); /* Load the template hierarchy if supported. */ require_if_theme_supports( 'Easy-core-template-hierarchy', trailingslashit( Easy_FUNCTIONS ) . 'template-hierarchy.php' ); /* Load the deprecated functions if supported. */ require_if_theme_supports( 'Easy-core-deprecated', trailingslashit( Easy_FUNCTIONS ) . 'deprecated.php' ); } /** * Load extensions (external projects). Extensions are projects that are included within the * framework but are not a part of it. They are external projects developed outside of the * framework. Themes must use add_theme_support( $extension ) to use a specific extension * within the theme. This should be declared on 'after_setup_theme' no later than a priority of 11. * * @since 0.7.0 */ function extensions() { /* Load the Breadcrumb Trail extension if supported. */ require_if_theme_supports( 'breadcrumb-trail', trailingslashit( Easy_EXTENSIONS ) . 'breadcrumb-trail.php' ); /* Load the Cleaner Gallery extension if supported and the plugin isn't active. */ if ( !function_exists( 'cleaner_gallery' ) ) require_if_theme_supports( 'cleaner-gallery', trailingslashit( Easy_EXTENSIONS ) . 'cleaner-gallery.php' ); /* Load the Custom Field Series extension if supported. */ require_if_theme_supports( 'custom-field-series', trailingslashit( Easy_EXTENSIONS ) . 'custom-field-series.php' ); /* Load the Get the Image extension if supported. */ require_if_theme_supports( 'get-the-image', trailingslashit( Easy_EXTENSIONS ) . 'get-the-image.php' ); /* Load the Loop Pagination extension if supported. */ require_if_theme_supports( 'loop-pagination', trailingslashit( Easy_EXTENSIONS ) . 'loop-pagination.php' ); /* Load the Entry Views extension if supported. */ require_if_theme_supports( 'entry-views', trailingslashit( Easy_EXTENSIONS ) . 'entry-views.php' ); /* Load the Theme Layouts extension if supported. */ require_if_theme_supports( 'theme-layouts', trailingslashit( Easy_EXTENSIONS ) . 'theme-layouts.php' ); /* Load the Post Stylesheets extension if supported. */ require_if_theme_supports( 'post-stylesheets', trailingslashit( Easy_EXTENSIONS ) . 'post-stylesheets.php' ); } /** * Load admin files for the framework. * * @since 0.7.0 */ function admin() { /* Check if in the WordPress admin. */ if ( is_admin() ) { /* Load the main admin file. */ require_once( trailingslashit( Easy_ADMIN ) . 'admin.php' ); /* Load the theme settings feature if supported. */ require_if_theme_supports( 'Easy-core-theme-settings', trailingslashit( Easy_ADMIN ) . 'theme-settings.php' ); /* Load the post meta box if supported. */ require_if_theme_supports( 'Easy-core-post-meta-box', trailingslashit( Easy_ADMIN ) . 'post-meta-box.php' ); } } /** * Adds the default framework actions and filters. * * @since 1.0.0 */ function default_filters() { /* Move the WordPress generator to a better priority. */ remove_action( 'wp_head', 'wp_generator' ); add_action( 'wp_head', 'wp_generator', 1 ); /* Add the theme info to the header (lets theme developers give better support). */ add_action( 'wp_head', 'Easy_meta_template', 1 ); /* Filter the textdomain mofile to allow child themes to load the parent theme translation. */ add_filter( 'load_textdomain_mofile', 'Easy_load_textdomain', 10, 2 ); /* Filter textdomain for extensions. */ add_filter( 'breadcrumb_trail_textdomain', 'Easy_get_textdomain' ); add_filter( 'theme_layouts_textdomain', 'Easy_get_textdomain' ); add_filter( 'custom_field_series_textdomain', 'Easy_get_textdomain' ); /* Make text widgets and term descriptions shortcode aware. */ add_filter( 'widget_text', 'do_shortcode' ); add_filter( 'term_description', 'do_shortcode' ); } } ?>