public function __construct($host, $user, $pass) { $body = "_[l[Shacker Birthdays:]l]_ \n"; //TODO: refactor out passwords/mysql connection details? $connection = mysql_connect($host, $user, $pass); $numRows = 0; $averageAge = 0; if ($connection !== False) { // TODO: refactor this out too mysql_select_db("shackdb"); // fetch birthdays first on same connection $query = "select avg(year) as avg_year from (SELECT substring(dob,1,4) as year from birthdays having year > 1901 and year < 2005) as tb1;"; $result = mysql_query($query); $averageAge = mysql_fetch_array($result, MYSQL_ASSOC); $averageAge = date("Y") - floatval($averageAge["avg_year"]); $query = "SELECT * FROM birthdays where dob like '%" . date('m-d') . "'"; $result = mysql_query($query); $numRows = mysql_numrows($result); } if ($numRows > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $body .= "y{" . $row["username"] . "}y" . self::agestring($row["dob"], $row["username"]) . "\n"; } $body .= "\n"; $body .= "And as always, Happy Birthday, Shackers from the y{the man with the briefcase}y!!\n"; } else { $body .= "\n"; $body .= "No birthdays today!\n"; } $body .= "\n"; $body .= "s[The average shackage is now " . number_format($averageAge, 2, '.', '') . "!]s\n"; $body .= "s[Want to add your birthday? http://shack.asktherelic.com/birthday.php]s"; parent::__construct($body); }
/** * Attachment constructor. * * @param WP_Post $post */ protected function __construct($post) { parent::__construct($post); // Set standard content $this->description =& $this->content; $this->caption =& $this->excerpt; }
function initialize($arr) { $this->images = explode(";", $arr['images']); $this->text = $arr['text']; parent::__construct($arr); return $this; }
public function __construct() { $body = "_[l[Shacker Birthdays:]l]_ \n"; //TODO: refactor out passwords/mysql connection details? $connection = mysql_connect("localhost", "shack", "shack"); $numRows = 0; $averageAge = 0; if ($connection !== False) { mysql_select_db("shack"); // fetch birthdays first on same connection $query = "select avg(year) as avg_year from (SELECT substring(dob,1,4) as year from birthdays having year > 1901 and year < 2001) as tb1;"; $result = mysql_query($query); $averageAge = mysql_fetch_array($result, MYSQL_ASSOC); $averageAge = date("Y") - floatval($averageAge["avg_year"]); $query = "SELECT * FROM birthdays where dob like '%" . date('m-d') . "'"; $result = mysql_query($query); $numRows = mysql_numrows($result); } if ($numRows > 0) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $body .= "y{" . $row["username"] . "}y" . self::agestring($row["dob"], $row["username"]) . "\n"; } $body .= "\nThe average shackage is now " . number_format($averageAge, 2, '.', '') . "!"; $body .= "\nCongrats folks!\n"; } else { $body .= "No birthdays today!\n"; } $body .= "\ns[Want to add your birthday? http://www.asktherelic.com/shack/birthday.php]s"; parent::__construct($body); }
/** * Creates a new PostWarningObject object. * * @see Post::__construct() */ public function __construct($postID, $row = null) { if ($postID !== null) { $sql = "SELECT\t\tpost.*, thread.topic, thread.boardID\n\t\t\t\tFROM \t\twbb" . WBB_N . "_post post\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\tWHERE \t\tpostID = " . $postID; $row = WCF::getDB()->getFirstRow($sql); } parent::__construct(null, $row); }
public function __construct() { $url = 'http://www.shackmeets.com/api/shackmeetspost'; $shackmeetsText = parent::curlData($url); $body = "_[p[Upcoming Shackmeets:]p]_ \n\n"; $body .= strlen($shackmeetsText) > 0 ? $shackmeetsText : 'None. :('; parent::__construct($body); }
public function __construct() { $url = 'http://shackbattl.es/external/ShackBattlesPost.aspx'; $shackBattlesText = parent::curlData($url); $body = "_[e[Upcoming ShackBattles:]e]_ \n\n"; $body .= strlen($shackBattlesText) > 0 ? $shackBattlesText : 'None. :('; parent::__construct($body); }
public function __construct() { $yesterday = date('m/d/Y', time() - 86400); $url = "http://www.lmnopc.com/greasemonkey/shacklol/api.php?format=php&date={$yesterday}&tag=lol"; $result = parent::curlData($url); $lol = unserialize($result); $body = "_[n[This Old LOL Pile:]n]_ \nThe top 5 y{LOL'D}y posts from yesterday. Don't miss the funny, if there was any to begin with! \n\n"; //multiplier bonus section, kinda awkward $single = array(); $double = array(); for ($i = 0; $i < count($lol); $i++) { $author = $lol[$i]["author"]; array_push($single, $author); } for ($i = 0; $i < count($single); $i++) { if (count(array_keys($single, $single[$i])) > 1) { array_push($double, $single[$i]); } } $double = array_unique($double); foreach ($double as $key) { $body .= "*[Multiloller bonus for y{{$key}}y!!!!]*\n\n"; } //set authors for awards parent::setAuthors($single); //$lol has methods body, author, tag_count, id for ($i = 0; $i < count($lol); $i++) { //cleanup text for findtag $bad = array("<div class=\"postbody\">", "<br />", "<br/>"); $good = array("", "\n", "\n"); $post = str_ireplace($bad, $good, $lol[$i]["body"]); $post = html_entity_decode($post); $post = parent::findtag($post); $star = ""; //If the first post, give it unicode stars if ($i === 0) { $star = "q[q[" . html_entity_decode("★", ENT_NOQUOTES, 'UTF-8') . "]q]q"; } $body .= "_[{$star} By: y{{$lol[$i]["author"]}}y with [{$lol[$i]["tag_count"]} lolz] {$star}]_ s[http://www.shacknews.com/laryn.x?id={$lol[$i]["id"]}]s \n"; $post_id = $lol[$i]["id"]; //If the post is tagged NWS or has nws literally in it, notify the public if (preg_match('/nws/i', $post) || parent::isNWS($post_id)) { $body .= "r{!!! (Possible NWS Post detected!) !!!}r \n"; } if (!parent::isNuked($post_id)) { if (strlen($post) > 700) { $body .= substr($post, 0, 700) . '...'; } else { $body .= $post; } } else { $body .= Post::$NUKED_TEXT; } $body .= "\n\n"; } $body .= "s[Want to LOL too? http://www.lmnopc.com/greasemonkey/shacklol/]s\n"; parent::__construct($body); }
public function __construct($val = false) { parent::__construct($val); $this->id = $val['id']; $this->post_key = $val['post_key']; $this->filter = $val['filter']; $this->standard_resolution_url = $val['standard_resolution_url']; $this->low_resolution_url = $val['low_resolution_url']; $this->thumbnail_url = $val['thumbnail_url']; }
public function __construct($val = false) { parent::__construct($val); $this->id = $val['id']; $this->post_key = $val['post_key']; $this->filter = $val['filter']; $this->standard_resolution_url = $val['standard_resolution_url']; $this->low_resolution_url = $val['low_resolution_url']; $this->thumbnail_url = $val['thumbnail_url']; $this->is_short_video = PDODAO::convertDBToBool($val['is_short_video']); }
/** * @Override */ function __construct($data) { parent::__construct($data); // DEBUG if (isset($data["content"])) { if (!is_array($data["content"])) { $data["content"] = array($data["content"]); } $this->setContent($data["content"]); } else { $this->setContent(array()); } // END DEBUG require_once "post/PostCommon.php"; $this->setType(PostType::COLLECTION); }
public function __construct() { $post; $good = 0; $randId = mt_rand(1, 18514293); $randUrl = "http://www.shackchatty.com/thread/{$randId}.xml"; $dom = file_get_dom($randUrl); foreach ($dom->find('comment') as $element) { if ($element->reply_count >= $good) { $good = $element->reply_count; $post = $element; } } $shackUrl = "http://www.shacknews.com/laryn.x?id=" . $post->id; $body = "_[g{Random Post:}g]_ \n"; $body .= "_[By: y{" . trim($post->author) . "}y s[{$shackUrl}]s]_ \n"; $body .= self::cleanText($post->children(0)->innertext) . "\n"; parent::__construct($body); }
public function __construct() { $yesterday = date('m/d/Y', time() - 86400); $url = "http://www.lmnopc.com/greasemonkey/shacklol/api.php?format=php&date={$yesterday}&tag=tag"; $result = parent::curlData($url); $tag = unserialize($result); //set authors for awards $authors = array(); for ($i = 0; $i < 3; $i++) { $author = $tag[$i]["author"]; array_push($authors, $author); } parent::setAuthors($authors); $body = "_[g{The Top Tags:}g]_ \nThis other thing that no one really uses!!!\n\n"; for ($i = 0; $i < 3; $i++) { //cleanup text for findtag $bad = array("<div class=\"postbody\">", "<br />", "<br/>"); $good = array("", "\n", "\n"); $post = str_ireplace($bad, $good, $tag[$i]["body"]); $post = html_entity_decode($post); $post = parent::findtag($post); $body .= "_[By: y{{$tag[$i]["author"]}}y with [{$tag[$i]["tag_count"]} tagz]]_ s[http://www.shacknews.com/laryn.x?id={$tag[$i]["id"]}]s \n"; $post_id = $tag[$i]["id"]; //If the post is tagged NWS or has nws literally in it, notify the public if (preg_match('/nws/i', $post) || parent::isNWS($post_id)) { $body .= "r{!!! (Possible NWS Post detected!) !!!}r \n"; } if (!parent::isNuked($post_id)) { if (strlen($post) > 700) { $body .= substr($post, 0, 700) . '...'; } else { $body .= $post; } } else { $body .= Post::$NUKED_TEXT; } $body .= "\n\n"; } $body .= "s[Want to tag too? http://www.lmnopc.com/greasemonkey/shacklol/]s\n"; parent::__construct($body); }
public function __construct() { $yesterday = date('m/d/Y', time() - 86400); $url = "http://www.lmnopc.com/greasemonkey/shacklol/api.php?format=php&date={$yesterday}&tag=inf"; $result = parent::curlData($url); $inf = unserialize($result); //set authors for awards $author = array($inf[0]["author"]); parent::setAuthors($author); //$lol has methods body, author, tag_count, id #$body = "_[g{The Top INF:}g]_ \nThe b{smartest}b thing that was said yesterday. Get yourself to school. \n\n"; $body = "_[b{The Top INF:}b]_ \n\"The thing that was posted yesterday that compelled the most amount of people to hit the inf button.\"\n\n"; for ($i = 0; $i < 1; $i++) { //cleanup text for findtag $bad = array("<div class=\"postbody\">", "<br />", "<br/>"); $good = array("", "\n", "\n"); $post = str_ireplace($bad, $good, $inf[$i]["body"]); $post = html_entity_decode($post); $post = parent::findtag($post); $body .= "_[By: y{{$inf[$i]["author"]}}y with [{$inf[$i]["tag_count"]} infz]]_ s[http://www.shacknews.com/laryn.x?id={$inf[$i]["id"]}]s \n"; $post_id = $inf[$i]["id"]; //If the post is tagged NWS or has nws literally in it, notify the public if (preg_match('/nws/i', $post) || parent::isNWS($post_id)) { $body .= "r{!!! (Possible NWS Post detected!) !!!}r \n"; } if (!parent::isNuked($post_id)) { if (strlen($post) > 700) { $body .= substr($post, 0, 700) . '...'; } else { $body .= $post; } } else { $body .= Post::$NUKED_TEXT; } $body .= "\n\n"; } $body .= "s[Want to INF too? http://www.lmnopc.com/greasemonkey/shacklol/]s\n"; parent::__construct($body); }
public function __construct() { $yesterday = date('m/d/Y', time() - 86400); $url = "http://www.lmnopc.com/greasemonkey/shacklol/api.php?format=php&date={$yesterday}&tag=unf"; $result = parent::curlData($url); $unf = unserialize($result); //set authors for awards $author = array($unf[0]["author"]); parent::setAuthors($author); $body = "_[r{The Top Unfs:}r]_ \nThis is all probably r{NWS}r, seriously, look before you click!\n\n"; $body .= "Nothing to see here, move along, citizen.\n\n"; //for($i=0; $i < 1; $i++) { // //cleanup text for findtag // $bad = array("<div class=\"postbody\">" , "<br />", "<br/>"); // $good = array("", "\n", "\n"); // $post = str_ireplace($bad, $good, $unf[$i]["body"]); // $post = html_entity_decode($post); // $post = parent::findtag($post); // $body .= "_[By: y{{$unf[$i]["author"]}}y with [{$unf[$i]["tag_count"]} unfz]]_ s[http://www.shacknews.com/laryn.x?id={$unf[$i]["id"]}]s \n"; // $post_id = $unf[$i]["id"]; // //If the post is tagged NWS or has nws literally in it, notify the public // if(preg_match('/nws/i', $post) || parent::isNWS($post_id)) { // $body .= "r{!!! (Possible NWS Post detected!) !!!}r \n"; // } // if(!parent::isNuked($post_id)) { // if (strlen($post) > 700) { // $body .= substr($post, 0, 700) . '...'; // } else { // $body .= $post; // } // } else { // $body .= Post::$NUKED_TEXT; // } // $body .= "\n\n"; //} //$body .= "s[Want to unf too? http://www.lmnopc.com/greasemonkey/shacklol/]s\n"; parent::__construct($body); }
public function __construct($posts) { $body = "_[l[Daily Awards:]l]_ \n\n"; //build a (name => tags) dictionary for all posts $winners = array(); foreach ($posts as $p) { foreach (array_unique($p->getAuthors()) as $name) { if (!array_key_exists($name, $winners)) { $winners[$name] = array(); } array_push($winners[$name], $p->tag); } } //check for a winner; someone with multiple tags foreach ($winners as $name => $tags) { if (count($tags) > 1) { $body .= $name . " is a " . implode('', $tags) . " winner!\n"; $awardWinner = True; } } $body .= "\n"; parent::__construct($body); }
public function __construct(\Frame\Core\Context $context) { parent::__construct($context); $this->post = json_decode(file_get_contents('php://input'), true); }
public function PostPHP($filename) { parent::__construct($filename); }
/** * @Override */ function __construct($data) { parent::__construct($data); $this->setType(Post::VIDEOREP); }
public function __construct($row = false) { if ($row) { parent::__construct($row); $this->id = $row['id']; $this->post_key = $row['post_key']; $this->description = $row['description']; $this->likes = $row['likes']; $this->dislikes = $row['dislikes']; $this->views = $row['views']; $this->minutes_watched = $row['minutes_watched']; $this->average_view_duration = $row['average_view_duration']; $this->average_view_percentage = $row['average_view_percentage']; $this->favorites_added = $row['favorites_added']; $this->favorites_removed = $row['favorites_removed']; $this->shares = $row['shares']; $this->subscribers_gained = $row['subscribers_gained']; $this->subscribers_lost = $row['subscribers_lost']; } }
/** * @Override */ function __construct($data) { parent::__construct($data); $this->setType(Post::NEWS); }
function __construct($redirectUrl) { $this->redirectUrl = $redirectUrl; parent::__construct(false); }
/** * @param string $content * @param AuthorInterface $title * @param AuthorInterface $author * @param \DateTimeInterface $postedAt */ public function __construct($content, $title, AuthorInterface $author, \DateTimeInterface $postedAt = null) { $this->content = $content; parent::__construct($title, $author, $postedAt); }
/** * @Override */ function __construct($data) { parent::__construct($data); require_once "post/PostCommon.php"; $this->setType(PostType::NEWS); }
/** * Creates a new ViewablePost object. * * @param integer $postID * @param array $row resultset with post data form database * @param Thread $thread thread of this post */ public function __construct($postID, $row = null, $thread = null) { parent::__construct($postID, $row); $this->thread = $thread; }
function initialize($arr) { $this->text = $arr['text']; parent::__construct($arr); return $this; }
function __construct($url) { parent::__construct($url, 'attachment'); }
/** * @Override */ function __construct($data) { parent::__construct($data); $this->setType(Post::COLLECTION); }