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


PHP EM_Object::ms_global_switch_back方法代码示例

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


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

示例1: em_admin_ms_locations

/**
 * Looks at the request values, saves/updates and then displays the right menu in the admin
 * @return null
 */
function em_admin_ms_locations()
{
    //TODO EM_Location is globalized, use it fully here
    global $EM_Location;
    EM_Object::ms_global_switch();
    //Take actions
    if (!empty($_REQUEST['action']) && ($_REQUEST['action'] == "edit" || $_REQUEST['action'] == "location_save")) {
        em_admin_location();
    } else {
        // no action, just a locations list
        em_admin_locations();
    }
    EM_Object::ms_global_switch_back();
}
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:em-ms-locations.php

示例2: meta_box_ms_categories

    public static function meta_box_ms_categories()
    {
        global $EM_Event;
        EM_Object::ms_global_switch();
        $categories = EM_Categories::get(array('hide_empty' => false));
        ?>

		<?php 
        if (count($categories) > 0) {
            ?>

			<p class="ms-global-categories">
			 <?php 
            $selected = $EM_Event->get_categories()->get_ids();
            ?>

			 <?php 
            $walker = new EM_Walker_Category();
            ?>

			 <?php 
            $args_em = array('hide_empty' => 0, 'name' => 'event_categories[]', 'hierarchical' => true, 'id' => EM_TAXONOMY_CATEGORY, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'walker' => $walker);
            ?>

			 <?php 
            echo walk_category_dropdown_tree($categories, 0, $args_em);
            ?>

			</p>
		<?php 
        } else {
            ?>

			<p><?php 
            sprintf(__('No categories available, <a href="%s">create one here first</a>', 'dbem'), get_bloginfo('wpurl') . '/wp-admin/admin.php?page=events-manager-categories');
            ?>
</p>
		<?php 
        }
        ?>

		<!-- END Categories -->
		<?php 
        EM_Object::ms_global_switch_back();
    }
开发者ID:batruji,项目名称:metareading,代码行数:45,代码来源:em-event-post-admin.php

示例3: em_admin_init

function em_admin_init()
{
    //in MS global mode and locations are stored in the main blog, then a user must have at least a subscriber role
    if (EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations')) {
        EM_Object::ms_global_switch();
        $user = new WP_User(get_current_user_id());
        if (count($user->roles) == 0) {
            $user->set_role('subscriber');
        }
        EM_Object::ms_global_switch_back();
    }
}
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:12,代码来源:em-admin.php

示例4: em_init_actions


//.........这里部分代码省略.........
            } else {
                $return = array('result' => false, 'message' => $EM_Event->feedback_message, 'errors' => $EM_Event->errors);
            }
        }
    }
    //Location Actions
    if (!empty($_REQUEST['action']) && substr($_REQUEST['action'], 0, 8) == 'location') {
        global $EM_Location, $EM_Notices;
        //Load the location object, with saved event if requested
        if (!empty($_REQUEST['location_id'])) {
            $EM_Location = new EM_Location($_REQUEST['location_id']);
        } else {
            $EM_Location = new EM_Location();
        }
        if ($_REQUEST['action'] == 'location_save' && current_user_can('edit_locations')) {
            if (get_site_option('dbem_ms_mainblog_locations')) {
                EM_Object::ms_global_switch();
            }
            //switch to main blog if locations are global
            //Check Nonces
            em_verify_nonce('location_save');
            //Grab and validate submitted data
            if ($EM_Location->get_post() && $EM_Location->save()) {
                //EM_location gets the location if submitted via POST and validates it (safer than to depend on JS)
                $EM_Notices->add_confirm($EM_Location->feedback_message, true);
                $redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : wp_get_referer();
                wp_redirect($redirect);
                exit;
            } else {
                $EM_Notices->add_error($EM_Location->get_errors());
                $result = false;
            }
            if (get_site_option('dbem_ms_mainblog_locations')) {
                EM_Object::ms_global_switch_back();
            }
        } elseif (!empty($_REQUEST['action']) && $_REQUEST['action'] == "location_delete") {
            //delete location
            //get object or objects
            if (!empty($_REQUEST['locations']) || !empty($_REQUEST['location_id'])) {
                $args = !empty($_REQUEST['locations']) ? $_REQUEST['locations'] : $_REQUEST['location_id'];
                $locations = EM_Locations::get($args);
                foreach ($locations as $location) {
                    if (!$location->delete()) {
                        $EM_Notices->add_error($location->get_errors());
                        $errors = true;
                    }
                }
                if (empty($errors)) {
                    $result = true;
                    $location_term = count($locations) > 1 ? __('Locations', 'dbem') : __('Location', 'dbem');
                    $EM_Notices->add_confirm(sprintf(__('%s successfully deleted', 'dbem'), $location_term));
                } else {
                    $result = false;
                }
            }
        } elseif (!empty($_REQUEST['action']) && $_REQUEST['action'] == "locations_search" && (!empty($_REQUEST['term']) || !empty($_REQUEST['q']))) {
            $results = array();
            if (is_user_logged_in() || get_option('dbem_events_anonymous_submissions') && user_can(get_option('dbem_events_anonymous_user'), 'read_others_locations')) {
                $location_cond = is_user_logged_in() && !current_user_can('read_others_locations') ? "AND location_owner=" . get_current_user_id() : '';
                $term = isset($_REQUEST['term']) ? '%' . $_REQUEST['term'] . '%' : '%' . $_REQUEST['q'] . '%';
                $sql = $wpdb->prepare("\r\n\t\t\t\t\tSELECT \r\n\t\t\t\t\t\tlocation_id AS `id`,\r\n\t\t\t\t\t\tConcat( location_name, ', ', location_address, ', ', location_town)  AS `label`,\r\n\t\t\t\t\t\tlocation_name AS `value`,\r\n\t\t\t\t\t\tlocation_address AS `address`, \r\n\t\t\t\t\t\tlocation_town AS `town`, \r\n\t\t\t\t\t\tlocation_state AS `state`,\r\n\t\t\t\t\t\tlocation_region AS `region`,\r\n\t\t\t\t\t\tlocation_postcode AS `postcode`,\r\n\t\t\t\t\t\tlocation_country AS `country`\r\n\t\t\t\t\tFROM " . EM_LOCATIONS_TABLE . " \r\n\t\t\t\t\tWHERE ( `location_name` LIKE %s ) AND location_status=1 {$location_cond} LIMIT 10\r\n\t\t\t\t", $term);
                $results = $wpdb->get_results($sql);
            }
            echo EM_Object::json_encode($results);
            die;
        }
开发者ID:rajankz,项目名称:webspace,代码行数:67,代码来源:em-actions.php

示例5: array

<?php

$args = !empty($args) ? $args : array();
/* @var $args array */
?>
<!-- START Category Search -->
<div class="em-search-category em-search-field">
	<label><?php 
echo esc_html($args['category_label']);
?>
</label>
	<?php 
EM_Object::ms_global_switch();
//in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
wp_dropdown_categories(array('hide_empty' => 0, 'orderby' => 'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class' => 'em-events-search-category'));
EM_Object::ms_global_switch_back();
//if switched above, switch back
?>
</div>
<!-- END Category Search -->
开发者ID:mpaskew,项目名称:isc-dev,代码行数:20,代码来源:categories.php


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