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
define('SAVEQUERIES', true); | |
add_action('shutdown', 'sql_logger'); | |
function sql_logger() { | |
global $wpdb; | |
$log_file = fopen(ABSPATH.'/sql_log.txt', 'a'); | |
fwrite($log_file, "//////////////////////////////////////////\n\n" . date("F j, Y, g:i:s a")."\n"); | |
foreach($wpdb->queries as $q) { | |
fwrite($log_file, $q[0] . " - ($q[1] s)" . "\n\n"); | |
} | |
fclose($log_file); |
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
if (!CModule::IncludeModule('highloadblock')) | |
return; | |
$rsData = \Bitrix\Highloadblock\HighloadBlockTable::getList(array('filter'=>array('TABLE_NAME'=>$arResult["PROPERTIES"]["BLOCK_PAY_5"]["USER_TYPE_SETTINGS"]["TABLE_NAME"]))); | |
if ( ($hldata = $rsData->fetch()) ){ | |
$hlentity = \Bitrix\Highloadblock\HighloadBlockTable::compileEntity($hldata); | |
$hlDataClass = $hldata['NAME'].'Table'; | |
$res = $hlDataClass::getList(array( | |
'filter' => array( | |
'UF_XML_ID' => $arResult["PROPERTIES"]["BLOCK_PAY_5"]["VALUE"], |
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
bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory | |
perl: warning: Setting locale failed. | |
perl: warning: Please check that your locale settings: | |
LANGUAGE = (unset), | |
LC_ALL = (unset), | |
LC_CTYPE = "UTF-8", | |
LANG = "en_US.UTF-8" | |
are supported and installed on your system. | |
perl: warning: Falling back to the standard locale ("C"). | |
perl: warning: Setting locale failed. |
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
$pdf_path = $_SERVER['DOCUMENT_ROOT'] . "/policies/{$number}.pdf"; | |
$url = 'https://my.inapp.insure/certgen?policy='.$policy.'&number='.$number.'&address='.$address.'&policyholder='.$policyholder.'&phone='.$phone.'&email='.$email.'&date_of_birth='.$date_of_birth.'&validity='.$validity.'&cost='.$cost.'&comes_into_force='.$comes_into_force.'&valid_until='.$valid_until; | |
if (!file_exists($pdf_path)) { | |
$command = 'google-chrome --no-sandbox --headless --disable-gpu --print-to-pdf="' . $pdf_path . '" "'.$url.'"'; | |
exec($command); | |
} | |
//return [$pdf_path, $url]; | |
$content = file_get_contents($pdf_path); | |
header("Content-type:application/pdf"); | |
header("Content-Disposition:attachment;filename='{$number}.pdf'"); |
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
merge_slashes on; | |
if ($request_uri ~* "\/\/+") { | |
rewrite ^/(.*) $scheme://$host/$1 permanent; | |
} |
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
add_filter('woocommerce_admin_billing_fields', 'custom_woocommerce_billing_fields'); | |
function custom_woocommerce_billing_fields($fields) | |
{ | |
$fields['your-diapason-from'] = array( | |
'label' => "Ширина двери", | |
'placeholder' => "Введите ширину двери", | |
'required' => false, | |
'clear' => false, | |
'type' => 'number', |
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
add_action( 'wpcf7_before_send_mail', 'create_order_function', 20, 3 ); | |
function create_order_function( $contact_form, &$abort, $that ){ | |
$data = $that->get_posted_data(); | |
$url = $_SERVER["REQUEST_URI"]; | |
if( $data['order-form'] == "Y" ) { | |
/*Array | |
( | |
[your-city] => | |
[your-name] => | |
[your-email] => [email protected] |
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 replace_query_parameter($name, $arr_replace, $delete = []) { | |
$url = $_SERVER["REQUEST_URI"]; | |
$regExp = "/{$name}\=[a-z0-9\[\]\%]*/i"; | |
if( count($delete) > 0 ) { | |
foreach ($delete as $del) { | |
$url = preg_replace("/{$del}\=[a-z0-9\[\]\%]*/i", "", $url); | |
} | |
} |
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
add_filter('woocommerce_shortcode_products_query', 'product_query_function', 10, 3); | |
function product_query_function($query_args, $attributes, $type) { | |
$get = $_GET; | |
if(!empty($get)) { | |
foreach ($get as $key => $value) { | |
if(strpos($key, "filter_") !== false && $value && strpos($key, "product_visivility") === false) { | |
//if(!isset($query_args["meta_query"]["relation"])) $query_args["meta_query"]["relation"] = "AND"; |
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
<? | |
use Bitrix\Main; | |
Main\EventManager::getInstance()->addEventHandler( | |
'main', | |
'OnEndBufferContent', | |
'lazyload_img' | |
); | |
function get_content($URL){ | |
$ch = curl_init(); |