Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Demmer ryandemmer

View GitHub Profile
View help.json
{
"data":
[
{
"title": "Global Configuration",
"xreference": "admin.config.about"
},
{
"title": "Cleanup and Output",
"xreference": "admin.config.cleanup"
View emoji.json
[
{
"😀": "Grinning Face",
"😁": "Grinning Face With Smiling Eyes",
"😂": "Face With Tears Of Joy",
"😃": "Smiling Face With Open Mouth",
"😄": "Smiling Face With Open Mouth And Smiling Eyes",
"😅": "Smiling Face With Open Mouth And Cold Sweat",
"😆": "Smiling Face With Open Mouth And Tightly-Closed Eyes",
"😇": "Smiling Face With Halo",
@ryandemmer
ryandemmer / editor.js
Created Oct 27, 2020
Convert spaces before colon to non-breaking
View editor.js
(function() {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onSetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, ' :');
});
ed.onGetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, ' :');
});
});
@ryandemmer
ryandemmer / onWfGetCustomEmbedData.php
Created Jul 1, 2020
onWfGetCustomEmbedData example
View onWfGetCustomEmbedData.php
public function onWfGetCustomEmbedData($url = '')
{
$expression = 'http(s)://(www\.)myembed\.com/(.*)id=(.*)';
$data = array(
'width' => '560',
'height'=> '315',
'src' => '',
'allow' => 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture allowfullscreen',
);
View buildListFromJson.php
private static function buildListFromJson($nodes)
{
$data = array();
$nodes = isset($nodes['@graph']) ? $nodes['@graph'] : array();
$properties = array_map(function ($node) {
if ($node['@type'] == 'rdf:Property') {
$id = str_replace('http://schema.org/', '', $node['@id']);
@ryandemmer
ryandemmer / inlineupload.php
Last active Jun 10, 2020
inlineupload.php
View inlineupload.php
<?php
defined('JPATH_BASE') or die;
class PlgSystemInlineUpload extends JPlugin
{
public function onWfFileSystemGetRootDir(&$root)
{
// inline upload only
if (JFactory::getApplication()->input->getInt('inline', 0) === 1) {
@ryandemmer
ryandemmer / uploadresize.php
Created Apr 1, 2020
Sample plugin to resize any image uploaded in Joomla / JCE
View uploadresize.php
<?php
defined('JPATH_BASE') or die;
class PlgSystemUploadResize extends JPlugin
{
public function onContentAfterSave($context, &$object_file)
{
if (!preg_match('#^com_(media|jce)\.file$#', $context)) {
@ryandemmer
ryandemmer / install.pkg.php
Created Dec 6, 2019
install.pkg.php modification
View install.pkg.php
$version = (string) $parent->manifest->version;
$current_version = (string) $parent->get('current_version');
$theme = 'modern';
// update toolbar_theme
if ($theme) {
$table = JTable::getInstance('Profiles', 'JceTable');
$db = JFactory::getDBO();
@ryandemmer
ryandemmer / editor.css
Created May 29, 2019
editor.css file with font size increases for improved readability
View editor.css
/* import your template stylesheet and any others as required */
@import url('template.css');
/* set the base font size and line height */
html {
font-size: 13px;
line-height: 18px
}
/* set the increased font size and line height for all elements */
View gist:477f81832e7bb306417bea088443d51b
$text = preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\s|\+)[^"]*"))#', '$1="'/$2$3', $text);