本文整理汇总了PHP中wp_die函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_die函数的具体用法?PHP wp_die怎么用?PHP wp_die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_die函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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',
) );
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:33,代码来源:class-wp-posts-list-table.php
示例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;
}
开发者ID:Bnei-Baruch,项目名称:Namaste,代码行数:33,代码来源:courses.php
示例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;
}
开发者ID:omodev,项目名称:hooks,代码行数:34,代码来源:google-drive-cdn.php
示例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.'));
}
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:13,代码来源:ms-deprecated.php
示例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
}
开发者ID:rinodung,项目名称:live-theme,代码行数:30,代码来源:page.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;
}
开发者ID:sedici,项目名称:wpmu-istec,代码行数:29,代码来源:gmw-fl-db.php
示例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();
}
开发者ID:spiderPan,项目名称:PanBlog,代码行数:30,代码来源:custom-ajax-handler.php
示例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();
}
开发者ID:bulats,项目名称:chef,代码行数:13,代码来源:Network.php
示例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;
}
开发者ID:nikibrown,项目名称:2014-Nerd-presentation,代码行数:31,代码来源:BasicPluginLicensingUi.php
示例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;
}
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:31,代码来源:BasicPluginLicensingUi.php
示例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);
}
开发者ID:JeffreyBue,项目名称:jb,代码行数:27,代码来源:PeThemeThumbnail.php
示例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;
}
开发者ID:berniecultess,项目名称:infirev,代码行数:33,代码来源:admin-settings.php
示例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();
}
}
开发者ID:severnrescue,项目名称:web,代码行数:60,代码来源:submittee_pp.php
示例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'));
}
}
开发者ID:ruanbarbosa,项目名称:buddypress-courseware,代码行数:12,代码来源:assignments.class.php
示例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();
}
开发者ID:showlowtech,项目名称:uiform-form-builder,代码行数:28,代码来源:uiform-fb-controller-fields.php
示例16: output
/**
* Output the settings
*/
public function output()
{
global $woocommerce, $woocommerce_settings, $current_section, $current_tab;
if (!current_user_can('manage_woocommerce')) {
wp_die(__('You do not have sufficient permissions to access this page.', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN));
}
do_action('woocommerce_mailpoet_settings_start');
$mailpoet_settings = $this->get_settings();
// Get current section
$current_section = empty($_REQUEST['section']) ? 'general' : sanitize_text_field(urldecode($_REQUEST['section']));
$current = $current_section ? '' : ' class="current"';
// Creates each settings section.
$mailpoet_section = apply_filters('woocommerce_mailpoet_settings_sections', array('general' => __('General', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN), 'lists' => __('Lists', MAILPOET_WOOCOMMERCE_TEXT_DOMAIN)));
foreach ($mailpoet_section as $section => $title) {
$title = ucwords($title);
$current = $section == $current_section ? ' class="current"' : '';
$links[] = '<a href="' . add_query_arg('section', $section, admin_url('admin.php?page=woocommerce_settings&tab=mailpoet')) . '"' . $current . '>' . esc_html($title) . '</a>';
}
echo '<ul class="subsubsub"><li>' . implode('| </li><li>', $links) . '</li></ul><br class="clear" />';
woocommerce_admin_fields($mailpoet_settings);
if ($current_section == 'lists') {
include_once MailPoet_WooCommerce_Add_on()->plugin_path() . '/includes/admin/settings/settings-newsletters.php';
$mailpoet_list = mailpoet_lists();
do_action('woocommerce_mailpoet_list_newsletters', $mailpoet_list);
}
}
开发者ID:rinodung,项目名称:live-theme,代码行数:29,代码来源:class-mailpoet-woocommerce-admin-settings.php
示例17: activate
public function activate()
{
if (!in_array('woocommerce/woocommerce.php', get_option('active_plugins')) || !defined('WC_VERSION') || !version_compare(WC_VERSION, '2.6', '>=')) {
deactivate_plugins(plugin_basename(__FILE__));
wp_die(sprintf(__('Для работы плагина eDostavka нужно установить %s! не ниже 2.6 версии'), '<a href="http://wordpress.org/extend/plugins/woocommerce/">WooCommerce</a>'));
}
}
开发者ID:kalbac,项目名称:wc-edostavka,代码行数:7,代码来源:wc-edostavka.php
示例18: prepare
protected function prepare()
{
include ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
try {
$this->api = $api = Sputnik::get_plugin($this->id);
} catch (Exception $e) {
status_header(500);
$this->header();
echo '<p>' . $e->getMessage() . '</p>';
$this->footer();
return;
}
if (!Sputnik::is_purchased($this->api->slug)) {
wp_redirect(Sputnik_Admin::build_url(array('buy' => $this->id)));
die;
}
if (!current_user_can('install_plugins')) {
wp_die(__('You do not have sufficient permissions to install plugins for this site.', 'sputnik'));
}
check_admin_referer($this->nonce_prefix . $this->api->slug);
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$title = sprintf($this->title_format, $this->api->name . ' ' . $this->api->version);
$nonce = $this->nonce_prefix . $this->id;
$url = 'update.php?action=install-plugin&plugin=' . $this->id;
if (isset($_GET['from'])) {
$url .= '&from=' . urlencode(stripslashes($_GET['from']));
}
$type = 'web';
//Install plugin type, From Web or an Upload.
if ($this->api->is_theme) {
$this->upgrader = new Sputnik_ThemeUpgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
} else {
$this->upgrader = new Sputnik_Upgrader(new Sputnik_View_Install_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
}
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:35,代码来源:Install.php
示例19: Init
static function Init()
{
global $submenu;
if (!empty($submenu['wpfilebase_manage']) && is_array($submenu['wpfilebase_manage']) && (empty($_GET['page']) || $_GET['page'] !== 'wpfilebase_css')) {
foreach (array_keys($submenu['wpfilebase_manage']) as $i) {
if ($submenu['wpfilebase_manage'][$i][2] === 'wpfilebase_css') {
unset($submenu['wpfilebase_manage'][$i]);
break;
}
}
}
add_filter('mce_external_plugins', array(__CLASS__, 'McePlugins'));
add_filter('mce_buttons', array(__CLASS__, 'MceButtons'));
if (isset($_GET['wpfilebase-screen'])) {
switch ($_GET['wpfilebase-screen']) {
case 'editor-plugin':
require_once WPFB_PLUGIN_ROOT . 'screens/editor-plugin.php';
exit;
case 'tpl-preview':
require_once WPFB_PLUGIN_ROOT . 'screens/tpl-preview.php';
exit;
}
wp_die('Unknown screen ' . esc_html($_GET['wpfilebase-screen']) . '!');
}
}
开发者ID:noxian,项目名称:WP-Filebase,代码行数:25,代码来源:AdminLite.php
示例20: smamo_instagram
function smamo_instagram()
{
// Klargør svar
$response = array();
$num = isset($_POST['num']) ? 4 * wp_strip_all_tags($_POST['num']) : 4;
// vi skal bruge et hashtag, ellers die();
if (!isset($_POST['hash'])) {
$response['code'] = '400';
$response['error'] = 'No hashtag received';
wp_die(json_encode($response));
}
// Indstil $tag
$tag = wp_strip_all_tags($_POST['hash']);
// Inkluder instagram class
require get_template_directory() . '/functions/instagram/instagram.class.php';
// Opret ny instance
$instagram = new Instagram(array('apiKey' => 'dd36cc7a7be445c8a00d9f383e49f8c8', 'apiSecret' => 'e750735ffba74f8a8ed753a33c7351da', 'apiCallback' => 'http://faaborg-gym.dk'));
$response['images'] = array();
$inst_obj = $instagram->getTagMedia($tag, $num);
$next_page = $instagram->pagination($inst_obj);
$response['next'] = $next_page;
foreach ($inst_obj->data as $key => $val) {
$response['images'][] = $val;
}
wp_die(json_encode($response));
}
开发者ID:JeppeSigaard,项目名称:faaborggym,代码行数:26,代码来源:ajax-instagram.php
注:本文中的wp_die函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论