当前位置: 首页>>代码示例>>PHP>>正文


PHP em_locate_template函数代码示例

本文整理汇总了PHP中em_locate_template函数的典型用法代码示例。如果您正苦于以下问题:PHP em_locate_template函数的具体用法?PHP em_locate_template怎么用?PHP em_locate_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了em_locate_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: em_ical

/**
 * generates an ical feed on init if url is correct
 */
function em_ical($regenerate = false)
{
    $cal_file_request = preg_match('/events.ics$/', $_SERVER['REQUEST_URI']);
    //are we askig for the ics file directly but doesn't exist?
    if ($cal_file_request || $regenerate) {
        ob_start();
        em_locate_template('templates/ical.php', true);
        $calendar = str_replace("\n", "\r\n", ob_get_clean());
        //get the contents to output and clean crlf issues
        $calendar = str_replace("\n\n", "\n", $calendar);
        //let's create a cache file
        /*
        if( get_option('dbem_regenerate_ical') || !file_exists(ABSPATH . "/events.ics") ){
        	$file = fopen( ABSPATH . "/events.ics", 'w');
        	if($file){
        		fwrite($file, $calendar, strlen($calendar));
        		fclose($file);
        		update_option('dbem_regenerate_ical',false);
        	}
        }
        */
        echo $calendar;
        die;
    }
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:28,代码来源:em-ical.php

示例2: em_ical_events

function em_ical_events()
{
    ob_start();
    em_locate_template('templates/ical.php', true);
    return preg_replace("/([^\r])\n/", "\$1\r\n", ob_get_clean());
    //get the contents to output and clean crlf issues
}
开发者ID:rajankz,项目名称:webspace,代码行数:7,代码来源:em-ical.php

示例3: the_content

 function the_content($content)
 {
     global $post, $EM_Event;
     if ($post->post_type == EM_POST_TYPE_EVENT) {
         if (is_archive() || is_search()) {
             if (get_option('dbem_cp_events_archive_formats')) {
                 $EM_Event = em_get_event($post);
                 $content = $EM_Event->output(get_option('dbem_event_list_item_format'));
             }
         } else {
             if (get_option('dbem_cp_events_formats') && !post_password_required()) {
                 $EM_Event = em_get_event($post);
                 ob_start();
                 em_locate_template('templates/event-single.php', true);
                 $content = ob_get_clean();
             } else {
                 $EM_Event = em_get_event($post);
                 if ($EM_Event->event_rsvp) {
                     $content .= $EM_Event->output('<h2>Bookings</h2>#_BOOKINGFORM');
                 }
             }
         }
     }
     return $content;
 }
开发者ID:hscale,项目名称:webento,代码行数:25,代码来源:em-event-post.php

示例4: the_content

 function the_content($content)
 {
     global $wp_query, $EM_Tag;
     $EM_Tag = new EM_Tag($wp_query->queried_object);
     ob_start();
     em_locate_template('templates/tag-single.php', true);
     return ob_get_clean();
 }
开发者ID:rajankz,项目名称:webspace,代码行数:8,代码来源:em-tag-taxonomy.php

示例5: em_get_locations_map_shortcode

/**
 * Generates a map of locations that match given query attributes. Accepts any location query attributes. 
 * @param array $args
 * @return string
 */
function em_get_locations_map_shortcode($args)
{
    $args['width'] = !empty($args['width']) ? $args['width'] : 450;
    $args['height'] = !empty($args['height']) ? $args['height'] : 300;
    ob_start();
    em_locate_template('templates/map-global.php', true, array('args' => $args));
    return ob_get_clean();
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:13,代码来源:em-shortcode.php

示例6: em_get_locations_map_shortcode

/**
 * Generates a map of locations that match given query attributes. Accepts any location query attributes. 
 * @param unknown_type $atts
 * @return string
 */
function em_get_locations_map_shortcode($atts)
{
    $clean_atts = EM_Locations::get_default_search($atts);
    $clean_atts['width'] = !empty($atts['width']) ? $atts['width'] : 450;
    $clean_atts['height'] = !empty($atts['height']) ? $atts['height'] : 300;
    ob_start();
    em_locate_template('templates/map-global.php', true, array('args' => $atts));
    return ob_get_clean();
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:14,代码来源:em-shortcode.php

示例7: the_content

 function the_content($content)
 {
     global $wp_query, $EM_Tag, $post, $em_tag_id;
     if (!empty($wp_query->em_tag_id) || $post->ID == get_option('dbem_tags_page') && !empty($em_tag_id)) {
         $EM_Tag = empty($wp_query->em_tag_id) ? em_get_tag($em_tag_id) : em_get_tag($wp_query->em_tag_id);
         ob_start();
         em_locate_template('templates/tag-single.php', true);
         return ob_get_clean();
     }
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:10,代码来源:em-tag-taxonomy.php

示例8: the_content

 function the_content($content)
 {
     global $wp_query, $EM_Category, $post;
     if (empty($post->ID)) {
         $EM_Category = new EM_Category($wp_query->queried_object);
         ob_start();
         em_locate_template('templates/category-single.php', true);
         return ob_get_clean();
     }
     return $content;
 }
开发者ID:hscale,项目名称:webento,代码行数:11,代码来源:em-category-taxonomy.php

示例9: the_content

 function the_content($content)
 {
     global $wp_query, $EM_Category, $post, $em_category_id;
     if (!empty($wp_query->em_category_id) || $post->ID == get_option('dbem_categories_page') && !empty($em_category_id)) {
         $EM_Category = empty($wp_query->em_category_id) ? em_get_category($em_category_id) : em_get_category($wp_query->em_category_id);
         ob_start();
         em_locate_template('templates/category-single.php', true);
         return ob_get_clean();
     }
     return $content;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:11,代码来源:em-category-taxonomy.php

示例10: the_content

 public static function the_content($content)
 {
     global $wp_query, $EM_Tag, $post, $em_tag_id;
     $is_tags_page = $post->ID == get_option('dbem_tags_page');
     $tag_flag = !empty($wp_query->em_tag_id) || !empty($em_tag_id);
     if ($is_tags_page && $tag_flag || empty($post->ID) && $tag_flag) {
         $EM_Tag = empty($wp_query->em_tag_id) ? em_get_tag($em_tag_id) : em_get_tag($wp_query->em_tag_id);
         ob_start();
         em_locate_template('templates/tag-single.php', true);
         return ob_get_clean();
     }
     return $content;
 }
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:13,代码来源:em-tag-taxonomy.php

示例11: em_ical_item

/**
 * Generates an ics file for a single event 
 */
function em_ical_item()
{
    global $wpdb, $wp_query, $wp_rewrite;
    //check if we're outputting an ical feed
    if (!empty($wp_query) && $wp_query->get('ical')) {
        $execute_ical = false;
        $filename = 'events';
        $args = array();
        //single event
        if ($wp_query->get(EM_POST_TYPE_EVENT)) {
            $event_id = $wpdb->get_var('SELECT event_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get(EM_POST_TYPE_EVENT) . "' AND event_status=1 LIMIT 1");
            if (!empty($event_id)) {
                $filename = $wp_query->get(EM_POST_TYPE_EVENT);
                $args['event'] = $event_id;
            }
            //single location
        } elseif ($wp_query->get(EM_POST_TYPE_LOCATION)) {
            $location_id = $wpdb->get_var('SELECT location_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='" . $wp_query->get(EM_POST_TYPE_LOCATION) . "' AND location_status=1 LIMIT 1");
            if (!empty($location_id)) {
                $filename = $wp_query->get(EM_POST_TYPE_LOCATION);
                $args['location'] = $location_id;
            }
            //taxonomies
        } else {
            $taxonomies = EM_Object::get_taxonomies();
            foreach ($taxonomies as $tax_arg => $taxonomy_info) {
                $taxonomy_term = $wp_query->get($taxonomy_info['query_var']);
                if ($taxonomy_term) {
                    $filename = $taxonomy_term;
                    $args[$tax_arg] = $taxonomy_term;
                }
            }
        }
        //only output the ical if we have a match from above
        if (count($args) > 0) {
            //send headers and output ical
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename="' . $filename . '.ics"');
            em_locate_template('templates/ical.php', true, array('args' => $args));
            exit;
        } else {
            //no item exists, so redirect to original URL
            $url_to_redirect = preg_replace("/ical\\/\$/", '', esc_url_raw(add_query_arg(array('ical' => null))));
            wp_redirect($url_to_redirect, '302');
            exit;
        }
    }
}
开发者ID:Olaf1989,项目名称:Cakes-and-more,代码行数:51,代码来源:em-ical.php

示例12: em_ical_event

/**
 * Generates an ics file for a single event 
 */
function em_ical_event()
{
    global $wpdb, $wp_query;
    //add endpoints to events
    if (!empty($wp_query) && $wp_query->get(EM_POST_TYPE_EVENT) && $wp_query->get('ical')) {
        $event_id = $wpdb->get_var('SELECT event_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get(EM_POST_TYPE_EVENT) . "' AND event_status=1 LIMIT 1");
        if (!empty($event_id)) {
            global $EM_Event;
            $EM_Event = em_get_event($event_id);
            //send headers
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename="' . $EM_Event->event_slug . '.ics"');
            em_locate_template('templates/ical.php', true);
            exit;
        }
    }
}
开发者ID:batruji,项目名称:metareading,代码行数:20,代码来源:em-ical.php

示例13: the_content

 function the_content($content)
 {
     global $post, $EM_Location;
     if ($post->post_type == EM_POST_TYPE_LOCATION) {
         if (is_archive() || is_search()) {
             if (get_option('dbem_cp_locations_archive_formats')) {
                 $EM_Location = em_get_location($post);
                 $content = $EM_Location->output(get_option('dbem_location_list_item_format'));
             }
         } else {
             if (get_option('dbem_cp_locations_formats') && !post_password_required()) {
                 $EM_Location = em_get_location($post);
                 ob_start();
                 em_locate_template('templates/location-single.php', true);
                 $content = ob_get_clean();
             }
         }
     }
     return $content;
 }
开发者ID:batruji,项目名称:metareading,代码行数:20,代码来源:em-location-post.php

示例14: template_include

 public function template_include($template)
 {
     if (is_post_type_archive('event')) {
         $new_template = em_locate_template('archive-event.php');
     }
     if (is_tax('event-category')) {
         $new_template = em_locate_template('taxonomy-event-category.php');
     }
     if (is_tax('event-location')) {
         $new_template = em_locate_template('taxonomy-event-location.php');
     }
     if (is_tax('event-organizer')) {
         $new_template = em_locate_template('taxonomy-event-organizer.php');
     }
     if (is_tax('event-tag')) {
         $new_template = em_locate_template('taxonomy-event-tag.php');
     }
     if (is_singular('event')) {
         $new_template = em_locate_template('single-event.php');
     }
     return apply_filters('em_template_include', !empty($new_template) ? $new_template : $template);
 }
开发者ID:DarussalamTech,项目名称:aims_prj,代码行数:22,代码来源:class-templates.php

示例15: em_admin_location

function em_admin_location($message = "")
{
    global $EM_Location, $EM_Notices;
    if (empty($EM_Location) || !is_object($EM_Location)) {
        $title = __('Add location', 'dbem');
        $EM_Location = new EM_Location();
    } else {
        $title = __('Edit location', 'dbem');
    }
    ?>
	<div class='wrap'>
		<div id='icon-edit' class='icon32'>
			<br/>
		</div>
		<h2><?php 
    echo $title;
    ?>
</h2>
		<?php 
    em_locate_template('forms/location-editor.php', true);
    ?>
	</div>
	<?php 
}
开发者ID:rajankz,项目名称:webspace,代码行数:24,代码来源:em-ms-locations.php


注:本文中的em_locate_template函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。