本文整理汇总了PHP中wp_restore_image函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_restore_image函数的具体用法?PHP wp_restore_image怎么用?PHP wp_restore_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_restore_image函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wp_ajax_image_editor
/**
* Ajax handler for image editing.
*
* @since 3.1.0
*/
function wp_ajax_image_editor()
{
$attachment_id = intval($_POST['postid']);
if (empty($attachment_id) || !current_user_can('edit_post', $attachment_id)) {
wp_die(-1);
}
check_ajax_referer("image_editor-{$attachment_id}");
include_once ABSPATH . 'wp-admin/includes/image-edit.php';
$msg = false;
switch ($_POST['do']) {
case 'save':
$msg = wp_save_image($attachment_id);
$msg = wp_json_encode($msg);
wp_die($msg);
break;
case 'scale':
$msg = wp_save_image($attachment_id);
break;
case 'restore':
$msg = wp_restore_image($attachment_id);
break;
}
wp_image_editor($attachment_id, $msg);
wp_die();
}
开发者ID:hughnet,项目名称:WordPress,代码行数:30,代码来源:ajax-actions.php
示例2: die
die('-1');
}
check_ajax_referer("image_editor-{$attachment_id}");
include_once ABSPATH . 'wp-admin/includes/image-edit.php';
$msg = false;
switch ($_POST['do']) {
case 'save':
$msg = wp_save_image($attachment_id);
$msg = json_encode($msg);
die($msg);
break;
case 'scale':
$msg = wp_save_image($attachment_id);
break;
case 'restore':
$msg = wp_restore_image($attachment_id);
break;
}
wp_image_editor($attachment_id, $msg);
die;
break;
case 'set-post-thumbnail':
$post_id = intval($_POST['post_id']);
if (!current_user_can('edit_post', $post_id)) {
die('-1');
}
$thumbnail_id = intval($_POST['thumbnail_id']);
if ($thumbnail_id == '-1') {
delete_post_meta($post_id, '_thumbnail_id');
die(_wp_post_thumbnail_html());
}
开发者ID:nagyist,项目名称:laura-wordpress,代码行数:31,代码来源:admin-ajax.php
注:本文中的wp_restore_image函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论