PluginProbe
Additional Terms Lite for WooCommerce / 1.0.1
Additional Terms Lite for WooCommerce v1.0.1
1.7.3 1.7.2.1 trunk 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.6.2 1.6.3 All 35 releases
woo-additional-terms / includes / WooAdditionalTerms.php

WooAdditionalTerms.php in Additional Terms Lite for WooCommerce 1.0.1, at includes/WooAdditionalTerms.php

78 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Woo Additional Terms Class.
4 *
5 * @author Mahdi Yazdani
6 * @package Woo Additional Terms
7 * @since 1.0
8 */
9 // Prevent direct file access
10 if ( ! defined( 'ABSPATH' ) ) exit;
11 if ( !class_exists( 'WooAdditionalTerms' ) ) :
12 class WooAdditionalTerms {
13 private $file;
14 public function __construct($file) {
15 $this->file = $file;
16 add_action( 'woocommerce_payment_gateways_settings', array( $this, 'woo_additional_terms_setting' ), 10 );
17 add_filter( 'plugin_action_links_' . plugin_basename( $this->file ), array( $this, 'woo_additional_terms_settings_link' ), 10 );
18 }
19 public function woo_additional_terms_setting( $settings ) {
20 $updated_settings = array();
21 foreach ( $settings as $section ) :
22 if ( isset( $section['id'] ) && 'checkout_page_options' == $section['id'] && isset( $section['type'] ) && 'sectionend' == $section['type'] ) :
23 $updated_settings[] = array(
24 'name' => __( 'Additional Terms', 'woo-additional-terms' ),
25 'desc' => __( 'If you define a "Additional Terms" page the customer will be asked if they accept them when checking out.', 'woo-additional-terms' ),
26 'id' => 'woo_additional_terms_page',
27 'default' => '',
28 'class' => 'wc-enhanced-select-nostd',
29 'css' => 'min-width:300px;',
30 'type' => 'single_select_page',
31 'desc_tip' => true,
32 'autoload' => false
33 );
34 $updated_settings[] = array(
35 'title' => __( 'Additional Terms Title', 'woo-additional-terms' ),
36 'desc' => __( 'Enter you custom title for additional terms, the title will appear in link shortcode and order details page.', 'woo-additional-terms' ),
37 'id' => 'woo_additional_terms_title',
38 'type' => 'text',
39 'default' => '',
40 'desc_tip' => true,
41 'css' => 'min-width:350px;'
42 );
43 $updated_settings[] = array(
44 'title' => __( 'Additional Terms Notice', 'woo-additional-terms' ),
45 'desc' => __( 'Use %link% for appending terms page link into notice content.', 'woo-additional-terms' ),
46 'id' => 'woo_additional_terms_notice',
47 'type' => 'text',
48 'default' => '',
49 'desc_tip' => __( 'Enter you custom notice for additional terms, the customer will be asked if they accept them when checking out.', 'woo-additional-terms' ),
50 'css' => 'min-width:350px;'
51 );
52 $updated_settings[] = array(
53 'title' => __( 'Additional Terms Notice Error', 'woo-additional-terms' ),
54 'desc' => __( 'Display friendly notice whenever customer doesn\'t accept additional terms.', 'woo-additional-terms' ),
55 'id' => 'woo_additional_terms_notice_error',
56 'type' => 'text',
57 'default' => __('You must accept our additional terms.', 'woo-additional-terms'),
58 'desc_tip' => true,
59 'css' => 'min-width:350px;'
60 );
61 endif;
62 $updated_settings[] = $section;
63 endforeach;
64 return $updated_settings;
65 }
66 /**
67 * Display plugin settings link in plugins table page.
68 *
69 *@since 1.0
70 */
71 public function woo_additional_terms_settings_link($links) {
72 // Add settings link to plugin list table
73 $settings_link = '<a href="admin.php?page=wc-settings&tab=checkout">' . __( 'Settings', 'woocommerce-store-vacation' ) . '</a>';
74 array_push( $links, $settings_link );
75 return $links;
76 }
77 }
78 endif;