本文整理汇总了PHP中wp_die函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_die函数的具体用法?PHP wp_die怎么用?PHP wp_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WP_Posts_List_Table
function WP_Posts_List_Table() {
global $post_type_object, $post_type, $wpdb;
if ( !isset( $_REQUEST['post_type'] ) )
$post_type = 'post';
elseif ( in_array( $_REQUEST['post_type'], get_post_types( array( 'show_ui' => true ) ) ) )
$post_type = $_REQUEST['post_type'];
else
wp_die( __( 'Invalid post type' ) );
$_REQUEST['post_type'] = $post_type;
$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT( 1 ) FROM $wpdb->posts
WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
AND post_author = %d
", $post_type, get_current_user_id() ) );
if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
$_GET['author'] = get_current_user_id();
}
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
$this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
}
parent::WP_List_Table( array(
'plural' => 'posts',
) );
}
示例2: enroll
static function enroll($is_manager)
{
global $wpdb, $user_ID, $user_email;
$_course = new NamasteLMSCourseModel();
$message = '';
// enroll in course
$course = $_course->select($_POST['course_id']);
// course fee?
$fee = get_post_meta($course->ID, 'namaste_fee', true);
// When fee is paid, enrollment is automatic so this is just fine here
if (!empty($fee)) {
$fee = apply_filters('namaste-coupon-applied', $fee);
}
// coupon code from other plugin?
if ($fee > 0 and !$is_manager) {
wp_die("You can't enroll yourself in a course when there is a fee");
}
$enroll_mode = get_post_meta($course->ID, 'namaste_enroll_mode', true);
// if already enrolled, just skip this altogether
if (!NamasteLMSStudentModel::is_enrolled($user_ID, $course->ID)) {
// depending on mode, status will be either 'pending' or 'enrolled'
$status = $enroll_mode == 'free' ? 'enrolled' : 'pending';
$_course->enroll($user_ID, $course->ID, $status);
if ($enroll_mode == 'free') {
$message = sprintf(__('You enrolled in "%s"', 'namaste'), $course->post_title);
} else {
$message = __('Thank you for your interest in enrolling this course. A manager will review your application.', 'namaste');
}
} else {
$message = __('You have already enrolled in this course', 'namaste');
}
return $message;
}
示例3: wpbgdc_autoloader
/**
* The autoloader class
*
* @param string $class_name
*
* @return bool
* @since 1.0
*/
function wpbgdc_autoloader($class_name)
{
// do not include classes that already exist
if (class_exists($class_name)) {
return true;
}
$file = trailingslashit(dirname(__FILE__)) . 'classes/' . strtolower($class_name) . '.php';
if (is_file($file)) {
require_once $file;
return true;
}
if (false === stripos($class_name, 'Google')) {
return false;
}
$file = trailingslashit(dirname(__FILE__)) . 'classes/' . str_replace('_', '/', $class_name) . '.php';
if (is_file($file)) {
try {
require_once $file;
} catch (Exception $e) {
$message = '<div class="error"><p>' . $e->getMessage() . '</p></div>';
wp_die($message);
}
return true;
}
return false;
}
示例4: wpmu_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 wpmu_checkAvailableSpace()
{
_deprecated_function(__FUNCTION__, '3.0', 'is_upload_space_available()');
if (!is_upload_space_available()) {
wp_die(__('Sorry, you must delete files before you can upload any more.'));
}
}
示例5: pado_options
function pado_options()
{
// Check that the user is able to view this page.
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.', 'pressapps'));
}
?>
<div class="wrap">
<div id="icon-themes" class="icon32"></div>
<h2><?php
_e('Document Settings', 'pressapps');
?>
</h2>
<form action="options.php" method="post">
<?php
settings_fields('pado_setup_options');
?>
<?php
do_settings_sections('pado_setup_options');
?>
<?php
submit_button();
?>
</form>
</div>
<?php
}
示例6: gmw_fl_update_members_database_table
function gmw_fl_update_members_database_table()
{
if (empty($_POST['gmw_action']) || $_POST['gmw_action'] != 'members_db_table_update') {
return;
}
//look for nonce
if (empty($_POST['gmw_members_db_table_update_nonce'])) {
wp_die(__('Cheatin\' eh?!', 'GMW'));
}
//varify nonce
if (!wp_verify_nonce($_POST['gmw_members_db_table_update_nonce'], 'gmw_members_db_table_update_nonce')) {
wp_die(__('Cheatin\' eh?!', 'GMW'));
}
global $wpdb;
$dbTable = $wpdb->get_row("SELECT * FROM wppl_friends_locator");
//Add column if not present.
if (!isset($dbTable->street_name)) {
$wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `street_name` varchar(128) NOT NULL AFTER `long`");
}
if (!isset($dbTable->street_number)) {
$wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `street_number` varchar(60) NOT NULL AFTER `long`");
}
if (!isset($dbTable->feature)) {
$wpdb->query("ALTER TABLE wppl_friends_locator ADD COLUMN `feature` tinyint NOT NULL default '0' AFTER `member_id`");
}
update_option("gmw_fl_db_version", GMW_FL_DB_VERSION);
wp_safe_redirect(admin_url('admin.php?page=gmw-add-ons&gmw_notice=members_db_table_updated&gmw_notice_status=updated'));
exit;
}
示例7: load_more_posts_callback
function load_more_posts_callback()
{
check_ajax_referer('pan_travel_blog', 'token');
try {
$offset = $_POST['offset'];
$number = $_POST['number'];
$loop = new WP_Query(array('post_type' => 'travel_blogs', 'post_status' => 'publish', 'order' => 'DESC', 'orderby' => 'meta_value', 'meta_key' => 'travel_blog_start_date', 'offset' => $offset, 'posts_per_page' => $number));
if ($loop->have_posts()) {
while ($loop->have_posts()) {
$loop->the_post();
?>
<?php
get_template_part('parts/content', 'travelblog');
?>
<?php
}
} else {
?>
<p><?php
_e('Sorry, no posts matched your criteria.');
?>
</p>
<?php
}
wp_reset_postdata();
} catch (Exception $e) {
echo 'Errors';
}
wp_die();
}
示例8: dispatch
/**
* Dispatch request for settings page
*
* @param none
* @return void
*/
public function dispatch()
{
if (!current_user_can('manage_network_options')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
self::render();
}
示例9: printUi
public function printUi()
{
if (!$this->currentUserCanManageLicense()) {
wp_die("You don't have sufficient permissions to manage licenses for this product.");
}
$action = isset($_REQUEST['license_action']) ? strval($_REQUEST['license_action']) : '';
if (empty($action)) {
$action = 'show_license';
}
check_admin_referer($action);
$this->triedLicenseKey = isset($_POST['license_key']) ? trim(strval($_POST['license_key'])) : $this->licenseManager->getLicenseKey();
$this->printHeader();
$this->dispatchAction($action);
$this->printLogo();
$this->printTabList();
?>
<div class="wrap" id="wslm-section-holder">
<div id="section-current-license" class="wslm-section">
<?php
$this->tabCurrentLicense();
?>
</div>
<div id="section-manage-sites" class="wslm-section hidden">
<?php
$this->tabManageSites();
?>
</div>
</div> <!-- #wslm-section-holder -->
<?php
exit;
}
示例10: printUi
public function printUi()
{
if (!$this->currentUserCanManageLicense()) {
wp_die("You don't have sufficient permissions to manage licenses for this product.");
}
$action = isset($_REQUEST['license_action']) ? strval($_REQUEST['license_action']) : '';
if (empty($action)) {
$action = 'show_license';
}
check_admin_referer($action);
$this->triedLicenseKey = isset($_POST['license_key']) ? trim(strval($_POST['license_key'])) : $this->licenseManager->getLicenseKey();
if (isset($_REQUEST['tab']) && is_string($_REQUEST['tab']) && array_key_exists($_REQUEST['tab'], $this->tabs)) {
$this->currentTab = $_REQUEST['tab'];
}
$this->printHeader();
$this->dispatchAction($action);
$this->printLogo();
$this->printTabList();
?>
<div class="wrap" id="wslm-section-holder">
<?php
foreach ($this->tabs as $id => $tab) {
printf('<div id="section-%1$s" class="wslm-section%2$s">', esc_attr($id), $this->currentTab !== $id ? ' hidden' : '');
call_user_func($tab['callback']);
echo '</div>';
}
?>
</div> <!-- #wslm-section-holder -->
<?php
exit;
}
示例11: ajax_image_crop
public function ajax_image_crop()
{
$res = false;
if (!current_user_can('edit_posts') || empty($_REQUEST["nonce"]) || !wp_verify_nonce($_REQUEST["nonce"], 'pe_theme_image_crop')) {
wp_send_json_error();
wp_die(0);
}
$id = $_REQUEST["id"];
$idx = $_REQUEST["idx"];
$size = $_REQUEST["size"];
list($w, $h) = explode("x", $size);
$crop = $_REQUEST["crop"];
$orig = $_REQUEST["orig"];
$res = $this->master->image->crop($orig, $crop, $w, $h);
if (!empty($res["cburl"])) {
$res["idx"] = absint($idx);
$meta = get_post_meta($id, PE_THEME_META, true);
if (empty($meta)) {
$meta = new StdClass();
$meta->thumbnails = new StdClass();
}
$meta->thumbnails->thumbs[$size] = $crop;
update_post_meta($id, PE_THEME_META, $this->update_attachment_metadata($meta, $id, null));
}
wp_send_json_success($res);
wp_die(0);
}
示例12: show_settings
public function show_settings()
{
if (!current_user_can('manage_options')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$out = '';
if (!isset($_GET['tab'])) {
$_GET['tab'] = 'general';
}
// check for changed settings
if (isset($_GET['settings-updated'])) {
// show "settings saved" message
$out .= '<div id="message" class="updated">
<p><strong>' . __('Settings saved.', 'event-list') . '</strong></p>
</div>';
// check feed rewrite status and update it if required
if ('feed' == $_GET['tab']) {
require_once EL_PATH . 'includes/feed.php';
EL_Feed::get_instance()->update_feed_rewrite_status();
}
}
// normal output
$out .= '
<div class="wrap">
<div id="icon-edit-pages" class="icon32"><br /></div><h2>' . __('Event List Settings', 'event-list') . '</h2>';
$out .= $this->show_tabs($_GET['tab']);
$out .= '<div id="posttype-page" class="posttypediv">';
$out .= $this->functions->show_option_form($_GET['tab']);
$out .= '
</div>
</div>';
echo $out;
}
示例13: process_submission
function process_submission()
{
if (!current_user_can('pp_manage_settings')) {
wp_die(__ppw('Cheatin’ uh?'));
}
if (!empty($_REQUEST['pp_refresh_updates'])) {
delete_site_transient('update_plugins');
pp_get_version_info(true, false, true);
wp_update_plugins();
wp_redirect(admin_url('admin.php?page=pp-settings&pp_refresh_done=1'));
exit;
}
if (!empty($_REQUEST['pp_renewal'])) {
$opt_val = get_option('pp_support_key');
$renewal_token = !is_array($opt_val) || count($opt_val) < 2 ? '' : substr($opt_val[1], 0, 16);
$url = site_url('');
$arr_url = parse_url($url);
$site = urlencode(str_replace($arr_url['scheme'] . '://', '', $url));
wp_redirect('http://presspermit.com/renewal/?pkg=press-permit-pro&site=' . $site . '&rt=' . $renewal_token);
exit;
}
if (!empty($_REQUEST['pp_upload_config']) || !empty($_REQUEST['pp_support_forum'])) {
require_once dirname(__FILE__) . '/admin/support_pp.php';
$args = array();
if (isset($_REQUEST['post_id'])) {
$args['post_id'] = (int) $_REQUEST['post_id'];
}
if (isset($_REQUEST['term_taxonomy_id'])) {
$args['term_taxonomy_id'] = (int) $_REQUEST['term_taxonomy_id'];
}
if (!empty($_REQUEST['pp_support_forum'])) {
//$forum = ( ! empty( $_REQUEST['pp_forum'] ) ) ? sanitize_url($_REQUEST['pp_forum']) : 'pp2-technical-issues';
$url = "http://presspermit.com/forums/";
if (!empty($_REQUEST['pp_topic'])) {
$url = add_query_arg('pp_topic', $_REQUEST['pp_topic'], $url);
}
wp_redirect($url);
}
$success = _pp_support_upload($args);
if (empty($_REQUEST['pp_support_forum'])) {
if (-1 === $success) {
$flag = 'pp_config_no_change';
} elseif ($success) {
$flag = 'pp_config_uploaded';
} else {
$flag = 'pp_config_failed';
}
wp_redirect(admin_url("admin.php?page=pp-settings&{$flag}=1"));
}
exit;
}
if (isset($_POST['pp_submit'])) {
$this->handle_submission('update');
} elseif (isset($_POST['pp_defaults'])) {
$this->handle_submission('default');
} elseif (isset($_POST['pp_role_usage_defaults'])) {
delete_option('pp_role_usage');
pp_refresh_options();
}
}
示例14: 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)) {
wp_die(__('BuddyPress Courseware error while registering assignment post type.', 'bpsp'));
}
}
示例15: ajax_refresh_captcha
public function ajax_refresh_captcha()
{
$length = 5;
$charset = 'abcdefghijklmnpqrstuvwxyz123456789';
$phrase = '';
$chars = str_split($charset);
for ($i = 0; $i < $length; $i++) {
$phrase .= $chars[array_rand($chars)];
}
$resp = $resp2 = array();
$resp['txt_color_st'] = isset($_POST['txt_color_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['txt_color_st']) : '';
$resp['txt_color'] = isset($_POST['txt_color']) ? Uiform_Form_Helper::sanitizeInput($_POST['txt_color']) : '';
$resp['background_st'] = isset($_POST['background_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['background_st']) : '';
$resp['background_color'] = isset($_POST['txt_color_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['background_color']) : '';
$resp['distortion'] = isset($_POST['distortion']) ? Uiform_Form_Helper::sanitizeInput($_POST['distortion']) : '';
$resp['behind_lines_st'] = isset($_POST['behind_lines_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['behind_lines_st']) : '';
$resp['behind_lines'] = isset($_POST['behind_lines']) ? Uiform_Form_Helper::sanitizeInput($_POST['behind_lines']) : '';
$resp['front_lines_st'] = isset($_POST['front_lines_st']) ? Uiform_Form_Helper::sanitizeInput($_POST['front_lines_st']) : '';
$resp['front_lines'] = isset($_POST['front_lines']) ? Uiform_Form_Helper::sanitizeInput($_POST['front_lines']) : '';
$resp['ca_txt_gen'] = $phrase;
$captcha_options = Uiform_Form_Helper::base64url_encode(json_encode($resp));
$resp2 = array();
$resp2['rkver'] = $captcha_options;
//return data to ajax callback
header('Content-Type: application/json');
echo json_encode($resp2);
wp_die();
}