Submit
Path:
~
/
home
/
getwphos
/
public_html
/
ppine
/
wp-content
/
plugins
/
ti-woocommerce-wishlist
/
integrations
/
File Content:
mycred.php
<?php /** * TI WooCommerce Wishlist integration with: * * @name myCRED * * @version 2.9.4.3 * * @slug mycred * * @url https://wordpress.org/plugins/mycred/ * */ // If this file is called directly, abort. if ( ! defined( 'ABSPATH' ) ) { exit; } // Load integration depends on current settings. global $tinvwl_integrations; $slug = "mycred"; $name = "myCRED"; $available = defined( 'myCRED_VERSION' ); $tinvwl_integrations = is_array( $tinvwl_integrations ) ? $tinvwl_integrations : []; $tinvwl_integrations[ $slug ] = array( 'name' => $name, 'available' => $available, ); if ( ! tinv_get_option( 'integrations', $slug ) ) { return; } if ( ! $available ) { return; } // myCred hooks if ( defined( 'myCRED_VERSION' ) ) { /** * Register MyCred hook for the WooCommerce Wishlist. * * @param array $installed The list of installed MyCred hooks. * * @return array The updated list of installed MyCred hooks. */ function tinvwl_mycred_register_ti_woocommerce_wishlist_hook( array $installed ): array { $installed['tinvwl'] = array( 'title' => __( 'WooCommerce Wishlist', 'ti-woocommerce-wishlist' ), 'description' => __( 'Awards %_plural% for users adding products to their wishlist and purchased products from their wishlist.', 'ti-woocommerce-wishlist' ), 'callback' => array( 'myCRED_Hook_TinvWL' ), ); return $installed; } add_filter( 'mycred_setup_hooks', 'tinvwl_mycred_register_ti_woocommerce_wishlist_hook', 100 ); /** * Load MyCred hook for the WooCommerce Wishlist. */ function tinvwl_mycred_load_ti_woocommerce_wishlist_hook() { // If the hook has been replaced or if the plugin is not installed, exit now. if ( class_exists( 'myCRED_Hook_TinvWL' ) ) { return; } class myCRED_Hook_TinvWL extends myCRED_Hook { /** * Constructor. * * @param array $hook_prefs The hook preferences. * @param string $type The point type to use. */ public function __construct( $hook_prefs, $type = MYCRED_DEFAULT_TYPE_KEY ) { parent::__construct( array( 'id' => 'tinvwl', 'defaults' => array( 'tinvwl_added' => array( 'creds' => 1, 'log' => '%plural% for adding a product to a wishlist', 'limit' => '0/x', ), 'tinvwl_purchased' => array( 'creds' => 1, 'log' => '%plural% for purchasing a product from a wishlist', 'limit' => '0/x', ), ), ), $hook_prefs, $type ); } /** * Run the hook. */ public function run() { add_action( 'tinvwl_product_added', array( $this, 'added' ) ); add_action( 'tinvwl_product_purchased', array( $this, 'purchased' ), 10, 3 ); } /** * Award points to the user who added a product to their wishlist. * * @param array $data Product data, including author and wishlist IDs. */ public function added( $data ) { // Must be logged in if ( ! is_user_logged_in() ) { return; } $user_id = get_current_user_id(); // Award the user adding to wishlist if ( $this->prefs['tinvwl_added']['creds'] !== 0 && ! $this->core->exclude_user( $user_id ) ) { // Limit if ( ! $this->over_hook_limit( 'tinvwl_added', 'added_to_wishlist', $user_id ) ) { // Make sure this is unique event if ( ! $this->core->has_entry( 'added_to_wishlist', $data['product_id'], $user_id ) ) { // Execute $this->core->add_creds( 'added_to_wishlist', $user_id, $this->prefs['tinvwl_added']['creds'], $this->prefs['tinvwl_added']['log'], $data['product_id'], array( 'ref_type' => 'post' ), $this->mycred_type ); } } } } /** * Award points to user who purchased a product from a wishlist. * * @param WC_Order $order Order object. * @param WC_Order_Item_Product $item Order item product object. * @param array $wishlist A wishlist data where product added from. */ public function purchased( $order, $item, $wishlist ) { // Must be logged in if ( ! is_user_logged_in() ) { return; } $user_id = get_current_user_id(); // Award the user adding to wishlist if ( $this->prefs['tinvwl_purchased']['creds'] !== 0 && ! $this->core->exclude_user( $user_id ) ) { // Limit if ( ! $this->over_hook_limit( 'tinvwl_purchased', 'purchased_from_wishlist', $user_id ) ) { // Make sure this is a unique event if ( ! $this->core->has_entry( 'purchased_from_wishlist', $item->get_id(), $user_id ) ) { // Execute $this->core->add_creds( 'purchased_from_wishlist', $user_id, $this->prefs['tinvwl_purchased']['creds'], $this->prefs['tinvwl_purchased']['log'], $item->get_id(), array( 'ref_type' => 'post' ), $this->mycred_type ); } } } } /** * Preferences */ public function preferences() { $prefs = $this->prefs; ?> <div class="hook-instance"> <h3><?php _e( 'Adding Product to Wishlist', 'ti-woocommerce-wishlist' ); ?></h3> <div class="row"> <div class="col-lg-2 col-md-6 col-sm-6 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_added' => 'creds' ) ); ?>"><?php _e( 'Points', 'ti-woocommerce-wishlist' ); ?></label> <input type="text" name="<?php echo $this->field_name( array( 'tinvwl_added' => 'creds' ) ); ?>" id="<?php echo $this->field_id( array( 'tinvwl_added' => 'creds' ) ); ?>" value="<?php echo $this->core->number( $prefs['tinvwl_added']['creds'] ); ?>" class="form-control"/> </div> </div> <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_added', 'limit', ) ); ?>"><?php _e( 'Limit', 'ti-woocommerce-wishlist' ); ?></label> <?php echo $this->hook_limit_setting( $this->field_name( array( 'tinvwl_added', 'limit', ) ), $this->field_id( array( 'tinvwl_added', 'limit', ) ), $prefs['tinvwl_added']['limit'] ); ?> </div> </div> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_added' => 'log' ) ); ?>"><?php _e( 'Log Template', 'ti-woocommerce-wishlist' ); ?></label> <input type="text" name="<?php echo $this->field_name( array( 'tinvwl_added' => 'log' ) ); ?>" id="<?php echo $this->field_id( array( 'tinvwl_added' => 'log' ) ); ?>" placeholder="<?php _e( 'required', 'ti-woocommerce-wishlist' ); ?>" value="<?php echo esc_attr( $prefs['tinvwl_added']['log'] ); ?>" class="form-control"/> <span class="description"><?php echo $this->available_template_tags( array( 'general', 'post', ) ); ?></span> </div> </div> </div> <h3><?php _e( 'Purchasing Product from Wishlist', 'ti-woocommerce-wishlist' ); ?></h3> <div class="row"> <div class="col-lg-2 col-md-6 col-sm-6 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_purchased' => 'creds' ) ); ?>"><?php _e( 'Points', 'ti-woocommerce-wishlist' ); ?></label> <input type="text" name="<?php echo $this->field_name( array( 'tinvwl_purchased' => 'creds' ) ); ?>" id="<?php echo $this->field_id( array( 'tinvwl_purchased' => 'creds' ) ); ?>" value="<?php echo $this->core->number( $prefs['tinvwl_purchased']['creds'] ); ?>" class="form-control"/> </div> </div> <div class="col-lg-4 col-md-6 col-sm-6 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_purchased', 'limit', ) ); ?>"><?php _e( 'Limit', 'ti-woocommerce-wishlist' ); ?></label> <?php echo $this->hook_limit_setting( $this->field_name( array( 'tinvwl_purchased', 'limit', ) ), $this->field_id( array( 'tinvwl_purchased', 'limit', ) ), $prefs['tinvwl_purchased']['limit'] ); ?> </div> </div> <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12"> <div class="form-group"> <label for="<?php echo $this->field_id( array( 'tinvwl_purchased' => 'log' ) ); ?>"><?php _e( 'Log Template', 'ti-woocommerce-wishlist' ); ?></label> <input type="text" name="<?php echo $this->field_name( array( 'tinvwl_purchased' => 'log' ) ); ?>" id="<?php echo $this->field_id( array( 'tinvwl_purchased' => 'log' ) ); ?>" placeholder="<?php _e( 'required', 'ti-woocommerce-wishlist' ); ?>" value="<?php echo esc_attr( $prefs['tinvwl_purchased']['log'] ); ?>" class="form-control"/> <span class="description"><?php echo $this->available_template_tags( array( 'general', 'post', ) ); ?></span> </div> </div> </div> </div> <?php } /** * Sanitize preferences for this hook. * * @param array $data The preferences to sanitize. * * @return array The sanitized preferences. */ public function sanitise_preferences( $data ): array { if ( isset( $data['tinvwl_added']['limit'] ) && isset( $data['tinvwl_added']['limit_by'] ) ) { $limit = sanitize_text_field( $data['tinvwl_added']['limit'] ); if ( $limit == '' ) { $limit = 0; } $data['tinvwl_added']['limit'] = $limit . '/' . $data['tinvwl_added']['limit_by']; unset( $data['tinvwl_added']['limit_by'] ); } if ( isset( $data['tinvwl_purchased']['limit'] ) && isset( $data['tinvwl_purchased']['limit_by'] ) ) { $limit = sanitize_text_field( $data['tinvwl_purchased']['limit'] ); if ( $limit == '' ) { $limit = 0; } $data['tinvwl_purchased']['limit'] = $limit . '/' . $data['tinvwl_purchased']['limit_by']; unset( $data['tinvwl_purchased']['limit_by'] ); } return $data; } } } add_action( 'mycred_load_hooks', 'tinvwl_mycred_load_ti_woocommerce_wishlist_hook', 100 ); /** * Add custom references to MyCred all references. * * @param array $references The MyCred all references. * * @return array The updated MyCred all references. */ function tinvwl_mycred_references( array $references ): array { $references['purchased_from_wishlist'] = __( 'Purchased From Wishlist', 'ti-woocommerce-wishlist' ); $references['added_to_wishlist'] = __( 'Added To Wishlist', 'ti-woocommerce-wishlist' ); return $references; } add_filter( 'mycred_all_references', 'tinvwl_mycred_references' ); }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
automatewoo
---
0755
advanced-product-fields-for-woocommerce-pro.php
6928 bytes
0644
advanced-product-fields-for-woocommerce.php
8536 bytes
0644
automatewoo.php
3463 bytes
0644
buy-now-button-for-woocommerce.php
1454 bytes
0644
check-pincodezipcode-for-shipping-woocommerce.php
1539 bytes
0644
cleantalk-spam-protect.php
1618 bytes
0644
clever-swatches.php
2543 bytes
0644
comet-cache.php
1552 bytes
0644
duracelltomi-google-tag-manager.php
1613 bytes
0644
elex-woocommerce-catalog-mode.php
2410 bytes
0644
gift-cards-for-woocommerce.php
4936 bytes
0644
hide-price-add-to-cart-button.php
14710 bytes
0644
improved-variable-product-attributes.php
5226 bytes
0644
ione360-configurator.php
4486 bytes
0644
litespeed-cache.php
2489 bytes
0644
mycred.php
11264 bytes
0644
nasa-core.php
1500 bytes
0644
product-extras-for-woocommerce.php
13123 bytes
0644
product-quantity-for-woocommerce.php
2165 bytes
0644
pw-woocommerce-gift-cards.php
3634 bytes
0644
shopengine.php
4763 bytes
0644
show-single-variations.php
1209 bytes
0644
sitepress-multilingual-cms.php
2549 bytes
0644
theme-divi.php
1571 bytes
0644
theme-flatsome.php
10579 bytes
0644
theme-kallyas.php
1191 bytes
0644
theme-oceanwp.php
1319 bytes
0644
wc-fields-factory.php
12629 bytes
0644
woo-advanced-qty.php
2585 bytes
0644
woo-payment-gateway.php
1715 bytes
0644
woo-variation-swatches-pro.php
2040 bytes
0644
woo-variations-table-grid.php
2796 bytes
0644
woocommerce-booking.php
3308 bytes
0644
woocommerce-bookings.php
6014 bytes
0644
woocommerce-composite-products.php
17755 bytes
0644
woocommerce-custom-fields.php
4953 bytes
0644
woocommerce-fast-cart.php
1690 bytes
0644
woocommerce-gravityforms-product-addons.php
14869 bytes
0644
woocommerce-mix-and-match-products.php
7322 bytes
0644
woocommerce-multilingual.php
9075 bytes
0644
woocommerce-rental-and-booking.php
9858 bytes
0644
woocommerce-square.php
1429 bytes
0644
woocommerce-tm-extra-product-options.php
14660 bytes
0644
woocommerce-waitlist.php
1561 bytes
0644
wp-fastest-cache.php
2948 bytes
0644
wp-grid-builder.php
2812 bytes
0644
wp-multilang.php
1865 bytes
0644
wp-rocket.php
4972 bytes
0644
wpc-variations-radio-buttons.php
1570 bytes
0644
yith-woocommerce-product-bundles.php
6780 bytes
0644
yith-woocommerce-quick-view.php
1395 bytes
0644
N4ST4R_ID | Naxtarrr