| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPPIZZA_MODULE_SKU Class |
| 4 |
* |
| 5 |
* @package WPPIZZA |
| 6 |
* @subpackage WPPIZZA_MODULE_SKU |
| 7 |
* @copyright Copyright (c) 2015, Oliver Bach |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 3.0 |
| 10 |
* |
| 11 |
*/ |
| 12 |
if ( ! defined( 'ABSPATH' ) ) exit;/*Exit if accessed directly*/ |
| 13 |
|
| 14 |
|
| 15 |
/************************************************************************************************************************ |
| 16 |
* |
| 17 |
* |
| 18 |
* |
| 19 |
* |
| 20 |
* |
| 21 |
* |
| 22 |
************************************************************************************************************************/ |
| 23 |
class WPPIZZA_MODULE_SKU{ |
| 24 |
|
| 25 |
private $settings_page = 'settings';/* which admin subpage (identified there by this->class_key) are we adding this to */ |
| 26 |
|
| 27 |
|
| 28 |
private $layout_page = 'layout';/* which admin subpage (identified there by this->class_key) are we adding this to */ |
| 29 |
|
| 30 |
|
| 31 |
private $localization_page = 'localization';/* which admin subpage (identified there by this->class_key) are we adding this to */ |
| 32 |
private $localization_position = 'itemised-order';/* at which admin position (section) should this appear on above admin subpage, integer(zero indexed - for numeric position) or key ('layout-style' for example) after which it should appear*/ |
| 33 |
|
| 34 |
|
| 35 |
private $section_key = 'sku';/* must be unique */ |
| 36 |
|
| 37 |
|
| 38 |
function __construct() { |
| 39 |
/********************************************************** |
| 40 |
[add settings to admin] |
| 41 |
***********************************************************/ |
| 42 |
if(is_admin()){ |
| 43 |
/* add admin options settings page*/ |
| 44 |
add_filter('wppizza_filter_settings_sections_'.$this->settings_page.'', array($this, 'admin_options_settings'), 40, 5); |
| 45 |
/* add admin options settings page fields */ |
| 46 |
add_action('wppizza_admin_settings_section_fields_'.$this->settings_page.'', array($this, 'admin_options_fields_settings'), 10, 5); |
| 47 |
|
| 48 |
/* add admin options layout page*/ |
| 49 |
add_filter('wppizza_filter_settings_sections_'.$this->layout_page.'', array($this, 'admin_options_layout'), 40, 5); |
| 50 |
/* add admin options layout page fields */ |
| 51 |
add_action('wppizza_admin_settings_section_fields_'.$this->layout_page.'', array($this, 'admin_options_fields_layout'), 10, 5); |
| 52 |
|
| 53 |
/* add admin options localization page - does not need fields action*/ |
| 54 |
add_filter('wppizza_filter_settings_sections_'.$this->localization_page.'', array($this, 'admin_options_localization'), 40, 5); |
| 55 |
|
| 56 |
|
| 57 |
/** admin metaboxes skus per size **/ |
| 58 |
add_filter('wppizza_filter_admin_metaboxes', array( $this, 'add_admin_metaboxes'), 55, 4);/* 55 to add after sizes| pricetiers and before additives */ |
| 59 |
add_filter('wppizza_filter_admin_save_metaboxes',array( $this, 'save_admin_metaboxes'), 10, 3); |
| 60 |
add_filter('wppizza_ajax_action_admin_sizeschanged', array( $this, 'ajax_admin_sizeschanged'), 10, 2);/* change sku metaboxes on change of pricetier/sizes */ |
| 61 |
|
| 62 |
/**add default options **/ |
| 63 |
add_filter('wppizza_filter_setup_default_options', array( $this, 'options_default')); |
| 64 |
/**validate options**/ |
| 65 |
add_filter('wppizza_filter_options_validate', array( $this, 'options_validate'), 10, 2 ); |
| 66 |
} |
| 67 |
/********************************************************** |
| 68 |
[filter depending on settings] |
| 69 |
***********************************************************/ |
| 70 |
/**************************************************** |
| 71 |
* filter sku: loop post title and price/sizes labels |
| 72 |
*****************************************************/ |
| 73 |
add_filter('wppizza_filter_post_title', array( $this, 'post_title'),10,2);/** add sku's to titles in loop **/ |
| 74 |
add_filter('wppizza_filter_post_prices', array( $this, 'post_prices'),10,2);/** add sku's to sizes in loop **/ |
| 75 |
|
| 76 |
/**************************************************** |
| 77 |
* filter sku: add sku parameters to session menu items |
| 78 |
*****************************************************/ |
| 79 |
add_filter('wppizza_fltr_order_session', array( $this, 'order_session'),10);/** add sku's to session menu items **/ |
| 80 |
/**************************************************** |
| 81 |
* filter sku: add sku parameters to order menu items |
| 82 |
*****************************************************/ |
| 83 |
add_filter('wppizza_filter_order_details_formatted', array( $this, 'order_details_formatted'), 10, 2);/** add sku's to cart menu items **/ |
| 84 |
|
| 85 |
|
| 86 |
/**************************************************** |
| 87 |
* output sku: add sku's to cart menu items |
| 88 |
*****************************************************/ |
| 89 |
add_filter('wppizza_filter_cart_items_from_session', array( $this, 'cart_items')); |
| 90 |
/**************************************************** |
| 91 |
* output sku: add sku's to pages (order, confirmation , thank you, user order history ) if/as enabled |
| 92 |
*****************************************************/ |
| 93 |
add_filter('wppizza_filter_order_item_header_markup', array( $this, 'header_columns'),1000, 3);/** add sku label to header column. high priority to not fall founl of remove filter that removes everything in the cart display except the absolute essentials (to make things fit) **/ |
| 94 |
add_filter('wppizza_filter_order_item_columns', array( $this, 'item_columns'),1000, 8);/** add sku to item column. high priority to not fall founl of remove filter that removes everything in the cart display except the absolute essentials (to make things fit) **/ |
| 95 |
/**************************************************** |
| 96 |
* output sku: add sku's to email/print templates |
| 97 |
*****************************************************/ |
| 98 |
add_filter('wppizza_filter_itemised_order_columns', array( $this, 'columns_templates'),10, 3);/** add sku header column and value **/ |
| 99 |
/**************************************************** |
| 100 |
* filter sku: search widget. search for sku's too |
| 101 |
*****************************************************/ |
| 102 |
add_filter('wppizza_filter_search',array( $this, 'search_sku'));/*search for sku's too in meta data*/ |
| 103 |
|
| 104 |
} |
| 105 |
|
| 106 |
/******************************************************************************************************************************************************* |
| 107 |
* |
| 108 |
* |
| 109 |
* |
| 110 |
* [frontend filters] |
| 111 |
* |
| 112 |
* |
| 113 |
* |
| 114 |
********************************************************************************************************************************************************/ |
| 115 |
/*************************************************************************************************************************** |
| 116 |
* |
| 117 |
* |
| 118 |
* [SKU's] allow searching for sku's |
| 119 |
* |
| 120 |
* |
| 121 |
***************************************************************************************************************************/ |
| 122 |
function search_sku($query){ |
| 123 |
global $wppizza_options; |
| 124 |
if(!empty($wppizza_options[$this->settings_page]['sku_enable']) && !empty($wppizza_options[$this->settings_page]['sku_search']) ){ |
| 125 |
/**what did we search for*/ |
| 126 |
$queryVar=($query->query_vars['s']);/*searches - according to Otto - are case insensitive anyway. no need to cast things to lowercase*/ |
| 127 |
$queryLength=strlen($queryVar); |
| 128 |
|
| 129 |
/**search meta data for sku's*/ |
| 130 |
$args = array( |
| 131 |
'post_type'=>WPPIZZA_POST_TYPE, |
| 132 |
'meta_query' => array( |
| 133 |
array ( |
| 134 |
'key' => WPPIZZA_SLUG.'_sku', |
| 135 |
'value' => $queryVar, |
| 136 |
'compare' => '=' |
| 137 |
) |
| 138 |
) |
| 139 |
); |
| 140 |
|
| 141 |
/**allow partial sku search, using integer of constant to define minimum required string length. minimum 3*/ |
| 142 |
if(!empty($wppizza_options[$this->settings_page]['sku_search_partial'])){ |
| 143 |
/**minimum of 5 chars to do a partial search unless overridden by constant**/ |
| 144 |
$minQueryLength = $wppizza_options[$this->settings_page]['sku_search_length']; |
| 145 |
|
| 146 |
/**change comparisaon to LIKE if partial enabled and q str length>=$minQueryLength*/ |
| 147 |
if($queryLength >= $minQueryLength){ |
| 148 |
$args['meta_query'][0]['compare']='LIKE'; |
| 149 |
} |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
$sku_query = new WP_Query( $args ); |
| 154 |
/** |
| 155 |
if we have found posts with this sku, replace results to only show results with that sku |
| 156 |
by replacing s query and including post__in instead |
| 157 |
**/ |
| 158 |
if($sku_query->post_count>0){ |
| 159 |
$sku_post_in=array(); |
| 160 |
foreach($sku_query->posts as $key=>$post){ |
| 161 |
$sku_post_in[$post->ID]=$post->ID; |
| 162 |
} |
| 163 |
$query->set('s','');//set search query to '' as it would not find meta seraches*/ |
| 164 |
$query->set('post__in',$sku_post_in); |
| 165 |
|
| 166 |
/** |
| 167 |
as the search string (get_query_var( 's' )) "search for [x]" and searchbox prefill would normally be empty |
| 168 |
as we've unset it, use get_search_query filter to set to $_GET[s] |
| 169 |
**/ |
| 170 |
add_filter('get_search_query',array($this, 'set_search_query_sku')); |
| 171 |
} |
| 172 |
} |
| 173 |
|
| 174 |
return $query; |
| 175 |
} |
| 176 |
/******************************************************************** |
| 177 |
* set found SKU as search_query |
| 178 |
********************************************************************/ |
| 179 |
function set_search_query_sku($query_var){ |
| 180 |
$query_var=esc_html($_GET['s']); |
| 181 |
return $query_var; |
| 182 |
} |
| 183 |
|
| 184 |
/********************************************************************************** |
| 185 |
* columns templates (email/print) - header and value |
| 186 |
**********************************************************************************/ |
| 187 |
function columns_templates($columns, $txt, $type){ |
| 188 |
global $wppizza_options; |
| 189 |
/* skip if not enabled */ |
| 190 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || empty($wppizza_options[$this->layout_page]['sku_display'][$type])){ |
| 191 |
return $columns; |
| 192 |
} |
| 193 |
|
| 194 |
/** array to insert **/ |
| 195 |
$splice[$this->section_key] = array(); |
| 196 |
$splice[$this->section_key]['key'] = $this->section_key ; |
| 197 |
//$splice[$this->section_key]['tr_class'] = 'items' ;/* should always be items */ |
| 198 |
$splice[$this->section_key]['label'] = $txt['sku_label'] ; |
| 199 |
$splice[$this->section_key]['fields']= array(); |
| 200 |
$splice[$this->section_key]['fields'][]= $this->section_key; |
| 201 |
|
| 202 |
/** splice into header columns **/ |
| 203 |
$columns = wppizza_array_splice($columns, $splice, ($wppizza_options[$this->layout_page]['sku_display'][$type]-1)); |
| 204 |
|
| 205 |
|
| 206 |
return $columns; |
| 207 |
} |
| 208 |
/********************************************************************************** |
| 209 |
* header columns pages (order, confirmation , thank you, user order history ) |
| 210 |
**********************************************************************************/ |
| 211 |
function header_columns($markup_header, $txt, $type){ |
| 212 |
global $wppizza_options; |
| 213 |
/* skip if not enabled */ |
| 214 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || empty($wppizza_options[$this->layout_page]['sku_display'][$type])){ |
| 215 |
return $markup_header; |
| 216 |
} |
| 217 |
|
| 218 |
/** div to insert **/ |
| 219 |
$splice['thead_th_'.$this->section_key]= '<th class="'.WPPIZZA_SLUG.'-item-'.$this->section_key.'-th">'.$txt['sku_label'].'</th>';/* table cell */ |
| 220 |
/** |
| 221 |
splice into header columns |
| 222 |
as cart only has left and right |
| 223 |
set 0 or 1000 respectively |
| 224 |
currently not in use |
| 225 |
**/ |
| 226 |
//$position = 0 ; |
| 227 |
if($type == 'cart'){ |
| 228 |
$position = ($wppizza_options[$this->layout_page]['sku_display'][$type] == 'left') ? 0 : 10000; |
| 229 |
}else{ |
| 230 |
$position = ($wppizza_options[$this->layout_page]['sku_display'][$type]-1) ; |
| 231 |
} |
| 232 |
$markup_header = wppizza_array_splice($markup_header, $splice, $position); |
| 233 |
|
| 234 |
return $markup_header; |
| 235 |
} |
| 236 |
/********************************************************************************** |
| 237 |
* item columns pages (order, confirmation, thank you, user order history ) |
| 238 |
**********************************************************************************/ |
| 239 |
function item_columns($item_column, $key , $item, $cart, $item_count, $order_id, $txt, $type){ |
| 240 |
global $wppizza_options; |
| 241 |
/* |
| 242 |
skip if not enabled |
| 243 |
for the moment, skip for cart too |
| 244 |
*/ |
| 245 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || empty($wppizza_options[$this->layout_page]['sku_display'][$type]) || $type == 'cart' ){ |
| 246 |
return $item_column; |
| 247 |
} |
| 248 |
/** td to insert **/ |
| 249 |
$splice['item_td_'.$this->section_key]= '<td class="'.WPPIZZA_SLUG.'-item-'.$this->section_key.'">'.$item[$this->section_key].'</td>';/* table cell */ |
| 250 |
|
| 251 |
|
| 252 |
/** |
| 253 |
splice into header columns |
| 254 |
as cart only has left and right |
| 255 |
set 0 or 1000 respectively |
| 256 |
currently not in use |
| 257 |
**/ |
| 258 |
$position = 0 ; |
| 259 |
if($type == 'cart'){ |
| 260 |
$position = ($wppizza_options[$this->layout_page]['sku_display'][$type] == 'left') ? 0 : 10000; |
| 261 |
}else{ |
| 262 |
$position = ($wppizza_options[$this->layout_page]['sku_display'][$type]-1) ; |
| 263 |
} |
| 264 |
/** splice into item columns **/ |
| 265 |
$item_column = wppizza_array_splice($item_column, $splice, $position); |
| 266 |
|
| 267 |
return $item_column; |
| 268 |
} |
| 269 |
/********************************************************************************* |
| 270 |
* [adding SKU's to post title in loop as required] |
| 271 |
*********************************************************************************/ |
| 272 |
function post_title($post_title, $post_id){ |
| 273 |
global $wppizza_options; |
| 274 |
/* |
| 275 |
skip if not enabled |
| 276 |
for the moment, skip for cart too |
| 277 |
*/ |
| 278 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || empty($wppizza_options[$this->layout_page]['sku_display']['menu_listing_title']) ){ |
| 279 |
return $post_title; |
| 280 |
} |
| 281 |
|
| 282 |
/* get SKUs*/ |
| 283 |
$post_meta = get_post_meta($post_id, WPPIZZA_SLUG, true); |
| 284 |
/*check if we have a main title sku*/ |
| 285 |
$sku_menu_title=!empty($post_meta[$this->section_key][-1]) ? $post_meta[$this->section_key][-1] : false; |
| 286 |
/* if there's no main , get the first size if we can**/ |
| 287 |
if(!$sku_menu_title){ |
| 288 |
$sku_menu_title=!empty($post_meta[$this->section_key][0]) ? $post_meta[$this->section_key][0] : false; |
| 289 |
} |
| 290 |
|
| 291 |
/**apply if SKU !=''**/ |
| 292 |
if(!empty($sku_menu_title)){ |
| 293 |
$new_title=''; |
| 294 |
|
| 295 |
/*sku left*/ |
| 296 |
if($wppizza_options[$this->layout_page]['sku_display']['menu_listing_title']=='left'){ |
| 297 |
$new_title.='<span class="'.WPPIZZA_SLUG.'_'.$this->section_key.'_title">'.$sku_menu_title.'</span>'; |
| 298 |
} |
| 299 |
|
| 300 |
/*title*/ |
| 301 |
$new_title.=''.$post_title.''; |
| 302 |
|
| 303 |
/*sku right*/ |
| 304 |
if($wppizza_options[$this->layout_page]['sku_display']['menu_listing_title']=='right'){ |
| 305 |
$new_title.='<span class="'.WPPIZZA_SLUG.'_'.$this->section_key.'_title">'.$sku_menu_title.'</span>'; |
| 306 |
} |
| 307 |
|
| 308 |
return $new_title; |
| 309 |
} |
| 310 |
|
| 311 |
return $post_title; |
| 312 |
} |
| 313 |
/********************************************************************************* |
| 314 |
* [adding SKU's menu items sizes in loop as required] |
| 315 |
*********************************************************************************/ |
| 316 |
function post_prices($prices, $post_data){ |
| 317 |
global $wppizza_options; |
| 318 |
/* skip if not enabled */ |
| 319 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || empty($wppizza_options[$this->layout_page]['sku_display']['menu_listing_size']) ){ |
| 320 |
return $prices; |
| 321 |
} |
| 322 |
|
| 323 |
/* for convenience */ |
| 324 |
$sku_keys = !empty($post_data -> wppizza_data[$this->section_key]) ? $post_data -> wppizza_data[$this->section_key] : array(); |
| 325 |
|
| 326 |
/**add size label to meta and pre or append sku as required**/ |
| 327 |
foreach($prices as $size_key=>$size_values){ |
| 328 |
|
| 329 |
/*check if we have size sku*/ |
| 330 |
$size_sku=!empty($sku_keys[$size_key]) ? $sku_keys[$size_key] : false; |
| 331 |
/* if there's no size main , get the main sku**/ |
| 332 |
if(!$size_sku){ |
| 333 |
$size_sku=!empty($sku_keys[-1]) ? $sku_keys[-1] : false; |
| 334 |
} |
| 335 |
|
| 336 |
$prices[$size_key]['size']=''; |
| 337 |
/*prepend*/ |
| 338 |
if(!empty($size_sku) && $wppizza_options[$this->layout_page]['sku_display']['menu_listing_size']=='left'){ |
| 339 |
$prices[$size_key]['size'].='<span class="'.WPPIZZA_SLUG.'_sku">'.$size_sku.'</span>'; |
| 340 |
} |
| 341 |
|
| 342 |
/**show if not replaced by sqk provided there is one*/ |
| 343 |
if(empty($wppizza_options[$this->layout_page]['sku_replaces_size']) || empty($wppizza_options[$this->layout_page]['sku_display']['menu_listing_size']) || empty($size_sku)){ |
| 344 |
$prices[$size_key]['size'].=''.$size_values['size']; |
| 345 |
} |
| 346 |
|
| 347 |
/*append*/ |
| 348 |
if(!empty($size_sku) && $wppizza_options[$this->layout_page]['sku_display']['menu_listing_size']=='right'){ |
| 349 |
$prices[$size_key]['size'].='<span class="'.WPPIZZA_SLUG.'_sku">'.$size_sku.'</span>'; |
| 350 |
} |
| 351 |
} |
| 352 |
|
| 353 |
return $prices; |
| 354 |
} |
| 355 |
|
| 356 |
/********************************************************************************* |
| 357 |
* [adding SKU's to session data] |
| 358 |
*********************************************************************************/ |
| 359 |
function order_session($session){ |
| 360 |
global $wppizza_options; |
| 361 |
|
| 362 |
|
| 363 |
/* skip if not enabled */ |
| 364 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || !isset($session['items'])){ |
| 365 |
return $session; |
| 366 |
} |
| 367 |
|
| 368 |
/* loop through items, adding sku's */ |
| 369 |
foreach($session['items'] as $key=>$item){ |
| 370 |
/* get SKUs*/ |
| 371 |
$post_meta = get_post_meta($item['post_id'], WPPIZZA_SLUG, true); |
| 372 |
|
| 373 |
|
| 374 |
/*check if we have an sku for this size*/ |
| 375 |
$sku=!empty($post_meta[$this->section_key][$item['size']]) ? $post_meta[$this->section_key][$item['size']] : false; |
| 376 |
/* if there's no sku for this size , try to get main sku**/ |
| 377 |
if(!$sku){ |
| 378 |
$sku=!empty($post_meta[$this->section_key][-1]) ? $post_meta[$this->section_key][-1] : false; |
| 379 |
} |
| 380 |
/* add to session data */ |
| 381 |
$session['items'][$key][$this->section_key] = $sku; |
| 382 |
} |
| 383 |
|
| 384 |
return $session; |
| 385 |
} |
| 386 |
|
| 387 |
/********************************************************************************* |
| 388 |
* [adding SKU's to order data retrieved formatted from db] |
| 389 |
*********************************************************************************/ |
| 390 |
function order_details_formatted($order_details_formatted, $order_values){ |
| 391 |
global $wppizza_options; |
| 392 |
/* skip if not enabled */ |
| 393 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || !isset($order_values['items'])){ |
| 394 |
return $order_details_formatted; |
| 395 |
} |
| 396 |
|
| 397 |
/* loop through items, adding it's sku's */ |
| 398 |
$items = $order_values['items']; |
| 399 |
|
| 400 |
foreach($order_values['items'] as $key=>$item){ |
| 401 |
$order_details_formatted['sections']['order']['items'][$key][$this->section_key] = (!empty($item[$this->section_key]) ? $item[$this->section_key] : '' ); |
| 402 |
} |
| 403 |
|
| 404 |
return $order_details_formatted; |
| 405 |
} |
| 406 |
|
| 407 |
|
| 408 |
/********************************************************************************* |
| 409 |
* [replacing price label as appropriate with sku] |
| 410 |
*********************************************************************************/ |
| 411 |
function cart_items($items){ |
| 412 |
global $wppizza_options; |
| 413 |
/* skip if not enabled */ |
| 414 |
if(empty($wppizza_options[$this->settings_page]['sku_enable']) || !isset($items)){ |
| 415 |
return $items; |
| 416 |
} |
| 417 |
|
| 418 |
foreach($items as $item_key => $item){ |
| 419 |
|
| 420 |
|
| 421 |
$items[$item_key]['price_label']=''; |
| 422 |
/*prepend*/ |
| 423 |
if(!empty($item['sku']) && $wppizza_options[$this->layout_page]['sku_display']['cart']=='left'){ |
| 424 |
$items[$item_key]['price_label'].='<span class="'.WPPIZZA_SLUG.'_sku">'.$item['sku'].'</span>'; |
| 425 |
} |
| 426 |
|
| 427 |
/**show if not replaced by sku provided there is one*/ |
| 428 |
if(empty($wppizza_options[$this->layout_page]['sku_replaces_size']) || empty($wppizza_options[$this->layout_page]['sku_display']['cart']) || empty($item['sku'])){ |
| 429 |
$items[$item_key]['price_label'].=''.$item['price_label']; |
| 430 |
} |
| 431 |
|
| 432 |
/*append*/ |
| 433 |
if(!empty($item['sku']) && $wppizza_options[$this->layout_page]['sku_display']['cart']=='right'){ |
| 434 |
$items[$item_key]['price_label'].='<span class="'.WPPIZZA_SLUG.'_sku">'.$item['sku'].'</span>'; |
| 435 |
} |
| 436 |
|
| 437 |
} |
| 438 |
return $items; |
| 439 |
} |
| 440 |
|
| 441 |
/******************************************************************************************************************************************************* |
| 442 |
* |
| 443 |
* |
| 444 |
* |
| 445 |
* [add admin page options] |
| 446 |
* |
| 447 |
* |
| 448 |
* |
| 449 |
********************************************************************************************************************************************************/ |
| 450 |
/********************************************************* |
| 451 |
* |
| 452 |
* [add metaboxes] |
| 453 |
* @since 3.0 |
| 454 |
* |
| 455 |
*********************************************************/ |
| 456 |
function add_admin_metaboxes($meta_boxes, $meta_values, $meal_sizes, $wppizza_options){ |
| 457 |
/* skip if not enabled */ |
| 458 |
if(empty($wppizza_options[$this->settings_page]['sku_enable'])){ |
| 459 |
return $meta_boxes; |
| 460 |
} |
| 461 |
|
| 462 |
/* add sku meta boxes*/ |
| 463 |
$meta_boxes[$this->section_key]=''; |
| 464 |
$meta_boxes[$this->section_key].="<div class='".WPPIZZA_SLUG."_option_meta'>"; |
| 465 |
|
| 466 |
$meta_boxes[$this->section_key].="<label class='".WPPIZZA_SLUG."-meta-label'>".__('SKUs', 'wppizza-admin').": </label>"; |
| 467 |
|
| 468 |
/* sku item global */ |
| 469 |
$meta_boxes[$this->section_key].="<span class='".WPPIZZA_SLUG."_sku'>"; |
| 470 |
$val=!empty($meta_values[$this->section_key][-1]) ? $meta_values[$this->section_key][-1] : ''; |
| 471 |
$meta_boxes[$this->section_key].="".__('Menu Item','wppizza-admin').": <input name='".WPPIZZA_SLUG."[".$this->section_key."][-1]' size='10' type='text' value='".$val."' />"; |
| 472 |
$meta_boxes[$this->section_key].="</span>"; |
| 473 |
|
| 474 |
/* sku per size , wrapped in span to replace via ajax on size change*/ |
| 475 |
$meta_boxes[$this->section_key].="<span class='".WPPIZZA_SLUG."_".$this->section_key."_sizes'>"; |
| 476 |
foreach($meta_values['prices'] as $k=>$v){ |
| 477 |
$ident=$wppizza_options['sizes'][$meta_values['sizes']][$k]['lbl'] ; |
| 478 |
$val=!empty($meta_values[$this->section_key][$k]) ? $meta_values[$this->section_key][$k] : ''; |
| 479 |
$meta_boxes[$this->section_key].=" ".$ident.": <input name='".WPPIZZA_SLUG."[".$this->section_key."][".$k."]' size='5' type='text' value='".$val."' />"; |
| 480 |
} |
| 481 |
$meta_boxes[$this->section_key].="</span>"; |
| 482 |
|
| 483 |
$meta_boxes[$this->section_key].="</div>"; |
| 484 |
|
| 485 |
return $meta_boxes; |
| 486 |
} |
| 487 |
/********************************************************* |
| 488 |
* |
| 489 |
* [save metaboxes values] |
| 490 |
* @since 3.0 |
| 491 |
* |
| 492 |
*********************************************************/ |
| 493 |
function save_admin_metaboxes($item_meta, $item_id, $wppizza_options){ |
| 494 |
|
| 495 |
/* skip if not enabled */ |
| 496 |
if(empty($wppizza_options[$this->settings_page]['sku_enable'])){ |
| 497 |
return $item_meta; |
| 498 |
} |
| 499 |
|
| 500 |
//**save new sku array replacing all od values**// |
| 501 |
$item_meta[$this->section_key]=array(); |
| 502 |
|
| 503 |
if(isset($_POST[WPPIZZA_SLUG]['sku'])){ |
| 504 |
/*as we might have different number of sizes, delete all old single sku meta keys for this item first*/ |
| 505 |
delete_post_meta($item_id, WPPIZZA_SLUG.'_'.$this->section_key); |
| 506 |
|
| 507 |
/**insert/add/edit current**/ |
| 508 |
foreach($_POST[WPPIZZA_SLUG]['sku'] as $k=>$v){ |
| 509 |
/**add to main wppizza meta data as serialized array*/ |
| 510 |
$item_meta[$this->section_key][$k] = wppizza_validate_string($_POST[WPPIZZA_SLUG][$this->section_key][$k]); |
| 511 |
|
| 512 |
/**add individual sku keys if not empty. set to lowercase to make case insesitive searches*/ |
| 513 |
/*searches - according to Otto - are case insensitive. so no need to save as lowercase for example*/ |
| 514 |
if(!empty($item_meta[$this->section_key][$k])){ |
| 515 |
add_post_meta($item_id, WPPIZZA_SLUG.'_'.$this->section_key, $item_meta[$this->section_key][$k] ); |
| 516 |
} |
| 517 |
} |
| 518 |
} |
| 519 |
return $item_meta; |
| 520 |
} |
| 521 |
|
| 522 |
/********************************************************* |
| 523 |
* |
| 524 |
* [ajax change sku metaboxes on price tier (sizes) change] |
| 525 |
* @since 3.0 |
| 526 |
* |
| 527 |
*********************************************************/ |
| 528 |
function ajax_admin_sizeschanged($obj, $set_size_id){ |
| 529 |
global $wppizza_options; |
| 530 |
/* skip if not enabled */ |
| 531 |
if(empty($wppizza_options[$this->settings_page]['sku_enable'])){ |
| 532 |
return $obj; |
| 533 |
} |
| 534 |
|
| 535 |
/*only if sku enabled and only on post/metaboxes page*/ |
| 536 |
$sku=''; |
| 537 |
if(is_array($wppizza_options['sizes'][$set_size_id])){ |
| 538 |
foreach($wppizza_options['sizes'][$set_size_id] as $size_key=>$sizes){ |
| 539 |
$sku.=" ".$sizes['lbl'].": <input name='".WPPIZZA_SLUG."[".$this->section_key."][".$size_key."]' size='10' type='text' value='' />"; |
| 540 |
}} |
| 541 |
$obj['inp'][$this->section_key]=$sku; |
| 542 |
$obj['element'][$this->section_key]='.'.WPPIZZA_SLUG.'_'.$this->section_key.'_sizes';/**html element to empty and replace with new input boxes**/ |
| 543 |
|
| 544 |
return $obj; |
| 545 |
} |
| 546 |
|
| 547 |
/*------------------------------------------------------------------------------ |
| 548 |
# |
| 549 |
# |
| 550 |
# [settings page] |
| 551 |
# |
| 552 |
# |
| 553 |
------------------------------------------------------------------------------*/ |
| 554 |
/**************************************************************** |
| 555 |
* [settigs section - setting page] |
| 556 |
* @since 3.0 |
| 557 |
* @return array() |
| 558 |
****************************************************************/ |
| 559 |
function admin_options_settings($settings, $sections, $fields, $inputs, $help){ |
| 560 |
|
| 561 |
/*sections*/ |
| 562 |
if($sections){ |
| 563 |
$settings['sections'][$this->section_key] = __('Sku Settings', 'wppizza-admin'); |
| 564 |
} |
| 565 |
/*fields*/ |
| 566 |
if($fields){ |
| 567 |
$field = 'sku_enable'; |
| 568 |
$settings['fields'][$this->section_key][$field] = array( __('Enable setting of SKU\'s:', 'wppizza-admin') , array( |
| 569 |
'value_key'=>$field, |
| 570 |
'option_key'=>$this->settings_page, |
| 571 |
/* Translators: 1,2: WPPizza Name as defined by constant */ |
| 572 |
'label'=>sprintf( __( 'check to be able to set SKUs for menu items [more options will be become available in "%1$s -> Layout" / "%2$s -> Localization"]', 'wppizza-admin'), WPPIZZA_NAME, WPPIZZA_NAME), |
| 573 |
'description'=>array() |
| 574 |
)); |
| 575 |
$field = 'sku_search'; |
| 576 |
$settings['fields'][$this->section_key][$field] = array( __('Enable search by SKU:', 'wppizza-admin') , array( |
| 577 |
'value_key'=>$field, |
| 578 |
'option_key'=>$this->settings_page, |
| 579 |
'label'=>__('make SKUs searchable (through wppizza search widget/shortcode. menu item search must be enabled)', 'wppizza-admin'), |
| 580 |
'description'=>array() |
| 581 |
)); |
| 582 |
$field = 'sku_search_partial'; |
| 583 |
$settings['fields'][$this->section_key][$field] = array( __('Enable partial SKU search:', 'wppizza-admin') , array( |
| 584 |
'value_key'=>$field, |
| 585 |
'option_key'=>$this->settings_page, |
| 586 |
'label'=>__('allow search to match partial SKUs', 'wppizza-admin'), |
| 587 |
'description'=>array() |
| 588 |
)); |
| 589 |
$field = 'sku_search_length'; |
| 590 |
$settings['fields'][$this->section_key][$field] = array( __('Partial search min characters:', 'wppizza-admin') , array( |
| 591 |
'value_key'=>$field, |
| 592 |
'option_key'=>$this->settings_page, |
| 593 |
'label'=>__('If partial search enabled above, minimum characters to be entered in searchfield to search for partially matching SKUs [minimum 3, default 5]', 'wppizza-admin'), |
| 594 |
'description'=>array() |
| 595 |
)); |
| 596 |
} |
| 597 |
|
| 598 |
return $settings; |
| 599 |
} |
| 600 |
/**************************************************************** |
| 601 |
* [output option fields - setting page] |
| 602 |
* @since 3.0 |
| 603 |
* @return array() |
| 604 |
****************************************************************/ |
| 605 |
function admin_options_fields_settings($wppizza_options, $options_key, $field, $label, $description){ |
| 606 |
|
| 607 |
if($field=='sku_enable'){ |
| 608 |
print'<label>'; |
| 609 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 610 |
print'' . $label . ''; |
| 611 |
print'</label>'; |
| 612 |
print'' . $description . ''; |
| 613 |
} |
| 614 |
if($field=='sku_search'){ |
| 615 |
print'<label>'; |
| 616 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 617 |
print'' . $label . ''; |
| 618 |
print'</label>'; |
| 619 |
print'' . $description . ''; |
| 620 |
} |
| 621 |
|
| 622 |
if($field=='sku_search_partial'){ |
| 623 |
print'<label>'; |
| 624 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 625 |
print'' . $label . ''; |
| 626 |
print'</label>'; |
| 627 |
print'' . $description . ''; |
| 628 |
} |
| 629 |
if($field=='sku_search_length'){ |
| 630 |
print'<label>'; |
| 631 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' size='2' type='text' value='".$wppizza_options[$options_key][$field]."' />"; |
| 632 |
print'' . $label . ''; |
| 633 |
print'</label>'; |
| 634 |
print'' . $description . ''; |
| 635 |
} |
| 636 |
} |
| 637 |
|
| 638 |
/*------------------------------------------------------------------------------ |
| 639 |
# |
| 640 |
# |
| 641 |
# [layout page] |
| 642 |
# |
| 643 |
# |
| 644 |
------------------------------------------------------------------------------*/ |
| 645 |
/**************************************************************** |
| 646 |
* [settigs section - layout page] |
| 647 |
* @since 3.0 |
| 648 |
* @return array() |
| 649 |
****************************************************************/ |
| 650 |
function admin_options_layout($settings, $sections, $fields, $inputs, $help){ |
| 651 |
global $wppizza_options; |
| 652 |
|
| 653 |
/* skip if not enabled */ |
| 654 |
if(empty($wppizza_options[$this->settings_page]['sku_enable'])){ |
| 655 |
return $settings; |
| 656 |
} |
| 657 |
|
| 658 |
/*sections*/ |
| 659 |
if($sections){ |
| 660 |
$settings['sections'][$this->section_key] = __('SKU display:', 'wppizza-admin'); |
| 661 |
} |
| 662 |
/*fields*/ |
| 663 |
if($fields){ |
| 664 |
$field = 'sku_replaces_size'; |
| 665 |
$settings['fields'][$this->section_key][$field] = array( __('Replace size labels with SKU (if exist):', 'wppizza-admin') , array( |
| 666 |
'value_key'=>$field, |
| 667 |
'option_key'=>$this->layout_page, |
| 668 |
'label'=>__('Except for menu listing title, enabling this option will render below display positions irrelevant', 'wppizza-admin'), |
| 669 |
'description'=>array() |
| 670 |
)); |
| 671 |
|
| 672 |
/** array of keys that have off left right options */ |
| 673 |
foreach($this->left_right_options() as $opt_key => $opt_val){ |
| 674 |
$field = $opt_key; |
| 675 |
$settings['fields'][$this->section_key][$field] = array( $opt_val['label'] , array( |
| 676 |
'value_key'=>$field, |
| 677 |
'option_key'=>$this->layout_page, |
| 678 |
'label'=>'', |
| 679 |
'description'=>array() |
| 680 |
)); |
| 681 |
} |
| 682 |
|
| 683 |
/** array of keys that have integer options */ |
| 684 |
foreach($this->numeric_options() as $opt_key => $opt_val){ |
| 685 |
$field = $opt_key; |
| 686 |
$settings['fields'][$this->section_key][$field] = array( $opt_val['label'] , array( |
| 687 |
'value_key'=>$field, |
| 688 |
'option_key'=>$this->layout_page, |
| 689 |
'label'=>__('column number [ 0=disabled, 1=first, 2=second etc]', 'wppizza-admin'), |
| 690 |
'description'=>array() |
| 691 |
)); |
| 692 |
} |
| 693 |
} |
| 694 |
|
| 695 |
return $settings; |
| 696 |
} |
| 697 |
/**************************************************************** |
| 698 |
* [output option fields - setting page] |
| 699 |
* @since 3.0 |
| 700 |
* @return array() |
| 701 |
****************************************************************/ |
| 702 |
function admin_options_fields_layout($wppizza_options, $options_key, $field, $label, $description){ |
| 703 |
|
| 704 |
if($field=='sku_replaces_size'){ |
| 705 |
print'<label>'; |
| 706 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][".$field."]' type='checkbox' ". checked($wppizza_options[$options_key][$field],true,false)." value='1' />"; |
| 707 |
print'' . $label . ''; |
| 708 |
print'</label>'; |
| 709 |
print'' . $description . ''; |
| 710 |
} |
| 711 |
|
| 712 |
$num_options = $this->numeric_options($field); |
| 713 |
if(!empty($num_options)){ |
| 714 |
print'<label>'; |
| 715 |
print "<input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][sku_display][".$field."]' size='3' type='text' value='".$wppizza_options[$options_key]['sku_display'][$field]."' />"; |
| 716 |
print'' . $label . ''; |
| 717 |
print'</label>'; |
| 718 |
print'' . $description . ''; |
| 719 |
} |
| 720 |
|
| 721 |
$left_right_options = $this->left_right_options($field); |
| 722 |
if(!empty($left_right_options)){ |
| 723 |
print'<label>'; |
| 724 |
print "".__('off','wppizza-admin')." <input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][sku_display][".$field."]' size='3' ". checked($wppizza_options[$options_key]['sku_display'][$field],0,false). " type='radio' value='0' />"; |
| 725 |
print'</label>'; |
| 726 |
print'<label>'; |
| 727 |
print "".__('left','wppizza-admin')." <input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][sku_display][".$field."]' size='3' ". checked($wppizza_options[$options_key]['sku_display'][$field],'left',false). "type='radio' value='left' />"; |
| 728 |
print'</label>'; |
| 729 |
print'<label>'; |
| 730 |
print "".__('right','wppizza-admin')." <input id='".$field."' name='".WPPIZZA_SLUG."[".$options_key."][sku_display][".$field."]' size='3' ". checked($wppizza_options[$options_key]['sku_display'][$field],'right',false). "type='radio' value='right' />"; |
| 731 |
print'' . $label . ''; |
| 732 |
print'</label>'; |
| 733 |
print'' . $description . ''; |
| 734 |
} |
| 735 |
} |
| 736 |
|
| 737 |
/*------------------------------------------------------------------------------ |
| 738 |
# |
| 739 |
# |
| 740 |
# [localization page] |
| 741 |
# |
| 742 |
# |
| 743 |
------------------------------------------------------------------------------*/ |
| 744 |
/**************************************************************** |
| 745 |
* [settigs section - localization page] |
| 746 |
* @since 3.0 |
| 747 |
* @return array() |
| 748 |
****************************************************************/ |
| 749 |
function admin_options_localization($settings, $sections, $fields, $inputs, $help){ |
| 750 |
global $wppizza_options; |
| 751 |
/* skip if not enabled */ |
| 752 |
if(empty($wppizza_options[$this->settings_page]['sku_enable'])){ |
| 753 |
return $settings; |
| 754 |
} |
| 755 |
/******************************** |
| 756 |
* [Labels SKU] |
| 757 |
********************************/ |
| 758 |
/*sections*/ |
| 759 |
if($sections){ |
| 760 |
$settings['sections'][$this->section_key] = __('SKU Label - Itemised Order', 'wppizza-admin'); |
| 761 |
} |
| 762 |
/*fields*/ |
| 763 |
if($fields){ |
| 764 |
$field = 'sku_label'; |
| 765 |
$settings['fields'][$this->section_key][$field] = array('' , array( |
| 766 |
'value_key'=>$field, |
| 767 |
'option_key'=>$this->localization_page, |
| 768 |
'label'=>__('SKU Label', 'wppizza-admin') |
| 769 |
)); |
| 770 |
} |
| 771 |
|
| 772 |
|
| 773 |
return $settings; |
| 774 |
} |
| 775 |
/*------------------------------------------------------------------------------ |
| 776 |
# [insert default option on install] |
| 777 |
# $parameter $options array() | filter passing on filtered options |
| 778 |
# @since 3.0 |
| 779 |
# @return array() |
| 780 |
------------------------------------------------------------------------------*/ |
| 781 |
function options_default($options){ |
| 782 |
/* |
| 783 |
settings |
| 784 |
*/ |
| 785 |
$options[$this->settings_page]['sku_enable'] = false; |
| 786 |
$options[$this->settings_page]['sku_search'] = false; |
| 787 |
$options[$this->settings_page]['sku_search_partial'] = false; |
| 788 |
$options[$this->settings_page]['sku_search_length'] = 5; |
| 789 |
|
| 790 |
/* |
| 791 |
layout |
| 792 |
*/ |
| 793 |
$options[$this->layout_page]['sku_replaces_size'] = false; |
| 794 |
/* off|left|right options */ |
| 795 |
foreach($this->left_right_options() as $opt_key => $opt_val){ |
| 796 |
$options[$this->layout_page]['sku_display'][$opt_key] = $opt_val['default']; |
| 797 |
} |
| 798 |
/* numeric options options */ |
| 799 |
foreach($this->numeric_options() as $opt_key => $opt_val){ |
| 800 |
$options[$this->layout_page]['sku_display'][$opt_key] = $opt_val['default']; |
| 801 |
} |
| 802 |
|
| 803 |
/* |
| 804 |
localization |
| 805 |
*/ |
| 806 |
$options[$this->localization_page]['sku_label'] = wppizza_textdomain('SKU', 'wppizza'); |
| 807 |
|
| 808 |
return $options; |
| 809 |
} |
| 810 |
|
| 811 |
/*------------------------------------------------------------------------------ |
| 812 |
# [validate options on save/update] |
| 813 |
# |
| 814 |
# @since 3.0 |
| 815 |
# @return array() |
| 816 |
------------------------------------------------------------------------------*/ |
| 817 |
|
| 818 |
function options_validate($options, $input){ |
| 819 |
/**make sure we get the full array on install/update**/ |
| 820 |
if ( empty( $_POST['_wp_http_referer'] ) ) { |
| 821 |
return $input; |
| 822 |
} |
| 823 |
/* |
| 824 |
settings |
| 825 |
*/ |
| 826 |
if(isset($_POST[''.WPPIZZA_SLUG.'_'.$this->settings_page.''])){ |
| 827 |
$options[$this->settings_page]['sku_enable'] = !empty($input[$this->settings_page]['sku_enable']) ? true : false; |
| 828 |
$options[$this->settings_page]['sku_search'] = !empty($input[$this->settings_page]['sku_search']) ? true : false; |
| 829 |
$options[$this->settings_page]['sku_search_partial'] = !empty($input[$this->settings_page]['sku_search_partial']) ? true : false; |
| 830 |
$options[$this->settings_page]['sku_search_length'] = (wppizza_validate_int_only($input[$this->settings_page]['sku_search_length']) >=3 ) ? $input[$this->settings_page]['sku_search_length'] : 5; |
| 831 |
} |
| 832 |
|
| 833 |
/* |
| 834 |
layout |
| 835 |
*/ |
| 836 |
if(isset($_POST[''.WPPIZZA_SLUG.'_'.$this->layout_page.''])){ |
| 837 |
$options[$this->layout_page]['sku_replaces_size'] = !empty($input[$this->layout_page]['sku_replaces_size']) ? true : false; |
| 838 |
/* validate off|left|right options */ |
| 839 |
foreach($this->left_right_options() as $opt_key => $opt_val){ |
| 840 |
$options[$this->layout_page]['sku_display'][$opt_key] = !empty($input[$this->layout_page]['sku_display'][$opt_key]) ? wppizza_validate_alpha_only($input[$this->layout_page]['sku_display'][$opt_key]) : 0; |
| 841 |
} |
| 842 |
/* validate numeric options */ |
| 843 |
foreach($this->numeric_options() as $opt_key => $opt_val){ |
| 844 |
$options[$this->layout_page]['sku_display'][$opt_key] = !empty($input[$this->layout_page]['sku_display'][$opt_key]) ? wppizza_validate_int_only($input[$this->layout_page]['sku_display'][$opt_key]) : 0; |
| 845 |
} |
| 846 |
|
| 847 |
} |
| 848 |
|
| 849 |
/* |
| 850 |
localization strings are automatically validated |
| 851 |
*/ |
| 852 |
|
| 853 |
return $options; |
| 854 |
} |
| 855 |
|
| 856 |
/*------------------------------------------------------------------------------ |
| 857 |
# |
| 858 |
# |
| 859 |
# [helpers] |
| 860 |
# |
| 861 |
# |
| 862 |
------------------------------------------------------------------------------*/ |
| 863 |
function left_right_options($selected = false){ |
| 864 |
/** array of display options that can be set to off|left|right */ |
| 865 |
$options = array(); |
| 866 |
$options['menu_listing_title']=array('label'=>__('menu listings title', 'wppizza-admin'), 'default' => 0); |
| 867 |
$options['menu_listing_size']=array('label'=>__('menu listings sizes', 'wppizza-admin'), 'default' => 0); |
| 868 |
// currently disabled // $options['cart']=array('label'=>__('cart', 'wppizza-admin'), 'default' => 0); |
| 869 |
/* only return selected option or false if not exists*/ |
| 870 |
if($selected){ |
| 871 |
if(isset($options[$selected])){ |
| 872 |
return $options[$selected]; |
| 873 |
}else{ |
| 874 |
return false; |
| 875 |
} |
| 876 |
} |
| 877 |
return $options; |
| 878 |
} |
| 879 |
|
| 880 |
function numeric_options($selected = false){ |
| 881 |
/** array of display options that can be set by integer */ |
| 882 |
$options = array(); |
| 883 |
$options['orderpage']=array('label'=>__('order page', 'wppizza-admin'), 'default' => 0); |
| 884 |
$options['confirmationpage']=array('label'=>__('confirmation page [if used in wppizza - order form settings]', 'wppizza-admin'), 'default' => 0); |
| 885 |
$options['thankyoupage']=array('label'=>__('thank you page [if enabled in wppizza->order settings]:', 'wppizza-admin'), 'default' => 0); |
| 886 |
$options['orderhistory']=array('label'=>__('customer purchase history', 'wppizza-admin'), 'default' => 0); |
| 887 |
|
| 888 |
$options['emails']=array('label'=>__('emails', 'wppizza-admin'), 'default' => 0); |
| 889 |
$options['print']=array('label'=>__('admin print order', 'wppizza-admin'), 'default' => 0); |
| 890 |
|
| 891 |
/* only return selected option or false if not exists*/ |
| 892 |
if($selected){ |
| 893 |
if(isset($options[$selected])){ |
| 894 |
return $options[$selected]; |
| 895 |
}else{ |
| 896 |
return false; |
| 897 |
} |
| 898 |
} |
| 899 |
return $options; |
| 900 |
} |
| 901 |
} |
| 902 |
/*************************************************************** |
| 903 |
* |
| 904 |
* [ini] |
| 905 |
* |
| 906 |
***************************************************************/ |
| 907 |
$WPPIZZA_MODULE_SKU = new WPPIZZA_MODULE_SKU(); |
| 908 |
?> |