Strolen's World · Legacy archive

Strolen Links in Forum Code

Started by Strolen Oct 14, 2010 3 posts Locked

  1. Strolen Links in Forum Code

    #1

    requires double brackets

    Post.php

    At VERY end

    //START STROLEN CODE PARSING


    function link_title($title)
    {


      //figure out if it just a title link
      // or if they used their own descriptive text
      // or the actual id
        $link = explode("|", stripslashes($title), 2);


        //if there is more than one part to the passed link
        if (count($link) > 1){




          //check and see if they are directing straight to a comment/idea
            $link_2 = explode("#", $link, 2);


            if (count($link_2) > 1){
                //if there is a sub_id portion then make entire link
                if ($link_2 == "idea"){
                $final_url = 'ideas/single/' . $link_2;
                    return "$link";
              }elseif($link_2){
                  $final_url = 'viewing/' . url_title($link_2, 'underscore') . '#' . $link_2;
                    return "$link";
                }
            }elseif ($link == "freetext"){
                $final_url = 'freetext/' . $link;
                    return "$link";
            }else{
                $final_url = 'viewing/' . url_title($link, 'underscore');
                return "$link";
            }
        }else{
          //only title in brackets
            $final_url = 'viewing/' . url_title($link, 'underscore');
            return "$link";
        }
    }


    //grabs the entire string inside the brackets that means autolink
    function parse_links($text)
    {
        $ret = ' ' . $text;


        $text = substr($ret, 1);
        //$text = preg_replace("/\[\[(.*?){2,4}\]\]/es", "link_pic(\"\\1\")", $text);
        $text = preg_replace("/\[\[(.*?)\]\]/es", "link_title(\"\\1\")", $text);


        return $text;
    }


    function url_title($str, $separator = 'dash', $lowercase = FALSE)
      {
          if ($separator == 'dash')
          {
            $search      = '_';
            $replace  = '-';
          }
          else
          {
            $search      = '-';
            $replace  = '_';
          }


          $trans = array(
                      '&\#\d+?;'            => '',
                      '&\S+?;'            => '',
                      '\s+'              => $replace,
                      '[^a-z0-9\-\._]'      => '',
                      $replace.'+'        => $replace,
                      $replace.'$'        => $replace,
                      '^'.$replace        => $replace,
                      '\.+$'              => ''
                    );


          $str = strip_tags($str);


          foreach ($trans as $key => $val)
          {
            $str = preg_replace("#".$key."#i", $val, $str);
          }


          if ($lowercase === TRUE)
          {
            $str = strtolower($str);
          }


          return trim(stripslashes($str));
      }

    Look for the Aeva plugin code. Directly below both paste

    //STROLEN START
                    $_POST['message'] = parse_links($_POST['message']);
                //STROLEN END



    Talon Trails
  2. Re: Strolen Links in Forum Code

    #2
    add to Subs.php

    'citadel' => array(
    'title' => "Main Citadel",
    'href' => 'http://strolen.com',
    'show' => true,
    'sub_buttons' => array(
    ),
    ),
    //then later

    'citadel_profile' => array(
                            'title' => "Citadel Profile",
                            'href' => 'http://strolen.com/author/',
                            'show' => allowedTo(array('profile_extra_any', 'profile_extra_own')),
                            'is_last' => true,
                        )

  3. Re: Strolen Links in Forum Code

    #3
    https://docs.google.com/document/d/1abzHbmk6zfrd7c_bph0nyaIPTMFhCFkSHKSPp8p5rfo/edit

Strolen's World · All categories · Guildhall