本文整理汇总了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}");