示例#1
0
/**
 * Add the "Site Name" menu.
 *
 * @since 3.3.0
 */
function nxt_admin_bar_site_menu($nxt_admin_bar)
{
    global $current_site;
    // Don't show for logged out users.
    if (!is_user_logged_in()) {
        return;
    }
    // Show only when the user is a member of this site, or they're a super admin.
    if (!is_user_member_of_blog() && !is_super_admin()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (empty($blogname)) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    if (is_network_admin()) {
        $blogname = sprintf(__('Network Admin: %s'), esc_html($current_site->site_name));
    } elseif (is_user_admin()) {
        $blogname = sprintf(__('Global Dashboard: %s'), esc_html($current_site->site_name));
    }
    $title = nxt_html_excerpt($blogname, 40);
    if ($title != $blogname) {
        $title = trim($title) . '…';
    }
    $nxt_admin_bar->add_menu(array('id' => 'site-name', 'title' => $title, 'href' => is_admin() ? home_url('/') : admin_url()));
    // Create submenu items.
    if (is_admin()) {
        // Add an option to visit the site.
        $nxt_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url('/')));
        // We're on the front end, print a copy of the admin menu.
    } else {
        // Add the dashboard item.
        $nxt_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
        // Add the appearance submenu items.
        nxt_admin_bar_appearance_menu($nxt_admin_bar);
    }
}
示例#2
0
/**
 * Display the RSS entries in a list.
 *
 * @since 2.5.0
 *
 * @param string|array|object $rss RSS url.
 * @param array $args Widget arguments.
 */
function nxt_widget_rss_output($rss, $args = array())
{
    if (is_string($rss)) {
        $rss = fetch_feed($rss);
    } elseif (is_array($rss) && isset($rss['url'])) {
        $args = $rss;
        $rss = fetch_feed($rss['url']);
    } elseif (!is_object($rss)) {
        return;
    }
    if (is_nxt_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>' . sprintf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message()) . '</p>';
        }
        return;
    }
    $default_args = array('show_author' => 0, 'show_date' => 0, 'show_summary' => 0);
    $args = nxt_parse_args($args, $default_args);
    extract($args, EXTR_SKIP);
    $items = (int) $items;
    if ($items < 1 || 20 < $items) {
        $items = 10;
    }
    $show_summary = (int) $show_summary;
    $show_author = (int) $show_author;
    $show_date = (int) $show_date;
    if (!$rss->get_item_quantity()) {
        echo '<ul><li>' . __('An error has occurred; the feed is probably down. Try again later.') . '</li></ul>';
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo '<ul>';
    foreach ($rss->get_items(0, $items) as $item) {
        $link = $item->get_link();
        while (stristr($link, 'http') != $link) {
            $link = substr($link, 1);
        }
        $link = esc_url(strip_tags($link));
        $title = esc_attr(strip_tags($item->get_title()));
        if (empty($title)) {
            $title = __('Untitled');
        }
        $desc = str_replace(array("\n", "\r"), ' ', esc_attr(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset')))));
        $desc = nxt_html_excerpt($desc, 360);
        // Append ellipsis. Change existing [...] to [&hellip;].
        if ('[...]' == substr($desc, -5)) {
            $desc = substr($desc, 0, -5) . '[&hellip;]';
        } elseif ('[&hellip;]' != substr($desc, -10)) {
            $desc .= ' [&hellip;]';
        }
        $desc = esc_html($desc);
        if ($show_summary) {
            $summary = "<div class='rssSummary'>{$desc}</div>";
        } else {
            $summary = '';
        }
        $date = '';
        if ($show_date) {
            $date = $item->get_date('U');
            if ($date) {
                $date = ' <span class="rss-date">' . date_i18n(get_option('date_format'), $date) . '</span>';
            }
        }
        $author = '';
        if ($show_author) {
            $author = $item->get_author();
            if (is_object($author)) {
                $author = $author->get_name();
                $author = ' <cite>' . esc_html(strip_tags($author)) . '</cite>';
            }
        }
        if ($link == '') {
            echo "<li>{$title}{$date}{$summary}{$author}</li>";
        } else {
            echo "<li><a class='rsswidget' href='{$link}' title='{$desc}'>{$title}</a>{$date}{$summary}{$author}</li>";
        }
    }
    echo '</ul>';
    $rss->__destruct();
    unset($rss);
}
示例#3
0
/**
 * Retrieve HTML form for modifying the image attachment.
 *
 * @since 2.5.0
 *
 * @param int $attachment_id Attachment ID for modification.
 * @param string|array $args Optional. Override defaults.
 * @return string HTML form for attachment.
 */
function get_media_item($attachment_id, $args = null)
{
    global $redir_tab;
    if (($attachment_id = intval($attachment_id)) && ($thumb_url = nxt_get_attachment_image_src($attachment_id, 'thumbnail', true))) {
        $thumb_url = $thumb_url[0];
    } else {
        $thumb_url = false;
    }
    $post = get_post($attachment_id);
    $current_post_id = !empty($_GET['post_id']) ? (int) $_GET['post_id'] : 0;
    $default_args = array('errors' => null, 'send' => $current_post_id ? post_type_supports(get_post_type($current_post_id), 'editor') : true, 'delete' => true, 'toggle' => true, 'show_title' => true);
    $args = nxt_parse_args($args, $default_args);
    $args = apply_filters('get_media_item_args', $args);
    extract($args, EXTR_SKIP);
    $toggle_on = __('Show');
    $toggle_off = __('Hide');
    $filename = esc_html(basename($post->guid));
    $title = esc_attr($post->post_title);
    if ($_tags = get_the_tags($attachment_id)) {
        foreach ($_tags as $tag) {
            $tags[] = $tag->name;
        }
        $tags = esc_attr(join(', ', $tags));
    }
    $post_mime_types = get_post_mime_types();
    $keys = array_keys(nxt_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
    $type = array_shift($keys);
    $type_html = "<input type='hidden' id='type-of-{$attachment_id}' value='" . esc_attr($type) . "' />";
    $form_fields = get_attachment_fields_to_edit($post, $errors);
    if ($toggle) {
        $class = empty($errors) ? 'startclosed' : 'startopen';
        $toggle_links = "\n\t<a class='toggle describe-toggle-on' href='#'>{$toggle_on}</a>\n\t<a class='toggle describe-toggle-off' href='#'>{$toggle_off}</a>";
    } else {
        $class = '';
        $toggle_links = '';
    }
    $display_title = !empty($title) ? $title : $filename;
    // $title shouldn't ever be empty, but just in case
    $display_title = $show_title ? "<div class='filename new'><span class='title'>" . nxt_html_excerpt($display_title, 60) . "</span></div>" : '';
    $gallery = isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab'] || isset($redir_tab) && 'gallery' == $redir_tab;
    $order = '';
    foreach ($form_fields as $key => $val) {
        if ('menu_order' == $key) {
            if ($gallery) {
                $order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[{$attachment_id}][menu_order]' name='attachments[{$attachment_id}][menu_order]' value='" . esc_attr($val['value']) . "' /></div>";
            } else {
                $order = "<input type='hidden' name='attachments[{$attachment_id}][menu_order]' value='" . esc_attr($val['value']) . "' />";
            }
            unset($form_fields['menu_order']);
            break;
        }
    }
    $media_dims = '';
    $meta = nxt_get_attachment_metadata($post->ID);
    if (is_array($meta) && array_key_exists('width', $meta) && array_key_exists('height', $meta)) {
        $media_dims .= "<span id='media-dims-{$post->ID}'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
    }
    $media_dims = apply_filters('media_meta', $media_dims, $post);
    $image_edit_button = '';
    if (gd_edit_image_support($post->post_mime_type)) {
        $nonce = nxt_create_nonce("image_editor-{$post->ID}");
        $image_edit_button = "<input type='button' id='imgedit-open-btn-{$post->ID}' onclick='imageEdit.open( {$post->ID}, \"{$nonce}\" )' class='button' value='" . esc_attr__('Edit Image') . "' /> <img src='" . esc_url(admin_url('images/nxtspin_light.gif')) . "' class='imgedit-wait-spin' alt='' />";
    }
    $attachment_url = get_permalink($attachment_id);
    $item = "\n\t{$type_html}\n\t{$toggle_links}\n\t{$order}\n\t{$display_title}\n\t<table class='slidetoggle describe {$class}'>\n\t\t<thead class='media-item-info' id='media-head-{$post->ID}'>\n\t\t<tr valign='top'>\n\t\t\t<td class='A1B1' id='thumbnail-head-{$post->ID}'>\n\t\t\t<p><a href='{$attachment_url}' target='_blank'><img class='thumbnail' src='{$thumb_url}' alt='' /></a></p>\n\t\t\t<p>{$image_edit_button}</p>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t<p><strong>" . __('File name:') . "</strong> {$filename}</p>\n\t\t\t<p><strong>" . __('File type:') . "</strong> {$post->post_mime_type}</p>\n\t\t\t<p><strong>" . __('Upload date:') . "</strong> " . mysql2date(get_option('date_format'), $post->post_date) . '</p>';
    if (!empty($media_dims)) {
        $item .= "<p><strong>" . __('Dimensions:') . "</strong> {$media_dims}</p>\n";
    }
    $item .= "</td></tr>\n";
    $item .= "\n\t\t</thead>\n\t\t<tbody>\n\t\t<tr><td colspan='2' class='imgedit-response' id='imgedit-response-{$post->ID}'></td></tr>\n\t\t<tr><td style='display:none' colspan='2' class='image-editor' id='image-editor-{$post->ID}'></td></tr>\n";
    $defaults = array('input' => 'text', 'required' => false, 'value' => '', 'extra_rows' => array());
    if ($send) {
        $send = get_submit_button(__('Insert into Post'), 'button', "send[{$attachment_id}]", false);
    }
    if ($delete && current_user_can('delete_post', $attachment_id)) {
        if (!EMPTY_TRASH_DAYS) {
            $delete = "<a href='" . nxt_nonce_url("post.php?action=delete&amp;post={$attachment_id}", 'delete-attachment_' . $attachment_id) . "' id='del[{$attachment_id}]' class='delete'>" . __('Delete Permanently') . '</a>';
        } elseif (!MEDIA_TRASH) {
            $delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_{$attachment_id}').style.display='block';return false;\">" . __('Delete') . "</a>\n\t\t\t <div id='del_attachment_{$attachment_id}' class='del-attachment' style='display:none;'>" . sprintf(__('You are about to delete <strong>%s</strong>.'), $filename) . "\n\t\t\t <a href='" . nxt_nonce_url("post.php?action=delete&amp;post={$attachment_id}", 'delete-attachment_' . $attachment_id) . "' id='del[{$attachment_id}]' class='button'>" . __('Continue') . "</a>\n\t\t\t <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a>\n\t\t\t </div>";
        } else {
            $delete = "<a href='" . nxt_nonce_url("post.php?action=trash&amp;post={$attachment_id}", 'trash-attachment_' . $attachment_id) . "' id='del[{$attachment_id}]' class='delete'>" . __('Move to Trash') . "</a>\n\t\t\t<a href='" . nxt_nonce_url("post.php?action=untrash&amp;post={$attachment_id}", 'untrash-attachment_' . $attachment_id) . "' id='undo[{$attachment_id}]' class='undo hidden'>" . __('Undo') . "</a>";
        }
    } else {
        $delete = '';
    }
    $thumbnail = '';
    $calling_post_id = 0;
    if (isset($_GET['post_id'])) {
        $calling_post_id = absint($_GET['post_id']);
    } elseif (isset($_POST) && count($_POST)) {
        // Like for async-upload where $_GET['post_id'] isn't set
        $calling_post_id = $post->post_parent;
    }
    if ('image' == $type && $calling_post_id && current_theme_supports('post-thumbnails', get_post_type($calling_post_id)) && post_type_supports(get_post_type($calling_post_id), 'thumbnail') && get_post_thumbnail_id($calling_post_id) != $attachment_id) {
        $ajax_nonce = nxt_create_nonce("set_post_thumbnail-{$calling_post_id}");
        $thumbnail = "<a class='nxt-post-thumbnail' id='nxt-post-thumbnail-" . $attachment_id . "' href='#' onclick='nxtSetAsThumbnail(\"{$attachment_id}\", \"{$ajax_nonce}\");return false;'>" . esc_html__("Use as featured image") . "</a>";
    }
    if (($send || $thumbnail || $delete) && !isset($form_fields['buttons'])) {
        $form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>{$send} {$thumbnail} {$delete}</td></tr>\n");
    }
    $hidden_fields = array();
    foreach ($form_fields as $id => $field) {
        if ($id[0] == '_') {
            continue;
        }
        if (!empty($field['tr'])) {
            $item .= $field['tr'];
            continue;
        }
        $field = array_merge($defaults, $field);
        $name = "attachments[{$attachment_id}][{$id}]";
        if ($field['input'] == 'hidden') {
            $hidden_fields[$name] = $field['value'];
            continue;
        }
        $required = $field['required'] ? '<span class="alignright"><abbr title="required" class="required">*</abbr></span>' : '';
        $aria_required = $field['required'] ? " aria-required='true' " : '';
        $class = $id;
        $class .= $field['required'] ? ' form-required' : '';
        $item .= "\t\t<tr class='{$class}'>\n\t\t\t<th valign='top' scope='row' class='label'><label for='{$name}'><span class='alignleft'>{$field['label']}</span>{$required}<br class='clear' /></label></th>\n\t\t\t<td class='field'>";
        if (!empty($field[$field['input']])) {
            $item .= $field[$field['input']];
        } elseif ($field['input'] == 'textarea') {
            if (user_can_richedit()) {
                // textarea_escaped when user_can_richedit() = false
                $field['value'] = esc_textarea($field['value']);
            }
            $item .= "<textarea id='{$name}' name='{$name}' {$aria_required}>" . $field['value'] . '</textarea>';
        } else {
            $item .= "<input type='text' class='text' id='{$name}' name='{$name}' value='" . esc_attr($field['value']) . "' {$aria_required} />";
        }
        if (!empty($field['helps'])) {
            $item .= "<p class='help'>" . join("</p>\n<p class='help'>", array_unique((array) $field['helps'])) . '</p>';
        }
        $item .= "</td>\n\t\t</tr>\n";
        $extra_rows = array();
        if (!empty($field['errors'])) {
            foreach (array_unique((array) $field['errors']) as $error) {
                $extra_rows['error'][] = $error;
            }
        }
        if (!empty($field['extra_rows'])) {
            foreach ($field['extra_rows'] as $class => $rows) {
                foreach ((array) $rows as $html) {
                    $extra_rows[$class][] = $html;
                }
            }
        }
        foreach ($extra_rows as $class => $rows) {
            foreach ($rows as $html) {
                $item .= "\t\t<tr><td></td><td class='{$class}'>{$html}</td></tr>\n";
            }
        }
    }
    if (!empty($form_fields['_final'])) {
        $item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
    }
    $item .= "\t</tbody>\n";
    $item .= "\t</table>\n";
    foreach ($hidden_fields as $name => $value) {
        $item .= "\t<input type='hidden' name='{$name}' id='{$name}' value='" . esc_attr($value) . "' />\n";
    }
    if ($post->post_parent < 1 && isset($_REQUEST['post_id'])) {
        $parent = (int) $_REQUEST['post_id'];
        $parent_name = "attachments[{$attachment_id}][post_parent]";
        $item .= "\t<input type='hidden' name='{$parent_name}' id='{$parent_name}' value='{$parent}' />\n";
    }
    return $item;
}
示例#4
0
    // Else try to grab the first menu from the menus list
} elseif (0 == $nav_menu_selected_id && !isset($_REQUEST['menu']) && !empty($nav_menus)) {
    $nav_menu_selected_id = $nav_menus[0]->term_id;
}
// Update the user's setting
if ($nav_menu_selected_id != $recently_edited && is_nav_menu($nav_menu_selected_id)) {
    update_user_meta($current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id);
}
// If there's a menu, get its name.
if (!$nav_menu_selected_title && is_nav_menu($nav_menu_selected_id)) {
    $_menu_object = nxt_get_nav_menu_object($nav_menu_selected_id);
    $nav_menu_selected_title = !is_nxt_error($_menu_object) ? $_menu_object->name : '';
}
// Generate truncated menu names
foreach ((array) $nav_menus as $key => $_nav_menu) {
    $_nav_menu->truncated_name = trim(nxt_html_excerpt($_nav_menu->name, 40));
    if ($_nav_menu->truncated_name != $_nav_menu->name) {
        $_nav_menu->truncated_name .= '&hellip;';
    }
    $nav_menus[$key]->truncated_name = $_nav_menu->truncated_name;
}
// Ensure the user will be able to scroll horizontally
// by adding a class for the max menu depth.
global $_nxt_nav_menu_max_depth;
$_nxt_nav_menu_max_depth = 0;
// Calling nxt_get_nav_menu_to_edit generates $_nxt_nav_menu_max_depth
if (is_nav_menu($nav_menu_selected_id)) {
    $edit_markup = nxt_get_nav_menu_to_edit($nav_menu_selected_id);
}
function nxt_nav_menu_max_depth($classes)
{
示例#5
0
/**
 * Display incoming links dashboard widget content.
 *
 * @since 2.5.0
 */
function nxt_dashboard_incoming_links_output()
{
    $widgets = get_option('dashboard_widget_options');
    @extract(@$widgets['dashboard_incoming_links'], EXTR_SKIP);
    $rss = fetch_feed($url);
    if (is_nxt_error($rss)) {
        if (is_admin() || current_user_can('manage_options')) {
            echo '<p>';
            printf(__('<strong>RSS Error</strong>: %s'), $rss->get_error_message());
            echo '</p>';
        }
        return;
    }
    if (!$rss->get_item_quantity()) {
        echo '<p>' . __('This dashboard widget queries <a href="http://blogsearch.google.com/">Google Blog Search</a> so that when another blog links to your site it will show up here. It has found no incoming links&hellip; yet. It&#8217;s okay &#8212; there is no rush.') . "</p>\n";
        $rss->__destruct();
        unset($rss);
        return;
    }
    echo "<ul>\n";
    if (!isset($items)) {
        $items = 10;
    }
    foreach ($rss->get_items(0, $items) as $item) {
        $publisher = '';
        $site_link = '';
        $link = '';
        $content = '';
        $date = '';
        $link = esc_url(strip_tags($item->get_link()));
        $author = $item->get_author();
        if ($author) {
            $site_link = esc_url(strip_tags($author->get_link()));
            if (!($publisher = esc_html(strip_tags($author->get_name())))) {
                $publisher = __('Somebody');
            }
        } else {
            $publisher = __('Somebody');
        }
        if ($site_link) {
            $publisher = "<a href='{$site_link}'>{$publisher}</a>";
        } else {
            $publisher = "<strong>{$publisher}</strong>";
        }
        $content = $item->get_content();
        $content = nxt_html_excerpt($content, 50) . ' ...';
        if ($link) {
            /* translators: incoming links feed, %1$s is other person, %3$s is content */
            $text = __('%1$s linked here <a href="%2$s">saying</a>, "%3$s"');
        } else {
            /* translators: incoming links feed, %1$s is other person, %3$s is content */
            $text = __('%1$s linked here saying, "%3$s"');
        }
        if (!empty($show_date)) {
            if (!empty($show_author) || !empty($show_summary)) {
                /* translators: incoming links feed, %4$s is the date */
                $text .= ' ' . __('on %4$s');
            }
            $date = esc_html(strip_tags($item->get_date()));
            $date = strtotime($date);
            $date = gmdate(get_option('date_format'), $date);
        }
        echo "\t<li>" . sprintf($text, $publisher, $link, $content, $date) . "</li>\n";
    }
    echo "</ul>\n";
    $rss->__destruct();
    unset($rss);
}
示例#6
0
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
require_once './admin-header.php';
?>

<div class="wrap">
<?php 
screen_icon();
?>
<h2><?php 
if ($post_id) {
    echo sprintf(__('Comments on &#8220;%s&#8221;'), sprintf('<a href="%s">%s</a>', get_edit_post_link($post_id), nxt_html_excerpt(_draft_or_post_title($post_id), 50)));
} else {
    echo __('Comments');
}
if (isset($_REQUEST['s']) && $_REQUEST['s']) {
    printf('<span class="subtitle">' . sprintf(__('Search results for &#8220;%s&#8221;'), nxt_html_excerpt(esc_html(stripslashes($_REQUEST['s'])), 50)) . '</span>');
}
?>
</h2>

<?php 
if (isset($_REQUEST['error'])) {
    $error = (int) $_REQUEST['error'];
    $error_msg = '';
    switch ($error) {
        case 1:
            $error_msg = __('Oops, no comment with this ID.');
            break;
        case 2:
            $error_msg = __('You are not allowed to edit comments on this post.');
            break;
示例#7
0
/**
 * Displays a metabox for the nav menu theme locations.
 *
 * @since 3.0.0
 */
function nxt_nav_menu_locations_meta_box()
{
    global $nav_menu_selected_id;
    if (!current_theme_supports('menus')) {
        // We must only support widgets. Leave a message and bail.
        echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p>';
        return;
    }
    $locations = get_registered_nav_menus();
    $menus = nxt_get_nav_menus();
    $menu_locations = get_nav_menu_locations();
    $num_locations = count(array_keys($locations));
    echo '<p class="howto">' . sprintf(_n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations), number_format_i18n($num_locations)) . '</p>';
    foreach ($locations as $location => $description) {
        ?>
		<p>
			<label class="howto" for="locations-<?php 
        echo $location;
        ?>
">
				<span><?php 
        echo $description;
        ?>
</span>
				<select name="menu-locations[<?php 
        echo $location;
        ?>
]" id="locations-<?php 
        echo $location;
        ?>
">
					<option value="0"></option>
					<?php 
        foreach ($menus as $menu) {
            ?>
					<option<?php 
            selected(isset($menu_locations[$location]) && $menu_locations[$location] == $menu->term_id);
            ?>
						value="<?php 
            echo $menu->term_id;
            ?>
"><?php 
            $truncated_name = nxt_html_excerpt($menu->name, 40);
            echo $truncated_name == $menu->name ? $menu->name : trim($truncated_name) . '&hellip;';
            ?>
</option>
					<?php 
        }
        ?>
				</select>
			</label>
		</p>
	<?php 
    }
    ?>
	<p class="button-controls">
		<img class="waiting" src="<?php 
    echo esc_url(admin_url('images/nxtspin_light.gif'));
    ?>
" alt="" />
		<?php 
    submit_button(__('Save'), 'primary', 'nav-menu-locations', false, disabled($nav_menu_selected_id, 0, false));
    ?>
	</p>
	<?php 
}
示例#8
0
/**
 * Perform trackbacks.
 *
 * @since 1.5.0
 * @uses $nxtdb
 *
 * @param int $post_id Post ID to do trackbacks on.
 */
function do_trackbacks($post_id)
{
    global $nxtdb;
    $post = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM {$nxtdb->posts} WHERE ID = %d", $post_id));
    $to_ping = get_to_ping($post_id);
    $pinged = get_pung($post_id);
    if (empty($to_ping)) {
        $nxtdb->update($nxtdb->posts, array('to_ping' => ''), array('ID' => $post_id));
        return;
    }
    if (empty($post->post_excerpt)) {
        $excerpt = apply_filters('the_content', $post->post_content);
    } else {
        $excerpt = apply_filters('the_excerpt', $post->post_excerpt);
    }
    $excerpt = str_replace(']]>', ']]&gt;', $excerpt);
    $excerpt = nxt_html_excerpt($excerpt, 252) . '...';
    $post_title = apply_filters('the_title', $post->post_title, $post->ID);
    $post_title = strip_tags($post_title);
    if ($to_ping) {
        foreach ((array) $to_ping as $tb_ping) {
            $tb_ping = trim($tb_ping);
            if (!in_array($tb_ping, $pinged)) {
                trackback($tb_ping, $post_title, $excerpt, $post_id);
                $pinged[] = $tb_ping;
            } else {
                $nxtdb->query($nxtdb->prepare("UPDATE {$nxtdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $tb_ping, $post_id));
            }
        }
    }
}