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_action( 'admin_init', 'wpse_57647_register_settings' ); | |
/* | |
* Register settings | |
*/ | |
function wpse_57647_register_settings() | |
{ | |
register_setting( | |
'general', |
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
element = document.createElement('ul'); | |
li = document.createElement("li") | |
liText = document.createTextNode('text') | |
li.appendChild(liText) | |
element.appendChild(li) | |
listresult.append(element) | |
/* |
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
public function outputCsv($fileName, $assocDataArray,$delimiter=';') | |
{ | |
ob_clean(); | |
header('Content-Encoding: UTF-8'); | |
header('Content-type: text/csv; charset=UTF-8'); | |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); | |
header('Cache-Control: private', false); | |
header('Content-Type: text/csv'); | |
header('Content-Disposition: attachment;filename=' . $fileName); | |
if(isset($assocDataArray['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
function csv_to_array($filename='', $delimiter=';'){ | |
if(!file_exists($filename) || !is_readable($filename)) | |
return FALSE; | |
$header = NULL; | |
$data = array(); | |
if (($handle = fopen($filename, 'r')) !== FALSE) | |
{ | |
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) | |
{ |
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 | |
// Добавляем foreign key | |
// Добавляем foreign key | |
$this->addForeignKey( | |
'FK_organization_id', // это "условное имя" ключа | |
'organization_sub', // это название текущей таблицы | |
'organization_id', // это имя поля в текущей таблице, которое будет ключом | |
'organization', // это имя таблицы, с которой хотим связаться | |
'id', // это поле таблицы, с которым хотим связаться | |
'CASCADE', // что делать при удалении сущности, на которую ссылаемся |
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_action( 'woocommerce_before_shop_loop_item_title', function(){ | |
if (is_user_logged_in()) { | |
global $product; | |
$attachment_ids = $product->get_gallery_image_ids(); | |
$attr = ['class'=>'to-image']; | |
echo wp_get_attachment_image(reset($attachment_ids), 'shop_catalog',false, $attr); | |
} |
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 | |
namespace common\behaviors; | |
use yii\base\Behavior; | |
use yii\base\InvalidConfigException; | |
use yii\db\ActiveRecord; | |
use yii\base\Event; |
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
$(document).ready(function() { | |
function scrollTracking(){ | |
var wt = $(window).scrollTop(); | |
var wh = $(window).height(); | |
var et = $('#activex').offset().top - 200; | |
var eh = $('#active').outerHeight(); | |
if (wt + wh >= et && wt + wh - eh * 2 <= et + (wh - eh)){ | |
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
<If "%{REQUEST_URI} =~ /url/"> | |
SetEnvIf Content-Type ^(multipart/form-data)(.*) NEW_CONTENT_TYPE=multipart/form-data-alternate$2 OLD_CONTENT_TYPE=$1$2 | |
RequestHeader set Content-Type %{NEW_CONTENT_TYPE}e env=NEW_CONTENT_TYPE | |
</If> |
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 | |
/* WooCommerce Distance Rate Shipping delivery_duration send telsender */ | |
function delivery_address_telsender ($list, $order_id){ | |
$meter_duration = WC()->session->get('szbd_distance_car', false); | |
if ($meter_duration) { | |
$km = $meter_duration/1000; | |
$list['{delivery_duration}'] = round($km,2).' км'; |