IPB

Welcome Guest ( Log In | Register )

Developed - Plugin

This topic is about Developed - Plugin, the author, Lewtheo, wrote about: I have made on my localhost a plugin for the Help section, I am just stuck with the last part What do I add to this file to get the HID=(Article number) to work properly? Maybe you could find the fix ... To read more just scroll down

> Report bugs here!

Hey all!
Please report all bugs and errors to our iptracker it will be much more organised!

 
Reply to this topicStart new topic
Developed - Plugin
Kirk
post Sep 2 2007, 06:27 PM
Post #1


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



I have made on my localhost a plugin for the Help section, I am just stuck with the last part

What do I add to this file to get the HID=(Article number) to work properly? Maybe you could find the fix and show me what I've done wrong

The other three parts to it, search/topics and help all work fine - Just I can't view the topics

Here is the code:

CODE
<?php
/**
* interesting fact:
* I was listening to Kanye West while writing this up, mostly replayed "stronger" from his new single.
*
*/

class furlhelp
{
    var $our_rules;
    var $all_rules;
    var $ipsclass;

    /**
    * plugin data very important
    * do not touch!!!
    */

    var $plugin_first_array = array();
    var $plugin_second_array = array();
    var $plugin_key_array = array();


    var $mseo;


    /**
    * place your rules here
    * Touch here !!
    */


    /**
    * the rules....
    */

    var $rule_home = array(
    'help/$',
    'help/',
    'act=Help'
    );
    
    var $rule_view = array(
    'help/topic/$',
    'help/topic/',
    'act=Help&code=show'
    );
    
    var $rule_search = array(
    'search/$',
    'search/',
    'act=Help&code=search'
    );    
    
    var $rule_article = array(
    'help/topic/([0-9]+)/$',
    'help/topic/$id/',
    'act=Help&code=show&id=$matches[1]'
    );
    
    var $cache_calender;



    /**
    * build_rule function
    * @since Sun Aug 05 19:12:24 BST 2007 19:12:24
    */

    function build_rule($all_rules)
    {

        //$all_rules[$this->calendar_rule_show_event[2]] = $this->calendar_rule_show_event[0];
        $all_rules[$this->rule_home[2]] = $this->rule_home[0];
        $all_rules[$this->rule_view[2]] = $this->rule_view[0];
        $all_rules[$this->rule_search[2]] = $this->rule_search[0];        
        $all_rules[$this->rule_article[2]] = $this->rule_article[0];        
        
        return $all_rules;
    }

    /**
    * init function
    * @since Sun Aug 05 12:49:48 BST 2007 12:49:48
    */

    function init()
    {

    }
    /**
    * replacement_info function
    * your work
    * @since Sun Aug 05 12:06:26 BST 2007 12:06:26
    */

    function replacement_info($url_info,$url)
    {
        
        if($url_info['exploded_query']['act'] == 'help' || $url_info['exploded_query']['act'] == 'Help')
        {
            $help_id = $this->mseo->clean_url($this->mseo->current_class->help['help_id']);
            
            if($url_info['exploded_query']['code'] == 'show')
            {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_view[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
            elseif($url_info['exploded_query']['code'] == 'search')
            {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_search[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }    
            elseif($url_info['exploded_query']['code'] == 'show' && $url_info['exploded_query']['id'] == '')
            {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_article[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }                
            else {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_home[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
        }


    }

    /**
    * after_replacement_fix function
    * @since Wed Aug 08 19:53:34 BST 2007 19:53:34
    */

    function after_replacement_fix()
    {

    }
    /**
    * check_url function
    * @since Tue Aug 07 21:08:09 BST 2007 21:08:09
    */

    function check_url()
    {

//        $this->ipsclass->input = $this->ipsclass->parse_incoming_recursively($_POST,$this->ipsclass->input);
        //print_r($this->ipsclass->input);
        //
        if($this->ipsclass->input['_low_act'] == 'help')
        {
                $current_url = 'http://'.$_SERVER['HTTP_HOST'].$this->mseo->current_url;
            
            if($this->ipsclass->input['code'] == 'show')
            {
                eval("\$formatted = \"{$this->rule_view[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }
            elseif($this->ipsclass->input['code'] == 'search')
            {
                eval("\$formatted = \"{$this->rule_search[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }    
            elseif($this->ipsclass->input['code'] == 'show' && ($this->ipsclass->input['hid'] == '$id'))
            {
                eval("\$formatted = \"{$this->rule_article[1]}\";");
                $help_id = $this->ipsclass->input['hid'];
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }                    
            else {
                eval("\$formatted = \"{$this->rule_home[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }
        
            if($formatted != $current_url)
            {

                $this->mseo->r301($formatted);
                
                
            }
        }

            
        
    }

}
?>
Go to the top of the page
 
+Quote Post
Kirk
post Sep 2 2007, 06:28 PM
Post #2


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



Where code=show (Normal file it is CODE=01 and where it is code=search it is normally CODE=02)
Go to the top of the page
 
+Quote Post
Kirk
post Sep 2 2007, 06:47 PM
Post #3


Advanced Member
***

Group: Members
Posts: 86
Joined: 27-June 07
Member No.: 3



Here is another addition (all working) to the furlstats.php file (Modules/Minerva/Plugin -> found here)

This is what the whole file will look like:

CODE
<?php
/**
* interesting fact:
* I was listening to Kanye West while writing this up, mostly replayed "stronger" from his new single.
*
*/

class furlstats
{
    var $our_rules;
    var $all_rules;
    var $ipsclass;

    /**
    * plugin data very important
    * do not touch!!!
    */

    var $plugin_first_array = array();
    var $plugin_second_array = array();
    var $plugin_key_array = array();


    var $mseo;


    /**
    * place your rules here
    * Touch here !!
    */


    /**
    * the rules....
    */

    var $rule_leaders = array(
    'stats/leaders/$',
    'stats/leaders/',
    'act=stats&CODE=leaders'
    );
    
    var $rule_top = array(
    'stats/top-posters/$',
    'stats/top-posters/',
    'act=Members&max_results=20&sort_key=posts&sort_order=desc&filter=ALL'
    );
    
    var $rule_top20 = array(
    'stats/todays-top-20-posters/$',
    'stats/todays-top-20-posters/',
    'act=stats'
    );
    
    var $rule_members = array(
    'Members/$',
    'Members/',
    'act=Members'
    );
    
    var $cache_calendar;



    /**
    * build_rule function
    * @since Sun Aug 05 19:12:24 BST 2007 19:12:24
    */

    function build_rule($all_rules)
    {

        //$all_rules[$this->calendar_rule_show_event[2]] = $this->calendar_rule_show_event[0];
        $all_rules[$this->rule_top20[2]] = $this->rule_top20[0];
        $all_rules[$this->rule_top[2]] = $this->rule_top[0];
        $all_rules[$this->rule_members[2]] = $this->rule_members[0];
        $all_rules[$this->rule_leaders[2]] = $this->rule_leaders[0];
        


        return $all_rules;
    }

    /**
    * init function
    * @since Sun Aug 05 12:49:48 BST 2007 12:49:48
    */

    function init()
    {

    }
    /**
    * replacement_info function
    * your work
    * @since Sun Aug 05 12:06:26 BST 2007 12:06:26
    */

    function replacement_info($url_info,$url)
    {
        
        if($url_info['exploded_query']['act'] == 'stats' || $url_info['exploded_query']['act'] == 'Stats')
        {
            
            if($url_info['exploded_query']['CODE'] == 'leaders')
            {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_leaders[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
            else {
                $importance = 10;
                eval("\$formatted = \"{$this->rule_top20[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
        }
        
        if($url_info['exploded_query']['act'] == 'members' || $url_info['exploded_query']['act'] == 'Members')
        {
            if($url_info['exploded_query']['max_results'] == '20')
            {
                $importance = 9;
                eval("\$formatted = \"{$this->rule_top[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
            else {
                $importance = 10;
                eval("\$formatted = \"{$this->rule_members[1]}\";");
                $this->plugin_first_array[$importance][] = $url;
                $this->plugin_second_array[$importance][] = $this->ipsclass->vars['board_url'].'/'.$formatted;
                $this->plugin_key_array[$importance] = 1;
                return  array($first_array,$second_array,$importance);
            }
        }


    }

    /**
    * after_replacement_fix function
    * @since Wed Aug 08 19:53:34 BST 2007 19:53:34
    */

    function after_replacement_fix()
    {

    }
    /**
    * check_url function
    * @since Tue Aug 07 21:08:09 BST 2007 21:08:09
    */

    function check_url()
    {

//        $this->ipsclass->input = $this->ipsclass->parse_incoming_recursively($_POST,$this->ipsclass->input);
        //print_r($this->ipsclass->input);
        //
        if($this->ipsclass->input['_low_act'] == 'stats')
        {
                $current_url = 'http://'.$_SERVER['HTTP_HOST'].$this->mseo->current_url;
            
            if($this->ipsclass->input['CODE'] =='leaders')
            {
                eval("\$formatted = \"{$this->rule_leaders[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }
            else {
                eval("\$formatted = \"{$this->rule_top20[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }
            
            if($formatted != $current_url)
            {

                $this->mseo->r301($formatted);
                
                
            }
        
        }
        
        if($this->ipsclass->input['_low_act'] == 'Members')
        {
        
            if($this->ipsclass->input['max_results'] =='20')
            {
                eval("\$formatted = \"{$this->rule_top[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }
            else {
                eval("\$formatted = \"{$this->rule_members[1]}\";");
                $formatted =  $this->ipsclass->vars['board_url'].'/'.$formatted;
            }

        }
        
    }

}
?>


Just simply edit the first top part to what you want the links to be smile.gif
Go to the top of the page
 
+Quote Post
bramburn
post Sep 3 2007, 09:21 AM
Post #4


Administrator
***

Group: Root Admin
Posts: 905
Joined: 25-June 07
From: London
Member No.: 1



thanks for the plugin, i will look at it when i get time.


--------------------
Remember to please use the bug tracker for all bugs and errors, it is more organised that way.
Support in french and english
If I reply in French please excuse my spelling & grammar, i haven't written in french for a long time.
DO NOT PM ME TO ASK ME TO GO ON MSN, post the query on the support forums!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
Tags
No Tag inserted yet


 



RSS Lo-Fi Version | Sitemap  | SEO by MinervaSEO © Icelabz.net Time is now: 8th January 2009 - 01:42 PM