Ignore:
Timestamp:
Dec 19, 2014, 7:15:58 AM (9 years ago)
Author:
SergeD
Message:

version 1.1.19 - please refer to changelog for more details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/greydragon/include/greydragon.class.php

    r30754 r30783  
    33if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
    44
    5 define('GDTHEME_VERSION', '1.0.18');
     5define('GDTHEME_VERSION', '1.1.19');
    66
    77define("QUOTES_NONE",   FALSE);
     
    1717  private $themeConfig;
    1818  private $themeConfigMin;
     19  private $dir;
     20  private $cssfile;
    1921
    2022  public static function Instance($ver = '') {
     
    2628
    2729  private function __construct($ver = ''){
     30    $this->dir  = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'greydragon/';
     31
    2832    self::loadConfig($ver);
    2933  }
     
    288292  public function getHeader() {
    289293    $content = "";
     294    $root_base = get_root_url();
     295    if ($root_base):
     296    else:
     297      $root_base = '/';
     298    endif;
     299
    290300    if ($this->hasOption('p_logo_path')):
    291       $content .= '<a title="Home" id="g-logo" href="' . PHPWG_ROOT_PATH . '"><img alt="Home" src="' . PHPWG_ROOT_PATH . $this->getOption('p_logo_path') . '"></a>';
     301      $content .= '<a title="Home" id="g-logo" href="' . $root_base . '"><img alt="Home" src="' . $root_base . $this->getOption('p_logo_path') . '"></a>';
    292302    endif;
    293303    if ($this->hasOption('p_header')):
    294       $content .= '<a title="Home" id="g-header-text" href="' . PHPWG_ROOT_PATH . '">' . $this->getOption('p_header') . '</a>';
     304      $content .= '<a title="Home" id="g-header-text" href="' . $root_base . '">' . $this->getOption('p_header') . '</a>';
    295305    elseif ($this->hasOption('page_banner', TRUE)):
    296       $content .= '<a title="Home" id="g-header-text" href="' . PHPWG_ROOT_PATH . '">' . $this->getOption('page_banner', TRUE) . '</a>';
     306      $content .= '<a title="Home" id="g-header-text" href="' . $root_base . '">' . $this->getOption('page_banner', TRUE) . '</a>';
    297307    endif;                                                                                                             
    298308
     
    300310  }
    301311
     312  public function prepareCustomCSS() {
     313
     314    $this->cssfile = dirname(dirname(dirname(dirname(__FILE__)))) . '/' . PWG_LOCAL_DIR . 'greydragon/custom.css';
     315
     316    if ($this->getOption('p_lowertext') == "on"):
     317      $css  = "/* Theme dynamic settings. Do not modify */\n"
     318            . "html, body, input, select, textarea, file { text-transform: lowercase; }\n\n";
     319    else:
     320      $css = "";
     321    endif;
     322    $temp = $this->getOption('p_customcss');
     323    if ($temp):
     324      $css .= "/* Custom CSS. Do not modify */\n" . $temp;
     325    endif;
     326
     327    // create a local directory
     328    if (!file_exists($this->dir)):
     329      mkdir($this->dir, 0755);
     330    endif;
     331
     332    if ($css):
     333      $handle = fopen($this->cssfile, "w");
     334      if ($handle):
     335        fwrite($handle, $css);
     336        fclose($handle);
     337      endif;
     338    else:
     339      @unlink($this->cssfile);
     340    endif;
     341  }
     342
     343  public function deleteCustomCSS() {
     344
     345    // delete local folder
     346    foreach (scandir($this->dir) as $file):
     347      if ($file == '.' or $file == '..') continue;
     348      unlink($this->dir . $file);
     349    endforeach;
     350    rmdir($this->dir);
     351  }
     352
    302353}
    303354
Note: See TracChangeset for help on using the changeset viewer.