Skip to content

Instantly share code, notes, and snippets.

View escopecz's full-sized avatar

John Linhart escopecz

View GitHub Profile
@escopecz
escopecz / tutorial.md
Last active August 29, 2015 14:04
Pagekit with Docker

How to run Pagekit with Docker

Pull Pagekit + server

sudo docker pull marksteve/pagekit

Clone MySql git repo

Firstly, go to a directory where scripts from gir repo should be stored.

@escopecz
escopecz / joomla-version-compare.php
Created August 19, 2014 11:24
Check / get / compare Joomla version
if (version_compare(JVERSION, '3.0.0', '>'))
{
// code for J!3.0.0 and newer
}
else
{
// code for older J! versions
}
@escopecz
escopecz / functions.md
Last active April 3, 2019 04:39
Set expiration date for Easy Digital Downloads Wordpress plugin

Here is solution for Easy Digital Downloads WP plugin to disable downloads one year after purchase.

Place these 3 functions to /wp-content/themes/{your_theme}/functions.php:

/**
 * Function returns expiration date based on post / payment date.
 * Replace '365 day' with your time period.
 * 
 * @param string date of post / payment
@escopecz
escopecz / gist:931ad49f741b6af75cb6
Last active June 29, 2020 00:17
Mautic API integration tutorial for PHP

Mautic has API to interact with other systems. There is PHP API library for faster integration to PHP projects.

Install Mautic API library with Composer

API library isn't at Packagist in time of writing this article. Good chance is the library is at Packagist in time of reading, so install it from there and skip this.

Install from GitHub repo. So to use the library as Composer package from GitHub repo your composer.json should contain:

...
@escopecz
escopecz / commands.php
Last active April 18, 2023 22:43 — forked from alanhartless/cron.php
Script to run Mautic (https://mautic.org) commands from a URL.
<?php
if (!isset($_GET['ILoveMauticReallyIDo'])) {
echo 'The secret phrase is wrong.';
die;
}
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',
<?php
/**
* Push data to a Mautic form
*
* @param array $data The data submitted by your form
* @param integer $formId Mautic Form ID
* @param string $ip IP address of the lead
* @return boolean
*/
@escopecz
escopecz / webhookTest.php
Last active October 29, 2021 12:57
A simple script to log a Mautic webhook request
<?php
/**
* A helper class to log and get the Mautic webhook request
*/
class webhookTest {
/**
* Log a message to a file
*
@escopecz
escopecz / index.html
Last active September 4, 2017 11:45
Cronfig Integration example
<html>
<head></head>
<body>
<div id="cronfig-wrapper">
Loading...
</div>
<script type="text/javascript">
document.cronfigConfig = {
platform: 'app_name',
tasks: {
@escopecz
escopecz / form.html
Last active October 16, 2023 06:35
An example of how to send a form submission to a Mautic form with jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mautic Form Test</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>