本文整理匯總了PHP中WikiPage::is_locked方法的典型用法代碼示例。如果您正苦於以下問題:PHP WikiPage::is_locked方法的具體用法?PHP WikiPage::is_locked怎麽用?PHP WikiPage::is_locked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WikiPage
的用法示例。
在下文中一共展示了WikiPage::is_locked方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_edit_html
protected function create_edit_html(WikiPage $page)
{
$h_title = html_escape($page->title);
$i_revision = int_escape($page->revision) + 1;
global $user;
if ($user->is_admin()) {
$val = $page->is_locked() ? " checked" : "";
$lock = "<br>Lock page: <input type='checkbox' name='lock'{$val}>";
} else {
$lock = "";
}
return "\n\t\t\t" . make_form(make_link("wiki_admin/save")) . "\n\t\t\t\t<input type='hidden' name='title' value='{$h_title}'>\n\t\t\t\t<input type='hidden' name='revision' value='{$i_revision}'>\n\t\t\t\t<textarea name='body' style='width: 100%' rows='20'>" . html_escape($page->body) . "</textarea>\n\t\t\t\t{$lock}\n\t\t\t\t<br><input type='submit' value='Save'>\n\t\t\t</form>\n\t\t";
}
示例2: can_edit
/**
* See if the given user is allowed to edit the given page.
*
* @param User $user
* @param WikiPage $page
* @return bool
*/
public static function can_edit(User $user, WikiPage $page)
{
// admins can edit everything
if ($user->is_admin()) {
return true;
}
// anon / user can't ever edit locked pages
if ($page->is_locked()) {
return false;
}
// anon / user can edit if allowed by config
if ($user->can("edit_wiki_page")) {
return true;
}
return false;
}
示例3: can_edit
/**
* See if the given user is allowed to edit the given page
*
* @retval boolean
*/
public static function can_edit(User $user, WikiPage $page)
{
global $config;
// admins can edit everything
if ($user->is_admin()) {
return true;
}
// anon / user can't ever edit locked pages
if ($page->is_locked()) {
return false;
}
// anon / user can edit if allowed by config
if ($config->get_bool("wiki_edit_anon", false) && $user->is_anonymous()) {
return true;
}
if ($config->get_bool("wiki_edit_user", false) && !$user->is_anonymous()) {
return true;
}
return false;
}