/** * Hook UI, setup privileges */ function __construct() { if (txpinterface == 'admin') { add_privs('wet_sql2php', '1'); register_tab('presentation', 'wet_sql2php', gTxt('wet_sql2php')); register_callback(array(__CLASS__, 'ui'), 'wet_sql2php'); } }
/** * Constructor */ public function __construct() { if (@txpinterface === 'admin') { add_privs(self::$slug, '1,2,3,4,5,6'); //add_privs('plugin_prefs.'.self::$slug, '1'); register_callback(array($this, 'handle_request'), self::$slug, '', 1); register_callback(array($this, 'inject_assets'), 'admin_side', 'head_end'); //register_callback(array($this, 'render_prefs'), 'plugin_prefs.'.self::$slug); register_callback(array($this, 'install'), 'plugin_lifecycle.' . self::$slug, 'installed'); //register_callback(array($this, 'uninstall'), 'plugin_lifecycle.'.self::$slug, 'deleted'); } register_callback(array($this, 'handle_public'), 'textpattern'); }
/** * The constructor merges this plugin with the core system. */ function __construct() { // In a full-fledged plugin your data would probably come from the database, or other more useful sources // but for educational purposes we content ourselves with this constants. self::$my_name = 'Donald Swain'; // Some things just never change... self::$greeting = array('Hello', 'Good-bye'); // Everybody may use this extension add_privs(__CLASS__, '1,2,3,4,5,6'); // Our user interface lives as a separate tab under 'Extensions' register_tab('extensions', __CLASS__, gTxt(__CLASS__)); // This plugin has a single entry point 'dispatch' for its sole event register_callback(array(__CLASS__, 'dispatch'), __CLASS__); }
/** * Constructor. */ public function __construct() { add_privs('rah_blobin_sync', '1'); add_privs('prefs.rah_blobin', '1'); register_callback(array($this, 'install'), 'plugin_lifecycle.rah_blobin', 'installed'); register_callback(array($this, 'uninstall'), 'plugin_lifecycle.rah_blobin', 'deleted'); $this->dir = txpath; if (!defined('rah_blobin_plugins_dir')) { define('rah_blobin_plugins_dir', $this->path(get_pref('rah_blobin_path'))); } if (rah_blobin_plugins_dir) { register_callback(array($this, 'endpoint'), 'textpattern'); $this->sync(); } }
if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) { define('PLUGIN_LIFECYCLE_NOTIFY', 0x2); } // This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events $plugin['flags'] = '0'; if (!defined('txpinterface')) { @(include_once 'zem_tpl.php'); } # --- BEGIN PLUGIN CODE --- if (@txpinterface == 'admin') { add_privs('article', '1,2,3,4,5,6'); add_privs('hak_tinymce_prefs', '1,2'); add_privs('hak_tinymce_js', '1,2,3,4,5,6'); add_privs('hak_tinymce_compressor_js', '1,2,3,4,5,6'); add_privs('hak_txpimage', '1,2,3,4,5,6'); add_privs('hak_txpcatselect', '1,2,3,4,5,6'); register_callback(array("hak_tinymce", "js_prep"), "hak_tinymce_js"); register_callback(array("hak_tinymce", "compressor_js_prep"), "hak_tinymce_compressor_js"); register_callback("hak_txpimage", "hak_txpimage"); register_callback("hak_txpcatselect", "hak_txpcatselect"); register_tab('extensions', 'hak_tinymce_prefs', 'hak_tinymce'); register_callback(array('hak_tinymce', 'prefs'), 'hak_tinymce_prefs'); register_callback(array('hak_tinymce', 'inject_toggle'), 'article_ui', 'extend_col_1'); register_callback(array("hak_tinymce", "inject_js"), "article_ui", "extend_col_1"); register_callback(array('hak_tinymce', 'override_markup_selects'), 'article_ui', 'markup'); register_callback(array('hak_tinymce', 'track_markup_selection'), 'article_ui', 'view'); } class hak_tinymce { function inject_toggle($event, $step, $default, $context_data = '') {
if (0) { ?> # --- BEGIN PLUGIN HELP --- //inc <README.textile> # --- END PLUGIN HELP --- <?php } # --- BEGIN PLUGIN CODE --- if (txpinterface === 'admin') { global $textarray; $textarray = array_merge($textarray, array('jmd_dashboard_tab' => 'Dashboard')); add_privs('jmd_dashboard', 1); register_callback('jmd_dashboard', 'jmd_dashboard'); ob_start('jmd_dashboard_tab'); } /** * Redirects users to ?event=jmd_dashboard upon login (unless they were * loading another event). */ function jmd_dashboard_login() { global $siteurl; if (gps('p_password') && !gps('event')) { txp_status_header("302 Found"); header("Location: http://{$siteurl}/textpattern/?event=jmd_dashboard"); exit; }
// Internal long prefix if (@txpinterface == 'admin') { /** * _cbe_rndc_texts - Admin-side: language strings definitions * * @return array */ function _cbe_rndc_texts() { /* ============== Possible language customisation here ============== */ return array(CBE_RNDC_LPFX . 'tab_label' => 'Random content', CBE_RNDC_LPFX . 'pop_com' => 'Comments generation', CBE_RNDC_LPFX . 'pop_art' => 'Articles generation', CBE_RNDC_LPFX . 'go_back' => 'Back', CBE_RNDC_LPFX . 'no_comm_allowed' => 'Comments are not allowed', CBE_RNDC_LPFX . 'populate' => 'Populate !', CBE_RNDC_LPFX . 'populate_end' => 'Populating finished', CBE_RNDC_LPFX . 'with_errors' => 'with errors'); /* =========================== Stop editing =========================== */ } global $textarray; $textarray += call_user_func('_' . CBE_RNDC_SPFX . 'texts'); add_privs(CBE_RNDC_EVENT, '1, 2'); register_tab('extensions', CBE_RNDC_EVENT, gTxt(CBE_RNDC_LPFX . 'tab_label')); register_callback(CBE_RNDC_LPFX . 'lifecycle', 'plugin_lifecycle.' . CBE_RNDC_EVENT); register_callback(CBE_RNDC_LPFX . 'router', CBE_RNDC_EVENT); /* ============================ Internal ============================ */ define('DIGITS', 0); define('ALPHAMAJUS', 1); define('ALPHAMINUS', 2); function _cbe_rndc_minimax(&$mini, &$maxi) { if ($maxi == 0) { $maxi = $mini; } if ($maxi < $mini) { $a = $mini; $mini = $maxi;
<?php $plugin['name'] = 'sed_plugin_help_viewer'; $plugin['version'] = '0.4'; $plugin['author'] = 'Netcarver'; $plugin['author_uri'] = 'http://txp-plugins.netcarving.com'; $plugin['description'] = 'Quickly check your plugin\'s help section from the plugin cache dirctory.'; $plugin['type'] = 1; @(include_once '../zem_tpl.php'); # --- BEGIN PLUGIN CODE --- if (@txpinterface == 'admin') { add_privs('sed_plugin_help_viewer', '1,2'); register_tab('extensions', 'sed_plugin_help_viewer', 'Help Viewer'); register_callback('sed_plugin_help_viewer', 'sed_plugin_help_viewer'); } function sed_plugin_help_viewer($event, $step) { if (!$step or !in_array($step, array('view_help'))) { _sed_list_plugins_from_cache(); } else { $step(); } } function view_help($message = '') { pagetop(gTxt('edit_plugins'), $message); $filename = gps('filename'); $plugin = array(); if (!empty($filename)) { $content = file($filename); $source_lines = count($content);
if (function_exists("register_callback")) { register_callback("asy_flush_event", "article", "edit"); register_callback("asy_flush_event", "article", "create"); register_callback("asy_flush_event", "link"); register_callback("asy_flush_event", "page", "page_save"); register_callback("asy_flush_event", "form", "form_save"); register_callback("asy_flush_event", "list", "list_multi_edit"); register_callback("asy_flush_event", "discuss"); // We do not have a callback when comments are posted on the front_end // but that's ok, I hacked some magic into jpcache-main.php register_callback('asy_public_flush', 'zemcontact.submit'); # Thanks Adam Messinger } // Add a new tab to the Content area. if (@txpinterface == 'admin') { add_privs('asy_jpcache', '1,2'); register_tab("extensions", "asy_jpcache", "jpcache-cleaner"); register_callback("asy_jpcachecleaner", "asy_jpcache"); } // This is the callback-function when something in the Admin-Panel gets changed. (Wrapper) function asy_flush_event($event, $step) { if ($event === 'article' && ($step === 'create' || $step === 'edit') && (count($_POST) == 0 || isset($_REQUEST['view']) && $_REQUEST['view'] != '')) { return; } elseif (count($_POST) == 0) { return; } $count = asy_flushdir(true); } // Thanks Adam Messinger function asy_public_flush()
* @description Thickbox-style image selector * @author Jon-Michael Deldin * @author_uri http://jmdeldin.com * @version 1.0b2 * @type 3 * @order 5 */ if (txpinterface === 'admin') { global $event, $jmdImgSel, $prefs; $jmdImgSel_privs = '1,2,3,4,5'; add_privs('jmd_img_selector', $jmdImgSel_privs); register_tab('extensions', 'jmd_img_selector', 'jmd_img_selector'); register_callback('jmd_img_selector', 'jmd_img_selector'); add_privs('jmd_img_selector_js', $jmdImgSel_privs); register_callback('jmd_img_selector_js', 'jmd_img_selector_js'); add_privs('jmd_img_selector_thickbox', $jmdImgSel_privs); register_callback('jmd_img_selector_thickbox', 'jmd_img_selector_thickbox'); $jmdImgSel_view = gps('view'); if ($event === 'article' && $jmdImgSel_view !== 'preview' && $jmdImgSel_view !== 'html') { ob_start('jmd_img_selector_head'); } $jmdImgSel = new JMD_ImgSelector(); if (empty($prefs[$jmdImgSel->prefix('tbWidth')])) { $jmdImgSel->upsertPref('tbWidth', 600, 1); } if (empty($prefs[$jmdImgSel->prefix('tbHeight')])) { $jmdImgSel->upsertPref('tbHeight', 600, 1); } if (empty($prefs[$jmdImgSel->prefix('imgWidth')])) { $jmdImgSel->upsertPref('imgWidth', 80, 1); }
$plugin['author_uri'] = 'http://txp-plugins.netcarving.com'; $plugin['description'] = 'Provides admin interface field customisation on a per-section basis.'; $plugin['type'] = '1'; $plugin['order'] = 5; @(include_once '../zem_tpl.php'); # --- BEGIN PLUGIN CODE --- require_plugin('sed_plugin_library'); if (!defined('sed_sf_prefix')) { define('sed_sf_prefix', 'sed_sf'); } #=============================================================================== # Admin interface features... #=============================================================================== if (@txpinterface === 'admin') { add_privs('sed_sf', '1,2,3,4,5,6'); add_privs('sed_sf.static_sections', '1'); # which users always see all sections in the write-tab select box global $_sed_sf_using_glz_custom_fields, $prefs, $textarray, $_sed_sf_l18n, $sed_sf_prefs, $_sed_sf_field_keys; #=========================================================================== # Strings for internationalisation... #=========================================================================== $_sed_sf_l18n = array('write_tab_heading' => 'Write Tab Fields...', 'hide_cf' => '{global_label} (#{cfnum})', 'hide_section' => 'Hide from non-publishers?', 'hide_all_text' => 'Hide all?', 'show_all_text' => 'Show all?', 'alter_section_tab' => 'Alter Presentation > Section tab?', 'filter_label' => 'Filter…', 'filter_limit' => 'Show section index filter after how many sections?', 'hide' => 'Hide', 'show' => 'Show'); $mlp = new sed_lib_mlp('sed_section_fields', $_sed_sf_l18n, '', 'admin'); #=========================================================================== # Plugin preferences... #=========================================================================== $sed_sf_prefs = array('alter_section_tab' => array('type' => 'yesnoradio', 'val' => '0'), 'filter_limit' => array('type' => 'text_input', 'val' => '18')); foreach ($sed_sf_prefs as $key => $data) { _sed_sf_install_pref($key, $data['val'], $data['type']); } #===========================================================================
<?php # --- BEGIN PLUGIN META --- $plugin = array('name' => 'rss_article_edit', 'version' => '0.1', 'author' => 'Rob Sable', 'author_uri' => 'http://www.wilshireone.com/', 'description' => 'Add edit article links to your public site.', 'type' => '1'); # --- END PLUGIN META --- # --- BEGIN PLUGIN CODE --- if ('admin' === @txpinterface) { add_privs('editlink', '1,2,3,4,5,6'); // Add a new tab under 'extensions' called 'edit link', for the 'editlink' event register_tab("extensions", "editlink", "edit link"); // 'rss_admin_editlink' will be called to handle the 'editlink' event register_callback("rss_admin_editlink", "editlink"); } function rss_admin_editlink($event, $step) { global $rss_ae_cookie; include txpath . '/include/txp_prefs.php'; if (!isset($rss_ae_cookie)) { $rss_ae_cookie = "rss_article_edit"; $rs = safe_insert('txp_prefs', "name='rss_ae_cookie', val='{$rss_ae_cookie}', prefs_id='1'"); } if (gps("add")) { safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'"); setcookie($rss_ae_cookie, $rss_ae_cookie, time() + 31536000, "/"); header("Location: index.php?event=editlink"); } else { if (gps("rem")) { safe_update("txp_prefs", "val = '" . addslashes(ps('rss_ae_cookie')) . "'", "name = 'rss_ae_cookie' and prefs_id ='1'"); setcookie($rss_ae_cookie, $rss_ae_cookie, time() - 3600, "/"); header("Location: index.php?event=editlink"); }
$new_product_event = 'product'; $new_product_name = 'Product'; $products_event = 'products'; $products_name = 'Products'; $customers_event = 'customers'; $customers_name = 'Customers'; $customer_event = 'customer'; $customer_name = 'Customer'; $orders_event = 'orders'; $orders_name = 'Orders'; $settings_event = 'settings'; $settings_name = 'Settings'; $dashboard_event = 'store'; $dashboard_name = 'Dashboard'; // Set the privilege levels for our new event add_privs($store_categories_event, '1,2'); if (isset($_REQUEST['step'])) { $step = $_REQUEST['step']; } else { $step = ""; } if (isset($_REQUEST['event'])) { $event = $_REQUEST['event']; } if ($event == "product") { switch (strtolower($step)) { // 'zem_admin_test' will be called to handle the new event case "": register_callback("product_edit", $new_product_event); break; case "create":
if (!defined('PLUGIN_HAS_PREFS')) { define('PLUGIN_HAS_PREFS', 0x1); } // This plugin wants to receive "plugin_prefs.{$plugin['name']}" events if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) { define('PLUGIN_LIFECYCLE_NOTIFY', 0x2); } // This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events $plugin['flags'] = '0'; if (!defined('txpinterface')) { @(include_once 'zem_tpl.php'); } # --- BEGIN PLUGIN CODE --- //<?php if (@txpinterface == 'admin') { add_privs('bot_admin_tooltips_tab', '1,2'); register_tab('extensions', 'bot_admin_tooltips_tab', 'bot_admin_tooltips'); register_callback('bot_admin_tooltips_tab', 'bot_admin_tooltips_tab'); register_callback('bot_admin_tooltips', 'article'); register_callback('bot_admin_tooltips', 'category'); register_callback('bot_admin_tooltips', 'list'); register_callback('bot_admin_tooltips', 'image'); register_callback('bot_admin_tooltips', 'file'); register_callback('bot_admin_tooltips', 'link'); register_callback('bot_admin_tooltips', 'discuss'); register_callback('bot_admin_tooltips', 'admin'); } global $bot_admin_tooltips, $bot_admin_tooltips_main_array; //set globals if (getThings("Show tables like '" . PFX . "bot_admin_tooltips'")) { // if plugin is installed loads items and tips from db
################## # # rah_textile_bar-plugin for Textpattern # version 0.7 # by Jukka Svahn # http://rahforum.biz # # Copyright (C) 2011 Jukka Svahn <http://rahforum.biz> # Licensed under GNU Genral Public License version 2 # http://www.gnu.org/licenses/gpl-2.0.html # ################### if (@txpinterface == 'admin') { rah_textile_bar_install(); rah_textile_bar_img(); add_privs('plugin_prefs.rah_textile_bar', '1,2'); register_callback('rah_textile_bar_prefs', 'plugin_prefs.rah_textile_bar'); register_callback('rah_textile_bar_install', 'plugin_lifecycle.rah_textile_bar'); register_callback('rah_textile_bar', 'admin_side', 'head_end'); } /** Installer @param $event string Admin-side event. @param $step string Admin-side event, plugin-lifecycle step. */ function rah_textile_bar_install($event = '', $step = '') { if ($step == 'deleted') { safe_delete('txp_prefs', "name like 'rah_textile_bar_%'"); return; }
$plugin['description'] = 'Database management system.'; // Plugin types: // 0 = regular plugin; loaded on the public web side only // 1 = admin plugin; loaded on both the public and admin side // 2 = library; loaded only when include_plugin() or require_plugin() is called $plugin['type'] = '1'; @(include_once 'zem_tpl.php'); # --- BEGIN PLUGIN CODE --- if (@txpinterface == 'admin') { add_privs('rss_db_man', '1'); register_tab("extensions", "rss_db_man", "DB Manager"); register_callback("rss_db_man", "rss_db_man"); add_privs('rss_sql_run', '1'); register_tab("extensions", "rss_sql_run", "Run SQL"); register_callback("rss_sql_run", "rss_sql_run"); add_privs('rss_db_bk', '1'); register_tab("extensions", "rss_db_bk", "DB Backup"); register_callback("rss_db_bk", "rss_db_bk"); } function rss_db_bk($event, $step) { global $prefs, $rss_dbbk_path, $rss_dbbk_dump, $rss_dbbk_mysql, $rss_dbbk_lock, $rss_dbbk_txplog, $rss_dbbk_debug, $DB, $file_base_path; if (!isset($rss_dbbk_lock)) { $rss_dbbk_lock = "1"; $rs = safe_insert('txp_prefs', "name='rss_dbbk_lock', val='{$rss_dbbk_lock}', prefs_id='1'"); } if (!isset($rss_dbbk_txplog)) { $rss_dbbk_txplog = "1"; $rs = safe_insert('txp_prefs', "name='rss_dbbk_txplog', val='{$rss_dbbk_txplog}', prefs_id='1'"); } if (!isset($rss_dbbk_debug)) {
<?php # --- BEGIN PLUGIN CODE --- // Plugin code goes here. No need to escape quotes. // Global textpattern variables + textile for use throughout global $txp_user, $vars, $txpcfg, $textile; // Textile construct include_once $txpcfg['txpath'] . '/lib/classTextile.php'; $textile = new Textile(); // Add the jmc_event_manager tab to the Content area. if (@txpinterface === 'admin') { // Check for existence of tables - if none, install jmc_check_installation(); // Add new tabs under "Gig Guide" for "Gigs", "Add a Gig", "Venue" and "Add a Venue" add_privs('jmc_event_manager', '1,2,3,4,5,6'); register_tab("content", "jmc_event_manager", "Event Manager"); // Register Callbacks to the plugin register_callback("jmc_event_manager", "jmc_event_manager"); register_callback("jmc_event_manager", "jmc_event_categories"); register_callback("jmc_event_manager", "jmc_event_manager_venue"); // // add_privs('tab.jmc_event_manager_prefs','1,2'); // register_tab("extensions", "jmc_event_manager_prefs", "jmc_e_m prefs"); register_callback("jmc_event_manager_prefs", "jmc_event_manager_prefs"); } // Events class JmcEvents { var $events = null; // Limits var $category_id = null;
//------------------------------------------------------------- if (!function_exists('priv_levels')) { function priv_levels($item, $var) { global $levels; return selectInput($item, $levels, $var); } } } global $mem_self, $prefs; $mem_self = array('admin_email' => '', 'admin_name' => '', 'new_user_priv' => '0', 'status' => false, 'status_message' => 'You are already registered.', 'email_message' => ''); $mem_self['admin_email'] = isset($prefs['mem_self_admin_email']) ? $prefs['mem_self_admin_email'] : ''; $mem_self['admin_name'] = isset($prefs['mem_self_admin_name']) ? $prefs['mem_self_admin_name'] : ''; $mem_self['new_user_priv'] = isset($prefs['mem_self_new_user_priv']) ? $prefs['mem_self_new_user_priv'] : '0'; if (@txpinterface == 'admin') { add_privs('self-reg', '1'); register_callback('mem_self_register', 'self-reg', '', 1); if ($event == 'self-reg') { // fake tabs when using them. Silences warnings from pageTop() register_tab('admin', 'self-reg', 'self-reg'); include_once txpath . '/publish/taghandlers.php'; } function mem_self_register($event, $step) { global $prefs; extract($prefs); if ($event != 'self-reg') { return; } pageTop('Self Registration', ''); if ($step == 'install') {
// "test" is the name of the associated event; "testing" is the displayed title if (@txpinterface == 'admin') { $myevent = 'test'; $mytab = 'testing'; // Set the privilege levels for our new event add_privs($myevent, '1,2'); // Add a new tab under 'extensions' associated with our event register_tab("extensions", $myevent, $mytab); // 'zem_admin_test' will be called to handle the new event register_callback("zem_admin_test", $myevent); // 'zem_admin_test_lifecycle' will be called on plugin installation, activation, deactivation, and deletion register_callback("zem_admin_test_lifecycle", "plugin_lifecycle.zem_plugin_example"); // 'zem_admin_test_prefs' will be called from the Options link on the plugin tab register_callback('zem_admin_test_prefs', 'plugin_prefs.zem_plugin_example'); // Set the privilege levels for our plugin's prefs event add_privs('plugin_prefs.zem_plugin_example', '1'); // Emit additional CSS rules for the admin side register_callback('zem_admin_test_style', 'admin_side', 'head_end'); } function zem_admin_test($event, $step) { // ps() returns the contents of POST vars, if any $something = ps("something"); pagetop("Testing", ps("do_something") ? "you typed: {$something}" : ""); // The eInput/sInput part of the form is important, setting the event and step respectively echo "<div align=\"center\" style=\"margin-top:3em\">"; echo form(tag("Test Form", "h3") . graf(gTxt('zem_type_something') . fInput("text", "something", $something, "edit", "", "", "20", "1") . fInput("submit", "do_something", "Go", "smallerbox") . eInput("test") . sInput("step_a"), " style=\"text-align:center\"")); echo "</div>"; } // Act upon activation/deactivation, installation/deletion. // $event will be "plugin_lifecycle.zem_plugin_example"
if (!defined('PLUGIN_HAS_PREFS')) { define('PLUGIN_HAS_PREFS', 0x1); } // This plugin wants to receive "plugin_prefs.{$plugin['name']}" events if (!defined('PLUGIN_LIFECYCLE_NOTIFY')) { define('PLUGIN_LIFECYCLE_NOTIFY', 0x2); } // This plugin wants to receive "plugin_lifecycle.{$plugin['name']}" events $plugin['flags'] = '0'; if (!defined('txpinterface')) { @(include_once 'zem_tpl.php'); } # --- BEGIN PLUGIN CODE --- //<? if (@txpinterface == 'admin') { add_privs('bot_wtc_tab', '1,2'); register_tab('extensions', 'bot_wtc_tab', 'bot_wtc'); register_callback('bot_wtc_tab', 'bot_wtc_tab'); register_callback('bot_wtc', 'article'); register_callback('bot_hide_per_section', 'article'); register_callback('bot_hidden_sections', 'article'); } //=========================================== global $bot_items; // TIP // I would store these in a named array and then pass them to the function by looping bot_wtc_insert_in_main_array('textile_help!bot! (!bot!label!bot!)', '$("h3:has(a[href=#textile_help])")'); bot_wtc_insert_in_main_array('textile_help', '$("#textile_help")'); bot_wtc_insert_in_main_array('advanced_options!bot! (!bot!label!bot!)', '$("h3:has(a[href=#advanced])")'); bot_wtc_insert_in_main_array('advanced_options', '$("#advanced")'); bot_wtc_insert_in_main_array('article_markup', '$("p:has(select[id*=markup-body])")');
* Rah_bitly plugin for Textpattern CMS. * * @author Jukka Svahn * @date 2011- * @license GNU GPLv2 * @link http://rahforum.biz/plugins/rah_bitly * * Requires Textpattern v4.4.1 or newer. * * Copyright (C) 2011 Jukka Svahn <http://rahforum.biz> * Licensed under GNU Genral Public License version 2 * http://www.gnu.org/licenses/gpl-2.0.html */ if (@txpinterface == 'admin') { rah_bitly::install(); add_privs('plugin_prefs.rah_bitly', '1,2'); register_callback(array('rah_bitly', 'prefs'), 'plugin_prefs.rah_bitly'); register_callback(array('rah_bitly', 'install'), 'plugin_lifecycle.rah_bitly'); register_callback(array('rah_bitly', 'update'), 'article', 'edit', 1); register_callback(array('rah_bitly', 'update'), 'article', 'publish', 1); register_callback(array('rah_bitly', 'update'), 'article', 'create', 1); register_callback(array('rah_bitly', 'update'), 'article', 'save', 1); register_callback(array('rah_bitly', 'update'), 'article', 'edit', 0); register_callback(array('rah_bitly', 'update'), 'article', 'publish', 0); register_callback(array('rah_bitly', 'update'), 'article', 'create', 0); register_callback(array('rah_bitly', 'update'), 'article', 'save', 0); } class rah_bitly { public static $version = '0.3'; /**
function GBPAdminTabView($title, $event, &$parent, $is_default = NULL) { $this->title = function_exists('mb_convert_case') ? mb_convert_case($title, MB_CASE_TITLE, "UTF-8") : ucwords($title); $this->event = $event; // Note: $this->parent only gets set correctly for PHP 5 $this->parent =& $parent->add_tab($this, $is_default); // Add privs for this tab global $txp_permissions; $perms = @$txp_permissions[$this->permissions]; add_privs($this->parent->event . '.' . $this->event, $perms ? $perms : $this->permissions); }
$plugin['author'] = 'Netcarver'; $plugin['author_uri'] = 'http://txp-plugins.netcarving.com'; $plugin['description'] = 'Provides indexed access to sections.'; $plugin['type'] = '1'; $plugin['order'] = 3; @(include_once '../zem_tpl.php'); # --- BEGIN PLUGIN CODE --- @require_plugin('sed_plugin_library'); if (!defined('sed_si_prefix')) { define('sed_si_prefix', 'sed_si'); } #=============================================================================== # Admin interface features... #=============================================================================== if (@txpinterface === 'admin') { add_privs('sed_si', '1,2,3,4,5,6'); global $prefs, $textarray, $_sed_si_l18n, $sed_si_prefs; #=========================================================================== # Strings for internationalisation... #=========================================================================== $_sed_si_l18n = array('alter_section_tab' => 'Alter Presentation > Section tab?', 'filter_label' => 'Filter…', 'filter_limit' => 'Show section index filter after how many sections?'); $mlp = new sed_lib_mlp('sed_section_index', $_sed_si_l18n, '', 'admin'); #=========================================================================== # Plugin preferences... #=========================================================================== $sed_si_prefs = array('alter_section_tab' => array('type' => 'yesnoradio', 'val' => '0'), 'filter_limit' => array('type' => 'text_input', 'val' => '18')); foreach ($sed_si_prefs as $key => $data) { _sed_si_install_pref($key, $data['val'], $data['type']); } #=========================================================================== # Textpattern event handlers...
// 1 = admin plugin; loaded on both the public and admin side // 2 = library; loaded only when include_plugin() or require_plugin() is called $plugin['type'] = '1'; @(include_once 'zem_tpl.php'); # --- BEGIN PLUGIN CODE --- global $CNK_VER_OUTPUT_PATH, $CNK_VER_EXT, $CNK_VER_EXT_CSS; $CNK_VER_OUTPUT_PATH = 'textpattern/_templates/versioning/'; //e.g. 'textpattern/_templates/versioning/' $CNK_VER_EXT = 'txp'; $CNK_VER_EXT_CSS = 'css'; /* DO NOT EDIT BELOW THIS LINE! */ $CNK_VER_OUTPUT_PATH = trim($CNK_VER_OUTPUT_PATH, '/') . ($CNK_VER_OUTPUT_PATH ? '/' : ''); if (@txpinterface == 'admin') { add_privs('cnk_versioning', '1,2'); register_tab('presentation', 'cnk_versioning', "Versioning"); register_callback('cnk_ver_handler', 'cnk_versioning'); register_callback('cnk_ver_disable_online_editing', 'page'); register_callback('cnk_ver_disable_online_editing', 'form'); register_callback('cnk_ver_disable_online_editing', 'css'); } else { if (@txpinterface == 'public') { register_callback('cnk_ver_textpattern', 'textpattern'); } } function cnk_ver_textpattern() { global $production_status, $CNK_VER_OUTPUT_PATH, $CNK_VER_EXT, $CNK_VER_EXT_CSS; if ($production_status != 'live') { $error = false;
} #=============================================================================== # MLP Registration... #=============================================================================== register_callback('_jmd_sitemap_enumerate_strings', 'l10n.enumerate_strings'); function _jmd_sitemap_enumerate_strings() { global $_jmd_sitemap_l18n; $r = array('owner' => 'jmd_sitemap', 'prefix' => JMD_SITEMAP_PREFIX, 'lang' => 'en-gb', 'event' => 'admin', 'strings' => $_jmd_sitemap_l18n); return $r; } #=============================================================================== # Admin interface features... #=============================================================================== if (txpinterface == 'admin') { add_privs('jmd_sitemap', 1); register_tab('extensions', 'jmd_sitemap', _jmd_sitemap_gtxt('extension_tab')); register_callback('jmd_sitemap', 'jmd_sitemap'); register_callback('jmd_sitemap', 'article', 'create' || 'edit'); if (empty($GLOBALS['prefs']['jmd_sitemap_exclude'])) { $tmp = serialize(array('default')); $GLOBALS['prefs']['jmd_sitemap_exclude'] = $tmp; safe_insert("txp_prefs", "prefs_id = 1,\n name = 'jmd_sitemap_exclude',\n val = '{$tmp}',\n type = 2,\n event = 'admin',\n html = 'text_input',\n position = 0\n "); } } function jmd_sitemap($event, $step) { global $prefs; $sitemap = new JMD_Sitemap(); // Generate sitemap if ($step == ('create' || 'edit' || 'update')) {
echo '<h1>SED Patterns</h1>'; echo upload_form('Install Pattern Pack', '', 'upload', self::EVENT, ''); } /** * Public entry point for rendering the default (home) page */ public static function home($event, $step) { if ($step && in_array($step, array('upload'))) { self::$step($event, $step); } else { self::show(); } } } add_privs(sed_patterns::EVENT, sed_patterns::PRIVS); register_tab('extensions', sed_patterns::EVENT, gTxt(sed_patterns::TAB)); register_callback('sed_patterns::home', sed_patterns::EVENT); # TODO add an installation+enable handler that will take care of keeping the plugin disabled if gzinflate is not installed. } # --- END PLUGIN CODE --- /* # --- BEGIN PLUGIN CSS --- <style type="text/css"> div#sed_patterns_help td { vertical-align:top; } div#sed_patterns_help code { font-weight:bold; font: 105%/130% "Courier New", courier, monospace; background-color: #FFFFCC;} div#sed_patterns_help code.sed_code_tag { font-weight:normal; border:1px dotted #999; background-color: #f0e68c; display:block; margin:10px 10px 20px; padding:10px; } div#sed_patterns_help a:link, div#sed_patterns_help a:visited { color: blue; text-decoration: none; border-bottom: 1px solid blue; padding-bottom:1px;} div#sed_patterns_help a:hover, div#sed_patterns_help a:active { color: blue; text-decoration: none; border-bottom: 2px solid blue; padding-bottom:1px;} div#sed_patterns_help h1 { color: #369; font: 20px Georgia, sans-serif; margin: 0; text-align: center; } div#sed_patterns_help h2 { border-bottom: 1px solid black; padding:10px 0 0; color: #369; font: 17px Georgia, sans-serif; }
{ $lang = array('manage_users' => 'Manage Users', 'user_db' => 'Use Alternate Database?', 'users' => 'Users', 'add_new_user' => 'Add New User', 'could_not_update_user' => 'Could not update user', 'reset_user_password' => 'Reset User Password', 'error_adding_new_user' => 'Could not add new user', 'new_pass' => 'Enter new password', 'confirm_pass' => 'Re-enter new password to confirm', 'a_message_will_be_sent_with_login' => 'A message will be sent with login information', 'email_pass' => 'Mail it to me', 'fallback' => 'Also authenticate against txp_users?', 'new_user_email' => "Dear %1\$s,\r\n\r\nYou have been registered as a user of %4\$s.\r\nYour username is: %2\$s\r\nYour password is: %3\$s\r\n\r\nVisit the site at %5\$s", 'change_email' => "Dear %1\$s,\r\n\r\nYour password has been changed. Your new password is: %3\$s\r\n\r\nVisit the site at %5\$s"); return $lang[$what]; } //--------------do not edit below this line------------------ //generate admin interface if (txpinterface == 'admin') { if (!isset($prefs['ign_pp_version']) || $prefs['ign_pp_version'] != $plugins_ver['ign_password_protect']) { //TODO: Update Prefs, run forms check and install forms if necessary. //TODO: add form pref for designating an alternate form } if (empty($prefs['ign_user_db'])) { ign_pp_install(); } //assign privs for interfaces add_privs('ign_user_mgmt', '1,2,3,4'); //create tabs, register callback functions for those tabs register_tab('admin', 'ign_user_mgmt', ign_gtxt('manage_users')); register_callback('ign_manageUsers', 'ign_user_mgmt'); register_callback('ign_file_tab', 'file', 'file_edit'); } if (txpinterface == 'public') { // disable caching for all pages // FIXME: find more selective method for disabling caching header("Cache-Control: must-revalidate"); $prefs['send_lastmod'] = false; //register file_download callback to filter download requests register_callback('ign_filter_downloads', 'file_download'); //fire off validation routine, since most functionality is dependent on it: $ign_err = ign_doTxpValidate(); }
- enhancement: new adi_menu tag attributes 'list_id' & 'list_id_prefix' - output unique IDs to <li> elements - enhancement: new adi_menu tag attribute 'active_li_class' - output class on active <li> - enhancement: adi_menu admin now displays summary of configured section hierarchy - modification: adi_breadcrumb tag attribute 'sep' deprecated for 'separator' 0.2 - fix: adi_menu_breadcrumb error when visiting pages that are excluded in adi_menu admin - fix: adi_menu_breadcrumb now copes with section loops, error message output - fix: adi_menu tag can now be used more than once on a page - enhancement: adi_menu admin section loop warning message - enhancement: adi_menu admin now displays sections in alphabetical order 0.1 - initial release */ if (@txpinterface == 'admin') { $myevent = 'adi_menu_admin'; $mytab = 'adi_menu'; // set the privilege levels add_privs($myevent, '1,2,3,6'); // add new tab under 'Presentation' register_tab("presentation", $myevent, $mytab); register_callback("adi_menu_admin", $myevent); //register_callback('adi_menu', 'adi_menu'); } function adi_menu_admin($event, $step) { $debug = 0; // display debug info // tooltip help information $h['se'] = "The TXP section name, set in Sections tab"; $h['ti'] = "The TXP section title, set in Sections tab"; $h['ex'] = "Tick if the section should be excluded by default from the menu"; $h['pa'] = "The section's parent"; $h['so'] = "The section's sort order number";
h2. Credits * Mark Norton for mdn_wikitoday's wicked HTML parser * "Ruhh" for prompting and testing this plugin # --- END PLUGIN HELP --- <?php } # --- BEGIN PLUGIN CODE --- //-------------------------- // admin if (@txpinterface == 'admin') { add_privs('jmd_wiki_events_prefs', '1'); register_tab('extensions', 'jmd_wiki_events_prefs', 'jmd_wiki_events'); register_callback('jmd_wiki_events_prefs', 'jmd_wiki_events_prefs'); } function jmd_wiki_events_prefs($event, $step) { ob_start('jmd_wiki_events_prefs_head'); // event alias $eName = 'jmd_wiki_events_prefs'; pagetop($eName); echo '<div id="jmd_wiki_events_prefs">'; if (!$step) { echo fieldset(form(fInput('submit', 'install', 'Install', 'publish') . eInput($eName) . sInput('install')) . form(fInput('submit', 'uninstall', 'Uninstall', 'publish') . eInput($eName) . sInput('uninstall'), '', "verify('Are you sure you want to delete all stored events?');"), 'Setup', 'setup'); } elseif ($step == 'install') { $sql = "CREATE TABLE " . safe_pfx('jmd_wiki_events') . "(\n title VARCHAR(15) KEY,\n last_mod DATE,\n contents LONGTEXT\n )"; $create = safe_query($sql);
<?php $plugin['name'] = 'sed_auto_inst'; $plugin['version'] = '0.2'; $plugin['author'] = 'Netcarver'; $plugin['author_uri'] = 'http://txp-plugins.netcarving.com'; $plugin['description'] = 'Plugin auto-installer'; $plugin['type'] = '1'; @(include_once '../zem_tpl.php'); # --- BEGIN PLUGIN CODE --- if (@txpinterface === 'admin') { add_privs('sed_plugin_auto_install', '1'); register_callback('sed_plugin_auto_install', 'admin', 'sed_auto_inst'); } function sed_plugin_auto_install($event, $step) { global $txpcfg, $prefs; require_privs('sed_plugin_auto_install'); include_once $txpcfg['txpath'] . '/include/txp_plugin.php'; $debug = false; if ($debug) { echo br, "Loading: Auto Install Plugin."; } # # Build a list of all files in the special plugins dir... # $files = array(); $path = $prefs['file_base_path'] . DS . 'sed_autoinst' . DS . 'plugins'; if ($debug) { echo br, "Auto Install Plugins... Accessing dir({$path}) ..."; }