first commit

This commit is contained in:
2024-07-31 13:12:38 +07:00
commit b4e8cbe182
10213 changed files with 3125839 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Abstracts;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
abstract class Metabox {
}

View File

@@ -0,0 +1,171 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Abstracts;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
abstract class Post_Type {
protected $post_type = '';
protected $singular = '';
protected $plural = '';
protected $menu_icon = '';
protected $menu_name = '';
protected $only_admin = false;
protected $taxonomies = array();
protected $supports = array( 'title', 'thumbnail', 'editor' );
function __construct() {
}
/**
* The register function is used the register post type finally.
*
* @return [type] [description]
*/
public function register() {
if ( ! $this->post_type ) {
return;
}
$labels = array( 'labels' => $this->labels() );
$args = $this->args();
$args = array_merge( $labels, $args );
register_post_type( $this->post_type, $args );
}
/**
* The args to set the post type.
*
* @return array Returns the array of arguments.
*/
public function args() {
$args = array( 'supports' => $this->supports(), 'rewrite' => $this->rewrites() );
if ( ! $this->only_admin ) {
$args['public'] = true;
}
if ( $taxonomies = $this->taxonomies ) {
$args['taxonomies'] = $taxonomies;
}
if ( $menu_icon = $this->menu_icon ) {
$args['menu_icon'] = $menu_icon;
}
return $args;
}
public function supports() {
return $this->supports;
}
public function labels() {
$menu_name = $this->menu_name;
if ( ! $menu_name ) {
$menu_name = $this->plural;
}
$singular = $this->singular;
$plural = $this->plural;
$labels = array(
'name' => sprintf( _x( '%s', 'Post type general name', 'student-2-plugin' ), $plural ),
'singular_name' => sprintf( _x( '%s', 'Post type singular name', 'student-2-plugin' ), $singular ),
'menu_name' => sprintf( _x( '%s', 'Admin Menu text', 'student-2-plugin' ), $plural ),
'name_admin_bar' => sprintf( _x( '%s', 'Add New on Toolbar', 'student-2-plugin' ), $singular ),
'add_new' => sprintf( __( 'Add New', 'student-2-plugin' ) ),
'add_new_item' => sprintf( __( 'Add New %s', 'student-2-plugin' ), $singular ),
'new_item' => sprintf( __( 'New %s', 'student-2-plugin' ), $singular ),
'edit_item' => sprintf( __( 'Edit %s', 'student-2-plugin' ), $singular ),
'view_item' => sprintf( __( 'View %s', 'student-2-plugin' ), $singular ),
'all_items' => sprintf( __( 'All %s', 'student-2-plugin' ), $plural ),
'search_items' => sprintf( __( 'Search %s', 'student-2-plugin' ), $plural ),
'parent_item_colon' => sprintf( __( 'Parent %s:', 'student-2-plugin' ), $plural ),
'not_found' => sprintf( __( 'No %s found.', 'student-2-plugin' ), $plural ),
'not_found_in_trash' => sprintf( __( 'No %s found in Trash.', 'student-2-plugin' ), $plural ),
'featured_image' => sprintf( _x( '%s Cover Image', 'Overrides the “Featured Image” phrase for this post type. Added in 4.3', 'student-2-plugin' ), $singular ),
'set_featured_image' => sprintf( _x( 'Set featured image', 'Overrides the “Set featured image” phrase for this post type. Added in 4.3', 'student-2-plugin' ), $singular ),
'remove_featured_image' => sprintf( _x( 'Remove featured image', 'Overrides the “Remove featured image” phrase for this post type. Added in 4.3', 'student-2-plugin' ) ),
'use_featured_image' => sprintf( _x( 'Use as featured image', 'Overrides the “Use as featured image” phrase for this post type. Added in 4.3', 'student-2-plugin' ) ),
'archives' => sprintf( _x( '%s archives', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'student-2-plugin' ), $singular ),
'insert_into_item' => sprintf( _x( 'Insert into %s', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'student-2-plugin' ), $singular ),
'uploaded_to_this_item' => sprintf( _x( 'Uploaded to this %s', 'Overrides the “Uploaded to this post”/”Uploaded to this page” phrase (used when viewing media attached to a post). Added in 4.4', 'student-2-plugin' ), $singular ),
'filter_items_list' => sprintf( _x( 'Filter %s list', 'Screen reader text for the filter links heading on the post type listing screen. Default “Filter posts list”/”Filter pages list”. Added in 4.4', 'student-2-plugin' ), $singular ),
'items_list_navigation' => sprintf( _x( '%s list navigation', 'Screen reader text for the pagination heading on the post type listing screen. Default “Posts list navigation”/”Pages list navigation”. Added in 4.4', 'student-2-plugin' ), $plural ),
'items_list' => sprintf( _x( '%s list', 'Screen reader text for the items list heading on the post type listing screen. Default “Posts list”/”Pages list”. Added in 4.4', 'student-2-plugin' ), $plural ),
);
if ( $menu_name ) {
$labels['menu_name'] = $menu_name;
}
return $labels;
}
public function rewrites() {
return array(
'slug' => $this->get_prop( __CLASS__, 'post_type' ),
);
}
static function get_prop( $className, $property ) {
if ( ! class_exists( $className ) ) {
return null;
}
if ( ! property_exists( $className, $property ) ) {
return null;
}
$vars = get_class_vars( $className );
return $vars[ $property ];
}
function set_prop( $className, $property ) {
if ( ! class_exists( $className ) ) {
return null;
}
if ( ! property_exists( $className, $property ) ) {
return null;
}
$vars = get_class_vars( $className );
return $vars[ $property ];
}
}

View File

@@ -0,0 +1,203 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Abstracts;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
abstract class Taxonomy {
protected $taxonomy = '';
protected $singular = '';
protected $plural = '';
protected $menu_name = '';
protected $post_types = array();
protected $labels = array();
protected $admin_only = false;
protected $args = array();
protected $supports = array();
protected $rewrite = array();
protected $show_in_table = false;
protected $hierarchical = false;
function instance( $taxonomy, $singular, $plural ) {
$this->taxonomy = $taxonomy;
$this->singular = $singular;
$this->plural = $plural;
return $this;
}
/**
* The register function is used the register post type finally.
*
* @return [type] [description]
*/
public function register() {
if ( ! $this->taxonomy ) {
return;
}
$labels = array( 'labels' => ( $this->labels ) ? $this->labels : $this->labels() );
$args = ( $this->args ) ? $this->args : $this->args();
$args = array_merge( $labels, $args );
$post_types = $this->post_types ? $this->post_types : array( 'post' );
register_taxonomy( $this->taxonomy, $post_types, $args );
}
/**
* The args to set the post type.
*
* @return array Returns the array of arguments.
*/
public function args() {
$args = array(
'supports' => ( $this->supports ) ? $this->supports : $this->supports(),
'rewrite' => ( $this->rewrite ) ? $this->rewrite : $this->rewrites(),
);
if ( $this->admin_only ) {
$args['public'] = false;
}
return $args;
}
public function supports() {
return array( 'title', 'thumbnail', 'editor' );
}
public function labels() {
$menu_name = $this->menu_name;
if ( ! $menu_name ) {
$menu_name = $this->plural;
}
$singular = $this->singular;
$plural = $this->plural;
$labels = array(
'name' => sprintf( _x( '%s', 'taxonomy general name', 'student-2-plugin' ), $plural ),
'singular_name' => sprintf( _x( '%s', 'taxonomy singular name', 'student-2-plugin' ), $singular ),
'search_items' => sprintf( __( 'Search %s', 'student-2-plugin' ), $plural ),
'all_items' => sprintf( __( 'All %s', 'student-2-plugin' ), $plural ),
'parent_item' => sprintf( __( 'Parent %s', 'student-2-plugin' ), $singular ),
'parent_item_colon' => sprintf( __( 'Parent %s:', 'student-2-plugin' ), $singular ),
'edit_item' => sprintf( __( 'Edit %s', 'student-2-plugin' ), $singular ),
'update_item' => sprintf( __( 'Update %s', 'student-2-plugin' ), $singular ),
'add_new_item' => sprintf( __( 'Add New %s', 'student-2-plugin' ), $singular ),
'new_item_name' => sprintf( __( 'New %s Name', 'student-2-plugin' ), $singular ),
'menu_name' => sprintf( __( '%s', 'student-2-plugin' ), $singular ),
);
if ( $menu_name ) {
$labels['menu_name'] = $menu_name;
}
return $labels;
}
public function rewrites() {
return array(
'slug' => $this->taxonomy,
);
}
function set_labels( $labels = array() ) {
$this->labels = array_merge( $labels, $this->labels() );
return $this;
}
function set_supports( $supports = array() ) {
$this->supports = $supports;
return $this;
}
function set_rewrite( $rewrites = array() ) {
$this->rewrite = $rewrites;
return $this;
}
function set_args( $args = array() ) {
$this->args = array_merge( $args, $this->args() );
return $this;
}
function admin_only() {
$this->admin_only = true;
return $this;
}
function set_post_type( $post_type ) {
$this->post_types = $post_type;
return $this;
}
function show_in_table() {
$this->show_in_table = true;
return $this;
}
function hierarchical() {
$this->hierarchical = true;
return $this;
}
}

View File

@@ -0,0 +1,409 @@
<?php
// don't load directly
defined( 'ABSPATH' ) || exit;
/**
* Price calculation for single tour
* @since 1.0.0
*/
if(!class_exists('Tour_Price')){
class Tour_Price {
public $group;
public $wc_group;
public $sale_group;
public $wc_sale_group;
public $adult;
public $wc_adult;
public $sale_adult;
public $wc_sale_adult;
public $child;
public $wc_child;
public $sale_child;
public $wc_sale_child;
public $infant;
public $wc_infant;
public $sale_infant;
public $wc_sale_infant;
public $meta;
function __construct($meta) {
# Get tour type
$tour_type = !empty($meta['type']) ? $meta['type'] : 'continuous';
# Custom availability status
if($tour_type == 'continuous') {
$custom_avail = !empty($meta['custom_avail']) ? $meta['custom_avail'] : false;
}
# Get discounts
$discount_type = !empty($meta['discount_type']) ? $meta['discount_type'] : 'none';
$discounted_price = !empty($meta['discount_price']) ? $meta['discount_price'] : 0;
/**
* Price calculation based on custom availability
*
* Custom availability has different pricing calculation
*/
if($tour_type == 'continuous' && $custom_avail == true) {
# Get pricing rule person/group
$pricing_rule = !empty($meta['custom_pricing_by']) ? $meta['custom_pricing_by'] : 'person';
/**
* Price calculation based on pricing rule
*/
if($pricing_rule == 'group') {
if(!empty($meta['cont_custom_date']) && gettype($meta['cont_custom_date'])=="string"){
$tf_tour_cont_custom_date = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) {
return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
}, $meta['cont_custom_date'] );
$tf_tour_custom_date = unserialize( $tf_tour_cont_custom_date );
$group_prices_array = array_column($tf_tour_custom_date, 'group_price');
}else{
# Get group price from all the arrays
$group_prices_array = is_array($meta['cont_custom_date']) ? array_column($meta['cont_custom_date'], 'group_price') : 0;
}
# Get minimum group price
$min_group_price = is_array($group_prices_array) ? min($group_prices_array) : 0;
# Get maximum group price
$max_group_price = is_array($group_prices_array) ? max($group_prices_array) : 0;
# Discount price calculation
if($discount_type == 'percent') {
$sale_min_group_price = number_format( $min_group_price - (( $min_group_price / 100 ) * $discounted_price) , 2, '.', '' );
$sale_max_group_price = number_format( $max_group_price - (( $max_group_price / 100 ) * $discounted_price) , 2, '.', '' );
} else if($discount_type == 'fixed') {
$sale_min_group_price = number_format( ( $min_group_price - $discounted_price ), 2, '.', '' );
$sale_max_group_price = number_format( ( $max_group_price - $discounted_price ), 2, '.', '' );
}
if($discount_type == 'percent' || $discount_type == 'fixed') {
# WooCommerce Regular Price
$wc_regular_min_group_price = wc_price($min_group_price );
$wc_regular_max_group_price = wc_price($max_group_price );
# Final output Regular (price range)
if(!empty($wc_regular_min_group_price) && !empty($wc_regular_max_group_price)) {
$price = ($wc_regular_min_group_price != $wc_regular_max_group_price) ? $wc_regular_min_group_price. '-' .$wc_regular_max_group_price : $wc_regular_min_group_price; // Discounted price range
}
if(!empty($wc_regular_min_group_price) && !empty($wc_regular_max_group_price)) {
$wc_price = ($wc_regular_min_group_price != $wc_regular_max_group_price) ? $wc_regular_min_group_price. '-' .$wc_regular_max_group_price : $wc_regular_min_group_price; // Discounted WooCommerce price range
}
# WooCommerce Price
$wc_min_group_price = wc_price( $sale_min_group_price );
$wc_max_group_price = wc_price( $sale_max_group_price );
# Final output (price range)
if(!empty($sale_min_group_price) && !empty($sale_max_group_price)) {
$sale_price = ($sale_min_group_price != $sale_max_group_price) ? $sale_min_group_price. '-' .$sale_max_group_price : $sale_min_group_price; // Discounted price range
}
if(!empty($wc_min_group_price) && !empty($wc_max_group_price)) {
$wc_sale_price = ($wc_min_group_price != $wc_max_group_price) ? $wc_min_group_price. '-' .$wc_max_group_price : $wc_min_group_price; // Discounted WooCommerce price range
}
} else {
# WooCommerce Price
$wc_min_group_price = wc_price($min_group_price);
$wc_max_group_price = wc_price($max_group_price);
# Final output (price range)
if(!empty($min_group_price) && !empty($max_group_price)) {
$price = ($min_group_price != $max_group_price) ? $min_group_price. '-' .$max_group_price : $min_group_price; // Price range
}
if(!empty($wc_min_group_price) && !empty($wc_max_group_price)) {
$wc_price = ($wc_min_group_price != $wc_max_group_price) ? $wc_min_group_price. '-' .$wc_max_group_price : $wc_min_group_price; // WooCommerce price range
}
}
} else if($pricing_rule == 'person') {
# Get adult, child, infant price from all the arrays
if(!empty($meta['cont_custom_date']) && gettype($meta['cont_custom_date'])=="string"){
$tf_tour_cont_custom_date = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) {
return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";';
}, $meta['cont_custom_date'] );
$tf_tour_custom_date = unserialize( $tf_tour_cont_custom_date );
$adult_price_array = is_array($tf_tour_custom_date) ? array_column($tf_tour_custom_date, 'adult_price') : 0;
$child_price_array = is_array($tf_tour_custom_date) ? array_column($tf_tour_custom_date, 'child_price') : 0;
$infant_price_array = is_array($tf_tour_custom_date) ? array_column($tf_tour_custom_date, 'infant_price') : 0;
}else{
$adult_price_array = is_array($meta['cont_custom_date']) ? array_column($meta['cont_custom_date'], 'adult_price') : 0;
$child_price_array = is_array($meta['cont_custom_date']) ? array_column($meta['cont_custom_date'], 'child_price') : 0;
$infant_price_array = is_array($meta['cont_custom_date']) ? array_column($meta['cont_custom_date'], 'infant_price') : 0;
}
# Get minimum price of adult, child, infant
$min_adult_price = !empty($adult_price_array) ? min($adult_price_array) : 0;
$min_child_price = !empty($child_price_array) ? min($child_price_array) : 0;
$min_infant_price = !empty($infant_price_array) ? min($infant_price_array) : 0;
# Get maximum price of adult, child, infant
$max_adult_price = !empty($adult_price_array) ? max($adult_price_array) : 0;
$max_child_price = !empty($child_price_array) ? max($child_price_array) : 0;
$max_infant_price = !empty($infant_price_array) ? max($infant_price_array): 0;
# Discount price calculation
if($discount_type == 'percent') {
# Minimum discounted price
$sale_min_adult_price = !empty($min_adult_price) ? number_format( $min_adult_price - (( $min_adult_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
$sale_min_child_price = !empty($min_child_price) ? number_format( $min_child_price - (( $min_child_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
$sale_min_infant_price = !empty($min_infant_price) ? number_format( $min_infant_price - (( $min_infant_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
# Maximum discounted price
$sale_max_adult_price = !empty($max_adult_price) ? number_format( $max_adult_price - (( $max_adult_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
$sale_max_child_price = !empty($max_child_price) ? number_format( $max_child_price - (( $max_child_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
$sale_max_infant_price = !empty($max_infant_price) ? number_format( $max_infant_price - (( $max_infant_price / 100 ) * $discounted_price) , 2, '.', '' ) : '';
} else if($discount_type == 'fixed') {
# Minimum discounted price
$sale_min_adult_price = !empty($min_adult_price) ? number_format( ( $min_adult_price - $discounted_price ), 2, '.', '' ) : '';
$sale_min_child_price = !empty($min_child_price) ? number_format( ( $min_child_price - $discounted_price ), 2, '.', '' ) : '';
$sale_min_infant_price = !empty($min_infant_price) ? number_format( ( $min_infant_price - $discounted_price ), 2, '.', '' ) : '';
# Maximum discounted price
$sale_max_adult_price = !empty($max_adult_price) ? number_format( ( $max_adult_price - $discounted_price ), 2, '.', '' ) : '';
$sale_max_child_price = !empty($max_child_price) ? number_format( ( $max_child_price - $discounted_price ), 2, '.', '' ) : '';
$sale_max_infant_price = !empty($max_infant_price) ? number_format( ( $max_infant_price - $discounted_price ), 2, '.', '' ) : '';
}
if($discount_type == 'percent' || $discount_type == 'fixed') {
# WooCommerce Price
$wc_min_adult_price = wc_price($sale_min_adult_price);
$wc_min_child_price = wc_price($sale_min_child_price);
$wc_min_infant_price = wc_price($sale_min_infant_price);
$wc_max_adult_price = wc_price($sale_max_adult_price);
$wc_max_child_price = wc_price($sale_max_child_price);
$wc_max_infant_price = wc_price($sale_max_infant_price);
# Final output (price range)
if(!empty($sale_min_adult_price) && !empty($sale_max_adult_price)) {
$sale_adult_price = ($sale_min_adult_price != $sale_min_adult_price) ? $sale_min_adult_price. '-' .$sale_max_adult_price : $sale_min_adult_price; // Discounted price range
}
if(!empty($sale_min_child_price) && !empty($sale_max_child_price)) {
$sale_child_price = ($sale_min_child_price != $sale_max_child_price) ? $sale_min_child_price. '-' .$sale_max_child_price : $sale_min_child_price; // Discounted price range
}
if(!empty($sale_min_infant_price) && !empty($sale_max_infant_price)) {
$sale_infant_price = ($sale_min_infant_price != $sale_max_infant_price) ? $sale_min_infant_price. '-' .$sale_max_infant_price : $sale_min_infant_price; // Discounted price range
}
if(!empty($wc_min_adult_price) && !empty($wc_max_adult_price)) {
$wc_sale_adult_price = ($wc_min_adult_price != $wc_max_adult_price) ? $wc_min_adult_price. '-' .$wc_max_adult_price : $wc_min_adult_price; // Discounted WooCommerce price range
}
if(!empty($wc_min_child_price) && !empty($wc_max_child_price)) {
$wc_sale_child_price = ($wc_min_child_price != $wc_max_child_price) ? $wc_min_child_price. '-' .$wc_max_child_price : $wc_min_child_price; // Discounted WooCommerce price range
}
if(!empty($wc_min_infant_price) && !empty($wc_max_infant_price)) {
$wc_sale_infant_price = ($wc_min_infant_price != $wc_max_infant_price) ? $wc_min_infant_price. '-' .$wc_max_infant_price : $wc_min_infant_price; // Discounted WooCommerce price range
}
}
# WooCommerce Price
$wc_min_adult_price = wc_price($min_adult_price);
$wc_min_child_price = wc_price($min_child_price);
$wc_min_infant_price = wc_price($min_infant_price);
$wc_max_adult_price = wc_price($max_adult_price);
$wc_max_child_price = wc_price($max_child_price);
$wc_max_infant_price = wc_price($max_infant_price);
# Final output (price range)
if(!empty($min_adult_price) && !empty($max_adult_price)) {
$adult_price = ($min_adult_price != $max_adult_price) ? $min_adult_price. '-' .$max_adult_price : $min_adult_price; // Price range
}
if(!empty($min_child_price) && !empty($max_child_price)) {
$child_price = ($min_child_price != $max_child_price) ? $min_child_price. '-' .$max_child_price : $min_child_price; // Price range
}
if(!empty($min_infant_price) && !empty($max_infant_price)) {
$infant_price = ($min_infant_price != $min_infant_price) ? $min_infant_price. '-' .$max_infant_price : $min_infant_price; // Price range
}
if(!empty($wc_min_adult_price) && !empty($wc_max_adult_price)) {
$wc_adult_price = ($wc_min_adult_price != $wc_max_adult_price) ? $wc_min_adult_price. '-' .$wc_max_adult_price : $wc_min_adult_price; // WooCommerce price range
}
if(!empty($wc_min_child_price) && !empty($wc_max_child_price)) {
$wc_child_price = ($wc_min_child_price != $wc_max_child_price) ? $wc_min_child_price. '-' .$wc_max_child_price : $wc_min_child_price; // WooCommerce price range
}
if(!empty($wc_min_infant_price) && !empty($wc_max_infant_price)) {
$wc_infant_price = ($wc_min_infant_price != $wc_max_infant_price) ? $wc_min_infant_price. '-' .$wc_max_infant_price : $wc_min_infant_price; // WooCommerce price range
}
}
} else {
/**
* Pricing for fixed/continuous
*/
# Get pricing rule person/group
$pricing_rule = !empty($meta['pricing']) ? $meta['pricing'] : 'person';
/**
* Price calculation based on pricing rule
*/
if($pricing_rule == 'group') {
# Get group price. Default 0
$price = !empty($meta['group_price']) ? $meta['group_price'] : 0;
if($discount_type == 'percent') {
$sale_price = number_format( $price - (( $price / 100 ) * $discounted_price) , 2, '.', '' );
} else if($discount_type == 'fixed') {
$sale_price = number_format( ( $price - $discounted_price ), 2, '.', '' );
}
# WooCommerce Price
$wc_price = wc_price($price);
if($discount_type == 'percent' || $discount_type == 'fixed') {
$wc_sale_price = wc_price($sale_price);
}
} else if($pricing_rule == 'person') {
$adult_price = !empty($meta['adult_price']) ? $meta['adult_price'] : 0;
$child_price = !empty($meta['child_price']) ? $meta['child_price'] : 0;
$infant_price = !empty($meta['infant_price']) ? $meta['infant_price'] : 0;
if($discount_type == 'percent') {
$adult_price ? $sale_adult_price = number_format( $adult_price - (( $adult_price / 100 ) * $discounted_price) , 2, '.', '' ) : 0;
$child_price ? $sale_child_price = number_format( $child_price - (( $child_price / 100 ) * $discounted_price) , 2, '.', '' ) : 0;
$infant_price ? $sale_infant_price = number_format( $infant_price - (( $infant_price / 100 ) * $discounted_price) , 2, '.', '' ) : 0;
} else if($discount_type == 'fixed') {
$adult_price ? $sale_adult_price = number_format( ( $adult_price - $discounted_price ), 2, '.', '' ) : 0;
$child_price ? $sale_child_price = number_format( ( $child_price - $discounted_price ), 2, '.', '' ) : 0;
$infant_price ? $sale_infant_price = number_format( ( $infant_price - $discounted_price ), 2, '.', '' ) : 0;
}
# WooCommerce Price
$wc_adult_price = wc_price($adult_price);
$wc_child_price = wc_price($child_price);
$wc_infant_price = wc_price($infant_price);
if($discount_type == 'percent' || $discount_type == 'fixed') {
$wc_sale_adult_price = !empty($sale_adult_price) ? wc_price($sale_adult_price) : 0;
$wc_sale_child_price = !empty($sale_child_price) ? wc_price($sale_child_price) : 0;
$wc_sale_infant_price = !empty($sale_infant_price) ? wc_price($sale_infant_price) : 0;
}
}
}
$this->group = $price ?? null;
$this->wc_group = $wc_price ?? null;
$this->sale_group = $sale_price ?? null;
$this->wc_sale_group = $wc_sale_price ?? null;
$this->adult = $adult_price ?? null;
$this->wc_adult = $wc_adult_price ?? null;
$this->sale_adult = $sale_adult_price ?? null;
$this->wc_sale_adult = $wc_sale_adult_price ?? null;
$this->child = $child_price ?? null;
$this->wc_child = $wc_child_price ?? null;
$this->sale_child = $sale_child_price ?? null;
$this->wc_sale_child = $wc_sale_child_price ?? null;
$this->infant = $infant_price ?? null;
$this->wc_infant = $wc_infant_price ?? null;
$this->sale_infant = $sale_infant_price ?? null;
$this->wc_sale_infant = $wc_sale_infant_price ?? null;
}
# Group regular price
function group() {
return $this->group;
}
# Group WC regular price
function wc_group() {
return $this->wc_group;
}
# Group sale price
function sale_group() {
return $this->sale_group;
}
# Group WC sale price
function wc_sale_group() {
return $this->wc_sale_group;
}
# Adult regular price
function adult() {
return $this->adult;
}
# Adult WC regular price
function wc_adult() {
return $this->wc_adult;
}
# Adult sale price
function sale_adult() {
return $this->sale_adult;
}
# Adult WC sale price
function wc_sale_adult() {
return $this->wc_sale_adult;
}
# Child regular price
function child() {
return $this->child;
}
# Child WC regular price
function wc_child() {
return $this->wc_child;
}
# Child sale price
function sale_child() {
return $this->sale_child;
}
# Child WC sale price
function wc_sale_child() {
return $this->wc_sale_child;
}
# Infant regular price
function infant() {
return $this->infant;
}
# Infant WC regular price
function wc_infant() {
return $this->wc_infant;
}
# Infant sale price
function sale_infant() {
return $this->sale_infant;
}
# Infant WC sale price
function wc_sale_infant() {
return $this->wc_sale_infant;
}
}
}
?>

View File

@@ -0,0 +1,55 @@
<?php
class Elementor_Layout_Control extends \Elementor\Base_Data_Control {
public function get_type() {
return 'elementor-layout-control';
}
public function enqueue() {
wp_enqueue_style( 'layout-control-css', YT_URL . 'assets/css/layout-control.css', [], '1.0.0' );
wp_enqueue_script( 'layout-control-js', YT_URL . 'assets/js/layout-control.js', [ 'jquery' ], '1.0.0' );
}
protected function get_default_settings() {
return [
'label_block' => true,
'rows' => 3,
'layoutcontrol_options' => [],
];
print_r( 'layoutcontrol_options' ); exit( 'asdf' );
}
public function content_template() {
$control_uid = $this->get_control_uid();
?>
<div class="elementor-control-field">
<label for="<?php echo esc_attr( $control_uid ); ?>" class="elementor-control-title">{{{ data.label }}}</label>
<div class="elementor-control-input-wrapper">
<#
if ( data.options ) {
_.each( data.options, function( value, key ) {
var selected = '';
if(data.controlValue == key){
selected = 'selected';
}
#>
<div class="radio-image-item {{ selected }}">
<input id="{{ data.name }}-{{ key }}" type="radio" class="field-radio-image" value="{{ key }}" name="{{ data.name }}" data-setting="{{ data.name }}" {{ selected }} />
<label for="{{ data.name }}-{{ key }}">
<img src="{{ value.image }}" alt="{{ value.label }}">
</label>
</div>
<#
});
}
#>
</div>
</div>
<# if ( data.description ) { #>
<div class="elementor-control-field-description">{{{ data.description }}}</div>
<# } #>
<?php
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="widgets.php" server="ftp.wp1.themevibrant.com//newwp/chirokind/wp-content/" local="133349340897602746" remote="133349016600000000" Dst="0" />
<file name="functions.php" server="ftp.wp1.themevibrant.com//newwp/chirokind/wp-content/" local="133353612480822595" remote="133353288000000000" Dst="0" />
<file name="functions.php" server="ftp.yogsthemes.com//arid/wp-content/" local="133453859541162614" remote="133453537200000000" Dst="0" />
<file name="widgets.php" server="ftp.yogsthemes.com//arid/wp-content/" local="133455696512428893" remote="133455372000000000" Dst="0" />
<file name="functions.php" server="ftp.wp1.yogsthemes.com//arid/wp-content/" local="133483978663509793" remote="133483798200000000" Dst="0" />
<file name="widgets.php" server="ftp.wp1.yogsthemes.com//arid/wp-content/" local="133486180815036803" remote="133486000800000000" Dst="0" />
</dwsync>

View File

@@ -0,0 +1,514 @@
<?php
function get_fontawesome_icons()
{
// scrape list of icons from bootstrap css
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
$subject = file_get_contents(get_template_directory() . '/assets/vendors/fontawesome/css/all.min.css');
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
$icons = array();
//fontawesome
foreach($matches as $match)
{
$icons[] = array('value' => 'bi '.$match[1], 'label' => $match[1]);
}
//Flaticon
$et_matches = get_et_icons();
foreach($et_matches as $match)
{
$icons[] = array('value' => 'icon '.$match[1], 'label' => $match[1]);
}
$icons = array_column($icons, 'label', 'value');
//print_r($icons); exit('hellow');
return $icons;
}
//Icomoon Icons
function get_et_icons()
{
$pattern = '/\.(icon-(?:\w+(?:-)?)+):before\s*{\s*content/';
$subject = file_get_contents(get_template_directory() . '/assets/vendors/thm-icons/style.css');
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
return $matches;
}
//get blog categories
function get_blog_categories() {
$options = array();
$taxonomy = 'category';
if (!empty($taxonomy)) {
$terms = get_terms(
array(
'parent' => 0,
'taxonomy' => $taxonomy,
'hide_empty' => false,
)
);
if (!empty($terms)) {
foreach ($terms as $term) {
if (isset($term)) {
$options[''] = 'Select';
if (isset($term->slug) && isset($term->name)) {
$options[$term->slug] = $term->name;
}
}
}
}
}
return $options;
}
//get Project categories
function get_project_categories() {
$options = array();
$taxonomy = 'project_cat';
if (!empty($taxonomy)) {
$terms = get_terms(
array(
'parent' => 0,
'taxonomy' => $taxonomy,
'hide_empty' => false,
)
);
if (!empty($terms)) {
foreach ($terms as $term) {
if (isset($term)) {
$options[''] = 'Select';
if (isset($term->slug) && isset($term->name)) {
$options[$term->slug] = $term->name;
}
}
}
}
}
return $options;
}
//get Testimonials categories
function get_testimonials_categories() {
$options = array();
$taxonomy = 'testimonials_cat';
if (!empty($taxonomy)) {
$terms = get_terms(
array(
'parent' => 0,
'taxonomy' => $taxonomy,
'hide_empty' => false,
)
);
if (!empty($terms)) {
foreach ($terms as $term) {
if (isset($term)) {
$options[''] = 'Select';
if (isset($term->slug) && isset($term->name)) {
$options[$term->slug] = $term->name;
}
}
}
}
}
return $options;
}
//get Product categories
function get_product_categories() {
$options = array();
$taxonomy = 'product_cat';
if (!empty($taxonomy)) {
$terms = get_terms(
array(
'parent' => 0,
'taxonomy' => $taxonomy,
'hide_empty' => false,
)
);
if (!empty($terms)) {
foreach ($terms as $term) {
if (isset($term)) {
$options[''] = 'Select';
if (isset($term->slug) && isset($term->name)) {
$options[$term->slug] = $term->name;
}
}
}
}
}
return $options;
}
//get Team categories
function get_team_categories() {
$options = array();
$taxonomy = 'team_cat';
if (!empty($taxonomy)) {
$terms = get_terms(
array(
'parent' => 0,
'taxonomy' => $taxonomy,
'hide_empty' => false,
)
);
if (!empty($terms)) {
foreach ($terms as $term) {
if (isset($term)) {
$options[''] = 'Select';
if (isset($term->slug) && isset($term->name)) {
$options[$term->slug] = $term->name;
}
}
}
}
}
return $options;
}
function thinkai_the_pagination2($args = array(), $echo = 1)
{
global $wp_query;
$default = array('base' => str_replace( 99999, '%#%', esc_url( get_pagenum_link( 99999 ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages, 'next_text' => '&raquo;', 'prev_text' => '&laquo;', 'type'=>'list','add_args' => false);
$args = wp_parse_args($args, $default);
$pagination = str_replace("<ul class='page-numbers'", '<ul class="pagination"', paginate_links($args) );
if(paginate_links(array_merge(array('type'=>'array'),$args)))
{
if($echo) echo wp_kses_post($pagination);
return $pagination;
}
}
function student2_plugin_fonticons() {
return json_decode( student2_filesystem()->get_contents( STUDENT2_PLUGIN_PATH . '/resource/fonticons.json' ), true );
$file = wp_remote_get( get_template_directory_uri() . '/assets/css/bootstrap-icons.min.css' );
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
preg_match_all( $pattern, wp_remote_retrieve_body( $file ), $matches );
$icons = array_combine( $matches[1], $matches[1] );
file_put_contents( STUDENT2_PLUGIN_PATH . '/resource/fonticons.json', json_encode( $icons ) );
return $icons;
}
function student2_filesystem() {
require_once ABSPATH . '/wp-admin/includes/file.php';
/* you can safely run request_filesystem_credentials() without any issues and don't need to worry about passing in a URL */
$creds = request_filesystem_credentials( site_url() . '/wp-admin/', '', false, false, array() );
/* initialize the API */
if ( ! WP_Filesystem( $creds ) ) {
/* any problems and we exit */
return false;
}
global $wp_filesystem;
/* do our file manipulations below */
return $wp_filesystem;
}
add_filter('thinkai_redux_custom_fonts_load', 'thinkai_redux_custom_fonts_load');
function thinkai_redux_custom_fonts_load( $custom_font ) {
$custom_style = '';
$pathinfo = pathinfo( $custom_font );
if ( $filename = thinkai_set( $pathinfo, 'filename' ) ) {
$custom_style .= '@font-face{
font-family:"' . $filename . '";';
$extensions = array( 'eot', 'woff', 'woff2', 'ttf', 'svg' );
$count = 0;
foreach ( $extensions as $extension ) {
$file_path = esc_url(home_url('/')) . '/wp-content/themes/thinkai/assets/css/custom-fonts/' . $filename . '.' . $extension;
$file_url = esc_url(get_template_directory_uri()) . '/assets/css/custom-fonts/' . $filename . '.' . $extension;
if ( $file_path ) {
$format = $extension;
if ( $extension === 'eot' ) {
$format = 'embedded-opentype';
}
if ( $extension === 'ttf' ) {
$format = 'truetype';
}
$terminated = ( $count > 0 ) ? ';' : '';
$custom_style .= $terminated . 'src:url("' . $file_url . '") format("' . $format . '")';
$count ++;
}
}
$custom_style .= ';}';
}
return $custom_style;
}
/**
* [thinkai_social_share_output description]
*
* @param [type] $comment [description].
* @param [type] $args [description].
* @param [type] $depth [description].
*
* @return void [description]
*/
function thinkai_social_share_output( $icon, $color = false ) {
$permalink = get_permalink( get_the_ID() );
$titleget = get_the_title();
$allowed_html = wp_kses_allowed_html( 'post' );
if ( $icon == 'facebook' ) {
$fb = ( $color == 1 ) ? 'style="color:#3b5998"' : '';
?>
<li>
<a onClick="window.open('http://www.facebook.com/sharer.php?u=<?php echo esc_url( $permalink ); ?>', 'Facebook', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.facebook.com/sharer.php?u=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-facebook" <?php echo wp_kses( $fb, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'twitter' ) {
$twitter = ( $color == 1 ) ? 'style="color:#00aced"' : '';
?>
<li>
<a onClick="window.open('http://twitter.com/share?url=<?php echo esc_url( $permalink ); ?>&amp;text=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Twitter share', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://twitter.com/share?url=<?php echo esc_url( $permalink ); ?>&amp;text=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-twitter" <?php echo wp_kses( $twitter, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'digg' ) {
$digg = ( $color == 1 ) ? 'style="color:#000000"' : '';
?>
<li>
<a onClick="window.open('http://www.digg.com/submit?url=<?php echo esc_url( $permalink ); ?>', 'Digg', 'width=715,height=330,left=' + (screen.availWidth / 2 - 357) + ',top=' + (screen.availHeight / 2 - 165) + '');
return false;" href="http://www.digg.com/submit?url=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-digg" <?php echo wp_kses( $digg, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'reddit' ) {
$reddit = ( $color == 1 ) ? 'style="color:#ff5700"' : '';
?>
<li>
<a onClick="window.open('http://reddit.com/submit?url=<?php echo esc_url( $permalink ); ?>&amp;title=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Reddit', 'width=617,height=514,left=' + (screen.availWidth / 2 - 308) + ',top=' + (screen.availHeight / 2 - 257) + '');
return false;" href="http://reddit.com/submit?url=<?php echo esc_url( $permalink ); ?>&amp;title=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-reddit" <?php echo wp_kses( $reddit, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'linkedin' ) {
$linkeding = ( $color == 1 ) ? 'style="color:#007bb6"' : '';
?>
<li>
<a onClick="window.open('http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo esc_url( $permalink ); ?>', 'Linkedin', 'width=863,height=500,left=' + (screen.availWidth / 2 - 431) + ',top=' + (screen.availHeight / 2 - 250) + '');
return false;" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo esc_url( $permalink ); ?>">
<i class="fa fa-linkedin" <?php echo wp_kses( $linkeding, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php if ( $icon == 'pinterest' ) {
$pinterest = ( $color == 1 ) ? 'style=color:#cb2027' : '';
?>
<li>
<a href='javascript:void((function(){var e=document.createElement(&apos;script&apos;);e.setAttribute(&apos;type&apos;,&apos;text/javascript&apos;);e.setAttribute(&apos;charset&apos;,&apos;UTF-8&apos;);e.setAttribute(&apos;src&apos;,&apos;http://assets.pinterest.com/js/pinmarklet.js?r=&apos;+Math.random()*99999999);document.body.appendChild(e)})())'>
<i class="fa fa-pinterest" <?php echo wp_kses( $pinterest, $allowed_html ); ?>></i></a>
</li>
<?php } ?>
<?php
if ( $icon == 'stumbleupon' ) {
$stumbleupon = ( $color == 1 ) ? 'style="color:#EB4823"' : '';
?>
<li>
<a onClick="window.open('http://www.stumbleupon.com/submit?url=<?php echo esc_url( $permalink ); ?>&amp;title=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Stumbleupon', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.stumbleupon.com/submit?url=<?php echo esc_url( $permalink ); ?>&amp;title=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-stumbleupon" <?php echo wp_kses( $stumbleupon, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'tumblr' ) {
$tumblr = ( $color == 1 ) ? 'style="color:#32506d"' : '';
$str = $permalink;
$str = preg_replace( '#^https?://#', '', $str );
?>
<li>
<a onClick="window.open('http://www.tumblr.com/share/link?url=<?php echo esc_attr( $str ); ?>&amp;name=<?php echo str_replace( " ", "%20", $titleget ); ?>', 'Tumblr', 'width=600,height=300,left=' + (screen.availWidth / 2 - 300) + ',top=' + (screen.availHeight / 2 - 150) + '');
return false;" href="http://www.tumblr.com/share/link?url=<?php echo esc_attr( $str ); ?>&amp;name=<?php echo str_replace( " ", "%20", $titleget ); ?>">
<i class="fa fa-tumblr" <?php echo wp_kses( $tumblr, $allowed_html ); ?>></i>
</a>
</li>
<?php } ?>
<?php
if ( $icon == 'email' ) {
$mail = ( $color == 1 ) ? 'style="color:#000000"' : '';
?>
<li>
<a href="mailto:?Subject=<?php echo str_replace( " ", "%20", $titleget ); ?>&amp;Body=<?php echo esc_url( $permalink ); ?>"><i class="fa fa-envelope-o" <?php echo wp_kses( $mail, $allowed_html ); ?>></i></a>
</li>
<?php
}
}
function thinkai_get_social_icons()
{
$options = ('social_media');
$output = '';
$count = 0;
if( thinkai_set( $options, 'social_media' ) && is_array( thinkai_set( $options, 'social_media' ) ) )
{
$total = count( thinkai_set( $options, 'social_media' ) ) - 2;
foreach( thinkai_set( $options, 'social_media' ) as $social_icon ){
if( isset( $social_icon['tocopy' ] ) ) continue;
$title = thinkai_set( $social_icon, 'title');
$class = thinkai_set( $social_icon, 'class');
$link = thinkai_set( $social_icon, 'social_link');
$icon = thinkai_set( $social_icon, 'social_icon');
$last_class = ( $count == $total ) ? ' class="last"' : '';
$output .= '
<li><a class="'.esc_attr( $class ).'" title="'.esc_attr( $title ).'" href="'.esc_url( $link ).'"><i class="fab '.$icon.'"></i></a></li>'."\n";
$count++;
}
}
return $output;
}
add_action('thinkai_social_share_output_two', 'thinkai_social_share_output_two');
function bunch_share_us_two($PostID = '', $PostName = '')
{
$options = thinkai_WSH()->option();
?>
<ul class="clearfix">
<?php if($options->get( 'facebook_sharing' )):?>
<li><a href="http://www.facebook.com/sharer.php?u=<?php echo esc_url(get_permalink($PostID)); ?>" target="_blank"><i class="fab fa-facebook-f"></i></a></li>
<?php endif;?>
<?php if($options->get( 'twitter_sharing' )):?>
<li><a href="https://twitter.com/share?url=<?php echo esc_url(get_permalink($PostID)); ?>&text=<?php echo esc_attr($post_slug=$PostName); ?>" target="_blank"><i class="fab fa-twitter-square"></i></a></li>
<?php endif;?>
<?php if($options->get( 'linkedin_sharing' )):?>
<li><a href="http://www.linkedin.com/shareArticle?url=<?php echo esc_url(get_permalink($PostID)); ?>&title=<?php echo esc_attr($post_slug=$PostName); ?>"><i class="fab fa-linkedin"></i></a></li>
<?php endif;?>
<?php if($options->get( 'pinterest_sharing' )):?>
<li><a href="https://pinterest.com/pin/create/bookmarklet/?url=<?php echo esc_url(get_permalink($PostID)); ?>&description=<?php echo esc_attr($post_slug=$PostName); ?>"><i class="fab fa-pinterest"></i></a></li>
<?php endif;?>
<?php if($options->get( 'reddit_sharing' )):?>
<li><a href="http://reddit.com/submit?url=<?php echo esc_url(get_permalink($PostID)); ?>&title=<?php echo esc_attr($post_slug=$PostName); ?>"><i class="fab fa-reddit"></i></a></li>
<?php endif;?>
<?php if($options->get( 'tumblr_sharing' )):?>
<li><a href="http://www.tumblr.com/share/link?url=<?php echo esc_url(get_permalink($PostID)); ?>&name=<?php echo esc_attr($post_slug=$PostName); ?>"><i class="fab fa-tumblr"></i></a></li>
<?php endif;?>
<?php if($options->get( 'digg_sharing' )):?>
<li><a href="http://digg.com/submit?url=<?php echo esc_url(get_permalink($PostID)); ?>&title=<?php echo esc_attr($post_slug=$PostName); ?>"><i class="fab fa-digg"></i></a></li>
<?php endif;?>
</ul>
<?php }
function thinkai_get_social_icon_two()
{
$options = thinkai_WSH()->option();
$icons = $options->get( 'social_media_tabs_v3' );
if ( $icons ) : ?>
<?php
for ( $i=0; $i < count( $icons['select_social_media'] ); $i++ ) {
$social_icon = ( isset( $icons['select_social_media'][$i] ) && !empty( $icons['select_social_media'][$i] ) ) ? $icons['select_social_media'][$i] : '';
$social_link = ( isset( $icons['link_social_media'][$i] ) && !empty( $icons['link_social_media'][$i] ) ) ? $icons['link_social_media'][$i] : '';
$social_title = ( isset( $icons['title_social_media'][$i] ) && !empty( $icons['title_social_media'][$i] ) ) ? $icons['title_social_media'][$i] : '';
?>
<li><a target="_blank" href="<?php echo esc_url($social_link); ?>"><span class="fab <?php echo esc_attr(str_replace("fa ", " ", $social_icon)); ?>"></span></a></li>
<?php } ?>
<?php endif; ?>
<?php }
function thinkai_get_social_icon_three()
{
$options = thinkai_WSH()->option();
$icons = $options->get( 'social_media_tabs_v3' );
if ( $icons ) : ?>
<?php
for ( $i=0; $i < count( $icons['select_social_media'] ); $i++ ) {
$social_icon = ( isset( $icons['select_social_media'][$i] ) && !empty( $icons['select_social_media'][$i] ) ) ? $icons['select_social_media'][$i] : '';
$social_link = ( isset( $icons['link_social_media'][$i] ) && !empty( $icons['link_social_media'][$i] ) ) ? $icons['link_social_media'][$i] : '';
$social_title = ( isset( $icons['title_social_media'][$i] ) && !empty( $icons['title_social_media'][$i] ) ) ? $icons['title_social_media'][$i] : '';
?>
<li>
<a target="_blank" href="<?php echo esc_url($social_link); ?>">
<div class="text">
<span class="txt1"><?php echo wp_kses($social_title, true); ?></span>
<span class="txt2"><?php echo wp_kses($social_title, true); ?></span>
</div>
<div class="icon">
<span class="fab <?php echo esc_attr(str_replace("fa ", " ", $social_icon)); ?> first"></span>
<span class="fab <?php echo esc_attr(str_replace("fa ", " ", $social_icon)); ?> second"></span>
</div>
</a>
</li>
<?php } ?>
<?php endif; ?>
<?php }
function thinkai_get_social_icon()
{
$options = thinkai_WSH()->option();
$icons = $options->get( 'social_media_tabs_v3' );
if ( $icons ) : ?>
<?php
for ( $i=0; $i < count( $icons['select_social_media'] ); $i++ ) {
$social_icon = ( isset( $icons['select_social_media'][$i] ) && !empty( $icons['select_social_media'][$i] ) ) ? $icons['select_social_media'][$i] : '';
$social_link = ( isset( $icons['link_social_media'][$i] ) && !empty( $icons['link_social_media'][$i] ) ) ? $icons['link_social_media'][$i] : '';
$social_title = ( isset( $icons['title_social_media'][$i] ) && !empty( $icons['title_social_media'][$i] ) ) ? $icons['title_social_media'][$i] : '';
?>
<li><a target="_blank" href="<?php echo esc_url($social_link); ?>"><span class="fab <?php echo esc_attr(str_replace("fa ", " ", $social_icon)); ?>"></span></a></li>
<?php } ?>
<?php endif; ?>
<?php }
function thinkai_page_list() {
$args = wp_parse_args( array(
'post_type' => 'page',
'numberposts' => -1,
) );
$posts = get_posts( $args );
$post_options = array( esc_html__( '-- Select Page --', 'thinkai' ) => '' );
if ( $posts ) {
foreach ( $posts as $post ) {
$post_options[$post->ID] = $post->post_title;
}
}
return $post_options;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Post_Types;
use THINKAIPLUGIN\Inc\Abstracts\Post_Type;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
class Project extends Post_Type {
protected $post_type = 'project';
protected $menu_icon = 'dashicons-portfolio';
protected $taxonomies = array();
public static $instance;
/**
* [instance description]
*
* @return [type] [description]
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* [init description]
*
* @return [type] [description]
*/
public static function init() {
self::instance()->menu_name = esc_html__( 'Projects', 'wpfixker' );
self::instance()->singular = esc_html__( 'Project', 'wpthinkai' );
self::instance()->plural = esc_html__( 'Projects', 'wpthinkai' );
self::instance()->supports = array('title', 'editor', 'thumbnail', 'excerpt');
add_action( 'init', array( self::instance(), 'register' ) );
}
}

View File

@@ -0,0 +1,68 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Post_Types;
use THINKAIPLUGIN\Inc\Abstracts\Post_Type;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
class Team extends Post_Type {
protected $post_type = 'team';
protected $menu_icon = 'dashicons-portfolio';
protected $taxonomies = array();
public static $instance;
/**
* [instance description]
*
* @return [type] [description]
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* [init description]
*
* @return [type] [description]
*/
public static function init() {
self::instance()->menu_name = esc_html__( 'Teams', 'wpfixker' );
self::instance()->singular = esc_html__( 'Team', 'wpthinkai' );
self::instance()->plural = esc_html__( 'Teams', 'wpthinkai' );
add_action( 'init', array( self::instance(), 'register' ) );
}
}

View File

@@ -0,0 +1,69 @@
<?php
/**
* Abstract class for register post type
*
* @package WordPress
* @subpackage Student2 Plugin
* @author Shahbaz Ahmed <shahbazahmed9@hotmail.com>
* @version 1.0
*/
namespace THINKAIPLUGIN\Inc\Post_Types;
use THINKAIPLUGIN\Inc\Abstracts\Post_Type;
if ( ! function_exists( 'add_action' ) ) {
exit;
}
/**
* Abstract Post Type
* Implemented by classes using the same CRUD(s) pattern.
*
* @version 2.6.0
* @package THINKAIPLUGIN/Abstracts
* @category Abstract Class
* @author Wptech
*/
class Testimonials extends Post_Type {
protected $post_type = 'testimonials';
protected $menu_icon = 'dashicons-portfolio';
protected $taxonomies = array();
public static $instance;
/**
* [instance description]
*
* @return [type] [description]
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* [init description]
*
* @return [type] [description]
*/
public static function init() {
self::instance()->menu_name = esc_html__( 'Testimonials', 'wpfixker' );
self::instance()->singular = esc_html__( 'Testimonial', 'wpthinkai' );
self::instance()->plural = esc_html__( 'Testimonials', 'wpthinkai' );
self::instance()->supports = array( 'title', 'editor', 'excerpt','thumbnail' );
add_action( 'init', array( self::instance(), 'register' ) );
}
}

View File

@@ -0,0 +1,98 @@
<?php
namespace THINKAIPLUGIN\Inc;
use THINKAIPLUGIN\Inc\Abstracts\Taxonomy;
class Taxonomies extends Taxonomy {
public static function init() {
$labels = array(
'name' => _x( 'Project Category', 'wpthinkai' ),
'singular_name' => _x( 'Project Category', 'wpthinkai' ),
'search_items' => __( 'Search Category', 'wpthinkai' ),
'all_items' => __( 'All Categories', 'wpthinkai' ),
'parent_item' => __( 'Parent Category', 'wpthinkai' ),
'parent_item_colon' => __( 'Parent Category:', 'wpthinkai' ),
'edit_item' => __( 'Edit Category', 'wpthinkai' ),
'update_item' => __( 'Update Category', 'wpthinkai' ),
'add_new_item' => __( 'Add New Category', 'wpthinkai' ),
'new_item_name' => __( 'New Category Name', 'wpthinkai' ),
'menu_name' => __( 'Project Category', 'wpthinkai' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'publicly_queryable' => true,
'rewrite' => array( 'slug' => 'project_cat' ),
);
register_taxonomy( 'project_cat', 'project', $args );
//Testimonials Taxonomy Start
$labels = array(
'name' => _x( 'Testimonials Category', 'wpthinkai' ),
'singular_name' => _x( 'Testimonials Category', 'wpthinkai' ),
'search_items' => __( 'Search Category', 'wpthinkai' ),
'all_items' => __( 'All Categories', 'wpthinkai' ),
'parent_item' => __( 'Parent Category', 'wpthinkai' ),
'parent_item_colon' => __( 'Parent Category:', 'wpthinkai' ),
'edit_item' => __( 'Edit Category', 'wpthinkai' ),
'update_item' => __( 'Update Category', 'wpthinkai' ),
'add_new_item' => __( 'Add New Category', 'wpthinkai' ),
'new_item_name' => __( 'New Category Name', 'wpthinkai' ),
'menu_name' => __( 'Testimonials Category', 'wpthinkai' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'publicly_queryable' => true,
'rewrite' => array( 'slug' => 'testimonials_cat' ),
);
register_taxonomy( 'testimonials_cat', 'testimonials', $args );
//Team Taxonomy Start
$labels = array(
'name' => _x( 'Team Category', 'wpthinkai' ),
'singular_name' => _x( 'Team Category', 'wpthinkai' ),
'search_items' => __( 'Search Category', 'wpthinkai' ),
'all_items' => __( 'All Categories', 'wpthinkai' ),
'parent_item' => __( 'Parent Category', 'wpthinkai' ),
'parent_item_colon' => __( 'Parent Category:', 'wpthinkai' ),
'edit_item' => __( 'Edit Category', 'wpthinkai' ),
'update_item' => __( 'Update Category', 'wpthinkai' ),
'add_new_item' => __( 'Add New Category', 'wpthinkai' ),
'new_item_name' => __( 'New Category Name', 'wpthinkai' ),
'menu_name' => __( 'Team Category', 'wpthinkai' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true,
'publicly_queryable' => true,
'rewrite' => array( 'slug' => 'team_cat' ),
);
register_taxonomy( 'team_cat', 'team', $args );
}
}