Example #1
0
 public function settings()
 {
     $settings = array();
     $first = TRUE;
     foreach ($this->settings->get_all() as $setting) {
         $settings[] = array('id' => $setting->id(), 'title' => $setting->title, 'active' => $first, 'view' => $setting->view());
         $first = FALSE;
     }
     return $settings;
 }
 static function get($option)
 {
     if (empty(static::$settings) === true) {
         Settings::get_all();
         if (empty(static::$settings) === false && key_exists($option, static::$settings)) {
             return static::$settings[$option];
         }
     }
     if (key_exists($option, static::$settings)) {
         return static::$settings[$option];
     }
 }
Example #3
0
 /**
  * Returns a PluginDoc array that PyroCMS uses 
  * to build the reference in the admin panel
  *
  * @return array
  */
 public function _self_doc()
 {
     $info = array();
     // dynamically build the array for the magic method __call
     $settings = Settings::get_all();
     ksort($settings);
     foreach ($settings as $slug => $value) {
         $info[$slug]['description'] = array('en' => 'Retrieve the value for setting ' . $slug . '.', 'br' => 'Recupera o valor da configuraĆ§Ć£o "' . $slug . '".');
         $info[$slug]['single'] = true;
         $info[$slug]['double'] = false;
         $info[$slug]['variables'] = '';
         $info[$slug]['params'] = array();
     }
     return $info;
 }
 public function action_index()
 {
     $data['settings'] = Settings::get_all();
     if (\Input::method() == 'POST') {
         Controller_Settings::update(Input::Post());
         $data['settings'] = Settings::get_all(true);
     }
     $data['blocked'] = $blacklist_item = Model_Blacklist::query()->get();
     $keys = \Settings::Get('character_set');
     if (empty($keys) === true) {
         $keys = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
     }
     $random_length = \Settings::Get('random_url_length');
     if (empty($random_length) === true) {
         $random_length = 5;
     }
     $url_sample_space = DB::select(DB::expr('count(id) as count'))->from('urls')->where(DB::expr('char_length(short_url)'), $random_length)->limit(1)->execute()->as_array();
     $data['urls_left'] = Controller_Admin::mathFact(strlen($keys)) / (Controller_Admin::mathFact(strlen($keys) - $random_length) * Controller_Admin::mathFact($random_length)) - $url_sample_space[0]['count'];
     $this->template->content = View::Forge('admin/index', $data);
 }
Example #5
0
                /* Succes message instellen. */
                $_SESSION['settings']['success'] = 'De settings zijn opgeslagen.';
                /* Javascript gebruiken om de pagina te 'refreshen'. */
                echo '<script>window.location = \'./operator_instellingen\';</script>';
                /* Exit het script, zodat er direct geredirect wordt. */
                exit;
            } catch (Exception $e) {
                /* Foutmelding gevangen, sla deze op. */
                $errorMessage = $e->getMessage();
            }
        }
    }
    /* Probeer onderstaande. */
    try {
        /* Probeer alle settings op te halen. */
        $settings = Settings::get_all();
    } catch (Exception $e) {
        /* Foutmelding gevangen, kijken of er al 1 bestaat. */
        if (!empty($errorMessage)) {
            /* Er bestaat al een foutmelding, dus voeg deze eraan toe. */
            $errorMessage .= '<br />' . $e->getMessage();
        } else {
            /* Nog geen foutmelding, dus sla deze op. */
            $errorMessage = $e->getMessage();
        }
    }
}
?>
<style>
	
	.table input[type="text"] {