plugin:goto
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:goto [2015-04-04 06:24] – Remove bad download link PatrickBrown | plugin:goto [2023-10-30 23:58] (current) – Klap-in | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
- | author | + | author |
- | email : 2006-07-19 | + | email : turnermm02[at]shaw[dot]ca |
type : syntax | type : syntax | ||
- | lastupdate : 2006-07-19 | + | lastupdate : 2021-03-01 |
- | compatible : 2006-11-06, Angua | + | compatible : Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather |
depends | depends | ||
conflicts | conflicts | ||
similar | similar | ||
tags : redirect | tags : redirect | ||
+ | |||
+ | downloadurl: | ||
+ | bugtracker : https:// | ||
+ | sourcerepo : https:// | ||
---- | ---- | ||
+ | This plugin redirects the current page to another page after a stipulated number of seconds. It requires the user to have JavaScript enabled in order to work to its fullest. However, a redirect link will still be displayed even without JavaScript. | ||
+ | ===== Installation ===== | ||
- | This [[plugins|plugin]] | + | Search and install the plugin using the [[plugin: |
+ | |||
+ | The default pause time, | ||
===== Syntax ===== | ===== Syntax ===== | ||
+ | |||
You can put the GOTO string anywhere in the document, but it probably makes the most sense to put it at the top. | You can put the GOTO string anywhere in the document, but it probably makes the most sense to put it at the top. | ||
+ | |||
~~GOTO> | ~~GOTO> | ||
- | The above will force the document to redirect to the [[: | ||
- | You can change | + | The above will force the document to redirect to the [[: |
- | ~~GOTO>wiki:syntax?15~~ | + | |
- | This will redirect the page after a 15 second pause. | + | |
- | By default, users can't set the pause length to be faster than three seconds, but this can be changed by editing the plugin. The reason for the minimum pause length | + | It is possible |
- | + | | |
- | ===== Issues ===== | + | === Pause before redirect === |
- | *When editing | + | |
- | | + | |
- | *Currently, the plugin only works correctly for internal links. | + | |
- | + | ||
- | ===== Installation ===== | + | |
- | + | ||
- | Download a zip [[http:// | + | |
- | + | ||
- | If you want to modify the default pause length and the minimum pause length, edit the following lines in '' | + | |
- | | + | |
- | $minSeconds | + | |
- | + | ||
- | You can change the redirect message that is displayed by editing the following line in syntax.php: | + | |
- | $message | + | |
- | '' | + | |
- | '' | + | |
- | + | ||
- | ===== syntax.php ===== | + | |
- | <code php syntax.php> | + | |
- | <?php | + | |
- | /** | + | |
- | * GOTO Plugin: Easily redirect to other pages in your wiki. | + | |
- | * | + | |
- | * @license | + | |
- | * @author | + | |
- | */ | + | |
- | if(!defined(' | + | You can change the number of seconds before the redirect |
- | if(!defined(' | + | ~~GOTO>wiki:syntax?15~~ |
- | require_once(DOKU_PLUGIN.' | + | |
- | + | ||
- | class syntax_plugin_goto extends DokuWiki_Syntax_Plugin { | + | |
- | + | ||
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | function getType(){ | + | |
- | return(' | + | |
- | } | + | |
- | + | ||
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | } | + | |
- | + | ||
- | function getSort() { | + | |
- | return 249; | + | |
- | } | + | |
- | + | ||
- | function handle($match, | + | |
- | + | ||
- | $seconds = 10; //Default number of seconds to wait before redirect. | + | |
- | $minSeconds = 3; //Minimum number of seconds allowed before redirect. | + | |
- | + | ||
- | /* $message is the redirection message that is displayed. %d will be replaced with a link | + | |
- | * to the destination. %s will be replaced with the number of seconds before redirect. */ | + | |
- | $message = "< | + | |
- | + | ||
- | global $ID; | + | |
- | $matches = explode("?", | + | |
- | if (is_numeric($matches[1])){ $seconds = $matches[1]; | + | |
- | if ($seconds < $minSeconds){ $seconds = $minSeconds; | + | |
- | resolve_pageid(getNS($ID), | + | |
- | $message = str_replace(" | + | |
- | $message = str_replace(" | + | |
- | return array($matches[0], | + | |
- | } | + | |
- | + | ||
- | function render($format, | + | |
- | $message = str_replace(" | + | |
- | $message = str_replace(" | + | |
- | $renderer-> | + | |
- | $renderer-> | + | |
- | } | + | |
- | + | ||
- | } | + | |
- | //Setup VIM: ex: et ts=4 enc=utf-8 : | + | |
- | </ | + | |
- | ===== Revision History ===== | + | This will redirect |
- | * 2006-06-30 --- Released.\\ | + | |
- | * 2006-07-19 --- Made it easier to customize the displayed | + | |
+ | By default, users can't set the pause length to be faster than two seconds, but this can be changed in the Configuration Manager by setting a new value for the '' | ||
Line 124: | Line 48: | ||
+ | ===== Updated Version ===== | ||
+ | The '' | ||
+ | --- [[user> | ||
+ | ==== Auto Login ==== | ||
+ | Auto login enables registered users, on logging into the wiki, to be automatically redirected to their own user page.The page will be created if it does not already exist. There are two ways to implement the auto login feature. | ||
+ | ==== 1. Embedded GOTO Syntax ==== | ||
+ | The first applies only to the current user. It uses the GOTO syntax with the '' | ||
+ | ~~GOTO> | ||
+ | This must be placed on the wiki's main page, so that when the user logs in, the page displayed in the browser is the page with this markup. No message is printed to the screen. and the user is redirected to the user page in the root namespace. If the userid is " | ||
+ | ==== 2. Configured Background Process ==== | ||
+ | Unlike **1** this method requires no additional plugin markup and does not require that the browser lands on any particular page. On login, the auto login feature redirects the user to the user's page or start page. This page and its namespace are based on the settings in either the '' | ||
- | ===== Discussion ===== | + | The redirects are governed by the '' |
- | Right now this plugin can only redirect | + | ==== Configuration |
+ | ^Option^Description^Default^ | ||
+ | |seconds|Time till redirection (seconds)| 3| | ||
+ | |minSeconds|Minimum time allowed till redirection (seconds) | 2| | ||
+ | |auto_login|On login, automatically go to predefined page, as set in '' | ||
+ | |auto_options|Target for the auto_login page based on '' | ||
+ | |common_ns((i.e. '' | ||
+ | |group|Comma separated list of group namespaces to which users can be redirected. Different users can be in different groups. | ||
+ | |group_options|The user can be redirected either to the group start page or to the user's own page in the group namespace. | ||
+ | |only_option|The options are '' | ||
- | I don't see the point of a page with a ~~GOTO~~ | + | ==== Auto_Options ==== |
- | >I agree, that does sound nice. However, there are a couple reasons I didn't use an http header redirection. As far as I know, it's impossible | + | There a four options available for defining the user page and namespace to which the auto login will be directed. In each case '' |
- | >>How about a parameter that disables the redirect, e.g. redirect=no? | + | |
- | >>> | + | |
+ | | ||
+ | - : | ||
- | Sorry, but this Plugin | + | ==== Group Options ==== |
+ | Therre are two possibilities for defining the auto login page based on group membership. | ||
+ | - start_page \\ group-name: | ||
+ | - user_page | ||
- | #redirect [[Articlename]] | ||
- | ?? | ||
- | The code you use is to complex and nobody can remember this. | ||
+ | ==== External Links ==== | ||
+ | External links now supported. The following: | ||
+ | | ||
+ | will redirect to wiki: | ||
+ | **%%You will be redirected to https:// | ||
- | > You're welcome to do better. | ||
- | > If there actually existed something like an "all Wiki Standardcode", | + | ===== Revision History |
- | >> Ever head of [[http:// | + | {{rss>https://github.com/cziehr/goto/commits/master.atom date count=25}} |
- | + | ===== Old Discussion | |
- | >>You have to now "# | + | To review old issues and discussion: [[plugin:goto: |
- | >>Use " | + | |
- | >>The only thing is, that such a basic function should by part of the basecode. | + | |
- | + | ||
- | ---- | + | |
- | $seconds and $minSeconds could by inserted in to the admin-configuration. | + | |
- | + | ||
- | ---- | + | |
- | + | ||
- | Note that the download links (to yeahway.com) are **broken** as of 2013-07-11. I'm not touching them as I don't know what policy is. | + | |
- | ---- | + | |
- | + | ||
- | ==== Why not allow to redirect to external sites? | + | |
- | + | ||
- | Specifying an URL like '' | + | |
- | Is it a bug or a feature? | + | |
- | --- [[user> | + | |
- | + | ||
- | ==== Why not using HTTP redirects? | + | |
- | + | ||
- | If you add | + | |
- | + | ||
- | ob_start(); | + | |
- | ob_implicit_flush(FALSE); | + | |
- | + | ||
- | to '' | + | |
- | + | ||
- | - No need to enable JavaScript | + | |
- | - No extra clicks for visitors, if they disabled JavaScript | + | |
- | + | ||
- | The issue " | + | |
- | + | ||
- | === User stupidity === | + | |
- | + | ||
- | Simple - You can't rely on the fact that all users will be able to know how to use the address bar correctly. If you can't access it through visual scanning and mouse clicks, assume 80% of the population will be unable to utilize the feature. | + | |
- | ==== Languages ==== | + | |
- | + | ||
- | <code> | + | |
- | Change | + | |
- | + | ||
- | $message = "< | + | |
- | + | ||
- | to | + | |
- | + | ||
- | $message = "< | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | and | + | |
- | + | ||
- | Input this in the Path " | + | |
- | + | ||
- | + | ||
- | == en == | + | |
- | <code php> | + | |
- | <?php | + | |
- | /* | + | |
- | English language file | + | |
- | + | ||
- | %d will be replaced with a link to the destination. | + | |
- | %s will be replaced with the number of seconds before redirect. | + | |
- | */ | + | |
- | $lang[' | + | |
- | //Setup VIM: ex: et ts=2 enc=utf-8 : | + | |
- | ?> | + | |
- | </code> | + | |
- | + | ||
- | + | ||
- | == de == | + | |
- | <code php> | + | |
- | <?php | + | |
- | /* | + | |
- | German language file | + | |
- | + | ||
- | %d will be replaced with a link to the destination. | + | |
- | %s will be replaced with the number of seconds before redirect. | + | |
- | */ | + | |
- | $lang[' | + | |
- | //Setup VIM: ex: et ts=2 enc=utf-8 : | + | |
- | ?> | + | |
- | </code> | + | |
- | + | ||
- | == fr == | + | |
- | <code php> | + | |
- | <?php | + | |
- | /* | + | |
- | french language file | + | |
- | + | ||
- | %d will be replaced with a link to the destination. | + | |
- | %s will be replaced with the number of seconds before redirect. | + | |
- | */ | + | |
- | $lang[' | + | |
- | //Setup VIM: ex: et ts=2 enc=utf-8 : | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | == es == | + | |
- | <code php> | + | |
- | <?php | + | |
- | /* | + | |
- | Spanish language file | + | |
- | + | ||
- | %d will be replaced with a link to the destination. | + | |
- | %s will be replaced with the number of seconds before redirect. | + | |
- | */ | + | |
- | $lang[' | + | |
- | //Setup VIM: ex: et ts=2 enc=utf-8 : | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | ==== Great ==== | + | |
- | Great, this plugin made my day. Only issue is that I cannot remember the syntax, #REDIRECT would have been better. | + | |
- | + | ||
- | ==== Support for Anchors ==== | + | |
- | The # character is replaced by %23 in the URL, so I've made the following modification to the render function. | + | |
- | + | ||
- | function render($format, | + | |
- | $message = str_replace(" | + | |
- | $message = str_replace(" | + | |
- | $renderer-> | + | |
- | $urlArr = split('#', | + | |
- | $url = wl($urlArr[0]); | + | |
- | if (count($urlArr) > 1) { | + | |
- | $url .= '#' | + | |
- | } | + | |
- | $renderer-> | + | |
- | } | + | |
- | + | ||
- | ==== Support for external pages ==== | + | |
- | + | ||
- | Minor modifications which allow: | + | |
- | - external pages to be referenced. | + | |
- | - doesn' | + | |
- | + | ||
- | < | + | |
- | --- ./ | + | |
- | +++ ./ | + | |
- | @@ -48,18 +48,29 @@ | + | |
- | $matches | + | |
- | if (is_numeric($matches[1])){ $seconds | + | |
- | if ($seconds < $minSeconds){ $seconds = $minSeconds; | + | |
- | - | + | |
- | + if (substr($matches[0], | + | |
- | + | + | |
- | $message = str_replace(" | + | |
- | $message = str_replace(" | + | |
- | return array($matches[0], $seconds, $message); | + | |
- | } | + | |
- | + | ||
- | function render($format, | + | |
- | - | + | |
- | - | + | |
- | - | + | |
- | - | + | |
- | + global $ACT; | + | |
- | + if (substr($data[0], | + | |
- | + | + | |
- | + | + | |
- | + | + | |
- | + if ($ACT != ' | + | |
- | + | + | |
- | + } else { | + | |
- | + | + | |
- | + | + | |
- | + | + | |
- | + if ($ACT != ' | + | |
- | + | + | |
- | + } | + | |
- | } | + | |
- | } | ||
- | </ |
plugin/goto.1428121483.txt.gz · Last modified: 2015-04-04 06:24 by PatrickBrown