Dotclear


Ignore:
Files:
39 added
7 edited

Legend:

Unmodified
Added
Removed
  • .hgignore

    r358 r503  
    11cache 
    2 public 
    32inc/config.php 
    43\.htaccess 
     4public/filters 
     5themes/ductile/_work 
     6themes/ductile-work 
     7themes/ductile/default-templates 
  • admin/blog_theme.php

    r500 r503  
    156156      
    157157     $radio_id = 'theme_'.html::escapeHTML($id); 
    158      if (preg_match('#^http(s)?://#',$core->blog->settings->system->themes_url)) { 
    159           $theme_url = http::concatURL($core->blog->settings->system->themes_url,'/'.$id); 
    160      } else { 
    161           $theme_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$id); 
    162      } 
     158     $theme_url = http::concatURL($core->blog->url,$core->blog->settings->system->themes_url.'/'.$id); 
    163159     $has_conf = file_exists(path::real($core->blog->themes_path.'/'.$id).'/_config.php'); 
    164160     $has_css = file_exists(path::real($core->blog->themes_path.'/'.$id).'/style.css'); 
     
    216212{ 
    217213     echo 
    218      '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; <span class="page-title">'.__('Blog appearance').'</span></h2>'; 
     214     '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.__('Blog appearance').'</h2>'; 
    219215      
    220216     if (!empty($_GET['upd'])) { 
     
    333329     echo 
    334330     '<h2>'.html::escapeHTML($core->blog->name). 
    335      ' &rsaquo; <a href="blog_theme.php">'.__('Blog appearance').'</a> &rsaquo; <span class="page-title">'.__('Theme configuration').'<span class="page-title"></h2>'. 
     331     ' &rsaquo; <a href="blog_theme.php">'.__('Blog appearance').'</a> &rsaquo; '.__('Theme configuration').'</h2>'. 
    336332     '<p><a class="back" href="blog_theme.php">'.__('back').'</a></p>'; 
    337333      
    338334     try 
    339335     { 
    340           # Let theme configuration set their own form(s) if required 
    341           $standalone_config = (boolean) $core->themes->moduleInfo($core->blog->settings->system->theme,'standalone_config'); 
    342  
    343           if (!$standalone_config) 
     336          # Let theme configuration set their own form(s) 
     337          $managed = (boolean) $core->callBehavior('adminThemeConfigManaged'); 
     338           
     339          if (!$managed) 
    344340               echo '<form id="theme_config" action="blog_theme.php?conf=1" method="post" enctype="multipart/form-data">'; 
    345341 
    346342          include $theme_conf_file; 
    347343 
    348           if (!$standalone_config) 
     344          if (!$managed) 
    349345               echo 
    350346               '<p class="clear"><input type="submit" value="'.__('Save').'" />'. 
    351347               $core->formNonce().'</p>'. 
    352348               '</form>'; 
    353  
    354349     } 
    355350     catch (Exception $e) 
  • admin/style/default.css

    r500 r503  
    11791179p.field { 
    11801180     position: relative; 
    1181  
     1181      
    11821182} 
    11831183p.field label { 
  • inc/public/prepend.php

    r270 r420  
    113113$core->themes->loadNsFile($__theme,'public'); 
    114114 
     115# Loading translations for selected theme 
     116if ($__parent_theme) { 
     117     $core->themes->loadModuleL10N($__parent_theme,$_lang,'main'); 
     118} 
     119$core->themes->loadModuleL10N($__theme,$_lang,'main'); 
     120 
    115121# --BEHAVIOR-- publicPrepend 
    116122$core->callBehavior('publicPrepend',$core); 
  • plugins/blowupConfig/_public.php

    r270 r295  
    2525          echo '<style type="text/css">'."\n".self::blowUpStyleHelper()."\n</style>\n"; 
    2626     } 
    27       
     27 
    2828     public static function blowUpStyleHelper() 
    2929     { 
    3030          $s = $GLOBALS['core']->blog->settings->themes->blowup_style; 
    31            
     31 
    3232          if ($s === null) { 
    3333               return; 
    3434          } 
    35            
     35 
    3636          $s = @unserialize($s); 
    3737          if (!is_array($s)) { 
    3838               return; 
    3939          } 
    40            
     40 
    4141          $css = array(); 
    42            
     42 
    4343          /* Sidebar position 
    4444          ---------------------------------------------- */ 
     
    4848               $css['#sidebar']['float'] = 'left'; 
    4949          } 
    50            
     50 
    5151          /* Properties 
    5252          ---------------------------------------------- */ 
    5353          self::prop($css,'body','background-color',$s['body_bg_c']); 
    54            
     54 
    5555          self::prop($css,'body','color',$s['body_txt_c']); 
    5656          self::prop($css,'.post-tags li a:link, .post-tags li a:visited, .post-info-co a:link, .post-info-co a:visited','color',$s['body_txt_c']); 
    5757          self::prop($css,'#page','font-size',$s['body_txt_s']); 
    5858          self::prop($css,'body','font-family',blowupConfig::fontDef($s['body_txt_f'])); 
    59            
     59 
    6060          self::prop($css,'.post-content, .post-excerpt, #comments dd, #pings dd, dd.comment-preview','line-height',$s['body_line_height']); 
    61            
     61 
    6262          if (!$s['blog_title_hide']) 
    6363          { 
     
    6565               self::prop($css,'#top h1','font-size',$s['blog_title_s']); 
    6666               self::prop($css,'#top h1','font-family',blowupConfig::fontDef($s['blog_title_f'])); 
    67                 
     67 
    6868               if ($s['blog_title_a'] == 'right' || $s['blog_title_a'] == 'left') { 
    6969                    $css['#top h1'][$s['blog_title_a']] = '0px'; 
    7070                    $css['#top h1']['width'] = 'auto'; 
    7171               } 
    72                 
     72 
    7373               if ($s['blog_title_p']) 
    7474               { 
     
    9292          } 
    9393          self::prop($css,'#top','height',$s['top_height']); 
    94            
     94 
    9595          self::prop($css,'.day-date','color',$s['date_title_c']); 
    9696          self::prop($css,'.day-date','font-family',blowupConfig::fontDef($s['date_title_f'])); 
    9797          self::prop($css,'.day-date','font-size',$s['date_title_s']); 
    98            
     98 
    9999          self::prop($css,'a','color',$s['body_link_c']); 
    100100          self::prop($css,'a:visited','color',$s['body_link_v_c']); 
    101101          self::prop($css,'a:hover, a:focus, a:active','color',$s['body_link_f_c']); 
    102            
     102 
    103103          self::prop($css,'#comment-form input, #comment-form textarea','color',$s['body_link_c']); 
    104104          self::prop($css,'#comment-form input.preview','color',$s['body_link_c']); 
     
    108108          self::prop($css,'#comment-form input.submit:hover','background',$s['body_link_f_c']); 
    109109          self::prop($css,'#comment-form input.submit:hover','border-color',$s['body_link_f_c']); 
    110            
     110 
    111111          self::prop($css,'#sidebar','font-family',blowupConfig::fontDef($s['sidebar_text_f'])); 
    112112          self::prop($css,'#sidebar','font-size',$s['sidebar_text_s']); 
    113113          self::prop($css,'#sidebar','color',$s['sidebar_text_c']); 
    114            
     114 
    115115          self::prop($css,'#sidebar h2','font-family',blowupConfig::fontDef($s['sidebar_title_f'])); 
    116116          self::prop($css,'#sidebar h2','font-size',$s['sidebar_title_s']); 
    117117          self::prop($css,'#sidebar h2','color',$s['sidebar_title_c']); 
    118            
     118 
    119119          self::prop($css,'#sidebar h3','font-family',blowupConfig::fontDef($s['sidebar_title2_f'])); 
    120120          self::prop($css,'#sidebar h3','font-size',$s['sidebar_title2_s']); 
    121121          self::prop($css,'#sidebar h3','color',$s['sidebar_title2_c']); 
    122            
     122 
    123123          self::prop($css,'#sidebar ul','border-top-color',$s['sidebar_line_c']); 
    124124          self::prop($css,'#sidebar li','border-bottom-color',$s['sidebar_line_c']); 
    125125          self::prop($css,'#topnav ul','border-bottom-color',$s['sidebar_line_c']); 
    126            
     126 
    127127          self::prop($css,'#sidebar li a','color',$s['sidebar_link_c']); 
    128128          self::prop($css,'#sidebar li a:visited','color',$s['sidebar_link_v_c']); 
     
    132132          self::prop($css,'#search .submit:hover','background',$s['sidebar_link_f_c']); 
    133133          self::prop($css,'#search .submit:hover','border-color',$s['sidebar_link_f_c']); 
    134            
     134 
    135135          self::prop($css,'.post-title','color',$s['post_title_c']); 
    136136          self::prop($css,'.post-title a, .post-title a:visited','color',$s['post_title_c']); 
    137137          self::prop($css,'.post-title','font-family',blowupConfig::fontDef($s['post_title_f'])); 
    138138          self::prop($css,'.post-title','font-size',$s['post_title_s']); 
    139            
     139 
    140140          self::prop($css,'#comments dd','background-color',$s['post_comment_bg_c']); 
    141141          self::prop($css,'#comments dd','color',$s['post_comment_c']); 
    142142          self::prop($css,'#comments dd.me','background-color',$s['post_commentmy_bg_c']); 
    143143          self::prop($css,'#comments dd.me','color',$s['post_commentmy_c']); 
    144            
     144 
    145145          self::prop($css,'#prelude, #prelude a','color',$s['prelude_c']); 
    146            
     146 
    147147          self::prop($css,'#footer p','background-color',$s['footer_bg_c']); 
    148148          self::prop($css,'#footer p','color',$s['footer_c']); 
     
    150150          self::prop($css,'#footer p','font-family',blowupConfig::fontDef($s['footer_f'])); 
    151151          self::prop($css,'#footer p a','color',$s['footer_l_c']); 
    152            
     152 
    153153          /* Images 
    154154          ------------------------------------------------------ */ 
     
    164164          self::backgroundImg($css,'#comments dt.me',$s['post_commentmy_bg_c'],'commentmy-t.png'); 
    165165          self::backgroundImg($css,'#comments dd.me',$s['post_commentmy_bg_c'],'commentmy-b.png'); 
    166            
     166 
    167167          $res = ''; 
    168168          foreach ($css as $selector => $values) { 
     
    173173               $res .= "}\n"; 
    174174          } 
     175 
     176          $res .= $s['extra_css']; 
     177 
    175178          return $res; 
    176179     } 
    177       
     180 
    178181     protected static function prop(&$css,$selector,$prop,$value) 
    179182     { 
     
    182185          } 
    183186     } 
    184       
     187 
    185188     protected static function backgroundImg(&$css,$selector,$value,$image) 
    186189     { 
  • plugins/blowupConfig/index.php

    r500 r503  
    2424     'body_bg_c' => null, 
    2525     'body_bg_g' => 'light', 
    26       
     26 
    2727     'body_txt_f' => null, 
    2828     'body_txt_s' => null, 
    2929     'body_txt_c' => null, 
    3030     'body_line_height' => null, 
    31       
     31 
    3232     'top_image' => 'default', 
    3333     'top_height' => null, 
    3434     'uploaded' => null, 
    35       
     35 
    3636     'blog_title_hide' => null, 
    3737     'blog_title_f' => null, 
     
    4040     'blog_title_a' => null, 
    4141     'blog_title_p' => null, 
    42       
     42 
    4343     'body_link_c' => null, 
    4444     'body_link_f_c' => null, 
    4545     'body_link_v_c' => null, 
    46       
     46 
    4747     'sidebar_position' => null, 
    4848     'sidebar_text_f' => null, 
     
    5959     'sidebar_link_f_c' => null, 
    6060     'sidebar_link_v_c' => null, 
    61       
     61 
    6262     'date_title_f' => null, 
    6363     'date_title_s' => null, 
    6464     'date_title_c' => null, 
    65       
     65 
    6666     'post_title_f' => null, 
    6767     'post_title_s' => null, 
     
    7171     'post_commentmy_bg_c' => null, 
    7272     'post_commentmy_c' => null, 
    73       
     73 
    7474     'prelude_c' => null, 
    7575     'footer_f' => null, 
     
    7878     'footer_l_c' => null, 
    7979     'footer_bg_c' => null, 
     80 
     81     'extra_css' => null 
    8082); 
    8183 
     
    108110          $blowup_user['body_txt_c'] = blowupConfig::adjustColor($_POST['body_txt_c']); 
    109111          $blowup_user['body_line_height'] = blowupConfig::adjustFontSize($_POST['body_line_height']); 
    110            
     112 
    111113          $blowup_user['blog_title_hide'] = (integer) !empty($_POST['blog_title_hide']); 
    112114          $update_blog_title = !$blowup_user['blog_title_hide'] && ( 
     
    115117               !empty($_POST['blog_title_p']) 
    116118          ); 
    117            
     119 
    118120          if ($update_blog_title) 
    119121          { 
     
    124126               $blowup_user['blog_title_p'] = blowupConfig::adjustPosition($_POST['blog_title_p']); 
    125127          } 
    126            
     128 
    127129          $blowup_user['body_link_c'] = blowupConfig::adjustColor($_POST['body_link_c']); 
    128130          $blowup_user['body_link_f_c'] = blowupConfig::adjustColor($_POST['body_link_f_c']); 
    129131          $blowup_user['body_link_v_c'] = blowupConfig::adjustColor($_POST['body_link_v_c']); 
    130            
     132 
    131133          $blowup_user['sidebar_text_f'] = $_POST['sidebar_text_f']; 
    132134          $blowup_user['sidebar_text_s'] = blowupConfig::adjustFontSize($_POST['sidebar_text_s']); 
     
    142144          $blowup_user['sidebar_link_f_c'] = blowupConfig::adjustColor($_POST['sidebar_link_f_c']); 
    143145          $blowup_user['sidebar_link_v_c'] = blowupConfig::adjustColor($_POST['sidebar_link_v_c']); 
    144            
     146 
    145147          $blowup_user['sidebar_position'] = ($_POST['sidebar_position'] == 'left') ? 'left' : null; 
    146            
     148 
    147149          $blowup_user['date_title_f'] = $_POST['date_title_f']; 
    148150          $blowup_user['date_title_s'] = blowupConfig::adjustFontSize($_POST['date_title_s']); 
    149151          $blowup_user['date_title_c'] = blowupConfig::adjustColor($_POST['date_title_c']); 
    150            
     152 
    151153          $blowup_user['post_title_f'] = $_POST['post_title_f']; 
    152154          $blowup_user['post_title_s'] = blowupConfig::adjustFontSize($_POST['post_title_s']); 
     
    154156          $blowup_user['post_comment_c'] = blowupConfig::adjustColor($_POST['post_comment_c']); 
    155157          $blowup_user['post_commentmy_c'] = blowupConfig::adjustColor($_POST['post_commentmy_c']); 
    156            
    157            
     158 
     159 
    158160          $blowup_user['footer_f'] = $_POST['footer_f']; 
    159161          $blowup_user['footer_s'] = blowupConfig::adjustFontSize($_POST['footer_s']); 
     
    161163          $blowup_user['footer_l_c'] = blowupConfig::adjustColor($_POST['footer_l_c']); 
    162164          $blowup_user['footer_bg_c'] = blowupConfig::adjustColor($_POST['footer_bg_c']); 
    163            
     165 
     166 
     167          $blowup_user['extra_css'] = blowupConfig::cleanCSS($_POST['extra_css']); 
     168 
    164169          if ($can_write_images) 
    165170          { 
     
    168173                    $uploaded = blowupConfig::imagesPath().'/'.$blowup_user['uploaded']; 
    169174               } 
    170                 
     175 
    171176               if (!empty($_FILES['upfile']) && !empty($_FILES['upfile']['name'])) { 
    172177                    files::uploadStatus($_FILES['upfile']); 
     
    174179                    $blowup_user['uploaded'] = basename($uploaded); 
    175180               } 
    176                 
     181 
    177182               $blowup_user['top_image'] = in_array($_POST['top_image'],$top_images) ? $_POST['top_image'] : 'default'; 
    178                 
     183 
    179184               $blowup_user['body_bg_c'] = blowupConfig::adjustColor($_POST['body_bg_c']); 
    180185               $blowup_user['body_bg_g'] = in_array($_POST['body_bg_g'],$gradient_types) ? $_POST['body_bg_g'] : ''; 
     
    184189               blowupConfig::createImages($blowup_user,$uploaded); 
    185190          } 
    186            
     191 
    187192          $core->blog->settings->addNamespace('themes'); 
    188193          $core->blog->settings->themes->put('blowup_style',serialize($blowup_user)); 
    189194          $core->blog->triggerBlog(); 
    190            
     195 
    191196          http::redirect($p_url.'&upd=1'); 
    192197     } 
     
    233238 
    234239echo '<form id="theme_config" action="'.$p_url.'" method="post" enctype="multipart/form-data">'; 
    235            
     240 
    236241echo '<fieldset><legend>'.__('General').'</legend>'; 
    237242 
     
    240245     '<p class="field"><label for="body_bg_c">'.__('Background color:').' '. 
    241246     form::field('body_bg_c',7,7,$blowup_user['body_bg_c'],'colorpicker').'</label></p>'. 
    242       
     247 
    243248     '<p class="field"><label for="body_bg_g">'.__('Background color fill:').' '. 
    244249     form::combo('body_bg_g',$gradient_types,$blowup_user['body_bg_g']).'</label></p>'; 
     
    304309          $preview_image = 'index.php?pf=blowupConfig/alpha-img/page-t/'.$blowup_user['top_image'].'.png'; 
    305310     } 
    306       
     311 
    307312     echo 
    308313     '<fieldset><legend>'.__('Top image').'</legend>'. 
     
    310315     form::combo('top_image',$top_images,($blowup_user['top_image'] ? $blowup_user['top_image'] : 'default')).'</label></p>'. 
    311316     '<p>'.__('Choose "Custom..." to upload your own image.').'</p>'. 
    312       
     317 
    313318     '<p id="uploader"><label for="upfile">'.__('Add your image:'). 
    314319     ' ('.sprintf(__('JPEG or PNG file, 800 pixels wide, maximum size %s'),files::size(DC_MAX_UPLOAD_SIZE)).')'. 
    315320     '<input type="file" name="upfile" id="upfile" size="35" />'. 
    316321     '</label></p>'. 
    317       
     322 
    318323     '<h3>'.__('Preview').'</h3>'. 
    319324     '<div class="grid" style="width:800px;border:1px solid #ccc;">'. 
     
    425430'</fieldset>'; 
    426431 
     432echo 
     433'<fieldset><legend>'.__('Additional CSS').'</legend>'. 
     434'<p>'.form::textarea('extra_css',72,5,html::escapeHTML($blowup_user['extra_css']),'maximal','',false,'title="'.__('Additional CSS').'"').'</p>'. 
     435'</fieldset>'; 
     436 
     437 
     438 
    427439// Import / Export configuration 
    428440$tmp_array = array(); 
  • plugins/blowupConfig/lib/class.blowup.config.php

    r270 r295  
    2222               'ss5' => 'Impact, Charcoal, sans-serif' 
    2323          ), 
    24            
     24 
    2525          'serif' => array( 
    2626               's1' => 'Times, "Times New Roman", serif', 
     
    2828               's3' => 'Baskerville, "Palatino Linotype", serif' 
    2929          ), 
    30            
     30 
    3131          'monospace' => array( 
    3232               'm1' => '"Andale Mono", "Courier New", monospace', 
     
    3434          ) 
    3535     ); 
    36       
     36 
    3737     protected static $fonts_combo = array(); 
    3838     protected static $fonts_list = array(); 
    39       
     39 
    4040     public static $top_images = array( 
    4141          'default' => 'Default', 
     
    5555          'typo' => 'Typo', 
    5656     ); 
    57       
     57 
    5858     public static function fontsList() 
    5959     { 
     
    7070               } 
    7171          } 
    72            
     72 
    7373          return self::$fonts_combo; 
    7474     } 
    75       
     75 
    7676     public static function fontDef($c) 
    7777     { 
     
    8585               } 
    8686          } 
    87            
     87 
    8888          return isset(self::$fonts_list[$c]) ? self::$fonts_list[$c] : null; 
    8989     } 
    90       
     90 
    9191     public static function adjustFontSize($s) 
    9292     { 
     
    9797               return $m[1].$m[2]; 
    9898          } 
    99            
     99 
    100100          return null; 
    101101     } 
    102       
     102 
    103103     public static function adjustPosition($p) 
    104104     { 
     
    106106               return null; 
    107107          } 
    108            
     108 
    109109          $p = explode(':',$p); 
    110            
     110 
    111111          return $p[0].(count($p) == 1 ? ':0' : ':'.$p[1]); 
    112112     } 
    113       
     113 
    114114     public static function adjustColor($c) 
    115115     { 
     
    117117               return ''; 
    118118          } 
    119            
     119 
    120120          $c = strtoupper($c); 
    121            
     121 
    122122          if (preg_match('/^[A-F0-9]{3,6}$/',$c)) { 
    123123               $c = '#'.$c; 
    124124          } 
    125            
     125 
    126126          if (preg_match('/^#[A-F0-9]{6}$/',$c)) { 
    127127               return $c; 
    128128          } 
    129            
     129 
    130130          if (preg_match('/^#[A-F0-9]{3,}$/',$c)) { 
    131131               return '#'.substr($c,1,1).substr($c,1,1).substr($c,2,1).substr($c,2,1).substr($c,3,1).substr($c,3,1); 
    132132          } 
    133            
     133 
    134134          return ''; 
    135135     } 
    136       
     136 
     137     public static function cleanCSS($css) 
     138     { 
     139          // TODO ? 
     140          return $css; 
     141     } 
     142 
    137143     public static function imagesPath() 
    138144     { 
     
    140146          return path::real($core->blog->public_path).'/blowup-images'; 
    141147     } 
    142       
     148 
    143149     public static function imagesURL() 
    144150     { 
     
    146152          return $core->blog->settings->system->public_url.'/blowup-images'; 
    147153     } 
    148       
     154 
    149155     public static function canWriteImages($create=false) 
    150156     { 
    151157          global $core; 
    152            
     158 
    153159          $public = path::real($core->blog->public_path); 
    154160          $imgs = self::imagesPath(); 
    155            
     161 
    156162          if (!function_exists('imagecreatetruecolor') || !function_exists('imagepng') || !function_exists('imagecreatefrompng')) { 
    157163               $core->error->add(__('At least one of the following functions is not available: '. 
     
    159165               return false; 
    160166          } 
    161            
     167 
    162168          if (!is_dir($public)) { 
    163169               $core->error->add(__('The \'public\' directory does not exist.')); 
    164170               return false; 
    165171          } 
    166            
     172 
    167173          if (!is_dir($imgs)) { 
    168174               if (!is_writable($public)) { 
     
    175181               return true; 
    176182          } 
    177            
     183 
    178184          if (!is_writable($imgs)) { 
    179185               $core->error->add(sprintf(__('The \'%s\' directory cannot be modified.'),'public/blowup-images')); 
    180186               return false; 
    181187          } 
    182            
     188 
    183189          return true; 
    184190     } 
    185       
     191 
    186192     public static function uploadImage($f) 
    187193     { 
     
    189195               throw new Exception(__('Unable to create images.')); 
    190196          } 
    191            
     197 
    192198          $name = $f['name']; 
    193199          $type = files::getMimeType($name); 
    194            
     200 
    195201          if ($type != 'image/jpeg' && $type != 'image/png') { 
    196202               throw new Exception(__('Invalid file type.')); 
    197203          } 
    198            
     204 
    199205          $dest = self::imagesPath().'/uploaded'.($type == 'image/png' ? '.png' : '.jpg'); 
    200            
     206 
    201207          if (@move_uploaded_file($f['tmp_name'],$dest) === false) { 
    202208               throw new Exception(__('An error occurred while writing the file.')); 
    203209          } 
    204            
     210 
    205211          $s = getimagesize($dest); 
    206212          if ($s[0] != 800) { 
    207213               throw new Exception(__('Uploaded image is not 800 pixels wide.')); 
    208214          } 
    209            
     215 
    210216          return $dest; 
    211217     } 
    212       
     218 
    213219     public static function createImages(&$config,$uploaded) 
    214220     { 
     
    219225          $comment_color_my = $config['post_commentmy_bg_c']; 
    220226          $top_image = $config['top_image']; 
    221            
     227 
    222228          $config['top_height'] = null; 
    223            
     229 
    224230          if ($top_image != 'custom' && !isset(self::$top_images[$top_image])) { 
    225231               $top_image = 'default'; 
     
    228234               $uploaded = null; 
    229235          } 
    230            
     236 
    231237          if (!self::canWriteImages(true)) { 
    232238               throw new Exception(__('Unable to create images.')); 
    233239          } 
    234            
     240 
    235241          $body_fill = array( 
    236242               'light' => dirname(__FILE__).'/../alpha-img/gradient-l.png', 
     
    238244               'dark' => dirname(__FILE__).'/../alpha-img/gradient-d.png' 
    239245          ); 
    240            
     246 
    241247          $body_g = isset($body_fill[$gradient]) ? $body_fill[$gradient] : false; 
    242            
     248 
    243249          if ($top_image == 'custom' && $uploaded) { 
    244250               $page_t = $uploaded; 
     
    246252               $page_t = dirname(__FILE__).'/../alpha-img/page-t/'.$top_image.'.png'; 
    247253          } 
    248            
     254 
    249255          $body_bg = dirname(__FILE__).'/../alpha-img/body-bg.png'; 
    250256          $page_t_mask = dirname(__FILE__).'/../alpha-img/page-t/image-mask.png'; 
     
    254260          $default_bg = '#e0e0e0'; 
    255261          $default_prelude = '#ededed'; 
    256            
     262 
    257263          self::dropImage(basename($body_bg)); 
    258264          self::dropImage('page-t.png'); 
     
    260266          self::dropImage(basename($comment_t)); 
    261267          self::dropImage(basename($comment_b)); 
    262            
     268 
    263269          $body_color = self::adjustColor($body_color); 
    264270          $prelude_color = self::adjustColor($prelude_color); 
    265271          $comment_color = self::adjustColor($comment_color); 
    266            
     272 
    267273          if ($top_image || $body_color || $gradient != 'light' || $prelude_color || $uploaded) 
    268274          { 
     
    271277               } 
    272278               $body_color = sscanf($body_color,'#%2X%2X%2X'); 
    273                 
     279 
    274280               # Create body gradient with color 
    275281               $d_body_bg = imagecreatetruecolor(50,180); 
    276282               $fill = imagecolorallocate($d_body_bg,$body_color[0],$body_color[1],$body_color[2]); 
    277283               imagefill($d_body_bg,0,0,$fill); 
    278                 
     284 
    279285               # User choosed a gradient 
    280286               if ($body_g) { 
     
    284290                    imagedestroy($s_body_bg); 
    285291               } 
    286                 
     292 
    287293               if (!$prelude_color) { 
    288294                    $prelude_color = $default_prelude; 
    289295               } 
    290296               $prelude_color = sscanf($prelude_color,'#%2X%2X%2X'); 
    291                 
     297 
    292298               $s_prelude = imagecreatetruecolor(50,30); 
    293299               $fill = imagecolorallocate($s_prelude,$prelude_color[0],$prelude_color[1],$prelude_color[2]); 
    294300               imagefill($s_prelude,0,0,$fill); 
    295301               imagecopy($d_body_bg,$s_prelude,0,0,0,0,50,30); 
    296                 
     302 
    297303               imagepng($d_body_bg,self::imagesPath().'/'.basename($body_bg)); 
    298304          } 
    299            
     305 
    300306          if ($top_image || $body_color || $gradient != 'light') 
    301307          { 
     
    304310               $size = $size[1]; 
    305311               $type = files::getMimeType($page_t); 
    306                 
     312 
    307313               $d_page_t = imagecreatetruecolor(800,$size); 
    308                 
     314 
    309315               if ($type == 'image/png') { 
    310316                    $s_page_t = @imagecreatefrompng($page_t); 
     
    312318                    $s_page_t = @imagecreatefromjpeg($page_t); 
    313319               } 
    314                 
     320 
    315321               if (!$s_page_t) { 
    316322                    throw new exception(__('Unable to open image.')); 
    317323               } 
    318                 
     324 
    319325               $fill = imagecolorallocate($d_page_t,$body_color[0],$body_color[1],$body_color[2]); 
    320326               imagefill($d_page_t,0,0,$fill); 
    321                 
     327 
    322328               if ($type == 'image/png') 
    323329               { 
     
    331337                    # JPEG, we add image and a frame with rounded corners 
    332338                    imagecopy($d_page_t,$s_page_t,0,0,0,0,800,$size); 
    333                      
     339 
    334340                    imagecopy($d_page_t,$d_body_bg,0,0,0,50,8,4); 
    335341                    imagecopy($d_page_t,$d_body_bg,0,4,0,54,4,4); 
    336342                    imagecopy($d_page_t,$d_body_bg,792,0,0,50,8,4); 
    337343                    imagecopy($d_page_t,$d_body_bg,796,4,0,54,4,4); 
    338                      
     344 
    339345                    $mask = imagecreatefrompng($page_t_mask); 
    340346                    imagealphablending($mask,true); 
    341347                    imagecopy($d_page_t,$mask,0,0,0,0,800,11); 
    342348                    imagedestroy($mask); 
    343                      
     349 
    344350                    $fill = imagecolorallocate($d_page_t,255,255,255); 
    345351                    imagefilledrectangle($d_page_t,0,11,3,$size-1,$fill); 
     
    347353                    imagefilledrectangle($d_page_t,0,$size-9,799,$size-1,$fill); 
    348354               } 
    349                 
     355 
    350356               $config['top_height'] = ($size).'px'; 
    351                 
     357 
    352358               imagepng($d_page_t,self::imagesPath().'/page-t.png'); 
    353                 
     359 
    354360               imagedestroy($d_body_bg); 
    355361               imagedestroy($d_page_t); 
    356362               imagedestroy($s_page_t); 
    357                 
     363 
    358364               # Create bottom image with color 
    359365               $d_page_b = imagecreatetruecolor(800,8); 
    360366               $fill = imagecolorallocate($d_page_b,$body_color[0],$body_color[1],$body_color[2]); 
    361367               imagefill($d_page_b,0,0,$fill); 
    362                 
     368 
    363369               $s_page_b = imagecreatefrompng($page_b); 
    364370               imagealphablending($s_page_b,true); 
    365371               imagecopy($d_page_b,$s_page_b,0,0,0,0,800,160); 
    366                 
     372 
    367373               imagepng($d_page_b,self::imagesPath().'/'.basename($page_b)); 
    368                 
     374 
    369375               imagedestroy($d_page_b); 
    370376               imagedestroy($s_page_b); 
    371377          } 
    372            
     378 
    373379          if ($comment_color) { 
    374380               self::commentImages($comment_color,$comment_t,$comment_b,basename($comment_t),basename($comment_b)); 
     
    378384          } 
    379385     } 
    380       
     386 
    381387     protected static function commentImages($comment_color,$comment_t,$comment_b,$dest_t,$dest_b) 
    382388     { 
    383389          $comment_color = sscanf($comment_color,'#%2X%2X%2X'); 
    384                 
     390 
    385391          $d_comment_t = imagecreatetruecolor(500,25); 
    386392          $fill = imagecolorallocate($d_comment_t,$comment_color[0],$comment_color[1],$comment_color[2]); 
    387393          imagefill($d_comment_t,0,0,$fill); 
    388            
     394 
    389395          $s_comment_t = imagecreatefrompng($comment_t); 
    390396          imagealphablending($s_comment_t,true); 
    391397          imagecopy($d_comment_t,$s_comment_t,0,0,0,0,500,25); 
    392            
     398 
    393399          imagepng($d_comment_t,self::imagesPath().'/'.$dest_t); 
    394400          imagedestroy($d_comment_t); 
    395401          imagedestroy($s_comment_t); 
    396            
     402 
    397403          $d_comment_b = imagecreatetruecolor(500,7); 
    398404          $fill = imagecolorallocate($d_comment_b,$comment_color[0],$comment_color[1],$comment_color[2]); 
    399405          imagefill($d_comment_b,0,0,$fill); 
    400            
     406 
    401407          $s_comment_b = imagecreatefrompng($comment_b); 
    402408          imagealphablending($s_comment_b,true); 
    403409          imagecopy($d_comment_b,$s_comment_b,0,0,0,0,500,7); 
    404            
     410 
    405411          imagepng($d_comment_b,self::imagesPath().'/'.$dest_b); 
    406412          imagedestroy($d_comment_b); 
    407413          imagedestroy($s_comment_b); 
    408414     } 
    409       
     415 
    410416     public static function dropImage($img) 
    411417     { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map