本文整理汇总了PHP中Post::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::__construct方法的具体用法?PHP Post::__construct怎么用?PHP Post::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2: __construct
/**
* Attachment constructor.
*
* @param WP_Post $post
*/
protected function __construct($post)
{
parent::__construct($post);
// Set standard content
$this->description =& $this->content;
$this->caption =& $this->excerpt;
}
示例3: initialize
function initialize($arr)
{
$this->images = explode(";", $arr['images']);
$this->text = $arr['text'];
parent::__construct($arr);
return $this;
}
示例4: __construct
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);
}
示例5: __construct
/**
* 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);
}
示例6: __construct
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);
}
示例7: __construct
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);
}
示例8: __construct
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);
}
示例9: __construct
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'];
}
示例10: __construct
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']);
}
示例11: array
/**
* @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);
}
示例12: __construct
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);
}
示例13: __construct
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);
}
示例14: __construct
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);
}
示例15: __construct
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);
}