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


PHP checked函数代码示例

本文整理汇总了PHP中checked函数的典型用法代码示例。如果您正苦于以下问题:PHP checked函数的具体用法?PHP checked怎么用?PHP checked使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: render_field

 function render_field($args)
 {
     $field_value = $this->get_value($args);
     echo '<input type="hidden" name="' . $args['field_name'] . '" value="0" />';
     echo '<input type="checkbox" name="' . $args['field_name'] . '" id="' . $args['field_id'] . '" value="1" ' . checked($field_value, 1, false) . ' class="stylish-checkbox" />';
     echo '<label for="' . $args['field_id'] . '">&nbsp;</label>';
 }
开发者ID:ernilambar,项目名称:admin-customizer,代码行数:7,代码来源:checkbox_simple.php

示例2: settings

        public function settings()
        {
            $use_custom = get_option('kt_color_grid_custom', '0');
            $sets = get_option('kt_color_grid_sets', array());
            $html = '';
            foreach ($sets as $set) {
                list($color, $name) = $set;
                $html .= sprintf('
            ' . $this->blueprint, $color, $name);
            }
            echo '
<div class="wrap"><h1>' . __('Settings') . ' › TinyMCE Color Grid</h1>
    <form action="" method="post">
        ' . wp_nonce_field('kt-tinymce-color-grid-save-settings', 'settings_nonce', false, false) . '
        <table class="form-table">
            <tbody>
                <tr>
                    <th><input type="checkbox" id="checkbox_custom" name="custom" value="yes"' . checked($use_custom, '1', false) . ' />
                        <label for="checkbox_custom">' . __("I'd like to define some custom colors", 'kt-tinymce-color-grid') . '</label></th>
                </tr>
            </tbody>
        </table>
        <div id="custom_colors"' . ($use_custom ? '' : ' style="display: none"') . '>' . $html . '
            <button id="add_custom_color" type="button" class="button button dashicons-before dashicons-plus">' . __('Add') . '</button>
        </div>
        <button type="submit" name="action" value="save-settings" class="button button-primary">' . __('Save') . '</button>
    </form>
</div>';
        }
开发者ID:amptdesign,项目名称:digi,代码行数:29,代码来源:kt-tinymce-color-grid.php

示例3: output_checkbox

	/**
	 * Outputs the sign-up checkbox, will only run once.
	 *
	 * @return bool
	 */
	public function output_checkbox() {
		$opts = $this->options;

		// If using option to hide checkbox for subscribers and cookie is set, set instance variable showed_checkbox to true so checkbox won't show.
		if ( $opts['cookie_hide'] == 1 && isset( $_COOKIE['ns_subscriber'] ) ) {
			$this->showed_checkbox = true;
		}

		// User could have rendered the checkbox by manually adding 'the hook 'ns_comment_checkbox()' to their comment form
		// If so, abandon function.
		if ( $this->showed_checkbox ) {
			return false;
		}

		?>
		<!-- Checkbox by Newsletter Sign-Up Checkbox v<?php echo NSU_VERSION_NUMBER; ?> - https://wordpress.org/plugins/newsletter-sign-up/ -->
		<p id="nsu-checkbox">
			<label for="nsu-checkbox-input" id="nsu-checkbox-label">
				<input value="1" id="nsu-checkbox-input" type="checkbox" name="newsletter-sign-up-do" <?php checked( $opts['precheck'], 1 ); ?> />
				<?php _e( $opts['text'], 'newsletter-sign-up' ); ?>
			</label>
		</p>
		<!-- / Newsletter Sign-Up -->
		<?php

		// make sure checkbox doesn't show again
		$this->showed_checkbox = true;

		return true;
	}
开发者ID:recetasdemama,项目名称:wordpress,代码行数:35,代码来源:NSU_Checkbox.php

示例4: render

 /**
  * Field Render Function.
  *
  * Takes the vars and outputs the HTML for the field in the settings
  *
  * @since NHP_Options 1.0
  */
 function render()
 {
     $class = isset($this->field['class']) ? $this->field['class'] : '';
     echo $this->field['desc'] != '' ? ' <label for="' . $this->field['id'] . '">' : '';
     echo '<input type="checkbox" id="' . $this->field['id'] . '" name="' . $this->args['opt_name'] . '[' . $this->field['id'] . ']" value="1" class="' . $class . '" ' . checked($this->value, '1', false) . '/>';
     echo isset($this->field['desc']) && !empty($this->field['desc']) ? ' ' . $this->field['desc'] . '</label>' : '';
 }
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:14,代码来源:field_checkbox.php

示例5: output

    /**
     * Output the metabox
     */
    public static function output($post)
    {
        wp_nonce_field('prosports_save_data', 'prosports_meta_nonce');
        $the_format = get_post_meta($post->ID, 'sp_format', true);
        ?>
		<div id="post-formats-select">
			<?php 
        foreach (SP()->formats->list as $key => $format) {
            ?>
				<input type="radio" name="sp_format" class="post-format" id="post-format-<?php 
            echo $key;
            ?>
" value="<?php 
            echo $key;
            ?>
" <?php 
            checked(true, $key == 'list' && !$the_format || $the_format == $key);
            ?>
> <label for="post-format-<?php 
            echo $key;
            ?>
" class="post-format-icon post-format-<?php 
            echo $key;
            ?>
"><?php 
            echo $format;
            ?>
</label><br>
			<?php 
        }
        ?>
		</div>
		<?php 
    }
开发者ID:kleitz,项目名称:ProSports,代码行数:37,代码来源:class-sp-meta-box-list-format.php

示例6: AtD_print_option

function AtD_print_option($name, $value, $options)
{
    // Attribute-safe version of $name
    $attr_name = sanitize_title($name);
    // Using sanitize_title since there's no comparable function for attributes
    ?>
   <input type="checkbox" id="atd_<?php 
    echo $attr_name;
    ?>
" name="<?php 
    echo $options['name'];
    ?>
[<?php 
    echo $name;
    ?>
]" value="1" <?php 
    checked('1', $options[$name]);
    ?>
> <label for="atd_<?php 
    echo $attr_name;
    ?>
"><?php 
    echo $value;
    ?>
</label>
<?php 
}
开发者ID:sajidsan,项目名称:sajidsan.github.io,代码行数:27,代码来源:config-options.php

示例7: freedom_page_layout

/**
 * Displays metabox to for select layout option
 */
function freedom_page_layout()
{
    global $page_layout, $post;
    // Use nonce for verification
    wp_nonce_field(basename(__FILE__), 'custom_meta_box_nonce');
    foreach ($page_layout as $field) {
        $layout_meta = get_post_meta($post->ID, $field['id'], true);
        if (empty($layout_meta)) {
            $layout_meta = 'default_layout';
        }
        ?>
			<input class="post-format" type="radio" name="<?php 
        echo $field['id'];
        ?>
" value="<?php 
        echo $field['value'];
        ?>
" <?php 
        checked($field['value'], $layout_meta);
        ?>
/>
			<label class="post-format-icon"><?php 
        echo $field['label'];
        ?>
</label><br/>
		<?php 
    }
}
开发者ID:idea-lab,项目名称:Spectrum,代码行数:31,代码来源:meta-boxes.php

示例8: sur_post_custom_metas

function sur_post_custom_metas($post)
{
    global $post;
    if (get_post_type($post) === "post" || get_post_type($post) === "page") {
        // Use nonce for verification
        wp_nonce_field('sur_post_custom_metas', 'sur_noncename');
        $sur_custom_bg = get_post_meta($post->ID, 'sur_custom_bg', true);
        $sur_hide_title = get_post_meta($post->ID, 'sur_hide_title', true);
        $sur_hide_breadcrumbs = get_post_meta($post->ID, 'sur_hide_breadcrumbs', true);
        ?>
	<table class="form-table">
	<tr>
		<th><label for="sur_custom_bg">Background URL</label></th>
		<td><input type="text" id="sur_custom_bg" name="sur_custom_bg" value="<?php 
        echo $sur_custom_bg;
        ?>
" size="120" class="" /></td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="checkbox" id="sur_hide_breadcrumbs" name="sur_hide_breadcrumbs" value="hide" <?php 
        checked($sur_hide_breadcrumbs, 'hide');
        ?>
/> <label for="sur_hide_breadcrumbs">Hide Breadcrumbs</label>&nbsp;
			<input type="checkbox" id="sur_hide_title" name="sur_hide_title" value="hide" <?php 
        checked($sur_hide_title, 'hide');
        ?>
/> <label for="sur_hide_title">Hide Title</label> &nbsp; <em>Title and Breadcrumbs are automatically hidden on Blank Template.</em>
		</td>
	</tr>
	</table>
<?php 
    }
}
开发者ID:wp-thema,项目名称:magxpress,代码行数:34,代码来源:metabox-post.php

示例9: tutsplus_register_form_edit

/**
 * Adding the HTML to the existing registration form
 */
function tutsplus_register_form_edit()
{
    $twitter_name = !empty($_POST['twitter_name']) ? trim($_POST['twitter_name']) : '';
    ?>
	<p>
	<label for="twitter_name">
		<?php 
    _e('Twitter name', 'sage');
    ?>
<br />
		<input type="text" name="twitter_name" id="twitter_name" class="input" value="<?php 
    echo esc_attr(wp_unslash($twitter_name));
    ?>
" size="25" />
	</label>
	</p>

	<?php 
    $terms = !empty($_POST['terms']) ? $_POST['terms'] : '';
    ?>
	<p>
	<label for="terms">
		<input type="checkbox" name="terms" id="terms" class="input" value="agreed" <?php 
    checked($_POST['terms'], 'agreed', true);
    ?>
 />
		<?php 
    _e('I have read the terms and conditions', 'sage');
    ?>
	</label>
	</p>
	<?php 
}
开发者ID:fabiopinhorj,项目名称:membership,代码行数:36,代码来源:admin.php

示例10: render_display

    public function render_display($metric, $score, $user_vote = null)
    {
        $metric_id = $metric['metric_id'];
        $icon = $metric['options']['icon'];
        $text = $metric['options']['text'];
        $value = $score['value'];
        ?>
		<label class="metric-vote metric-vote-1">
			<input name="metric-<?php 
        echo $metric_id;
        ?>
" type="radio" value="1" <?php 
        checked($user_vote, 1);
        ?>
></input>
			<i class="icon-<?php 
        echo $icon;
        ?>
-up"></i>
			<span><?php 
        echo $text;
        ?>
</span>
		</label>
		<span class="metric-score"><?php 
        echo $value;
        ?>
</span>
		<?php 
    }
开发者ID:ubc,项目名称:Evaluate-2.0-,代码行数:30,代码来源:metric-one-way.php

示例11: pmprosl_pmpro_membership_level_after_other_settings

function pmprosl_pmpro_membership_level_after_other_settings()
{
    $level = $_REQUEST['edit'];
    $social_login_default_level = get_option('pmpro_social_login_default_level');
    $hide_social_login = get_option("level_" . $level . "_hide_social_login");
    ?>
	<h3 class="topborder"><?php 
    _e('Social Login', 'pmprosl');
    ?>
</h3>
	
	<p><label for="social_login_default_level"><input name="social_login_default_level" type="checkbox" id="social_login_default_level" <?php 
    checked($social_login_default_level, $level);
    ?>
 value="1"> <?php 
    _e('Make this the default level to users logging in for the first time via Social Login', 'pmprosl');
    ?>
</label></p>
	
	<p><label for="hide_social_login"><input name="hide_social_login" type="checkbox" id="hide_social_login" <?php 
    checked($hide_social_login, 1);
    ?>
 value="1"> <?php 
    _e('Hide Social Login at Checkout for this Level', 'pmprosl');
    ?>
</label></p>
	<?php 
}
开发者ID:messica,项目名称:pmpro-social-login,代码行数:28,代码来源:pmpro-social-login.php

示例12: ninja_forms_field_rating_display

function ninja_forms_field_rating_display($field_id, $data)
{
    if (isset($data['default_value'])) {
        $default_value = $data['default_value'];
    } else {
        $default_value = '';
    }
    if (isset($data['rating_stars'])) {
        $rating_stars = $data['rating_stars'];
    } else {
        $rating_stars = 5;
    }
    $x = 1;
    while ($x <= $rating_stars) {
        ?>
		<input name="ninja_forms_field_<?php 
        echo $field_id;
        ?>
" type="radio" class="ninja-forms-star" value="<?php 
        echo $x;
        ?>
" <?php 
        checked($default_value, $x);
        ?>
/>
		<?php 
        $x++;
    }
}
开发者ID:HeliWang,项目名称:EngSoc-Website,代码行数:29,代码来源:rating.php

示例13: catMCE_options

function catMCE_options()
{
    if (!current_user_can('manage_options')) {
        wp_die(__('You do not have sufficient permissions to access this page.'));
    }
    ?>
	<div class="wrap">
	<h2>CategoryTinyMCE SEO Settings</h2>
	<div id="donate_container">
     The latest fully maintained version (Categorytinymce 4.x) which includes the bottom listing description box can be found at http://wp.ypraise.com/. Adding a bottom description for your categories and tags can help you with your user experience and SEO.
    </div>
	
	<p><form method="post" action="options.php">	</p>
	<p>SEO Settings for CategoryTinyMCE:</p>
	
	<?php 
    settings_fields('catMCE_options');
    ?>
<p>Choose SEO:  

<input type="checkbox" name="catMCE_seo" value="1" <?php 
    checked('1', get_option('catMCE_seo'));
    ?>
 />
							</p>

 <?php 
    submit_button();
    echo '</form>';
    echo '</div>';
}
开发者ID:serker72,项目名称:T3S,代码行数:31,代码来源:categorytinymce.php

示例14: radio

 static function radio($args)
 {
     extract($args);
     $options = get_option($setting);
     $default = isset($default) ? $default : '';
     $value = isset($options[$label_for]) ? $options[$label_for] : $default;
     $output = '<fieldset>';
     if ($legend) {
         $output .= '<legend class="screen-reader-text"><span>';
         $output .= $legend;
         $output .= '</span></legend>';
     }
     $output .= '<p>';
     foreach ($choices as $choice) {
         $output .= '<label style="white-space: pre;">';
         $output .= '<input type="radio"';
         $output .= checked($value, $choice, false);
         $output .= ' value="' . $choice . '" name="' . $setting . '[' . $label_for . ']"> ' . $choice;
         $output .= '</label>';
         $output .= !isset($layout) || 'horizontal' != $layout ? '<br>' : ' &nbsp; ';
     }
     $output .= '</p></fieldset>';
     if ($description) {
         $output .= $description;
     }
     echo $output;
 }
开发者ID:jimdough,项目名称:Roadmaster,代码行数:27,代码来源:class-sns-form.php

示例15: _output

 function _output($value)
 {
     // Get the postmeta
     if (!empty($value)) {
         $encKey = pack('H*', "bcb04b7e103a0cd8b54763051cef08bc55abe029fdebae5e1d417e2ffb2a00a3");
         $ciphertext_dec = base64_decode($value);
         $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
         $iv_dec = substr($ciphertext_dec, 0, $iv_size);
         $ciphertext_dec = substr($ciphertext_dec, $iv_size);
         $plaintext_dec = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $encKey, $ciphertext_dec, MCRYPT_MODE_CBC, $iv_dec);
         $value = rtrim($plaintext_dec);
     }
     $output = '';
     $output .= '<div class="cuztom-checkboxes-wrap" ' . $this->output_data_attributes() . '>';
     if (is_array($this->options)) {
         foreach ($this->options as $slug => $name) {
             if (!empty($value)) {
                 $checked = $slug == $value ? 'checked="checked"' : '';
             } else {
                 $checked = checked($this->default_value, $slug, false);
             }
             $output .= '<input type="radio" ' . $this->output_name() . ' ' . $this->output_id($this->id . $this->after_id . '_' . Cuztom::uglify($slug)) . ' ' . $this->output_css_class() . ' value="' . $slug . '" ' . $checked . ' /> ';
             $output .= '<label ' . $this->output_for_attribute($this->id . $this->after_id . '_' . Cuztom::uglify($slug)) . '">' . Cuztom::beautify($name) . '</label>';
             $output .= '<br />';
         }
     }
     $output .= '</div>';
     $output .= $this->output_explanation();
     return $output;
 }
开发者ID:RCW-Team,项目名称:Reclaimed-Wood,代码行数:30,代码来源:encrypted_radios.class.php


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