Skip to content

Instantly share code, notes, and snippets.

View kagg-design's full-sized avatar

Igor at KAGG Design kagg-design

View GitHub Profile
<?php
public function get_element_translations( $element_id, $trid = false, $actual_translations_only = false ) {
$valid_element = $this->maybe_populate_cache ( $element_id, $trid );
if ( $element_id ) {
$res = $valid_element
? ( $actual_translations_only
? $this->filter_for_actual_trans ( $element_id ) : $this->translations[ $element_id ] ) : array();
} elseif ( $trid ) {
$res = isset( $this->trid_groups[ $trid ] ) ? $this->trid_groups[ $trid ] : array();
REMOTE_DOMAIN="site.ru"
KEY_FILE="~/.ssh/site-root.rsa"
REMOTE_PATH="/path/to/site_dir/"
LOCAL_PATH="D:/Sites/site/"
REMOTE_URL="https://site.ru"
LOCAL_URL="http://site.test"
AFTER_SYNC_COMMANDS="wp plugin deactivate super-socializer && wp user delete 44903 --yes && add_kagg"
#!/bin/bash
if [ "$OSTYPE" == "linux-gnu" ] && grep -q Microsoft /proc/version; then
WP_PATH=$(wp config path)
else
WP_PATH=$(wp config path 2>/dev/null)
fi
if [[ ! $WP_PATH ]]; then
echo "This is not a WordPress install"
@kagg-design
kagg-design / fix.php
Last active March 26, 2020 11:18
Fix for Gravity Forms Multilingual.
<?php
/**
* @return bool
*/
function woocommerce_gforms_use_ajax_filter() {
return true;
}
add_filter( 'woocommerce_gforms_use_ajax', 'woocommerce_gforms_use_ajax_filter' );
<?php
/**
* @author OnTheGo Systems
*/
class GFML_Conditional_Logic extends GFML_Form {
/**
* It translates the attributes of the conditional logic, before translating the fields.
* This is necessary, or it would not be possible to adjust the conditional logic based on values from "choices" fields.
*
<?php
use Cyr_To_Lat\Cyr_To_Lat_TestCase;
class Krya {
public function init() {
$overload = new Krya_Overload();
add_action( 'over', [ $overload, 'over_func' ] );
}
jQuery( document ).ready(
function( $ ) {
var timer;
var logAjax = 0;
var $nonce = $( '#gts_webtranslator_gateway_nonce' ).val();
var $progressBarWrap = $( '#progress-bar-wrap' );
var $progressDot = $( '#progress-dot' );
var $progressCount = $( '#progress-count' );
var $progressBar = $( '#progress-bar' );
var $logElement = $( '#webtranslator-log' );
@kagg-design
kagg-design / att.php
Created June 23, 2020 11:58
Mail attachment missing
<?php
add_action( 'init', 'att_page', PHP_INT_MAX );
function att_page() {
if ( is_att_page() ) {
$attachment = null;
$to = 'info@kagg.eu';
$subject = 'subj';
$message = 'message';
include_once ABSPATH . 'wp-admin/includes/file.php';
@kagg-design
kagg-design / block-login.php
Last active June 23, 2020 14:32
Block any kind of logins to the site
<?php
/**
* Plugin Name: Block Login
*/
function no_login_authenticate_filter( $user, $username, $pass ) {
remove_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
return null;
}
@kagg-design
kagg-design / cyr2lat-attributes-in-woocommerce.php
Created March 20, 2021 14:01
MU Plugin to block transliteration of WooCommerce attributes and attribute terms.
<?php
/**
* MU Plugin to block transliteration of WooCommerce attributes and attribute terms.
*
* @package cyr-to-lat
*/
/**
* Class Block_WC_Attr_Cyr2lat.
*/