Skip to content

Instantly share code, notes, and snippets.

@tonypartridge
tonypartridge / generatePdfWithSVGImages
Created March 22, 2023 13:51
Convert Apex Charts to Image and to end of a PDF Document in a new page.
function generatePDF() {
var canvas = document.querySelector("#PDF");
screenWidth = parseFloat(window.getComputedStyle(canvas).width);
var charts = document.querySelectorAll('.filament-widgets-container');
var images = [];
charts.forEach(function (el) {
html2canvas(el, {
scale: 2480 / screenWidth // 2480px - size for A4 paper, 300 dpi
@tonypartridge
tonypartridge / jcm.php
Created October 5, 2022 03:45
JomClassifieds to DJClassifieds Migration Script - Joomla 3 -> 4
<?php
/**
* This script is to be placed in the root of Joomla! and run via the browser,
* it will empty DJ Classifieds tables so can only be used on w J4 sites
* you MUST have already copied the Joomla! Users over too as we just set the user_ids.
**/
define('_JEXEC', 0);
$mediaFolderReplacement = 'com_jomclassifieds'; // replace com_jomclassifieds with this value; i.e. /media/classifieds_archive instead of the original /media/jom_classifieds
@tonypartridge
tonypartridge / Joomla RSVP Pro - Sym Linker
Created January 10, 2019 16:59
Local Development Phing build script to sym link RSVP Pro Project structure
<?xml version="1.0" encoding="UTF-8"?>
<!-- Usage - run phing -f linker.xml -Dp=/var/www/je -->
<project name="linker" default="link" basedir=".">
<property name="URI.base" value="./"/>
<resolvepath propertyName="URI.base" file="${URI.base}"/>
<property name="p" value="" />
<property name="component" value="com_rsvppro"/>
<property name="rootPath" value="${URI.base}"/>
@tonypartridge
tonypartridge / bulk_sessions.php
Created October 16, 2018 14:30
Bulk Session inserter for Joomla! replace the database connection details with your own database details.
<?php
// Simple script to insert lots of sessions to Joomla _session table.
$limit = 20000;
// Database connection using mysqli
$dbname = 'j33jq';
$dbuser = 'root';
$dbpass = 'root';
@tonypartridge
tonypartridge / wpExportParseUrlRedirect.php
Created July 12, 2018 13:06
Simple PHP Script to parse Wordpress posts xml export to get the relative url and prepare for Joomla! com_redirects, note using J2XML with WP Import plugin to import content quickly.
<?php
// Make sure the WP File is called wpxmlfile.xml
$xmlfile = file_get_contents('wpxmlfile.xml');
$wpfile = simplexml_load_string($xmlfile)->channel;
// Set the parent menu item alias for the posts to be accessed under
// Assumed at present it is 'News with the alias news'
$newParentAlias = '/news/';
<?php
/** In this scenario I have a custom field, type list with the name 'company-name' for my users **/
$user = JFactory::getUser();
JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php'); // Load the custom fields helper
$ProfileFields = FieldsHelper::getFields('com_users.user', $user, true);
foreach ($ProfileFields as $field) {
@tonypartridge
tonypartridge / default.xml
Last active June 26, 2018 14:37
Markup for pre-setting filters in Joomla! Admin menu items, this one is for com_content
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CONTENT_ARTICLES_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_CONTENT_ARTICLES_VIEW_DEFAULT_DESC]]>
</message>
</layout>
<fields name="request">
<fieldset name="request"
>
{"field20":"40","field120":"60","field27":["1"],"field1":["VSimexRPuXNuFEng"],"field22":["1"],"field2":["wEmlaFFzH"],"field3":["QRaAfuSoQJn"],"field4":["oLqqdvAB"],"field5":"vIMJuU ofwnvszwaqik, [url=http:\/\/aqdrbzyjcyiy.com\/]aqdrbzyjcyiy[\/url], [link=http:\/\/oxuzfknyjbin.com\/]oxuzfknyjbin[\/link], http:\/\/cntzorajsini.com\/","field6":"KuRVPJLkaUYUGHs","field7":"eLzwiuKcnW","field9":["1"],"field10":["1"],"field11":["0"],"field13":["0"],"field14":["1"],"field15":["vIMJuU <a href="http://ofwnvszwaqik.com/" />ofwnvszwaqik, [url=http:\/\/aqdrbzyjcyiy.com\/]aqdrbzyjcyiy[\/url], [link=http:\/\/oxuzfknyjbin.com\/]oxuzfknyjbin[\/link], http:\/\/cntzorajsini.com\/"],"field16":["1"],"field18":["vIMJuU <a href="http://ofwnvszwaqik.com/" />ofwnvszwaqik, [url=http:\/\/aqdrbzyjcyiy.com\/]aqdrbzyjcyiy[\/url], [link=http:\/\/oxuzfknyjbin.com\/]oxuzfknyjbin[\/link], http:\/\/cntzorajsini.com\/"],"field19":["vIMJuU <a href="http://ofwnvszwaqik.com/" />ofwnvszwaqik, [url=http:\/\/aqdrbzyjcyiy.com\/]aqdrbzyjcyiy[\/url]
@tonypartridge
tonypartridge / latestadded_events.php
Last active January 4, 2017 14:12
JEvents Latest Added Events Query / Setup
<p><?php echo JText::_("JEV_CPANEL_LATEST_EVENTS_ADDED_DESC"); ?> </p>
<?php
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.

Keybase proof

I hereby claim:

  • I am tonypartridge on github.
  • I am tonypartridge (https://keybase.io/tonypartridge) on keybase.
  • I have a public key whose fingerprint is F2DB E915 4714 271E 2EFD D8A6 F058 BCD0 E8F6 B0CE

To claim this, I am signing this object: