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 | |
/** | |
* Process Timer. | |
* Create a system timer for determining the run-time of a specific process. | |
* | |
* Usage: | |
* $timer = new \Tyme\ProcessTimer(); | |
* $timer->start(); | |
* // Long running process | |
* $timer->stop(); |
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 | |
/** | |
* Block Converter. | |
* Convert HTML to Gutenberg Blocks. | |
* | |
* @package Tyme\BlockConverter | |
*/ | |
namespace Tyme; |
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
const { getBlockVariations, unregisterBlockVariation } = wp.blocks; | |
wp.domReady(() => { | |
const allowedEmbedBlocks = ['vimeo', 'youtube']; | |
getBlockVariations('core/embed').forEach(function (blockVariation) { | |
if (allowedEmbedBlocks.indexOf(blockVariation.name) === -1) { | |
unregisterBlockVariation('core/embed', blockVariation.name); | |
} | |
}); |
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 | |
/** | |
* Automatic Media & Post Cache Purging | |
* when using the Enable Media Replace plugin. | |
* | |
* @package Tyme | |
*/ | |
namespace Tyme\CacheManager; |
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 | |
/** | |
* Serialize Gutenberg Blocks into HTML Markup | |
* | |
* @param array $block Array of block data to be serialized | |
* @return string Gutenberg HTML markup of serialized block | |
*/ | |
function serialize_block( $block ) { | |
if ( ! isset( $block['blockName'] ) ) { | |
return false; |