本文整理汇总了PHP中wp_array_slice_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_array_slice_assoc函数的具体用法?PHP wp_array_slice_assoc怎么用?PHP wp_array_slice_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_array_slice_assoc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: gramm_list_authors
/**
* Custom List Users
*
* Custom function to generate a list of blog authors,
* built based on WordPress' native wp_list_users function.
*
* @since Grammatizator 0.6
*/
function gramm_list_authors($args = '')
{
// SET up variables
global $wpdb;
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'role' => '', 'include' => array(), 'biolength' => 55, 'heading_tag' => 'h3', 'echo' => true);
$args = wp_parse_args($args, $defaults);
$return = '';
// GET data from database with database query
// Use this to get the paramenters we need for get_users() out of the default $args
$query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'role', 'include'));
// Used to request only an array of user IDs from get_users()
$query_args['fields'] = 'ids';
$authors = get_users($query_args);
// STEP through the data
foreach ($authors as $authorid) {
// GET individual user data and save in temporary variables
$author = get_userdata($authorid);
/* Test me */
// print_r();
// First Last name
// Bio
// Twitter handle
// Link to users's posts
// Image (get later)
// BUILD output
}
// End foreach loop
// OUTPUT results
}
开发者ID:admturner,项目名称:wordpress-learning-test,代码行数:37,代码来源:dsc-05.php
示例2: get_image
function get_image($image_id)
{
$attachment_data = wp_prepare_attachment_for_js($image_id);
$image = wp_array_slice_assoc($attachment_data, array('sizes', 'caption', 'description'));
if (empty($image)) {
return false;
}
foreach ($this->sizes as $size) {
$size_name = $size;
if (!isset($image['sizes'][$size])) {
$size = 'full';
$image['error'] = "wrong-size";
}
// Format Data
$image[$size_name]['img'] = $image['sizes'][$size]['url'];
$image[$size_name]['width'] = $image['sizes'][$size]['width'];
$image[$size_name]['height'] = $image['sizes'][$size]['height'];
}
$image['id'] = $image_id;
$image['desc'] = $image['description'];
unset($image['sizes'], $image['description']);
if (!$this->has_descriptions && !empty($image['description'])) {
$this->has_descriptions = true;
}
$image['desc'] = htmlspecialchars(str_replace('"', '"', $image['desc']), ENT_QUOTES);
$image['caption'] = htmlspecialchars(str_replace('"', '"', $image['caption']), ENT_QUOTES);
return $image;
}
开发者ID:justnorris,项目名称:village-client-area,代码行数:28,代码来源:CA_Gallery_Data.class.php
示例3: cbnr_the_exchange
/**
* Output the exchange rates
* This is the shortcode callback function
*/
function cbnr_the_exchange($attrs = '')
{
$rates = cbnr_get_rates();
if (is_array($attrs)) {
foreach ($attrs as &$atr) {
$atr = strtolower($atr);
}
unset($atr);
$rates = wp_array_slice_assoc($rates, $attrs);
}
if (empty($rates)) {
return;
}
$html = '';
if (!is_array($attrs) || !in_array('nocss', $attrs)) {
$html .= '<style type="text/css">@import url("' . plugins_url('style.css', __FILE__) . '");</style>';
}
$html .= '<div class="cbnr">';
$html .= ' <h3>Curs Valutar <img src="' . cbnr_get_icon_url('ron') . '"></h3>';
$html .= ' <div class="cbnr_date">' . date('j F Y') . '</div>';
foreach ($rates as $key => $value) {
$html .= ' <div class="cbnr_row">';
$html .= ' <div class="cnbr_flag"><img src="' . cbnr_get_icon_url($key) . '" title="' . strtoupper($key) . '"></div>';
$html .= ' <div class="cbnr_currency">' . strtoupper($key) . '</div>';
$html .= ' <div class="cbnr_value">' . $value . ' RON</div>';
$html .= ' </div>';
}
$html .= ' <span class="cbnr_credits">Curs oferit de <a href="http://www.bnro.ro">Banca Națională a României</a></span>';
$html .= '</div>';
return $html;
}
开发者ID:relu,项目名称:wp-cursbnr,代码行数:35,代码来源:wp-cursbnr.php
示例4: gramm_list_authors
/**
* Custom List Users
*
* Custom function to generate a list of blog authors,
* built based on WordPress' native wp_list_users function.
*
* @since Grammatizator 0.6
*/
function gramm_list_authors($args = '')
{
// SET up variables
global $wpdb;
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'role' => '', 'include' => array(), 'biolength' => 55, 'heading_tag' => 'h5', 'echo' => true);
$args = wp_parse_args($args, $defaults);
$return = '';
// GET data from database with database query
// Use this to get the paramenters we need for get_users() out of the default $args
$query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'role', 'include'));
// Used to request only an array of user IDs from get_users()
$query_args['fields'] = 'ids';
$authors = get_users($query_args);
// STEP through the data
foreach ($authors as $authorid) {
// GET individual user data and save in temporary variables
$author = get_userdata($authorid);
// First Last name
if ($author->first_name && $author->last_name) {
$name = "{$author->first_name} {$author->last_name}";
} else {
$name = $author->display_name;
}
// Bio
if (get_the_author_meta('description', $author->ID)) {
$bio = get_the_author_meta('description', $author->ID);
} else {
$bio = '';
}
// Twitter handle
if (get_the_author_meta('twitter', $author->ID)) {
$twit = '<p class="social-links"><a class="twitter" href="https://twitter.com/' . get_the_author_meta('twitter', $author->ID) . '" title="' . esc_attr(sprintf(__("%s on Twitter"), $author->display_name)) . '">@' . get_the_author_meta('twitter', $author->ID) . '</a></p>';
} else {
$twit = '';
}
// Link to users's posts
$authorlink = '<a class="fn" href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__("Posts by %s"), $author->display_name)) . '">' . $name . '</a>';
// BUILD output
$return .= '<section class="author byline vcard">';
// Image
$return .= '<div class="avatar-wrap avatar-size-90">';
$return .= get_avatar($author->ID, 90);
$return .= '</div>';
$return .= '<div class="bio-wrap">';
$return .= '<' . $args['heading_tag'] . '>' . $authorlink . '</' . $args['heading_tag'] . '>';
$return .= $twit;
if ($args['biolength'] > 0 && $bio) {
$return .= '<p class="author-bio">';
$return .= wptexturize($bio);
$return .= '</p>';
}
$return .= '</div><!-- close .bio-wrap -->';
$return .= '</section>';
// End output
}
// End foreach loop
// OUTPUT results
// guesses?
}
开发者ID:admturner,项目名称:wordpress-learning-test,代码行数:67,代码来源:dsc-07.php
示例5: user_query
static function user_query($query)
{
if (isset($query->_p2p_capture)) {
return;
}
// Don't overwrite existing P2P query
if (isset($query->query_vars['connected_type'])) {
return;
}
_p2p_append($query->query_vars, wp_array_slice_assoc($_GET, P2P_URL_Query::get_custom_qv()));
}
开发者ID:Olaw2jr,项目名称:wp-posts-to-posts,代码行数:11,代码来源:column-user.php
示例6: json
/**
* Gather the parameters passed to client JavaScript via JSON.
*
* @since 4.1.0
* @return array The array to be exported to the client as JSON.
*/
public function json()
{
$array = wp_array_slice_assoc((array) $this, array('id', 'title', 'description', 'priority', 'type'));
$array['content'] = $this->get_content();
$array['active'] = $this->active();
$array['instanceNumber'] = $this->instance_number;
// BEGIN Redux Additions
$array['width'] = isset($this->section['customizer_width']) ? $this->section['customizer_width'] : '';
$array['icon'] = isset($this->section['icon']) && !empty($this->section['icon']) ? $this->section['icon'] : 'hide';
// EMD Redux Additions
return $array;
}
开发者ID:pcuervo,项目名称:od4d,代码行数:18,代码来源:advanced_customizer_panel.php
示例7: get_url
static function get_url($context = 'display', $redirect_to = '')
{
$args = wp_array_slice_assoc($_GET, array('checkemail', 'registration', 'loggedout'));
if (!empty($redirect_to)) {
$args['redirect_to'] = urlencode($redirect_to);
}
if ($page_id = self::get_id()) {
$permalink = get_permalink($page_id);
} else {
$permalink = site_url('wp-login.php');
}
return esc_url(add_query_arg($args, $permalink), null, $context);
}
开发者ID:kalushta,项目名称:darom,代码行数:13,代码来源:views-login.php
示例8: get_comments_queried_language
/**
* Get the language to filter a comments query
*
* @since 2.0
*
* @param object $query
* @return object|bool the language(s) to use in the filter, false otherwise
*/
protected function get_comments_queried_language($query)
{
// Don't filter comments if comment ids or post ids are specified
$plucked = wp_array_slice_assoc($query->query_vars, array('comment__in', 'parent', 'post_id', 'post__in', 'post_parent'));
$fields = array_filter($plucked);
if (!empty($fields)) {
return false;
}
// Don't filter comments if a non translated post type is specified
if (!empty($query->query_vars['post_type']) && !$this->model->is_translated_post_type($query->query_vars['post_type'])) {
return false;
}
return empty($query->query_vars['lang']) ? $this->curlang : $this->model->get_language($query->query_vars['lang']);
}
开发者ID:JSreactor,项目名称:MarketCrater.com,代码行数:22,代码来源:filters.php
示例9: query
/**
* Run a search query.
*
* @since 1.5
* @uses apply_filters() geo_mashup_search_query_args Filter the geo query arguments.
*
* @param string|array $args Search parameters.
* @return array Search results.
**/
public function query($args)
{
$default_args = array('object_name' => 'post', 'object_ids' => null, 'exclude_object_ids' => null, 'units' => 'km', 'location_text' => '', 'radius' => null, 'sort' => 'distance_km ASC');
$this->query_vars = wp_parse_args($args, $default_args);
/** @var $units */
extract($this->query_vars);
$this->results = array();
$this->result_count = 0;
$this->result = null;
$this->current_result = -1;
$this->units = $units;
$this->max_km = 20000;
$this->distance_factor = 'km' == $units ? 1 : self::MILES_PER_KILOMETER;
$this->near_location = GeoMashupDB::blank_location(ARRAY_A);
$geo_query_args = wp_array_slice_assoc($this->query_vars, array('object_name', 'sort', 'exclude_object_ids', 'limit'));
if (!empty($near_lat) and !empty($near_lng)) {
$this->near_location['lat'] = $near_lat;
$this->near_location['lng'] = $near_lng;
} else {
if (!empty($location_text)) {
$geocode_text = empty($geolocation) ? $location_text : $geolocation;
if (!GeoMashupDB::geocode($geocode_text, $this->near_location)) {
// No search center was found, we can't continue
return $this->results;
}
} else {
// No coordinates to search near
return $this->results;
}
}
$radius_km = $this->max_km;
if (!empty($radius)) {
$radius_km = abs($radius) / $this->distance_factor;
}
$geo_query_args['radius_km'] = $radius_km;
$geo_query_args['near_lat'] = $this->near_location['lat'];
$geo_query_args['near_lng'] = $this->near_location['lng'];
if (isset($map_cat)) {
$geo_query_args['map_cat'] = $map_cat;
}
$geo_query_args = apply_filters('geo_mashup_search_query_args', $geo_query_args);
$this->results = GeoMashupDB::get_object_locations($geo_query_args);
$this->result_count = count($this->results);
if ($this->result_count > 0) {
$this->max_km = $this->results[$this->result_count - 1]->distance_km;
} else {
$this->max_km = $radius_km;
}
return $this->results;
}
开发者ID:amgxyz,项目名称:geocms-custom-maps,代码行数:59,代码来源:geo-mashup-search.php
示例10: __construct
/**
* Build it.
*
* @uses wp_array_slice_assoc()
* @uses wp_parse_args()
*
* @since 1.0.0
*
* @param array $args The array of arguments.
*/
public function __construct($args = array())
{
if (!isset($args['api_key'], $args['latitude'], $args['longitude'])) {
return false;
}
// Limit the arguments keys listed in the default array, then parse the submitted arguments
$limit_keys = array_keys($this->defaults);
$args = wp_array_slice_assoc($args, $limit_keys);
$this->args = wp_parse_args($args, $this->defaults);
// Build the query arguments for the forecast url
$query = !empty($this->query) && is_array($this->query) ? '?' . http_build_query($this->query) : '';
// Build the request url
$this->request_url = self::API_ENDPOINT . esc_attr($this->api_key) . '/' . floatval($this->latitude) . ',' . floatval($this->longitude) . (is_null($this->time) ? '' : ',' . $this->time) . $query;
// Get and save the response
$this->response = $this->get_response($this->clear_cache);
}
开发者ID:joshuadavidnelson,项目名称:wp-forecast-io,代码行数:26,代码来源:wp-forecast-io.php
示例11: gramm_list_authors
/**
* Custom List Users
*
* Custom function to generate a list of blog authors,
* built based on WordPress' native wp_list_users function.
*
* @since Grammatizator 0.6
*/
function gramm_list_authors($args = '')
{
// SET up variables
global $wpdb;
$defaults = array('orderby' => 'name', 'order' => 'ASC', 'role' => '', 'include' => array(), 'biolength' => 55, 'heading_tag' => 'h3', 'echo' => true);
$args = wp_parse_args($args, $defaults);
$return = '';
// GET data from database with database query
// Use this to get the paramenters we need for get_users() out of the default $args
$query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'role', 'include'));
// Used to request only an array of user IDs from get_users()
$query_args['fields'] = 'ids';
$authors = get_users($query_args);
// STEP through the data
foreach ($authors as $authorid) {
// GET individual user data and save in temporary variables
$author = get_userdata($authorid);
// First Last name
if ($author->first_name && $author->last_name) {
$name = "{$author->first_name} {$author->last_name}";
} else {
$name = $author->display_name;
}
// Bio
if (get_the_author_meta('description', $author->ID)) {
$bio = get_the_author_meta('description', $author->ID);
} else {
$bio = '';
}
// Twitter handle
if (get_the_author_meta('twitter', $author->ID)) {
$twit = '<p class="social-links"><a class="twitter" href="https://twitter.com/' . get_the_author_meta('twitter', $author->ID) . '" title="' . esc_attr(sprintf(__("%s on Twitter"), $author->display_name)) . '">@' . get_the_author_meta('twitter', $author->ID) . '</a></p>';
} else {
$twit = '';
}
// Link to users's posts
$authorlink = '<a class="fn" href="' . get_author_posts_url($author->ID, $author->user_nicename) . '" title="' . esc_attr(sprintf(__("Posts by %s"), $author->display_name)) . '">' . $name . '</a>';
/* Test me INSIDE the loop */
// TESTHERE
// Image (get later)
// BUILD output
}
// End foreach loop
/* Test me OUTSIDE the loop too! */
// TESTHERE
// OUTPUT results
}
开发者ID:admturner,项目名称:wordpress-learning-test,代码行数:55,代码来源:dsc-06.php
示例12: register
public static function register($args)
{
if (isset($args['name'])) {
if (strlen($args['name']) > 44) {
trigger_error(sprintf("Connection name '%s' is longer than 44 characters.", $args['name']), E_USER_WARNING);
return false;
}
} else {
trigger_error("Connection types without a 'name' parameter are deprecated.", E_USER_WARNING);
}
$args = wp_parse_args($args, array('name' => false, 'from_object' => 'post', 'to_object' => 'post', 'from' => 'post', 'to' => 'post', 'from_query_vars' => array(), 'to_query_vars' => array(), 'data' => array(), 'cardinality' => 'many-to-many', 'prevent_duplicates' => true, 'self_connections' => false, 'sortable' => false, 'title' => array(), 'from_labels' => '', 'to_labels' => '', 'reciprocal' => false));
$sides = array();
foreach (array('from', 'to') as $direction) {
$object = _p2p_pluck($args, $direction);
if ('user' == $object) {
$args[$direction . '_object'] = 'user';
} elseif ('attachment' == $object) {
$args[$direction . '_object'] = 'attachment';
}
if ('post' == $args[$direction . '_object']) {
$validated = array();
foreach ((array) $object as $ptype) {
if (!post_type_exists($ptype)) {
trigger_error("Post type '{$ptype}' is not defined.");
} else {
$validated[] = $ptype;
}
}
if (empty($validated)) {
$validated = array('post');
}
$args[$direction . '_query_vars']['post_type'] = $validated;
}
}
if (!$args['name']) {
$args['name'] = md5(serialize(array_values(wp_array_slice_assoc($args, array('from_object', 'to_object', 'from_query_vars', 'to_query_vars', 'data')))));
}
$args = apply_filters('p2p_connection_type_args', $args);
$ctype = new P2P_Connection_Type($args);
if (isset(self::$instances[$ctype->name])) {
trigger_error("Connection type '{$ctype->name}' is already defined.", E_USER_NOTICE);
}
self::$instances[$ctype->name] = $ctype;
return $ctype;
}
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:45,代码来源:type-factory.php
示例13: user_query
static function user_query($query)
{
if (!function_exists('get_current_screen')) {
return;
}
$current_screen = get_current_screen();
if ($current_screen && 'users' != $current_screen->id) {
return;
}
if (isset($query->_p2p_capture)) {
return;
}
// Don't overwrite existing P2P query
if (isset($query->query_vars['connected_type'])) {
return;
}
_p2p_append($query->query_vars, wp_array_slice_assoc($_GET, self::get_custom_qv()));
}
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:url-query.php
示例14: json
/**
* Gather the parameters passed to client JavaScript via JSON.
*
* @since 4.1.0
* @return array The array to be exported to the client as JSON.
*/
public function json()
{
$array = wp_array_slice_assoc((array) $this, array('id', 'title', 'description', 'priority', 'panel', 'type'));
$array['content'] = $this->get_content();
$array['active'] = $this->active();
$array['instanceNumber'] = $this->instance_number;
if ($this->panel) {
/* translators: ▸ is the unicode right-pointing triangle, and %s is the section title in the Customizer */
$array['customizeAction'] = sprintf(__('Customizing ▸ %s', 'redux-framework'), esc_html($this->manager->get_panel($this->panel)->title));
} else {
$array['customizeAction'] = __('Customizing', 'redux-framework');
}
// BEGIN Redux Additions
$array['width'] = isset($this->section['customizer_width']) ? $this->section['customizer_width'] : '';
$array['icon'] = isset($this->section['icon']) && !empty($this->section['icon']) ? $this->section['icon'] : 'hide';
// EMD Redux Additions
return $array;
}
开发者ID:pcuervo,项目名称:od4d,代码行数:24,代码来源:advanced_customizer_section.php
示例15: stt2extat_default_setting
function stt2extat_default_setting($option = '')
{
global $stt2extat_sanitize;
$args = $stt2extat_sanitize->sanitize();
switch ($option) {
case 'update':
return $args;
break;
case 'shortcode':
$default = array('text_header', 'html_heading', 'number', 'display', 'count', 'convert');
$args = wp_array_slice_assoc($args, $default);
return $args;
break;
default:
$args = apply_filters('stt2extat_default_settings', $args);
return $args;
break;
}
}
开发者ID:Jevuska,项目名称:stt2-extension-add-terms,代码行数:19,代码来源:settings.php
示例16: wpex_active_skin_class_file
function wpex_active_skin_class_file()
{
// Get active skin
$active_skin = wpex_active_skin();
// Lets bail if the active skin is the base skin
if ('base' == $active_skin || !$active_skin) {
return;
}
// Get currect skin class to load later
$skins = wpex_skins();
$active_skin_array = wp_array_slice_assoc($skins, array($active_skin));
if (is_array($active_skin_array)) {
$is_core = !empty($active_skin_array[$active_skin]['core']) ? true : false;
$class_file = !empty($active_skin_array[$active_skin]['class']) ? $active_skin_array[$active_skin]['class'] : false;
}
// Return class file if one exists
if ($is_core && $class_file) {
return $class_file;
}
}
开发者ID:sergey-h,项目名称:naman,代码行数:20,代码来源:skins.php
示例17: register
public static function register($args)
{
$args = wp_parse_args($args, array('name' => false, 'from_object' => 'post', 'to_object' => 'post', 'from' => 'post', 'to' => 'post', 'from_query_vars' => array(), 'to_query_vars' => array(), 'data' => array(), 'cardinality' => 'many-to-many', 'prevent_duplicates' => true, 'sortable' => false, 'title' => array(), 'from_labels' => '', 'to_labels' => '', 'reciprocal' => false));
$sides = array();
foreach (array('from', 'to') as $direction) {
$object = _p2p_pluck($args, $direction);
if ('user' == $object) {
$args[$direction . '_object'] = 'user';
} elseif ('attachment' == $object) {
$args[$direction . '_object'] = 'attachment';
}
if ('post' == $args[$direction . '_object']) {
$validated = array();
foreach ((array) $object as $ptype) {
if (!post_type_exists($ptype)) {
trigger_error("Post type '{$ptype}' is not defined.");
} else {
$validated[] = $ptype;
}
}
if (empty($validated)) {
$validated = array('post');
}
$args[$direction . '_query_vars']['post_type'] = $validated;
}
}
if (!$args['name']) {
$args['name'] = md5(serialize(array_values(wp_array_slice_assoc($args, array('from_object', 'to_object', 'from_query_vars', 'to_query_vars', 'data')))));
}
if ($args['from_object'] == $args['to_object'] && 'post' == $args['from_object']) {
$class = 'P2P_Connection_Type';
} else {
$class = 'Generic_Connection_Type';
}
$ctype = new $class($args);
if (isset(self::$instances[$ctype->name])) {
trigger_error('Connection type is already defined.', E_USER_NOTICE);
}
self::$instances[$ctype->name] = $ctype;
return $ctype;
}
开发者ID:netconstructor,项目名称:wp-posts-to-posts,代码行数:41,代码来源:type-factory.php
示例18: action_plugins_loaded
/**
* Instantiate SCB framework classes.
*/
public static function action_plugins_loaded()
{
$invite_subject = sprintf(__('You\'re invited to subscribe to %s', 'Postmatic'), get_option('blogname'));
$invite_intro = __('This is an invitation to subscribe to email updates from this website. We hope it is welcome, but we promise we won\'t contact you again unless you respond.', 'Postmatic');
$subscribed_introduction = '<h2>' . __('Thanks for signing up!', 'Postmatic') . '</h2>' . '<p>' . __('We\'re glad you\'ve decided to join and hope you enjoy our posts.', 'Postmatic') . '</p>';
$default_options = array('auto_subscribe_authors' => true, 'prompt_key' => '', 'site_subscription_post_types' => array('post'), 'skip_notices' => array(), 'skip_widget_intro' => false, 'skip_akismet_intro' => false, 'skip_zero_spam_intro' => false, 'skip_local_mail_intro' => false, 'skip_moderation_user_intro' => false, 'redirect_to_options_page' => true, 'send_login_info' => false, 'email_header_type' => Prompt_Enum_Email_Header_Types::TEXT, 'email_header_image' => 0, 'email_header_text' => get_option('blogname'), 'email_footer_type' => Prompt_Enum_Email_Footer_Types::WIDGETS, 'email_footer_text' => '', 'email_footer_credit' => true, 'plan' => '', 'email_transport' => Prompt_Enum_Email_Transports::LOCAL, 'messages' => array('welcome' => __('Welcome!', 'Postmatic')), 'invite_subject' => $invite_subject, 'invite_introduction' => $invite_intro, 'last_version' => 0, 'enable_collection' => false, 'site_icon' => 0, 'no_post_featured_image_default' => false, 'no_post_email_default' => false, 'enabled_message_types' => array(), 'excerpt_default' => false, 'comment_opt_in_default' => false, 'comment_opt_in_text' => __('Continue this conversation via email', 'Postmatic'), 'comment_flood_control_trigger_count' => 6, 'upgrade_required' => false, 'enable_optins' => false, 'enable_skimlinks' => false, 'skimlinks_publisher_id' => '', 'emails_per_chunk' => 25, 'enable_digests' => false, 'digest_plans' => array(), 'site_styles' => array(), 'enable_invites' => false, 'enable_mailchimp_import' => false, 'enable_jetpack_import' => false, 'enable_mailpoet_import' => false, 'enable_post_delivery' => true, 'enable_comment_delivery' => true, 'subscribed_introduction' => $subscribed_introduction, 'connected' => false, 'scr_import_done' => false);
$default_options = array_merge($default_options, Prompt_Optins::options_fields());
self::prevent_options_errors();
self::$options = new scbOptions('prompt_options', __FILE__, $default_options);
/**
* Filter overridden options.
*
* @param array $overridden_options
* @param array $current_options
*/
$filtered_options = apply_filters('prompt/override_options', array(), self::$options->get());
self::$overridden_options = wp_array_slice_assoc($filtered_options, array_keys(self::$options->get()));
if (!empty(self::$overridden_options)) {
self::$options->set(self::$overridden_options);
}
// Until we have a key we won't do much
$key = self::$options->get('prompt_key');
if ($key) {
self::add_hooks();
}
if (is_admin()) {
self::settings_page();
self::delivery_metabox();
self::text_metabox();
self::$activate_notice = new Prompt_Admin_Activate_Notice($key, self::$settings_page);
}
/**
* Fires when Postmatic has loaded.
*
* This happens after plugins are loaded {@see 'plugins_loaded'}, and always fires when Postmatic is active.
*
* @since 1.0.0
*/
do_action('prompt/core_loaded');
}
开发者ID:postmatic,项目名称:beta-dist,代码行数:43,代码来源:core.php
示例19: comments_clauses
/**
* filters the comments according to the current language
* used by the recent comments widget and admin language filter
*
* @since 0.2
*
* @param array $clauses sql clauses
* @param object $query WP_Comment_Query object
* @return array modified $clauses
*/
public function comments_clauses($clauses, $query)
{
global $wpdb;
// don't filter comments if comment ids or post ids are specified
$plucked = wp_array_slice_assoc($query->query_vars, array('comment__in', 'parent', 'post_id', 'post__in', 'post_parent'));
$fields = array_filter($plucked);
if (!empty($fields)) {
return $clauses;
}
// don't filter comments if a non translated post type is specified
if (!empty($query->query_vars['post_type']) && !$this->model->is_translated_post_type($query->query_vars['post_type'])) {
return $clauses;
}
$lang = empty($query->query_vars['lang']) ? $this->curlang : $this->model->get_language($query->query_vars['lang']);
if (!empty($lang)) {
// if this clause is not already added by WP
if (!strpos($clauses['join'], '.ID')) {
$clauses['join'] .= " JOIN {$wpdb->posts} ON {$wpdb->posts}.ID = {$wpdb->comments}.comment_post_ID";
}
$clauses['join'] .= $this->model->post->join_clause();
$clauses['where'] .= $this->model->post->where_clause($lang);
}
return $clauses;
}
开发者ID:spielhoelle,项目名称:amnesty,代码行数:34,代码来源:filters.php
示例20: wp_dropdown_users
/**
* Create dropdown HTML content of users.
*
* The content can either be displayed, which it is by default or retrieved by
* setting the 'echo' argument. The 'include' and 'exclude' arguments do not
* need to be used; all users will be displayed in that case. Only one can be
* used, either 'include' or 'exclude', but not both.
*
* The available arguments are as follows:
*
* @since 2.3.0
*
* @global int $blog_id
*
* @param array|string $args {
* Optional. Array or string of arguments to generate a drop-down of users.
* {@see WP_User_Query::prepare_query() for additional available arguments.
*
* @type string $show_option_all Text to show as the drop-down default (all).
* Default empty.
* @type string $show_option_none Text to show as the drop-down default when no
* users were found. Default empty.
* @type int|string $option_none_value Value to use for $show_option_non when no users
* were found. Default -1.
* @type string $hide_if_only_one_author Whether to skip generating the drop-down
* if only one user was found. Default empty.
* @type string $orderby Field to order found users by. Accepts user fields.
* Default 'display_name'.
* @type string $order Whether to order users in ascending or descending
* order. Accepts 'ASC' (ascending) or 'DESC' (descending).
* Default 'ASC'.
* @type array|string $include Array or comma-separated list of user IDs to include.
* Default empty.
* @type array|string $exclude Array or comma-separated list of user IDs to exclude.
* Default empty.
* @type bool|int $multi Whether to skip the ID attribute on the 'select' element.
* Accepts 1|true or 0|false. Default 0|false.
* @type string $show User table column to display. If the selected item is empty
* then the 'user_login' will be displayed in parentheses.
* Accepts user fields. Default 'display_name'.
* @type int|bool $echo Whether to echo or return the drop-down. Accepts 1|true (echo)
* or 0|false (return). Default 1|true.
* @type int $selected Which user ID should be selected. Default 0.
* @type bool $include_selected Whether to always include the selected user ID in the drop-
* down. Default false.
* @type string $name Name attribute of select element. Default 'user'.
* @type string $id ID attribute of the select element. Default is the value of $name.
* @type string $class Class attribute of the select element. Default empty.
* @type int $blog_id ID of blog (Multisite only). Default is ID of the current blog.
* @type string $who Which type of users to query. Accepts only an empty string or
* 'authors'. Default empty.
* }
* @return string String of HTML content.
*/
function wp_dropdown_users($args = '')
{
$defaults = array('show_option_all' => '', 'show_option_none' => '', 'hide_if_only_one_author' => '', 'orderby' => 'display_name', 'order' => 'ASC', 'include' => '', 'exclude' => '', 'multi' => 0, 'show' => 'display_name', 'echo' => 1, 'selected' => 0, 'name' => 'user', 'class' => '', 'id' => '', 'blog_id' => $GLOBALS['blog_id'], 'who' => '', 'include_selected' => false, 'option_none_value' => -1);
$defaults['selected'] = is_author() ? get_query_var('author') : 0;
$r = wp_parse_args($args, $defaults);
$show = $r['show'];
$show_option_all = $r['show_option_all'];
$show_option_none = $r['show_option_none'];
$option_none_value = $r['option_none_value'];
$query_args = wp_array_slice_assoc($r, array('blog_id', 'include', 'exclude', 'orderby', 'order', 'who'));
$query_args['fields'] = array('ID', 'user_login', $show);
/**
* Filter the query arguments for the user drop-down.
*
* @since 4.4.0
*
* @param array $query_args The query arguments for wp_dropdown_users().
* @param array $r The default arguments for wp_dropdown_users().
*/
$query_args = apply_filters('wp_dropdown_users_args', $query_args, $r);
$users = get_users($query_args);
$output = '';
if (!empty($users) && (empty($r['hide_if_only_one_author']) || count($users) > 1)) {
$name = esc_attr($r['name']);
if ($r['multi'] && !$r['id']) {
$id = '';
} else {
$id = $r['id'] ? " id='" . esc_attr($r['id']) . "'" : " id='{$name}'";
}
$output = "<select name='{$name}'{$id} class='" . $r['class'] . "'>\n";
if ($show_option_all) {
$output .= "\t<option value='0'>{$show_option_all}</option>\n";
}
if ($show_option_none) {
$_selected = selected($option_none_value, $r['selected'], false);
$output .= "\t<option value='" . esc_attr($option_none_value) . "'{$_selected}>{$show_option_none}</option>\n";
}
$found_selected = false;
foreach ((array) $users as $user) {
$user->ID = (int) $user->ID;
$_selected = selected($user->ID, $r['selected'], false);
if ($_selected) {
$found_selected = true;
}
$display = !empty($user->{$show}) ? $user->{$show} : '(' . $user->user_login . ')';
$output .= "\t<option value='{$user->ID}'{$_selected}>" . esc_html($display) . "</option>\n";
//.........这里部分代码省略.........
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:101,代码来源:user.php
注:本文中的wp_array_slice_assoc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论