Skip to content

Instantly share code, notes, and snippets.

@wlarch
wlarch / wp-embed.js
Created March 26, 2020 12:21
wordpress-iframe-1
/* Resize the iframe on request. */
if ( 'height' === data.message ) {
height = parseInt( data.value, 10 );
if ( height > 1000 ) {
height = 1000;
} else if ( ~~height < 200 ) {
height = 200;
}
@wlarch
wlarch / functions.php
Last active April 3, 2020 20:22
wordpress-iframe-1
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_scripts', PHP_INT_MAX);
function child_theme_enqueue_scripts() {
wp_enqueue_script('iframe-script', get_stylesheet_directory_uri() . '/js/iframe.js', ['jquery'], uniqid(), true);
}
@wlarch
wlarch / iframe.js
Last active July 1, 2024 17:52
Overwrite/bypass <iframe></iframe> height limit imposed by Wordpress
/**
* Overwrite/bypass <iframe></iframe> height limit imposed by Wordpress
* Original idea from bypass-iframe-height-limit plugin by Justin Carboneau
* Adapted from original /wp-includes/js/wp-embed.js
*/
(function(window, document) {
'use strict';
var supportedBrowser = false;
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/vtt
AddOutputFilterByType DEFLATE text/x-component
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
<?php
class StringHelper
{
/**
* Compare an associative multidimensionnal array by specific object value
*
* @param array &$array Reference of the array we want to sort
* @param string $element Element from which we want to order by specific key from
<?php
require "StringHelper.php";
$helper = new StringHelper();
$categories = [];
$news = new stdClass();
$news->names = ["fr" => "Actualités", "en" => "News"];
$categories[] = $news;
@wlarch
wlarch / .php_cs.dist
Created April 28, 2021 18:55
.php_cs.dist (centiva-core)
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => ['=>' => 'align_single_space_minimal'],