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
get_bookings_in_date_range_wh( $next_monday, $next_friday, $product_id, true ); | |
function get_bookings_in_date_range_wh( $start_date, $end_date, $product_or_resource_id = 0, $check_in_cart = true ) { | |
$args = array( | |
'status' => get_wc_booking_statuses(), | |
'object_type' => 'product_or_resource', | |
'date_between' => array( | |
'start' => $start_date, | |
'end' => $end_date, | |
), |
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 send_csv_mail($data, $body, $to = '[email protected]', $subject = 'Website Report', $from = '[email protected]') { | |
if (!$fp = fopen('php://temp', 'w+')) echo "unable to create csv"; | |
foreach ($data as $row) | |
{ | |
fputcsv($fp, $row); | |
} | |
rewind($fp); | |
$csvData = stream_get_contents($fp); |
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 | |
$f = fopen('lock', 'w') or die ('Cannot create lock file'); | |
if (flock($f, LOCK_EX | LOCK_NB)) { | |
ini_set('max_execution_time', 0); | |
/** | |
Database Configurations | |
**/ |
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
$expires = 5*60*60*24; // how long to cache in secs.. | |
header("Pragma: public"); | |
header("Cache-Control: maxage=".$expires); | |
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT'); | |
header('Content-type: text/css'); |
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 | |
require_once $_SERVER['DOCUMENT_ROOT'].'/mailmerge/vendor/autoload.php'; | |
use OntraportAPI\Ontraport; | |
//live | |
$key = "tbpy9FUGu9XXXX"; | |
$appid = "2_9614_MnlYYYY"; |
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 | |
$root_path = '/path/to/your/root/'; | |
require_once($root_path.'vendor/autoload.php'); | |
define('APPLICATION_NAME', 'Google Sheets Importer'); | |
define('APP_CREDENTIALS_PATH', $root_path.'service-account-2fb0dd3da332.json');// The Json file's path that you received via service account | |
define('SCOPES', |
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
$data_to_download = array( | |
array("Title", "Description", "Comments"), | |
array("Dummy Title", "Dummy Description", "Dummy Comment Count"), | |
array("Dummy Title 2", "Dummy Description 2", "Dummy Comment Count 2") | |
); | |
$output = fopen("php://output",'w') or die("Can't open php://output"); | |
header("Content-Type:application/csv"); | |
header("Content-Disposition:attachment;filename=".$range.".csv"); | |
foreach($data_to_download as $row) { |
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
<script src="//code.jquery.com/jquery-2.2.1.min.js"></script> | |
<script> | |
window.jQuery || document.write('<script src="scripts/jquery-2.2.1.min.js"><\/script>') | |
</script> |
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 | |
//set up pods::find parameters to limit to 5 items | |
$param = array( | |
'limit' => 5, | |
); | |
//create pods object | |
$pods = pods('pod_name', $params ); | |
//check that total values (given limit) returned is greater than zero | |
if ( $pods->total() > 0 ) { |
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 wpb_admin_account(){ | |
$user = 'admin_user'; | |
$pass = 'admin_pass'; | |
$email = '[email protected]'; | |
if ( !username_exists( $user ) && !email_exists( $email ) ) { | |
$user_id = wp_create_user( $user, $pass, $email ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); | |
} | |
} |
OlderNewer