Code Monkey home page Code Monkey logo

preview-before-redirect-with-qrcode-thumbnail-and-forced's Introduction

Preview URL with QR Code and Thumbnail

Plugin for YOURLS 1.5+. Tested on YOURLS 1.8.1

Description

  1. Add the character '~' to a short URL to display a preview page with QR code and Thumbnail image before redirection.
  2. On clicking a shortlink, land on a preview page, and wait for N seconds before auto redirection.
  3. You can find a preview button Preview Button, at the admin area.

Requirements

The following plugins should already be installed and activated:

  1. YOURLS QRCode or Google Chart API QR Code Plugin. If not found, an QR NOT FOUND image is displayed`
  2. Thumbnail URL image. If not found Preview Not Found image is displayed.
  3. If you have the plugin 404 If Not Found activate, please remeber to edit the plugin file and add all functions which are triggered in other plugins as loader_failed. An example of the same is:
...
yourls_add_action('redirect_keyword_not_found', 'ozh_404_if_not_found');

// 'keyword+' provided but this isnt an existing stat page
yourls_add_action('infos_keyword_not_found', 'ozh_404_if_not_found');

// 'keyword' not provided: direct attempt at http://sho.rt/yourls-go.php or -infos.php
yourls_add_action('redirect_no_keyword', 'ozh_404_if_not_found');
yourls_add_action('infos_no_keyword', 'ozh_404_if_not_found');

// Display a default 404 not found page
function ozh_404_if_not_found($request) {
   // The QR Code generator, .qr.
	if(function_exists('sean_yourls_qrcode'))
		sean_yourls_qrcode( $request );
   // Our plugin with tidle (~) character.
	if(function_exists('formula21_preview_loader_failed'))
		formula21_preview_loader_failed($request);
    yourls_status_header(404);
    ...
}

Installation

  1. In /user/plugins, create a new folder named preview-url-with-qrcode-thumbnail.
  2. Drop these files in that directory.
  3. Go to /user/config.php and add:
    • define('PRE_REDIRECT_PREVIEW', true); to activate the preview before redirect plugin.
    • define('PRE_REDIRECT_SECONDS', 10); to define the number of seconds before auto-redirection. Recommended 8 to 10 seconds.
    • These features are optional.
    • The plugin is so made to replace with the long url if Javascript is active. If not, the plugin yet works and will redirect with something called a Refresh header.
  4. Go to the Plugins administration page ( eg http://sho.rt/admin/plugins.php ) and activate the plugin.
  5. Have fun!

Translating

This plugin already translated to English and Russian, simply uses whatever language YOURLS uses, as described here.

If you want to translate this plugin into your own language, this blog post from YOURLS describes how to do it. You can find the latest .pot file in the languages folder of the plugin directory. Please follow the contributing guidelines below to add your translation to plugin.

License

MIT License

preview-before-redirect-with-qrcode-thumbnail-and-forced's People

Contributors

anweshandev avatar fellwell5 avatar prog-it avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.