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 | |
//получить Id заказов бронирования авто | |
public static function get_orders_ids($order_status = array('wc-completed', 'wc-on-hold')){ | |
global $wpdb; | |
$product_id = self::$settings['woo_id_product']; | |
$results = $wpdb->get_col(" | |
SELECT order_items.order_id | |
FROM {$wpdb->prefix}woocommerce_order_items as order_items | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_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
<?php | |
$str = '15:17 14.09.2019'; | |
$d = strtotime($str); | |
echo date_diff(new DateTime(), new DateTime('15:17 15.09.2019'))->days; | |
// format | |
$str = '2019-07-27T10:44:15+10:00'; | |
$d = date("jS F, Y", strtotime($str)); |
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
Date.prototype.yyyymmdd = function() { | |
var mm = this.getMonth() + 1; // getMonth() is zero-based | |
var dd = this.getDate(); | |
return [this.getFullYear(), | |
(mm>9 ? '' : '0') + mm, | |
(dd>9 ? '' : '0') + dd | |
].join('/'); | |
}; | |
Jan02_1970.yyyymmdd() |
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 | |
//получить Id заказов бронирования авто | |
public static function get_orders_ids($order_status = array('wc-completed')){ | |
global $wpdb; | |
$product_id = self::$settings['woo_id_product']; | |
$results = $wpdb->get_col(" | |
SELECT order_items.order_id | |
FROM {$wpdb->prefix}woocommerce_order_items as order_items | |
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_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
* * * * * php /var/www/project/yii mailer/send | |
<?php | |
// регистрируем пятиминутный интервал | |
add_filter( 'cron_schedules', 'cron_add_five_min2234124124124' ); | |
function cron_add_five_min2234124124124( $schedules ) { | |
$schedules['twenty_min_аaa'] = array( | |
'interval' => 60 * 20, | |
'display' => 'Раз в 20 минут' | |
); |
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 | |
/* | |
Plugin Name: Movie Reviews | |
Plugin URI: http://wp.tutsplus.com/ | |
Description: Declares a plugin that will create a custom post type displaying movie reviews. | |
Version: 1.0 | |
Author: Soumitra Chakraborty | |
Author URI: http://wp.tutsplus.com/ | |
License: GPLv2 | |
*/ |
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 | |
foreach ($product_list as $data) { | |
// код 1С; артикул (ориентироватья ненадо); 0 нет в наличии > 0 в наличии; цена | |
$sku = trim($data[0]); // код 1С | |
$sku = $data[1]; // артикул (ориентироватья ненадо) | |
$quantity = $data[2]; // нет в наличии > 0 в наличии | |
$price = $data[3]; // цена | |
$found = false; |
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 | |
/** | |
* Delete old LOG files | |
*/ | |
$path = $this_dir . '/logs/'; | |
$days = 90; | |
// Open the directory | |
if ($handle = opendir($path)) { | |
// Loop through the directory |
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 | |
// /включать wp-load.php | |
if(!defined(ABSPATH)){ | |
$pagePath = explode('/wp-content/', dirname(__FILE__)); | |
include_once(str_replace('wp-content/' , '', $pagePath[0] . '/wp-load.php')); | |
} |
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 | |
// add_action('woocommerce_before_add_to_cart_button','wdm_add_custom_fields'); | |
add_filter('woocommerce_add_cart_item_data','wdm_add_item_data',10,3); | |
add_filter('woocommerce_get_item_data','wdm_add_item_meta',10,2); | |
add_action( 'woocommerce_checkout_create_order_line_item', 'wdm_add_custom_order_line_item_meta',10,4 ); | |
function wdm_add_custom_fields() | |
{ |