本文整理汇总了PHP中__checked_selected_helper函数的典型用法代码示例。如果您正苦于以下问题:PHP __checked_selected_helper函数的具体用法?PHP __checked_selected_helper怎么用?PHP __checked_selected_helper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__checked_selected_helper函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpmm_multiselect
/**
* Outputs the html selected attribute
*
* @since 2.0.4
* @param array $values
* @param string $current
* @param bool $echo
* @return string html attribute or empty string
*/
function wpmm_multiselect($values, $current)
{
foreach ($values as $k => $role) {
$is_selected = __checked_selected_helper($role, $current, false, 'selected');
if (!empty($is_selected)) {
return $is_selected;
break;
}
}
}
示例2: disabled
/**
* @since 3.0
* @see /wp-includes/general-template.php
*/
function disabled($disabled, $current = true, $echo = true)
{
if (function_exists('disabled')) {
return disabled($disabled, $current, $echo);
} else {
if (function_exists('__checked_selected_helper')) {
return __checked_selected_helper($disabled, $current, $echo, 'disabled');
}
}
$result = $disabled == $current ? " disabled='disabled'" : '';
if ($echo) {
echo $result;
}
return $result;
}
示例3: get_meta_box
public function get_meta_box($post)
{
$use_caption = get_post_meta($post->ID, 'ss-slide-use-caption', true);
$use_caption_title = get_post_meta($post->ID, 'ss-slide-use-caption-title', true);
$link = get_post_meta($post->ID, 'ss-slide-link', true);
$link_new_window = get_post_meta($post->ID, 'ss-slide-link-new-window', true);
wp_nonce_field('ss-slide-edit', 'ss-slide-options-nonce');
?>
<p>
<strong>Caption</strong><br />
<label>
<input type="checkbox" name="ss-slide-use-caption" id="ss-slide-use-caption" value="1" <?php
__checked_selected_helper('1', $use_caption, true, 'checked');
?>
/>
Enable caption for this slide.
</label><br />
<label>
<input type="checkbox" name="ss-slide-use-caption-title" id="ss-slide-use-caption-title" value="1" <?php
__checked_selected_helper('1', $use_caption_title, true, 'checked');
?>
/>
Add slide title to caption.
</label>
</p>
<p>
<strong>Link</strong><br />
<input type="text" name="ss-slide-link" id="ss-slide-link" value="<?php
echo $link;
?>
" style="width: 100%;" /><br />
<label><input type="checkbox" name="ss-slide-link-new-window" id="ss-slide-link-new-window" value="1" <?php
__checked_selected_helper('1', $link_new_window, true, 'checked');
?>
/> Open link in new window.</label>
</p>
<?php
}
示例4: disabled
/**
* Outputs the html disabled attribute.
*
* Compares the first two arguments and if identical marks as disabled
*
* @since 3.0.0
*
* @param mixed $disabled One of the values to compare
* @param mixed $current (true) The other value to compare if not just true
* @param bool $echo Whether to echo or just return the string
* @return string html attribute or empty string
*/
function disabled($disabled, $current = true, $echo = true)
{
return __checked_selected_helper($disabled, $current, $echo, 'disabled');
}
示例5: gv_selected
/**
* Similar to the WordPress `selected()`, `checked()`, and `disabled()` functions, except it allows arrays to be passed as current value
*
* @todo Move to helper-functions.php
* @see selected() WordPress core function
*
* @param string $value One of the values to compare
* @param mixed $current (true) The other value to compare if not just true
* @param bool $echo Whether to echo or just return the string
* @param string $type The type of checked|selected|disabled we are doing
*
* @return string html attribute or empty string
*/
function gv_selected($value, $current, $echo = true, $type = 'selected')
{
$output = '';
if (is_array($current)) {
if (in_array($value, $current)) {
$output = __checked_selected_helper(true, true, false, $type);
}
} else {
$output = __checked_selected_helper($value, $current, false, $type);
}
if ($echo) {
echo $output;
}
return $output;
}
示例6: metabox_authorization_content
/**
* Render Authorization meta box.
*/
function metabox_authorization_content($data)
{
if (!$this->goauth->is_authorized()) {
?>
<form action="<?php
echo $this->redirect_uri;
?>
" method="post">
<p><?php
_e('Before backups can be uploaded to Google Drive, you need to authorize the plugin and give it permission to make changes on your behalf.', $this->text_domain);
?>
</p>
<p>
<label for="client_id"><?php
_e('Client ID', $this->text_domain);
?>
</label>
<input id="client_id" name="client_id" type='text' <?php
__checked_selected_helper(defined('BACKUP_CLIENT_ID'), true, true, 'readonly');
?>
class="large-text" value='<?php
echo esc_html($this->options['client_id']);
?>
' />
</p>
<p>
<label for="client_secret"><?php
_e('Client secret', $this->text_domain);
?>
<input id="client_secret" name='client_secret' type='text' <?php
__checked_selected_helper(defined('BACKUP_CLIENT_SECRET'), true, true, 'readonly');
?>
class="large-text" value='<?php
echo esc_html($this->options['client_secret']);
?>
' />
</p>
<p class="para hide-if-js">
<label for="refresh_token"><?php
_e('Refresh token', $this->text_domain);
?>
<input id="refresh_token" name='refresh_token' type='text' <?php
__checked_selected_helper(defined('BACKUP_REFRESH_TOKEN'), true, true, 'readonly');
?>
class="large-text" value='<?php
echo esc_html($this->options['refresh_token']);
?>
' />
</p>
<p>
<input name="authorize" type="submit" class="button-secondary" value="<?php
_e('Authorize', $this->text_domain);
?>
" /> <a href="#refresh_token" class="show-para hide-if-no-js"><?php
_e('More', $this->text_domain);
?>
</a>
</p>
</form>
<?php
} else {
?>
<?php
if (!empty($this->options['user_info'])) {
?>
<div id="dashboard_right_now" class="column-username">
<?php
if ($this->options['user_info']['picture']) {
?>
<img src="<?php
echo $this->options['user_info']['picture'];
?>
" width="50" heigth="50" />
<?php
} else {
$default = get_option('avatar_default');
if (empty($default)) {
$default = 'mystery';
}
echo get_avatar($this->options['user_info']['email'], 50, $default);
}
?>
<strong><?php
echo $this->options['user_info']['name'];
?>
</strong><br />
<?php
echo $this->options['user_info']['email'];
?>
<br />
<span class="approved"><?php
_e("Authorized", $this->text_domain);
?>
</span>
</div>
<?php
}
//.........这里部分代码省略.........
示例7: page_settings
public function page_settings()
{
?>
<div class="wrap">
<div class="icon32" id="icon-options-general"></div>
<h2>Default Settings</h2>
<?php
if ('true' == $_GET['settings-updated']) {
?>
<div id="message" class="updated below-h2">
<p>Simple Slides default settings has been succesfully updated.</p>
</div>
<?php
}
?>
<p>
Use <strong>shortcode attributes</strong> to override these default settings. Shortcode attribute names are indicated below each setting label.
</p>
<p>
For more information, please refer to the <a target="_blank" href="http://apocalypseboy.com/simple-slides/">plugin documentation</a>.
</p>
<form action="options.php" method="post">
<?php
$settings = $this->get_settings();
echo settings_fields($this->settings_name);
?>
<table class="form-table">
<tr>
<th scope="row">
<label>Theme</label><br />
<span class="description">[theme]</span>
</th>
<td>
<select name="<?php
echo $this->settings_name;
?>
[script][script_settings_nojs][theme]">
<option value="default" <?php
__checked_selected_helper('default', $settings['script']['script_settings_nojs']['theme'], true, 'selected');
?>
>Default</option>
<option value="clean" <?php
__checked_selected_helper('clean', $settings['script']['script_settings_nojs']['theme'], true, 'selected');
?>
>Clean</option>
<option value="bar" <?php
__checked_selected_helper('bar', $settings['script']['script_settings_nojs']['theme'], true, 'selected');
?>
>Bar</option>
<option value="dark" <?php
__checked_selected_helper('dark', $settings['script']['script_settings_nojs']['theme'], true, 'selected');
?>
>Dark</option>
<option value="light" <?php
__checked_selected_helper('light', $settings['script']['script_settings_nojs']['theme'], true, 'selected');
?>
>Light</option>
</select>
<span class="description"></span>
</td>
</tr>
<tr>
<th scope="row">
<label>Image Size</label><br />
<span class="description">[image_size]</span>
</th>
<td>
<input class="regular-text" type="text" name="<?php
echo $this->settings_name;
?>
[script][script_settings_nojs][image_size]" value="<?php
echo $settings['script']['script_settings_nojs']['image_size'];
?>
" /><br />
<span class="description"></span>
</td>
</tr>
<tr>
<th scope="row">
<label>Width</label><br />
<span class="description">[width]</span>
</th>
<td>
<input class="regular-text" type="text" name="<?php
echo $this->settings_name;
?>
[script][script_settings_nojs][width]" value="<?php
echo $settings['script']['script_settings_nojs']['width'];
?>
" /><br />
<span class="description">Can be any css value that's appropiate for width. (e.g. auto, 300px, 95%)</span>
</td>
</tr>
<tr>
<th scope="row">
<label>Height</label><br />
<span class="description">[height]</span>
</th>
//.........这里部分代码省略.........
示例8: displayDropdown
/**
* Display Dropdown callback: displays a harvesthq.github.io/chosen/ dropdown.
* special arguments:
*
* - bool required
* - bool multiple
* - array | string value
* - array items | callable itemsCallback
* @param $args
* @return mixed|string
*/
public function displayDropdown($args)
{
$key = $args['post']->ID . '_' . $args['key'];
$html = $this->getTemplate($args, $key);
if (isset($args['name'])) {
$name = $args['name'];
} else {
// Get the current value
$name = $key;
}
$attr = '';
if (isset($args['required'])) {
$attr .= __checked_selected_helper($args['required'], true, false, 'required');
}
$singleValue = true;
if (isset($args['multiple']) && $args['multiple']) {
$attr .= ' multiple';
$arrayNotation = '[]';
if (substr($name, -strlen($arrayNotation)) !== $arrayNotation) {
$name .= $arrayNotation;
}
$singleValue = false;
}
if (isset($args['value']) && (!$singleValue || is_string($args['value']))) {
$value = $args['value'];
} elseif (isset($args['value'][0]) && $singleValue) {
$value = $args['value'][0];
} else {
// Get the current value
$value = get_post_meta($args['post']->ID, $args['key'], $singleValue);
if (!$singleValue) {
$value = array_filter($value);
}
}
$items = $args['items'];
if (isset($args['itemsCallback']) && is_callable($args['itemsCallback'])) {
$items = callUserFunctionWithSafeArguments($args['itemsCallback'], array($args));
}
if (isset($args['allow_single_deselect']) && $args['allow_single_deselect'] == true) {
$items = array(0 => array('title' => '')) + $items;
}
$options = self::convertDropdownItemsToOptions($items, $value, $singleValue);
$select = '<select name="' . $name . '" id="' . $key . '" ' . $attr . '>' . implode('', $options) . '</select>';
$chosenArguments = array_merge(array('width' => '100%'), $args);
$chosenKey = str_replace('-', '_', $key) . '_chosen';
// only call the sortable method if it was requested
$sortableCall = '';
if ($chosenArguments['sortable'] != false) {
$sortableCall = '.chosenSortable()';
}
// convert array to object recursively
$chosenArgumentsObject = json_decode(json_encode($chosenArguments), FALSE);
$chosenArgumentsJson = json_encode($chosenArgumentsObject);
$select .= '
<script>
(function ($) {
$(document).ready(function(){
$("#' . $key . '").on("chosen:ready change", function(evt, params) {
$("#' . $chosenKey . ' .search-choice").each(function(){
// compare label to option text
var label = $(this).text().trim();
var options = $("#' . $key . '").find("option").filter(function(){
return $(this).text().trim() == label;
});
if(options.length > 0){
var option = options[0];
if($(option).data("url")){
if(!$(this).hasClass("has-link-action")){
$(".search-choice-close", this).before("<a class=\\"search-choice-link\\" href=\\"" + $(option).data("url") + "\\" ></a>");
$(this).addClass("has-link-action");
}
}
if($(option).data("image")){
if(!$(this).hasClass("has-image")){
$("span", this).before("<img class=\\"search-choice-image\\" src=\\"" + $(option).data("image") + "\\" />");
$(this).addClass("has-image");
}
}
}
});
$("#' . $chosenKey . ' .search-choice-link").click(function(e){
// chosen is registered on parent, stop the propagation, but don\'t prevent the default action (i.e. browswer link)
e.stopPropagation();
});
});
//.........这里部分代码省略.........
示例9: _e
_e("Local backups as well as other files created by the plugin will be stored on this path.", $this->text_domain);
?>
</p>
</td>
</tr>
<?php
if ($this->goauth->is_authorized()) {
?>
<tr valign="top">
<th scope="row"><label for="drive_folder"><?php
_e('Drive folder ID', $this->text_domain);
?>
</label></th>
<td>
<input id="drive_folder" name="drive_folder" type="text" <?php
__checked_selected_helper(defined('BACKUP_DRIVE_FOLDER'), true, true, 'readonly');
?>
class="regular-text code" value="<?php
echo esc_html($this->options['drive_folder']);
?>
" />
<p class="description"><?php
_e('Backups will be uploaded to this folder. Leave empty to save in root folder.', $this->text_domain);
?>
</p>
</td>
</tr>
<?php
}
?>
<tr valign="top">