Skip to content

Instantly share code, notes, and snippets.

View ryandemmer's full-sized avatar

Ryan Demmer ryandemmer

View GitHub Profile
@ryandemmer
ryandemmer / gist:7e2d36ae93e9349742bc
Created April 27, 2015 15:12
Popup dynamic class
(function($) {
$(document).ready(function() {
$('a.jcepopup').click(function() {
var self = this;
window.setTimeout(function() {
$('#jcemediabox-popup-page').addClass('popup-' + $(self).index());
}, 100);
});
});
@ryandemmer
ryandemmer / filesystem-hikashop.php
Last active January 31, 2017 14:37
Example JCE Filesystem Extension for HikaMarket
<?php
require_once(JPATH_SITE . '/components/com_jce/editor/extensions/filesystem/joomla.php');
class WFHikashopFileSystem extends WFJoomlaFileSystem {
private function getHikaMarketVendor() {
$hkm_init = defined('HIKAMARKET_COMPONENT');
if(!$hkm_init ) {
<?php
class PlgSystemWfHikashop extends JPlugin {
public function __construct(&$subject, $config) {
parent::__construct($subject, $config);
}
private function getHikaMarketVendor() {
$hkm_init = defined('HIKAMARKET_COMPONENT');
@ryandemmer
ryandemmer / plg_content_example.php
Last active January 20, 2017 09:32
OnContentBeforeSave example
<?php
class PlgContentExample extends JPlugin
{
public function onContentBeforeSave($context, $article, $isNew)
{
if ($context != 'com_content.form') {
return true;
}
@ryandemmer
ryandemmer / sef.php
Last active April 14, 2017 11:30
System - SEF
<?php
/**
* @package Joomla.Plugin
* @subpackage System.sef
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
@ryandemmer
ryandemmer / emoji.json
Created February 16, 2018 17:11
Emjoi JSON file
[
{"😀":"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"},
{"😈":"smiling_face_with_horns"},
@ryandemmer
ryandemmer / editor.js
Created March 29, 2018 11:32
Replace editor content
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onInit.add(function () {
function updateContent(content) {
content = content.replace(/\b(jce)\b/gi, function(match, value) {
return value.toUpperCase();
});
content = content.replace(/\b(january)\b/gi, function(match, value) {
return '<strong>' + value + '</strong>';
});
@ryandemmer
ryandemmer / editor.js
Created April 6, 2018 10:50
Remove external links
tinyMCE.onAddEditor.add(function (mgr, ed) {
ed.onPreInit.add(function () {
ed.parser.addAttributeFilter('href', function (nodes, name) {
var i = nodes.length,
node, value;
while (i--) {
node = nodes[i], value = node.attr('href');
@ryandemmer
ryandemmer / editor.js
Last active June 4, 2018 18:22
Create target on links when pasting
tinyMCE.onAddEditor.add(function(mgr, ed) {
ed.onPreInit.add(function() {
function updateTarget(elm, externalOnly) {
if (externalOnly && !/:\/\//.test(elm.getAttribute('href'))) {
return;
}
if (!elm.target) {
ed.dom.setAttrib(elm, 'target', '_blank');
}
@ryandemmer
ryandemmer / country_map.csv
Last active August 15, 2018 14:38
Country Code Map
code country region
AD Andorra EU
AE United Arab Emirates AS
AF Afghanistan AS
AG Antigua and Barbuda NA
AI Anguilla NA
AL Albania EU
AM Armenia AS
AN Netherlands Antilles NA
AO Angola AF