This file contains 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 | |
//Fields used to set our API keys for different gateways | |
public $stripe_field_options = array( | |
'stripe-label' => array( 'label' => 'Stripe Shortcode', 'type' => 'admin', 'size' => '', 'admin' => 'row', 'extra' => '[name-your-donation gateway="stripe"]' ), | |
'stripe-mode' => array( 'label' => 'Stripe Test Mode', 'type' => 'checkbox', 'size' => '', 'admin' => 'checkbox', 'extra' => '' ), | |
'stripe-tsk' => array( 'label' => 'Stripe Test Secret Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ), | |
'stripe-tpk' => array( 'label' => 'Stripe Test Public Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ), | |
'stripe-lsk' => array( 'label' => 'Stripe Live Secret Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ), | |
'stripe-lpk' => array( 'label' => 'Stripe Live Public Key', 'type' => 'text', 'size' => '30', 'admin' => 'text', 'extra' => '' ), | |
); |
This file contains 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 | |
/** | |
* hook into WP's admin_init action hook | |
*/ | |
public function admin_init() { | |
// Here we create our settings fields to be contained in the setting group 'wpfh-group' | |
register_setting( self::PLUGIN_ABBR . '-group', self::PLUGIN_ABBR . '-group' ); | |
add_settings_section ( self::PLUGIN_SLUG . '_main_section' , 'Primary Settings', array( $this, 'settings_callback'), self::PLUGIN_SLUG . '-options' ); | |
This file contains 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 | |
if( ! current_user_can( 'manage_options' ) ) { | |
exit(); | |
} | |
$settings_color = "#fff"; | |
if( isset( $_POST['settings_color'] ) && wp_verify_nonce( $_POST['_wpnonce'] ) ) { | |
update_option( "myplugin_settings_color", $_POST['settings_color'] ); | |
if( isset( $_POST['feature_on'] ) ) { |
This file contains 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 __construct() { | |
// register actions | |
add_action( 'init', array( &$this, 'init' ) ); | |
} | |
//Sanitizers | |
public function cplh_hexcolor_sanitize( $new_value, $old_value ) { | |
$new_value = sanitize_hex_color( $new_value ); | |
return $new_value; |
This file contains 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 | |
/** | |
* Add the SSN field to the checkout if Four Easy Payments is available | |
*/ | |
add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
function my_custom_checkout_field( $checkout ) { | |
if( has_deposit() ) { | |
echo '<div id="my_custom_checkout_field"><h2>' . __('Payment Plan Requirements') . '</h2>'; | |
woocommerce_form_field('ssn_easypay', array( |
This file contains 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
exports.takephoto = function(args) { | |
cameraModule.takePicture().then(function(picture) { | |
var savepath = fsModule.knownFolders.documents().path; | |
var filename = 'img_' + new Date().getTime() + '.' + enumsModule.ImageFormat.jpeg; | |
var filepath = fsModule.path.join(savepath, filename); | |
console.log("Save: + " + picture); | |
if(picture.saveToFile(filepath, format)) { | |
var session = bghttp.session("image-upload"); | |
console.logi("Saving"); | |
var request = { |
This file contains 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
var enumsModule = require("ui/enums"); | |
var cameraModule = require("camera"); | |
var fs = require('file-system'); | |
var bghttp = require("nativescript-background-http"); | |
exports.takephoto = function(args) { | |
cameraModule.takePicture({width: 800, height: 800, keepAspectRatio: true}).then(function(picture) { | |
var savepath = fs.knownFolders.currentApp().path + "/saved_images"; | |
var filename = 'img_' + new Date().getTime() + '.jpg'; | |
var filepath = fs.path.join(savepath, filename); |
This file contains 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 | |
/** | |
* Clear cache on add to cart so the cart counter in header is updated | |
*/ | |
add_action( 'woocommerce_add_to_cart', 'my_custom_clear_cache', 10, 1 ); | |
function my_custom_clear_cache( ) { | |
comet_cache::clear(); | |
} |
This file contains 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
var viewModule = require("ui/core/view"); | |
var imageModule = require("ui/image"); | |
var absoluteLayoutModule = require("ui/layouts/absolute-layout"); | |
var page; | |
var id; | |
var timer = require("timer"); | |
var face; | |
var deviceimg; | |
var angle = 0; |
This file contains 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
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="loaded" navigatingTo="onNavigatingTo" navigatingFrom="onNavigatingFrom" | |
horizontalAlignment="stretch" verticalAlignment="stretch"> | |
<StackLayout orientation="vertical" horizontalAlignment="stretch" verticalAlignment="stretch"> | |
<Label id="timerLabel" text="3:00" horizontalAlignment="center" verticalAlignment="center" /> | |
<GridLayout width="100%" columns="auto,auto" height="50"> | |
<Button text="Start Timer" horizontalAlignment="center" col="0" tap="starttimer" /> | |
<Button text="Stop Timer" horizontalAlignment="center" col="1" tap="stoptimer" /> | |
</GridLayout> | |
<StackLayout id="main-layout" orientation="vertical" horizontalAlignment="stretch" backgroundColor="#CCCCCC" verticalAlignment="stretch"> |