本文整理汇总了PHP中K::input方法的典型用法代码示例。如果您正苦于以下问题:PHP K::input方法的具体用法?PHP K::input怎么用?PHP K::input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类K
的用法示例。
在下文中一共展示了K::input方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paf_page_cb
/**
* Callback function for pages
*/
function paf_page_cb()
{
global $paf;
global $paf_options, $paf_pages, $paf_sections, $paf_tabs;
global $paf_page_tabs, $paf_page_sections, $paf_page_options;
global $paf_page, $paf_tab;
// Get submit button text (looks in: tab > page > default )
if ($paf_tab && ($submit_button_text = K::get_var('submit_button', $paf_page_tabs[$paf_tab]))) {
} else {
if ($submit_button_text = K::get_var('submit_button', $paf_pages[$paf_page])) {
} else {
$submit_button_text = __('Save Changes');
}
}
// Get reset button text (looks in: tab > page )
if ($paf_tab && ($reset_button_text = K::get_var('reset_button', $paf_page_tabs[$paf_tab]))) {
} else {
if ($reset_button_text = K::get_var('reset_button', $paf_pages[$paf_page])) {
}
}
// Start output
echo '<div class="wrap">' . '<h2>' . K::get_var('title', $paf_pages[$paf_page], $paf_page) . '</h2>';
// Print tabs links
if ($paf_page_tabs) {
echo '<h2 class="nav-tab-wrapper">';
foreach ($paf_page_tabs as $slug => $page_tab) {
printf('<a href="?page=%s&tab=%s" class="nav-tab %s">%s</a>', $paf_page, $slug, $paf_tab === $slug ? 'nav-tab-active' : '', $page_tab['menu_title']);
}
echo '</h2>';
echo '<h2>' . $paf_page_tabs[$paf_tab]['title'] . '</h2>';
}
// Print the options
echo '<form id="paf-form" class="hidden" action="' . paf_url() . '" method="post">';
// Show options that don't have sections
reset($paf_page_options);
foreach ($paf_page_options as $id => $page_option) {
if (K::get_var('section', $page_option)) {
continue;
}
paf_print_option($id);
}
// Show options that have sections
reset($paf_page_options);
foreach ($paf_page_sections as $section_id => $page_section) {
K::wrap(K::get_var('title', $page_section, $section_id), array('class' => 'title'), array('in' => 'h3'));
foreach ($paf_page_options as $id => $page_option) {
if ($section_id === K::get_var('section', $page_option)) {
paf_print_option($id);
}
}
}
// Nonce
wp_nonce_field('paf_save', 'paf_nonce');
// Submit and Reset buttons
echo '<p>';
K::input('paf_submit', array('class' => 'button button-large button-primary', 'href' => '#', 'id' => 'paf-submit', 'type' => 'submit', 'value' => $submit_button_text), array('in' => 'input'));
if ($reset_button_text) {
echo ' ';
K::wrap('Reset', array('class' => 'button button-large paf-reset', 'href' => '#', 'id' => 'paf-reset'), array('in' => 'a'));
}
echo '</p>';
echo '</form>';
// Add JS and CSS
paf_asset_js('paf', TRUE);
paf_asset_css('paf', TRUE);
echo '</div>';
}
示例2: paf_print_option_type_not_implemented
function paf_print_option_type_not_implemented($option_def)
{
$option_id = key($option_def);
$option = $option_def[$option_id];
if ('~' === K::get_var('description', $option)) {
$option['description'] = paf_option_return_dump($option_id);
}
K::input('paf[' . $option_id . ']', array('value' => K::get_var('value', $option, '')), array('format' => sprintf(paf_option_return_format(), paf_option_return_title($option_def), sprintf('<p class="description"><span class="dashicons dashicons-no"></span> ' . __('The option type <code>%s</code> is not yet implemented') . '</p>', $option['type']), K::get_var('description', $option, ''))));
}
示例3: skelet_tinyMCE_php
function skelet_tinyMCE_php($tag)
{
global $paf_shortcodes;
$select2_enqueued = false;
$protocol = is_ssl() ? 'https' : 'http';
// Head
printf('<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title></title>');
// CSS
printf('<link rel="stylesheet" href="%s" />', admin_url('css/common' . (is_rtl() ? '-rtl' : '') . '.css'));
printf('<link rel="stylesheet" href="%s" />', admin_url('css/forms' . (is_rtl() ? '-rtl' : '') . '.css'));
printf('<link rel="stylesheet" href="%s" />', site_url('wp-includes/css/dashicons' . (is_rtl() ? '-rtl' : '') . '.min.css'));
printf('<link rel="stylesheet" href="%s" />', site_url('wp-includes/css/buttons' . (is_rtl() ? '-rtl' : '') . '.min.css'));
print '<style>body { height: auto; margin: 0; min-width: 0; padding: 1em; }</style>';
paf_asset_css('paf');
// JS
printf('<script src="%s"></script>', "{$protocol}://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js");
printf('<script src="%s"></script>', "{$protocol}://cdnjs.cloudflare.com/ajax/libs/jquery.serializeJSON/1.2.0/jquery.serializeJSON.min.js");
paf_asset_js('paf');
ob_start();
?>
<script>
var paf;
var shortcode = '';
var wrap = <?php
echo K::get_var('wrap', $paf_shortcodes[$tag]) ? 'true' : 'false';
?>
;
jQuery( document ).ready( function ( $ ) {
/* Fill content field with selected text if any */
var content = parent.tinymce.activeEditor.selection.getContent( { format : 'text' } );
$( '#content' ).val( content );
// Update shortcode
$( 'input,select,textarea', 'form' ).on( 'change keyup', function() { $( 'form' ).change(); } );
// Autoselect shortcode
$( "#shortcode" ).mouseover( function() { $( this ).select(); } );
/**
* Bind to form events
*
* - On submit: Fill the WP editor
* - On change: update the shortcode value
*/
$( 'form' ).on( 'submit change', function( e ) {
e.preventDefault();
shortcode = '';
paf = $( this ).serializeJSON().paf;
content = $( '#content' ).val();
if( 'undefined' === typeof paf ) {
paf = {};
}
// Build the shortcode
Object.keys( paf ).map( function(v) {
if( 'undefined' !== paf[ v ] && paf[ v ] ) {
shortcode += ' '
+ v
+ '="'
+ paf[ v ].toString().split().join().replace( '"', '\\"', 'g' )
+ '"'
;
}
} );
if( wrap ) {
shortcode = "[<?php
echo $tag;
?>
" + shortcode + "]"
+ content
+ "[/<?php
echo $tag;
?>
]"
;
} else {
shortcode = "[<?php
echo $tag;
?>
" + shortcode + "]";
}
// Update the demo
$( "#shortcode" ).val( shortcode );
// Fill the editor and close
if ( 'submit' === e.type ) {
parent.tinymce.activeEditor.execCommand( "mceInsertContent", false, shortcode );
parent.tinymce.activeEditor.windowManager.close( window );
}
} ).change();
} );
</script>
<?php
//.........这里部分代码省略.........