Пример #1
0
 /**
  * Returns an instance of this class. If one doesn't exist,
  * it instanciates a new one and returns it.
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new LikeboxSettings();
     }
     return self::$instance;
 }
Пример #2
0
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'SaveSettings') {
    // save the settings
    $settings = LikeboxSettings::getInstance();
    $inputSettings['enabled'] = $_POST['enabled'];
    $inputSettings['show_header'] = $_POST['show_header'];
    $inputSettings['show_border'] = $_POST['show_border'];
    $inputSettings['show_stream'] = $_POST['show_stream'];
    $inputSettings['show_faces'] = $_POST['show_faces'];
    // Save the text fields
    $settings->set('fb_url', $_POST['fb_url']);
    $settings->set('width', $_POST['width']);
    $settings->set('height', $_POST['height']);
    // A simple loop to set all the checkbox fields
    $checkBoxes = array('enabled', 'show_header', 'show_border', 'show_stream', 'show_faces');
    foreach ($checkBoxes as $key) {
        if (isset($inputSettings[$key])) {
            $settings->set($key, 1);
        } else {
            $settings->set($key, 0);
        }
    }
    // redirect to the 'show settings' page, with a success message
    header('HTTP/1.1 303 See Other');
    header("Location: index.php?module=likebox&action=ShowSettings");
    exit;
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ShowSettings') {
    // Create the settings view
    $settingsView = new SettingsView(LikeboxSettings::getInstance());
    Layout::add($settingsView->show());
}
Пример #3
0
<?php

/**
 * Close.php - Handles including the HTML for the buttons after other modules are finished
 *
 * @author Jeremy Booker <jbooker at tux dot appstate dot edu>
 */
PHPWS_Core::initModClass('likebox', 'LikeboxView.php');
PHPWS_Core::initModClass('likebox', 'LikeboxSettings.php');
$settings = LikeboxSettings::getInstance();
if ($settings->get('enabled') == 1) {
    $view = new LikeboxView($settings);
    $view->view();
}