Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
On vacation

Pechenki AlexandrKrot

😎
On vacation
View GitHub Profile
@AlexandrKrot
AlexandrKrot / Kama_Breadcrumbs.php
Created Oct 28, 2021
Kama_Breadcrumbs с itemprop="position"
View Kama_Breadcrumbs.php
<?php
/**
* Хлебные крошки для WordPress (breadcrumbs)
*
* @param string [$sep = ''] Разделитель. По умолчанию ' » '
* @param array [$l10n = array()] Для локализации. См. переменную $default_l10n.
* @param array [$args = array()] Опции. См. переменную $def_args
* @return string Выводит на экран HTML код
*
* version 3.3.2
@AlexandrKrot
AlexandrKrot / serialize.js
Created Sep 18, 2021
serialize form, vanila js
View serialize.js
function serializeObject (form) {
// Create a new FormData object
const formData = new FormData(form);
// Create an object to hold the name/value pairs
const pairs = {};
// Add each name/value pair to the object
for (const [name, value] of formData) {
pairs[name] = value;
@AlexandrKrot
AlexandrKrot / functions.php
Created Aug 31, 2021
wc telsender all meta
View functions.php
<?php
/* Telsender all meta*/
function meta_wc_function($list, $order_id)
{
$order = wc_get_order($order_id);
$allmeta = $order->get_meta_data();
@AlexandrKrot
AlexandrKrot / fun.php
Last active Aug 3, 2021
TM Extra Product Options telsender Options
View fun.php
<?php
function meta_wc_function ($list, $order_id){
$order = wc_get_order( $order_id);
$items = $order->get_items();
$product_f = '';
$curents = get_woocommerce_currency_symbol();
foreach ( $items as $item) {
View Crypter.php
<?php
namespace backend\helpers;
use Yii;
class Crypter
{
/**
* Метод шифрования
*
* @var string
@AlexandrKrot
AlexandrKrot / functions.php
Last active Jun 15, 2021
telsender coupons | woocommerce
View functions.php
<?php
/**
* Telsender coupons name
* @param $list
* @param $order_id
* @return mixed
*/
function telsender_coupons($list, $order_id){
View getThumbnailPdf.php
<?php
/**
* Thumbnail PDF
* @param $pdf_file
* @return string
* @throws ImagickException
*/
private function getThumbnailPdf($pdf_file)
{
$thumb_w = 50;
@AlexandrKrot
AlexandrKrot / fun.php
Last active May 6, 2021
FIX (has been blocked by cors policy )
View fun.php
<?php
// Allow from any origin
if(isset($_SERVER["HTTP_ORIGIN"]))
{
// You can decide if the origin in $_SERVER['HTTP_ORIGIN'] is something you want to allow, or as we do here, just allow all
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
}
else
{
@AlexandrKrot
AlexandrKrot / functions.php
Created Apr 26, 2021
fix tinymce data param tags
View functions.php
<?php
function delfi_tinymce_fix( $init )
{
// добавление html элементов, которые не будут стираться
$init['extended_valid_elements'] = 'h1[*],h2[*],h3[*],h4[*],h5[*],span[*],div[*],article[*],noindex[8],ul[class|id]';
// не удалять разрывы строк
$init['remove_linebreaks'] = false;
// конвертировать символы новой строки в BR
@AlexandrKrot
AlexandrKrot / language_helper.php
Last active Apr 8, 2021
ImageCMS hreflang function
View language_helper.php
<?php
/**
* list language $hrefland
* @return array
*/
if (!function_exists('listLang')) {
function listLang()
{