This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function give_user_subscription( $product, $user_id, $note = '' ){ | |
| // First make sure all required functions and classes exist | |
| if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){ | |
| return false; | |
| } | |
| $order = wc_create_order( array( 'customer_id' => $user_id ) ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| steps: | |
| - name: 'debian:stable-slim' | |
| args: ['bash', './deploy-plugin.sh'] | |
| env: | |
| - 'BUILD=$BUILD_ID' | |
| - 'PROJECT=$PROJECT_ID' | |
| - 'REV=$REVISION_ID' | |
| - 'VERSION=$TAG_NAME' | |
| - 'SVN_USERNAME=$_SVN_USERNAME' | |
| - 'SVN_PASSWORD=$_SVN_PASSWORD' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _isEvent(prop) { | |
| if (0 !== prop.indexOf('on')) { | |
| return false; | |
| } | |
| return true; | |
| } | |
| function _getEvents(obj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This JS creates collapsible Gravity Form sections breaks | |
| IMPORTANT: | |
| 1 - Within the Gravity form, you must add the class collapsible to each section break. | |
| 2 - All fields within those section breaks must have the class collapsible_field | |
| 3 - You must include both the CSS and the JS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Install] | |
| WantedBy=multi-user.target | |
| [Unit] | |
| Description=Google Cloud Compute Engine SQL Proxy | |
| Requires=networking.service | |
| After=networking.service | |
| [Service] | |
| Type=simple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define('MAILGUN_URL', 'https://api.mailgun.net/v3/DOMAIN_NAME'); | |
| define('MAILGUN_KEY', 'KEY'); | |
| function sendmailbymailgun($to,$toname,$mailfromnane,$mailfrom,$subject,$html,$text,$tag,$replyto){ | |
| $array_data = array( | |
| 'from'=> $mailfromname .'<'.$mailfrom.'>', | |
| 'to'=>$toname.'<'.$to.'>', | |
| 'subject'=>$subject, | |
| 'html'=>$html, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * Feel free to improve it. | |
| * Original by Janich: https://gist.github.com/janich/6121771 | |
| * | |
| * @requires PHP 5.3+ | |
| * @package ExportMySQLUsers | |
| * @author Zaid Daba'een | |
| * @license http://www.dbad-license.org/ DBAD license | |
| */ | |
| // Set up database root credentials | |
| $host = 'localhost'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * ----------------------------------------------------------------------------------------- | |
| * Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php` | |
| * ----------------------------------------------------------------------------------------- | |
| */ | |
| // HTML Minifier | |
| function minify_html($input) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT product.ID as product_id, product.post_title as product_name, replace(product.post_content, '"', "'") as product_content, product_sku.meta_value as product_sku, product_price.meta_value as product_price, product_weight.meta_value as product_weight | |
| FROM wp_posts as product | |
| LEFT JOIN wp_postmeta as product_sku ON product.ID = product_sku.post_ID | |
| LEFT JOIN wp_postmeta as product_price ON product.ID = product_price.post_ID | |
| LEFT JOIN wp_postmeta as product_weight ON product.ID = product_weight.post_ID | |
| WHERE (product.post_type = 'product' OR product.post_type = 'product_variation') AND product_sku.meta_key = '_sku' AND product_price.meta_key = '_price' AND product_weight.meta_key = '_weight' | |
| ORDER BY product_id ASC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # simple function to check http response code before downloading a remote file | |
| # example usage: | |
| # if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi | |
| function validate_url(){ | |
| if [[ `wget -S --spider $1 2>&1 | grep 'HTTP/1.1 200 OK'` ]]; then echo "true"; fi | |
| } |
NewerOlder