/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * @since presscore 1.0 */ function presscore_setup() { /** * Editor style. */ add_editor_style(); /** * Add default posts and comments RSS feed links to head */ add_theme_support( 'automatic-feed-links' ); /** * Enable support for Post Thumbnails */ add_theme_support( 'post-thumbnails' ); /** * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __( 'Primary Menu', LANGUAGE_ZONE ), 'top' => __( 'Top Menu', LANGUAGE_ZONE ), 'bottom' => __( 'Bottom Menu', LANGUAGE_ZONE ), ) ); /** * Enable support for Post Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'chat', 'status' ) ); /** * Allow shortcodes in widgets. * */ add_filter( 'widget_text', 'do_shortcode' ); // create upload dir wp_upload_dir(); /** * Include AQResizer. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/aq_resizer.php' ); /** * Include core functions. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/core-functions.php' ); /** * Include stylesheet related functions. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/stylesheet-functions.php' ); /** * Include options framework if it is not installed like plugin. * */ if ( !defined('OPTIONS_FRAMEWORK_VERSION') ) { // Base require_once( PRESSCORE_EXTENSIONS_DIR . '/options-framework/options-framework.php' ); if ( current_user_can( 'edit_theme_options' ) ) { // add theme options add_filter( 'options_framework_location', 'presscore_add_theme_options' ); } } /** * Include custom post typest. * */ require_once( PRESSCORE_DIR . '/post-types.php' ); if ( !class_exists('Mobile_Detect') ) { /** * Mobile detection library. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/mobile-detect.php' ); } /** * Some additional classes ( remove in future ). * */ require_once( PRESSCORE_CLASSES_DIR . '/tags.class.php' ); /** * Include helpers. * */ require_once( PRESSCORE_DIR . '/helpers.php' ); $current_page_name = dt_get_current_page_name(); $is_backend = is_admin() || dt_is_login_page(); if ( function_exists('vc_is_inline') && vc_is_inline() ) { $is_backend = false; } /** * Include admin functions. * */ if ( $is_backend && is_admin() ) { /** * Include the TGM_Plugin_Activation class. */ require_once( PRESSCORE_EXTENSIONS_DIR . '/class-tgm-plugin-activation.php' ); // include only for theme update page if ( 'admin.php' == $current_page_name && !empty($_GET['page']) && 'of-themeupdate-menu' == $_GET['page'] ) { /** * Update library. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/envato-wordpress-toolkit-library/class-envato-wordpress-theme-upgrader.php' ); } /** * Attach metaboxes. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/meta-box.php' ); if ( $located_file = locate_template( 'inc/admin/metaboxes.php' ) ) { include_once( $located_file ); } require_once( PRESSCORE_ADMIN_DIR . '/admin-functions.php' ); } else if ( !$is_backend ) { /** * Include custom menu. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/core-menu.php' ); /** * Include template actions and filters. * */ require_once( PRESSCORE_DIR . '/template-tags.php' ); /** * Include paginator. * */ require_once( PRESSCORE_EXTENSIONS_DIR . '/dt-pagination.php' ); } /** * Include widgets. * */ /* Widgets list */ $presscore_widgets = array( 'contact-info.php', 'custom-menu-1.php', 'custom-menu-2.php', 'blog-posts.php', 'blog-categories.php', 'flickr.php', 'portfolio.php', 'progress-bars.php', 'testimonials-list.php', 'testimonials-slider.php', 'team.php', 'logos.php', 'photos.php', 'contact-form.php', 'accordion.php', ); $presscore_widgets = apply_filters( 'presscore_widgets', $presscore_widgets ); // include widgets only for frontend and widgets admin page if ( $presscore_widgets && ( in_array($current_page_name, array('widgets.php', 'admin-ajax.php', 'themes.php')) || !$is_backend ) ) { foreach ( $presscore_widgets as $presscore_widget ) { if ( $file_path = locate_template( 'inc/widgets/' . $presscore_widget ) ) { require_once( $file_path ); } } } // List of shortcodes folders to include // All folders located in /include $presscore_shortcodes = array( 'columns', 'box', 'gap', 'divider', 'stripes', 'fancy-image', 'list', 'button', 'tooltips', 'highlight', 'code', 'tabs', 'accordion', 'toggles', 'quote', 'call-to-action', 'shortcode-teasers', 'banner', 'benefits', 'progress-bars', 'contact-form', 'social-icons', 'map', 'blog-posts-small', 'blog-posts', 'portfolio', 'portfolio-jgrid', 'portfolio-slider', 'small-photos', 'slideshow', 'team', 'testimonials', 'logos', 'gallery', 'animated-text', 'list-vc', 'benefits-vc', 'fancy-video-vc', 'fancy-titles-vc', 'fancy-separators-vc' ); $presscore_shortcodes = apply_filters( 'presscore_shortcodes', $presscore_shortcodes ); // include shortcodes only for frontend and post admin pages if ( $presscore_shortcodes && ( in_array( $current_page_name, array('post.php', 'post-new.php', 'admin-ajax.php') ) || !$is_backend ) ) { /** * Setup shortcodes. * */ require_once( PRESSCORE_SHORTCODES_DIR . '/setup.php' ); foreach ( $presscore_shortcodes as $shortcode_dirname ) { include_once( PRESSCORE_SHORTCODES_INCLUDES_DIR . '/' . $shortcode_dirname . '/functions.php' ); } } if ( apply_filters( 'presscore_enable_theme_mega_menu', true ) ) { include PRESSCORE_CLASSES_DIR . '/mega-menu.class.php'; $mega_menu = new Dt_Mega_menu(); } /** * Add woocommerce support. * */ if ( class_exists( 'Woocommerce' ) && $file_path = locate_template( 'inc/mod-woocommerce/mod-woocommerce.php' ) ) { require_once( $file_path ); } if ( class_exists('UberMenu') ) { /** * Add ubermenu support. * */ require_once( PRESSCORE_DIR . '/mod-ubermenu/mod-ubermenu.php' ); } // if Layer and Revolution sliders both active if ( defined('LS_PLUGIN_VERSION') && class_exists('UniteBaseClassRev') ) { /** * Layer slider compatibility settings. * */ require_once( PRESSCORE_DIR . '/mod-layerslider/mod-layerslider.php' ); } if ( defined('W3TC') && W3TC && defined('W3TC_DYNAMIC_SECURITY') && W3TC_DYNAMIC_SECURITY ) { /** * Total Cache settings. * */ require_once( PRESSCORE_DIR . '/mod-totalcache/mod-totalcache.php' ); } if ( function_exists('wp_cache_is_enabled') && wp_cache_is_enabled() && function_exists('add_cacheaction') ) { /** * Super cache settings. * */ require_once( PRESSCORE_DIR . '/mod-supercache/mod-supercache.php' ); } if ( class_exists('SitePress') ) { /** * WPML tricks. * */ require_once( PRESSCORE_DIR . '/mod-wpml/mod-wpml.php' ); } if ( class_exists('PG_Walker_Nav_Menu_Edit_Custom') ) { require_once( PRESSCORE_DIR . '/mod-private-content/mod-private-content.php' ); } // the events calendar mod if ( class_exists('TribeEvents') ) { require_once( PRESSCORE_DIR . '/mod-the-events-calendar/mod-the-events-calendar.php' ); } ///////////// // Jetpack // ///////////// if ( class_exists( 'Jetpack', false ) ) { include_once locate_template( 'inc/mod-jetpack/mod-jetpack.php' ); } }
///////////////////////////////////////// // Layer slider compatibility settings // ///////////////////////////////////////// if (defined('LS_PLUGIN_VERSION') && class_exists('UniteBaseClassRev')) { include_once locate_template('inc/mods/mod-layerslider/mod-layerslider.php'); } ///////////////// // Total Cache // ///////////////// if (defined('W3TC') && W3TC && defined('W3TC_DYNAMIC_SECURITY') && W3TC_DYNAMIC_SECURITY) { include_once locate_template('inc/mods/mod-totalcache/mod-totalcache.php'); } ///////////////// // Super Cache // ///////////////// if (function_exists('wp_cache_is_enabled') && wp_cache_is_enabled() && function_exists('add_cacheaction')) { include_once locate_template('inc/mods/mod-supercache/mod-supercache.php'); } ////////// // WPML // ////////// if (class_exists('SitePress', false)) { include_once locate_template('inc/mods/mod-wpml/mod-wpml.php'); } ///////////////////// // Private content // ///////////////////// if (class_exists('PG_Walker_Nav_Menu_Edit_Custom', false)) { include_once locate_template('inc/mods/mod-private-content/mod-private-content.php'); } /////////////////////////
function wp_cache_manager() { global $wp_cache_config_file, $valid_nonce; $valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache'); echo '<div class="wrap">'; echo "<h2>WP-Cache Manager</h2>\n"; if (isset($_REQUEST['wp_restore_config']) && $valid_nonce) { unlink($wp_cache_config_file); echo '<strong>Configuration file changed, some values might be wrong. Load the page again from the "Options" menu to reset them.</strong>'; } echo '<a name="main"></a><fieldset class="options"><legend>Main options</legend>'; if (!wp_cache_check_link() || !wp_cache_verify_config_file() || !wp_cache_verify_cache_dir()) { echo "<br>Cannot continue... fix previous problems and retry.<br />"; echo "</fieldset></div>\n"; return; } if (!wp_cache_check_global_config()) { echo "</fieldset></div>\n"; return; } if ($valid_nonce) { if (isset($_REQUEST['wp_enable'])) { wp_cache_enable(); } elseif (isset($_REQUEST['wp_disable'])) { wp_cache_disable(); } } echo '<form name="wp_manager" action="' . $_SERVER["REQUEST_URI"] . '" method="post">'; if (wp_cache_is_enabled()) { echo '<strong>WP-Cache is Enabled</strong>'; echo '<input type="hidden" name="wp_disable" />'; echo '<div class="submit"><input type="submit"value="Disable it" /></div>'; } else { echo '<strong>WP-Cache is Disabled</strong>'; echo '<input type="hidden" name="wp_enable" />'; echo '<div class="submit"><input type="submit" value="Enable it" /></div>'; } wp_nonce_field('wp-cache'); echo "</form>\n"; wp_cache_edit_max_time(); echo '</fieldset>'; echo '<a name="files"></a><fieldset class="options"><legend>Accepted filenames, rejected URIs</legend>'; wp_cache_edit_rejected(); echo "<br />\n"; wp_cache_edit_accepted(); echo '</fieldset>'; wp_cache_edit_rejected_ua(); wp_cache_files(); wp_cache_restore(); echo "</div>\n"; }