/** * Enqueue scripts and styles. */ function vca_enqueue_styles_scripts() { /** * Only load styles and scripts when necessary. * Don't bloat front-end. */ if (false === apply_filters('village_client_area/load_scripts', is_village_client_area())) { return; } $url_base = VCA()->plugin_url(); /*! * Enqueue Styles * */ wp_enqueue_style('client-area-style', $url_base . '/resources/build/client-area.css'); /*! * * Enqueue Scripts * */ // List of required JS Libs $libs = apply_filters('village_client_libs', array('imagesloaded', 'masonry', 'wp_js_hooks', 'velocity')); // Enqueue all required libraries foreach ($libs as $lib_name) { $handle = 'village-' . $lib_name; $url = $url_base . '/resources/libs/' . $lib_name . '.js'; wp_enqueue_script($handle, $url, array('jquery', 'underscore'), VCA()->version, true); } // Enqueue Client Area Script wp_enqueue_script('village-client-area', $url_base . '/resources/build/client-area.js', array('jquery'), VCA()->version, true); // Add "window.ajax_object.ajax_url" to frontend wp_localize_script('village-client-area', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php'))); }
/** * comments_template_loader function. * * @param mixed $template * @return string */ public static function comments_template_loader($template) { if (get_post_type() !== '') { return $template; } $check_dirs = array(trailingslashit(get_stylesheet_directory()) . VCA()->template_path(), trailingslashit(get_template_directory()) . VCA()->template_path(), trailingslashit(get_stylesheet_directory()), trailingslashit(get_template_directory()), trailingslashit(VCA()->plugin_path()) . 'templates/'); foreach ($check_dirs as $dir) { if (file_exists(trailingslashit($dir) . 'client-comments.php')) { return trailingslashit($dir) . 'client-comments.php'; } } }
function vca_locate_template($slug, $name = null) { $template = ""; // Look in yourtheme/slug-name.php and yourtheme/client-area/slug-name.php if ($name) { $template = locate_template(array("{$slug}-{$name}.php", VCA()->template_path() . "{$slug}-{$name}.php")); } // Get plugin path slug-name.php if (!$template && $name && file_exists(VCA()->plugin_path() . "/templates/{$slug}-{$name}.php")) { $template = VCA()->plugin_path() . "/templates/{$slug}-{$name}.php"; } // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/woocommerce/slug.php if (!$template) { $template = locate_template(array("{$slug}.php", VCA()->template_path() . "{$slug}.php")); } // Get fallback slug.php if (!$template && !$name && file_exists(VCA()->plugin_path() . "/templates/{$slug}.php")) { $template = VCA()->plugin_path() . "/templates/{$slug}.php"; } return $template; }
<?php $sections = array(); $args = array(); // ------------------------ // Tab: Advanced // ------------------------ $sections[] = array('title' => esc_html__('General', 'village-ca'), 'icon' => 'el-icon-wrench', 'fields' => array(array('id' => "client_area_page", 'title' => esc_html__("Client area archive page", 'village-ca'), 'subtitle' => esc_html__("In which page to list all client galleries ?", 'village-ca'), 'type' => 'select', 'data' => 'pages', 'required' => 0), array('id' => "enable_favorites", 'title' => esc_html__("Enable Favorites", 'village-ca'), 'subtitle' => esc_html__("Let your clients pick their favorite images ?", 'village-ca'), 'type' => 'switch', 'default' => '1'), array('id' => "enable_comments", 'title' => esc_html__("Enable Comments", 'village-ca'), 'subtitle' => esc_html__("Display comment area ?", 'village-ca'), 'type' => 'switch', 'default' => '1'), array('id' => "enable_smart_tags", 'title' => esc_html__("Enable Smart Tags", 'village-ca'), 'subtitle' => esc_html__("Enable hoverable image number tags ?", 'village-ca'), 'type' => 'switch', 'default' => '1'), array('id' => "image_name_type", 'title' => esc_html__("Image Name", 'village-ca'), 'subtitle' => 'Show additional image info', 'type' => 'select', 'options' => array('none' => "Disable", 'title' => 'Show image title', 'filename' => 'Show image filename'), 'default' => 'none'))); //-----------------------------------*/ // Initialize Redux: //-----------------------------------*/ $args['display_name'] = 'Village Client Area'; $args['display_version'] = VCA()->version; $args['menu_title'] = esc_html__("Settings", 'village-ca'); $args['page_slug'] = 'village-client'; $args['menu_type'] = 'submenu'; $args['page_parent'] = 'edit.php?post_type=client_gallery'; // Disable Redux CSS Output $args['output'] = false; $args['dev_mode'] = false; $args['share_icons'][] = array('url' => 'http://twitter.com/Theme_Village', 'title' => 'Follow us on Twitter', 'icon' => 'el-icon-twitter'); $args['share_icons'][] = array('url' => 'http://www.facebook.com/themevillage.net', 'title' => 'Like us on Facebook', 'icon' => 'el-icon-facebook'); $args = apply_filters('ca_redux_args', $args); $sections = apply_filters('ca_redux_sections', $sections); Redux::setArgs(CA_Option::$key, $args); CA_Options_Parser::set_sections(CA_Option::$key, $sections);
*/ if (!defined('ABSPATH')) { exit; } /** * Deactivate client area post type plugin that was bundled with older ThemeVillage themes. * @since 1.0.0 * @TODO : * + remove at v1.2.0 */ if (is_admin()) { include_once ABSPATH . 'wp-admin/includes/plugin.php'; $legacy_vca_plugin = 'village-client-area-post-type/village-client-area-post-type.php'; if (is_plugin_active($legacy_vca_plugin)) { deactivate_plugins($legacy_vca_plugin); } } function village_client_area_initialize() { $domain = 'village-ca'; // The "plugin_locale" filter is also used in load_plugin_textdomain() $locale = apply_filters('plugin_locale', get_locale(), $domain); load_textdomain($domain, WP_LANG_DIR . '/village-ca/' . $domain . '-' . $locale . '.mo'); load_plugin_textdomain($domain, false, dirname(plugin_basename(__FILE__)) . '/languages/'); } add_action('plugins_loaded', 'village_client_area_initialize'); require_once 'Village_Client_Area.php'; // Initialize do_action('before_vca_init'); VCA(); do_action('vca_init');