/** * Uninstall * @return bool */ public function uninstall() { $Factory = new PluginFactory(); $Plugin = $Factory->newInstance($this->Key); DB::getInstance()->deleteByID('plugin', $Plugin->id()); PluginFactory::clearCache(); return true; }
/** * Uninstall * @return bool */ public function uninstall() { $Factory = new PluginFactory(); $Plugin = $Factory->newInstance($this->Key); DB::getInstance()->deleteByID('plugin', $Plugin->id()); DB::getInstance()->query('DELETE FROM `' . PREFIX . 'plugin_conf` WHERE `pluginid`=' . $Plugin->id() . ' AND accountid = ' . SessionAccountHandler::getId()); PluginFactory::clearCache(); return true; }
/** * Init DatabaseScheme */ protected function initDatabaseScheme() { $this->DatabaseScheme = DatabaseSchemePool::get('training/schemes/scheme.UserData.php'); $Factory = new PluginFactory(); if ($Factory->isInstalled('RunalyzePluginPanel_Sportler')) { $Plugin = $Factory->newInstance('RunalyzePluginPanel_Sportler'); if (!$Plugin->Configuration()->value('use_body_fat')) { $this->DatabaseScheme->hideFieldset('analyse'); } if (!$Plugin->Configuration()->value('use_pulse')) { $this->DatabaseScheme->hideField('pulse_rest'); } } }
/** * Catch values */ public final function catchValuesFromDatabase() { $ResultFromDB = Cache::get(self::CACHE_KEY); if (is_null($ResultFromDB)) { $ResultFromDB = DB::getInstance()->query('SELECT `pluginid`,`config`,`value` ' . 'FROM `' . PREFIX . 'plugin_conf` ' . 'WHERE `pluginid` IN (' . implode(',', PluginFactory::allIDs()) . ')')->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC); Cache::set(self::CACHE_KEY, $ResultFromDB, '60'); } $this->checkValuesFromDatabase($ResultFromDB); }
function activatePlugin($name) { $plugin_factory = PluginFactory::instance(); $plugin = $plugin_factory->getPluginByName($name); if (! $plugin) { echo "Install plugin\n"; $plugin_manager = new PluginManager(); $plugin = $plugin_manager->installPlugin($name); } if (! $plugin_factory->isPluginAvailable($plugin)) { echo "Activate plugin\n"; $plugin_factory->availablePlugin($plugin); } }
public function tearDown() { ForgeConfig::restore(); $this->mysqli->query('DELETE FROM groups WHERE unix_group_name = "short-name"'); unset($GLOBALS['svn_prefix']); unset($GLOBALS['cvs_prefix']); unset($GLOBALS['grpdir_prefix']); unset($GLOBALS['ftp_frs_dir_prefix']); unset($GLOBALS['ftp_anon_dir_prefix']); unset($GLOBALS['sys_default_domain']); unset($GLOBALS['sys_cookie_prefix']); unset($GLOBALS['sys_force_ssl']); $GLOBALS['sys_pluginsroot'] = $this->old_sys_pluginsroot; $GLOBALS['sys_custompluginsroot'] = $this->old_sys_custompluginsroot; EventManager::clearInstance(); PluginManager::instance()->invalidateCache(); PluginFactory::clearInstance(); $GLOBALS = $this->old_globals; parent::tearDown(); }
/** * Clear cache */ public static function clearCache() { self::$Plugins = NULL; Cache::delete(self::CACHE_KEY); }
<?php /** * File for displaying the config-window for a plugin. * Call: call.Plugin.config.php?id= */ require_once '../inc/class.Frontend.php'; $Frontend = new Frontend(true); $Factory = new PluginFactory(); if (isset($_GET['key'])) { $Factory->uninstallPlugin(filter_input(INPUT_GET, 'key')); echo Ajax::wrapJSforDocumentReady('Runalyze.Overlay.load("call/window.config.php");'); } elseif (isset($_GET['id']) && is_numeric($_GET['id'])) { $Plugin = $Factory->newInstanceFor($_GET['id']); $Plugin->displayConfigWindow(); } else { echo '<em>' . __('Something went wrong ...') . '</em>'; }
protected function activatePlugin($name) { $plugin_factory = PluginFactory::instance(); $plugin = $plugin_factory->createPlugin($name); $plugin_factory->availablePlugin($plugin); }
<?php /** * File for displaying plugins. * Call: call.Plugin.display.php?id= [&sport= &jahr= &dat= ] */ require '../inc/class.Frontend.php'; $Frontend = new Frontend(); $Factory = new PluginFactory(); try { $Plugin = $Factory->newInstanceFor(filter_input(INPUT_GET, 'id')); } catch (Exception $E) { $Plugin = null; echo HTML::error(__('The plugin could not be found.')); } if ($Plugin !== null) { if ($Plugin instanceof PluginPanel) { $Plugin->setSurroundingDivVisible(false); } $Plugin->display(); }
<?php /** * Draw prognosis as function of time * Call: include Plot.form.php * @package Runalyze\Plugins\Panels */ use Runalyze\Calculation\JD; use Runalyze\Calculation\Prognosis; use Runalyze\Configuration; use Runalyze\Activity\Distance; if (is_dir(FRONTEND_PATH . '../plugin/RunalyzePluginStat_Wettkampf')) { $Factory = new PluginFactory(); $WKplugin = $Factory->newInstance('RunalyzePluginStat_Wettkampf'); } if (!isset($distance)) { $distance = 10; } $DataFailed = false; $Prognosis = array(); $Results = array(); $Strategy = new Prognosis\Daniels(); $Strategy->adjustVDOT(false); $PrognosisObj = new Prognosis\Prognosis(); $PrognosisObj->setStrategy($Strategy); if (START_TIME != time()) { $Data = Cache::get('prognosePlotData'); if (is_null($Data)) { $withElevation = Configuration::Vdot()->useElevationCorrection(); $Data = DB::getInstance()->query(' SELECT
function _getPluginFactory() { return PluginFactory::instance(); }
/** * Set all fieldsets and fields */ public function setFieldsetsAndFields() { $Data = AccountHandler::getDataForId(SessionAccountHandler::getId()); FormularInput::setStandardSize(FormularInput::$SIZE_MIDDLE); $UsernameField = new FormularInput('name', __('Username'), $Data['username']); $UsernameField->setDisabled(); $MailField = new FormularInput('name', __('Email address'), $Data['mail']); $MailField->setDisabled(); $NameField = new FormularInput('name', __('Name'), $Data['name']); $LanguageField = new FormularSelectBox('language', __('Language'), $Data['language']); foreach (Language::availableLanguages() as $klang => $lang) { $LanguageField->addOption($klang, $lang[0]); } $SinceField = new FormularInput('name', __('Registered since'), date('d.m.Y H:i', $Data['registerdate'])); $SinceField->setDisabled(); $LastLoginField = new FormularInput('name', __('Last Login'), date('d.m.Y H:i', $Data['lastlogin'])); $LastLoginField->setDisabled(); $Account = new FormularFieldset(__('Your account')); $Account->addField($UsernameField); $Account->addField($MailField); $Account->addField($NameField); $Account->addField($LanguageField); $Account->addField($SinceField); $Account->addField($LastLoginField); $AllowMailsField = new FormularSelectBox('allow_mails', __('Email me'), $Data['allow_mails']); $AllowMailsField->addOption('1', __('Yes')); $AllowMailsField->addOption('0', __('No')); $Notifications = new FormularFieldset(__('Notifications')); $Notifications->addInfo(__('At irregular intervals we are sending mails to you. We will never send you spam or advertisement.')); $Notifications->addField($AllowMailsField); $Password = new FormularFieldset(__('Change your password')); if (empty($_POST['old_pw']) && empty($_POST['new_pw']) && empty($_POST['new_pw_repeat'])) { $Password->setCollapsed(); } else { // Don't show passwords as 'value="..."' $_POST['old_pw'] = ''; $_POST['new_pw'] = ''; $_POST['new_pw_repeat'] = ''; } $Password->addField(new FormularInputPassword('old_pw', __('Old password'))); $Password->addField(new FormularInputPassword('new_pw', __('New password'))); $Password->addField(new FormularInputPassword('new_pw_repeat', __('Repeat new password'))); $Backup = new FormularFieldset(__('Backup your data')); $Backup->setCollapsed(); $Factory = new PluginFactory(); if ($Factory->isInstalled('RunalyzePluginTool_DbBackup')) { $Plugin = $Factory->newInstance('RunalyzePluginTool_DbBackup'); $Backup->addInfo(__('Please use the plugin') . ' \'<strong>' . $Plugin->getWindowLink() . '</strong>\'.'); } else { $Backup->addInfo(__('The backup of all your data is not manually possible yet.<br>' . 'In important individual cases write us an e-mail to mail@runalyze.de and and we will take care of it right away!')); } $DeleteLink = Ajax::window('<a href="call/window.delete.php"><strong>' . __('Delete your account') . ' »</strong></a>') . '<br><br>' . __('You\'ll receive an email with a link to confirm the deletion.<br>' . 'The deletion is permanent and cannot be reversed. ' . 'Therefore, you should backup your data.'); $Delete = new FormularFieldset(__('Delete your account')); $Delete->setCollapsed(); $Delete->addWarning($DeleteLink); $this->Formular->addFieldset($Account); $this->Formular->addFieldset($Notifications); $this->Formular->addFieldset($Password); $this->Formular->addFieldset($Backup); $this->Formular->addFieldset($Delete); $this->Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W100); }
/** * Display panels */ public function displayPanels() { $Factory = new PluginFactory(); $Panels = $Factory->enabledPanels(); foreach ($Panels as $key) { $Panel = $Factory->newInstance($key); $Panel->display(); } }
/** * Window: explanations for calculations * @package Runalyze\Plugins\Panels */ require '../../inc/class.Frontend.php'; $Frontend = new Frontend(); ?> <div class="panel-heading"> <h1><?php _e('Explanation: How are these experimental values calculated?'); ?> </h1> </div> <div class="panel-content"> <?php $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Rechenspiele'); $Formular = new Formular(); $Formular->setId('rechenspiele-calculator'); $Formular->addCSSclass('ajax'); $Formular->addCSSclass('no-automatic-reload'); $Formular->addFieldset($Plugin->getFieldsetTRIMP(), false); $Formular->addFieldset($Plugin->getFieldsetVDOT(), false); $Formular->addFieldset($Plugin->getFieldsetBasicEndurance()); $Formular->addFieldset($Plugin->getFieldsetPaces(), false); $Formular->allowOnlyOneOpenedFieldset(); $Formular->display(); ?> </div>
/** * This method instantiate a plugin that should not be used outside * of installation use case. It bypass all caches and do not check availability * of the plugin. * * @param string $name The name of the plugin (docman, tracker, …) * @return Plugin */ public function getPluginDuringInstall($name) { return $this->plugin_factory->instantiatePlugin(0, $name); }
<?php /** * File for uninstalling plugins. * Call: call.Plugin.uninstall.php?key= */ require '../inc/class.Frontend.php'; $Pluginkey = filter_input(INPUT_GET, 'key'); $Frontend = new Frontend(); $Installer = new PluginInstaller($Pluginkey); echo '<h1>' . __('Uninstall') . ' ' . $Pluginkey . '</h1>'; if ($Installer->uninstall()) { echo HTML::okay(__('The plugin has been uninstalled.')); PluginFactory::clearCache(); Ajax::setReloadFlag(Ajax::$RELOAD_ALL); echo Ajax::getReloadCommand(); } else { echo HTML::error(__('There was a problem, the plugin could not be uninstalled.')); } echo '<ul class="blocklist">'; echo '<li>'; echo Ajax::window('<a href="' . ConfigTabPlugins::getExternalUrl() . '">' . Icon::$TABLE . ' ' . __('back to list') . '</a>'); echo '</li>'; echo '</ul>';
/** * Get the link for first various statistic * @return string */ public static function getLinkForVariousStats() { $Factory = new PluginFactory(); $array = $Factory->variousPlugins(); return $Factory->newInstance($array[0])->getLink(); }
/** * Display surrounding div and default content for all tools */ public static function displayToolsContent() { echo '<div id="' . self::$TOOLS_DIV_ID . '">'; echo '<div class="panel-heading">'; echo '<h1>' . __('Tools') . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; echo __('Complex tools can analyze or process the complete database and will open in an overlay.') . '<br><br>'; echo '<table class="fullwidth zebra-style more-padding">'; echo '<thead><tr><th colspan="3">' . __('Installed tools') . ':</th></tr></thead>'; echo '<tbody class="top-and-bottom-border">'; $Factory = new PluginFactory(); $tools = $Factory->activePlugins(PluginType::Tool); if (empty($tools)) { echo '<tr><td colspan="3"><em>' . __('No tools installed.') . '.</em></td></tr>'; } foreach ($tools as $key) { $Factory = new PluginFactory(); $Plugin = $Factory->newInstance($key); echo '<tr> <td>' . $Plugin->getConfigLink() . '</td> <td class="b">' . self::getLinkFor($Plugin->id(), $Plugin->name()) . '</td> <td>' . $Plugin->description() . '</td> </tr>'; } echo '</tbody>'; echo '</table>'; echo '</div>'; echo '</div>'; }
/** * Add tab for comparison of years */ protected function addTabForComparisonOfYears() { $Content = ''; $Factory = new PluginFactory(); if ($Factory->isInstalled('RunalyzePluginStat_Statistiken')) { $Plugin = $Factory->newInstance('RunalyzePluginStat_Statistiken'); $Content .= $Plugin->getYearComparisonTable(); } if ($Factory->isInstalled('RunalyzePluginStat_Wettkampf')) { if ($Content != '') { $Content .= '<tbody><tr class="no-zebra no-border"><td colspan="' . (date("Y") - START_YEAR + 2) . '"> </td></tr></tbody>'; } $Plugin = $Factory->newInstance('RunalyzePluginStat_Wettkampf'); $Content .= $Plugin->getYearComparisonTable(); } if ($Content != '') { $this->StatisticTabs->addTab(__('Year on year') . ' (' . __('Running') . ')', 'statistics-years', $Content); } }
/** * Function to (in)activate the plugin * @param int $active */ public final function setActive($active = 1) { DB::getInstance()->update('plugin', $this->id(), 'active', $active); $this->active = $active; PluginFactory::clearCache(); }
public function __construct() { $this->plugin_factory = PluginFactory::instance(); }
/** * Set default values */ protected function setDefaultValues() { $Strategy = new Prognosis\Bock(); $TopResults = $Strategy->getTopResults(2); $CurrentShape = Configuration::Data()->vdotShape(); if (empty($_POST)) { $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Prognose'); $_POST['model'] = 'jack-daniels'; $_POST['distances'] = implode(', ', $Plugin->getDistances()); $_POST['vdot'] = $CurrentShape; $_POST['endurance'] = true; $_POST['endurance-value'] = BasicEndurance::getConst(); $_POST['best-result-km'] = !empty($TopResults) ? $TopResults[0]['distance'] : '5.0'; $_POST['best-result-time'] = !empty($TopResults) ? Duration::format($TopResults[0]['s']) : '0:26:00'; $_POST['second-best-result-km'] = !empty($TopResults) ? $TopResults[1]['distance'] : '10.0'; $_POST['second-best-result-time'] = !empty($TopResults) ? Duration::format($TopResults[1]['s']) : '1:00:00'; } $this->InfoLines['jack-daniels'] = __('Your current VDOT:') . ' ' . $CurrentShape . '. '; $this->InfoLines['jack-daniels'] .= __('Your current basic endurance:') . ' ' . BasicEndurance::getConst() . '.'; $ResultLine = empty($TopResults) ? __('none') : sprintf(__('%s in %s <small>(%s)</small> and %s in %s <small>(%s)</small>'), Distance::format($TopResults[0]['distance']), Duration::format($TopResults[0]['s']), date('d.m.Y', $TopResults[0]['time']), Distance::format($TopResults[1]['distance']), Duration::format($TopResults[1]['s']), date('d.m.Y', $TopResults[1]['time'])); $this->InfoLines['robert-bock'] = __('Your two best results:') . ' ' . $ResultLine; $this->setupJackDanielsStrategy(); $this->setupBockStrategy(); $this->setupSteffnyStrategy(); $this->setupCameronStrategy(); }
/** * Send results to Multi Editor */ protected function sendResultsToMultiEditor() { $IDs = array(); foreach ($this->Trainings as $data) { $IDs[] = $data['id']; } $_POST['ids'] = implode(',', $IDs); $Factory = new PluginFactory(); $MultiEditor = $Factory->newInstance('RunalyzePluginTool_MultiEditor'); if ($MultiEditor) { $MultiEditor->display(); } else { echo HTML::error(__('The multi editor could not be located.')); } echo Ajax::wrapJS('$("#search").remove();$("#ajax").removeClass("big-window");'); }
$Mode = StandardFormular::$SUBMIT_MODE_EDIT; $Shoe = new Shoe(Request::sendId()); } $Formular = new StandardFormular($Shoe, $Mode); if ($Formular->submitSucceeded()) { header('Location: window.schuhe.table.php'); ShoeFactory::clearCache(); exit; } if (Request::sendId() > 0) { $DeleteText = '<strong>' . __('Delete shoe') . ' »</strong>'; $DeleteUrl = $_SERVER['SCRIPT_NAME'] . '?delete=true&id=' . $Shoe->id(); $DeleteLink = Ajax::link($DeleteText, 'ajax', $DeleteUrl); if ($Shoe->getKm() != $Shoe->getAdditionalKm()) { $DeleteLink = __('The shoe cannot be deleted as long it is used for some activity.'); } $DeleteFieldset = new FormularFieldset(__('Delete shoe')); $DeleteFieldset->addWarning($DeleteLink); $Formular->addFieldset($DeleteFieldset); } $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Schuhe'); echo '<div class="panel-heading">'; echo '<div class="panel-menu"><ul><li>' . $Plugin->tableLink() . '</li></ul></div>'; echo '<h1>' . $Header . '</h1>'; echo '</div>'; echo '<div class="panel-content">'; $Formular->setId('shoe'); $Formular->setLayoutForFields(FormularFieldset::$LAYOUT_FIELD_W33); $Formular->display(); echo '</div>';
/** * Parse all post values */ public function parsePostData() { $Factory = new PluginFactory(); foreach ($Factory->completeData() as $Plugin) { $id = $Plugin['id']; if (isset($_POST['plugin_modus_' . $id]) && isset($_POST['plugin_order_' . $id])) { DB::getInstance()->update('plugin', $id, array('active', 'order'), array((int) $_POST['plugin_modus_' . $id], (int) $_POST['plugin_order_' . $id])); } } $Factory->clearCache(); Ajax::setReloadFlag(Ajax::$RELOAD_PLUGINS); }
<?php /** * File for moving a panel-plugin. * Call: call.PluginPanel.move.php?id=&mode= */ require_once '../inc/class.Frontend.php'; $Frontend = new Frontend(); if (is_numeric($_GET['id'])) { $Factory = new PluginFactory(); $Panel = $Factory->newInstanceFor($_GET['id']); if ($Panel->type() == PluginType::Panel) { $Panel->move(filter_input(INPUT_GET, 'mode')); } }
public function restrict() { $request = HTTPRequest::instance(); $plugin_factory = PluginFactory::instance(); $plugin_resource_restrictor = $this->getPluginResourceRestrictor(); $plugin = $plugin_factory->getPluginById($request->get('plugin_id')); if ($plugin->getScope() !== Plugin::SCOPE_PROJECT) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, 'This project cannot be restricted.'); $GLOBALS['Response']->redirect('/plugins/pluginsadministration/'); die; } $presenter = new PluginsAdministration_ManageAllowedProjectsPresenter($plugin, $plugin_resource_restrictor->searchAllowedProjectsOnPlugin($plugin), $plugin_resource_restrictor->isPluginRestricted($plugin)); $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') . '/src/templates/resource_restrictor'); $renderer->renderToPage(PluginsAdministration_ManageAllowedProjectsPresenter::TEMPLATE, $presenter); }
<?php /** * Window: user table * @package Runalyze\Plugins\Panels */ require '../../inc/class.Frontend.php'; use Runalyze\Activity\Duration; use Runalyze\Activity\Weight; $Frontend = new Frontend(); $Factory = new PluginFactory(); $Plugin = $Factory->newInstance('RunalyzePluginPanel_Sportler'); $Fields = array('time' => 'date', 'weight' => '', 'sleep_duration' => ' <small>h</small>'); $FieldsPulse = array('pulse_rest' => ' <small>bpm</small>', 'pulse_max' => ' <small>bpm</small>'); $FieldsFat = array('fat' => ' %', 'water' => ' %', 'muscles' => ' %'); $Data = array_reverse(UserData::getFullArray()); if (Request::param('reload') == 'true') { Ajax::setReloadFlag(Ajax::$RELOAD_ALL); echo Ajax::getReloadCommand(); } ?> <div class="panel-heading"> <div class="panel-menu"><ul><li><?php echo $Plugin->addLink(); ?> </li></ul></div> <h1><?php _e('Body values'); ?> </h1> </div>
<?php require_once 'SocialPluginsHelper.php'; $socialPlugins = new SocialPluginsHelper(array(SocialPluginsHelper::HTML_AFTER_BUTTONS => '<div class="clear"></div>', SocialPluginsHelper::HTML_BEFORE_BUTTONS => '<div class="clear"></div>', SocialPluginsHelper::STYLE_OF_WRAPPER => 'margin-top:10px;', SocialPluginsHelper::CUSTOM_PLUGIN_STYLE => array("TwitterButton" => "width:69px;", "FacebookLike" => "width:146px;"))); $socialPlugins->add(PluginFactory::create("FacebookLike")); $socialPlugins->add(PluginFactory::create("TwitterButton")); $socialPlugins->add(PluginFactory::create("Gplus")); ?> <html> <head></head> <body> <?php $socialPlugins->renderAllButtons(); //$socialPlugins->renderAllScripts(); ?> </body> </html>