is_plugin_active( 'woocommerce/woocommerce.php' ) ) { return; } // Set up localisation load_plugin_textdomain( 'agreeme-checkbox-for-woocommerce', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); // Include required files $this->includes(); // Admin if ( is_admin() ) { $this->admin(); } } /** * is_plugin_active. * * @version 1.4.0 * @since 1.4.0 */ function is_plugin_active( $plugin ) { return ( function_exists( 'is_plugin_active' ) ? is_plugin_active( $plugin ) : ( in_array( $plugin, apply_filters( 'active_plugins', ( array ) get_option( 'active_plugins', array() ) ) ) || ( is_multisite() && array_key_exists( $plugin, ( array ) get_site_option( 'active_sitewide_plugins', array() ) ) ) ) ); } /** * Include required core files used in admin and on the frontend. * * @version 1.1.0 * @since 1.0.0 */ function includes() { // Functions require_once( 'inc/agrwc-functions.php' ); // Main require_once( 'inc/classes/agrwc-main.php' ); } /** * @version 1.0.2 * @since 1.0.0 */ public static function agrwc_activate() { ////////////// check for options............and add basic options if(get_option('agrwc_enabled', false)){ } else { add_option('agrwc_enabled', 'yes'); add_option('agrwc_buttonclasses', 'yes'); add_option('agrwc_formclasses', 'yes'); add_option('agrwc_alertmsg', 'yes'); } } /** * alg_wc_ccf_get_default_date_format. * * @version 1.0.2 * @since 1.0.0 */ public static function agrwc_deactivate() { ////////////// ////////////// remove options } /** * alg_wc_ccf_get_default_date_format. * * @version 1.0.2 * @since 1.0.0 */ public static function agrwc_uninstall() { ////////////// ////////////// remove options delete_option('agrwc_enabled'); delete_option('agrwc_buttonclasses'); delete_option('agrwc_formclasses'); delete_option('agrwc_alertmsg'); } /** * admin. * * @version 1.0.2 * @since 1.0.0 */ function admin() { // Action links add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'action_links' ) ); // Settings add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_woocommerce_settings_tab' ) ); // Version update if ( agrwc_get_option( 'version', '' ) !== AGR_WC_VERSION ) { add_action( 'admin_init', array( $this, 'version_updated' ) ); } } /** * Show action links on the plugin screen. * * @version 1.1.0 * @since 1.0.0 * @param mixed $links * @return array */ function action_links( $links ) { $custom_links = array(); $custom_links[] = '' . __( 'Settings', 'woocommerce' ) . ''; return array_merge( $custom_links, $links ); } /** * Add Custom Checkout Fields settings tab to WooCommerce settings. * * @version 1.0.2 * @since 1.0.0 */ function add_woocommerce_settings_tab( $settings ) { $settings[] = require_once( 'inc/options/agrwc-settings-cbx.php' ); return $settings; } /** * version_updated. * * @version 1.0.2 * @since 1.0.0 */ function version_updated() { update_option( AGR_WC_ID . '_' . 'version', AGR_WC_VERSION ); } /** * Get the plugin url. * * @version 1.0.2 * @since 1.0.0 * @return string */ public static function plugin_url() { return untrailingslashit( plugin_dir_url( __FILE__ ) ); } /** * Get the plugin path. * * @version 1.0.2 * @since 1.0.0 * @return string */ public static function plugin_path() { return untrailingslashit( plugin_dir_path( __FILE__ ) ); } } endif; if ( ! function_exists( 'agrwc_checkbox_fields' ) ) { /** * Returns the main instance of AGR_WC. * * @version 1.0.2 * @since 1.0.0 * @return AGR_WC */ function agrwc_checkbox_fields() { return AGR_WC::instance(); } return agrwc_checkbox_fields(); }