/** * Print scripts * * @since 1.0 */ function edd_wl_print_scripts() { global $edd_options; // Use minified libraries if SCRIPT_DEBUG is turned off $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; // register scripts wp_register_script('edd-wl', EDD_WL_PLUGIN_URL . 'includes/js/edd-wl' . $suffix . '.js', array('jquery'), EDD_WL_VERSION, true); wp_register_script('edd-wl-validate', EDD_WL_PLUGIN_URL . 'includes/js/jquery.validate' . $suffix . '.js', array('jquery'), EDD_WL_VERSION, true); wp_register_script('edd-wl-modal', EDD_WL_PLUGIN_URL . 'includes/js/modal' . $suffix . '.js', array('jquery'), EDD_WL_VERSION, true); // load scripts on single post type pages $post_types = edd_wl_allowed_post_types(); foreach ($post_types as $post_type) { if (is_singular($post_type)) { wp_enqueue_script('edd-wl'); wp_enqueue_script('edd-wl-modal'); } } // load validation if email sharing is present if (edd_wl_is_page('view') && edd_wl_sharing_is_enabled('email')) { wp_enqueue_script('edd-wl-validate'); } wp_localize_script('edd-wl', 'edd_wl_scripts', array('wish_list_page' => edd_wl_get_wish_list_uri(), 'wish_list_add' => edd_wl_get_wish_list_create_uri(), 'ajax_nonce' => wp_create_nonce('edd_wl_ajax_nonce'))); // CSS $file = 'edd-wl' . $suffix . '.css'; $templates_dir = edd_get_theme_template_dir_name(); $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()) . $templates_dir . $file; $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()) . $templates_dir . 'edd-wl.css'; $parent_theme_style_sheet = trailingslashit(get_template_directory()) . $templates_dir . $file; $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()) . $templates_dir . 'edd-wl.css'; $edd_plugin_style_sheet = trailingslashit(edd_wl_get_templates_dir()) . $file; // Look in the child theme directory first, followed by the parent theme, followed by the EDD core templates directory // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. // This allows users to copy just edd-wl.css to their theme if (file_exists($child_theme_style_sheet) || !empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2))) { if (!empty($nonmin)) { $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . 'edd-wl.css'; } else { $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . $file; } } elseif (file_exists($parent_theme_style_sheet) || !empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2))) { if (!empty($nonmin)) { $url = trailingslashit(get_template_directory_uri()) . $templates_dir . 'edd-wl.css'; } else { $url = trailingslashit(get_template_directory_uri()) . $templates_dir . $file; } } elseif (file_exists($edd_plugin_style_sheet) || file_exists($edd_plugin_style_sheet)) { $url = trailingslashit(edd_wl_get_templates_url()) . $file; } wp_enqueue_style('edd-wl-styles', $url, array(), EDD_WL_VERSION, 'screen'); }
/** * Register Styles * * Checks the styles option and hooks the required filter. * * @since 1.0 * @return void */ function edd_register_styles() { if (edd_get_option('disable_styles', false)) { return; } // Use minified libraries if SCRIPT_DEBUG is turned off $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $file = 'edd' . $suffix . '.css'; $templates_dir = edd_get_theme_template_dir_name(); $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()) . $templates_dir . $file; $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()) . $templates_dir . 'edd.css'; $parent_theme_style_sheet = trailingslashit(get_template_directory()) . $templates_dir . $file; $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()) . $templates_dir . 'edd.css'; $edd_plugin_style_sheet = trailingslashit(edd_get_templates_dir()) . $file; // Look in the child theme directory first, followed by the parent theme, followed by the EDD core templates directory // Also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled. // This allows users to copy just edd.css to their theme if (file_exists($child_theme_style_sheet) || !empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2))) { if (!empty($nonmin)) { $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . 'edd.css'; } else { $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . $file; } } elseif (file_exists($parent_theme_style_sheet) || !empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2))) { if (!empty($nonmin)) { $url = trailingslashit(get_template_directory_uri()) . $templates_dir . 'edd.css'; } else { $url = trailingslashit(get_template_directory_uri()) . $templates_dir . $file; } } elseif (file_exists($edd_plugin_style_sheet) || file_exists($edd_plugin_style_sheet)) { $url = trailingslashit(edd_get_templates_url()) . $file; } wp_register_style('edd-styles', $url, array(), EDD_VERSION, 'all'); wp_enqueue_style('edd-styles'); if (edd_is_checkout() && is_ssl()) { // Dashicons are used to show the padlock icon on the credit card form wp_enqueue_style('dashicons'); } }
/** * Returns a list of paths to check for template locations * * @since 1.8.5 * @return mixed|void */ function edd_get_theme_template_paths() { $template_dir = edd_get_theme_template_dir_name(); $file_paths = array(1 => trailingslashit(get_stylesheet_directory()) . $template_dir, 10 => trailingslashit(get_template_directory()) . $template_dir, 100 => edd_get_templates_dir()); $file_paths = apply_filters('edd_template_paths', $file_paths); // sort the file paths based on priority ksort($file_paths, SORT_NUMERIC); return array_map('trailingslashit', $file_paths); }
/** * Load head styles * * Ensures download styling is still shown correctly if a theme is using the CSS template file * * @since 2.5 * @global $post * @return void */ function edd_load_head_styles() { global $post; if (edd_get_option('disable_styles', false) || !is_object($post)) { return; } // Use minified libraries if SCRIPT_DEBUG is turned off $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $file = 'edd' . $suffix . '.css'; $templates_dir = edd_get_theme_template_dir_name(); $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()) . $templates_dir . $file; $child_theme_style_sheet_2 = trailingslashit(get_stylesheet_directory()) . $templates_dir . 'edd.css'; $parent_theme_style_sheet = trailingslashit(get_template_directory()) . $templates_dir . $file; $parent_theme_style_sheet_2 = trailingslashit(get_template_directory()) . $templates_dir . 'edd.css'; $has_css_template = false; if (has_shortcode($post->post_content, 'downloads') && file_exists($child_theme_style_sheet) || file_exists($child_theme_style_sheet_2) || file_exists($parent_theme_style_sheet) || file_exists($parent_theme_style_sheet_2)) { $has_css_template = apply_filters('edd_load_head_styles', true); } if (!$has_css_template) { return; } ?> <style>.edd_download{float:left;}.edd_download_columns_1 .edd_download{width: 100%;}.edd_download_columns_2 .edd_download{width:50%;}.edd_download_columns_0 .edd_download,.edd_download_columns_3 .edd_download{width:33%;}.edd_download_columns_4 .edd_download{width:25%;}.edd_download_columns_5 .edd_download{width:20%;}.edd_download_columns_6 .edd_download{width:16.6%;}</style> <?php }