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
@CrossOrigin | |
@RestController | |
@RequestMapping("/api/example") | |
public class Exampleresource { | |
@GetMapping(path = "/translate", produces = MediaType.APPLICATION_JSON_VALUE) | |
public ResponseEntity<String> translate() { | |
// String result = "Ok"; | |
String file1Path = "src/main/resources/transfile1.txt"; | |
String file2Path = "src/main/resources/transfile2.txt"; |
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 | |
/** | |
* Funciones utiles | |
*/ | |
if (!defined('ABSPATH')) { | |
exit('No direct access allowed'); | |
} | |
if (!defined('TT_SESSION_TRANSIENT_KEY')) { | |
$cookie_key = 'tt_sesiones_' . COOKIEHASH; | |
$session_transient_key = !empty($_COOKIE[$cookie_key]) ? $_COOKIE[$cookie_key] : ''; |
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 | |
/** | |
* Limitar maximo de items de un group field con la opcion rows_limit | |
* @param array $cmb_id The current box ID. | |
* @param int $object_id The ID of the current object. | |
* @param string $object_type The type of object you are working with. | |
* @param array $cmb This CMB2 object. | |
*/ | |
add_action('cmb2_after_form', 'js_limit_group_repeat', 10, 4); | |
function js_limit_group_repeat($cmb_id, $object_id, $object_type, $cmb) { |
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
Gracias por darte de alta. Muy pronto recibirás nuestras noticias. | |
Thank you for signing up. You will receive our news very soon. | |
Hubo un error intentando enviar tu mensaje. Por favor inténtalo de nuevo más tarde. | |
There was an error trying to send your message. Please try again later. | |
Introduce tu dirección de e-mail. | |
Enter your email address. | |
Hubo un error intentando enviar tu mensaje. Por favor inténtalo de nuevo más tarde. |
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
// extensions installed | |
Alignment | |
Auto Close Tag | |
js-beautify for VS Code | |
vscode-expand-region | |
highlight-matching-tag | |
Path Intellisense | |
Intelephense | |
vscode-phpcs | |
phpfmt for Visual Studio Code |
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 | |
// tt_reorder_multiarray_by_numeric_subvalue | |
function tt_reorder_multiarray_by_numeric_subvalue($matriz, $subkey){ | |
function cmp($key) { | |
return function($a, $b) use ($key){ | |
$an = intval($a[ $key ]); | |
$bn = intval($b[ $key ]); | |
if($an==$bn){ | |
return 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
<?php | |
// Listar archivos recursivamente y reducir tamaño de imágenes con Imagick | |
if( isset($_GET['list_upload_dir']) ) | |
add_action( "init", "list_upload_dir" ); | |
function list_upload_dir(){ | |
$wud = wp_upload_dir(); | |
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $wud['basedir'] ) ); | |
$i = 0; | |
echo'<meta charset="UTF-8">'; | |
echo'<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">'; |
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 | |
// custom add_rewrite_rule y add_rewrite_tag | |
add_action('init', 'custom_rewrite_rule'); | |
function custom_rewrite_rule() { | |
$rp = getFirstPostByTemplate('template-revistas.php'); | |
if( empty($rp) ) return false; | |
$param1 = 'categoria'; | |
$param2 = 'entrada'; | |
add_rewrite_tag('%'.$param1.'%', '([^&]+)'); | |
add_rewrite_tag('%'.$param2.'%', '([^&]+)'); |
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 | |
/** | |
Re-use some existing WordPress functions so you don't have to write a bunch of raw PHP to check for SSL, port numbers, etc | |
Place in your functions.php (or re-use in a plugin) | |
If you absolutely don't need or want any query string, use home_url(add_query_arg(array(),$wp->request)); | |
Hat tip to: | |
+ http://kovshenin.com/2012/current-url-in-wordpress/ |
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( 'init', function(){ | |
if( !isset($_GET['test_adjuntar']) ) return false; | |
if ( !function_exists('media_sideload_image') ){ | |
require_once( ABSPATH.'/wp-admin/includes/media.php' ); | |
require_once( ABSPATH.'/wp-admin/includes/file.php' ); | |
require_once( ABSPATH.'/wp-admin/includes/image.php' ); | |
} | |
$uploadpath = wp_get_upload_dir(); |
NewerOlder