Пример #1
0
/**
 * Register Styles
 *
 * Checks the styles option and hooks the required filter.
 *
 * @access      private
 * @since       1.0
 * @return      void
*/
function edd_register_styles()
{
    global $edd_options;
    if (isset($edd_options['disable_styles'])) {
        return;
    }
    $file = 'edd.css';
    if (file_exists(trailingslashit(get_stylesheet_directory()) . 'edd_templates/' . $file)) {
        $url = trailingslashit(get_stylesheet_directory_uri()) . 'edd_templates/' . $file;
    } elseif (file_exists(trailingslashit(get_template_directory()) . 'edd_templates/' . $file)) {
        $url = trailingslashit(get_template_directory_uri()) . 'edd_templates/' . $file;
    } elseif (file_exists(trailingslashit(edd_get_templates_dir()) . $file)) {
        $url = trailingslashit(edd_get_templates_url()) . $file;
    }
    wp_enqueue_style('edd-styles', $url, EDD_VERSION);
}
Пример #2
0
/**
 * 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');
    }
}
/**
 * Register Styles
 *
 * Checks the styles option and hooks the required filter.
 *
 * @since 1.0
 * @global $edd_options
 * @return void
 */
function edd_register_styles()
{
    global $edd_options;
    if (isset($edd_options['disable_styles'])) {
        return;
    }
    // Use minified libraries if SCRIPT_DEBUG is turned off
    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
    $file = 'edd' . $suffix . '.css';
    $templates_dir = 'edd_templates/';
    $child_theme_style_sheet = trailingslashit(get_stylesheet_directory()) . $templates_dir . $file;
    $parent_theme_style_sheet = trailingslashit(get_template_directory()) . $templates_dir . $file;
    $edd_plugin_style_sheet = trailingslashit(edd_get_templates_dir()) . $file;
    // If not debugging and .min.css exists in preferred directory, use it. Otherwise, if .css exists in the preferred directory, use it.
    // If still nothing found, try the next directory.
    if ($suffix && file_exists($child_theme_style_sheet) || file_exists($child_theme_style_sheet)) {
        $url = trailingslashit(get_stylesheet_directory_uri()) . $templates_dir . $file;
    } elseif ($suffix && file_exists($parent_theme_style_sheet) || file_exists($parent_theme_style_sheet)) {
        $url = trailingslashit(get_template_directory_uri()) . $templates_dir . $file;
    } elseif ($suffix && file_exists($edd_plugin_style_sheet) || file_exists($edd_plugin_style_sheet)) {
        $url = trailingslashit(edd_get_templates_url()) . $file;
    }
    wp_enqueue_style('edd-styles', $url, array(), EDD_VERSION);
}
/**
 * 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);
}
/**
 * Retrieve the name of the highest priority template file that exists.
 *
 * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
 * inherit from a parent theme can just overload one file. If the template is
 * not found in either of those, it looks in the theme-compat folder last.
 *
 * Taken from bbPress
 *
 * @since v1.2
 *
 * @param string|array $template_names Template file(s) to search for, in order.
 * @param bool $load If true the template file will be loaded if it is found.
 * @param bool $require_once Whether to require_once or require. Default true.
 *                            Has no effect if $load is false.
 * @return string The template filename if one is located.
 */
function edd_locate_template($template_names, $load = false, $require_once = true)
{
    // No file found yet
    $located = false;
    // Try to find a template file
    foreach ((array) $template_names as $template_name) {
        // Continue if template is empty
        if (empty($template_name)) {
            continue;
        }
        // Trim off any slashes from the template name
        $template_name = ltrim($template_name, '/');
        // Check child theme first
        if (file_exists(trailingslashit(get_stylesheet_directory()) . 'edd_templates/' . $template_name)) {
            $located = trailingslashit(get_stylesheet_directory()) . 'edd_templates/' . $template_name;
            break;
            // Check parent theme next
        } elseif (file_exists(trailingslashit(get_template_directory()) . 'edd_templates/' . $template_name)) {
            $located = trailingslashit(get_template_directory()) . 'edd_templates/' . $template_name;
            break;
            // Check theme compatibility last
        } elseif (file_exists(trailingslashit(edd_get_templates_dir()) . $template_name)) {
            $located = trailingslashit(edd_get_templates_dir()) . $template_name;
            break;
        }
    }
    if (true == $load && !empty($located)) {
        load_template($located, $require_once);
    }
    return $located;
}
Пример #6
0
function edd_downloads_downloads_history_shortcode($atts, $content = null)
{
    if (is_user_logged_in()) {
        $action = isset($_REQUEST['action']) ? esc_html($_REQUEST['action']) : '';
        if ($action == '') {
            require plugin_dir_path(__FILE__) . "template/downloads_history.php";
        }
    } else {
        global $edd_login_redirect;
        $edd_login_redirect = get_permalink();
        require edd_get_templates_dir() . "/shortcode-login.php";
    }
}