XPressME Integration Kit

Trac

Changeset 741


Ignore:
Timestamp:
May 9, 2011, 9:10:31 PM (13 years ago)
Author:
toemon
Message:

XOOPS/XCL/ImpressCMSでモジュールアイコンを変更するようにした。

Location:
branches/Ver3.0/xpressme_integration_kit
Files:
6 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Ver3.0/xpressme_integration_kit/module_icon.php

    r232 r741  
    11<?php 
     2$xoopsOption['nocommon'] = true ; 
     3require '../../mainfile.php' ; 
    24$mydirpath = dirname(__FILE__); 
    3 $mydirname = basename($mydirpath); 
     5$mydirname = basename(dirname(__FILE__)); 
    46$icon_cache_limit = 3600 ; // default 3600sec == 1hour 
    57 
     
    1012header("Content-type: image/png"); 
    1113 
    12 $icon_fullpath = $mydirpath.'/module_icon.png' ; 
     14// file name 
     15if( ! empty( $_GET['file'] ) ) { 
     16        $file_base = preg_replace( '/[^0-9a-z_]/' , '' , $_GET['file'] ) ; 
     17} else { 
     18        $file_base = 'module_icon' ; 
     19} 
    1320 
    14 if(function_exists( 'imagecreatefrompng' ) && function_exists( 'imagecolorallocate' ) && function_exists( 'imagestring' ) && function_exists( 'imagepng' ) ) { 
     21// branches by cores 
     22if( defined( 'ICMS_TRUST_PATH' ) ) { 
     23        $draw_dirname = false ; 
     24        $file_base .= '_icms' ; 
     25} else if( defined( 'XOOPS_CUBE_LEGACY' ) ) { 
     26        $draw_dirname = true ; 
     27        $file_base .= '_xcl' ; 
     28        $title = '('.$mydirname.')'; 
     29        $px = ( 112 - 6 * strlen( $title ) ) ; 
     30        $py = 14; 
     31        $font = 3; 
     32 
     33} else { 
     34        $draw_dirname = true ; 
     35        $title = $mydirname; 
     36        $px = ( 92 - 6 * strlen( $title ) ) / 2 ; 
     37        $py = 36; 
     38        $font = 3; 
     39} 
     40 
     41// icon files must be PNG 
     42$file = $file_base . '.png' ; 
     43 
     44// custom icon 
     45if( file_exists( $mydirpath.'/'.$file ) ) { 
     46        $draw_dirname = false ; 
     47        $icon_fullpath = $mydirpath.'/module_icon.png' ; 
     48} else { 
     49        $icon_fullpath = dirname(__FILE__).'/images/'.$file ; 
     50} 
     51 
     52if( $draw_dirname && function_exists( 'imagecreatefrompng' ) && function_exists( 'imagecolorallocate' ) && function_exists( 'imagestring' ) && function_exists( 'imagepng' ) ) { 
    1553 
    1654        $im = imagecreatefrompng( $icon_fullpath ) ; 
    1755 
    1856        $color = imagecolorallocate( $im , 0 , 0 , 0 ) ; // black 
    19         $px = ( 92 - 6 * strlen( $mydirname ) ) / 2 ; 
    20         imagestring( $im , 3 , $px , 34 , $mydirname , $color ) ; 
     57        imagestring( $im , $font , $px , $py , $title , $color ) ; 
    2158        imagepng( $im ) ; 
    2259        imagedestroy( $im ) ; 
  • branches/Ver3.0/xpressme_integration_kit/xoops_version.php

    r725 r741  
    8888$modversion['license'] = "GPL see LICENSE"; 
    8989$modversion['official'] = 0 ; 
    90 $modversion['image'] =  'module_icon.php' ; 
     90$modversion['image'] = file_exists( $mydirpath.'/module_icon.png' ) ? 'module_icon.png' : 'module_icon.php' ; 
     91$modversion['iconbig'] = 'module_icon.php?file=iconbig' ; 
     92$modversion['iconsmall'] = 'module_icon.php?file=iconsmall' ; 
    9193$modversion['dirname'] = $mydirname; 
    9294 
Note: See TracChangeset for help on using the changeset viewer.