SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 # RewriteEngine On # RewriteCond %{HTTP:Authorization} ^(Bearer\ )(.*)$ [NC] # RewriteRule ^(.*) $1?access_token=%2 [QSA] #Header set Access-Control-Allow-Origin "*" #Header set Access-Control-Allow-Methods "GET,PUT,POST,DELETE" #Header set Access-Control-Allow-Headers "Content-Type, Authorization" <IfModule mod_rewrite.c> <IfModule mod_negotiation.c> Options -MultiViews </IfModule> RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://kprep.api.ozandac.com/$1 [R,L] RewriteEngine On # Prevent direct access to the "public" folder - redirect to root RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /public/ RewriteRule ^public/(.*) /$1 [R=302,L] # Redirect Trailing Slashes If Not A Folder... # - but look for the file in the "public" folder # (ensure we are not already in the "public" folder) RewriteCond %{REQUEST_URI} !^/public/ RewriteCond %{DOCUMENT_ROOT}/public/$1 !-d RewriteRule ^(.*)/$ /$1 [R=302,L] # Rewrite "everything" to the "public" subdirectory if not already # This ignores existing files/dirs in the document root RewriteCond %{REQUEST_URI} ^/(.*) RewriteRule !^public/ public/%1 # Handle Front Controller... (as before) RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] </IfModule>
Month: October 2020
Gravityforms limit submission – once for user, unlimited for guest
public function context() { // rule targets specific user, if this user is different we don't need to test the rule if ( $this->user_id != 'all' ) { if ( $this->user_id != get_current_user_id() ) { return false; } } if($this->user_id == "all") { if(get_current_user_id()===0) { return false; } } return true; }
File: gp-limit-submissions/includes/GPLS_Rule_User.php
Plugin: https://gravitywiz.com/documentation/gravity-forms-limit-submissions
How to add Buy Now button on Product page – WordPress/woocommerce?
Change && to &&
add_filter('woocommerce_add_to_cart_redirect', 'malpani_redirect_checkout_add_cart'); function malpani_redirect_checkout_add_cart() { if (isset($_POST["buynow"]) && $_POST["buynow"] === "2") { return wc_get_checkout_url(); } } add_filter('woocommerce_after_add_to_cart_button', 'malpani_add_buy_button'); function malpani_add_buy_button() { echo '<input id="buynowinput" name="buynow" value="1" hidden> <button type="button" id="buy_now" class="buy_now button">Buy Now</button> <script> jQuery(document).ready(function ($) { $("#buy_now").click(function (e) { $("#buynowinput").val(2); $(".single_add_to_cart_button").click(); e.stopPropagation(); e.preventDefault(); }) }); </script>';
How to get Gravity forms entry value by label?
function harsh_get_value_by_label( $form, $entry, $label ) { foreach ( $form['fields'] as $field ) { $lead_key = $field->label; if ( strtolower( $lead_key ) == strtolower( $label ) ) { return $entry[ $field->id ]; } if($field->inputs != null and count($field->inputs)) { foreach($field->inputs as $children) { $subLeadKey = $children["label"]; if ( strtolower( $subLeadKey ) == strtolower( $label ) ) { return $entry[ $children["id"] ]; } } } } return false; }