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


PHP arr::set方法代码示例

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


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

示例1: mdjm_limit_results_to_employee_quotes

/**
 * Hook into pre_get_posts and limit employees quotes to their own events
 * if their permissions are not full.
 *
 * @since	1.0
 * @param	arr		$query		The WP_Query
 * @return	void
 */
function mdjm_limit_results_to_employee_quotes($query)
{
    if (!is_admin() || 'mdjm-quotes' != $query->get('post_type') || mdjm_employee_can('list_all_quotes')) {
        return;
    }
    global $user_ID;
    $events = mdjm_get_employee_events($user_ID);
    foreach ($events as $event) {
        $quote = mdjm_get_event_quote_id($event->ID);
        if (!empty($quote)) {
            $quotes[] = $quote;
        }
    }
    if (!empty($quotes)) {
        $query->set('post__in', $quotes);
    }
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:25,代码来源:quotes.php

示例2: mdjm_limit_results_to_employee_addons

/**
 * Hook into pre_get_posts and limit employees addons if their permissions are not full.
 *
 * @since	1.4
 * @param	arr		$query		The WP_Query
 * @return	void
 */
function mdjm_limit_results_to_employee_addons($query)
{
    if (!is_admin() || 'mdjm-addon' != $query->get('post_type') || mdjm_employee_can('mdjm_package_edit')) {
        return;
    }
    global $user_ID;
    $query->set('meta_query', array(array('key' => '_addon_employees', 'value' => sprintf(':"%s";', $user_ID), 'compare' => 'LIKE')));
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:15,代码来源:equipment.php

示例3: mdjm_transaction_post_filtered

/**
 * Adjust the query when the transactions are filtered.
 *
 * @since	1.3
 * @param	arr		$query		The WP_Query
 * @return	void
 */
function mdjm_transaction_post_filtered($query)
{
    global $pagenow;
    $post_type = isset($_GET['post_type']) ? $_GET['post_type'] : '';
    if ('edit.php' != $pagenow || 'mdjm-transaction' != $post_type || !is_admin()) {
        return;
    }
    // Filter by transaction type
    if (!empty($_GET['mdjm_filter_type'])) {
        $type = isset($_GET['mdjm_filter_type']) ? $_GET['mdjm_filter_type'] : 0;
        if ($type != 0) {
            $query->set('tax_query', array(array('taxonomy' => 'transaction-types', 'field' => 'term_id', 'terms' => $type)));
        }
    }
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:22,代码来源:txns.php

示例4: mdjm_event_post_search

/**
 * Customise the event post query during a search so that clients and employees are included in results.
 *
 * @since	1.0
 * @param	arr		$query		The WP_Query
 * @return	void
 */
function mdjm_event_post_search($query)
{
    global $pagenow;
    if (!is_admin() || 'mdjm-event' != $query->get('post_type') || !$query->is_search() || 'edit.php' != $pagenow) {
        return;
    }
    // If searching it's only useful if we include clients and employees
    $users = new WP_User_Query(array('search' => $_GET['s'], 'search_columns' => array('user_login', 'user_email', 'user_nicename', 'display_name')));
    // WP_User_Query
    $user_results = $users->get_results();
    // Loop through WP_User_Query search looking for events where user is client or employee
    if (!empty($user_results)) {
        foreach ($user_results as $user) {
            $results = get_posts(array('post_type' => 'mdjm-event', 'post_status' => 'any', 'posts_per_page' => -1, 'meta_query' => array('relation' => 'OR', array('key' => '_mdjm_event_dj', 'value' => $user->ID, 'type' => 'NUMERIC'), array('key' => '_mdjm_event_client', 'value' => $user->ID, 'type' => 'NUMERIC'), array('key' => '_mdjm_event_employees', 'value' => sprintf(':"%s";', $user->ID), 'compare' => 'LIKE'))));
            // get_posts
            if (!empty($results)) {
                foreach ($results as $result) {
                    $events[] = $result->ID;
                }
            }
        }
        // foreach( $users as $user )
        if (!empty($events)) {
            $query->set('post__in', $events);
            $query->set('post_status', array('mdjm-unattended', 'mdjm-enquiry', 'mdjm-contract', 'mdjm-approved', 'mdjm-failed', 'mdjm-rejected', 'mdjm-completed'));
        }
    }
    // if( !empty( $users ) )
}
开发者ID:mdjm,项目名称:mobile-dj-manager,代码行数:36,代码来源:events.php


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