本文整理汇总了PHP中WC_germanized函数的典型用法代码示例。如果您正苦于以下问题:PHP WC_germanized函数的具体用法?PHP WC_germanized怎么用?PHP WC_germanized使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WC_germanized函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
public static function output()
{
global $post, $thepostid;
$thepostid = $post->ID;
$_product = wc_get_product($thepostid);
$terms = array();
$delivery_time = $_product->gzd_product->delivery_time;
woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Unit Base', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Unit price per amount (e.g. 100)', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Unit Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
if (version_compare(WC()->version, '2.3', '<')) {
return;
}
?>
<p class="form-field">
<label for="delivery_time"><?php
_e('Delivery Time', 'woocommerce-germanized');
?>
</label>
<input type="hidden" class="wc-product-search wc-gzd-delivery-time-search" style="width: 50%" id="delivery_time" name="delivery_time" data-minimum_input_length="1" data-allow_clear="true" data-placeholder="<?php
_e('Search for a delivery time…', 'woocommerce-germanized');
?>
" data-action="woocommerce_gzd_json_search_delivery_time" data-multiple="false" data-selected="<?php
echo $delivery_time ? $delivery_time->name : '';
?>
" value="<?php
echo $delivery_time ? $delivery_time->term_id : '';
?>
" />
</p>
<?php
}
示例2: add_scripts
public function add_scripts()
{
$screen = get_current_screen();
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$assets_path = WC_germanized()->plugin_url() . '/assets/';
$admin_script_path = $assets_path . 'js/admin/';
wp_register_style('woocommerce-gzd-admin', $assets_path . 'css/woocommerce-gzd-admin' . $suffix . '.css', false, WC_GERMANIZED_VERSION);
wp_enqueue_style('woocommerce-gzd-admin');
wp_register_style('tourbus', $assets_path . 'css/tourbus' . $suffix . '.css', false, WC_GERMANIZED_VERSION);
wp_register_script('wc-gzd-admin', $admin_script_path . 'settings' . $suffix . '.js', array('jquery', 'woocommerce_settings'), WC_GERMANIZED_VERSION, true);
wp_register_script('wc-gzd-admin-emails', $admin_script_path . 'emails' . $suffix . '.js', array('jquery', 'woocommerce_settings'), WC_GERMANIZED_VERSION, true);
wp_register_script('scrollto', $admin_script_path . 'scrollTo' . $suffix . '.js', array('jquery'), WC_GERMANIZED_VERSION, true);
wp_register_script('tourbus', $admin_script_path . 'tourbus' . $suffix . '.js', array('jquery'), WC_GERMANIZED_VERSION, true);
wp_register_script('wc-gzd-admin-tour', $admin_script_path . 'tour' . $suffix . '.js', array('jquery', 'woocommerce_settings', 'tourbus'), WC_GERMANIZED_VERSION, true);
if (isset($_GET['tab']) && $_GET['tab'] == 'germanized') {
wp_enqueue_script('wc-gzd-admin');
$section = 'general';
if (isset($_GET['section'])) {
$section = sanitize_text_field($_GET['section']);
}
if ($this->is_tour_enabled($section)) {
wp_enqueue_script('scrollto');
wp_enqueue_script('tourbus');
wp_enqueue_script('wc-gzd-admin-tour');
wp_enqueue_style('tourbus');
}
}
if (isset($_GET['section']) && !empty($_GET['section']) && strpos($_GET['section'], 'gzd_') !== false) {
wp_enqueue_script('wc-gzd-admin-emails');
}
// Hide delivery time and unit tagsdiv
if (version_compare(WC()->version, '2.3', '>=')) {
wp_add_inline_style('woocommerce-gzd-admin', '#tagsdiv-product_delivery_time, #tagsdiv-product_unit {display: none}');
}
}
示例3: output
public static function output()
{
global $post, $thepostid;
$thepostid = $post->ID;
$_product = wc_get_product($thepostid);
$terms = array();
woocommerce_wp_select(array('id' => '_unit', 'label' => __('Unit', 'woocommerce-germanized'), 'options' => array_merge(array('none' => __('Select unit', 'woocommerce-germanized')), WC_germanized()->units->get_units()), 'desc_tip' => true, 'description' => __('Needed if selling on a per unit basis', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_product', 'label' => __('Product Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Number of units included per default product price. Example: 1000 ml.', 'woocommerce-germanized')));
woocommerce_wp_text_input(array('id' => '_unit_base', 'label' => __('Base Price Units', 'woocommerce-germanized'), 'data_type' => 'decimal', 'desc_tip' => true, 'description' => __('Base price units. Example base price: 0,99 € / 100 ml. Insert 100 as base price unit amount.', 'woocommerce-germanized')));
woocommerce_wp_checkbox(array('id' => '_unit_price_auto', 'label' => __('Calculation', 'woocommerce-germanized'), 'description' => '<span class="wc-gzd-premium-desc">' . __('Calculate base prices automatically.', 'woocommerce-germanized') . '</span> <a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="wc-gzd-pro">pro</a>'));
woocommerce_wp_text_input(array('id' => '_unit_price_regular', 'label' => __('Regular Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
woocommerce_wp_text_input(array('id' => '_unit_price_sale', 'label' => __('Sale Base Price', 'woocommerce-germanized') . ' (' . get_woocommerce_currency_symbol() . ')', 'data_type' => 'price'));
}
示例4: admin_options
public function admin_options()
{
?>
<h3><?php
echo !empty($this->method_title) ? $this->method_title : __('Settings', 'woocommerce');
?>
</h3>
<?php
echo !empty($this->method_description) ? wpautop($this->method_description) : '';
?>
<?php
if (!WC_germanized()->is_pro()) {
?>
<div class="wc-gzd-premium-overlay notice notice-warning inline">
<h3><?php
_e('Automatically generate PDF invoices for this gateway?', 'woocommerce-germanized');
?>
</h3>
<p><?php
_e('By upgrading to the professional version you\'ll be able to automatically generate PDF invoices to this payment gateway. Furthermore you\'ll benefit from even more professional features such as a multistep checkout page, legal text generators, B2B VAT settings and premium support!', 'woocommerce-germanized');
?>
</p>
<p>
<a class="button button-primary" href="https://vendidero.de/woocommerce-germanized" target="_blank"><?php
_e('Upgrade now', 'woocommerce-germanized');
?>
</a>
<a class="button button-secondary" style="margin-left: 1em" href="https://vendidero.de/woocommerce-germanized#accounting" target="_blank"><?php
_e('Learn more about PDF invoicing', 'woocommerce-germanized');
?>
</a>
</p>
</div>
<?php
}
?>
<table class="form-table">
<?php
$this->generate_settings_html();
?>
</table><?php
}
示例5: set_language
public function set_language($lang)
{
global $sitepress, $woocommerce;
$sitepress->switch_lang($lang, true);
$this->locale = $sitepress->get_locale($lang);
add_filter('plugin_locale', array($this, 'set_locale'), 10, 2);
unload_textdomain('woocommerce');
unload_textdomain('woocommerce-germanized');
unload_textdomain('woocommerce-germanized-pro');
unload_textdomain('default');
$woocommerce->load_plugin_textdomain();
WC_germanized()->load_plugin_textdomain();
do_action('woocommerce_gzd_wpml_lang_changed', $lang);
load_default_textdomain();
global $wp_locale;
$wp_locale = new WP_Locale();
}
示例6: settings_page_scroll_top
public function settings_page_scroll_top()
{
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
$assets_path = WC_germanized()->plugin_url() . '/assets/';
wp_register_style('woocommerce-gzd-admin', $assets_path . 'css/woocommerce-gzd-admin' . $suffix . '.css', false, WC_germanized()->version);
wp_enqueue_style('woocommerce-gzd-admin');
$admin_script_path = $assets_path . 'js/admin/';
if (isset($_GET['tab']) && $_GET['tab'] == 'germanized') {
wp_enqueue_script('wc-gzd-admin', $admin_script_path . 'settings' . $suffix . '.js', array('jquery', 'woocommerce_settings'), WC_GERMANIZED_VERSION, true);
}
if (isset($_GET['section']) && !empty($_GET['section']) && strpos($_GET['section'], 'gzd') !== false) {
wp_enqueue_script('wc-gzd-admin-emails', $admin_script_path . 'emails' . $suffix . '.js', array('jquery', 'woocommerce_settings'), WC_GERMANIZED_VERSION, true);
}
// Hide delivery time and unit tagsdiv
if (version_compare(WC()->version, '2.3', '>=')) {
wp_add_inline_style('woocommerce-gzd-admin', '#tagsdiv-product_delivery_time, #tagsdiv-product_unit {display: none}');
}
}
示例7: add_admin_assets
public function add_admin_assets()
{
$screen = get_current_screen();
wp_enqueue_style('wc-gzdp-admin', WC_germanized_pro()->plugin_url() . '/assets/css/admin/wc-gzdp-admin' . $this->suffix . '.css', array(), WC_GERMANIZED_PRO_VERSION);
if (in_array($screen->id, array('shop_order', 'edit-shop_order'))) {
// Invoice JS
wp_enqueue_script('wc-gzdp-admin-invoice', WC_germanized_pro()->plugin_url() . '/assets/js/admin/invoice' . $this->suffix . '.js', array('jquery'), WC_GERMANIZED_PRO_VERSION, true);
// Order JS
wp_enqueue_script('wc-gzdp-admin-order', WC_germanized_pro()->plugin_url() . '/assets/js/admin/order' . $this->suffix . '.js', array('jquery'), WC_GERMANIZED_PRO_VERSION, true);
} else {
if ($screen->id == 'woocommerce_page_wc-settings') {
wp_enqueue_media();
wp_enqueue_style('wc-gzd-fontawesome', WC_germanized()->plugin_url() . '/assets/css/font-awesome.min.css', array(), WC_GERMANIZED_VERSION);
wp_register_script('wc-gzdp-admin-settings', WC_germanized_pro()->plugin_url() . '/assets/js/admin/settings' . $this->suffix . '.js', array('jquery'), WC_GERMANIZED_PRO_VERSION, true);
wp_localize_script('wc-gzdp-admin-settings', 'wc_gzdp_attachment_field', array('title' => _x('Choose Attachment', 'admin-field', 'woocommerce-germanized-pro'), 'insert' => _x('Set attachment', 'admin-field', 'woocommerce-germanized-pro'), 'unset' => _x('Unset attachment', 'admin-field', 'woocommerce-germanized-pro'), 'ajax_url' => admin_url('admin-ajax.php')));
wp_localize_script('wc-gzdp-admin-settings', 'wc_gzdp', array('ajax_url' => admin_url('admin-ajax.php')));
wp_enqueue_script('wc-gzdp-admin-settings');
}
}
do_action('woocommerce_gzdp_admin_assets');
}
示例8: get_sidebar
public function get_sidebar()
{
return '<div class="wc-gzd-admin-settings-sidebar"><h3>' . _x('About Trusted Shops', 'trusted-shops', 'woocommerce-germanized') . '</h3><a href="' . $this->get_trusted_url('integration/', 'membership') . '" target="_blank"><img style="width: 100%; height: auto" src="' . WC_germanized()->plugin_url() . '/assets/images/trusted-shops-b.png" /></a></div>';
}
示例9: intro
/**
* Into text/links shown on all about pages.
*
* @access private
* @return void
*/
private function intro()
{
// Flush after upgrades
if (!empty($_GET['wc-gzd-updated']) || !empty($_GET['wc-gzd-installed'])) {
flush_rewrite_rules();
}
// Drop minor version if 0
$major_version = substr(WC_germanized()->version, 0, 3);
?>
<div class="wc-gzd-news">
<h1>Willkommen bei WooCommerce Germanized</h1>
<a class="wc-gzd-logo" href="https://vendidero.de/woocommerce-germanized" target="_blank" style="margin-right: 1em"></a>
<div class="about-text woocommerce-about-text">
<?php
if (!empty($_GET['wc-gzd-installed'])) {
$message = 'Super, alles erledigt!';
} elseif (!empty($_GET['wc-gzd-updated'])) {
$message = 'Danke, dass du auf die neueste Version aktualisiert hast!';
} else {
$message = 'Danke für die Installation!';
}
echo $message . '<br/>';
?>
WooCommerce Germanized <?php
echo $major_version;
?>
erweitert deine WooCommerce Installation um wichtige Funktionen für den deutschen Markt.</p>
</div>
<p class="woocommerce-actions wc-gzd-actions">
<a href="<?php
echo admin_url('admin.php?page=wc-settings&tab=germanized');
?>
" class="button button-primary">Einstellungen</a>
<a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="button button-primary">Upgrade zur Pro Version</a>
<span class="wc-gzd-fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvendidero.de%2Fwoocommerce-germanized&width&layout=button&action=recommend&show_faces=false&share=false&height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px;" allowTransparency="true"></iframe>
</span>
</p>
<div class="changelog vendipro new-feature">
<h3>Neu: Rechtliche Hinweistexte als PDF-Anhang <span class="wc-gzd-pro">pro</span></h3>
<div class="left">
<a href="https://vendidero.de/woocommerce-germanized#legal-page" target="_blank"><img src="<?php
echo WC_germanized()->plugin_url();
?>
/assets/images/legal-page.png" style="border: none" /></a>
</div>
<div class="right">
<p>
Deine E-Mails sind aufgrund deiner AGB und Widerrufsbelehrung ziemlich lang? Große und bekannte Shops senden die rechtlichen Hinweistexte einfach als PDF-Anhang.
Für <span class="wc-gzd-pro">pro</span> User haben wir diese Funktionalität nun auch implementiert. Generiere entweder automatisch PDF-Dateien auf Basis deiner rechtlichen Hinweisseiten oder lade manuell eine PDF-Datei hoch, die als Anhang verwendet werden soll.
</p>
<div class="wc-feature wc-vendipro-features feature-section col two-col">
<div>
<h4><i class="fa fa-magic"></i> Layout Einstellungen</h4>
<p>Flexibles PDF-Layout für automatisch erstellte PDF-Anhänge - ähnlich wie bei Rechnungen & Lieferscheinen.</p>
</div>
<div class="last-feature">
<h4><i class="fa fa-refresh"></i> Aktualisierung</h4>
<p>Sobald du eine Hinweisseite speicherst, wird deine PDF-Datei automatisch aktualisiert.</p>
</div>
</div>
<div class="vendipro-buttons">
<a href="https://vendidero.de/woocommerce-germanized#pro" target="_blank" class="button button-primary wc-gzd-button">Pro Version entdecken</a>
<p class="price smaller">ab 69,95 € inkl. Mwst. - inkl. 1 Jahr Updates & Premium Support!</p>
</div>
</div>
</div>
<div class="changelog vendipro new-feature">
<h3>Mehrstufige Kasse mit Datenüberprüfung <span class="wc-gzd-pro">pro</span></h3>
<div class="left">
<a href="https://vendidero.de/woocommerce-germanized#multistep-checkout" target="_blank"><img src="<?php
echo WC_germanized()->plugin_url();
?>
/assets/images/multistep-checkout.png" /></a>
</div>
<div class="right">
<p>
Du möchtest deinen Checkout in mehrere Stufen aufteilen? Mit diesem neuen Feature ist das kein Problem mehr.
Nutze ähnlich wie andere große deutsche Shops die Schritte Persönliche Daten, Zahlungsart und Bestätigen. Im Bestätigungs-Schritt
werden dem Kunden alle Eingaben noch einmal aufgeführt.
</p>
<div class="wc-feature wc-vendipro-features feature-section col two-col">
<div>
<h4><i class="fa fa-paint-brush"></i> Läuft mit deinem Theme</h4>
<p>Die mehrstufige Kasse kommt ganz ohne Überschreiben von WooCommerce Templates aus.</p>
</div>
<div class="last-feature">
<h4><i class="fa fa-adjust"></i> Farben & Optionen</h4>
<p>Passe sowohl Farben als auch Beschriftungen einfach in den Einstellungen an.</p>
</div>
<div>
<h4><i class="fa fa-check"></i> Daten Prüfen</h4>
<p>Lasse deine Kunden im letzten Schritt ihre Daten vor Bestellabschluss prüfen und u.U. korrigieren.</p>
//.........这里部分代码省略.........
示例10: intro
/**
* Into text/links shown on all about pages.
*
* @access private
* @return void
*/
private function intro()
{
// Flush after upgrades
if (!empty($_GET['wc-gzd-updated']) || !empty($_GET['wc-gzd-installed'])) {
flush_rewrite_rules();
}
// Drop minor version if 0
$major_version = substr(WC_germanized()->version, 0, 3);
?>
<h1>Willkommen bei WooCommerce Germanized</h1>
<a class="wc-gzd-logo" href="https://vendidero.de/woocommerce-germanized" target="_blank" style="margin-right: 1em"></a>
<div class="about-text woocommerce-about-text">
<?php
if (!empty($_GET['wc-gzd-installed'])) {
$message = 'Super, alles erledigt!';
} elseif (!empty($_GET['wc-gzd-updated'])) {
$message = 'Danke, dass du auf die neueste Version aktualisiert hast!';
} else {
$message = 'Danke für die Installation!';
}
echo $message . '<br/>';
?>
WooCommerce Germanized <?php
echo $major_version;
?>
erweitert deine WooCommerce Installation um wichtige Funktionen für den deutschen Markt.</p>
</div>
<p class="woocommerce-actions wc-gzd-actions">
<a href="<?php
echo admin_url('admin.php?page=wc-settings&tab=germanized');
?>
" class="button button-primary">Einstellungen</a>
<a href="https://vendidero.de/woocommerce-germanized#buy" target="_blank" class="button button-primary">Upgrade zur Pro Version</a>
<span class="wc-gzd-fb">
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvendidero.de%2Fwoocommerce-germanized&width&layout=button&action=recommend&show_faces=false&share=false&height=20" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:20px;" allowTransparency="true"></iframe>
</span>
</p>
<div class="changelog vendipro new-feature">
<h3>Neu: Mehrstufige Kasse mit Datenüberprüfung <span class="wc-gzd-pro">pro</span></h3>
<div class="left">
<a href="https://vendidero.de/woocommerce-germanized#multistep-checkout" target="_blank"><img src="<?php
echo WC_germanized()->plugin_url();
?>
/assets/images/multistep-checkout.png" /></a>
</div>
<div class="right">
<p>
Du möchtest deinen Checkout in mehrere Stufen aufteilen? Mit diesem neuen Feature ist das kein Problem mehr.
Nutze ähnlich wie andere große deutsche Shops die Schritte Persönliche Daten, Zahlungsart und Bestätigen. Im Bestätigungs-Schritt
werden dem Kunden alle Eingaben noch einmal aufgeführt.
</p>
<div class="wc-feature wc-vendipro-features feature-section col two-col">
<div>
<h4><i class="fa fa-paint-brush"></i> Läuft mit deinem Theme</h4>
<p>Die mehrstufige Kasse kommt ganz ohne Überschreiben von WooCommerce Templates aus.</p>
</div>
<div class="last-feature">
<h4><i class="fa fa-adjust"></i> Farben & Optionen</h4>
<p>Passe sowohl Farben als auch Beschriftungen einfach in den Einstellungen an.</p>
</div>
<div>
<h4><i class="fa fa-check"></i> Daten Prüfen</h4>
<p>Lasse deine Kunden im letzten Schritt ihre Daten vor Bestellabschluss prüfen und u.U. korrigieren.</p>
</div>
<div class="last-feature">
<h4><i class="fa fa-refresh"></i> Kein Neuladen</h4>
<p>Die Mehrstufige Kasse funktioniert komplett per Javascript. Inhalte werden asynchron nachgeladen.</p>
</div>
</div>
<div class="vendipro-buttons">
<a href="https://vendidero.de/woocommerce-germanized#pro" target="_blank" class="button button-primary wc-gzd-button">Pro Version entdecken</a>
<p class="price smaller">ab 69,95 € inkl. Mwst. - inkl. 1 Jahr Updates & Premium Support!</p>
</div>
</div>
</div>
<div class="changelog vendipro">
<h3>VendiPro - Das WooCommerce Theme für den deutschen Markt</h3>
<div class="left">
<a href="https://vendidero.de/vendipro" target="_blank"><img src="<?php
echo WC_germanized()->plugin_url();
?>
/assets/images/vendidero.jpg" /></a>
</div>
<div class="right">
<p>Endlich ist es soweit - Ein WooCommerce Theme, perfekt auf den deutschen Markt abgestimmt.
Mit <a href="https://vendidero.de/vendipro" target="_blank">VendiPro</a> wirken alle WooCommerce & WooCommerce Germanized Inhalte einfach noch professioneller.</p>
<div class="wc-feature wc-vendipro-features feature-section col two-col">
<div>
<h4><i class="fa fa-mobile"></i> Responsive Layout</h4>
<p>VendiPro hinterlässt sowohl auf Desktop- als auch auf Mobilgeräten einen klasse Eindruck!</p>
</div>
<div class="last-feature">
<h4><i class="fa fa-pencil"></i> Individualität</h4>
<p>Passe VendiPro einfach per WordPress Theme Customizer an deine Bedürfnisse an.</p>
//.........这里部分代码省略.........
示例11: WC_germanized
<?php
/**
* Trusted Shops Rich Snippets HTML
*
* @author Vendidero
* @package WooCommerceGermanized/Templates
* @version 1.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
?>
<?php
echo WC_germanized()->trusted_shops->get_average_rating_html();
示例12: _e
?>
</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0" id="status">
<thead>
<tr>
<th colspan="3" data-export-label="Templates"><?php
_e('Templates', 'woocommerce');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$template_paths = apply_filters('woocommerce_gzd_template_overrides_scan_paths', array('WooCommerce Germanized' => WC_germanized()->plugin_path() . '/templates/'));
$scanned_files = array();
$found_files = array();
$outdated_templates = false;
foreach ($template_paths as $plugin_name => $template_path) {
$scanned_files[$plugin_name] = WC_Admin_Status::scan_template_files($template_path);
}
foreach ($scanned_files as $plugin_name => $files) {
$plugin_subfolder = sanitize_title($plugin_name);
foreach ($files as $file) {
if (strpos($file, '.php') === false) {
continue;
}
if (file_exists(get_stylesheet_directory() . '/' . $file)) {
$theme_file = get_stylesheet_directory() . '/' . $file;
} elseif (file_exists(get_stylesheet_directory() . '/' . $plugin_subfolder . '/' . $file)) {
示例13: gzd_revocation
/**
* Checks revocation form and sends Email to customer and Admin
*/
public static function gzd_revocation()
{
check_ajax_referer('woocommerce-revocation', 'security');
wp_verify_nonce($_POST['_wpnonce'], 'woocommerce-revocation');
$data = array();
$fields = WC_GZD_Revocation::get_fields();
if (!empty($fields)) {
foreach ($fields as $key => $field) {
if ($key != 'sep') {
if ($key == 'address_mail') {
if (!is_email($_POST[$key])) {
wc_add_notice('<strong>' . $field['label'] . '</strong> ' . _x('is not a valid email address.', 'revocation-form', 'woocommerce-germanized'), 'error');
}
} elseif ($key == 'address_postal') {
if (!WC_Validation::is_postcode($_POST[$key], $_POST['address_country']) || empty($_POST[$key])) {
wc_add_notice(_x('Please enter a valid postcode/ZIP', 'revocation-form', 'woocommerce-germanized'), 'error');
}
} else {
if (isset($field['required']) && empty($_POST[$key])) {
wc_add_notice('<strong>' . $field['label'] . '</strong> ' . _x('is not valid.', 'revocation-form', 'woocommerce-germanized'), 'error');
}
}
if (!empty($_POST[$key])) {
if ($field['type'] == 'country') {
$countries = WC()->countries->get_countries();
$data[$key] = $countries[sanitize_text_field($_POST[$key])];
} else {
$data[$key] = sanitize_text_field($_POST[$key]);
}
}
}
}
}
$error = false;
if (wc_notice_count('error') == 0) {
wc_add_notice(_x('Thank you. We have received your Revocation Request. You will receive a conformation email within a few minutes.', 'revocation-form', 'woocommerce-germanized'), 'success');
// Send Mail
if ($mail = WC_germanized()->emails->get_email_instance_by_id('customer_revocation')) {
$mail->trigger($data);
// Send to Admin
$data['mail'] = get_bloginfo('admin_email');
$mail->trigger($data);
}
} else {
$error = true;
}
ob_start();
wc_print_notices();
$messages = ob_get_clean();
if ($error) {
echo '<!--WC_START-->' . json_encode(array('result' => 'failure', 'messages' => isset($messages) ? $messages : '')) . '<!--WC_END-->';
} else {
if (is_ajax()) {
echo '<!--WC_START-->' . json_encode(array('result' => 'success', 'messages' => isset($messages) ? $messages : '')) . '<!--WC_END-->';
}
}
exit;
}
示例14: is_theme_compatible
/**
* Checks if current theme is woocommerce germanized compatible
*
* @return boolean
*/
public function is_theme_compatible()
{
$templates_to_check = WC_germanized()->get_critical_templates();
if (!empty($templates_to_check)) {
foreach ($templates_to_check as $template) {
$template_path = trailingslashit('woocommerce') . $template;
$theme_template = locate_template(array($template_path, $template));
if ($theme_template) {
return false;
}
}
}
return true;
}
示例15: update_db_version
/**
* Update DB version to current
*/
private static function update_db_version($version = null)
{
delete_option('woocommerce_gzd_db_version');
add_option('woocommerce_gzd_db_version', is_null($version) ? WC_germanized()->version : $version);
}