/** * Tests addon::meta_data() * * @test */ public function test_meta_data() { $default = addon::meta_data('default', 'theme'); $smssync = addon::meta_data('smssync', 'plugin'); $this->assertNotEmpty($default['Theme Name']); $this->assertNotEmpty($smssync['name']); }
function index() { $this->template->content = new View('admin/addons/themes'); $this->template->content->title = 'Addons'; // setup and initialize form field names $form = array('site_style' => ''); // Copy the form as errors, so the errors will be stored with keys // corresponding to the form field names $errors = $form; $form_error = FALSE; $form_saved = FALSE; // check, has the form been submitted, if so, setup validation if ($_POST) { // Instantiate Validation, use $post, so we don't overwrite $_POST // fields with our own things $post = new Validation($_POST); // Add some filters $post->pre_filter('trim', TRUE); // Add some rules, the input field, followed by a list of checks, carried out in order $post->add_rules('site_style', 'length[1,50]'); // Test to see if things passed the rule checks if ($post->validate()) { // Yes! everything is valid Settings_Model::save_setting('site_style', $post->site_style); // Everything is A-Okay! $form_saved = TRUE; // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); } else { // repopulate the form fields $form = arr::overwrite($form, $post->as_array()); // populate the error fields, if any $errors = arr::overwrite($errors, $post->errors('settings')); $form_error = TRUE; } } else { $site_style = Settings_Model::get_setting('site_style'); // Retrieve Current Settings $form = array('site_style' => !empty($site_style) ? $site_style : 'default'); } $this->template->content->form = $form; $this->template->content->errors = $errors; $this->template->content->form_error = $form_error; $this->template->content->form_saved = $form_saved; $themes = addon::get_addons('theme'); foreach ($themes as $key => $theme) { // We want to hide checkin themes if checkins is not enabled if (!Kohana::config('settings.checkins') and $theme['Checkins'] == 1) { unset($themes[$key]); } } $this->template->content->themes = $themes; }
/** * Loads ushahidi themes */ public static function register_theme() { self::$themes = addon::get_addons('theme', TRUE); $theme = Kohana::config("settings.site_style"); $theme = empty($theme) ? 'default' : $theme; self::load_theme($theme); }
<script type="text/javascript" language="JavaScript" src="<?php echo APP_ROOT; ?> include/js/jquery.js"></script> <script type="text/javascript" language="JavaScript" src="<?php echo APP_ROOT; ?> include/js/jqSOAPClient.js"></script> <script type="text/javascript" language="JavaScript" src="<?php echo APP_ROOT; ?> include/js/jqXMLUtils.js"></script> <?php // ADDONS $addon_obj = new addon(); $addon_obj->loadAddons(); foreach ($addon_obj->result as $addon) { echo '<script type="application/x-javascript" src="' . APP_ROOT . 'addons/' . $addon->kurzbz . '/content/init.js.php" />'; } ?> <commandset id="maincommands"> <command id="menu-file-close:command" oncommand="closeWindow();"/> <command id="menu-properties-studiensemester:command" oncommand="studiensemesterChange();"/> <command id="menu-prefs-stpltable-stundenplan:command" oncommand="stpltableChange('stundenplan');"/> <command id="menu-prefs-stpltable-stundenplandev:command" oncommand="stpltableChange('stundenplandev');"/> <command id="menu-prefs-kontofilterstg:command" oncommand="EinstellungenKontoFilterStgChange();"/> <command id="menu-statistic-koordinatorstunden:command" oncommand="StatistikPrintKoordinatorstunden();"/> <command id="menu-statistic-lehrauftraege:command" oncommand="StatistikPrintLehrauftraege();"/> <command id="menu-statistic-lvplanung:command" oncommand="StatistikPrintLVPlanung();"/>
</div> </div> </div> <?php } else { $table = table::factory(); $table->addCollsLayout('20,*,215'); $table->addRow()->addCell('')->addCell(lang::get('name'))->addCell(lang::get('actions')); $table->addSection('tbody'); $addons = scandir(dir::backend('addons' . DIRECTORY_SEPARATOR)); if (count($addons)) { foreach ($addons as $dir) { if (in_array($dir, ['.', '..', '.htaccess'])) { continue; } $curAddon = new addon($dir); $install_url = url::backend('addons', ['subpage' => 'overview', 'addon' => $dir, 'action' => 'install']); $active_url = url::backend('addons', ['subpage' => 'overview', 'addon' => $dir, 'action' => 'active']); $delete_url = url::backend('addons', ['subpage' => 'overview', 'addon' => $dir, 'action' => 'delete']); $help_url = url::backend('addons', ['subpage' => 'overview', 'addon' => $dir, 'action' => 'help']); if ($curAddon->isInstall()) { $install = '<a href="' . $install_url . '" class="btn btn-sm dyn-online">' . lang::get('addon_installed') . '</a>'; } else { $install = '<a href="' . $install_url . '" class="btn btn-sm dyn-offline">' . lang::get('addon_not_installed') . '</a>'; } if ($curAddon->isActive()) { $active = '<a href="' . $active_url . '" class="btn btn-sm dyn-online fa fa-check" title="' . lang::get('addon_actived') . '"></a>'; } else { $active = '<a href="' . $active_url . '" class="btn btn-sm dyn-offline fa fa-times" title="' . lang::get('addon_not_actived') . '"></a>'; } $delete = '<a href="' . $delete_url . '" class="btn btn-sm btn-danger fa fa-trash-o delete"></a>';
<?php $config = new addon('seo'); $form = form::factory('user', 'id=' . dyn::get('user')->get('id'), 'index.php'); $form->setSave(false); $form->delButton('save-back'); $field = $form->addSelectField('ending', $form->get('ending', $config->get('ending'))); $field->fieldName(lang::get('ending')); $field->add('/', '/'); $field->add('.html', '.html'); $field = $form->addSelectField('start_url', $form->get('start_url', $config->get('start_url'))); $field->fieldName(lang::get('start_page')); $field->add('0', dyn::get('hp_url')); $field->add('1', dyn::get('hp_url') . seo_rewrite::rewriteId(dyn::get('start_page'))); $field = $form->addCheckboxField('robots', $form->get('robots', $config->get('robots'))); $field->fieldName(lang::get('seo_site_indexing')); $field->add('1', ''); if ($form->isSubmit()) { $config->add('ending', $form->get('ending'), true); $config->add('start_url', $form->get('start_url'), true); $config->add('robots', $form->get('robots'), true); if (!$config->saveConfig()) { $this->setErrorMessage(lang::get('seo_not_saved')); } addonConfig::loadAllConfig(); seo_rewrite::generatePathlist(); } ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php
} else { echo lang::get('addon_no_readme'); } ?> </div> </div> <?php } else { $table = new table(); $table->addCollsLayout('25,*,215, 70'); $table->addRow()->addCell('')->addCell(lang::get('name'))->addCell(lang::get('status'))->addCell(''); $table->addSection('tbody'); $addons = array_diff(scandir(dir::base('addons' . DIRECTORY_SEPARATOR)), ['.', '..', '.htaccess']); if (count($addons)) { foreach ($addons as $dir) { $curAddon = new addon($dir); $status = ''; $delete = '<a href="?page=addons&addon=' . $dir . '&action=delete" class="delete"></a>'; $status .= ' <form action="" method="get"> <input type="hidden" name="page" value="addons"> <input type="hidden" name="addon" value="' . $dir . '"> <select class="addonAction" name="action">'; if ($curAddon->isActive()) { $status .= '<option selected="selected" value="">' . lang::get('addon_actived') . '</option>'; } elseif ($curAddon->isInstall()) { $status .= '<option selected="selected" value="">' . lang::get('addon_installed') . '</option>'; } else { $status .= '<option selected="selected" value="">' . lang::get('addon_not_installed') . '</option>'; } if ($curAddon->isInstall()) {
<tr> <td colspan="4" class="col"> <h3><?php echo Kohana::lang('ui_main.no_results'); ?> </h3> </td> </tr> <?php } foreach ($plugins as $plugin) { $plugin_id = $plugin->id; $plugin_active = $plugin->plugin_active; // Retrieve Plugin Header Information from readme.txt $defaults = array("name" => "", "description" => "", "website" => "", "author" => "", "version" => ""); $plugin_meta = addon::meta_data($plugin->plugin_name, 'plugin', $defaults); // Do we have a settings page? $settings = plugin::find_settings($plugin->plugin_name); ?> <tr <?php if ($plugin_active) { echo " class=\"addon_active\" "; } ?> > <td class="col-1"><input name="plugin_id[]" id="plugin" value="<?php echo $plugin_id; ?> " type="checkbox" class="check-box"/></td> <td class="col-2"> <div class="post">
<tr> <td>BIC</td> <td>' . $bic . '</td> </tr>'; } if ($konto->zahlungsreferenz != '') { echo ' <tr> <td>Zahlungsreferenz</td> <td>' . $konto->zahlungsreferenz . '</td> </tr>'; } echo ' </tbody> </table>'; $addon = new addon(); $addon->loadAddons(); foreach ($addon->result as $a) { if ($a->kurzbz === "eps") { echo '<table class="tablesorter"> <thead> <tr> <th width="40%">Zahlung anweisen</th> <th width="60%"></th> </tr> </thead> <tbody> <tr> <td>EPS</td> <td> <a href="../../../addons/eps/cis/index.php?buchungsnummer=' . $buchungsnr . '"><img src="../../../skin/images/eps-logo_full.gif" width="30" height="30" alt="EPS Überweisung"></a>
/** * Resync plugins in codebase with database */ public static function resync_plugins() { $plugins = addon::get_addons('plugin', FALSE); // Get all plugins from the db $plugins_db = ORM::factory('plugin')->select_list('id', 'plugin_name'); // Sync the folder with the database foreach ($plugins as $dir => $plugin) { if (!in_array($dir, $plugins_db)) { $plugin = ORM::factory('plugin'); $plugin->plugin_name = $dir; $plugin->save(); } } // Remove any plugins not found in the plugins folder and not previously installed from the database foreach (ORM::factory('plugin')->where('plugin_installed', 0)->find_all() as $plugin) { if (!array_key_exists($plugin->plugin_name, $plugins)) { $plugin->delete(); } } }