PluginProbe
Welcart e-Commerce / 2.12.4
Welcart e-Commerce v2.12.4
2.12.4 2.12.3 2.11.35 2.12.2 2.12.1 2.11.34 2.11.33 2.11.32 2.11.31 2.11.30 1.3.16 1.3.17 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 All 292 releases
← All changes | includes/edit-form-advanced34.php +458 -575 1.4.122.12.4 View file →
@@ -1,576 +1,458 @@
1 -<?php
2 -/**
3 - * Post advanced form for inclusion in the administration panels.
4 - *
5 - * @package WordPress
6 - * @subpackage Administration
7 - */
8 -// don't load directly
9 -if ( !defined('ABSPATH') )
10 - die('-1');
11 -
12 -global $usces;
13 -
14 -//echo $GLOBALS['hook_suffix'];
15 -//wp_enqueue_script('post');
16 -//
17 -//if ( post_type_supports($post_type, 'editor') ) {
18 -// if ( user_can_richedit() )
19 -// wp_enqueue_script('editor');
20 -// wp_enqueue_script('word-count');
21 -//}
22 -//
23 -//if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
24 -// add_thickbox();
25 -// wp_enqueue_script('media-upload');
26 -//}
27 -
28 -/**
29 - * Post ID global
30 - * @name $post_ID
31 - * @var int
32 - */
33 -$post_ID = isset($post_ID) ? (int) $post_ID : 0;
34 -$temp_ID = isset($temp_ID) ? (int) $temp_ID : 0;
35 -$user_ID = isset($user_ID) ? (int) $user_ID : 0;
36 -$action = isset($action) ? $action : '';
37 -
38 -$messages = array();
39 -$messages['post'] = array(
40 - 0 => '', // Unused. Messages start at index 1.
41 - 1 => sprintf( __('Post updated. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
42 - 2 => __('Custom field updated.'),
43 - 3 => __('Custom field deleted.'),
44 - 4 => __('Post updated.'),
45 - /* translators: %s: date and time of the revision */
46 - 5 => isset($_GET['revision']) ? sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
47 - 6 => sprintf( __('Post published. <a href="%s">View post</a>'), esc_url( get_permalink($post_ID) ) ),
48 - 7 => __('Post saved.'),
49 - 8 => sprintf( __('Post submitted. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
50 - 9 => sprintf( __('Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>'),
51 - // translators: Publish box date format, see http://php.net/date
52 - (isset($post->post_date) ? date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) : ''), esc_url( get_permalink($post_ID) ) ),
53 - 10 => sprintf( __('Post draft updated. <a target="_blank" href="%s">Preview post</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
54 -);
55 -//$messages['page'] = array(
56 -// 0 => '', // Unused. Messages start at index 1.
57 -// 1 => sprintf( __('Page updated. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
58 -// 2 => __('Custom field updated.'),
59 -// 3 => __('Custom field deleted.'),
60 -// 4 => __('Page updated.'),
61 -// 5 => isset($_GET['revision']) ? sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
62 -// 6 => sprintf( __('Page published. <a href="%s">View page</a>'), esc_url( get_permalink($post_ID) ) ),
63 -// 7 => __('Page saved.'),
64 -// 8 => sprintf( __('Page submitted. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
65 -// 9 => sprintf( __('Page scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview page</a>'), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( get_permalink($post_ID) ) ),
66 -// 10 => sprintf( __('Page draft updated. <a target="_blank" href="%s">Preview page</a>'), esc_url( add_query_arg( 'preview', 'true', get_permalink($post_ID) ) ) ),
67 -//);
68 -//
69 -$messages = apply_filters( 'post_updated_messages', $messages );
70 -
71 -$message = false;
72 -if ( isset($_GET['message']) ) {
73 - $_GET['message'] = absint( $_GET['message'] );
74 - if ( isset($messages[$post_type][$_GET['message']]) )
75 - $message = $messages[$post_type][$_GET['message']];
76 - elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
77 - $message = $messages['post'][$_GET['message']];
78 -}
79 -
80 -$notice = false;
81 -$form_extra = '';
82 -if ( isset($post->post_status) && 'auto-draft' == $post->post_status ) {
83 - if ( 'edit' == $action )
84 - $post->post_title = '';
85 - $autosave = false;
86 - $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
87 -} else {
88 - $autosave = wp_get_post_autosave( $post_ID );
89 -}
90 -
91 -$form_action = 'editpost';
92 -$nonce_action = 'update-' . $post_type . '_' . $post_ID;
93 -$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post->ID) . "' />";
94 -
95 -// Detect if there exists an autosave newer than the post and if that autosave is different than the post
96 -if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
97 - foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
98 - if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
99 - $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
100 - break;
101 - }
102 - }
103 - unset($autosave_field, $_autosave_field);
104 -}
105 -
106 -$post_type_object = get_post_type_object($post_type);
107 -
108 -// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
109 -
110 -
111 -
112 -/****************************************************************************/
113 -function post_item_pict_box($post) {
114 - global $usces, $current_screen;
115 - $item_picts = array();
116 - $item_sumnails = array();
117 - $post_id = isset($post->ID) ? $post->ID : 0;
118 - $item_code = get_post_meta($post_id, '_itemCode', true);
119 -
120 - if( !empty($item_code) ){
121 - $pictid = (int)$usces->get_mainpictid($item_code);
122 - $item_picts[] = wp_get_attachment_image( $pictid, array(260, 200), true );
123 - $item_sumnails[] = wp_get_attachment_image( $pictid, array(50, 50), true );
124 - $item_pictids = $usces->get_pictids($item_code);
125 - for($i=0; $i<count($item_pictids); $i++){
126 - $item_picts[] = wp_get_attachment_image( $item_pictids[$i], array(260, 200), true );
127 - $item_sumnails[] = wp_get_attachment_image( $item_pictids[$i], array(50, 50), true );
128 - }
129 - }
130 -?>
131 -
132 - <div class="item-main-pict">
133 - <div id="item-select-pict">
134 -<?php
135 - if($item_sumnails) {
136 - echo $item_picts[0];
137 - } else {
138 -?>
139 - <!--<img src="#" width="260" height="200" alt="" />-->
140 -
141 -<?php
142 - }
143 -?>
144 - </div>
145 - <div class="clearfix">
146 - <?php for($i=0; $i<count($item_sumnails); $i++){ ?>
147 - <div class="subpict"><a onclick='uscesItem.cahngepict("<?php echo str_replace('"', '\"', $item_picts[$i]); ?>");'><?php echo $item_sumnails[$i]; ?></a></div>
148 - <?php } ?>
149 - </div>
150 - </div>
151 -<?php
152 -}
153 -add_meta_box('item-main-pict', __('Item image', 'usces'), 'post_item_pict_box', $post_type, 'side', 'high');
154 -
155 -
156 -do_action('add_meta_boxes', $post_type, $post);
157 -do_action('add_meta_boxes_' . $post_type, $post);
158 -
159 -do_action('do_meta_boxes', $post_type, 'normal', $post);
160 -do_action('do_meta_boxes', $post_type, 'advanced', $post);
161 -do_action('do_meta_boxes', $post_type, 'side', $post);
162 -
163 -//if ( 'post' == $post_type ) {
164 -// add_contextual_help($current_screen,
165 -// '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes that allow you to add metadata to your post using drag and drop, and can minimize or expand them by clicking the title bar of the box. You can also hide any of the boxes by using the Screen Options tab, where you can also choose a 1- or 2-column layout for this screen.') . '</p>' .
166 -// '<p>' . __('<strong>Title</strong> - Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>' .
167 -// '<p>' . __('<strong>Post editor</strong> - Enter the text for your post. There are two modes of editing: Visual and HTML. Choose the mode by clicking on the appropriate tab. Visual mode gives you a WYSIWYG editor. Click the last icon in the row to get a second row of controls. The HTML mode allows you to enter raw HTML along with your post text. You can insert media files by clicking the icons above the post editor and following the directions.') . '</p>' .
168 -// '<p>' . __('<strong>Publish</strong> - You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.') . '</p>' .
169 -// '<p>' . __('<strong>Featured Image</strong> - This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the featured image as a post thumbnail on the home page, a custom header, etc.') . '</p>' .
170 -// '<p>' . __("<strong>Send Trackbacks</strong> - Trackbacks are a way to notify legacy blog systems that you've linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.") . '</p>' .
171 -// '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>' .
172 -// '<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'options-writing.php') . '</p>' .
173 -// '<p><strong>' . __('For more information:') . '</strong></p>' .
174 -// '<p>' . __('<a href="http://codex.wordpress.org/Writing_Posts">Writing Posts Documentation</a>') . '</p>' .
175 -// '<p>' . __('<a href="http://wordpress.org/support/">Support Forums</a>') . '</p>'
176 -// );
177 -//} elseif ( 'page' == $post_type ) {
178 -// add_contextual_help($current_screen, '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the "Parent" of the other, creating a group of Pages.') . '</p>' .
179 -// '<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. The Page editor mostly works the same Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' .
180 -// '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
181 -// '<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' .
182 -// '<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in.') . '</p>' .
183 -// '<p><strong>' . __('For more information:') . '</strong></p>' .
184 -// '<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_SubPanel">Page Creation Documentation</a>') . '</p>' .
185 -// '<p>' . __('<a href="http://wordpress.org/support/">Support Forums</a>') . '</p>'
186 -// );
187 -//}
188 -
189 -/* 30 ***************************************/
190 -//require_once('./admin-header.php');
191 -
192 -$status = $this->action_status;
193 -$message = $this->action_message;
194 -$this->action_status = 'none';
195 -$this->action_message = '';
196 -global $screen_layout_columns;
197 -
198 -?>
199 -<script type="text/javascript">
200 -
201 -jQuery(function($){
202 -<?php if($status == 'success'){ ?>
203 - $("#anibox").animate({ backgroundColor: "#ECFFFF" }, 2000);
204 -<?php }else if($status == 'caution'){ ?>
205 - $("#anibox").animate({ backgroundColor: "#FFF5CE" }, 2000);
206 -<?php }else if($status == 'error'){ ?>
207 - $("#anibox").animate({ backgroundColor: "#FFE6E6" }, 2000);
208 -<?php } ?>
209 -});
210 -</script>
211 -
212 -<div class="wrap">
213 -<div class="usces_admin">
214 -<?php //screen_icon(); ?>
215 -<h2><!--<img src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/usc-e-shop/images/easymoblog1.png" /> --><?php echo esc_html( $title ); ?></h2>
216 -<div id="aniboxStatus" class="<?php echo $status; ?>">
217 - <div id="anibox" class="clearfix">
218 - <img src="<?php echo USCES_PLUGIN_URL; ?>/images/list_message_<?php echo $status; ?>.gif" />
219 - <div class="mes" id="info_massage"><?php echo $message; ?></div>
220 - </div>
221 -</div>
222 -<form name="post" action="" method="post" id="post">
223 -<?php
224 -
225 -//if ( 0 == $post_ID)
226 -// wp_nonce_field('add-post');
227 -//else
228 -// wp_nonce_field('update-post_' . $post_ID);
229 -$itemCode = get_post_meta($post_ID, '_itemCode', true);
230 -$itemName = get_post_meta($post_ID, '_itemName', true);
231 -$itemRestriction = get_post_meta($post_ID, '_itemRestriction', true);
232 -$itemPointrate = get_post_meta($post_ID, '_itemPointrate', true);
233 -$itemGpNum1 = get_post_meta($post_ID, '_itemGpNum1', true);
234 -$itemGpNum2 = get_post_meta($post_ID, '_itemGpNum2', true);
235 -$itemGpNum3 = get_post_meta($post_ID, '_itemGpNum3', true);
236 -$itemGpDis1 = get_post_meta($post_ID, '_itemGpDis1', true);
237 -$itemGpDis2 = get_post_meta($post_ID, '_itemGpDis2', true);
238 -$itemGpDis3 = get_post_meta($post_ID, '_itemGpDis3', true);
239 -
240 -$itemShipping = get_post_meta($post_ID, '_itemShipping', true);
241 -$itemDeliveryMethod = get_post_meta($post_ID, '_itemDeliveryMethod', true);
242 -$itemShippingCharge = get_post_meta($post_ID, '_itemShippingCharge', true);
243 -$itemIndividualSCharge = get_post_meta($post_ID, '_itemIndividualSCharge', true);
244 -/*************************************** 30 */
245 -?>
246 -
247 -<?php wp_nonce_field($nonce_action); ?>
248 -<input type="hidden" name="usces_nonce" id="usces_nonce" value="<?php echo wp_create_nonce( 'usc-e-shop' ); ?>" />
249 -<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
250 -<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" />
251 -<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
252 -<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
253 -<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" />
254 -<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
255 -<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url(stripslashes(wp_get_referer())); ?>" />
256 -
257 -<input type="hidden" name="post_mime_type" value="item" />
258 -<input type="hidden" name="page" value="usces_itemedit" />
259 -<input name="usces_referer" type="hidden" id="usces_referer" value="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>" />
260 -
261 -<?php
262 -if ( isset($post->post_status) && 'draft' != $post->post_status )
263 - wp_original_referer_field(true, 'previous');
264 -
265 -echo $form_extra;
266 -
267 -wp_nonce_field( 'autosave', 'autosavenonce', false );
268 -wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
269 -wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
270 -?>
271 -
272 -<div id="refbutton"><a href="<?php echo USCES_ADMIN_URL . '?page=usces_itemedit&amp;action=duplicate&amp;post='.$post->ID.'&usces_referer='.(isset($_REQUEST['usces_referer']) ? urlencode($_REQUEST['usces_referer']) : ''); ?>">[<?php _e('make a copy', 'usces'); ?>]</a> <a href="<?php if(isset($_REQUEST['usces_referer'])) echo $_REQUEST['usces_referer']; ?>">[<?php _e('back to item list', 'usces'); ?>]</a></div>
273 -<!--<div id="poststuff" class="metabox-holder has-right-sidebar">-->
274 -<div id="poststuff">
275 -<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
276 -<div id="post-body-content">
277 -
278 -
279 -
280 -
281 -<!--<div id="postitemcustomstuff">-->
282 -<div id="meta_box_product_first_box" class="postbox " >
283 -<div class="inside">
284 -<table class="iteminfo_table">
285 -<tr>
286 -<th><?php _e('item code', 'usces'); ?></th>
287 -<td><input type="text" name="itemCode" id="itemCode" class="itemCode" value="<?php echo esc_attr($itemCode); ?>" />
288 -<input type="hidden" name="itemCode_nonce" id="itemCode_nonce" value="<?php echo wp_create_nonce( 'itemCode_nonce' ); ?>" /></td>
289 -</tr>
290 -<tr>
291 -<th><?php _e('item name', 'usces'); ?></th>
292 -<td><input type="text" name="itemName" id="itemName" class="itemName" value="<?php echo esc_attr($itemName); ?>" />
293 -<input type="hidden" name="itemName_nonce" id="itemName_nonce" value="<?php echo wp_create_nonce( 'itemName_nonce' ); ?>" /></td>
294 -</tr>
295 -<tr>
296 -<th><?php _e('Limited amount for purchase', 'usces'); ?></th>
297 -<td><?php printf(__('limit by%s%s%s', 'usces'), '<input type="text" name="itemRestriction" id="itemRestriction" class="itemRestriction" value="', esc_attr($itemRestriction), '" />'); ?>
298 -<input type="hidden" name="itemRestriction_nonce" id="itemRestriction_nonce" value="<?php echo wp_create_nonce( 'itemRestriction_nonce' ); ?>" /></td>
299 -</tr>
300 -<tr>
301 -<th><?php _e('Percentage of points', 'usces'); ?></th>
302 -<td><input type="text" name="itemPointrate" id="itemPointrate" class="itemPointrate" value="<?php echo esc_attr($itemPointrate); ?>" />%<em>(<?php _e('Integer', 'usces'); ?>)</em>
303 -<input type="hidden" name="itemPointrate_nonce" id="itemPointrate_nonce" value="<?php echo wp_create_nonce( 'itemPointrate_nonce' ); ?>" /></td>
304 -</tr>
305 -<tr>
306 -<?php
307 -$gp_row = '<th rowspan="3">' . __('Business package discount', 'usces') . '</th>
308 -<td>1.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum1', '" id="', 'itemGpNum1', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum1), '" />') . '<input type="text" name="itemGpDis1" id="itemGpDis1" class="itemPointrate" value="' . esc_attr($itemGpDis1) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td>
309 -</tr>
310 -<tr>
311 -<td>2.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum2', '" id="', 'itemGpNum2', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum2), '" />') . '<input type="text" name="itemGpDis2" id="itemGpDis2" class="itemPointrate" value="' . esc_attr($itemGpDis2) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td>
312 -</tr>
313 -<tr>
314 -<td>3.' . sprintf(__('in more than%s%s%s%s%s %s%s%s,', 'usces'), '<input type="text" name="', 'itemGpNum3', '" id="', 'itemGpNum3', '" class="itemPointrate"', 'value="', esc_attr($itemGpNum3), '" />') . '<input type="text" name="itemGpDis3" id="itemGpDis3" class="itemPointrate" value="' . esc_attr($itemGpDis3) . '" />' . __('%discount','usces') . '(' . __('Unit price','usces') . ')</td>
315 -</tr>';
316 -?>
317 -<?php echo apply_filters('usces_item_master_gp_row', $gp_row, $post_ID); ?>
318 -<?php apply_filters('usces_item_master_first_section', NULL, $post_ID); ?>
319 -</table>
320 -</div>
321 -</div>
322 -<?php do_action('usces_after_item_master_first_section', $post_ID); ?>
323 -<!--<div id="postitemcustomstuff">-->
324 -<div id="meta_box_product_second_box" class="postbox " >
325 -<div class="inside">
326 -<table class="iteminfo_table">
327 -<?php
328 -$second_section = '<tr class="shipped">
329 -<th>' . __('estimated shipping date', 'usces') . '</th>
330 -<td><select name="itemShipping" id="itemShipping" class="itemShipping">';
331 -foreach( (array)$this->shipping_rule as $key => $label){
332 - $selected = $key == $itemShipping ? ' selected="selected"' : '';
333 - $second_section .= '<option value="' . esc_attr($key) . '"' . $selected . '>' . esc_html($label) . '</option>';
334 -}
335 -$second_section .= '</select>
336 -<input type="hidden" name="itemShipping_nonce" id="itemShipping_nonce" value="' . wp_create_nonce( 'itemShipping_nonce' ) . '" /></td>
337 -</tr>
338 -<tr class="shipped">
339 -<th>' . __('shipping option','usces') . '</th>
340 -<td>';
341 -$delivery_methods = $this->options['delivery_method'];
342 -if( count($delivery_methods) === 0 ){
343 - $second_section .= __('* Please register an item, after you finished delivery setting!','usces');
344 -}else{
345 - foreach( $delivery_methods as $deli){
346 - $second_section .= '<label for="itemDeliveryMethod[' . $deli['id'] . ']"><input name="itemDeliveryMethod[' . $deli['id'] . ']" id="itemDeliveryMethod[' . $deli['id'] . ']" type="checkbox" value="' . esc_attr($deli['id']) . '"';
347 - if(in_array($deli['id'], (array)$itemDeliveryMethod)) {
348 - $second_section .= ' checked="checked"';
349 - }
350 - $second_section .= ' />' . esc_html($deli['name']) . '</label>';
351 - }
352 -}
353 -$second_section .= '</td>
354 -</tr>
355 -<tr class="shipped">
356 -<th>' . __('Shipping', 'usces') . '</th>
357 -<td><select name="itemShippingCharge" id="itemShippingCharge" class="itemShippingCharge">';
358 -foreach( $this->options['shipping_charge'] as $cahrge){
359 - $selected = $cahrge['id'] == $itemShippingCharge ? ' selected="selected"' : '';
360 - $second_section .= '<option value="' . $cahrge['id'] . '"' . $selected . '>' . esc_html($cahrge['name']) . '</option>';
361 -}
362 -$second_section .= '</select>
363 -<input type="hidden" name="itemShippingCharge_nonce" id="itemShippingCharge_nonce" value="' . wp_create_nonce( 'itemShippingCharge_nonce' ) . '" /></td>
364 -</tr>
365 -<tr class="shipped">
366 -<th>' . __('Postage individual charging', 'usces') . '</th>
367 -<td><input name="itemIndividualSCharge" id="itemIndividualSCharge" type="checkbox" value="1"';
368 -if($itemIndividualSCharge){
369 - $second_section .= ' checked="checked"';
370 -}
371 -$second_section .= ' /></td>
372 -</tr>';
373 -$second_section = apply_filters('usces_item_master_second_section', $second_section, $post_ID);
374 -echo $second_section;
375 -?>
376 -</table>
377 -</div>
378 -</div>
379 -<?php do_action('usces_after_item_master_second_section', $post_ID); ?>
380 -
381 -<div id="itemsku" class="postbox">
382 -<h3 class="hndle"><span>SKU <?php _e('Price', 'usces'); ?></span></h3>
383 -<div class="inside">
384 - <div id="postskucustomstuff" class="skustuff">
385 -<?php
386 -//$metadata = has_item_sku_meta($post->ID);
387 -//list_item_sku_meta($metadata);
388 -//item_sku_meta_form();
389 -$skus = $usces->get_skus($post->ID);
390 -list_item_sku_meta($skus);
391 -item_sku_meta_form();
392 -
393 -?>
394 - </div>
395 -</div>
396 -</div>
397 -<?php do_action('usces_after_item_master_sku_section', $post_ID); ?>
398 -<div id="itemoption" class="postbox">
399 -<h3 class="hndle"><span><?php _e('options for items', 'usces'); ?></span></h3>
400 -<div class="inside">
401 -<div id="postoptcustomstuff"><div id="optajax-response"></div>
402 -<?php
403 -//$metadata = has_item_option_meta($post->ID);
404 -//list_item_option_meta($metadata);
405 -//item_option_meta_form();
406 -$opts = usces_get_opts($post->ID);
407 -list_item_option_meta($opts);
408 -item_option_meta_form();
409 -?>
410 -</div>
411 -</div>
412 -</div>
413 -<?php do_action('usces_after_item_master_option_section', $post_ID); ?>
414 -
415 -<div class="postbox">
416 -<?php if ( post_type_supports($post_type, 'title') ) { ?>
417 -<div class="inside">
418 -<div class="itempagetitle"><?php _e("The product details page title", "usces"); ?></div>
419 -<div id="titlediv">
420 - <div id="titlewrap">
421 - <label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php _e('Enter title here') ?></label>
422 - <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( htmlspecialchars( $post->post_title ) ); ?>" id="title" autocomplete="off" />
423 - </div>
424 -<?php
425 -$sample_permalink_html = get_sample_permalink_html($post->ID);
426 -$shortlink = wp_get_shortlink($post->ID, 'post');
427 -if ( !empty($shortlink) )
428 - $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
429 -
430 -if ( !( 'pending' == $post->post_status && !current_user_can( $post_type_object->cap->publish_posts ) ) ) { ?>
431 - <div id="edit-slug-box">
432 - <?php
433 - if ( ! empty($post->ID) && ! empty($sample_permalink_html) && 'auto-draft' != $post->post_status )
434 - echo $sample_permalink_html;
435 - ?>
436 - </div>
437 -<?php
438 -}
439 -?>
440 -</div>
441 -<?php
442 -wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
443 -?>
444 -<?php } ?>
445 -<?php if ( post_type_supports($post_type, 'editor') ) { ?>
446 -<div class="itempagetitle"><?php _e("Full product details", "usces"); ?></div>
447 -<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
448 -
449 -<style type="text/css">
450 -<!--
451 -.wp_themeSkin table td {
452 - background-color: white;
453 -}
454 -</style>
455 -<?php
456 - if ( version_compare($wp_version, '3.3-beta', '>') ){
457 - wp_editor($post->post_content, 'content', array('dfw' => true, 'tabindex' => 1) );
458 - }else{
459 - the_editor($post->post_content);
460 - }
461 -?>
462 -
463 -<table id="post-status-info" cellspacing="0"><tbody><tr>
464 - <td id="wp-word-count"></td>
465 - <td class="autosave-info">
466 - <span id="autosave">&nbsp;</span>
467 -<?php
468 - if ( 'auto-draft' != $post->post_status ) {
469 - echo '<span id="last-edit">';
470 - if ( $last_id = get_post_meta($post_ID, '_edit_last', true) ) {
471 - $last_user = get_userdata($last_id);
472 - printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html( $last_user->display_name ), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
473 - } else {
474 - if( isset($post->post_modified) )
475 - printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified));
476 - }
477 - echo '</span>';
478 - } ?>
479 - </td>
480 -</tr></tbody></table>
481 -
482 -</div>
483 -
484 -<?php
485 -}
486 -?>
487 -</div>
488 -</div>
489 -
490 -<?php
491 -//do_meta_boxes($post_type, 'normal', $post);
492 -//
493 -//( 'page' == $post_type ) ? do_action('edit_page_form') : do_action('edit_form_advanced');
494 -//
495 -//do_meta_boxes($post_type, 'advanced', $post);
496 -//
497 -//do_action('dbx_post_sidebar'); ?>
498 -
499 -</div>
500 -
501 -
502 -
503 -
504 -
505 -
506 -
507 -
508 -
509 -
510 -<div id="postbox-container-1" class="postbox-container">
511 -<div id="side-info-column" class="inner-sidebar">
512 -<div id="item-main-pict"></div>
513 -</div>
514 -
515 -<?php
516 -
517 -if ( 'page' == $post_type )
518 - do_action('submitpage_box');
519 -else
520 - do_action('submitpost_box');
521 -
522 -do_meta_boxes($post_type, 'side', $post);
523 -
524 -?>
525 -</div>
526 -<div id="postbox-container-2" class="postbox-container">
527 -<?php
528 -
529 -do_meta_boxes(null, 'normal', $post);
530 -
531 -if ( 'page' == $post_type )
532 - do_action('edit_page_form');
533 -else
534 - do_action('edit_form_advanced');
535 -
536 -do_meta_boxes(null, 'advanced', $post);
537 -
538 -?>
539 -</div>
540 -<?php
541 -
542 -do_action('dbx_post_sidebar');
543 -
544 -?>
545 -
546 -</div>
547 -
548 -<br class="clear" />
549 -</div><!-- /poststuff -->
550 -</form>
551 -</div>
552 -
553 -<?php wp_comment_reply(); ?>
554 -
555 -<?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
556 -<script type="text/javascript">
557 -try{document.post.itemCode.focus();}catch(e){}
558 -try{
559 - var dfo = document.post;
560 - if(dfo.itemRestriction.value == '') dfo.itemRestriction.value = uscesL10n.purchase_limit;
561 - if(dfo.itemPointrate.value == '') dfo.itemPointrate.value = uscesL10n.point_rate;
562 - if(dfo.itemShipping.selectedIndex == '0') dfo.itemShipping.selectedIndex = uscesL10n.shipping_rule;
563 -}catch(e){}
564 -
565 -jQuery(document).ready(function($){
566 - $("#in-category-"+<?php echo USCES_ITEM_CAT_PARENT_ID; ?>).attr({checked: "checked"});
567 -
568 -// $('#itemCode').blur(
569 -// function() {
570 -// if ( $("#itemCode").val().length == 0 ) return;
571 -// uscesItem.newdraft($('#itemCode').val());
572 -// });
573 -});
574 -</script>
575 -<?php endif; ?>
1 +<?php
2 +/**
3 + * Post advanced form for inclusion in the administration panels.
4 + *
5 + * @package WordPress
6 + * @subpackage Administration
7 + */
8 +
9 +// Don't load directly.
10 +if ( ! defined( 'ABSPATH' ) ) {
11 + die( '-1' );
12 +}
13 +global $usces;
14 +
15 +/**
16 + * Post ID global
17 + * @name $post_ID
18 + * @var int
19 + */
20 +$post_ID = isset( $post_ID ) ? (int) $post_ID : 0;
21 +$temp_ID = isset( $temp_ID ) ? (int) $temp_ID : 0;
22 +$user_ID = isset( $user_ID ) ? (int) $user_ID : 0;
23 +$action = isset( $action ) ? $action : '';
24 +$messages = array();
25 +$messages['post'] = array(
26 + 0 => '', // Unused. Messages start at index 1.
27 + 1 => sprintf( __( 'Post updated. <a href="%s">View post</a>' ), esc_url( get_permalink( $post_ID ) ) ),
28 + 2 => __( 'Custom field updated.' ),
29 + 3 => __( 'Custom field deleted.' ),
30 + 4 => __( 'Post updated.' ),
31 + /* translators: %s: Date and time of the revision. */
32 + 5 => isset( $_GET['revision'] ) ? sprintf( __( 'Post restored to revision from %s' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
33 + 6 => sprintf( __( 'Post published. <a href="%s">View post</a>' ), esc_url( get_permalink( $post_ID ) ) ),
34 + 7 => __( 'Post saved.' ),
35 + 8 => sprintf( __( 'Post submitted. <a target="_blank" href="%s">Preview post</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
36 + 9 => sprintf( __( 'Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview post</a>' ),
37 + /* translators: Publish box date format, see http://php.net/date */
38 + ( isset( $post->post_date ) ? date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) : '' ), esc_url( get_permalink( $post_ID ) ) ),
39 + 10 => sprintf( __( 'Post draft updated. <a target="_blank" href="%s">Preview post</a>' ), esc_url( add_query_arg( 'preview', 'true', get_permalink( $post_ID ) ) ) ),
40 +);
41 +$messages = apply_filters( 'post_updated_messages', $messages );
42 +
43 +$message = false;
44 +if ( isset( $_GET['message'] ) ) {
45 + $_GET['message'] = absint( $_GET['message'] );
46 + if ( isset( $messages[ $post_type ][ $_GET['message'] ] ) ) {
47 + $message = $messages[ $post_type ][ $_GET['message'] ];
48 + } elseif ( ! isset( $messages[ $post_type ] ) && isset( $messages['post'][ $_GET['message'] ] ) ) {
49 + $message = $messages['post'][ $_GET['message'] ];
50 + }
51 +}
52 +
53 +$notice = false;
54 +$form_extra = '';
55 +if ( isset( $post->post_status ) && 'auto-draft' === $post->post_status ) {
56 + if ( 'edit' === $action ) {
57 + $post->post_title = '';
58 + }
59 + $autosave = false;
60 + $form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
61 +} else {
62 + $autosave = wp_get_post_autosave( $post_ID );
63 +}
64 +
65 +$form_action = 'editpost';
66 +$nonce_action = 'update-' . $post_type . '_' . $post_ID;
67 +$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post_ID ) . "' />";
68 +
69 +// Detect if there exists an autosave newer than the post and if that autosave is different than the post.
70 +if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
71 + foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
72 + if ( normalize_whitespace( $autosave->$autosave_field ) !== normalize_whitespace( $post->$autosave_field ) ) {
73 + $notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
74 + break;
75 + }
76 + }
77 + unset( $autosave_field, $_autosave_field );
78 +}
79 +
80 +$post_type_object = get_post_type_object( $post_type );
81 +
82 +// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
83 +
84 +/****************************************************************************/
85 +
86 +do_action( 'add_meta_boxes', $post_type, $post );
87 +do_action( 'add_meta_boxes_' . $post_type, $post );
88 +
89 +do_action( 'do_meta_boxes', $post_type, 'normal', $post );
90 +do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
91 +do_action( 'do_meta_boxes', $post_type, 'side', $post );
92 +
93 +/* 30 ***************************************/
94 +
95 +global $screen_layout_columns;
96 +?>
97 +<div class="wrap">
98 +<div class="usces_admin">
99 +<h1><?php echo esc_html( $title ); ?></h1>
100 +<?php usces_admin_action_status(); ?>
101 +<?php wp_nonce_field( 'admin_setup', 'wc_nonce' ); ?>
102 +
103 +<form name="post" action="" method="post" id="post">
104 +<?php
105 +$wel_item = new Welcart\ItemData();
106 +$item_format = $wel_item->get_item_format();
107 +$product = wel_get_product( $post_ID, false );
108 +$product = array_merge( $item_format, is_array( $product ) ? $product : array() );
109 +$itemCode = $product['itemCode'];
110 +$itemName = $product['itemName'];
111 +$itemRestriction = $product['itemRestriction'];
112 +$itemPointrate = ( ! empty( $product['itemPointrate'] ) ) ? $product['itemPointrate'] : '';
113 +$itemGpNum1 = $product['itemGpNum1'];
114 +$itemGpNum2 = $product['itemGpNum2'];
115 +$itemGpNum3 = $product['itemGpNum3'];
116 +$itemGpDis1 = $product['itemGpDis1'];
117 +$itemGpDis2 = $product['itemGpDis2'];
118 +$itemGpDis3 = $product['itemGpDis3'];
119 +
120 +$itemOrderAcceptable = $product['itemOrderAcceptable'];
121 +$itemOrderAcceptable_checked = ( ! empty( $itemOrderAcceptable ) && 1 === (int) $itemOrderAcceptable ) ? ' checked="checked"' : '';
122 +
123 +$itemShipping = $product['itemShipping'];
124 +$itemDeliveryMethod = $product['itemDeliveryMethod'];
125 +$itemShippingCharge = $product['itemShippingCharge'];
126 +$itemIndividualSCharge = $product['itemIndividualSCharge'];
127 +/*************************************** 30 */
128 +$usces_referer = ( isset( $_REQUEST['usces_referer'] ) ) ? $_REQUEST['usces_referer'] : '';
129 +?>
130 +
131 +<?php wp_nonce_field( $nonce_action ); ?>
132 +<input type="hidden" name="usces_nonce" id="usces_nonce" value="<?php echo wp_create_nonce( 'usc-e-shop' ); ?>" />
133 +<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID; ?>" />
134 +<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" />
135 +<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
136 +<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
137 +<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
138 +<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
139 +<input type="hidden" id="referredby" name="referredby" value="<?php echo esc_url( stripslashes( wp_get_referer() ) ); ?>" />
140 +
141 +<input type="hidden" name="post_mime_type" value="item" />
142 +<input type="hidden" name="page" value="usces_itemedit" />
143 +<input name="usces_referer" type="hidden" id="usces_referer" value="<?php echo esc_url( $usces_referer ); ?>" />
144 +
145 +<?php
146 +if ( isset( $post->post_status ) && 'draft' !== $post->post_status ) {
147 + wp_original_referer_field( true, 'previous' );
148 +}
149 +wel_esc_script_e( $form_extra );
150 +
151 +wp_nonce_field( 'autosave', 'autosavenonce', false );
152 +wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
153 +wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
154 +
155 +$nonce_action = 'duplicate_post_' . $post->ID; // アクション名を特定の投稿に紐付ける
156 +$url = esc_url( USCES_ADMIN_URL ) . '?page=usces_itemedit&action=duplicate&post=' . $post->ID . '&usces_referer=' . urlencode( esc_url( $usces_referer ) );
157 +$nonce_url = wp_nonce_url( $url, $nonce_action );
158 +?>
159 +<div id="refbutton"><a href="<?php echo esc_url( $nonce_url ); ?>">[<?php esc_html_e( 'make a copy', 'usces' ); ?>]</a> <a href="<?php echo esc_url( $usces_referer ); ?>">[<?php esc_html_e( 'back to item list', 'usces' ); ?>]</a></div>
160 +<!--<div id="poststuff" class="metabox-holder has-right-sidebar">-->
161 +<div id="poststuff">
162 +<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
163 +<div id="post-body-content">
164 +
165 +<!--<div id="postitemcustomstuff">-->
166 +<div id="meta_box_product_first_box" class="postbox " >
167 +<div class="inside">
168 +<table class="iteminfo_table">
169 +<?php ob_start(); ?>
170 +<tr>
171 +<th><?php esc_html_e( 'item code', 'usces' ); ?></th>
172 +<td><input type="text" name="itemCode" id="itemCode" class="itemCode" value="<?php echo esc_attr( $itemCode ); ?>" onkeydown="if (event.keyCode == 13) {return false;}" />
173 +<input type="hidden" name="itemCode_nonce" id="itemCode_nonce" value="<?php echo wp_create_nonce( 'itemCode_nonce' ); ?>" /></td>
174 +</tr>
175 +<tr>
176 +<th><?php esc_html_e( 'item name', 'usces' ); ?></th>
177 +<td><input type="text" name="itemName" id="itemName" class="itemName" value="<?php echo esc_attr( $itemName ); ?>" />
178 +<input type="hidden" name="itemName_nonce" id="itemName_nonce" value="<?php echo wp_create_nonce( 'itemName_nonce' ); ?>" /></td>
179 +</tr>
180 +<tr>
181 +<th><?php esc_html_e( 'Limited amount for purchase', 'usces' ); ?></th>
182 +<td><?php printf( __( 'limit by%s%s%s', 'usces' ), '<input type="text" name="itemRestriction" id="itemRestriction" class="itemRestriction" value="', esc_attr( $itemRestriction ), '" />' ); ?>
183 +<input type="hidden" name="itemRestriction_nonce" id="itemRestriction_nonce" value="<?php echo wp_create_nonce( 'itemRestriction_nonce' ); ?>" /></td>
184 +</tr>
185 +<tr>
186 +<th><?php esc_html_e( 'Percentage of points', 'usces' ); ?></th>
187 +<td><input type="text" name="itemPointrate" id="itemPointrate" class="itemPointrate" value="<?php echo esc_attr( $itemPointrate ); ?>" />%<em>(<?php esc_html_e( 'Integer', 'usces' ); ?>)</em>
188 +<input type="hidden" name="itemPointrate_nonce" id="itemPointrate_nonce" value="<?php echo wp_create_nonce( 'itemPointrate_nonce' ); ?>" /></td>
189 +</tr>
190 +<tr>
191 +<?php
192 +$gp_row = '<th rowspan="3">' . __( 'Business package discount', 'usces' ) . '</th>
193 +<td>1.' . sprintf( __( 'in more than%s%s%s%s%s %s%s%s,', 'usces' ), '<input type="text" name="', 'itemGpNum1', '" id="', 'itemGpNum1', '" class="itemPointrate"', 'value="', esc_attr( $itemGpNum1 ), '" />') . '<input type="text" name="itemGpDis1" id="itemGpDis1" class="itemPointrate" value="' . esc_attr( $itemGpDis1 ) . '" />' . __( '%discount', 'usces' ) . '(' . __( 'Unit price', 'usces' ) . ')</td>
194 +</tr>
195 +<tr>
196 +<td>2.' . sprintf( __( 'in more than%s%s%s%s%s %s%s%s,', 'usces' ), '<input type="text" name="', 'itemGpNum2', '" id="', 'itemGpNum2', '" class="itemPointrate"', 'value="', esc_attr( $itemGpNum2 ), '" />') . '<input type="text" name="itemGpDis2" id="itemGpDis2" class="itemPointrate" value="' . esc_attr( $itemGpDis2 ) . '" />' . __( '%discount', 'usces' ) . '(' . __( 'Unit price', 'usces' ) . ')</td>
197 +</tr>
198 +<tr>
199 +<td>3.' . sprintf( __( 'in more than%s%s%s%s%s %s%s%s,', 'usces' ), '<input type="text" name="', 'itemGpNum3', '" id="', 'itemGpNum3', '" class="itemPointrate"', 'value="', esc_attr( $itemGpNum3 ), '" />') . '<input type="text" name="itemGpDis3" id="itemGpDis3" class="itemPointrate" value="' . esc_attr( $itemGpDis3 ) . '" />' . __( '%discount', 'usces' ) . '(' . __( 'Unit price', 'usces' ) . ')</td>
200 +</tr>';
201 +echo apply_filters( 'usces_item_master_gp_row', $gp_row, $post_ID );
202 +?>
203 +<tr>
204 +<th><?php esc_html_e( 'Purchase restriction when sold out', 'usces' ); ?></th>
205 +<td><label type="itemOrderAcceptable"><input name="itemOrderAcceptable" type="checkbox" id="itemOrderAcceptable" class="itemOrderAcceptable" value="1"<?php echo esc_attr( $itemOrderAcceptable_checked ); ?>/><?php esc_html_e( 'Purchase is not restricted (not checked the stock) even when sold out.', 'usces' ); ?></label></td>
206 +<input type="hidden" name="itemOrderAcceptable_nonce" id="itemOrderAcceptable_nonce" value="<?php echo wp_create_nonce( 'itemOrderAcceptable_nonce' ); ?>" /></td>
207 +</tr>
208 +<?php apply_filters( 'usces_item_master_first_section', null, $post_ID ); ?>
209 +<?php
210 +$first_section = ob_get_contents();
211 +ob_end_clean();
212 +$first_section = apply_filters( 'usces_item_master_first_section_full', $first_section, $post_ID );
213 +echo $first_section; // no escape due to filter.
214 +?>
215 +</table>
216 +</div>
217 +</div>
218 +<?php do_action( 'usces_after_item_master_first_section', $post_ID ); ?>
219 +<!--<div id="postitemcustomstuff">-->
220 +<div id="meta_box_product_second_box" class="postbox " >
221 +<div class="inside">
222 +<table class="iteminfo_table">
223 +<?php
224 +$second_section = '<tr class="shipped">
225 +<th>' . __( 'estimated shipping date', 'usces' ) . '</th>
226 +<td><select name="itemShipping" id="itemShipping" class="itemShipping">';
227 +foreach ( (array) $this->shipping_rule as $key => $label ) {
228 + $selected = ( (int) $key === (int) $itemShipping ) ? ' selected="selected"' : '';
229 + $second_section .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $label ) . '</option>';
230 +}
231 +$second_section .= '</select>
232 +<input type="hidden" name="itemShipping_nonce" id="itemShipping_nonce" value="' . wp_create_nonce( 'itemShipping_nonce' ) . '" /></td>
233 +</tr>
234 +<tr class="shipped">
235 +<th>' . __( 'shipping option', 'usces' ) . '</th>
236 +<td>';
237 +$delivery_methods = ( isset( $this->options['delivery_method'] ) && is_array( $this->options['delivery_method'] ) ) ? $this->options['delivery_method'] : array();
238 +if ( count( $delivery_methods ) === 0 ) {
239 + $second_section .= __( '* Please register an item, after you finished delivery setting!', 'usces' );
240 +} else {
241 + foreach ( $delivery_methods as $deli ) {
242 + $second_section .= '<label for="itemDeliveryMethod[' . $deli['id'] . ']"><input name="itemDeliveryMethod[' . $deli['id'] . ']" id="itemDeliveryMethod[' . $deli['id'] . ']" type="checkbox" value="' . esc_attr( $deli['id'] ) . '"';
243 + if ( in_array( $deli['id'], (array) $itemDeliveryMethod ) ) {
244 + $second_section .= ' checked="checked"';
245 + }
246 + $second_section .= ' />' . esc_html( $deli['name'] ) . '</label>';
247 + }
248 +}
249 +$second_section .= '</td>
250 +</tr>
251 +<tr class="shipped">
252 +<th>' . __( 'Shipping', 'usces' ) . '</th>
253 +<td><select name="itemShippingCharge" id="itemShippingCharge" class="itemShippingCharge">';
254 +foreach ( $this->options['shipping_charge'] as $cahrge ) {
255 + $selected = ( (int) $cahrge['id'] === (int) $itemShippingCharge ) ? ' selected="selected"' : '';
256 + $second_section .= '<option value="' . $cahrge['id'] . '"' . $selected . '>' . esc_html( $cahrge['name'] ) . '</option>';
257 +}
258 +$second_section .= '</select>
259 +<input type="hidden" name="itemShippingCharge_nonce" id="itemShippingCharge_nonce" value="' . wp_create_nonce( 'itemShippingCharge_nonce' ) . '" /></td>
260 +</tr>
261 +<tr class="shipped">
262 +<th>' . __( 'Postage individual charging', 'usces' ) . '</th>
263 +<td><input name="itemIndividualSCharge" id="itemIndividualSCharge" type="checkbox" value="1"';
264 +if ( $itemIndividualSCharge ) {
265 + $second_section .= ' checked="checked"';
266 +}
267 +$second_section .= ' /></td>
268 +</tr>';
269 +$second_section = apply_filters( 'usces_item_master_second_section', $second_section, $post_ID );
270 +echo $second_section; // no escape due to filter.
271 +?>
272 +</table>
273 +</div>
274 +</div>
275 +<?php do_action( 'usces_after_item_master_second_section', $post_ID ); ?>
276 +
277 +<div id="itemsku" class="postbox">
278 +<h3><span>SKU <?php esc_html_e( 'Price', 'usces' ); ?></span></h3>
279 +<div class="inside">
280 + <div id="postskucustomstuff" class="skustuff">
281 + <?php
282 + //$skus = $usces->get_skus($post_ID);
283 + $skus = isset( $product['_sku'] ) ? $product['_sku'] : array();
284 + list_item_sku_meta( $skus );
285 + item_sku_meta_form();
286 + ?>
287 + </div>
288 +</div>
289 +</div>
290 +<?php do_action( 'usces_after_item_master_sku_section', $post_ID ); ?>
291 +<div id="itemoption" class="postbox">
292 +<h3><span><?php esc_html_e( 'options for items', 'usces' ); ?></span></h3>
293 +<div class="inside">
294 +<div id="postoptcustomstuff"><div id="optajax-response"></div>
295 +<?php
296 +//$opts = usces_get_opts($post_ID);
297 +$opts = isset( $product['_opt'] ) ? $product['_opt'] : array();
298 +list_item_option_meta( $opts );
299 +item_option_meta_form();
300 +?>
301 +</div>
302 +</div>
303 +</div>
304 +<?php do_action( 'usces_after_item_master_option_section', $post_ID ); ?>
305 +
306 +<div class="postbox">
307 +<?php if ( post_type_supports( $post_type, 'title' ) ) { ?>
308 +<div class="inside">
309 +<div class="itempagetitle"><?php esc_html_e( 'The product details page title', 'usces' ); ?></div>
310 +<div id="titlediv">
311 + <div id="titlewrap">
312 + <label class="hide-if-no-js" style="visibility:hidden" id="title-prompt-text" for="title"><?php esc_html_e( 'Enter title here' ); ?></label>
313 + <input type="text" name="post_title" size="30" tabindex="1" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" autocomplete="off" />
314 + </div>
315 + <?php
316 + $sample_permalink_html = get_sample_permalink_html( $post->ID );
317 + $shortlink = wp_get_shortlink( $post->ID, 'post' );
318 + if ( ! empty( $shortlink ) ) {
319 + $sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr( $shortlink ) . '" /><a href="#" class="button" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __( 'Get Shortlink' ) . '</a>';
320 + }
321 + if ( ! ( 'pending' === $post->post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
322 + ?>
323 + <div id="edit-slug-box">
324 + <?php
325 + if ( ! empty( $post->ID ) && ! empty( $sample_permalink_html ) && 'auto-draft' !== $post->post_status ) {
326 + wel_esc_script_e( $sample_permalink_html );
327 + }
328 + ?>
329 + </div>
330 + <?php
331 + }
332 + ?>
333 +</div>
334 + <?php
335 + wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
336 +}
337 +?>
338 +<?php if ( post_type_supports( $post_type, 'editor' ) ) { ?>
339 +<div class="itempagetitle"><?php esc_html_e( 'Full product details', 'usces' ); ?></div>
340 +<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
341 +
342 +<style type="text/css">
343 +<!--
344 +.wp_themeSkin table td {
345 + background-color: white;
346 +}
347 +-->
348 +</style>
349 + <?php
350 + // if ( version_compare( $wp_version, '3.3-beta', '>' ) ) {
351 + wp_editor( $post->post_content, 'content', array( 'dfw' => true, 'tabindex' => 1 ) );
352 + // } else {
353 + // the_editor( $post->post_content );
354 + // }
355 + ?>
356 +<table id="post-status-info" cellspacing="0"><tbody><tr>
357 + <td id="wp-word-count"></td>
358 + <td class="autosave-info">
359 + <span id="autosave">&nbsp;</span>
360 + <?php
361 + if ( 'auto-draft' !== $post->post_status ) {
362 + echo '<span id="last-edit">';
363 + $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) );
364 + if ( $last_user ) {
365 + /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */
366 + printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
367 + } else {
368 + if ( isset( $post->post_modified ) ) {
369 + /* translators: 1: Post edited date, 2: Post edited time. */
370 + printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
371 + }
372 + }
373 + echo '</span>';
374 + }
375 + ?>
376 + </td>
377 +</tr></tbody></table>
378 +
379 +</div>
380 + <?php
381 +}
382 +?>
383 +</div>
384 +</div>
385 +
386 +<?php
387 +do_action( 'edit_form_after_title', $post );
388 +?>
389 +
390 +</div>
391 +
392 +<div id="postbox-container-1" class="postbox-container">
393 +<div id="side-info-column" class="inner-sidebar">
394 +</div>
395 +
396 +<?php
397 +
398 +if ( 'page' === $post_type ) {
399 + do_action( 'submitpage_box' );
400 +} else {
401 + do_action( 'submitpost_box' );
402 +}
403 +do_meta_boxes( $post_type, 'side', $post );
404 +
405 +?>
406 +</div>
407 +<div id="postbox-container-2" class="postbox-container">
408 +<?php
409 +
410 +do_meta_boxes( null, 'normal', $post );
411 +
412 +if ( 'page' === $post_type ) {
413 + do_action( 'edit_page_form' );
414 +} else {
415 + do_action( 'edit_form_advanced' );
416 +}
417 +do_meta_boxes( null, 'advanced', $post );
418 +
419 +?>
420 +</div>
421 +<?php
422 +do_action( 'dbx_post_sidebar' );
423 +?>
424 +</div>
425 +
426 +<br class="clear" />
427 +</div><!-- /poststuff -->
428 +</form>
429 +</div><!-- /usces_admin -->
430 +</div><!-- /wrap -->
431 +
432 +<?php
433 +if ( post_type_supports( $post_type, 'comments' ) ) {
434 + wp_comment_reply();
435 +}
436 +?>
437 +
438 +<?php if ( ( isset( $post->post_title ) && '' === $post->post_title ) || ( isset( $_GET['message'] ) && 2 > $_GET['message'] ) ) : ?>
439 +<?php
440 +global $wp_version;
441 +$li_category_id = version_compare( $wp_version, '6.7', '>=' )
442 + ? '#category-all ul#categorychecklist input[type="checkbox"][id*="in-category-' . USCES_ITEM_CAT_PARENT_ID . '-"]'
443 + : '#in-category-' . USCES_ITEM_CAT_PARENT_ID;
444 +?>
445 +<script type="text/javascript">
446 +try{document.post.itemCode.focus();}catch(e){}
447 +try{
448 + var dfo = document.post;
449 + if(dfo.itemRestriction.value == '') dfo.itemRestriction.value = uscesL10n.purchase_limit;
450 + if(dfo.itemPointrate.value == '') dfo.itemPointrate.value = uscesL10n.point_rate;
451 + if(dfo.itemShipping.selectedIndex == '0') dfo.itemShipping.selectedIndex = uscesL10n.shipping_rule;
452 +}catch(e){}
453 +
454 +jQuery(document).ready(function($){
455 + $('<?php wel_esc_script_e( $li_category_id ); ?>').prop( "checked", true );
456 +});
457 +</script>
458 +<?php endif; ?>