本文整理匯總了PHP中Block::addBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP Block::addBlock方法的具體用法?PHP Block::addBlock怎麽用?PHP Block::addBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Block
的用法示例。
在下文中一共展示了Block::addBlock方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: parseBlock
protected function parseBlock($lines, $current = 0)
{
//printf("parseBlock: line %s\n", $current);
$rootBlock = new Block('[root]');
for ($i = $current, $count = count($lines); $i < $count; $i++) {
$line = trim($lines[$i]);
$line = $this->stripComment($line);
if ($line === '' || $line[0] === '#') {
//printf("parseBlock: skip line %s\n", $i);
continue;
}
if ($line[strlen($line) - 1] === '{') {
list($block, $i) = $this->parseBlock($lines, ++$i);
if ($block !== false) {
list($name, $value) = $this->parseLine($line);
$block->name = $name;
$block->value = $value;
$rootBlock->addBlock($block);
}
continue;
}
if ($line === '}') {
return [$rootBlock, $i];
}
list($property, $i) = $this->parseProperty($lines, $i);
if ($property !== false) {
$rootBlock->addProperty($property);
}
}
return $rootBlock;
}
示例2: add_param
//$if (!$searchnum)
//begin displaying if there is a user with name or number given
// Create the new page
if (User::logged_in()) {
//TODO add searchname instead?
$page->url = add_param($page->url, 'searchnum', $searchnum);
$addtolist = isset($_POST['addtolist']) ? (bool) $_POST['addtolist'] : false;
// if person is manipulating which tier this plan is on their autoread list
if (isset($_POST['block_user'])) {
if ($_POST['block_user'] == 1) {
$user = User::get();
if ($user->webview == 1) {
$warning = new AlertText("Warning! Your plan is set to be viewable by guests. This will allow blocked users to read your plan\nsimply by logging out. If you would like to change this setting, please visit\n<a href=\"/webview.php\">the guest settings page</a>.");
$page->append($warning);
}
Block::addBlock($idcookie, $searchnum);
$msg = new InfoText("<p>You have blocked this user. Blocking a user is one-directional. Selecting \"Block\" renders the contents of your plan unavailable to this user. Neither will see any [planlove] by the other, and any updates either make will not show up on each other’s planwatch.</p>\n\n<p>If this block was made in error, please use the option at the bottom of the page to un-do.</p>");
} else {
Block::removeBlock($idcookie, $searchnum);
$msg = new InfoText("User " . $planinfo[0][0] . " has been unblocked.");
}
$page->append($msg);
} else {
if ($addtolist) {
$privlevel = isset($_POST['privlevel']) ? (int) $_POST['privlevel'] : 0;
if ($privlevel == 0) {
mysql_query("DELETE FROM autofinger WHERE owner = '{$idcookie}' and interest = '{$searchnum}'");
$yay = new InfoText("User " . $planinfo[0][0] . " removed from your autoread list.");
} else {
if ($privlevel > 0 && $privlevel <= 3) {
mysql_query("INSERT INTO autofinger (owner, interest, priority) VALUES ('{$idcookie}', '{$searchnum}', '{$privlevel}') ON DUPLICATE KEY UPDATE priority={$privlevel}");