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


PHP EM_Object::sanitize方法代码示例

本文整理汇总了PHP中EM_Object::sanitize方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Object::sanitize方法的具体用法?PHP EM_Object::sanitize怎么用?PHP EM_Object::sanitize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EM_Object的用法示例。


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

示例1: em_events_page_title

/**
 * Filter for titles when on event pages
 * @param $data
 * @return string
 */
function em_events_page_title($content)
{
    global $EM_Event;
    global $post;
    $events_page_id = get_option('dbem_events_page');
    if ($post->ID == $events_page_id && $events_page_id != 0) {
        if (isset($_REQUEST['calendar_day']) && $_REQUEST['calendar_day'] != '') {
            $events = EM_Events::get(array('limit' => 2, 'scope' => $_REQUEST['calendar_day'], 'owner' => false));
            if (count($events) != 1 || get_option('dbem_display_calendar_day_single') == 1) {
                //We only support dates for the calendar day list title, so we do a simple filter for the supplied calendar_day
                $content = get_option('dbem_list_date_title');
                preg_match_all("/#[A-Za-z0-9]+/", $content, $placeholders);
                foreach ($placeholders[0] as $placeholder) {
                    // matches all PHP date and time placeholders
                    if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $placeholder)) {
                        $content = str_replace($placeholder, mysql2date(ltrim($placeholder, "#"), $_REQUEST['calendar_day']), $content);
                    }
                }
            } else {
                $event = array_shift($events);
                $content = $event->output(get_option('dbem_event_page_title_format'));
            }
        } elseif (isset($_REQUEST['location_id']) && ($_REQUEST['location_id'] |= '')) {
            $location = new EM_Location(EM_Object::sanitize($_REQUEST['location_id']));
            $content = $location->output(get_option('dbem_location_page_title_format'));
        } elseif (isset($_REQUEST['event_id']) && $_REQUEST['event_id'] != '') {
            // single event page
            $content = $EM_Event->output(get_option('dbem_event_page_title_format'));
        } else {
            // Multiple events page
            $content = get_option('dbem_events_page_title');
        }
        //TODO FILTER - filter titles before em output
    }
    return apply_filters('em_events_page_title', $content);
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:41,代码来源:em-events.php

示例2: em_content_page_title

/**
 * Filter for titles when on event pages
 * @param $data
 * @return string
 */
function em_content_page_title($content)
{
    global $EM_Event, $EM_Location, $EM_Category, $wp_query, $post;
    $events_page_id = get_option('dbem_events_page');
    if ($post->ID == $events_page_id && $events_page_id != 0) {
        $content = apply_filters('em_content_page_title_pre', '', $content);
        if (empty($content)) {
            if (!empty($_REQUEST['calendar_day'])) {
                $events = EM_Events::get(array('limit' => 2, 'scope' => $_REQUEST['calendar_day'], 'owner' => false));
                if (count($events) != 1 || get_option('dbem_display_calendar_day_single') == 1) {
                    //We only support dates for the calendar day list title, so we do a simple filter for the supplied calendar_day
                    $content = get_option('dbem_list_date_title');
                    preg_match_all("/#[A-Za-z0-9]+/", $content, $placeholders);
                    foreach ($placeholders[0] as $placeholder) {
                        // matches all PHP date and time placeholders
                        if (preg_match('/^#[dDjlNSwzWFmMntLoYyaABgGhHisueIOPTZcrU]$/', $placeholder)) {
                            $content = str_replace($placeholder, mysql2date(ltrim($placeholder, "#"), $_REQUEST['calendar_day']), $content);
                        }
                    }
                } else {
                    $event = array_shift($events);
                    $content = $event->output(get_option('dbem_event_page_title_format'));
                }
            } elseif (is_object($EM_Location)) {
                $location = new EM_Location(EM_Object::sanitize($_REQUEST['location_id']));
                $content = $location->output(get_option('dbem_location_page_title_format'));
            } elseif (is_object($EM_Category)) {
                //Just a single location
                $content = $EM_Category->output(get_option('dbem_category_page_title_format'));
            } elseif ($wp_query->get('bookings_page')) {
                //Bookings Page
                $content = sprintf(__('My %s', 'dbem'), __('Bookings', 'dbem'));
            } elseif (is_object($EM_Event) && !empty($_REQUEST['book'])) {
                //bookings page
                $content = $EM_Event->output(get_option('dbem_bookings_page_title'));
            } elseif (is_object($EM_Event)) {
                // single event page
                if ($EM_Event->status == 1) {
                    $content = $EM_Event->output(get_option('dbem_event_page_title_format'));
                } else {
                    $content = get_option('dbem_events_page_title');
                }
            } elseif (!empty($_REQUEST['event_categories'])) {
                $content = get_option('dbem_categories_page_title');
            } elseif (!empty($_REQUEST['event_locations'])) {
                $content = get_option('dbem_locations_page_title');
            } else {
                // Multiple events page
                $content = get_option('dbem_events_page_title');
            }
        }
        return apply_filters('em_content_page_title', $content);
    }
    return $content;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:60,代码来源:em-events.php


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