本文整理汇总了PHP中nxt_die函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_die函数的具体用法?PHP nxt_die怎么用?PHP nxt_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nxt_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register_post_types
/**
* register_post_types()
*
* Static function to register the assignments post types, taxonomies and capabilities.
*/
function register_post_types()
{
$assignment_post_def = array('label' => __('Assignments', 'bpsp'), 'singular_label' => __('Assignment', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Assignments', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'assignment', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'editor', 'author', 'custom-fields'), 'taxonomies' => array('course_id', 'group_id'));
if (!register_post_type('assignment', $assignment_post_def)) {
nxt_die(__('BuddyPress Courseware error while registering assignment post type.', 'bpsp'));
}
}
示例2: register_post_types
/**
* register_post_types()
*
* Static function to register the responses post types, taxonomies and capabilities.
*/
function register_post_types()
{
$response_post_def = array('label' => __('Responses', 'bpsp'), 'singular_label' => __('Response', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Responses', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'response', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'editor', 'author'));
if (!register_post_type('response', $response_post_def)) {
nxt_die(__('BuddyPress Courseware error while registering response post type.', 'bpsp'));
}
}
示例3: edit_comment
/**
* Update a comment with values provided in $_POST.
*
* @since 2.0.0
*/
function edit_comment()
{
if (!current_user_can('edit_comment', (int) $_POST['comment_ID'])) {
nxt_die(__('You are not allowed to edit comments on this post.'));
}
$_POST['comment_author'] = $_POST['newcomment_author'];
$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
$_POST['comment_author_url'] = $_POST['newcomment_author_url'];
$_POST['comment_approved'] = $_POST['comment_status'];
$_POST['comment_content'] = $_POST['content'];
$_POST['comment_ID'] = (int) $_POST['comment_ID'];
foreach (array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit) {
if (!empty($_POST['hidden_' . $timeunit]) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit]) {
$_POST['edit_date'] = '1';
break;
}
}
if (!empty($_POST['edit_date'])) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = $jj > 31 ? 31 : $jj;
$hh = $hh > 23 ? $hh - 24 : $hh;
$mn = $mn > 59 ? $mn - 60 : $mn;
$ss = $ss > 59 ? $ss - 60 : $ss;
$_POST['comment_date'] = "{$aa}-{$mm}-{$jj} {$hh}:{$mn}:{$ss}";
}
nxt_update_comment($_POST);
}
示例4: nxtmu_checkAvailableSpace
/**
* Determines if the available space defined by the admin has been exceeded by the user.
*
* @deprecated 3.0.0
* @see is_upload_space_available()
*/
function nxtmu_checkAvailableSpace()
{
_deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()');
if (!is_upload_space_available()) {
nxt_die(__('Sorry, you must delete files before you can upload any more.'));
}
}
示例5: register_post_types
/**
* register_post_types()
*
* Static function to register the lecture post type, taxonomies and capabilities.
*/
function register_post_types()
{
$lecture_post_def = array('label' => __('Lecture', 'bpsp'), 'singular_label' => __('Lecture', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Lectures', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'lecture', 'hierarchical' => true, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'editor', 'author', 'page-attributes'), 'taxonomies' => array('group_id'));
if (!register_post_type('lecture', $lecture_post_def)) {
nxt_die(__('BuddyPress Courseware error while registering lecture post type.', 'bpsp'));
}
$course_rel_def = array('public' => BPSP_DEBUG, 'show_ui' => BPSP_DEBUG, 'hierarchical' => false, 'label' => __('Course ID', 'bpsp'), 'query_var' => 'course_id', 'rewrite' => false, 'capabilities' => array('manage_terms' => 'manage_course_id', 'edit_terms' => 'manage_course_id', 'delete_terms' => 'manage_course_id', 'assign_terms' => 'edit_courses'));
register_taxonomy('course_id', array('lecture'), $course_rel_def);
if (!get_taxonomy('course_id')) {
nxt_die(__('BuddyPress Courseware error while registering course taxonomy.', 'bpsp'));
}
}
示例6: register_post_types
/**
* register_post_types()
*
* Static function to register the assignments post types, taxonomies and capabilities.
*/
function register_post_types()
{
$grade_post_def = array('label' => __('Gradebooks', 'bpsp'), 'singular_label' => __('Gradebook', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Gradebook', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'gradebook', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('author', 'custom-fields'), 'taxonomies' => array('group_id'));
if (!register_post_type('gradebook', $grade_post_def)) {
nxt_die(__('BuddyPress Courseware error while registering grade post type.', 'bpsp'));
}
$assignment_rel_def = array('public' => BPSP_DEBUG, 'show_ui' => BPSP_DEBUG, 'hierarchical' => false, 'label' => __('Assignment ID', 'bpsp'), 'query_var' => 'assignment_id', 'rewrite' => false, 'capabilities' => array('manage_terms' => 'manage_assignment_id', 'edit_terms' => 'manage_assignment_id', 'delete_terms' => 'manage_assignment_id', 'assign_terms' => 'edit_gradebooks'));
register_taxonomy('assignment_id', array('gradebook'), $assignment_rel_def);
if (!get_taxonomy('assignment_id')) {
nxt_die(__('BuddyPress Courseware error while registering assignment taxonomy.', 'bpsp'));
}
}
示例7: __construct
function __construct()
{
global $post_type, $taxonomy, $tax;
nxt_reset_vars(array('action', 'taxonomy', 'post_type'));
if (empty($taxonomy)) {
$taxonomy = 'post_tag';
}
if (!taxonomy_exists($taxonomy)) {
nxt_die(__('Invalid taxonomy'));
}
$tax = get_taxonomy($taxonomy);
if (empty($post_type) || !in_array($post_type, get_post_types(array('show_ui' => true)))) {
$post_type = 'post';
}
parent::__construct(array('plural' => 'tags', 'singular' => 'tag'));
}
示例8: register_post_types
/**
* register_post_types()
*
* Static function to register the bibliography post types and capabilities.
*/
function register_post_types()
{
$bib_post_def = array('label' => __('Bibliography', 'bpsp'), 'singular_label' => __('Bibliography', 'bpsp'), 'description' => __('BuddyPress ScholarPress Courseware Bibliography', 'bpsp'), 'public' => BPSP_DEBUG, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_ui' => BPSP_DEBUG, 'capability_type' => 'bib', 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array('title', 'custom-fields'));
if (!register_post_type('bib', $bib_post_def)) {
nxt_die(__('BuddyPress Courseware error while registering bibliography post type.', 'bpsp'));
}
/**
* Dummy post definition for storing the bibs entries as custom-fields
*/
$bibdb_def = array('post_title' => 'BIBSDB', 'post_status' => 'draft', 'post_type' => 'bib');
if (!get_posts($bibdb_def)) {
$bibs_id = nxt_insert_post($bibdb_def);
if (!$bibs_id) {
nxt_die('BuddyPress Courseware error while creating bibliography database.', 'bpsp');
}
}
}
示例9: edit_link
/**
* Update or insert a link using values provided in $_POST.
*
* @since 2.0.0
*
* @param int $link_id Optional. ID of the link to edit.
* @return int|nxt_Error Value 0 or nxt_Error on failure. The link ID on success.
*/
function edit_link($link_id = 0)
{
if (!current_user_can('manage_links')) {
nxt_die(__('Cheatin’ uh?'));
}
$_POST['link_url'] = esc_html($_POST['link_url']);
$_POST['link_url'] = esc_url($_POST['link_url']);
$_POST['link_name'] = esc_html($_POST['link_name']);
$_POST['link_image'] = esc_html($_POST['link_image']);
$_POST['link_rss'] = esc_url($_POST['link_rss']);
if (!isset($_POST['link_visible']) || 'N' != $_POST['link_visible']) {
$_POST['link_visible'] = 'Y';
}
if (!empty($link_id)) {
$_POST['link_id'] = $link_id;
return nxt_update_link($_POST);
} else {
return nxt_insert_link($_POST);
}
}
示例10: __
}
$help = '<p><strong>' . __('For more information:') . '</strong></p>';
if ('category' == $taxonomy) {
$help .= '<p>' . __('<a href="http://codex.nxtclass.org/Posts_Categories_Screen" target="_blank">Documentation on Categories</a>') . '</p>';
} elseif ('link_category' == $taxonomy) {
$help .= '<p>' . __('<a href="http://codex.nxtclass.org/Links_Link_Categories_Screen" target="_blank">Documentation on Link Categories</a>') . '</p>';
} else {
$help .= '<p>' . __('<a href="http://codex.nxtclass.org/Posts_Tags_Screen" target="_blank">Documentation on Tags</a>') . '</p>';
}
$help .= '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>';
get_current_screen()->set_help_sidebar($help);
unset($help);
}
require_once 'admin-header.php';
if (!current_user_can($tax->cap->edit_terms)) {
nxt_die(__('You are not allowed to edit this item.'));
}
$messages[1] = __('Item added.');
$messages[2] = __('Item deleted.');
$messages[3] = __('Item updated.');
$messages[4] = __('Item not added.');
$messages[5] = __('Item not updated.');
$messages[6] = __('Items deleted.');
?>
<div class="wrap nosubsub">
<?php
screen_icon();
?>
<h2><?php
echo esc_html($title);
示例11: _show_post_preview
function _show_post_preview()
{
if (isset($_GET['preview_id']) && isset($_GET['preview_nonce'])) {
$id = (int) $_GET['preview_id'];
if (false == nxt_verify_nonce($_GET['preview_nonce'], 'post_preview_' . $id)) {
nxt_die(__('You do not have permission to preview drafts.'));
}
add_filter('the_preview', '_set_preview');
}
}
示例12: bail
/**
* Wraps errors in a nice header and footer and dies.
*
* Will not die if nxtdb::$show_errors is true
*
* @since 1.5.0
*
* @param string $message The Error message
* @param string $error_code Optional. A Computer readable string to identify the error.
* @return false|void
*/
function bail($message, $error_code = '500')
{
if (!$this->show_errors) {
if (class_exists('nxt_Error')) {
$this->error = new nxt_Error($error_code, $message);
} else {
$this->error = $message;
}
return false;
}
nxt_die($message);
}
示例13: install_theme_information
/**
* Display theme information in dialog box form.
*
* @since 2.8.0
*/
function install_theme_information()
{
//TODO: This function needs a LOT of UI work :)
global $tab, $themes_allowedtags;
$api = themes_api('theme_information', array('slug' => stripslashes($_REQUEST['theme'])));
if (is_nxt_error($api)) {
nxt_die($api);
}
// Sanitize HTML
foreach ((array) $api->sections as $section_name => $content) {
$api->sections[$section_name] = nxt_kses($content, $themes_allowedtags);
}
foreach (array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key) {
if (isset($api->{$key})) {
$api->{$key} = nxt_kses($api->{$key}, $themes_allowedtags);
}
}
iframe_header(__('Theme Install'));
if (empty($api->download_link)) {
echo '<div id="message" class="error"><p>' . __('<strong>ERROR:</strong> This theme is currently not available. Please try again later.') . '</p></div>';
iframe_footer();
exit;
}
if (!empty($api->tested) && version_compare($GLOBALS['nxt_version'], $api->tested, '>')) {
echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has <strong>not been tested</strong> with your current version of NXTClass.') . '</p></div>';
} else {
if (!empty($api->requires) && version_compare($GLOBALS['nxt_version'], $api->requires, '<')) {
echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This theme has not been marked as <strong>compatible</strong> with your version of NXTClass.') . '</p></div>';
}
}
// Default to a "new" theme
$type = 'install';
// Check to see if this theme is known to be installed, and has an update awaiting it.
$update_themes = get_site_transient('update_themes');
if (is_object($update_themes) && isset($update_themes->response)) {
foreach ((array) $update_themes->response as $theme_slug => $theme_info) {
if ($theme_slug === $api->slug) {
$type = 'update_available';
$update_file = $theme_slug;
break;
}
}
}
$themes = get_themes();
foreach ((array) $themes as $this_theme) {
if (is_array($this_theme) && $this_theme['Stylesheet'] == $api->slug) {
if ($this_theme['Version'] == $api->version) {
$type = 'latest_installed';
} elseif ($this_theme['Version'] > $api->version) {
$type = 'newer_installed';
$newer_version = $this_theme['Version'];
}
break;
}
}
?>
<div class='available-theme'>
<img src='<?php
echo esc_url($api->screenshot_url);
?>
' width='300' class="theme-preview-img" />
<h3><?php
echo $api->name;
?>
</h3>
<p><?php
printf(__('by %s'), $api->author);
?>
</p>
<p><?php
printf(__('Version: %s'), $api->version);
?>
</p>
<?php
$buttons = '<a class="button" id="cancel" href="#" onclick="tb_close();return false;">' . __('Cancel') . '</a> ';
switch ($type) {
default:
case 'install':
if (current_user_can('install_themes')) {
$buttons .= '<a class="button-primary" id="install" href="' . nxt_nonce_url(self_admin_url('update.php?action=install-theme&theme=' . $api->slug), 'install-theme_' . $api->slug) . '" target="_parent">' . __('Install Now') . '</a>';
}
break;
case 'update_available':
if (current_user_can('update_themes')) {
$buttons .= '<a class="button-primary" id="install" href="' . nxt_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=' . $update_file), 'upgrade-theme_' . $update_file) . '" target="_parent">' . __('Install Update Now') . '</a>';
}
break;
case 'newer_installed':
if (current_user_can('install_themes') || current_user_can('update_themes')) {
?>
<p><?php
printf(__('Newer version (%s) is installed.'), $newer_version);
?>
//.........这里部分代码省略.........
示例14: edit_user
/**
* Edit user settings based on contents of $_POST
*
* Used on user-edit.php and profile.php to manage and process user options, passwords etc.
*
* @since 2.0
*
* @param int $user_id Optional. User ID.
* @return int user id of the updated user
*/
function edit_user($user_id = 0)
{
global $nxt_roles, $nxtdb;
$user = new stdClass();
if ($user_id) {
$update = true;
$user->ID = (int) $user_id;
$userdata = get_userdata($user_id);
$user->user_login = $nxtdb->escape($userdata->user_login);
} else {
$update = false;
}
if (!$update && isset($_POST['user_login'])) {
$user->user_login = sanitize_user($_POST['user_login'], true);
}
$pass1 = $pass2 = '';
if (isset($_POST['pass1'])) {
$pass1 = $_POST['pass1'];
}
if (isset($_POST['pass2'])) {
$pass2 = $_POST['pass2'];
}
if (isset($_POST['role']) && current_user_can('edit_users')) {
$new_role = sanitize_text_field($_POST['role']);
$potential_role = isset($nxt_roles->role_objects[$new_role]) ? $nxt_roles->role_objects[$new_role] : false;
// Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
// Multisite super admins can freely edit their blog roles -- they possess all caps.
if (is_multisite() && current_user_can('manage_sites') || $user_id != get_current_user_id() || $potential_role && $potential_role->has_cap('edit_users')) {
$user->role = $new_role;
}
// If the new role isn't editable by the logged-in user die with error
$editable_roles = get_editable_roles();
if (!empty($new_role) && empty($editable_roles[$new_role])) {
nxt_die(__('You can’t give users that role.'));
}
}
if (isset($_POST['email'])) {
$user->user_email = sanitize_text_field($_POST['email']);
}
if (isset($_POST['url'])) {
if (empty($_POST['url']) || $_POST['url'] == 'http://') {
$user->user_url = '';
} else {
$user->user_url = esc_url_raw($_POST['url']);
$user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://' . $user->user_url;
}
}
if (isset($_POST['first_name'])) {
$user->first_name = sanitize_text_field($_POST['first_name']);
}
if (isset($_POST['last_name'])) {
$user->last_name = sanitize_text_field($_POST['last_name']);
}
if (isset($_POST['nickname'])) {
$user->nickname = sanitize_text_field($_POST['nickname']);
}
if (isset($_POST['display_name'])) {
$user->display_name = sanitize_text_field($_POST['display_name']);
}
if (isset($_POST['description'])) {
$user->description = trim($_POST['description']);
}
foreach (_nxt_get_user_contactmethods($user) as $method => $name) {
if (isset($_POST[$method])) {
$user->{$method} = sanitize_text_field($_POST[$method]);
}
}
if ($update) {
$user->rich_editing = isset($_POST['rich_editing']) && 'false' == $_POST['rich_editing'] ? 'false' : 'true';
$user->admin_color = isset($_POST['admin_color']) ? sanitize_text_field($_POST['admin_color']) : 'fresh';
$user->show_admin_bar_front = isset($_POST['admin_bar_front']) ? 'true' : 'false';
}
$user->comment_shortcuts = isset($_POST['comment_shortcuts']) && 'true' == $_POST['comment_shortcuts'] ? 'true' : '';
$user->use_ssl = 0;
if (!empty($_POST['use_ssl'])) {
$user->use_ssl = 1;
}
$errors = new nxt_Error();
/* checking that username has been typed */
if ($user->user_login == '') {
$errors->add('user_login', __('<strong>ERROR</strong>: Please enter a username.'));
}
/* checking the password has been typed twice */
do_action_ref_array('check_passwords', array($user->user_login, &$pass1, &$pass2));
if ($update) {
if (empty($pass1) && !empty($pass2)) {
$errors->add('pass', __('<strong>ERROR</strong>: You entered your new password only once.'), array('form-field' => 'pass1'));
} elseif (!empty($pass1) && empty($pass2)) {
$errors->add('pass', __('<strong>ERROR</strong>: You entered your new password only once.'), array('form-field' => 'pass2'));
}
//.........这里部分代码省略.........
示例15: get_current_screen
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p>
<p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of all the template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p>
<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Lookup takes you to a web page with reference material about that particular function.') . '</p>
<p>' . __('After typing in your edits, click Update File.') . '</p>
<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>
<p>' . __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="http://codex.nxtclass.org/Child_Themes" target="_blank">child theme</a> instead.') . '</p>' . (is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '')));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Theme_Development" target="_blank">Documentation on Theme Development</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Editing_Files" target="_blank">Documentation on Editing Files</a>') . '</p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Template_Tags" target="_blank">Documentation on Template Tags</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/" target="_blank">Support Forums</a>') . '</p>');
nxt_reset_vars(array('action', 'redirect', 'profile', 'error', 'warning', 'a', 'file', 'theme', 'dir'));
$themes = get_themes();
if (empty($theme)) {
$theme = get_current_theme();
} else {
$theme = stripslashes($theme);
}
if (!isset($themes[$theme])) {
nxt_die(__('The requested theme does not exist.'));
}
$allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
if (empty($file)) {
if (false !== array_search($themes[$theme]['Stylesheet Dir'] . '/style.css', $allowed_files)) {
$file = $themes[$theme]['Stylesheet Dir'] . '/style.css';
} else {
$file = $allowed_files[0];
}
} else {
$file = stripslashes($file);
if ('theme' == $dir) {
$file = dirname(dirname($themes[$theme]['Template Dir'])) . $file;
} else {
if ('style' == $dir) {
$file = dirname(dirname($themes[$theme]['Stylesheet Dir'])) . $file;