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 | |
//required `phpmailer/phpmailer` and `aws/aws-sdk-php` PHP library | |
use Aws\Ses\Exception\SesException; | |
use PHPMailer\PHPMailer\PHPMailer; | |
use PHPMailer\PHPMailer\SMTP; | |
use PHPMailer\PHPMailer\Exception; | |
$AWS_ACCESS_KEY_ID = 'xxxxxxxxxxxxx'; | |
$AWS_SECRET_ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxx'; |
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
import * as React from 'react'; | |
import { View, ActivityIndicator, Platform, StyleSheet } from 'react-native'; | |
import { WebView } from 'react-native-webview'; | |
import * as FileSystem from 'expo-file-system'; | |
const { cacheDirectory, writeAsStringAsync, deleteAsync, getInfoAsync, EncodingType, } = FileSystem; | |
function viewerHtml(base64, customStyle, withScroll = false, withPinchZoom = false, maximumPinchZoomScale = 5) { | |
return ` | |
<!DOCTYPE html> | |
<html> | |
<head> |
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 | |
$string = 'This is a {{ sample }} string with {{ curly }} brace'; | |
preg_match_all('/\{{([^}]*)\}}/', $string, $matches); | |
print_r($matches[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
<?php | |
/** | |
* Hide shipping rates when free shipping is available. | |
* Updated to support WooCommerce 2.6 Shipping Zones. | |
* | |
* @param array $rates Array of rates found for the package. | |
* @return 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
<?php | |
function wcs_my_free_shipping( $is_available ) { | |
global $woocommerce; | |
// set the product ids that are eligible | |
$eligible = array( '360' ); | |
// get cart contents | |
$cart_items = $woocommerce->cart->get_cart(); |
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 | |
$str = 'Awesome line äåòñêèå ïåñíè'; | |
echo filter_var($str,FILTER_SANITIZE_STRING,FILTER_FLAG_STRIP_HIGH); |
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 | |
/** | |
* Send FCM Push notification using PHP | |
*/ | |
$serverKey = ''; | |
$deviceToken = ''; | |
$notificationBody = array( | |
'body' => 'here is a message. message', | |
'title' => 'This is title #2', | |
'sound' => "default", |
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 | |
define('MAILGUN_URL', 'https://api.mailgun.net/v3/{{DOMAIN}}'); | |
define('MAILGUN_KEY', '{{APIKEY}'); | |
/** | |
* @param $to - a@xyz.com or a@xyz.com, b@xyz.com | |
* @param $from - doe <doe@xyz.com> | |
* @param $subject - subject | |
* @param $html - rich body | |
* @param $text - text body |
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 | |
/** | |
* _slug | |
* | |
* @param mixed $str | |
* @param mixed $delimiter | |
* @return void | |
*/ | |
function _slug($str, $delimiter = '-') { |
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
/** | |
* Ellipsize String | |
* | |
* This function will strip tags from a string, split it at its max_length and ellipsize | |
* | |
* @param string string to ellipsize | |
* @param int max length of string | |
* @param mixed int (1|0) or float, .5, .2, etc for position to split | |
* @param string ellipsis ; Default '...' | |
* @return string ellipsized string |
NewerOlder