• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ Contributions (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Grouphug.us confessions

Post a bug fix, a new feature, a theme ...

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby kriko » Mon Jun 01, 2009 1:47 pm

Hello!

This is a great thing to spice up your channels - grouphug.us confessions.

It will display a random confession everytime a user uses "/confess" command.

Create confess.class.php inside src/commands with following code:
Code: Select all
<?php

require_once(dirname(__FILE__)."/../pfccommand.class.php");
require(dirname(__FILE__).'/../htmlParser/simple_html_dom.php');

class pfcCommand_confess extends pfcCommand
{
  var $usage = "/confess";

  function run(&$xml_reponse, $p)
  {
    $clientid    = $p["clientid"];
    $param       = $p["param"];
    $sender      = $p["sender"];
    $recipient   = $p["recipient"];
    $recipientid = $p["recipientid"];
   
    $c  =& pfcGlobalConfig::Instance();
    $u  =& pfcUserConfig::Instance();
    $ct =& pfcContainer::Instance();

      $contents = file_get_contents('http://confessions.grouphug.us/random');
      $html = new simple_html_dom();
      $html->load($contents);
      $div = $html->find('[class*=node-confession]', 0);

      $inner = $div->innertext;
      $html->load($inner);
      $p = $html->find('[class*=content]', 0);

      $text = $p->plaintext;
      $message = $text;
      $ct->write($recipient, "*me*", $this->name, $u->getNickname().": ".$message);
  }
}

?>

Download simple_html_dom.php from:
http://sourceforge.net/projects/simplehtmldom/

and place it into (you can change this, just remember to update confess class):
src/htmlParser

Enjoy!
kriko
Member
 
Posts: 30
Joined: Sun May 31, 2009 8:07 pm
Top

Postby chap » Thu Jun 04, 2009 2:00 am

Installed and worked like a charm. Raised a few eyebrows too!

Thanks, kriko!

Chap
Last edited by chap on Thu Jun 04, 2009 2:00 am, edited 1 time in total.
chap
New member
 
Posts: 8
Joined: Mon May 25, 2009 4:20 am
Top

Postby unveiled » Thu Nov 12, 2009 3:51 am

This is great, I can make my own command now from FMyLife.com and stuff. Thanks for the contribution.
unveiled
New member
 
Posts: 2
Joined: Wed Nov 11, 2009 2:52 am
Top


Post a reply
3 posts • Page 1 of 1

Return to Contributions (v1.x)

Who is online

Users browsing this forum: No registered users and 12 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub