PATH:
home
/
letacommog
/
laindinois
/
wp-content
/
plugins
/
woocommerce-pdf-vouchers
/
includes
/
compatibility
<?php // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; /** * WC Vendor Class. To enhance compatibility with WC Vendor plugin. * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ class WOO_Vou_WC_Vendor { public function __construct() { } /** * Modify WC Vendor Pro Role Array * * Handle to modify settings array * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function woo_vou_wcvendor_settings( $settings ) { array_push($settings,array( 'name' => esc_html__( 'WC Vendor Settings', 'woovoucher' ), 'type' => 'title', 'desc' => '', 'id' => 'vou_wc_vendor_settings' ), array( 'id' => 'vou_enable_auto_integrate_wc_vendor', 'name' => esc_html__( 'Auto Integrate vendor with PDF Voucher', 'woovoucher' ), 'desc' => esc_html__( 'Auto Integrate vendor with PDF Voucher', 'woovoucher' ), 'type' => 'checkbox', 'desc_tip' => '<p class="description">' . esc_html__( 'Check this box if you want to integrate WC Vendors with PDF Vouchers.', 'woovoucher' ) . '</p>', 'default' => 'yes' ), array( 'id' => 'vou_enable_vendor_acess_pdf_vou_frontend', 'name' => esc_html__( 'Enable Access to PDF Vouchers tab', 'woovoucher' ), 'desc' => esc_html__( 'Enable Access to PDF Vouchers tab', 'woovoucher' ), 'type' => 'checkbox', 'desc_tip' => '<p class="description">' . esc_html__( 'Check this box if you want to allow vendors to access PDF Vouchers on add/edit product page on frontend and backend.', 'woovoucher' ) . '</p>', 'default' => 'yes' ), array( 'type' => 'sectionend', 'id' => 'vou_wc_vendor_settings' )); return $settings; } /** * Add Capability to vendor role * * Handle to add capability to vendor role * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function woo_vou_wcvendor_initilize_role_capabilities() { global $woo_vou_vendor_role; foreach ($woo_vou_vendor_role as $vendor_role) { //get vendor role $vendor_role_obj = get_role($vendor_role); if (!empty($vendor_role_obj)) { // If vendor role is exist if (!$vendor_role_obj->has_cap(WOO_VOU_VENDOR_LEVEL)) { //If capabilty not exist //Add vucher level capability to vendor roles $vendor_role_obj->add_cap(WOO_VOU_VENDOR_LEVEL); } } } } /** * Modify Vendor Role Array * * Handle to modify vendor role array * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function woo_vou_wcvendor_append_voucher_role( $woo_vou_roles ) { // Get global options $vou_enable_auto_integrate_wc_vendor = get_option('vou_enable_auto_integrate_wc_vendor'); // add wc vendor as voucher vendor if( empty( $vou_enable_auto_integrate_wc_vendor ) || $vou_enable_auto_integrate_wc_vendor == 'yes' ) { $woo_vou_roles[] = 'vendor'; } return $woo_vou_roles; } /** * Modify Vendor shopname * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function woo_vou_wcvendor_voucher_shopname( $vendor_shopname, $vendor_user ) { // Get vendor's shop name $vendor_shopname = get_user_meta($vendor_user, 'pv_shop_name', true); return $vendor_shopname; } /** * Preview PDF - Replace shortcode with value * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function woo_vou_wcvendor_voucher_shopname_pdf_preview_shortcode( $vendor_shopname ) { // Get vendor's shop name $vendor_shopname = esc_html__('Vendor Shop', 'woovoucher'); return $vendor_shopname; } /** * Handles to hide PDF Vouchers tab * * Function handles to hide PDF Vouchers tab on product add/edit page * for vendor when WC Vendor is activated * * @package WooCommerce - PDF Vouchers * @since 3.3.0 */ public function woo_vou_wcvendor_remove_pdf_vou_tab() { global $woo_vou_admin_meta; $user_id = get_current_user_id(); // Get current user $vou_enable_vendor_acess_pdf_vou_frontend = get_option('vou_enable_vendor_acess_pdf_vou_frontend'); // Get global option // If option is not empty and set to no if ( WCV_Vendors::is_vendor($user_id) && !empty($vou_enable_vendor_acess_pdf_vou_frontend) && $vou_enable_vendor_acess_pdf_vou_frontend == 'no') { // Remove PDF Vouchers tab remove_action('woocommerce_product_write_panel_tabs', array($woo_vou_admin_meta, 'woo_vou_product_write_panel_tab')); } } /** * Adding Hooks * * Adding proper hooks for Vendor. * * @package WooCommerce - PDF Vouchers * @since 3.8.2 */ public function add_hooks(){ // Append the settings array add_filter( 'woo_vou_misc_settings', array( $this, 'woo_vou_wcvendor_settings' ) ); // add capabilities to user roles add_action('init', array($this, 'woo_vou_wcvendor_initilize_role_capabilities' ), 100 ); // Append the pdf voucher role add_filter( 'woo_vou_edit_vendor_role', array($this, 'woo_vou_wcvendor_append_voucher_role' ) ); // Modify Vendor shopname add_filter( 'woo_vou_shopname_pdf_preview', array($this, 'woo_vou_wcvendor_voucher_shopname' ), 10, 2 ); add_filter( 'woo_vou_shopname_pdf_process', array($this, 'woo_vou_wcvendor_voucher_shopname' ), 10, 2 ); // Preview PDF - Replace shortcode with value add_filter( 'woo_vou_vendor_shopname_pdf_preview_shortcode', array($this, 'woo_vou_wcvendor_voucher_shopname_pdf_preview_shortcode' ) ); // add metabox in products add_action('admin_init', array($this, 'woo_vou_wcvendor_remove_pdf_vou_tab')); } }
[+]
..
[-] class-woo-vou-your-price.php
[edit]
[-] class-woo-vou-wedevs-dokan.php
[edit]
[-] class-woo-vou-order-sms.php
[edit]
[-] class-woo-vou-booking.php
[edit]
[-] class-woo-vou-qtranslate-x.php
[edit]
[-] class-woo-vou-wpml.php
[edit]
[-] class-woo-vou-vendor-pro.php
[edit]
[-] class-woo-vou-eml.php
[edit]
[-] class-woo-vou-vendor.php
[edit]
[-] class-woo-vou-wcmp.php
[edit]
[-] class-woo-vou-bundles.php
[edit]
[-] class-woo-vou-currency-switcher.php
[edit]