Exemplo n.º 1
0
function gp_tmpl_load($template, $args = array())
{
    $args = gp_tmpl_filter_args($args);
    do_action_ref_array('pre_tmpl_load', array($template, &$args));
    require_once GP_TMPL_PATH . 'helper-functions.php';
    $file = GP_TMPL_PATH . "{$template}.php";
    if (is_readable($file)) {
        extract($args, EXTR_SKIP);
        include $file;
    }
    do_action_ref_array('post_tmpl_load', array($template, &$args));
}
Exemplo n.º 2
0
function gp_tmpl_load($template, $args = array(), $template_path = null)
{
    $args = gp_tmpl_filter_args($args);
    /**
     * Fires before a template is loaded.
     *
     * @since 1.0.0
     *
     * @param string $template The template name.
     * @param array  $args     Arguments passed to the template. Passed by reference.
     */
    do_action_ref_array('gp_pre_tmpl_load', array($template, &$args));
    require_once GP_TMPL_PATH . 'helper-functions.php';
    $locations = array(GP_TMPL_PATH);
    if (!is_null($template_path)) {
        array_unshift($locations, untrailingslashit($template_path) . '/');
    }
    /**
     * Filter the locations to load template files from.
     *
     * @since 1.0.0
     *
     * @param array       $locations     File paths of template locations.
     * @param string      $template      The template name.
     * @param array       $args          Arguments passed to the template.
     * @param string|null $template_path Priority template location, if any.
     */
    $locations = apply_filters('gp_tmpl_load_locations', $locations, $template, $args, $template_path);
    if (isset($args['http_status'])) {
        status_header($args['http_status']);
    }
    foreach ($locations as $location) {
        $file = $location . "{$template}.php";
        if (is_readable($file)) {
            extract($args, EXTR_SKIP);
            include $file;
            break;
        }
    }
    /**
     * Fires after a template was loaded.
     *
     * @since 1.0.0
     *
     * @param string $template The template name.
     * @param array  $args     Arguments passed to the template. Passed by reference.
     */
    do_action_ref_array('gp_post_tmpl_load', array($template, &$args));
}
Exemplo n.º 3
0
function gp_tmpl_load($template, $args = array(), $template_path = null)
{
    $args = gp_tmpl_filter_args($args);
    do_action_ref_array('pre_tmpl_load', array($template, &$args));
    require_once GP_TMPL_PATH . 'helper-functions.php';
    $locations = array(GP_TMPL_PATH);
    if (!is_null($template_path)) {
        array_unshift($locations, untrailingslashit($template_path) . '/');
    }
    $locations = apply_filters('tmpl_load_locations', $locations, $template, $args, $template_path);
    if (isset($args['http_status'])) {
        status_header($args['http_status']);
    }
    foreach ($locations as $location) {
        $file = $location . "{$template}.php";
        if (is_readable($file)) {
            extract($args, EXTR_SKIP);
            include $file;
            break;
        }
    }
    do_action_ref_array('post_tmpl_load', array($template, &$args));
}