| ... | ... |
@@ -13,7 +13,7 @@ define('RC_PLUGIN_URL', plugin_dir_url(__FILE__));
|
| 13 | 13 |
define('RC_SETTING_OPTION_KEY', 'rucy_post_type');
|
| 14 | 14 |
define('RC_TXT_DOMAIN', 'rucy');
|
| 15 | 15 |
define('RC_POSTTYPE_DEFAULT','post,page');
|
| 16 |
-define('RC_CRON_FOOK', 'rucy_update_reserved_content');
|
|
| 16 |
+define('RC_CRON_HOOK', 'rucy_update_reserved_content');
|
|
| 17 | 17 |
load_plugin_textdomain( RC_TXT_DOMAIN, false, 'rucy/lang'); |
| 18 | 18 |
|
| 19 | 19 |
add_action('admin_enqueue_scripts','rc_load_jscss');
|
| ... | ... |
@@ -168,11 +168,11 @@ function savePostmeta($post_id) |
| 168 | 168 |
$reservDate = strtotime(get_gmt_from_date($_POST[$rcKeys['date']]) . " GMT"); |
| 169 | 169 |
if(in_array($_POST['post_type'], $acceptPostType) || $_POST['post_type'] != 'revision') |
| 170 | 170 |
{
|
| 171 |
- wp_schedule_single_event($reservDate, RC_CRON_FOOK, array($post_id)); |
|
| 171 |
+ wp_schedule_single_event($reservDate, RC_CRON_HOOK, array($post_id)); |
|
| 172 | 172 |
} |
| 173 | 173 |
} else if($_POST[$rcKeys['accept']] == "0") {
|
| 174 | 174 |
// delete schedule |
| 175 |
- wp_clear_scheduled_hook(RC_CRON_FOOK, array($post_id)); |
|
| 175 |
+ wp_clear_scheduled_hook(RC_CRON_HOOK, array($post_id)); |
|
| 176 | 176 |
} |
| 177 | 177 |
} |
| 178 | 178 |
} |
| ... | ... |
@@ -214,7 +214,7 @@ function updateReservedContent($post_id) |
| 214 | 214 |
); |
| 215 | 215 |
wp_update_post($updates,true); |
| 216 | 216 |
} |
| 217 |
- wp_clear_scheduled_hook(RC_CRON_FOOK, array($post_id)); |
|
| 217 |
+ wp_clear_scheduled_hook(RC_CRON_HOOK, array($post_id)); |
|
| 218 | 218 |
$dels = getRcMetas(); |
| 219 | 219 |
foreach ($dels as $key => $del) |
| 220 | 220 |
{
|
| ... | ... |
@@ -258,9 +258,10 @@ function addRcSetting() |
| 258 | 258 |
$post = $_POST; |
| 259 | 259 |
$isCheckedPost = ""; |
| 260 | 260 |
$isCheckedPage = ""; |
| 261 |
- $arrCustomPostTypes = ""; |
|
| 262 | 261 |
$customPostTypes = ""; |
| 263 | 262 |
$errorClass = "form-invalid"; |
| 263 |
+ $basicPostTypes = array('page','post');
|
|
| 264 |
+ $invalidPostTypes = array('attachment','revision');
|
|
| 264 | 265 |
$message = array(); |
| 265 | 266 |
$error = 0; |
| 266 | 267 |
if(isset($post['page_options'])) |
| ... | ... |
@@ -284,12 +285,15 @@ function addRcSetting() |
| 284 | 284 |
} |
| 285 | 285 |
if(isset($post['rc_custom_post']) && $post['rc_custom_post'] != "") {
|
| 286 | 286 |
$customCheck = explode(',', $post['rc_custom_post']);
|
| 287 |
- foreach ($customCheck as $check){
|
|
| 288 |
- if(preg_match('/^page$/', $check) || preg_match('/^post$/', $check))
|
|
| 287 |
+ foreach ($customCheck as $check) |
|
| 288 |
+ {
|
|
| 289 |
+ if(in_array($check, $basicPostTypes)) |
|
| 289 | 290 |
{
|
| 290 | 291 |
$message['custom_post'] = __('Do not input "post" or "page". ', RC_TXT_DOMAIN);
|
| 291 | 292 |
} else if(!preg_match('/[a-zA-Z0-9_-]/', $check)) {
|
| 292 | 293 |
$message['custom_post'] = __("Please input alphabet or numeric. And do not input sequencial commas.", RC_TXT_DOMAIN);
|
| 294 |
+ } else if(in_array($check, $invalidPostTypes)){
|
|
| 295 |
+ $message['custom_post'] = __('Do not input "attachment" or "revision". ',RC_TXT_DOMAIN);
|
|
| 293 | 296 |
} |
| 294 | 297 |
} |
| 295 | 298 |
$res .= "," . $post['rc_custom_post']; |
| ... | ... |
@@ -400,7 +404,7 @@ if(function_exists('register_uninstall_hook'))
|
| 400 | 400 |
|
| 401 | 401 |
function goodbyeRucy() |
| 402 | 402 |
{
|
| 403 |
- wp_clear_scheduled_hook(RC_CRON_FOOK); |
|
| 403 |
+ wp_clear_scheduled_hook(RC_CRON_HOOK); |
|
| 404 | 404 |
delete_option(RC_SETTING_OPTION_KEY); |
| 405 | 405 |
$allposts = get_posts('numberposts=-1&post_status=');
|
| 406 | 406 |
$meta_keys = getRcMetas(); |