Example #1
0
function cps_ban_check()
{
    if (!is_user_logged_in()) {
        return;
    }
    global $current_user;
    if (is_multisite()) {
        if (empty($current_user->roles)) {
            load_template(dirname(__FILE__) . '/wp_ban_cps_ms_alert.php');
        }
        foreach ($current_user->roles as $role) {
            if ($role == 'banned') {
                load_template(dirname(__FILE__) . '/wp_ban_cps_ms_alert.php');
            }
        }
    } else {
        foreach ($current_user->roles as $role) {
            if ($role == 'banned') {
                wp_clear_auth_cookie();
                do_action('wp_logout');
                wp_redirect(home_url());
                exit;
            }
        }
    }
}
 /**
  * Locates and renders the album based on the template
  * Will look in the following locations
  *  wp-content/themes/{child-theme}/foogallery/album-{template}.php
  *    wp-content/themes/{theme}/foogallery/album-{template}.php
  *  wp-content/plugins/foogallery/templates/album-{template}.php
  *
  * @param $args array       Arguments passed in from the shortcode
  */
 public function render_template($args)
 {
     //do some work before we locate the template
     global $current_foogallery_album;
     global $current_foogallery_album_arguments;
     global $current_foogallery_album_template;
     //set the arguments
     $current_foogallery_album_arguments = $args;
     //load our album
     $current_foogallery_album = $this->find_album($args);
     if (false === $current_foogallery_album) {
         _e('Could not load the album!', 'foogallery');
         return;
     }
     //find the gallery template we will use to render the gallery
     $current_foogallery_album_template = $this->get_arg($args, 'template', $current_foogallery_album->album_template);
     //set a default if we have no gallery template
     if (empty($current_foogallery_album_template)) {
         $current_foogallery_album_template = foogallery_get_default('album_template');
     }
     //if we still have not default, then use the first one we can find
     if (empty($current_foogallery_album_template)) {
         $available_templates = foogallery_album_templates();
         $current_foogallery_album_template = $available_templates[0]['slug'];
     }
     //check if we have any galleries
     if (!$current_foogallery_album->has_galleries()) {
         //no galleries!
         do_action("foogallery_album_template_no_galleries-({$current_foogallery_album_template})", $current_foogallery_album);
     } else {
         //create locator instance
         $instance_name = FOOGALLERY_SLUG . '_album_templates';
         $loader = new Foo_Plugin_File_Locator_v1($instance_name, FOOGALLERY_FILE, 'templates', FOOGALLERY_SLUG);
         //allow extensions to very easily add pickup locations for their files
         $this->add_extension_pickup_locations($loader, apply_filters($instance_name . '_files', array()));
         if (false !== ($template_location = $loader->locate_file("album-{$current_foogallery_album_template}.php"))) {
             //we have found a template!
             do_action('foogallery_located_album_template', $current_foogallery_album);
             do_action("foogallery_located_album_template-{$current_foogallery_album_template}", $current_foogallery_album);
             //try to include some JS
             if (false !== ($js_location = $loader->locate_file("album-{$current_foogallery_album_template}.js"))) {
                 wp_enqueue_script("foogallery-album-template-{$current_foogallery_album_template}", $js_location['url']);
             }
             //try to include some CSS
             if (false !== ($css_location = $loader->locate_file("album-{$current_foogallery_album_template}.css"))) {
                 wp_enqueue_style("foogallery-album-template-{$current_foogallery_album_template}", $css_location['url']);
             }
             //finally include the actual php template!
             if ($template_location) {
                 load_template($template_location['path'], false);
             }
             //we have loaded all files, now let extensions do some stuff
             do_action("foogallery_loaded_album_template", $current_foogallery_album);
             do_action("foogallery_loaded_album_template-({$current_foogallery_album_template})", $current_foogallery_album);
         } else {
             //we could not find a template!
             _e('No album template found!', 'foogallery');
         }
     }
 }
 static function issues_handler()
 {
     if (strtok($_SERVER["REQUEST_URI"], '?') == '/issues') {
         load_template(plugin_dir_path(__FILE__) . 'page-issues.php');
         exit;
     }
 }
function nimbus_cotizador($atts, $content)
{
    extract($atts);
    set_query_var('success', $action);
    $template = locate_template("/templates/quote.php");
    load_template($template);
}
Example #5
0
/**
 * Retrieve the name of the highest priority template file that exists.
 */
function popmake_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, '/');
        // try locating this template file by looping through the template paths
        foreach (popmake_get_theme_template_paths() as $template_path) {
            if (file_exists($template_path . $template_name)) {
                $located = $template_path . $template_name;
                break;
            }
        }
        if ($located) {
            break;
        }
    }
    if (true == $load && !empty($located)) {
        load_template($located, $require_once);
    }
    return $located;
}
 static function search_handler()
 {
     if (strtok($_SERVER["REQUEST_URI"], '?') == '/search') {
         load_template(plugin_dir_path(__FILE__) . 'page-search.php');
         exit;
     }
     if (strtok($_SERVER["REQUEST_URI"], '?') == '/search-request') {
         $search_options = array('s' => $_GET['s'], 'post_type' => 'post');
         if ($_GET['cat']) {
             $search_options['cat'] = get_category_by_slug($_GET['cat'])->term_id;
         }
         if ($_GET['author']) {
             $search_options['author_name'] = $_GET['author'];
         }
         $search_options['paged'] = $_GET['page'] ? $_GET['page'] : 1;
         $search_options['posts_per_page'] = 3;
         $searched_posts = new WP_Query($search_options);
         $show_more_link = $searched_posts->max_num_pages > $search_options['paged'];
         if ($search_options['paged'] > 1) {
             include 'search-more.php';
         } else {
             include 'search.php';
         }
         exit;
     }
 }
/**
 * Load template files of the plugin also include a filter pn_get_template_part<br>
 * Based on WooCommerce function<br>
 *
 * @package   Plugin_Name
 * @author  Mte90 <*****@*****.**>
 * @license   GPL-2.0+
 * @copyright 2014-2015
 * @since    1.0.0
 */
function pn_get_template_part($slug, $name = '', $include = true)
{
    $template = '';
    $path = plugin_dir_path(realpath(dirname(__FILE__))) . 'templates/';
    $plugin = Plugin_Name::get_instance();
    $plugin_slug = $plugin->get_plugin_slug() . '/';
    // Look in yourtheme/slug-name.php and yourtheme/plugin-name/slug-name.php
    if ($name) {
        $template = locate_template(array("{$slug}-{$name}.php", $plugin_slug . "{$slug}-{$name}.php"));
    } else {
        $template = locate_template(array("{$slug}.php", $plugin_slug . "{$slug}.php"));
    }
    // Get default slug-name.php
    if (!$template && $name && file_exists($path . "{$slug}-{$name}.php")) {
        $template = $path . "{$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", $plugin_slug . "{$slug}.php"));
    }
    // Allow 3rd party plugin filter template file from their plugin
    $template = apply_filters('pn_get_template_part', $template, $slug, $name);
    if ($template && $include === true) {
        load_template($template, false);
    } else {
        if ($template && $include === false) {
            return $template;
        }
    }
}
 public function locate_template($template_names, $load = false, $require_once = true)
 {
     // No file found yet
     $located = false;
     // Traverse through template files
     foreach ((array) $template_names as $template_name) {
         // Continue if template is empty
         if (empty($template_name)) {
             continue;
         }
         $template_name = ltrim($template_name, '/');
         // Check templates for frontend section
         if (file_exists(trailingslashit(upme_path) . 'templates/cards/' . $template_name)) {
             $located = trailingslashit(upme_path) . 'templates/cards/' . $template_name;
             break;
             // Check templates for admin section
         } elseif (file_exists(trailingslashit(upme_path) . 'admin/templates/' . $template_name)) {
             $located = trailingslashit(upme_path) . 'admin/templates/' . $template_name;
             break;
         } else {
             /* Enable additional template locations using filters for addons */
             $template_locations = apply_filters('upme_template_loader_locations', array());
             foreach ($template_locations as $location) {
                 if (file_exists($location . $template_name)) {
                     $located = $location . $template_name;
                     break;
                 }
             }
         }
     }
     if (true == $load && !empty($located)) {
         load_template($located, $require_once);
     }
     return $located;
 }
/**
 * Retrieve the name of the highest priority template file that exists.
 *
 * Searches the child theme first, then the parent theme before checking the plug-in templates folder.
 * So parent themes can override the default plug-in templates, and child themes can over-ride both.
 *
 * Behaves almost identically to `{@see locate_template()}` 
 *
 * @since 1.7
 *
 * @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 eo_locate_template($template_names, $load = false, $require_once = true)
{
    $located = '';
    $template_dir = get_stylesheet_directory();
    //child theme
    $parent_template_dir = get_template_directory();
    //parent theme
    $stack = apply_filters('eventorganiser_template_stack', array($template_dir, $parent_template_dir, EVENT_ORGANISER_DIR . 'templates'));
    $stack = array_unique($stack);
    foreach ((array) $template_names as $template_name) {
        if (!$template_name) {
            continue;
        }
        foreach ($stack as $template_stack) {
            if (file_exists(trailingslashit($template_stack) . $template_name)) {
                $located = trailingslashit($template_stack) . $template_name;
                break;
            }
        }
    }
    if ($load && '' != $located) {
        load_template($located, $require_once);
    }
    return $located;
}
Example #10
0
 /**
  * The callback function used by spl_autoload_register
  * @param $class_name string - The class name
  */
 private function loading_classes($class_name)
 {
     $path_regex = 'td';
     // foreach regex path, the class name is verified for a start matching
     if (strpos($class_name, $path_regex) !== false and strpos($class_name, $path_regex) === 0) {
         $class_settings = td_api_base::get_by_id($class_name);
         if (!empty($class_settings)) {
             if (array_key_exists('file', $class_settings)) {
                 $class_file_path = $class_settings['file'];
                 if (isset($class_file_path) and !empty($class_file_path)) {
                     // set the autoloaded key for that component
                     td_api_base::_debug_set_class_is_autoloaded($class_name);
                     //	                    if ($class_name == 'td_page_views') {
                     //		                    print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 4)); //return only 4 call stack frames
                     //		                    die;
                     //	                    }
                     // require_once($class_file_path); - we need to use load_template to make our single_templates work like wordpress
                     // with load_template we prepare the globals ($post etc for the files)
                     // we should not use the global $post or any other globals in our classes without explicit declaration
                     load_template($class_file_path, true);
                 }
             } else {
                 td_util::error(__FILE__, "Missing parameter: 'file'");
             }
         }
     }
 }
Example #11
0
    public function gerenciar_auditoria()
    {
        $this->load->library('table');
        //vai carregar o modulo usuarios e mostrar a tela de recuperação de senha
        set_tema('headerinc', load_css('dataTables.bootstrap.min'), FALSE);
        set_tema('headerinc', load_css('responsive.bootstrap.min'), FALSE);
        set_tema('headerinc', load_css('ionicons.min', 'css/ionicons/css'), FALSE);
        set_tema('footerinc', load_js('jquery.dataTables'), FALSE);
        set_tema('footerinc', load_js('dataTables.bootstrap.min'), FALSE);
        set_tema('footerinc', load_js('dataTables.responsive.min'), FALSE);
        set_tema('footerinc', load_js('table-manage-responsive-auditoria.min'), FALSE);
        set_tema('footerinc', load_js('tooltip'), FALSE);
        set_tema('footerinc', '<script>
		$(document).ready(function() {
			App.init();
			TableManageResponsive.init();
                        $(\'[data-toggle="tooltip"]\').tooltip();   
		});
	</script>', FALSE);
        set_tema('titulo', 'Registros da Auditoria');
        set_tema('conteudo', load_modulo('auditoria', 'gerenciar_auditoria'));
        set_tema('rodape', '');
        //vai substituir o rodape padrao
        load_template();
    }
function bppp_locate_template($template_names, $load = false, $require_once = false)
{
    $located = '';
    foreach ((array) $template_names as $template_name) {
        if (!$template_name) {
            continue;
        }
        if (file_exists(STYLESHEETPATH . '/' . $template_name)) {
            $located = STYLESHEETPATH . '/' . $template_name;
            break;
        } else {
            if (file_exists(TEMPLATEPATH . '/' . $template_name)) {
                $located = TEMPLATEPATH . '/' . $template_name;
                break;
            } else {
                if (file_exists(BuddyPress_Profile_Progression()->templates_dir . $template_name)) {
                    $located = BuddyPress_Profile_Progression()->templates_dir . $template_name;
                    break;
                }
            }
        }
    }
    if ($load && '' != $located) {
        load_template($located, $require_once);
    }
    return $located;
}
/**
 * Pronamic framework edit post
 */
function pronamic_framework_shortcode_edit_post_form($atts, $content = null)
{
    $result = '';
    if (is_user_logged_in()) {
        $post_id = filter_input(INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT);
        // Post
        $post = get_post($post_id);
        $post_type = get_post_type($post_id);
        $post_type_object = get_post_type_object($post_type);
        if ($post_type_object) {
            if (current_user_can($post_type_object->cap->edit_posts, $post_id)) {
                // Query start
                global $wp_query;
                $query = array('p' => $post_id, 'post_type' => 'any');
                $original_query = $wp_query;
                $wp_query = null;
                $wp_query = new WP_Query($query);
                // Template
                ob_start();
                $template = plugin_dir_path(Pronamic_Framework::$file) . '/templates/edit-post-form.php';
                load_template($template, false);
                $result = ob_get_clean();
                // Query end
                $wp_query = null;
                $wp_query = $original_query;
                wp_reset_postdata();
            }
        }
    }
    return $result;
}
Example #14
0
/**
 * This function locates and loads templates based on arguments. Optionally an array of data can be passed
 * that will be extract()ed and the template will have access to the $data. If data is passed, WordPress
 * global variables can be included as well. The template file can also be required once if necessary.
 *
 * Verify if the file exists in the theme first, then load the plugin template if necessary as a fallback.
 */
function note_get_template_part($slug, $name = '', $data = array(), $wp_globals = false, $require_once = false)
{
    // note_get_template_part filter
    $template = apply_filters('note_get_template_part', note_locate_template_part($slug, $name), $slug, $name);
    // Finally, if we have a template, lets load it
    if ($template) {
        // If data was passed we have to require() the files
        if (is_array($data) && !empty($data)) {
            $data = apply_filters('note_get_template_part_data', $data, $slug, $name);
            // WordPress Globals
            if ($wp_globals) {
                global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
            }
            // Extract the data for use in the template
            extract($data, EXTR_SKIP);
            // Skip collisions
            unset($data);
            // We don't need the $data var anymore
            // Require Once
            if ($require_once) {
                require_once $template;
            } else {
                require $template;
            }
        } else {
            load_template($template, $require_once);
        }
    }
}
Example #15
0
 public function vermensagem()
 {
     esta_logado();
     set_tema('titulo', 'Visualizar Mensagens');
     set_tema('conteudo', load_modulo('contatos', 'vermensagem'));
     load_template();
 }
/**
 * Retrieve the name of the highest priority template file that exists.
 *
 * Searches in the SS_FRAMEWORK before STYLESHEETPATH and then on TEMPLATEPATH so that themes which
 * inherit from a parent theme can just overload one file.
 *
 * @since 2.7.0
 *
 * @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 ss_locate_template($template_names, $load = false, $require_once = true)
{
    $located = '';
    foreach ((array) $template_names as $template_name) {
        if (!$template_name) {
            continue;
        }
        if (file_exists(SS_FRAMEWORK_PATH . '/' . $template_name)) {
            $located = SS_FRAMEWORK_PATH . '/' . $template_name;
            break;
        } elseif (file_exists(STYLESHEETPATH . '/' . $template_name)) {
            $located = STYLESHEETPATH . '/' . $template_name;
            break;
        } else {
            if (file_exists(TEMPLATEPATH . '/' . $template_name)) {
                $located = TEMPLATEPATH . '/' . $template_name;
                break;
            }
        }
    }
    if ($load && '' != $located) {
        load_template($located, $require_once);
    }
    return $located;
}
Example #17
0
    public function gerenciar_configuracoes()
    {
        esta_logado(TRUE);
        if ($this->input->post('salvar')) {
            if (verifica_adm(TRUE)) {
                $upload = $this->midia_model->fazer_upload('arquivo');
                $configuracoes = elements(array('nome_site', 'url_logomarca', 'email_adm'), $this->input->post());
                foreach ($configuracoes as $nome_config => $valor_config) {
                    define_config($nome_config, $valor_config);
                }
                define_msg('configok', 'Configurações atualizadas com sucesso.', 'sucesso');
                redirect('configuracoes/gerenciar_configuracoes');
            } else {
                redirect('configuracoes/gerenciar_configuracoes');
            }
        }
        //vai carregar o modulo usuarios e mostrar a tela de recuperação de senha
        set_tema('footerinc', '<script>
		$(document).ready(function() {
			App.init();
		});
	</script>', FALSE);
        set_tema('titulo', 'Configuração do Sistema');
        set_tema('conteudo', load_modulo('configuracoes', 'gerenciar'));
        set_tema('rodape', '');
        //vai substituir o rodape padrao
        load_template();
    }
Example #18
0
 /**
  * Method to allow including of a template part from within a plugin. Replicates what locate_template() does in
  * WordPress core, but allows you to specify the path where to start looking. Falls back to looking in the
  *
  * @since 1.0.0
  *
  * @param string $startPath The path - probably set via a constant - of where to start looking
  * @param string|array $templateNames 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 $requireOnce Whether to require_once or require. Default true. Has no effect if $load is false.
  * @return string The template filename if one is located.
  */
 public static function locate_template_part_in_plugin($startPath, $templateNames, $load = false, $requireOnce = true)
 {
     $located = '';
     foreach ((array) $templateNames as $templateName) {
         if (!$templateName) {
             continue;
         }
         if (file_exists(untrailingslashit($startPath) . '/' . $templateName)) {
             $located = untrailingslashit($startPath) . '/' . $templateName;
             break;
         } else {
             if (file_exists(untrailingslashit(STYLESHEETPATH) . '/' . $templateName)) {
                 $located = untrailingslashit(STYLESHEETPATH) . '/' . $templateName;
                 break;
             } else {
                 if (file_exists(untrailingslashit(TEMPLATEPATH) . '/' . $templateName)) {
                     $located = untrailingslashit(TEMPLATEPATH) . '/' . $templateName;
                     break;
                 }
             }
         }
     }
     if ($load && '' !== $located) {
         load_template($located, $require_once);
     }
     return $located;
 }
Example #19
0
 /**
  * Load template files of the plugin also include a filter pn_get_template_part<br>
  * Based on WooCommerce function<br>
  * 
  * @param string $plugin_slug
  * @param string $slug
  * @param string $name
  * @param string $include
  * @return string
  */
 function wpbp_get_template_part($plugin_slug, $slug, $name = '', $include = true)
 {
     $template = '';
     $plugin_slug = $plugin_slug . '/';
     $path = WP_PLUGIN_DIR . '/' . $plugin_slug . 'templates/';
     // Look in yourtheme/slug-name.php and yourtheme/plugin-name/slug-name.php
     if ($name) {
         $template = locate_template(array("{$slug}-{$name}.php", $plugin_slug . "{$slug}-{$name}.php"));
     } else {
         $template = locate_template(array("{$slug}.php", $plugin_slug . "{$slug}.php"));
     }
     // Get default slug-name.php
     if (!$template && $name && file_exists($path . "{$slug}-{$name}.php")) {
         $template = $path . "{$slug}-{$name}.php";
     }
     // If template file doesn't exist, look in yourtheme/slug.php and yourtheme/plugin-name/slug.php
     if (!$template) {
         $template = locate_template(array("{$slug}.php", $plugin_slug . "{$slug}.php"));
     }
     // Allow 3rd party plugin filter template file from their plugin
     $template = apply_filters('wpbp_get_template_part', $template, $slug, $name, $plugin_slug);
     if ($template && $include === true) {
         load_template($template, false);
     } else {
         if ($template && $include === false) {
             return $template;
         }
     }
 }
 function visual_carousel_get_template_part($slug, $name = '', $require = false)
 {
     global $shortcode_template;
     $template = '';
     // Look in yourtheme/pluginname/slug-name.php
     if ($slug && $name && file_exists(visual_carousel()->theme_dir . "{$shortcode_template}/{$slug}-{$name}.php")) {
         $template = visual_carousel()->theme_dir . "{$shortcode_template}/{$slug}-{$name}.php";
     } elseif (!$template && file_exists(visual_carousel()->theme_dir . "{$shortcode_template}/{$slug}.php")) {
         $template = visual_carousel()->theme_dir . "{$shortcode_template}/{$slug}.php";
     } elseif (!$template && $name && file_exists(visual_carousel()->template_dir . "{$shortcode_template}/{$slug}-{$name}.php")) {
         $template = visual_carousel()->template_dir . "{$shortcode_template}/{$slug}-{$name}.php";
     } elseif (!$template && file_exists(visual_carousel()->template_dir . "{$shortcode_template}/{$slug}.php")) {
         $template = visual_carousel()->template_dir . "{$shortcode_template}/{$slug}.php";
     }
     // Allow 3rd party plugin filter template file from their plugin
     $template = apply_filters('visual_carousel_get_template_part', $template, $slug, $name);
     if (!$template) {
         return false;
     }
     if ($require) {
         return $template;
     }
     // load template file.
     load_template($template, false);
 }
 public function collaboration_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()) . 'collaboration_templates/' . $template_name)) {
             $located = trailingslashit(get_stylesheet_directory()) . 'collaboration_templates/' . $template_name;
             break;
             // Check parent theme next
         } elseif (file_exists(trailingslashit(get_template_directory()) . 'collaboration_templates/' . $template_name)) {
             $located = trailingslashit(get_template_directory()) . 'collaboration_templates/' . $template_name;
             break;
             // Check theme compatibility last
         } elseif (file_exists(trailingslashit(EDD_FES()->templates->collaboration_get_templates_dir()) . $template_name)) {
             $located = trailingslashit(EDD_FES()->templates->collaboration_get_templates_dir()) . $template_name;
             break;
         }
     }
     if (true == $load && !empty($located)) {
         load_template($located, $require_once);
     }
     return $located;
 }
function get_sidebar() {
	do_action( 'get_sidebar' );
	if ( file_exists( TEMPLATEPATH . '/sidebar.php') )
		load_template( TEMPLATEPATH . '/sidebar.php');
	else
		load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
}
Example #23
0
/**
 * Loads template part file
 * Provides same functionality as get_template_part() but with the added benefit of optional output buffering and the ability to pass parameters
 *
 * @param string $slug The slug name for the generic template or sub-directory
 * @param string $name The name of the specialised template
 * @param bool $echo Echo output immediately or buffered and returned
 * @param array $param Array of additional params to include in scope
 */
function try_get_template_part($slug, $name, $echo = true, $params = array())
{
    global $posts, $post, $wp_did_header, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
    do_action("get_template_part_{$slug}", $slug, $name);
    $templates = array();
    if (isset($name)) {
        $templates[] = "{$slug}/{$name}.php";
        $templates[] = "{$slug}-{$name}.php";
    }
    $templates[] = "{$slug}.php";
    $template_file = locate_template($templates, false, false);
    // Add query vars and params to scope
    if (is_array($wp_query->query_vars)) {
        extract($wp_query->query_vars, EXTR_SKIP);
    }
    extract($params, EXTR_SKIP);
    // Buffer output and return if echo is false
    if (!$echo) {
        ob_start();
    }
    load_template($template_file, false);
    if (!$echo) {
        return ob_get_clean();
    }
}
Example #24
0
/**
 * If mobile site is enable and there is a mobile template, then display mobile layout on mobile
 */
function calibrefx_init_mobile_site()
{
    global $calibrefx;
    //Register mobile menu
    register_nav_menus(array('mobile' => apply_filters('mobile_menu_text', __('Mobile Navigation Menu', 'calibrefx'))));
    if (is_admin() or !wp_is_mobile()) {
        return;
    }
    remove_theme_support('calibrefx-footer-widgets');
    remove_theme_support('calibrefx-header-right-widgets');
    //Disable wp admin bar
    show_admin_bar(false);
    add_filter('body_class', 'calibrefx_mobile_site_body_class');
    add_filter('wrapper_class', 'calibrefx_mobile_wrapper_class');
    add_filter('wrapper_attr', 'calibrefx_mobile_wrapper_attr');
    remove_action('calibrefx_after_header', 'calibrefx_do_nav');
    remove_action('calibrefx_after_header', 'calibrefx_do_subnav', 15);
    add_action('calibrefx_before_wrapper', 'calibrefx_do_top_mobile_nav');
    add_action('calibrefx_after_wrapper', 'calibrefx_do_mobile_footer', 100);
    add_filter('template_include', 'calibrefx_get_mobile_template');
    if (file_exists(CHILD_MOBILE_URI . '/functions.php')) {
        load_template(CHILD_MOBILE_URI . '/functions.php');
    }
    $calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_breadcrumbs', 10);
    $calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_notification', 20);
    $calibrefx->hooks->remove('calibrefx_sidebar', 'calibrefx_do_sidebar');
    $calibrefx->hooks->remove('calibrefx_sidebar_alt', 'calibrefx_do_sidebar_alt');
    $calibrefx->hooks->remove('calibrefx_after_post_content', 'calibrefx_do_author_box_single', 20);
    $calibrefx->hooks->remove('calibrefx_footer', 'calibrefx_footer_area', 10);
    //On mobile there is no sidebar
    add_filter('calibrefx_site_layout', 'calibrefx_layout_full_width');
}
Example #25
0
 public function gerenciar()
 {
     set_tema('footerinc', load_JS(array('data-table', 'table')), FALSE);
     set_tema('titulo', 'Registros de auditoria');
     set_tema('conteudo', load_modulo('auditoria', 'gerenciar'));
     load_template();
 }
Example #26
0
/**
 * 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.
 *
 * @since bbPres (r3618)
 *
 * @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 bbp_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(STYLESHEETPATH) . $template_name)) {
            $located = trailingslashit(STYLESHEETPATH) . $template_name;
            break;
            // Check parent theme next
        } elseif (file_exists(trailingslashit(TEMPLATEPATH) . $template_name)) {
            $located = trailingslashit(TEMPLATEPATH) . $template_name;
            break;
            // Check theme compatibility last
        } elseif (file_exists(trailingslashit(bbp_get_theme_compat_dir()) . $template_name)) {
            $located = trailingslashit(bbp_get_theme_compat_dir()) . $template_name;
            break;
        }
    }
    if (true == $load && !empty($located)) {
        load_template($located, $require_once);
    }
    return $located;
}
 function bp_locate_template($template_names, $load = false, $require_once = true)
 {
     // No file found yet
     $located = false;
     $template_locations = bp_get_template_stack();
     // 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, '/');
         // Loop through template stack
         foreach ((array) $template_locations as $template_location) {
             // Continue if $template_location is empty
             if (empty($template_location)) {
                 continue;
             }
             // Check child theme first
             if (file_exists(trailingslashit($template_location) . $template_name)) {
                 $located = trailingslashit($template_location) . $template_name;
                 break 2;
             }
         }
     }
     // Maybe load the template if one was located
     if (true == $load && !empty($located)) {
         load_template($located, $require_once);
     }
     return $located;
 }
 static function ot_settings()
 {
     $theme_options_file = BW_DEMO . 'theme-options.php';
     if (isset($_GET['activated']) && !self::is_theme_installed() && file_exists($theme_options_file)) {
         load_template($theme_options_file);
     }
 }
	function feed($comments)
	{

    	if (!$comments)
    	{

        	global $wp_query;
	    	if($wp_query->query_vars['feed']=='news.yandex.ru')
	    	{
            	/*выводим  за последние 7 дней*/
		   		function filter_where($where = '') {
					$today_date = get_the_date('Y-m-d');
					//posts between publish date of wrap-up and 7 days prior
					// commented
					// $where .= " AND post_date >= '" . date('Y-m-d', strtotime('-7 days')) . "' AND post_date <= '" . date('Y-m-d', strtotime('+1 days')) . "'";
					// added
					$where .= " AND wp_posts.post_date >= '" . date('Y-m-d', strtotime('-7 days')) . "' AND wp_posts.post_date <= '" . date('Y-m-d', strtotime('+1 days')) . "'";
					return $where;
				}
		   		add_filter('posts_where', 'filter_where');
            	load_template( NEWS_YANDEX_RU_PATH.'/template.php');
				//exit;
	    	}

		}

	}
 public function editar()
 {
     esta_logado();
     $this->form_validation->set_message('matches', 'Por favor selecione um solicitante');
     $this->form_validation->set_rules('titulo', 'Titulo', 'required');
     if ($this->form_validation->run() == TRUE) {
         $dados = elements(array(), $this->input->post());
         $upload = $this->slideshows->do_upload('foto');
         $dados = elements(array(), $this->input->post());
         @($dados['foto'] = $upload['file_name']);
         if ($dados['foto'] == '<') {
             $dados = elements(array('titulo', 'link'), $this->input->post());
             $this->slideshows->do_update($dados, array('id' => $this->input->post('idslideshows')));
         } else {
             if (is_array($upload) && $upload['file_name'] != '') {
                 $dados = elements(array(), $this->input->post());
                 $dados['foto'] = $upload['file_name'];
                 $this->slideshows->do_update($dados, array('id' => $this->input->post('idslideshows')));
             } else {
                 set_msg('msgerro', $upload, 'erro');
                 redirect(current_url());
             }
         }
     }
     set_tema('titulo', 'Alteração de mídia');
     set_tema('conteudo', load_modulo('slideshows', 'editar'));
     load_template();
 }