Plugin Directory

Changeset 3042938


Ignore:
Timestamp:
02/29/2024 08:19:07 AM (2 years ago)
Author:
contractorcommerce
Message:

Replace duplicated checks with a function

Location:
contractor-commerce-integration/tags/1.0.9
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • contractor-commerce-integration/tags/1.0.9/README.txt

    r3042726 r3042938  
    11=== Contractor Commerce Integration ===
    2 Contributors: pjhile
     2Contributors: pjhile, kirilldakhnyuk
    33Tags: ecommerce, hvac, contractor
    44Requires at least: 3.0.1
    55Tested up to: 6.3
    6 Stable tag: 1.0.9
     6Stable tag: 1.1.0
    77Requires PHP: 7.0
    88License: GPLv2 or later
  • contractor-commerce-integration/tags/1.0.9/contractor-commerce.php

    r3042726 r3042938  
    1717 * Plugin URI:        https://bitbucket.org/hvactechnologies/contractor-commerce-integration
    1818 * Description:       Adds Contractor Commerce to your site.
    19  * Version:           1.0.9
     19 * Version:           1.1.0
    2020 * Author:            Contractor Commerce
    2121 * Author URI:        https://www.contractorcommerce.com/
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define( 'CONTRACTOR_COMMERCE_VERSION', '1.0.9' );
     40define( 'CONTRACTOR_COMMERCE_VERSION', '1.1.0' );
    4141
    4242/**
     
    8383}
    8484
    85 function contractor_commerce_exlude_query_vars( $query_vars ) {
    86     if ( get_option( 'concom_settings' ) && ! isset(get_option( 'concom_settings' )['concom_select_field_1']) ) {
    87         return $query_vars;
     85function isPluginSetup ( $defaultReturn = null ) {
     86    if ( get_option( 'concom_settings' ) && ! isset( get_option( 'concom_settings' )['concom_select_field_1'] ) ) {
     87        return $defaultReturn;
    8888    }
    8989   
    9090    if ( ! isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
    91         return $query_vars;
     91        return $defaultReturn;
    9292    }
     93}
     94
     95function contractor_commerce_exlude_query_vars( $query_vars ) {
     96    isPluginSetup( $query_vars );
    9397   
    9498    $uri = get_page_uri( get_option( 'concom_settings' )['concom_select_field_1']);
     
    104108
    105109function contractor_commerce_rewrite_rules() {
    106     if ( get_option( 'concom_settings' ) && ! isset(get_option( 'concom_settings' )['concom_select_field_1']) ) {
    107         return;
    108     }
    109    
    110     if ( ! isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
    111         return;
    112     }
     110    isPluginSetup();
    113111   
    114112    $shop_page_name = get_post(get_option( 'concom_settings' )['concom_select_field_1'])->post_name;
     
    120118
    121119add_action ( 'init', function () { 
    122     if ( get_option( 'concom_settings' ) && ! isset(get_option( 'concom_settings' )['concom_select_field_1']) ) {
    123         return;
    124     }
    125    
    126     if ( ! isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
    127         return;
    128     }
     120    isPluginSetup();
    129121   
    130122    $shop_page_name = get_post(get_option( 'concom_settings' )['concom_select_field_1'])->post_name;
     
    150142
    151143add_action( 'wp_head', function () {
    152     if ( get_option( 'concom_settings' ) && ! isset( get_option( 'concom_settings' )['concom_select_field_1'] ) ) {
    153         return;
    154     }
    155    
    156     if ( ! isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
    157         return;
    158     }
     144    isPluginSetup();
    159145   
    160146    if ( get_the_ID() == get_option( 'concom_settings' )['concom_select_field_1'] ) {
  • contractor-commerce-integration/tags/1.0.9/includes/class-contractor-commerce.php

    r2661119 r3042938  
    7171            $this->version = CONTRACTOR_COMMERCE_VERSION;
    7272        } else {
    73             $this->version = '1.0.0';
     73            $this->version = '1.1.0';
    7474        }
    7575        $this->plugin_name = 'contractor-commerce';
Note: See TracChangeset for help on using the changeset viewer.