Example #1
0
 public static function __static()
 {
     $file = new File(PATH_TO_ROOT . '/cache/debug.php');
     if ($file->exists()) {
         include $file->get_path();
         self::$enabled = $enabled;
         self::$options = $options;
     }
 }
 public static function is_apc_enabled()
 {
     if (self::$apc_available !== null && self::$apc_enabled === null) {
         $file = new File(PATH_TO_ROOT . '/cache/apc.php');
         if ($file->exists()) {
             include $file->get_path();
             if (isset($enable_apc)) {
                 return $enable_apc;
             }
         }
     }
     return false;
 }
 private function build_form()
 {
     $form = new HTMLForm(__CLASS__);
     $fieldset = new FormFieldsetHTML('customize-favicon', $this->lang['customization.favicon']);
     $form->add_fieldset($fieldset);
     if ($this->config->get_favicon_path() == null || $this->config->get_favicon_path() == '') {
         $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], $this->lang['customization.favicon.current.null']));
     } else {
         if ($this->config->favicon_exists()) {
             $favicon_file = new File(PATH_TO_ROOT . $this->config->get_favicon_path());
             $picture = '<img src="' . Url::to_rel($favicon_file->get_path()) . '" alt="' . $this->lang['customization.favicon.current'] . '" title="' . $this->lang['customization.favicon.current'] . '"/>';
             $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], $picture));
         } else {
             $fieldset->add_field(new FormFieldFree('current_favicon', $this->lang['customization.favicon.current'], '<span class="text-strong color-alert">' . $this->lang['customization.favicon.current.erased'] . '</span>'));
         }
     }
     $fieldset->add_field(new FormFieldFilePicker('favicon', $this->lang['customization.favicon.current.change']));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }
 /**
  * @desc Saves the uploaded file on the server's filesystem.
  * @param File $destination The destination file 
  */
 public function save(File $destination)
 {
     move_uploaded_file($this->tmp_name, $destination->get_path());
 }
 private function build_form($theme_selected)
 {
     $form = new HTMLForm(__CLASS__);
     $theme_choise_fieldset = new FormFieldsetHTML('theme-choice', $this->lang['customization.interface.theme-choice']);
     $form->add_fieldset($theme_choise_fieldset);
     $theme_choise_fieldset->add_field(new FormFieldSimpleSelectChoice('select_theme', $this->lang['customization.interface.select-theme'], $theme_selected, $this->list_themes(), array('events' => array('change' => 'document.location.href = "' . AdminCustomizeUrlBuilder::customize_interface()->rel() . '" + HTMLForms.getField(\'select_theme\').getValue()'))));
     $customize_interface_fieldset = new FormFieldsetHTML('customize_interface', $this->lang['customization.interface']);
     $form->add_fieldset($customize_interface_fieldset);
     $header_logo_path = $this->get_header_logo_path($theme_selected);
     if (!empty($header_logo_path)) {
         $header_logo_file = new File(PATH_TO_ROOT . $header_logo_path);
         if ($header_logo_file->exists()) {
             $picture = '<img src="' . Url::to_rel($header_logo_file->get_path()) . '" alt="' . $this->lang['customization.interface.logo.current'] . '" title="' . $this->lang['customization.interface.logo.current'] . '"/>';
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $picture));
         } else {
             $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], '<span class="text-strong color-alert">' . $this->lang['customization.interface.logo.current.erased'] . '</span>'));
         }
     } else {
         $customize_interface_fieldset->add_field(new FormFieldFree('current_logo', $this->lang['customization.interface.logo.current'], $this->lang['customization.interface.logo.current.null']));
     }
     $customize_interface_fieldset->add_field(new FormFieldFilePicker('header_logo', $this->lang['customization.interface.logo.current.change'], array('description' => $this->lang['customization.interface.logo.current.change-explain'])));
     $customize_interface_fieldset->add_field(new FormFieldCheckbox('use_default_logo', $this->lang['customization.interface.logo.use-default'], FormFieldCheckbox::UNCHECKED));
     $this->submit_button = new FormButtonDefaultSubmit();
     $form->add_button($this->submit_button);
     $form->add_button(new FormButtonReset());
     $this->form = $form;
 }