11
irmtfan
Re: Newbb buttons
  • 2012/7/27 3:05

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


OK I review 3.08 and it is totally different from 4.3 and it is rather hard to implement text links in 3.08.
please do the below. It is just a try but i think it works.

1- In newbb/include/functions.php add to newbb_displayImage function like below:
change this:
function newbb_displayImage($image$alt ""$width 0$height =0$style ="margin: 0px;"$sizeMeth='scale')
{
    global 
$xoopsModuleConfig$forumImage;
    static 
$image_type;

    
$user_agent_is_IE5 newbb_isIE5();
    if(!isset(
$image_type)) $image_type = ($xoopsModuleConfig['image_type'] == 'auto')?(($user_agent_is_IE5)?'gif':'png'):$xoopsModuleConfig['image_type'];
    
$image .= '.'.$image_type;
    
$imageuri=preg_replace("/^".preg_quote(XOOPS_URL,"/")."/",XOOPS_ROOT_PATH,$image);
    if(!
preg_match("/^".preg_quote(XOOPS_ROOT_PATH,"/")."/",$imageuri)){
        
$imageuri XOOPS_ROOT_PATH."/".$image;
    }
    if(
file_exists($imageuri)){
        
$size=@getimagesize($imageuri);
        if(
is_array($size)){
            
$width=$size[0];
            
$height=$size[1];
        }
    }else{
        
$image=$forumImage['blank'].'.gif';
    }
    
$width .='px';
    
$height .='px';

    
$img_style "width: $width; height:$height$style";
    
$image_url "<img src="".$image."" style="".$img_style."" alt="".$alt."" align="middle" />";

    return 
$image_url;
}

with this:
function newbb_displayImage($image$alt ""$width 0$height =0$style ="margin: 0px;"$sizeMeth='scale')
{
    global 
$xoopsModuleConfig$forumImage;
// START hacked by irmtfan
if (!empty($xoopsModuleConfig['display_text_links']) && !empty($alt)) {
return 
$alt;
}
// END hacked by irmtfan
    
static $image_type;

    
$user_agent_is_IE5 newbb_isIE5();
    if(!isset(
$image_type)) $image_type = ($xoopsModuleConfig['image_type'] == 'auto')?(($user_agent_is_IE5)?'gif':'png'):$xoopsModuleConfig['image_type'];
    
$image .= '.'.$image_type;
    
$imageuri=preg_replace("/^".preg_quote(XOOPS_URL,"/")."/",XOOPS_ROOT_PATH,$image);
    if(!
preg_match("/^".preg_quote(XOOPS_ROOT_PATH,"/")."/",$imageuri)){
        
$imageuri XOOPS_ROOT_PATH."/".$image;
    }
    if(
file_exists($imageuri)){
        
$size=@getimagesize($imageuri);
        if(
is_array($size)){
            
$width=$size[0];
            
$height=$size[1];
        }
    }else{
        
$image=$forumImage['blank'].'.gif';
    }
    
$width .='px';
    
$height .='px';

    
$img_style "width: $width; height:$height$style";
    
$image_url "<img src="".$image."" style="".$img_style."" alt="".$alt."" align="middle" />";

    return 
$image_url;
}


2- then you can define the configuration in newbb/include/plugin.php
// Display text links instead of image buttons for edit, reply, .... set true or false
$customConfig["display_text_links"] = true;


deka87:
I hope the above will work for 3.08. please inform us.
Maybe some buttons still show up. you just need to define an ALT key for them in source files.

12
irmtfan
Re: Newbb buttons
  • 2012/7/28 11:01

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I test this hack in 3.08 and it works.
but i recommend to upgrade to 4.3 because of the far better performances.

13
deka87
Re: Newbb buttons
  • 2012/7/28 15:45

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Thanks, irmtfan! Workes like a charm. I surely plan to upgrade, but a bit later.

14
irmtfan
Re: Newbb buttons
  • 2012/9/1 9:03

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


deka87 and flipse:
If you follow the newbb 4.3 topic i improve this feature in newbb and add css3 buttons.
It works for me but it would be good to have more testers.
If core team add the full customization image feature to the 2.6.0 it would be great to add this feature (css3 buttons) too.

You can download the latest version here:
http://www.jadoogaran.org/test255/modules/newbb43_rev10109_irmtfan_2012_09_01.zip

or SVN rev.10138:
http://xoops.svn.sourceforge.net/viewvc/xoops/XoopsModules/newbb/branches/irmtfan/newbb/

the look is like this:

Resized Image

Also it is good if some developers take a look in newbb43/class/icon.php to see codes and the ways to implementat it in the core.

It means in the 2.6.0 we cannot have any <img> tag in the templates.
All modules should use xoopsdisplayImage($image,$alt) smarty

Login

Who's Online

165 user(s) are online (107 user(s) are browsing Support Forums)


Members: 0


Guests: 165


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits