Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ryandemmer's full-sized avatar

Ryan Demmer ryandemmer

View GitHub Profile
@ryandemmer
ryandemmer / textfilter.sql
Created March 18, 2024 09:46
Text Filter sql fix
UPDATE `abcd_extensions` SET `params` = '{"filters":{"1":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"9":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"6":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"7":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"2":{"filter_type":"NH","filter_tags":"","filter_attributes":""},"3":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"4":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"5":{"filter_type":"BL","filter_tags":"","filter_attributes":""},"8":{"filter_type":"NONE","filter_tags":"","filter_attributes":""}}}' WHERE `name` = 'com_config'
@ryandemmer
ryandemmer / my_plugin.php
Created September 15, 2023 15:35
Sample system plugin
<?php
/**
* @copyright Copyright (C) 2023 Joe Public. All rights reserved
* @license GNU General Public License version 2 or later
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
@ryandemmer
ryandemmer / help.json
Created January 18, 2022 13:17
Help Topics
{
"data":
[
{
"title": "Global Configuration",
"xreference": "admin.config.about"
},
{
"title": "Cleanup and Output",
"xreference": "admin.config.cleanup"
@ryandemmer
ryandemmer / emoji.json
Created November 10, 2021 12:45
Standard emoji
[
{
"😀": "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 October 27, 2020 11:43
Convert spaces before colon to non-breaking
(function() {
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onSetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, '&nbsp;:');
});
ed.onGetContent.add(function(ed, o) {
o.content = o.content.replace(/\s:/g, '&nbsp;:');
});
});
@ryandemmer
ryandemmer / onWfGetCustomEmbedData.php
Created July 1, 2020 11:53
onWfGetCustomEmbedData example
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',
);
@ryandemmer
ryandemmer / buildListFromJson.php
Created June 30, 2020 15:54
buildListFromJson
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 June 10, 2020 09:27
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 April 1, 2020 16:01
Sample plugin to resize any image uploaded in Joomla / JCE
<?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 December 6, 2019 10:29
install.pkg.php modification
$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();