1: <?php
2: /**
3: * Wicked BackLinks class.
4: *
5: * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (GPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/gpl.
9: *
10: * @author Tyler Colbert <tyler@colberts.us>
11: * @package Wicked
12: */
13: class Wicked_Page_BackLinks extends Wicked_Page {
14:
15: /**
16: * Display modes supported by this page.
17: *
18: * @var array
19: */
20: public $supportedModes = array(
21: Wicked::MODE_DISPLAY => true);
22:
23: /**
24: * The page that we're displaying backlinks to.
25: *
26: * @var string
27: */
28: protected $_referrer = null;
29:
30: public function __construct($referrer)
31: {
32: $this->_referrer = $referrer;
33: }
34:
35: /**
36: * Renders this page in display or block mode.
37: *
38: * @return string The contents.
39: * @throws Wicked_Exception
40: */
41: public function displayContents($isBlock)
42: {
43: $summaries = $GLOBALS['wicked']->getBackLinks($this->_referrer);
44: Horde::addScriptFile('tables.js', 'horde', true);
45: ob_start();
46: require WICKED_TEMPLATES . '/pagelist/header.inc';
47: foreach ($summaries as $page) {
48: if (!empty($page['page_history'])) {
49: $page = new Wicked_Page_StandardHistoryPage($page);
50: } else {
51: $page = new Wicked_Page_StandardPage($page);
52: }
53: require WICKED_TEMPLATES . '/pagelist/summary.inc';
54: }
55: require WICKED_TEMPLATES . '/pagelist/footer.inc';
56: return ob_get_clean();
57: }
58:
59: public function pageName()
60: {
61: return 'BackLinks';
62: }
63:
64: public function pageTitle()
65: {
66: return sprintf(_("Backlinks: %s"), $this->referrer());
67: }
68:
69: public function referrer()
70: {
71: return $this->_referrer;
72: }
73:
74: }
75: