Skip to content

Instantly share code, notes, and snippets.

@litzinger
litzinger / .phpstorm.meta.php
Last active February 26, 2024 14:38
PhpStorm meta file for ExpressionEngine
<?php
/**
* ExpressionEngine PhpStorm Meta
*
* This file is not a CODE, it makes no sense and won't run or validate
* Its AST serves PhpStorm IDE as DATA source to make advanced type inference decisions.
*
* @see https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Advanced+Metadata
*/
@litzinger
litzinger / FluidField.php.diff
Last active December 11, 2023 14:20
Proposed changes to EE's Fluid Field - See https://github.com/ExpressionEngine/ExpressionEngine/issues/1643 for past convos
--- Model/FluidField_unedited.php 2023-07-17 11:25:23
+++ Model/FluidField.php 2023-07-07 16:49:14
@@ -119,7 +119,9 @@
$rows = ee()->extensions->call(
'fluid_field_get_field_data',
$this->field_id,
- $this->field_data_id
+ $this->field_data_id,
+ $this->fluid_field_id,
+ $this->entry_id
@litzinger
litzinger / screencapture.sh
Last active November 17, 2023 07:30
Take screenshot every 5 minutes
First, create a couple new folders:
cd ~/
mkdir Scripts
mkdir Screenshots
cd Screenshots
mkdir cron
cd ~/Scripts
vim screencapture.sh
<?php
define('XDEBUG', "xdebug");
define('ZEND_DEBUGGER', "Zend Debugger");
function createXmlHeader()
{
return "<?xml version=\"1.0\"?>";
}
@litzinger
litzinger / ee-tips.md
Last active August 24, 2023 18:17
ExpressionEngine Quick Tips

Forcing a database update

If you're in a situation where you've already updated EE, but then need to run the database upgrades again, this will help force the installer to run the updates again. This situation may occur if you've upgrade a local or dev version of a site, but need to grab a newer version of the production database to get it up-to-date too.

  1. Change $config['app_version'] to the previous version you've already upgraded from.

  2. Add define('INSTALL_MODE', TRUE); to your admin.php file, then reload admin.php. Clicking the version number in the footer should show an update is available, even though it may match what says is currently installed. Run the update normally, then remove define('INSTALL_MODE', TRUE); from your admin.php file.

OR

@litzinger
litzinger / 0-Debugging-ExpressionEngine.md
Last active January 26, 2023 20:28
How to show errors when you get a white screen in EE. Turning up the debugging will reveal PHP errors.

Overview

Below are two techniques to help debug the WSOD (white screen of death), usually a 500 server error, in an ExpressionEngine site. The Basic-Debugging option will be suitable in most cases and is specific to ExpressionEngine. The Advanced-Debugging is generic and applicable to any PHP based software. If the basic debugging does not work, try the advanced.

If you get a WSOD you will need to first get your site to reveal an error before reporting it to EllisLab or the add-on developer. Simply reporting "I get a white screen" does not give the developer enough information to assist you. An error message on the other hand will point the developer to the source of the issue.

@litzinger
litzinger / ft.colorpicker.php
Created December 12, 2022 16:30
Refactor the EE ColorPicker fieldtype to support named colors
<?php
/**
* ExpressionEngine (https://expressionengine.com)
*
* @link https://expressionengine.com/
* @copyright Copyright (c) 2003-2022, Packet Tide, LLC (https://www.packettide.com)
* @license https://expressionengine.com/license
*/
use Mexitek\PHPColors\Color;
@litzinger
litzinger / cron.sh
Created October 25, 2022 14:15
Force macOS Calendar to sync with Exchange
0 * * * * launchctl stop com.apple.CalendarAgent && launchctl start com.apple.CalendarAgent
@litzinger
litzinger / build.php
Created August 8, 2022 16:19
localize vendor packages
<?php
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($addonDir, \RecursiveDirectoryIterator::SKIP_DOTS),
\RecursiveIteratorIterator::LEAVES_ONLY
);
download_and_extract_package('basee', 'Basee', $outputDir, $addonDir);
download_and_extract_package('file-field', 'FileField', $outputDir, $addonDir);
@litzinger
litzinger / getset-php.sublime-snippet
Created March 3, 2014 21:18
Creates getter and setter in PHP model
<snippet>
<content><![CDATA[
/**
* Get $1
*
* @return ${2:[type]} \$$1
*/
public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};