本文整理汇总了PHP中get_sample_permalink_html函数的典型用法代码示例。如果您正苦于以下问题:PHP get_sample_permalink_html函数的具体用法?PHP get_sample_permalink_html怎么用?PHP get_sample_permalink_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_sample_permalink_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_ajax_sample_permalink
/**
* Ajax handler to retrieve a sample permalink.
*
* @since 3.1.0
*/
function wp_ajax_sample_permalink()
{
check_ajax_referer('samplepermalink', 'samplepermalinknonce');
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
$title = isset($_POST['new_title']) ? $_POST['new_title'] : '';
$slug = isset($_POST['new_slug']) ? $_POST['new_slug'] : null;
wp_die(get_sample_permalink_html($post_id, $title, $slug));
}
示例2: _e
<div id="post-body">
<div id="titlediv">
<h3><?php
_e('Title');
?>
</h3>
<div id="titlewrap">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php
echo attribute_escape($post->post_title);
?>
" id="title" autocomplete="off" />
</div>
<div class="inside">
<?php
$sample_permalink_html = get_sample_permalink_html($post->ID);
?>
<div id="edit-slug-box">
<?php
if (!empty($post->ID) && !empty($sample_permalink_html)) {
echo $sample_permalink_html;
}
?>
</div>
</div>
</div>
<div id="<?php
echo user_can_richedit() ? 'postdivrich' : 'postdiv';
?>
" class="postarea">
示例3: apply_filters
if (post_type_supports($post_type, 'title')) {
?>
<div id="titlediv">
<div id="titlewrap">
<label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php
echo apply_filters('enter_title_here', __('Enter title here'), $post);
?>
</label>
<input type="text" name="post_title" size="30" tabindex="1" value="<?php
echo esc_attr(htmlspecialchars($post->post_title));
?>
" id="title" autocomplete="off" />
</div>
<div class="inside">
<?php
$sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
$shortlink = nxt_get_shortlink($post->ID, 'post');
if (!empty($shortlink)) {
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
}
if ($post_type_object->public && !('pending' == $post->post_status && !current_user_can($post_type_object->cap->publish_posts))) {
?>
<div id="edit-slug-box">
<?php
if (!empty($post->ID) && !empty($sample_permalink_html) && 'auto-draft' != $post->post_status) {
echo $sample_permalink_html;
}
?>
</div>
<?php
}
示例4: test_get_sample_permalink_html_should_use_preview_links_for_draft_and_pending_posts_with_no_post_name
/**
* @ticket 30910
* @ticket 18306
*/
public function test_get_sample_permalink_html_should_use_preview_links_for_draft_and_pending_posts_with_no_post_name()
{
$this->set_permalink_structure('/%postname%/');
wp_set_current_user(self::$admin_id);
$future_date = date('Y-m-d H:i:s', time() + 100);
$p = self::factory()->post->create(array('post_status' => 'pending', 'post_name' => '', 'post_date' => $future_date));
$found = get_sample_permalink_html($p);
$post = get_post($p);
$this->assertContains('href="' . esc_url(get_preview_post_link($post)), $found);
}
示例5: test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug
/**
* @ticket 32954
* @ticket 18306
*/
public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug()
{
$this->set_permalink_structure('/%postname%/');
wp_set_current_user(self::$admin_id);
// Published posts should use published permalink
$p = self::factory()->post->create(array('post_status' => 'publish', 'post_name' => 'foo-صورة'));
$found = get_sample_permalink_html($p, null, 'new_slug-صورة');
$post = get_post($p);
$message = 'Published post';
$this->assertContains('href="' . get_option('home') . "/" . $post->post_name . '/"', $found, $message);
$this->assertContains('>new_slug-صورة<', $found, $message);
// Scheduled posts should use published permalink
$future_date = date('Y-m-d H:i:s', time() + 100);
$p = self::factory()->post->create(array('post_status' => 'future', 'post_name' => 'bar-صورة', 'post_date' => $future_date));
$found = get_sample_permalink_html($p, null, 'new_slug-صورة');
$post = get_post($p);
$message = 'Scheduled post';
$this->assertContains('href="' . get_option('home') . "/" . $post->post_name . '/"', $found, $message);
$this->assertContains('>new_slug-صورة<', $found, $message);
// Draft posts should use preview link
$p = self::factory()->post->create(array('post_status' => 'draft', 'post_name' => 'baz-صورة'));
$found = get_sample_permalink_html($p, null, 'new_slug-صورة');
$post = get_post($p);
$message = 'Draft post';
$preview_link = get_permalink($post->ID);
$preview_link = add_query_arg('preview', 'true', $preview_link);
$this->assertContains('href="' . esc_url($preview_link) . '"', $found, $message);
$this->assertContains('>new_slug-صورة<', $found, $message);
}
示例6: vf_embed_edit_slug
/**
* Handle saving the permalink via ajax.
*/
function vf_embed_edit_slug()
{
$post_id = vf_configure_embed_container();
check_ajax_referer('samplepermalink', 'samplepermalinknonce');
$slug = isset($_POST['new_slug']) ? $_POST['new_slug'] : null;
wp_update_post(array('ID' => $post_id, 'post_name' => $slug));
die(get_sample_permalink_html($post_id, 'Discussion Forum', $slug));
}
示例7: update_usermeta
if ($page_columns) {
update_usermeta($user->ID, "screen_layout_{$page}", $page_columns);
}
die('1');
break;
case 'get-permalink':
check_ajax_referer('getpermalink', 'getpermalinknonce');
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
die(add_query_arg(array('preview' => 'true'), get_permalink($post_id)));
break;
case 'sample-permalink':
check_ajax_referer('samplepermalink', 'samplepermalinknonce');
$post_id = isset($_POST['post_id']) ? intval($_POST['post_id']) : 0;
$title = isset($_POST['new_title']) ? $_POST['new_title'] : '';
$slug = isset($_POST['new_slug']) ? $_POST['new_slug'] : '';
die(get_sample_permalink_html($post_id, $title, $slug));
break;
case 'inline-save':
check_ajax_referer('inlineeditnonce', '_inline_edit');
if (!isset($_POST['post_ID']) || !($post_ID = (int) $_POST['post_ID'])) {
exit;
}
if ('page' == $_POST['post_type']) {
if (!current_user_can('edit_page', $post_ID)) {
die(__('You are not allowed to edit this page.'));
}
} else {
if (!current_user_can('edit_post', $post_ID)) {
die(__('You are not allowed to edit this post.'));
}
}
示例8: get_option
/**
* @ticket 30910
*/
public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_button_when_pretty_permalinks_are_enabled() {
global $wp_rewrite;
$old_permalink_structure = get_option( 'permalink_structure' );
$permalink_structure = '%postname%';
$wp_rewrite->set_permalink_structure( "/$permalink_structure/" );
flush_rewrite_rules();
wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
$future_date = date( 'Y-m-d H:i:s', time() + 100 );
$p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
$found = get_sample_permalink_html( $p );
$post = get_post( $p );
$this->assertContains( "span id='view-post-btn'><a href='" . get_option( 'home' ) . "/" . $post->post_name . "/'", $found );
$wp_rewrite->set_permalink_structure( $old_permalink_structure );
flush_rewrite_rules();
}
示例9: apply_filters
if (post_type_supports($post_type, 'title')) {
?>
<div id="titlediv">
<div id="titlewrap">
<label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php
echo apply_filters('enter_title_here', __('Enter title here'), $post);
?>
</label>
<input type="text" name="post_title" size="30" tabindex="1" value="<?php
echo esc_attr(htmlspecialchars($post->post_title));
?>
" id="title" autocomplete="off" />
</div>
<div class="inside">
<?php
$sample_permalink_html = !empty($post_type_object->publicly_queryable) ? get_sample_permalink_html($post->ID) : '';
$shortlink = wp_get_shortlink($post->ID, 'post');
if (!empty($shortlink)) {
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
}
if (!empty($post_type_object->publicly_queryable) && !('pending' == $post->post_status && !current_user_can($post_type_object->cap->publish_posts))) {
?>
<div id="edit-slug-box">
<?php
if (!empty($post->ID) && !empty($sample_permalink_html) && 'auto-draft' != $post->post_status) {
echo $sample_permalink_html;
}
?>
</div>
<?php
}
示例10: vanilla_embed_options
//.........这里部分代码省略.........
-moz-border-radius: 0;
-webkit-border-radius: 0;
border: 1px inset #888;
}
input.InputBox,
input.InputBox:focus {
width: 400px;
border: 1px solid #888;
}
.GetVanilla {
padding: 10px 0 26px;
}
.GetVanilla h2 {
margin: 0;
padding: 0 0 16px;
}
.GetVanilla a {
margin: 0;
box-shadow: 0px 0px 2px #999;
-moz-box-shadow: 0px 0px 2px #999;
-webkit-box-shadow: 0px 0px 2px #999;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background:url("../wp-content/plugins/EmbedVanilla/bg-button-blue.png") repeat-x scroll left top transparent;
border:1px solid #0F7FE6;
color:#003673;
cursor:pointer;
font-size:12px;
font-weight:bold;
padding:6px 10px 6px 6px;
text-decoration:none;
text-shadow:0 1px 0 #B7F5FD;
}
.GetVanilla a span {
padding-left: 20px;
background: url('../wp-content/plugins/EmbedVanilla/logo.png') no-repeat 0 0;
}
.GetVanilla a:hover {
border: 1px solid #0B64C6;
color: #001F44;
text-shadow:0 1px 0 #EEFFFF;
}
.GetVanilla a:focus {
background: #81CFF6;
border:1px solid #0B64C6;
color:#001F44;
text-shadow:0 1px 0 #EEFFFF;
}
</style>
<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div>
<h2><?php
_e('<Embed> Vanilla');
?>
</h2>
<?php
if (isset($_POST['save'])) {
echo '<div class="updated" id="message"><p>Your changes have been saved.</p></div>';
}
?>
<p>Use this page to embed your Vanilla Forum into WordPress.</p>
<?php
if (substr($VanillaEmbedCode, 0, 7) != '<script') {
echo "<div class=\"GetVanilla\">\n\t\t\t<h2>Don't have a Vanilla Forum yet?</h2>\n\t\t\t<a href=\"http://vanillaforums.com\" target=\"_blank\"><span>Get one in under 60 seconds!</span></a>\n\t\t</div>";
}
?>
<form method="post">
<strong>Forum <Embed> Code</strong>
<textarea id="EmbedCode" name="vanilla_embed_code"><?php
echo $VanillaEmbedCode;
?>
</textarea>
<em>Paste the forum embed code from your Vanilla forum here.</em>
<strong>Forum Location in WordPress</strong>
<em>Define where to access your Vanilla Forum within WordPress.</em>
<?php
/*
<input type="text" class="InputBox" name="vanilla_page_name" value="<?php echo $VanillaPageName; ?>" />
*/
?>
<div id="edit-slug-box"><?php
echo get_sample_permalink_html($PostID);
?>
</div>
<?php
wp_nonce_field('samplepermalink', 'samplepermalinknonce', false);
?>
</div>
<p class="submit"><input type="submit" name="save" value="<?php
_e('Save »');
?>
" /></p>
</form>
</div>
<?php
}
示例11: _e
?>
</label></p>
<?php
if (current_user_can('create_posts', 'page')) {
?>
<p class="if-page-for-posts sub-option"><label for="page_for_posts_title"><?php
_e('Page title:');
?>
<input name="page_for_posts_title" type="text" id="page_for_posts_title" value="<?php
echo esc_attr(htmlspecialchars($page_for_posts->post_title));
?>
" />
</label></p>
<p class="if-page-for-posts sub-option" id="edit-slug-box">
<?php
echo get_sample_permalink_html($page_for_posts->ID, $page_for_posts->post_title, $page_for_posts->post_name);
?>
</p>
<input name="post_name" type="hidden" id="post_name" value="<?php
echo esc_attr(apply_filters('editable_slug', $page_for_posts->post_name));
?>
" />
<?php
if ('page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front')) {
?>
<div class="error inline"><p><strong><?php
_e('ERROR:');
?>
</strong> <?php
_e('These pages should not be the same!');
?>
示例12: post_lang_choice
/**
* Ajax response for changing the language in the post metabox
*
* @since 0.2
*/
public function post_lang_choice()
{
check_ajax_referer('pll_language', '_pll_nonce');
global $post_ID;
// Obliged to use the global variable for wp_popular_terms_checklist
$post_id = $post_ID = (int) $_POST['post_id'];
$lang = $this->model->get_language($_POST['lang']);
$post_type = $_POST['post_type'];
$post_type_object = get_post_type_object($post_type);
if (!current_user_can($post_type_object->cap->edit_post, $post_ID)) {
wp_die(-1);
}
$this->model->post->set_language($post_ID, $lang);
// Save language, useful to set the language when uploading media from post
ob_start();
if ($lang) {
include PLL_ADMIN_INC . '/view-translations-' . ('attachment' == $post_type ? 'media' : 'post') . '.php';
}
$x = new WP_Ajax_Response(array('what' => 'translations', 'data' => ob_get_contents()));
ob_end_clean();
// Categories
if (isset($_POST['taxonomies'])) {
// Not set for pages
foreach ($_POST['taxonomies'] as $taxname) {
$taxonomy = get_taxonomy($taxname);
ob_start();
$popular_ids = wp_popular_terms_checklist($taxonomy->name);
$supplemental['populars'] = ob_get_contents();
ob_end_clean();
ob_start();
// Use $post_ID to remember ckecked terms in case we come back to the original language
wp_terms_checklist($post_ID, array('taxonomy' => $taxonomy->name, 'popular_cats' => $popular_ids));
$supplemental['all'] = ob_get_contents();
ob_end_clean();
$supplemental['dropdown'] = wp_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —', 'echo' => 0));
$x->Add(array('what' => 'taxonomy', 'data' => $taxonomy->name, 'supplemental' => $supplemental));
}
}
// Parent dropdown list ( only for hierarchical post types )
if (in_array($post_type, get_post_types(array('hierarchical' => true)))) {
$post = get_post($post_ID);
// Args and filter from 'page_attributes_meta_box' in wp-admin/includes/meta-boxes.php of WP 4.2.1
$dropdown_args = array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column' => 'menu_order, post_title', 'echo' => 0);
/** This filter is documented in wp-admin/includes/meta-boxes.php */
$dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
// Since WP 3.3
$x->Add(array('what' => 'pages', 'data' => wp_dropdown_pages($dropdown_args)));
}
// Flag
$x->Add(array('what' => 'flag', 'data' => empty($lang->flag) ? esc_html($lang->slug) : $lang->flag));
// Sample permalink
$x->Add(array('what' => 'permalink', 'data' => get_sample_permalink_html($post_ID)));
$x->send();
}
示例13: RenderEditor
//.........这里部分代码省略.........
// Section Ends
// Section Ends
case 'sectionend':
if (!empty($field['id'])) {
do_action('clearbase_editor_section_' . sanitize_title($field['id']) . '_end');
}
echo '</table>';
if (!empty($field['id'])) {
do_action('clearbase_editor_section_' . sanitize_title($field['id']) . '_after');
}
break;
case 'post_title':
?>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="post-post_title"><?php
echo __('Title', 'clearbase');
?>
</label>
</th>
<td class="forminp forminp-text">
<input
name="post-post_title"
id="post-post_title"
type="text"
style="min-width: 300px"
value="<?php
echo esc_attr($post->post_title);
?>
"
class=""
/> <?php
//Render the permalink editor
$sample_permalink_html = get_sample_permalink_html($post->ID);
// $shortlink = wp_get_shortlink($post->ID, 'post');
// if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) )
// $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
if (!('pending' == get_post_status($post) && !current_user_can($post_type_object->cap->publish_posts))) {
$has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
?>
<div id="edit-slug-box" class="hide-if-no-js">
<?php
if ($has_sample_permalink) {
echo $sample_permalink_html;
}
?>
</div>
<?php
}
?>
</td>
</tr>
<tr valign="top" class="hide-if-js">
<th scope="row" class="titledesc">
<label for="post-post_name"><?php
echo esc_html(__('Slug', 'clearbase'));
?>
</label>
<?php
echo $tip;
?>
</th>
<td class="forminp forminp-text">
<input
name="post-post_name"
id="post-post_name"
示例14: test_fix_sample_permalink_html_on_publish_when_pretty_permalinks_are_enabled
function test_fix_sample_permalink_html_on_publish_when_pretty_permalinks_are_enabled()
{
$this->set_permalink_structure('/%postname%/');
// Published posts should use published permalink
$p = self::factory()->post->create(array('post_status' => 'publish', 'post_name' => 'foo-صورة', 'post_author' => self::$admin_user_id));
wp_set_current_user(self::$admin_user_id);
$found = get_sample_permalink_html($p, null, 'new_slug-صورة');
$post = get_post($p);
$message = 'Published post';
$this->assertContains('href="' . get_option('home') . "/" . $post->post_name . '/"', $found, $message);
$this->assertContains('>new_slug-صورة<', $found, $message);
}
示例15: wc2_item_content_info_box
function wc2_item_content_info_box()
{
global $post;
$wc2_item = WC2_DB_Item::get_instance();
?>
<div class="postbox">
<?php
//if( post_type_supports( $post->post_type, 'title' ) ) :
?>
<div class="inside">
<div class="itempagetitle"><?php
_e('ページタイトル:', 'wc2');
?>
</div>
<div id="titlediv">
<div id="titlewrap">
<label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php
_e('Enter title here');
?>
</label>
<input type="text" name="post_title" size="30" tabindex="1" value="<?php
esc_attr_e(htmlspecialchars($post->post_title));
?>
" id="title" autocomplete="off" />
</div>
<?php
$sample_permalink_html = get_sample_permalink_html($post->ID);
$shortlink = wp_get_shortlink($post->ID, ITEM_POST_TYPE);
if (!empty($shortlink)) {
$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt('URL:', jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
}
if (!('pending' == $post->post_status && !current_user_can($post_type_object->cap->publish_posts))) {
?>
<div id="edit-slug-box">
<?php
if (!empty($post->ID) && !empty($sample_permalink_html) && 'auto-draft' != $post->post_status) {
echo $sample_permalink_html;
}
?>
</div>
<?php
}
?>
</div>
<?php
wp_nonce_field('samplepermalink', 'samplepermalinknonce', false);
//endif;
//if( post_type_supports($post->post_type, 'editor' ) ) :
?>
<div class="itempagetitle"><?php
_e('商品説明:', 'wc2');
?>
</div>
<div id="<?php
echo user_can_richedit() ? 'postdivrich' : 'postdiv';
?>
" class="postarea">
<style type="text/css">
<!--
.wp_themeSkin table td {
background-color: white;
}
-->
</style>
<?php
wp_editor($post->post_content, 'content', array('dfw' => true, 'tabindex' => 1));
?>
<table id="post-status-info" cellspacing="0"><tbody><tr>
<td id="wp-word-count"></td>
<td class="autosave-info">
<span id="autosave"> </span>
<?php
if ('auto-draft' != $post->post_status) {
echo '<span id="last-edit">';
if ($last_id = get_post_meta($post->ID, '_edit_last', true)) {
$last_user = get_userdata($last_id);
printf(__('Last edited by %1$s on %2$s at %3$s'), esc_attr($last_user->display_name), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
} else {
if (isset($post->post_modified)) {
printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
}
}
echo '</span>';
}
?>
</td>
</tr></tbody></table>
</div>
<?php
//endif;
?>
</div>
</div>
<?php
}