adi_webhook provides a mechanism to easily implement webhooks on Textpattern websites. It waits for incoming connections and, if URL variables (and values) match predefined settings, will execute the code of your choice.
It’s a bit like adi_gps in that it takes notice of URL vars, but unlike adi_gps it provides a mechanism to selectively act on the data received.
See the help supplied with the plugin, or have a look online.
adi_webhook was created in response to a request from Gary (giz) to process MailChimp callbacks.
]]>Just install the plugin and go to Admin > Prefs > Advanced Prefs
, scroll down to the ‘Publish’ section and choose the default for your site and save the prefs.
From now on, your new articles will default to that status.
]]>soo_editarea
to work on “Admin/Plugins/Edit”To tame amok-running plugins there’s a parameter: with an URL like
http://example.com/txp/textpattern/index.php?event=plugin&plugins=0
you get to your “Admin/Plugins”-page with all plugins disabled. This works only for privs 1 and 2 (‘publisher’ and ‘managing_editor’), since we don’t want to allow the lower ranks to disable a possible security related plugin.
In file textpattern/index.php
find the line saying
if (!empty($admin_side_plugins) and gps('event') != 'plugin')
(should be #118) and replace it by
// TODO: Find all the other lines looking *exactly* like this one and use $GLOBALS['txp_privs'] instead $txp_privs = safe_field("privs", "txp_users", "name = '".doSlash($txp_user)."'"); $no_plugins = (gps('plugins')==='0' && in_array($txp_privs, array(1, 2))) ? '&plugins=0' : ''; if (!empty($admin_side_plugins) && empty($no_plugins))
In file textpattern/include/txp_plugin.php
find the line saying
$status.'&name='.urlencode($name).'"';
(should be #251) and replace it by
$status.'&name='.urlencode($name).$GLOBALS['no_plugins'].'"';
In file textpattern/lib/txplib_misc.php
find the block saying
if (!isset($GLOBALS['event']) || ($GLOBALS['event'] !== 'plugin')) { $plugin_areas[$area][$title] = $event; }
(should be at #43), remove the “if”-line and the curly brackets, so that only
$plugin_areas[$area][$title] = $event;
remains.
diff -Naur -x '*~' txp-4.3.0-orig/textpattern/include/txp_plugin.php txp-4.3.0/textpattern/include/txp_plugin.php --- txp-4.3.0-orig/textpattern/include/txp_plugin.php 2010-07-17 15:41:18.000000000 +0200 +++ txp-4.3.0/textpattern/include/txp_plugin.php 2011-01-17 10:10:11.000000000 +0100 @@ -248,7 +248,7 @@ { $out = '<a href="index.php?'; $out .= 'event=plugin&step=switch_status&status='. - $status.'&name='.urlencode($name).'"'; + $status.'&name='.urlencode($name).$GLOBALS['no_plugins'].'"'; $out .= '>'.$linktext.'</a>'; return $out; } diff -Naur -x '*~' txp-4.3.0-orig/textpattern/index.php txp-4.3.0/textpattern/index.php --- txp-4.3.0-orig/textpattern/index.php 2011-01-02 15:20:19.000000000 +0100 +++ txp-4.3.0/textpattern/index.php 2011-01-17 10:06:07.000000000 +0100 @@ -115,7 +115,11 @@ janitor(); - if (!empty($admin_side_plugins) and gps('event') != 'plugin') + // TODO: Find all the other lines looking *exactly* like this one and use $GLOBALS['txp_privs'] instead + $txp_privs = safe_field("privs", "txp_users", "name = '".doSlash($txp_user)."'"); + $no_plugins = (gps('plugins')==='0' && in_array($txp_privs, array(1, 2))) ? '&plugins=0' : ''; + + if (!empty($admin_side_plugins) && empty($no_plugins)) load_plugins(1); // plugins may have altered privilege settings diff -Naur -x '*~' txp-4.3.0-orig/textpattern/lib/txplib_misc.php txp-4.3.0/textpattern/lib/txplib_misc.php --- txp-4.3.0-orig/textpattern/lib/txplib_misc.php 2010-10-21 07:08:52.000000000 +0200 +++ txp-4.3.0/textpattern/lib/txplib_misc.php 2011-01-17 10:06:07.000000000 +0100 @@ -691,11 +691,8 @@ { global $plugin_areas; - if (!isset($GLOBALS['event']) || ($GLOBALS['event'] !== 'plugin')) - { $plugin_areas[$area][$title] = $event; } - } // ------------------------------------------------------------- function pluggable_ui($event, $element, $default='')]]>
<txp:if_section name="widgets,sprockets,thingies">
<txp:hide>The widgets, sprockets, and thingies sections have their own special layouts.</txp:hide>
<txp:output_form form='content-<txp:section />' />
<txp:else />
<txp:hide>All the other sections look pretty much the same.</txp:hide>
<txp:output_form form='content-default' />
</txp:if_section>
This plugin is designed to simplify this somewhat, and eliminate that list of section names (which is just one more thing for me to forget to update when I change the site).
atb_if_form
A simple, hopefully self-explanatory conditional form:
<txp:atb_if_form name="someform">
<p>someform exists.</p>
<txp:else />
<p>someform doesn't exist</p>
</txp:atb_if_form>
atb_output_form_if_exists
Can be used exactly the same way as the built-in output_form
tag, except it doesn’t raise an error if the form provided doesn’t exist:
<txp:atb_output_form_if_exists form='foo-<txp:section />'>
This text will be available via the txp:yield tag in foo-[section].
</txp:atb_output_form_if_exists>
It can also be used with a txp:else
tag:
<txp:atb_output_form_if_exists form='foo-<txp:section />'>
This text will be available via the txp:yield tag in foo-[section].
<txp:else />
<txp:output_form form="foo-default" />
</txp:atb_output_form_if_exists>
You can also follow this on GitHub.
]]>