本文整理汇总了PHP中Page::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::url方法的具体用法?PHP Page::url怎么用?PHP Page::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forming
public static function forming()
{
$form = new Form("POST", Page::url("/forms"));
$input = new InputElement("login", "Identifiant :", "Pierre");
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
// Balise, Name, Label, Value
$input = new FormElement("select", "age", "Age :", 10);
$input->addElement(new FormElement("option", "", "0-10", 0));
$input->addElement(new FormElement("option", "", "10-20", 10));
$input->addElement(new FormElement("option", "", "20-30", 20));
$input->addElement(new FormElement("option", "", "30-40", 30));
$input->addElement(new FormElement("option", "", "40-50", 40));
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
$input = new FormElement("label", null, "Age : ");
$input->addClasses("label_input_checkbox_radio");
$form->addElement($input);
$input = new InputElement("mabox1", "0-10", 0, "checkbox", "mabox1");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("mabox2", "10-20", 10, "checkbox", "mabox2");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("mabox3", "20-30", 20, "checkbox", "mabox3");
$form->addElement($input);
$input = new InputElement("mabox4", "30-40", 30, "checkbox", "mabox4");
$input->setAttribute("checked", "checked");
$input->setAttribute("disabled", "disabled");
$form->addElement($input);
$input = new InputElement("mabox5", "40-50", 40, "checkbox", "mabox5");
$input->setAttribute("disabled", "disabled");
$form->addElement($input);
$input = new FormElement("label", null, "Age : ");
$input->addClasses("label_input_checkbox_radio");
$form->addElement($input);
$input = new InputElement("monradio", "0-10", 0, "radio", "monradio1");
$input->setAttribute("checked", "checked");
$form->addElement($input);
$input = new InputElement("monradio", "10-20", 10, "radio", "monradio2");
$form->addElement($input);
$input = new InputElement("monradio", "20-30", 20, "radio", "monradio3");
$form->addElement($input);
$input = new InputElement("monradio", "30-40", 30, "radio", "monradio4");
$form->addElement($input);
$input = new InputElement("monradio", "40-50", 40, "radio", "monradio5");
$form->addElement($input);
$input = new FormElement("textarea", "description", t("Description : "), "Test");
$input->setAttribute("row", 6);
$input->setAttribute("col", 18);
$input->addClasses("actualite_area_text");
$form->addElement($input);
$form->addElement(new ClosedElement("br"));
$input = new InputElement("monbutton", null, "Test JS", "button");
$input->setAttribute("onclick", "alert('Test JS OK');");
$form->addElement($input);
$theme = new Theme();
$theme->process_form($form);
$theme->process_theme();
}
示例2: url
/**
* Returns a URL to the item with an optional section parameter
*
* @param Page $section Parent page to use as the class
* @return string
*/
public function url($section = null)
{
if (!is_a($section, 'Page') || $section === $this->parent()) {
return parent::url();
}
return parent::url() . '?section=' . $section->uri();
}
示例3: testConstruction
public function testConstruction()
{
$kirby = $this->kirbyInstance();
$site = $this->siteInstance($kirby);
$page = new Page($site, '1-a');
$this->assertInstanceOf('Kirby', $page->kirby());
$this->assertEquals($kirby, $page->kirby());
$this->assertInstanceOf('Site', $page->site());
$this->assertEquals($site, $page->site());
$this->assertInstanceOf('Site', $page->parent());
$this->assertEquals($site, $page->parent());
$this->assertEquals('1-a', $page->dirname());
$this->assertEquals(1, $page->depth());
$this->assertEquals($kirby->roots()->content() . DS . '1-a', $page->root());
$this->assertEquals('1', $page->num());
$this->assertEquals('a', $page->uid());
$this->assertEquals('a', $page->id());
$this->assertEquals('1-a', $page->diruri());
$this->assertEquals('/a', $page->url());
$this->assertTrue($page->isCachable());
$this->assertEquals('a', $page->slug());
$this->assertTrue($page->is($page));
$this->assertTrue($page->equals($page));
$this->assertFalse($page->isSite());
$this->assertFalse($page->isActive());
$this->assertFalse($page->isOpen());
$this->assertTrue($page->isVisible());
$this->assertFalse($page->isInvisible());
$this->assertFalse($page->isHomePage());
$this->assertFalse($page->isErrorPage());
$this->assertEquals($page->id(), (string) $page);
}
示例4: widget_menu_system
public function widget_menu_system()
{
$theme = new Theme();
$list = array();
$list[] = Theme::linking(Page::url("/admin/modules/"), t("<i class=\"fa fa-puzzle-piece fa-fw\"></i> Modules"));
$list[] = Theme::linking(Page::url("/admin/database/"), t("<i class=\"fa fa-database fa-fw\"></i> Base de données"));
return t("<div class=\"widget_titre\"><i class=\"fa fa-wrench fa-fw\"></i> Système</div>") . $theme->listing($list);
}
示例5: get_avatar
public function get_avatar()
{
if (!($fid = Database::getValue("SELECT fid FROM " . CONFIG_DB_PREFIX . "user_avatar WHERE uid = {$this->uid}"))) {
return false;
} else {
return Page::url("/file/{$fid}");
}
}
示例6: hook_timeline
public function hook_timeline()
{
$type = "Text";
if (isset($_POST['send'])) {
$result = $this->render_form_submit($type);
$f = new PublicationObject();
$f->content = $result;
$f->qrender = "Text";
$f->save();
}
$form_publish = '<div class="actualite">
<div class="actualite_avatar_area">
<div class="actualite_avatar avatar" style="background-image:url(' . User::get_user_logged_avatar() . ')">
</div>
</div>
<div class="quoi_de_neuf_bloc">
<form method="POST" action="">' . $this->render_form($type) . '
<input type="submit" value="publier" name="send"/></form>
<div style="position: absolute; display: none; word-wrap: break-word; white-space: pre-wrap; border-left: 0px none rgb(51, 51, 51); border-color: rgb(51, 51, 51); border-style: none; border-width: 0px; font-weight: 400; width: 510px; font-family: monospace; line-height: 14px; font-size: 12px; padding: 10px;"> </div></div>
<div class="clear"></div>
</div>';
$friendshipO = new FriendshipObject();
$friends = $friendshipO->loadAllFriends(User::get_user_logged_id());
$friends[] = user::get_user_logged_id();
$f = PublicationObject::loadAllByFriendship($friends);
$content_publish = "";
$users = array();
$theme = new Theme();
foreach ($f as $t) {
if (!isset($users[$t->author])) {
$users[$t->author] = new UserObject();
$users[$t->author]->load($t->author);
}
$u = $users[$t->author];
$content_publish .= '<div class="actualite">
<div class="actualite_avatar_area">
<div class="actualite_avatar avatar" style="background-image:url(' . $u->get_avatar() . ')">
</div>
<div class="actualite_nom">' . $theme::linking(Page::url("/profile/{$u->uid}"), $u->firstname . "<br />" . $u->lastname) . '</a></div>
</div>
<div class="actualite_bloc">
<div class="actualite_area">
<div class="actualite_area_text">
' . $this->render_render($t->qrender, $t->content) . '
</div>
</div>
<div class="actualite_buttons">
<div class="actualite_date"><i class="fa fa-calendar fa-fw"></i> ' . date("H:i:s d/m/Y", $t->date_published) . '</div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>';
}
return array($form_publish, '<div class="page_contenu_sep"></div>', $content_publish);
}
示例7: documentation
public function documentation($rubrique, $sousrubrique = 'index')
{
$r = "";
$rubrique = str_replace(" ", "-", $rubrique);
if (file_exists("modules/doc/docs/{$rubrique}/{$sousrubrique}.md")) {
$file = file_get_contents("modules/doc/docs/{$rubrique}/{$sousrubrique}.md");
} else {
$file = file_get_contents("modules/doc/docs/notfound.md");
}
preg_match('/@title:(.*)/', $file, $matches);
if (isset($matches[1])) {
$file = str_replace("@title:" . $matches[1], "", $file);
Theme::set_title($matches[1]);
}
$p = new Parsedown();
$r = $p->text($file);
$theme = new Theme();
$theme->add_to_head("<link rel='stylesheet' href='" . Page::url("/modules/doc/styles/atelier-forest.dark.css") . "'/>");
$theme->add_to_head("<script src='" . Page::url("/modules/doc/highlight.pack.js") . "'></script>");
$theme->add_to_head("<script>hljs.initHighlightingOnLoad();</script>");
$theme->add_to_body("<div style='margin:15px;'>{$r}</div>");
$theme->process_theme(Theme::STRUCT_ADMIN);
}
示例8: page_upload_content
public static function page_upload_content()
{
$theme = new Theme();
if (isset($_FILES['file'])) {
$file = new FileObject();
if ($file->uploadFile($_FILES['file'])) {
Notification::statusNotify(t("Le fichier a bien été uploadé."), Notification::STATUS_SUCCESS);
} else {
Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR);
}
}
$f = new Form("POST", Page::url("/file/upload"));
$f->setAttribute("enctype", "multipart/form-data");
$t = new InputElement("file", t("Fichier : "), "", "file");
$f->addElement($t);
$t = new InputElement("submit-file", "", t("Charger"), "submit");
$f->addElement($t);
$formulaire = $theme->forming($f);
$theme->set_title("Charger un fichier");
$theme->add_to_body($formulaire);
$theme->process_theme(Theme::STRUCT_ADMIN);
return;
}
示例9: page_set_avatar
public static function page_set_avatar()
{
$theme = new Theme();
if (isset($_FILES['file'])) {
$file = new FileObject();
if ($id_file = $file->uploadFile($_FILES['file'])) {
$u = User::get_user_logged();
$u->set_avatar($id_file);
header("location: " . Page::url("/profile"));
return;
} else {
Notification::statusNotify(t("Une erreur s'est produite lors de l'upload."), Notification::STATUS_ERROR);
}
}
$f = new Form("POST", Page::url("/profile/settings/avatar"));
$f->setAttribute("enctype", "multipart/form-data");
$t = new InputElement("file", t("Fichier : "), "", "file");
$f->addElement($t);
$t = new InputElement("submit-file", "", t("Charger"), "submit");
$f->addElement($t);
$formulaire = $theme->forming($f);
$theme->set_title("Changer mon avatar");
$theme->add_to_body($formulaire);
$theme->process_theme(Theme::STRUCT_ADMIN);
return;
}
示例10: update_page
/**
* Function: update_page
* Updates a page when the form is submitted.
*/
public function update_page()
{
if (!Visitor::current()->group->can("edit_page")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to edit pages."));
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (empty($_POST['title']) and empty($_POST['slug'])) {
error(__("Error"), __("Title and slug cannot be blank."));
}
$page = new Page($_POST['id']);
if ($page->no_results) {
Flash::warning(__("Page not found."), "/admin/?action=manage_pages");
}
$page->update($_POST['title'], $_POST['body'], null, $_POST['parent_id'], !empty($_POST['show_in_list']), $page->list_order, null, $_POST['slug']);
if (!isset($_POST['ajax'])) {
Flash::notice(_f("Page updated. <a href=\"%s\">View Page →</a>", array($page->url())), "/admin/?action=manage_pages");
}
}
示例11: uninstallWidgetPage
public static function uninstallWidgetPage($widgetName)
{
$widget = new WidgetObject();
if ($widget->load($widgetName)) {
if ($widget->uninstall($widget)) {
header("location: " . Page::url("/admin/view/widget/"));
} else {
header("location: " . Page::url("/admin/view/widget/?err=install"));
}
} else {
header("location: " . Page::url("/admin/view/widget/?err=unknown"));
}
return;
}
示例12: _remap
public function _remap($model)
{
global $admin, $ci, $page;
$this->benchmark->mark('page_setup_start');
if (!defined('BLOG')) {
define('BLOG', '');
}
define('BASE_URL', $this->config->base_url());
$this->poster = md5(BASE_URL);
$this->model = $model;
$ci = $this;
// $ci =& get_instance(); doesn't cut it so ...
$errors = '';
do {
$errors .= ob_get_clean();
} while (ob_get_level());
ob_start();
session_cache_limiter('');
// turn off automatic sending of cache headers
if ($this->model == '#cache#') {
$file = func_get_arg(1);
$type = array_pop($file);
$this->load->driver('resources');
return $this->resources->deliverer->view(implode('/', $file), $type);
}
$admin = array_merge(array('name' => '', 'email' => '', 'password' => '', 'folder' => ''), (array) $admin);
define('ADMIN', !empty($admin['folder']) ? trim($admin['folder'], '/') . '/' : 'admin/');
$uri = $this->uri->uri_string();
$bp_admin = strpos($uri . '/', ADMIN) === 0 ? isset($admin['function']) ? $admin['function'] : true : false;
if (!$bp_admin && $this->poster != $this->model) {
$uri = str_replace('_', '-', $uri);
}
$paths = array();
foreach (explode('/', $uri) as $value) {
if (($extension = strpos($value, '.')) !== false) {
$value = substr($value, 0, $extension);
}
// remove file extensions
if (!empty($value)) {
$paths[] = $value;
}
// remove empty "folders"
}
$paths = array_diff($paths, array('index'));
// remove any reference to 'index'
$type = pathinfo($uri, PATHINFO_EXTENSION);
if (!empty($type) && in_array($type, array('xml', 'txt', 'less'))) {
$desired_url = $this->config->base_url(implode('/', $paths) . '.' . $type);
} else {
$desired_url = $this->config->site_url($paths) . strstr($_SERVER['REQUEST_URI'], '?');
}
$actual_url = (is_https() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if ($desired_url != $actual_url) {
header('Location: ' . $desired_url, true, 301);
exit;
}
$this->load->driver('session');
$this->load->library('sitemap');
if ($html = $this->sitemap->cached()) {
$this->benchmark->mark('page_setup_end');
$this->benchmark->mark('page_display_start');
} else {
require_once BASE . 'Page.php';
$page = new Page();
$this->benchmark->mark('page_setup_end');
$this->benchmark->mark('page_content_start');
if ($this->model == $this->poster) {
$this->delay_flashdata();
$this->log_analytics('users');
$image = base64_decode('R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
header('Expires: Fri, 01 Jan 1990 00:00:00 GMT');
header('Cache-Control: max-age=0, must-revalidate');
header('Content-Length: ' . strlen($image));
header('Content-Type: image/gif');
header('Pragma: no-cache');
exit($image);
} elseif ($template = $this->input->post($this->poster)) {
$this->delay_flashdata();
$data = array();
$file = BASE_URI . 'blog/content/post.tpl';
if (is_file($file)) {
$this->load->driver('blog', array('role' => '#post#'));
$this->blog->resources(BASE_URL . 'blog/content/');
$this->load->library('auth');
$vars = array('template' => $template, 'user' => $this->auth->user(), 'uri' => array('id' => $this->sitemap->uri('id'), 'type' => $this->sitemap->uri('type'), 'views' => $this->sitemap->uri('views')));
$this->blog->smarty($file, $vars);
$data = $this->compile($page->post);
}
$data = json_encode($this->filter_links($data));
header('Content-Type: application/json');
header('Content-Length: ' . strlen($data));
exit($data);
} elseif ($this->model == '#sitemap#') {
$params = func_get_arg(1);
$method = array_shift($params);
// Either 'robots' or 'xml'
$html = $this->sitemap->{$method}(array_shift($params));
} else {
if ($bp_admin) {
$this->load->driver('blog', array('role' => '#admin#'));
//.........这里部分代码省略.........
示例13: action_empty_tags
public function action_empty_tags()
{
$empties = Model::factory('Hmanga')->where('tags', '##')->find_many();
foreach ($empties as $hmanga) {
$p = new Page(self::$base . $hmanga->url);
echo $p->url() . '<br>' . PHP_EOL;
$new_info = $this->extract_from_page($p);
echo $new_info['tags'] . '<br><br>' . PHP_EOL;
$hmanga->tags = $new_info['tags'];
$hmanga->save();
}
}
示例14: action_update
public function action_update()
{
foreach (array('https://www.fakku.net/manga/english', 'https://www.fakku.net/doujinshi/english') as $starting_url) {
$page = 1;
$next = true;
$to_add = array();
while ($next) {
$p = new Page($starting_url . ($page > 1 ? '/page/' . $page : ''));
echo $p->url() . "<br>\n";
$infos = $this->extract_from_page($p);
// if (strpos($p->content(), 'base64')) {print_r($p->content());print_r($infos);exit;}//debug
// if (strpos($p->content(), 'ps.googleusercontent.com')) {print_r($p->content());print_r($infos);exit;}//debug
foreach ($infos as $k => $info) {
if ($this->is_already_exist($info)) {
unset($infos[$k]);
$next = false;
}
}
// echo '<pre>';print_r($infos);exit;
$to_add = array_merge($to_add, $infos);
$page++;
}
$to_add = array_reverse($to_add);
// echo '<pre>';print_r($to_add);continue;
// save
foreach ($to_add as $info) {
echo $info['url'] . "<br>\n";
$this->add_hmanga($info);
}
}
}
示例15: inlineImage
protected function inlineImage($excerpt)
{
if (preg_match($this->twig_link_regex, $excerpt['text'], $matches)) {
$excerpt['text'] = str_replace($matches[1], '/', $excerpt['text']);
$excerpt = parent::inlineImage($excerpt);
$excerpt['element']['attributes']['src'] = $matches[1];
$excerpt['extent'] = $excerpt['extent'] + strlen($matches[1]) - 1;
return $excerpt;
} else {
$excerpt['type'] = 'image';
$excerpt = parent::inlineImage($excerpt);
}
// Some stuff we will need
$actions = [];
$media = null;
// if this is an image
if (isset($excerpt['element']['attributes']['src'])) {
$alt = $excerpt['element']['attributes']['alt'] ?: '';
$title = $excerpt['element']['attributes']['title'] ?: '';
$class = isset($excerpt['element']['attributes']['class']) ? $excerpt['element']['attributes']['class'] : '';
//get the url and parse it
$url = parse_url(htmlspecialchars_decode($excerpt['element']['attributes']['src']));
$this_host = isset($url['host']) && $url['host'] == $this->uri->host();
// if there is no host set but there is a path, the file is local
if ((!isset($url['host']) || $this_host) && isset($url['path'])) {
$path_parts = pathinfo($url['path']);
// get the local path to page media if possible
if ($path_parts['dirname'] == $this->page->url(false, false, false)) {
// get the media objects for this page
$media = $this->page->media();
} else {
// see if this is an external page to this one
$base_url = rtrim(Grav::instance()['base_url_relative'] . Grav::instance()['pages']->base(), '/');
$page_route = '/' . ltrim(str_replace($base_url, '', $path_parts['dirname']), '/');
$ext_page = $this->pages->dispatch($page_route, true);
if ($ext_page) {
$media = $ext_page->media();
}
}
// if there is a media file that matches the path referenced..
if ($media && isset($media->all()[$path_parts['basename']])) {
// get the medium object
$medium = $media->all()[$path_parts['basename']];
// if there is a query, then parse it and build action calls
if (isset($url['query'])) {
$url['query'] = htmlspecialchars_decode(urldecode($url['query']));
$actions = array_reduce(explode('&', $url['query']), function ($carry, $item) {
$parts = explode('=', $item, 2);
$value = isset($parts[1]) ? $parts[1] : null;
$carry[] = ['method' => $parts[0], 'params' => $value];
return $carry;
}, []);
}
// loop through actions for the image and call them
foreach ($actions as $action) {
$medium = call_user_func_array([$medium, $action['method']], explode(',', urldecode($action['params'])));
}
if (isset($url['fragment'])) {
$medium->urlHash($url['fragment']);
}
$excerpt['element'] = $medium->parseDownElement($title, $alt, $class, true);
} else {
// not a current page media file, see if it needs converting to relative
$excerpt['element']['attributes']['src'] = Uri::buildUrl($url);
}
}
}
return $excerpt;
}