WCML_Store_Pages

The WooCommerce Multilingual WCML Store Pages class.

Defined (1)

The class is defined in the following location(s).

/inc/class-wcml-store-pages.php  
  1. class WCML_Store_Pages{ 
  2.  
  3. /** 
  4. * @var woocommerce_wpml 
  5. */ 
  6. private $woocommerce_wpml; 
  7. /** 
  8. * @var SitePress 
  9. */ 
  10. private $sitepress; 
  11.  
  12. function __construct( $woocommerce_wpml, $sitepress ) { 
  13.  
  14. $this->woocommerce_wpml =& $woocommerce_wpml; 
  15. $this->sitepress =& $sitepress; 
  16.  
  17. add_action('init', array($this, 'init')); 
  18. add_filter( 'woocommerce_create_pages', array( $this, 'switch_pages_language' ), 9 ); 
  19. add_filter( 'woocommerce_create_pages', array( $this, 'install_pages_action' ), 11 ); 
  20. //update wc pages ids after change default language or create new if not exists 
  21. add_action( 'icl_after_set_default_language', array( $this, 'after_set_default_language' ), 10, 2 ); 
  22. // Translate shop page ids 
  23. $this->add_filter_to_get_shop_translated_page_id(); 
  24. add_filter( 'template_include', array( $this, 'template_loader' ), 100 ); 
  25.  
  26. if( is_admin() ) { 
  27. add_action( 'icl_post_languages_options_before', array( $this, 'show_translate_shop_pages_notice') ); 
  28. }  
  29.  
  30. function init() {  
  31.  
  32. if(!is_admin()) { 
  33. add_filter('pre_get_posts', array($this, 'shop_page_query'), 9); 
  34. add_filter('icl_ls_languages', array($this, 'translate_ls_shop_url')); 
  35. add_filter('parse_request', array($this, 'adjust_shop_page')); 
  36.  
  37. add_filter( 'woocommerce_create_page_id', array( $this, 'check_store_page_id'), 10 , 3 ); 
  38.  
  39. $nonce = filter_input( INPUT_POST, 'wcml_nonce', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); 
  40. if (isset($_POST['create_pages']) && wp_verify_nonce($nonce, 'create_pages')) { 
  41. $this->create_missing_store_pages_with_redirect(); 
  42.  
  43. $this->front_page_id = get_option('page_on_front'); 
  44. $this->shop_page_id = wc_get_page_id('shop'); 
  45. $this->shop_page = get_post( $this->shop_page_id ); 
  46. }  
  47.  
  48. function switch_pages_language( $pages ) { 
  49.  
  50. $default_language = $this->sitepress->get_default_language(); 
  51.  
  52. if( $this->sitepress->get_current_language() != $default_language ) { 
  53. foreach( $pages as $key => $page ) { 
  54.  
  55. switch( $key ) { 
  56. case 'shop': 
  57. $page['name'] = 'shop'; 
  58. $page['title'] = 'Shop'; 
  59. break; 
  60. case 'cart': 
  61. $page['name'] = 'cart'; 
  62. $page['title'] = 'Cart'; 
  63. break; 
  64. case 'checkout': 
  65. $page['name'] = 'checkout'; 
  66. $page['title'] = 'Checkout'; 
  67. break; 
  68. case 'myaccount': 
  69. $page['name'] = 'my-account'; 
  70. $page['title'] = 'My account'; 
  71. break; 
  72.  
  73. if( $this->sitepress->get_default_language() != 'en' ) { 
  74. $page['name'] = $this->woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( 'Page slug'.$page['name'], $default_language ); 
  75. $page['title'] = $this->woocommerce_wpml->strings->get_translation_from_woocommerce_mo_file( 'Page title'.$page['title'], $default_language ); 
  76.  
  77. return $pages; 
  78.  
  79. function install_pages_action( $pages ) { 
  80. global $wpdb; 
  81.  
  82. foreach( $pages as $key => $page) { 
  83.  
  84. if ( strlen( $page[ 'content' ] ) > 0 ) { 
  85. // Search for an existing page with the specified page content (typically a shortcode) 
  86. $page_found = $wpdb->get_var( $wpdb->prepare( " 
  87. SELECT ID FROM " . $wpdb->posts . " as p  
  88. LEFT JOIN {$wpdb->prefix}icl_translations AS icl ON icl.element_id = p.id  
  89. WHERE post_type='page'  
  90. AND post_content LIKE %s  
  91. AND icl.element_type = 'post_page'  
  92. AND icl.language_code = %s LIMIT 1; 
  93. ",  
  94. "%{$page[ 'content' ]}%", $this->sitepress->get_default_language() ) ); 
  95. } else { 
  96. // Search for an existing page with the specified page slug 
  97. $page_found = $wpdb->get_var( $wpdb->prepare( " 
  98. SELECT ID FROM " . $wpdb->posts . " as p  
  99. LEFT JOIN {$wpdb->prefix}icl_translations AS icl ON icl.element_id = p.id  
  100. WHERE post_type='page'  
  101. AND post_name = %s  
  102. AND icl.element_type = 'post_page'  
  103. AND icl.language_code = %s LIMIT 1; 
  104. ",  
  105. esc_sql( $page['name'] ), $this->sitepress->get_default_language() ) ); 
  106.  
  107. if( !$page_found ) { 
  108. $page_data = array( 
  109. 'post_status' => 'publish',  
  110. 'post_type' => 'page',  
  111. 'post_author' => 1,  
  112. 'post_name' => esc_sql( $page['name'] ),  
  113. 'post_title' => $page['title'],  
  114. 'post_content' => $page['content'],  
  115. 'post_parent' => ! empty( $page['parent'] ) ? wc_get_page_id( $page['parent'] ) : '',  
  116. 'comment_status' => 'closed' 
  117. ); 
  118. $page_id = wp_insert_post( $page_data ); 
  119.  
  120. if ( 'woocommerce_' . $key . '_page_id' ) 
  121. update_option( 'woocommerce_' . $key . '_page_id', $page_id ); 
  122.  
  123. unset( $pages[ $key ] ); 
  124.  
  125. return $pages; 
  126.  
  127. function add_filter_to_get_shop_translated_page_id() { 
  128. $woo_pages = array( 
  129. 'shop_page_id',  
  130. 'cart_page_id',  
  131. 'checkout_page_id',  
  132. 'myaccount_page_id',  
  133. 'lost_password_page_id',  
  134. 'edit_address_page_id',  
  135. 'view_order_page_id',  
  136. 'change_password_page_id',  
  137. 'logout_page_id',  
  138. 'pay_page_id',  
  139. 'thanks_page_id',  
  140. 'terms_page_id',  
  141. 'review_order_page_id' 
  142. ); 
  143.  
  144. foreach($woo_pages as $woo_page) { 
  145. add_filter('woocommerce_get_'.$woo_page, array($this, 'translate_pages_in_settings')); 
  146. //I think following filter not needed because "option_woocommerce_..." not used in Woo, but I need ask David to confirm this 
  147. add_filter('option_woocommerce_'.$woo_page, array($this, 'translate_pages_in_settings')); 
  148.  
  149. add_filter('woocommerce_get_checkout_url', array($this, 'get_checkout_page_url')); 
  150.  
  151. function translate_pages_in_settings($id) { 
  152. global $pagenow; 
  153. if( $pagenow == 'options-permalink.php' || ( isset( $_GET['page'] ) && $_GET['page'] == 'wpml-wcml' ) ) { 
  154. return $id; 
  155.  
  156. return apply_filters( 'translate_object_id', $id, 'page', true); 
  157.  
  158. /** 
  159. * Filters WooCommerce query for translated shop page 
  160. *  
  161. */ 
  162. function shop_page_query($q) { 
  163. if ( ! $q->is_main_query() ) 
  164. return; 
  165.  
  166. //do not alter query_object and query_object_id (part 1 of 2) 
  167. global $wp_query; 
  168. $queried_object_original = isset($wp_query->queried_object) ? $wp_query->queried_object : null; 
  169. $queried_object_id_original = isset($wp_query->queried_object_id) ? $wp_query->queried_object_id : null; 
  170.  
  171. if ( 
  172. !empty($this->shop_page) && 
  173. $this->shop_page->post_status == 'publish' && 
  174. !empty($this->front_page_id) && 
  175. $q->get('post_type') != 'product' && 
  176. $q->get('page_id') !== $this->front_page_id && 
  177. $this->shop_page_id == $q->get('page_id') 
  178. ) { 
  179. $q->set( 'post_type', 'product' ); 
  180. $q->set( 'page_id', '' ); 
  181. if ( isset( $q->query['paged'] ) ) 
  182. $q->set( 'paged', $q->query['paged'] ); 
  183.  
  184. // Get the actual WP page to avoid errors 
  185. // This is hacky but works. Awaiting http://core.trac.wordpress.org/ticket/21096 
  186. global $wp_post_types; 
  187.  
  188. $q->is_page = true; 
  189.  
  190. $wp_post_types['product']->ID = $this->shop_page->ID; 
  191. $wp_post_types['product']->post_title = $this->shop_page->post_title; 
  192. $wp_post_types['product']->post_name = $this->shop_page->post_name; 
  193.  
  194. // Fix conditional functions 
  195. $q->is_singular = false; 
  196. $q->is_post_type_archive = true; 
  197. $q->is_archive = true; 
  198.  
  199. //do not alter query_object and query_object_id (part 2 of 2) 
  200. if(is_null($queried_object_original)) { 
  201. unset($wp_query->queried_object); 
  202. }else{ 
  203. $wp_query->queried_object = $queried_object_original; 
  204. if(is_null($queried_object_id_original)) { 
  205. unset($wp_query->queried_object_id); 
  206. }else{ 
  207. $wp_query->queried_object_id = $queried_object_id_original; 
  208.  
  209.  
  210.  
  211. /** 
  212. * Translate shop url 
  213. */ 
  214. function translate_ls_shop_url($languages, $debug_mode = false) { 
  215.  
  216. $shop_id = $this->shop_page_id; 
  217. $front_id = apply_filters( 'translate_object_id', $this->front_page_id, 'page'); 
  218.  
  219. foreach ($languages as $language) { 
  220. // shop page 
  221. // obsolete? 
  222. if (is_post_type_archive('product') || $debug_mode ) { 
  223. if ($front_id == $shop_id) { 
  224. $url = $this->sitepress->language_url($language['language_code']); 
  225. } else { 
  226. $this->sitepress->switch_lang($language['language_code']); 
  227. $url = get_permalink( apply_filters( 'translate_object_id', $shop_id, 'page', true, $language['language_code']) ); 
  228. $this->sitepress->switch_lang(); 
  229.  
  230. $languages[$language['language_code']]['url'] = $url; 
  231.  
  232. // copy get parameters? 
  233. $gets_passed = array(); 
  234. $parameters_copied = apply_filters( 'icl_lang_sel_copy_parameters',  
  235. array_map( 'trim',  
  236. explode( ', ',  
  237. wpml_get_setting_filter('',  
  238. 'icl_lang_sel_copy_parameters') ) ) ); 
  239. if ( $parameters_copied ) { 
  240. foreach ( $_GET as $k => $v ) { 
  241. if ( in_array( $k, $parameters_copied ) ) { 
  242. $gets_passed[ $k ] = $v; 
  243.  
  244. foreach( $languages as $code => $language ) { 
  245. $languages[$code]['url'] = add_query_arg( $gets_passed, $language['url'] ); 
  246.  
  247.  
  248. return $languages; 
  249.  
  250. function adjust_shop_page($q) { 
  251.  
  252. if ( $this->sitepress->get_default_language() != $this->sitepress->get_current_language() ) { 
  253. if (!empty($q->query_vars['pagename'])) { 
  254. $shop_page = get_post( wc_get_page_id('shop') ); 
  255. // we should explode by / for children page 
  256. $query_var_page = explode('/', $q->query_vars['pagename']); 
  257. if (isset($shop_page->post_name) && ( ( $shop_page->post_name == $query_var_page[count($query_var_page)-1]) || ( $shop_page->post_name == strtolower($query_var_page[count($query_var_page)-1]) ) ) ) { 
  258. unset($q->query_vars['page']); 
  259. unset($q->query_vars['pagename']); 
  260. $q->query_vars['post_type'] = 'product'; 
  261.  
  262. function create_missing_store_pages_with_redirect() { 
  263. $this->create_missing_store_pages(); 
  264.  
  265. wp_redirect(admin_url('admin.php?page=wpml-wcml&tab=status')); exit; 
  266.  
  267.  
  268. /** 
  269. * create missing pages 
  270. */ 
  271. function create_missing_store_pages() { 
  272. global $wp_rewrite; 
  273. $miss_lang = $this->get_missing_store_pages(); 
  274.  
  275. //dummy array for names 
  276. $names = array( __('Cart', 'woocommerce-multilingual'),  
  277. __('Checkout', 'woocommerce-multilingual'),  
  278. __('Checkout → Pay', 'woocommerce-multilingual'),  
  279. __('Order Received', 'woocommerce-multilingual'),  
  280. __('My Account', 'woocommerce-multilingual'),  
  281. __('Change Password', 'woocommerce-multilingual'),  
  282. __('Edit My Address', 'woocommerce-multilingual'),  
  283. __('Logout', 'woocommerce-multilingual'),  
  284. __('Lost Password', 'woocommerce-multilingual'),  
  285. __('View Order', 'woocommerce-multilingual'),  
  286. __('Shop', 'woocommerce-multilingual')); 
  287.  
  288. if (isset($miss_lang['codes'])) { 
  289. $wp_rewrite = new WP_Rewrite(); 
  290.  
  291. $check_pages = $this->get_wc_pages(); 
  292. $default_language = $this->sitepress->get_default_language(); 
  293. if(in_array($default_language, $miss_lang['codes'])) { 
  294. $miss_lang['codes'] = array_merge(array($default_language), array_diff($miss_lang['codes'], array($default_language))); 
  295. }  
  296.  
  297. foreach ($miss_lang['codes'] as $mis_lang) { 
  298. $args = array(); 
  299.  
  300. $this->woocommerce_wpml->locale->switch_locale( $mis_lang ); 
  301.  
  302. foreach ($check_pages as $page) { 
  303. $orig_id = get_option($page); 
  304. $trid = $this->sitepress->get_element_trid($orig_id, 'post_page'); 
  305. $translations = $this->sitepress->get_element_translations($trid, 'post_page', true); 
  306.  
  307. if (!isset( $translations[ $mis_lang ] ) || ( !is_null( $translations[$mis_lang]->element_id ) && get_post_status( $translations[$mis_lang]->element_id )!='publish' ) ) { 
  308. $orig_page = get_post($orig_id); 
  309.  
  310. switch( $page ) { 
  311. case 'woocommerce_shop_page_id': 
  312. $page_title = $mis_lang !== 'en' ? __( 'Shop', 'woocommerce-multilingual') : 'Shop'; 
  313. break; 
  314. case 'woocommerce_cart_page_id': 
  315. $page_title = $mis_lang !== 'en' ? __( 'Cart', 'woocommerce-multilingual') : 'Cart'; 
  316. break; 
  317. case 'woocommerce_checkout_page_id': 
  318. $page_title = $mis_lang !== 'en' ? __( 'Checkout', 'woocommerce-multilingual') : 'Checkout'; 
  319. break; 
  320. case 'woocommerce_myaccount_page_id': 
  321. $page_title = $mis_lang !== 'en' ? __( 'My Account', 'woocommerce-multilingual') : 'My Account'; 
  322. break; 
  323. default: 
  324. $page_title = $mis_lang !== 'en' ? translate( $orig_page->post_title, 'woocommerce-multilingual') : $orig_page->post_title; 
  325. break; 
  326.  
  327. $args['post_title'] = $page_title; 
  328. $args['post_type'] = $orig_page->post_type; 
  329. $args['post_content'] = $orig_page->post_content; 
  330. $args['post_excerpt'] = $orig_page->post_excerpt; 
  331. $args['post_status'] = ( isset($translations[$mis_lang]->element_id) && get_post_status($translations[$mis_lang]->element_id) != 'publish' ) ? 'publish' : $orig_page->post_status; 
  332. $args['menu_order'] = $orig_page->menu_order; 
  333. $args['ping_status'] = $orig_page->ping_status; 
  334. $args['comment_status'] = $orig_page->comment_status; 
  335. $post_parent = apply_filters( 'translate_object_id', $orig_page->post_parent, 'page', false, $mis_lang); 
  336. $args['post_parent'] = is_null($post_parent)?0:$post_parent; 
  337. $new_page_id = wp_insert_post($args); 
  338.  
  339. if( isset($translations[$mis_lang]->element_id) && get_post_status($translations[$mis_lang]->element_id) == 'trash' && $mis_lang == $default_language) { 
  340. update_option($page, $new_page_id); 
  341. }  
  342.  
  343. if( isset($translations[$mis_lang]->element_id) && !is_null($translations[$mis_lang]->element_id)) { 
  344. $this->sitepress->set_element_language_details($translations[$mis_lang]->element_id, 'post_page', false, $mis_lang); 
  345.  
  346. $trid = $this->sitepress->get_element_trid($orig_id, 'post_page'); 
  347. $this->sitepress->set_element_language_details($new_page_id, 'post_page', $trid, $mis_lang); 
  348. $this->woocommerce_wpml->locale->switch_locale(); 
  349.  
  350. /** 
  351. * get missing pages 
  352. * return array; 
  353. */ 
  354. function get_missing_store_pages() { 
  355.  
  356. $check_pages = $this->get_wc_pages(); 
  357.  
  358. $missing_lang = array(); 
  359. $pages_in_progress = array(); 
  360.  
  361. foreach ($check_pages as $page) { 
  362. $page_id = get_option($page); 
  363. $page_obj = get_post($page_id); 
  364. if(!$page_id || !$page_obj || $page_obj->post_status != 'publish' ) { 
  365. return 'non_exist'; 
  366.  
  367. $languages = $this->sitepress->get_active_languages(); 
  368.  
  369. $missing_lang_codes = array(); 
  370.  
  371. foreach ($check_pages as $page) { 
  372. $store_page_id = get_option($page); 
  373. $trid = $this->sitepress->get_element_trid($store_page_id, 'post_page'); 
  374. $translations = $this->sitepress->get_element_translations($trid, 'post_page', true); 
  375. $pages_in_progress_miss_lang = ''; 
  376. foreach ($languages as $language) { 
  377. if ( !in_array( $language['code'], $missing_lang_codes ) && 
  378. ( !isset( $translations[ $language['code'] ] ) || ( !is_null( $translations[$language['code']]->element_id ) && get_post_status( $translations[$language['code']]->element_id )!='publish' ) ) ) { 
  379.  
  380. $missing_lang_codes[] = $language['code']; 
  381.  
  382. $missing_lang[] = $language; 
  383.  
  384. continue; 
  385.  
  386. if ( isset($translations[$language['code']] ) && is_null( $translations[$language['code']]->element_id ) ) { 
  387.  
  388. $pages_in_progress[$store_page_id][] = $language; 
  389.  
  390.  
  391.  
  392. foreach( $pages_in_progress as $key => $page_in_progress ) { 
  393. $pages_in_progress_notice[$key]['page'] = get_the_title( $key ).' :'; 
  394. $pages_in_progress_notice[$key]['lang'] = $page_in_progress; 
  395.  
  396.  
  397. $status = array(); 
  398.  
  399. if (!empty($missing_lang)) { 
  400. $status['lang'] = $missing_lang; 
  401. $status['codes'] = $missing_lang_codes; 
  402.  
  403. if (!empty($pages_in_progress_notice)) { 
  404. $status['in_progress'] = $pages_in_progress_notice; 
  405.  
  406. if(!empty($status)) { 
  407. return $status; 
  408. }else { 
  409. return false; 
  410.  
  411. /** 
  412. * Filters WooCommerce checkout link. 
  413. */ 
  414. function get_checkout_page_url() { 
  415. return get_permalink(apply_filters( 'translate_object_id', get_option('woocommerce_checkout_page_id'), 'page', true)); 
  416.  
  417. function get_wc_pages() { 
  418. return apply_filters('wcml_wc_installed_pages', array( 
  419. 'woocommerce_shop_page_id',  
  420. 'woocommerce_cart_page_id',  
  421. 'woocommerce_checkout_page_id',  
  422. 'woocommerce_myaccount_page_id' 
  423. )); 
  424.  
  425. function after_set_default_language( $code, $previous_code ) { 
  426. global $wpdb; 
  427.  
  428. $this->create_missing_store_pages(); 
  429. $pages = $this->get_wc_pages(); 
  430.  
  431. foreach( $pages as $page ) { 
  432.  
  433. if( $page_id = get_option($page) ) { 
  434. $trnsl_id = apply_filters( 'translate_object_id', $page_id, 'page', false, $code ); 
  435. if( !is_null( $trnsl_id ) ) { 
  436. $wpdb->update( $wpdb->options, array( 'option_value' => $trnsl_id ), array( 'option_name' => $page ) ); 
  437.  
  438.  
  439. // Clear any unwanted data 
  440. wc_delete_product_transients(); 
  441. delete_transient( 'woocommerce_cache_excluded_uris' ); 
  442.  
  443. function template_loader( $template ) { 
  444.  
  445. if ( is_product_taxonomy() ) { 
  446. global $sitepress, $woocommerce_wpml; 
  447.  
  448. $current_language = $sitepress->get_current_language(); 
  449. $default_language = $sitepress->get_default_language(); 
  450.  
  451. if( $current_language != $default_language ) { 
  452.  
  453. $templates = array( 'woocommerce.php' ); 
  454.  
  455. $term = get_queried_object(); 
  456.  
  457. if (is_tax('product_cat') || is_tax('product_tag')) { 
  458. $file = 'taxonomy-' . $term->taxonomy . '.php'; 
  459. } else { 
  460. $file = 'archive-product.php'; 
  461.  
  462. // check templates 
  463. $term = get_queried_object(); 
  464. $taxonomy = $term->taxonomy; 
  465. $prefix = 'taxonomy-'.$taxonomy; 
  466. $original_term_id = icl_object_id($term->term_id, $taxonomy, true, $default_language); 
  467. $original_term = $woocommerce_wpml->terms->wcml_get_term_by_id( $original_term_id, $taxonomy ); 
  468.  
  469.  
  470. $terms_to_check = array( $term->term_id => $term->slug ); 
  471. if ($original_term) { 
  472. $terms_to_check[ $original_term_id ] = $original_term->slug; 
  473.  
  474. $paths = array( '', WC()->template_path() ); 
  475.  
  476. foreach( $paths as $path ) { 
  477.  
  478. foreach( $terms_to_check as $term_id => $term_slug ) { 
  479.  
  480. $templates[] = $path."$prefix-{$current_language}-{$term_slug}.php"; 
  481. $templates[] = $path."$prefix-{$current_language}-{$term_id}.php"; 
  482. $templates[] = $path."$prefix-{$term_slug}.php"; 
  483. $templates[] = $path."$prefix-{$term_id}.php"; 
  484.  
  485.  
  486. $templates[] = $path."$prefix-{$current_language}.php"; 
  487. $templates[] = $path."$prefix.php"; 
  488. $templates[] = $path.$file; 
  489.  
  490. $loaded_template = locate_template( array_unique( $templates ) ); 
  491.  
  492. if ( $loaded_template ) { 
  493.  
  494. $template = $loaded_template; 
  495.  
  496.  
  497.  
  498.  
  499. return $template; 
  500.  
  501.  
  502. public function show_translate_shop_pages_notice() { 
  503. if( empty( $this->woocommerce_wpml->settings['set_up_wizard_run'] ) ) { 
  504.  
  505. $is_shop_page = false; 
  506.  
  507. $pages = $this->get_wc_pages(); 
  508. $current_page_id = get_the_ID(); 
  509. foreach( $pages as $page ) { 
  510. $page_id = get_option( $page ); 
  511. if( $page_id && $page_id === $current_page_id ) { 
  512. $is_shop_page = true; 
  513. break; 
  514.  
  515. if ( $is_shop_page ) { 
  516.  
  517. $is_translated = true; 
  518. $active_languages = array_keys( $this->sitepress->get_active_languages() ); 
  519.  
  520. $trid = $this->sitepress->get_element_trid( $current_page_id, 'post_page' ); 
  521. $translations = $this->sitepress->get_element_translations($trid, $current_page_id, true, true, true ); 
  522.  
  523. foreach( $active_languages as $language ) { 
  524. if( !isset( $translations[$language] ) ) { 
  525. $is_translated = false; 
  526. break; 
  527.  
  528. if( !$is_translated ) { 
  529. $text = sprintf( __( 'To quickly translate this and other WooCommerce store pages, please run the %ssetup wizard%s.', 'woocommerce-multilingual' ),  
  530. '<a href="' . admin_url( 'admin.php?page=wcml-setup' ) . '">', '</a>' ); 
  531.  
  532. echo '<div class="notice notice-error inline">'; 
  533. echo '<p><i class="otgs-ico-warning"></i> ' . $text . '</p>'; 
  534. echo '</div>'; 
  535.  
  536.  
  537.  
  538.