Skip to content

Commit

Permalink
Transfered files
Browse files Browse the repository at this point in the history
  • Loading branch information
zendcrew committed Sep 21, 2022
1 parent 99991b4 commit 056d265
Show file tree
Hide file tree
Showing 402 changed files with 82,349 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
19/09/2022 version 1.0
- Initial Release
11 changes: 11 additions & 0 deletions extensions/extensions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

if ( !defined( 'ABSPATH' ) ) {
exit;
}

//WTARS_Shipped
if ( !class_exists( 'WTARS_Shipped_Extension' ) ) {
require_once 'shipped/shipped-extensions.php';
new WTARS_Shipped_Extension();
}
10 changes: 10 additions & 0 deletions extensions/shipped/admin/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

require_once dirname( __FILE__ ) . '/settings-page/settings-page.php';

require_once dirname( __FILE__ ) . '/cost-types/cost-types.php';
require_once dirname(__FILE__) . '/logic-types/logic-types.php';

require_once dirname(__FILE__) . '/condition-types/condition-types.php';
require_once dirname( __FILE__ ) . '/data-list/data-list.php';
require_once dirname( __FILE__ ) . '/notices/notices.php';
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

if ( !class_exists( 'Reon' ) ) {
return;
}

if ( !class_exists( 'WTARS_Shipped_Admin_Conditions_Customer' ) ) {

class WTARS_Shipped_Admin_Conditions_Customer {

public function __construct() {

add_filter( 'wtars_shipped_admin/get-condition-groups', array( $this, 'get_groups' ), 130, 2 );
add_filter( 'wtars_shipped_admin/get-customers-group-conditions', array( $this, 'get_conditions' ), 10, 2 );

add_filter( 'wtars_shipped_admin/get-users-condition-fields', array( $this, 'get_users_fields' ), 10, 2 );
add_filter( 'wtars_shipped_admin/get-logged_in_user-condition-fields', array( $this, 'get_logged_in_user_fields' ), 10, 2 );
}

public function get_groups( $in_groups, $args ) {

$in_groups[ 'customers' ] = esc_html__( 'Customers', 'table-rate-shipping-rates' );

return $in_groups;
}

public function get_conditions( $in_list, $args ) {

if ( !defined( 'WTARS_SHIPPED_PREMIUM' ) ) {

$in_list[ 'users' ] = esc_html__( 'Customers', 'table-rate-shipping-rates' );
$in_list[ 'logged_in_user' ] = esc_html__( 'Customer Is Logged In', 'table-rate-shipping-rates' );
}

return $in_list;
}

public function get_users_fields( $in_fields, $args ) {

$in_fields[] = array(
'id' => 'compare',
'type' => 'select2',
'default' => 'in_list',
'options' => array(
'in_list' => esc_html__( 'Any in the list', 'table-rate-shipping-rates' ),
'none' => esc_html__( 'None in the list', 'table-rate-shipping-rates' ),
),
'width' => '98%',
'box_width' => '25%',
);

$in_fields[] = array(
'id' => 'user_emails',
'type' => 'select2',
'multiple' => true,
'minimum_input_length' => 2,
'placeholder' => esc_html__( 'Search users...', 'table-rate-shipping-rates' ),
'allow_clear' => true,
'minimum_results_forsearch' => 10,
'data' => array(
'source' => 'users',
'ajax' => true,
'value_col' => 'email',
'show_value' => true,
),
'width' => '100%',
'box_width' => '75%',
);



return $in_fields;
}

public function get_logged_in_user_fields( $in_fields, $args ) {

$in_fields[] = array(
'id' => 'is_logged_in',
'type' => 'select2',
'default' => 'yes',
'options' => array(
'no' => esc_html__( 'No', 'table-rate-shipping-rates' ),
'yes' => esc_html__( 'Yes', 'table-rate-shipping-rates' ),
),
'width' => '100%',
'box_width' => '100%',
);



return $in_fields;
}

}

new WTARS_Shipped_Admin_Conditions_Customer();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?php

if ( !class_exists( 'Reon' ) ) {
return;
}

if ( !class_exists( 'WTARS_Shipped_Admin_Conditions_Order_Totals' ) && !defined( 'WTARS_SHIPPED_PREMIUM' ) ) {

class WTARS_Shipped_Admin_Conditions_Order_Totals {

private $prefix = 'order_total-';

public function __construct() {
add_filter( 'wtars_shipped_admin/get-condition-groups', array( $this, 'get_groups' ), 70, 2 );
add_filter( 'wtars_shipped_admin/get-order_totals-group-conditions', array( $this, 'get_conditions' ), 10, 2 );
}

public function get_groups( $in_groups, $args ) {

foreach ( $this->get_options() as $option ) {

add_filter( 'wtars_shipped_admin/get-' . $this->prefix . $option[ 'option_id' ] . '-condition-fields', array( $this, 'get_totals_fields' ), 10, 2 );
}

$in_groups[ 'order_totals' ] = esc_html__( 'Cart &amp; Package Totals', 'table-rate-shipping-rates' );

return $in_groups;
}

public function get_conditions( $in_list, $args ) {

foreach ( $this->get_options() as $option ) {

$in_list[ $this->prefix . $option[ 'option_id' ] ] = sprintf( esc_html__( 'Totals - %s', 'table-rate-shipping-rates' ), $this->get_title( $option ) );
}

return $in_list;
}

public function get_totals_fields( $in_fields, $args ) {

$in_fields[] = array(
'id' => 'compare',
'type' => 'select2',
'default' => '--',
'options' => array(
'--' => esc_html__( 'Between', 'table-rate-shipping-rates' ),
'>=' => esc_html__( 'More than or equal to', 'table-rate-shipping-rates' ),
'>' => esc_html__( 'More than', 'table-rate-shipping-rates' ),
'<=' => esc_html__( 'Less than or equal to', 'table-rate-shipping-rates' ),
'<' => esc_html__( 'Less than', 'table-rate-shipping-rates' ),
'==' => esc_html__( 'Equal to', 'table-rate-shipping-rates' ),
'!=' => esc_html__( 'Not equal to', 'table-rate-shipping-rates' ),
),
'width' => '98%',
'box_width' => '44%',
'fold_id' => 'order_totals',
);

$in_fields[] = array(
'id' => 'totals',
'type' => 'textbox',
'input_type' => 'number',
'default' => '0.01',
'placeholder' => esc_html__( '0.00', 'table-rate-shipping-rates' ),
'attributes' => array(
'min' => '0',
'step' => '0.01',
),
'width' => '100%',
'box_width' => '56%',
'fold' => array(
'target' => 'order_totals',
'attribute' => 'value',
'value' => array( '--' ),
'oparator' => 'neq',
'clear' => false,
),
);

$in_fields[] = array(
'id' => 'from_totals',
'type' => 'textbox',
'input_type' => 'number',
'default' => '0',
'placeholder' => esc_html__( '0.00', 'table-rate-shipping-rates' ),
'attributes' => array(
'min' => '0',
'step' => '0.01',
),
'width' => '98%',
'box_width' => '28%',
'fold' => array(
'target' => 'order_totals',
'attribute' => 'value',
'value' => array( '--' ),
'oparator' => 'eq',
'clear' => false,
),
);

$in_fields[] = array(
'id' => 'to_totals',
'type' => 'textbox',
'input_type' => 'number',
'default' => '0.01',
'placeholder' => esc_html__( '0.00', 'table-rate-shipping-rates' ),
'attributes' => array(
'min' => '0',
'step' => '0.01',
),
'width' => '100%',
'box_width' => '28%',
'fold' => array(
'target' => 'order_totals',
'attribute' => 'value',
'value' => array( '--' ),
'oparator' => 'eq',
'clear' => false,
),
);

return $in_fields;
}

public function get_options() {

global $wtars_shipped;

$options = array();

if ( isset( $wtars_shipped[ 'checkout_totals' ] ) ) {
$options = $wtars_shipped[ 'checkout_totals' ];
} else {
$options = self::get_default();
}

return $options;
}

private function get_title( $option ) {
if ( !empty( $option[ 'title' ] ) ) {
return $option[ 'title' ];
}

return $this->get_default_title( $option[ 'option_id' ] );
}

private function get_default_title( $option_id ) {

foreach ( $this->get_default() as $option ) {

if ( $option_id == $option[ 'option_id' ] ) {
return $option[ 'admin_note' ];
}
}
return esc_html__( 'Order Totals', 'table-rate-shipping-rates' );
}

private function get_default() {

return array(
array(
'title' => esc_html__( 'Order Totals', 'table-rate-shipping-rates' ),
'option_id' => '2234343',
),
);
}

}

new WTARS_Shipped_Admin_Conditions_Order_Totals();
}
Loading

0 comments on commit 056d265

Please sign in to comment.