Пример #1
0
/**
* "Generic" plugin API: Save item
*
* To be called (eventually) whenever Geeklog saves an item into the database.
* Plugins can define their own 'itemsaved' function to be notified whenever
* an item is saved or modified.
*
* NOTE:     The behaviour of this API function changed in Geeklog 1.6.0
*
* @param    string  $id     unique ID of the item
* @param    string  $type   type of the item, e.g. 'article'
* @param    string  $old_id (optional) old ID when the ID was changed
* @return   void            (actually: false, for backward compatibility)
* @link     http://wiki.geeklog.net/index.php/PLG_itemSaved
*
*/
function PLG_itemSaved($id, $type, $old_id = '')
{
    global $_CONF, $_PLUGINS;
    $t = explode('.', $type);
    $plg_type = $t[0];
    // Treat template system like a plugin (since belong to core group)
    $plugintypes[] = 'template';
    require_once $_CONF['path_system'] . 'lib-template.php';
    $plugintypes = array_merge($plugintypes, $_PLUGINS);
    foreach ($plugintypes as $pi_name) {
        if ($pi_name != $plg_type) {
            $function = 'plugin_itemsaved_' . $pi_name;
            if (function_exists($function)) {
                $function($id, $type, $old_id);
            }
        }
    }
    if (function_exists('CUSTOM_itemsaved')) {
        CUSTOM_itemsaved($id, $type, $old_id);
    }
    return false;
    // for backward compatibility
}
Пример #2
0
/**
* "Generic" plugin API: Save item
*
* To be called whenever glFusion saves an item into the database.
* Plugins can define their own 'itemsaved' function to be notified whenever
* an item is saved or modified.
*
* @param    string  $id     unique ID of the item
* @param    string  $type   type of the item, e.g. 'article'
* @param    string  $old_id (optional) old ID when the ID was changed
* @returns  bool            false
*
*/
function PLG_itemSaved($id, $type, $old_id = '')
{
    global $_PLUGINS;
    $t = explode('.', $type);
    $plg_type = $t[0];
    $plugins = count($_PLUGINS);
    for ($save = 0; $save < $plugins; $save++) {
        if ($_PLUGINS[$save] != $plg_type) {
            $function = 'plugin_itemsaved_' . $_PLUGINS[$save];
            if (function_exists($function)) {
                $function($id, $type, $old_id);
            }
        }
    }
    if (function_exists('CUSTOM_itemsaved')) {
        CUSTOM_itemsaved($id, $type, $old_id);
    }
    return false;
}