Skip to main content Help Control Panel

Aubagne HipHop

Tout le Hip Hop d'Aubagne et des alentours

Home «   Server software «  

Documentation: links/links.php

Class Links - The database abstraction layer for links

This script is a reference file of this system.

Licence: GNU Lesser General Public License

Auteurs:

click() - Increment one click link

function click($url)



Voir aussi:

delete() - Delete one link

function delete($id)



Voir aussi:

delete_for_anchor() - Delete all links for a given anchor

function delete_for_anchor($anchor)



Voir aussi:

get() - Get one link by id or by url

function &get($id)



Voir aussi:

have() - Check for link existence

function have($url, $anchor=NULL)

This function can be used either to see if a link exists in the database, or to check if one link has been attached to a particular anchor.

To query the whole database, use:
if(Links::have($that_beautiful_url))
   ...


To check that an article has a link attached, use:
$anchor 'article:'.$article['id'];
if(
Links::have($that_beautiful_url$anchor))
   ...


Voir aussi:

list_by_date() - List newest links

function &list_by_date($offset=0, $count=10, $variant='dates')

To build a simple box of the newest links in your main index page, just use the following example:
// side bar with the list of most recent links
include_once 'links/links.php';
$local['title_en'] = 'Most recent Links';
$local['title_fr'] = 'liens récents';
$title i18n::user('title');
$items Links::list_by_date(010);
$text Skin::build_list($items'compact');
$context['text'] .= Skin::build_box($title$text'navigation');


You can also display the newest link separately, using Links::get_newest() In this case, skip the very first link in the list by using Links::list_by_date(1, 10).

This function masks links fetched from external feeds, by ensuring the action code is not 'link:feed'.

Voir aussi:

list_by_date_for_anchor() - List newest links for one anchor

function &list_by_date_for_anchor($anchor, $offset=0, $count=20, $variant='no_anchor', $capability='?')

Example:
include_once 'links/links.php';
$items Links::list_by_date_for_anchor('section:12'010);
$context['text'] .= Skin::build_list($items'compact');


Voir aussi:

list_by_date_for_author() - List newest links for one author

function &list_by_date_for_author($author_id, $offset=0, $count=20, $variant='no_author')

Example:
include_once 'links/links.php';
$items Links::list_by_date_for_author(12010);
$context['text'] .= Skin::build_list($items'compact');


list_by_hits() - List most read links

function &list_by_hits($offset=0, $count=10, $variant='hits')

To build a simple box of the most read links in your main index page, just use Links::list_by_hits(0, 10)

Example:
include_once '../links/links.php';
$context['text'] .= Skin::build_list(Links::list_by_hits(), 'compact');


You can also display the most read link separately, using Links::get_most_read() In this case, skip the very first link in the list by using Links::list_by_hits(1)

Voir aussi:

list_by_hits_for_author() - List most popular links for one author

function &list_by_hits_for_author($author_id, $offset=0, $count=10, $variant='hits')

Example:
include_once 'links/links.php';
$items Links::list_by_hits_for_author(12010);
$context['text'] .= Skin::build_list($items'compact');


list_by_title_for_anchor() - List links by title for one anchor

function &list_by_title_for_anchor($anchor, $offset=0, $count=10, $variant='no_anchor', $capability='?')

Example:
include_once '../links/links.php';
$items Links::list_by_title_for_anchor('article:12');
$context['text'] .= Skin::build_list($items'decorated');


Voir aussi:

list_news() - List links received from newsfeeders

function &list_news($offset=0, $count=10, $variant='dates')

This function is used to show most recent news received from the net. It restricts the lookup to links that have the action code 'link:feed'.

Voir aussi:

list_selected() - List selected links

function &list_selected(&$result, $layout='compact', $capability='?')

Accept following variants:

ping() - Ping back links referenced in some text

function ping($text, $anchor)

This is the client implementation of trackback and pingback specifications.

This function is triggered by publishing scripts, either articles/publish.php, services/blog.php, agents/messages.php or agents/uploads.php.

It is used to efficiently link pages across a set of web sites according to the following mechanism:

We are claiming to support most of the trackback client interface here, as described in the trackback specification. A foreign page is considered as being trackback-enabled if it has a special RDF section linking its reference (i.e., URL) to a Trackback Ping URL.

Note that YACS also implements the server part of the trackback specification in links/trackback.php, which supports POST REST calls.

We are claiming to fully support the pingback client interface here, as described in the pingback specification. A foreign page is considered to be pingback-enabled if it has a meta link to a Pingback Ping URL.

Note that YACS also implements the server part of the pingback specification in services/ping.php, which supports XML-RPC calls.

This function transforms every YACS codes into HTML before extracting links, and before submitting the excerpt to remote site.

Voir aussi:

ping_as_pingback() - Attempt to use the pingback interface

function ping_as_pingback($text, $source, $target)



Voir aussi:

ping_as_trackback() - Attempt to use the trackback interface

function ping_as_trackback($text, $source, $target, $title='', $excerpt='', $blog_name='')



Voir aussi:

post() - Post a new link or an updated link

function post($fields)



Voir aussi:

purge_old_news() - Cap the number of news in the database

function purge_old_news($limit=1000)

This function deletes oldest entries going beyond the given threshold. Links coming from feeders are located by the special value 'link:feed' in the field edit action.

Note that if a link is collected from a feeder, and if it is modified afterwards, then the edit-action field is changed to 'link:update', meaning it is not condidered as some news anymore. This link won't appear at the front page anymore, and won't be purged either. Any change to a news link makes it become an ordinary and permanent link.

Voir aussi:

search() - Search for some keywords in all links

function &search($pattern, $offset=0, $count=10, $variant='search')



Voir aussi:

setup() - Create tables for links

function setup()

Voir aussi:

stat() - Get some statistics

function &stat()



Voir aussi:

stat_for_anchor() - Get some statistics for one anchor

function &stat_for_anchor($anchor)



Voir aussi:

transform_reference() - Reference another page at this site

function transform_reference($text)

The function transforms a local reference (e.g;, [user=2]) to an actual link relative to the YACS directory (e.g., users/view.php/2), adds a title and, sometimes, set a description as well.

Voir aussi:

Tools
Browse the source of this script
Server software