• You are not logged in.
  • 1

How to create a hook?

  • Started by Abdulhalim
  • 3 Replies
  • Abdulhalim
  • Member
  • Reputation: 17
  • From: Iran, BND
  • Registered: 28-06-2016
  • Posts: 125

Hello ,

I have an old hook from PunBB and I want to use in Panther , How can I change it and install on Panther please ?

The following code is main XML file part

    <hooks>
        <hook id="vt_start">
            <![CDATA[
                if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php'))
                    require $ext_info['path'].'/lang/'.$forum_user['language'].'.php';
                else
                    require $ext_info['path'].'/lang/English.php';
            ]]>
        </hook>
        <hook id="ps_handle_url_tag_end">
            <![CDATA[
                global $forum_user, $lang_hide_urls_for_guests, $forum_url;

    if ($forum_user['is_guest'])
    {
        if ($bbcode)
        {
            if ($full_url == $link)
                return '[url]'.$link.'[/url]';
            else
                return '[url='.$full_url.']'.$link.'[/url]';
        }
        else
        {
            $register = '<a href="'.forum_link($forum_url['register']).'">'.$lang_hide_urls_for_guests['register'].'</a>';
            $login = '<a href="'.forum_link($forum_url['login']).'">'.$lang_hide_urls_for_guests['login'].'</a>';
            $lang_hide_urls_for_guests['replace url'] = sprintf($lang_hide_urls_for_guests['replace url'], $register, $login);
            return '('.$lang_hide_urls_for_guests['replace url'].')';
        }
    }
    else
            ]]>
        </hook>
    </hooks>

and this is for language file

$lang_hide_urls_for_guests = array(
    'replace url'        => 'Please %2$s or %1$s to see this URL',
    'register'        => 'register',
    'login'        => 'log in'

The secret of staying young is to live honestly, eat slowly, and lie about your age.

I’m working on improving my English

Offline
  • 0
  • Chris98
  • Project Manager
  • Reputation: 51
  • From: England, United Kingdom
  • Registered: 15-04-2015
  • Posts: 512

At the moment there is no way of including language files for extensions, but this is something that needs to be addressed. And unfortunately, there are no hooks in the parser at the moment so this extension won't be possible.

We are trying our best to adjust the extensions system so that this will be possible in the next version as it is very badly in need of an update. We will also try to allow extensions to change the template files which was due for the last release but had to be postponed due to the large number of updates.

Kind regards,
Christopher Marshall
chris [at] get-aura [dot] org

Project Manager

Offline
  • 0
  • Abdulhalim
  • Member
  • Reputation: 17
  • From: Iran, BND
  • Registered: 28-06-2016
  • Posts: 125

Thank you Chris ,
Yes, I think this version needs to an update package .
I found out a bunch of errors , anyway, I like the new version

The secret of staying young is to live honestly, eat slowly, and lie about your age.

I’m working on improving my English

Offline
  • 0
  • Chris98
  • Project Manager
  • Reputation: 51
  • From: England, United Kingdom
  • Registered: 15-04-2015
  • Posts: 512

Good to see you like the new version, and we do apologise that it does fall short of your expectations. I completely agree that it needs another big update, we are working diligently to try and make the next release much better.

Kind regards,
Christopher Marshall
chris [at] get-aura [dot] org

Project Manager

Offline
  • 1

Users in this topic: 0 guests, 0 registered users

  • 1