View .php_cs.dist
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 | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => [ | |
'default' => 'single_space', | |
'operators' => ['=>' => 'align_single_space_minimal'], |
View categories.php
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 | |
require "StringHelper.php"; | |
$helper = new StringHelper(); | |
$categories = []; | |
$news = new stdClass(); | |
$news->names = ["fr" => "Actualités", "en" => "News"]; | |
$categories[] = $news; |
View StringHelper.php
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 | |
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 |
View mod_expires and mod_deflate for caching assets in .htaccess
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
<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 |
View iframe.js
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
/** | |
* 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; |
View functions.php
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
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); | |
} |
View wp-embed.js
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
/* 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; | |
} |