This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get Upload Preferences (Cross-compatible between ExpressionEngine 2.0 and 2.4) | |
* @param int $group_id Member group ID specified when returning allowed upload directories only for that member group | |
* @param int $id Specific ID of upload destination to return | |
* @return array Result array of DB object, possibly merged with custom file upload settings (if on EE 2.4+) | |
*/ | |
function get_upload_preferences($group_id = NULL, $id = NULL) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove any <script> tags | |
// Go backwards to factor in nested script tags, e.g. <script>document.write('<script></script>')</script> | |
$offset = strlen($html) - 9; // Minimum match length is 9 chars (<script/>) | |
for ($offset; $offset >= 0; $offset--) | |
{ | |
$substr = substr($html, $offset); | |
if (preg_match('/^<script[^>]+?\/>|^<script(?:.|\s)*?\/script>/im', $substr, $match)) | |
{ | |
$html = substr($html, 0, $offset).substr($html, $offset+strlen($match[0])); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In system/expressionengine/third_party/wygwam/ft.wygwam.php, find this in the beginning of the save() function: | |
// Clear out if just whitespace | |
if (! $data || preg_match('/^\s*(<\w+>\s*( )*\s*<\/\w+>|<br \/>)?\s*$/s', $data)) | |
{ | |
return ''; | |
} | |
And replace it with this: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); | |
require_once PATH_THIRD.'matrix/config.php'; | |
/** | |
* Wygwam Custom Toolbar Button | |
* | |
* This is a sample extension that would add a plugin to Wygwam’s extraPlugins setting, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="file" name="fieldname"> | |
<input type="hidden" name="fieldname_filedir" value="1"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if entry.drinkAttributes.contains('alcoholic') %} | |
Alcoholic! | |
{% else %} | |
Not alcoholic | |
{% endif %} | |
<h2>Selected Attributes</h2> | |
<table> | |
{% for attr in entry.drinkAttributes %} | |
<tr> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set criteria = {section: 'cocktails', order: 'title'} %} | |
{% set prev = entry.getPrev(criteria) %} | |
{% set next = entry.getNext(criteria) %} | |
{% if prev or next %} | |
<div class="pane"> | |
{% if prev %} | |
<p>Previous: <a href="{{ prev.url }}">{{ prev.title }}</a></p> | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Getting Started | |
* Introduction | |
* Installing & Updating | |
- Requirements | |
- Installing | |
- Updating | |
* Licensing | |
* CP Overview | |
* Packages & Plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
entries: [ | |
{% for entry in craft.entries.find() %} | |
{ | |
title: "{{ entry.title | e('js') }}", | |
tags: [ | |
{% for tag in entry.myTagsField %} | |
"{{ tag.name | e('js') }}" {% if not loop.last %},{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$charset = craft()->templates->getTwig()->getCharset(); | |
$value = new \Twig_Markup($value, $charset); |