PATH:
home
/
lab2454c
/
invest.westernclear.com
/
wp-content
/
plugins
/
portfolio
<?php /* Plugin Name: investments Description: investments products. Version: 4.27 Author: 3gmediasolution Text Domain: ure Domain Path: /lang/ */ /* Copyright 2021 */ add_action('init', 'what_are_our_investments'); function what_are_our_investments() { $labels = array( 'name' => _x('Investments', 'post type general name'), 'singular_name' => _x('investments', 'post type singular name'), 'add_new' => _x('Add New', 'investments item'), 'add_new_item' => __('Add New investments Item'), 'edit_item' => __('Edit investments Item'), 'new_item' => __('New investments Item'), 'view_item' => __('View investments Item'), 'search_items' => __('Search investments'), 'not_found' => __('Nothing found'), 'not_found_in_trash' => __('Nothing found in Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, //'menu_icon' => get_stylesheet_directory_uri() . '/article16.png', 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title','editor','thumbnail','custom-fields','comments') ); register_post_type( 'investments' , $args ); } add_action( 'init', 'our_investments_create_taxonomies', 0 ); function our_investments_create_taxonomies() { // Project Categories register_taxonomy('investments-cat',array('investments'),array( 'hierarchical' => true, 'label' => 'Categories', 'singular_name' => 'investments_category', 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => 'investments-cat' ) )); register_taxonomy( 'our_investments_tag', 'investments', array( 'hierarchical' => false, 'label' => __( 'Tags', CURRENT_THEME ), 'singular_name' => __( 'Tag', CURRENT_THEME ), 'rewrite' => true, 'query_var' => true ) ); } /*---------------what_are_other_asking post type end---------------*/ add_filter( 'comments_open', 'my_comments_open', 10, 2 ); function my_comments_open( $open, $post_id ) { $post = get_post( $post_id ); if ( 'investments' == $post->post_type ) $open = true; return $open; } add_shortcode('cr_portfolio', 'portfolio_cust'); function portfolio_cust(){ ob_start(); portfolio_cust_show(); return ob_get_clean(); } function portfolio_cust_show() { $site_url = site_url()."/login"; if ( ! is_user_logged_in() ) { wp_redirect($site_url); } $args = array( 'post_type' => 'investments', 'posts_per_page' => 6, 'order' => 'DESC' ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ): $the_query->the_post(); echo "<br>"; echo get_field('title',$post->ID); echo "<br>"; echo get_field('subtitle',$post->ID); echo "<br>"; echo get_field('media_link',$post->ID); echo "<br>"; echo get_field('website_link',$post->ID); echo "<br>"; echo substr(get_field('description',$post->ID),0,83)."..."; echo "<br>"; echo get_field('place_name',$post->ID); echo "<br>"; echo get_field('valuation',$post->ID); echo "<br>"; echo get_field('price_per_share',$post->ID); echo "<br>"; echo get_field('min_investment',$post->ID); echo "<br>"; echo get_field('shares_offered',$post->ID); echo "<br>"; echo get_field('offering_type',$post->ID); echo "<br>"; echo get_field('offering_max',$post->ID); echo "<br>"; echo get_field('offering',$post->ID); echo "<br>"; ?> <a href="<?php the_permalink();?>">Link</a> <?php echo "<br>"; endwhile; } wp_reset_postdata(); } add_shortcode('single_portfolio', 'portfolio_single'); function portfolio_single(){ ob_start(); portfolio_single_show(); return ob_get_clean(); } function portfolio_single_show() { $site_url = site_url()."/login"; if ( ! is_user_logged_in() ) { wp_redirect($site_url); } global $post; echo "<br>"; echo get_field('title',$post->ID); echo "<br>"; echo get_field('subtitle',$post->ID); echo "<br>"; echo get_field('media_link',$post->ID); echo "<br>"; echo get_field('website_link',$post->ID); echo "<br>"; echo get_field('description',$post->ID); echo "<br>"; echo get_field('place_name',$post->ID); echo "<br>"; echo get_field('valuation',$post->ID); echo "<br>"; echo get_field('price_per_share',$post->ID); echo "<br>"; echo get_field('min_investment',$post->ID); echo "<br>"; echo get_field('shares_offered',$post->ID); echo "<br>"; echo get_field('offering_type',$post->ID); echo "<br>"; echo get_field('offering_max',$post->ID); echo "<br>"; echo get_field('offering',$post->ID); echo "<br>"; ?> <a href="<?php the_permalink();?>">Link</a> <?php echo "<br>"; } add_shortcode('payment_form', 'single_payment'); function single_payment(){ ob_start(); payment_form(); return ob_get_clean(); } function payment_form() { ?> <div class="panel panel-default"> <div class="panel-heading">Order Process</div> <div class="panel-body"> <form action="http://162.215.253.89/ercabarter/dev/payment-process/" method="POST" id="paymentForm"> <div class="row"> <div class="col-md-8" style="border-right:1px solid #ddd;"> <h4 align="center">Customer Details</h4> <div class="form-group"> <label><b>Card Holder Name <span class="text-danger">*</span></b></label> <input type="text" name="customerName" id="customerName" class="form-control" value=""> <span id="errorCustomerName" class="text-danger"></span> </div> <div class="form-group"> <label><b>Email Address <span class="text-danger">*</span></b></label> <input type="text" name="emailAddress" id="emailAddress" class="form-control" value=""> <span id="errorEmailAddress" class="text-danger"></span> </div> <div class="form-group"> <label><b>Address <span class="text-danger">*</span></b></label> <textarea name="customerAddress" id="customerAddress" class="form-control"></textarea> <span id="errorCustomerAddress" class="text-danger"></span> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label><b>City <span class="text-danger">*</span></b></label> <input type="text" name="customerCity" id="customerCity" class="form-control" value=""> <span id="errorCustomerCity" class="text-danger"></span> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label><b>Zip <span class="text-danger">*</span></b></label> <input type="text" name="customerZipcode" id="customerZipcode" class="form-control" value=""> <span id="errorCustomerZipcode" class="text-danger"></span> </div> </div> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label><b>State </b></label> <input type="text" name="customerState" id="customerState" class="form-control" value=""> </div> </div> <div class="col-sm-6"> <div class="form-group"> <label><b>Country <span class="text-danger">*</span></b></label> <input type="text" name="customerCountry" id="customerCountry" class="form-control"> <span id="errorCustomerCountry" class="text-danger"></span> </div> </div> </div> <hr> <h4 align="center">Payment Details</h4> <div class="form-group"> <label>Card Number <span class="text-danger">*</span></label> <input type="text" name="cardNumber" id="cardNumber" class="form-control" placeholder="1234 5678 9012 3456" maxlength="20" onkeypress=""> <span id="errorCardNumber" class="text-danger"></span> </div> <div class="form-group"> <div class="row"> <div class="col-md-4"> <label>Expiry Month</label> <input type="text" name="cardExpMonth" id="cardExpMonth" class="form-control" placeholder="MM" maxlength="2" onkeypress="return validateNumber(event);"> <span id="errorCardExpMonth" class="text-danger"></span> </div> <div class="col-md-4"> <label>Expiry Year</label> <input type="text" name="cardExpYear" id="cardExpYear" class="form-control" placeholder="YYYY" maxlength="4" onkeypress="return validateNumber(event);"> <span id="errorCardExpYear" class="text-danger"></span> </div> <div class="col-md-4"> <label>CVC</label> <input type="text" name="cardCVC" id="cardCVC" class="form-control" placeholder="123" maxlength="4" onkeypress="return validateNumber(event);"> <span id="errorCardCvc" class="text-danger"></span> </div> </div> </div> <br> <div align="center"> <input type="hidden" name="price" value="500"> <input type="hidden" name="total_amount" value="500"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_details" value="Jeans"> <input type="hidden" name="item_number" value="TS1234567"> <input type="hidden" name="order_number" value="SKA987654321"> <input type="button" name="payNow" id="payNow" class="btn btn-success btn-sm" onclick="stripePay(event)" value="Pay Now" /> </div> <br> </div> </div> </form> </div> </div> </div> </div> <script type="text/javascript" src="https://js.stripe.com/v2/"></script> <script type="text/javascript" src="http://162.215.253.89/ercabarter/dev/wp-content/plugins/investments/payment1.js"></script> <script type="text/javascript"> Stripe.setPublishableKey('pk_test_51JQdZZEAJtDMbuhoGvZkiYwfBlflB0FLbKke242tY9JwnUM5OeMkYxb7l2gzRgC9py98TvGFUZwtm35OpFNijpb500dUkZ5ACv'); function stripePay(event) { event.preventDefault(); if(validateForm() == true) { jQuery('#payNow').attr('disabled', 'disabled'); jQuery('#payNow').val('Payment Processing....'); Stripe.createToken({ number:jQuery('#cardNumber').val(), cvc:jQuery('#cardCVC').val(), exp_month : jQuery('#cardExpMonth').val(), exp_year : jQuery('#cardExpYear').val() }, stripeResponseHandler); return false; } } function stripeResponseHandler(status, response) { if(response.error) { jQuery('#payNow').attr('disabled', false); jQuery('#message').html(response.error.message).show(); } else { var stripeToken = response['id']; jQuery('#paymentForm').append("<input type='test' name='stripeToken' value='" + stripeToken + "' />"); alert(stripeToken); jQuery('#paymentForm').submit(); } } </script> <?php } add_shortcode('payment_process', 'payment_process'); function payment_process(){ ob_start(); payment_process_code(); return ob_get_clean(); } function payment_process_code() { $paymentMessage = ''; if(!empty($_POST['stripeToken'])){ // get token and user details $stripeToken = $_POST['stripeToken']; $customerName = $_POST['customerName']; $customerEmail = $_POST['emailAddress']; $customerAddress = $_POST['customerAddress']; $customerCity = $_POST['customerCity']; $customerZipcode = $_POST['customerZipcode']; $customerState = $_POST['customerState']; $customerCountry = $_POST['customerCountry']; $cardNumber = $_POST['cardNumber']; $cardCVC = $_POST['cardCVC']; $cardExpMonth = $_POST['cardExpMonth']; $cardExpYear = $_POST['cardExpYear']; //include Stripe PHP library require_once('stripe-php/init.php'); //set stripe secret key and publishable key $stripe = array( "secret_key" => "sk_test_51JQdZZEAJtDMbuhoDE3lmRJ1R69SsFjOhIUYHqH5BZwEB5yZU6Heaxjd8EL0w8i3Fjcfee6ePpswrQf00iMtaVoy00iUHL5S5M", "publishable_key" => "pk_test_51JQdZZEAJtDMbuhoGvZkiYwfBlflB0FLbKke242tY9JwnUM5OeMkYxb7l2gzRgC9py98TvGFUZwtm35OpFNijpb500dUkZ5ACv" ); \Stripe\Stripe::setApiKey($stripe['secret_key']); //add customer to stripe $customer = \Stripe\Customer::create(array( 'name' => $customerName, 'description' => 'test description', 'email' => $customerEmail, 'source' => $stripeToken, "address" => ["city" => $customerCity, "country" => $customerCountry, "line1" => $customerAddress, "line2" => "", "postal_code" => $customerZipcode, "state" => $customerState] )); // item details for which payment made $itemName = $_POST['item_details']; $itemNumber = $_POST['item_number']; $itemPrice = $_POST['price']; $totalAmount = $_POST['total_amount']; $currency = $_POST['currency_code']; $orderNumber = $_POST['order_number']; // details for which payment performed $payDetails = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => $totalAmount, 'currency' => $currency, 'description' => $itemName, 'metadata' => array( 'order_id' => $orderNumber ) )); // get payment details $paymenyResponse = $payDetails->jsonSerialize(); // check whether the payment is successful if($paymenyResponse['amount_refunded'] == 0 && empty($paymenyResponse['failure_code']) && $paymenyResponse['paid'] == 1 && $paymenyResponse['captured'] == 1){ // transaction details echo $amountPaid = $paymenyResponse['amount']; echo $balanceTransaction = $paymenyResponse['balance_transaction']; echo $paidCurrency = $paymenyResponse['currency']; echo $paymentStatus = $paymenyResponse['status']; echo $paymentDate = date("Y-m-d H:i:s"); //insert tansaction details into database die("Die"); } else{ $paymentMessage = "failed"; } } else{ $paymentMessage = "failed"; } $_SESSION["message"] = $paymentMessage; }
[+]
js
[-] portfolio.php-19-11-2021
[edit]
[+]
stripe-php
[+]
..
[-] Investments.php--
[edit]
[-] portfolio.php
[edit]
[-] Investments.php-29-10-2021
[edit]
[-] portfolio.php----subho-bk
[edit]
[-] Investments.php--28-last-su
[edit]
[+]
vendor
[-] Investments.php-pay-27
[edit]
[-] Investments.php----an-29
[edit]
[-] Investments.php-28-10-2021
[edit]
[+]
css
[-] portfolio.php-17-11-2021
[edit]
[-] portfolio.php--01
[edit]
[-] payment1.js-01-11-2021
[edit]
[-] Investments.php-01-11-2021
[edit]
[+]
images
[-] portfolio.php-24-11-2021
[edit]
[-] payment1.js
[edit]
[-] portfolio.php-18-11-2021
[edit]