Example #1
0
function seConfigTab($tabExtraPlugins)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    //change the local path for search engine translation
    seChangeLocale();
    $strUrl = $oPlugin->getUrl() . 'include/ajax_action.php';
    $strContent = '<h2>Actions</h2>
	<div><button class="ui-state-default ui-corner-all" type="button" onClick="seInitBase(\'' . $strUrl . '\');">' . _('Populate Data Base') . '</button></div>
	<h2>Configuration</h2>
	' . $oConfigFile->DisplayEditor();
    $tabExtraPlugins[] = array('FRAG_NAME' => 'plugins_searchengine', 'TAB_NAME' => _('Search Engine'), 'TAB_CONTENT' => $strContent);
    return true;
}
Example #2
0
 function _loadAllEvents()
 {
     if (is_dir(PLUGINS_DIR)) {
         $oPdir = getFileObject(PLUGINS_DIR);
         //parse each plugin directory
         $listDir = $oPdir->listDir($oPdir->ONLY_DIR);
         foreach ($listDir as $strPluginPath) {
             $oDirPlugin = new PPluginDir($strPluginPath);
             if ($oDirPlugin->isActivated()) {
                 $listFiles = $oDirPlugin->listDir($oDirPlugin->ONLY_FILES, $bFullPath = false);
                 //parse each files and add it in the tab events
                 foreach ($listFiles as $strFileName) {
                     if (preg_match('/(.+)filter\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                         $this->_events['smarty'][$tabInfo[1]][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[2], 'EVENT' => $tabInfo[1]);
                     } else {
                         if (preg_match('/insert\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                             $this->_events['smarty']['insert'][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[1], 'EVENT' => 'insert');
                         } else {
                             if (preg_match('/function\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                                 $this->_events['smarty']['function'][] = array('FILEPATH' => $oDirPlugin->path . SLASH . $strFileName, 'NAME' => $tabInfo[1], 'EVENT' => 'function');
                             } else {
                                 if (preg_match('/(.+)event\\.(.+)\\.php/', $strFileName, $tabInfo)) {
                                     $strEvent = $tabInfo[1];
                                     $strName = $tabInfo[2];
                                     $strFunction = 'pollen_' . $strEvent . 'event_' . $strName;
                                     require_once $oDirPlugin->path . SLASH . $strFileName;
                                     $this->_addEvent($strEvent, $strFunction, $pritority = 10);
                                 } else {
                                     if (preg_match('/\\.php$/', $strFileName)) {
                                         require_once $oDirPlugin->path . SLASH . $strFileName;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             //end if plugin is activated
         }
     }
 }
Example #3
0
function toggleactivateplugin()
{
    global $configFile;
    if (!isset($_REQUEST["plugin"]) || !isset($_REQUEST["value"])) {
        setError('Internal Error in togleactivateplugin');
    }
    $strPluginName = urljsdecode($_REQUEST["plugin"]);
    $strValue = urljsdecode($_REQUEST["value"]);
    $oPluginDir = new PPluginDir(PLUGINS_DIR . SLASH . $strPluginName);
    if (!$oPluginDir->isDir()) {
        return setError(sprintf(_('Can not find the plugin %s'), $strPluginName));
    }
    if (!$oPluginDir->toggleActivate(true)) {
        return false;
    }
    if ($strValue == "true") {
        echo sprintf(_('Plugin %s is activated'), $oPluginDir->getPluginName());
    } else {
        echo sprintf(_('Plugin %s is unactivated'), $oPluginDir->getPluginName(), true);
    }
    return true;
}
			<th>' . _('Name') . '</th>
			<th>' . _('Author') . '</th>
			<th>' . _('Version') . '</th>
			<th>' . _('Action') . '</th>
		</tr>
		{LIST}
	</table>
';
$strListActivated = '';
$strListAvailable = '';
if (is_dir(PLUGINS_DIR)) {
    $oPdir = getFileObject(PLUGINS_DIR);
    //parse each plugin directory
    $listDir = $oPdir->listDir($oPdir->ONLY_DIR);
    foreach ($listDir as $strPluginPath) {
        $oDirPlugin = new PPluginDir($strPluginPath);
        $bActivated = false;
        $configFile->getParam($oDirPlugin->getIdName(), $bActivated, 'PLUGINS');
        $strAction = $bActivated === "true" ? _('UnActivate') : _('Activate');
        $strLine = '<tr>
			<td>' . $oDirPlugin->getPluginName() . '</td>
			<td>' . $oDirPlugin->getAuthor() . '</td>
			<td>' . $oDirPlugin->getVersion() . '</td>
			<td><a href="#" onClick="return toggleactivatePlugin(\'' . urljsencode($oDirPlugin->getName()) . '\',\'false\');">[ ' . $strAction . ' ]</a></td>
		</tr>';
        if ($bActivated === "true") {
            $strListActivated .= $strLine;
        } else {
            $strListAvailable .= $strLine;
        }
    }