Inheritance: extends Base
Example #1
0
 public function __construct($config)
 {
     $this->setURLTemplate('http://www.reddit.com/user/' . $config['username'] . '/liked/');
     $this->setURL(sprintf('http://www.reddit.com/user/%s/liked.json?feed=%s&user=%s', $config['username'], $config['key'], $config['username']));
     $this->setItemTemplate('<li><a class="story" href="{{{url}}}">{{{title}}} <span>({{{domain}}})</span></a> <a href="{{{base}}}/r/{{{subreddit}}}/" class="subreddit">{{{subreddit}}} ∞</a> <a href="{{{link}}}" class="score">{{{score}}} ⇧</a> <a href="{{{link}}}" class="comments">{{{comments}}} ✎</a></li>' . "\n");
     parent::__construct($config);
 }
Example #2
0
<?php

include_once "services.php";
$page = !empty($_GET["page"]) ? $_GET["page"] : "";
$reddit = new Reddit();
$soundcloud = new SoundCloud();
$youtube = new Youtube();
// $beatport = new Beatport();
$S = new Services();
if ($page == "filters") {
    foreach ($S::getServices() as $k => $v) {
        echo "<input type=\"checkbox\" name=\"tracks-services\" value=\"{$k}\" id=\"{$k}\" /><label for=\"{$k}\">{$k}</label><br />";
    }
    echo <<<EOT
<script type="text/javascript">
\$("#filters-tracks").siblings().hide().end().show().find("input").button({ icons: { primary: "ui-icon-check" } }).click(function(){
\tif( this.checked ) {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-close" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).hide();
\t}
\telse {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-check" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).show();
\t}
});
</script>
EOT;
} else {
    if ($page == "search") {
        header("Content-type: application/json");
        $q = urldecode($_GET["q"]);
define('VERSION', '2.0.0');
// Versioning should following the semantic versioning guidelines outlined here: http://semver.org/
define('USER_AGENT', 'User-Agent: locationbot/' . VERSION . ' by ianp');
require_once 'reddit.php';
// Methods for Authentication, Getting Posts, and Posting
require_once 'data.php';
// Simple factory for getting a database connection.
require_once 'credentials.php';
// Credentials for the database and user.
require_once 'action.php';
// Action to take when we post a reply.
require_once 'mention_action.php';
// Action to take when our name is mentioned.
// Start doing "bot" stuff.
$data_connection = Data::GetConnection();
$reddit = new Reddit(REDDIT_USERNAME, REDDIT_PASSWORD);
$reddit->Login();
// Get collections of subreddits that we should be monitoring.
$query = "SELECT rec_id, name FROM Subreddit WHERE active=1";
$result = $data_connection->query($query);
$subreddit = array();
while ($row = $result->fetch_assoc()) {
    $subreddit[$row['name']] = $row['rec_id'];
}
// Get list of locations that we should look for.
$query = "SELECT name FROM Location";
$result = $data_connection->query($query);
$location = array();
while ($row = $result->fetch_assoc()) {
    array_push($location, "\\b({$row['name']})\\b");
}
Example #4
0
<?php

include_once "services.php";
$page = !empty($_GET["page"]) ? $_GET["page"] : "";
$reddit = new Reddit();
// $beatport = new Beatport();
$S = new Services();
if ($page == "filters") {
    foreach ($S::getServices() as $k => $v) {
        echo "<input type=\"checkbox\" name=\"tracks-services\" value=\"{$k}\" id=\"{$k}\" /><label for=\"{$k}\">{$k}</label><br />";
    }
    echo <<<EOT
<script type="text/javascript">
\$("#filters-tracks").siblings().hide().end().show().find("input").button({ icons: { primary: "ui-icon-check" } }).click(function(){
\tif( this.checked ) {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-close" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).hide();
\t}
\telse {
\t\t\$(this).button("option", "icons", { primary: "ui-icon-check" });
\t\t\$("#loadhere").children("#tracks").find(".item."+\$(this).val().toLowerCase()).show();
\t}
});
</script>
EOT;
} else {
    if ($page == "search") {
        header("Content-type: application/json");
        $q = urldecode($_GET["q"]);
        $pagenumber = !empty($_GET["pagenumber"]) ? $_GET["pagenumber"] : 0;
        $n = $pagenumber * LIMIT;