~quam-plures-core/quam-plures/multiple_user_adsense

« back to all changes in this revision

Viewing changes to qp_plugins/linkblog_widget/_linkblog.widget.php

  • Committer: EdB
  • Date: 2013-02-25 05:03:58 UTC
  • mfrom: (7618.1.37 quam-plures)
  • Revision ID: 1912webworks@gmail.com-20130225050358-v7ogz34ydcvohkq6
updating to current core

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * This file implements the linkblog_Widget class.
 
4
 *
 
5
 * This file is part of Quam Plures - {@link http://quamplures.net/}
 
6
 * See also {@link https://launchpad.net/quam-plures}.
 
7
 *
 
8
 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
 
9
 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
 
10
 *
 
11
 * {@internal License choice
 
12
 * - If you have received this file as part of a package, please find the license.txt file in
 
13
 *   the same folder or the closest folder above for complete license terms.
 
14
 * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
 
15
 *   then you must choose one of the following licenses before using the file:
 
16
 *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
 
17
 *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
 
18
 * }}
 
19
 *
 
20
 * {@internal Below is a list of authors who have contributed to design/coding of this file: }}
 
21
 * @author fplanque: Francois PLANQUE.
 
22
 *
 
23
 * @package widgets
 
24
 */
 
25
if( !defined('QP_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
 
26
 
 
27
$wiCache = get_Cache('WidgetCache');
 
28
$wiCache->load_widget( 'item_list' );
 
29
 
 
30
/**
 
31
 * linkblog_widget class
 
32
 *
 
33
 * This widget displays another blog as a linkblog.
 
34
 *
 
35
 * @package widgets
 
36
 */
 
37
class linkblog_Widget extends item_list_Widget
 
38
{
 
39
        /**
 
40
         * Constructor
 
41
         */
 
42
        function linkblog_Widget( $db_row = NULL )
 
43
        {
 
44
                // Call parent constructor:
 
45
                parent::ComponentWidget( $db_row, 'widget', 'linkblog' );
 
46
 
 
47
                $this->widget_name = $this->T_('Simple Linkblog Links list');
 
48
                $this->widget_title = $this->T_('Linkblog');
 
49
        }
 
50
 
 
51
 
 
52
        /**
 
53
         * Get definitions for editable params
 
54
         *
 
55
         * @see Plugin::GetDefaultSettings()
 
56
         * @param local params like 'for_editing' => true
 
57
         */
 
58
        function get_param_definitions( $params )
 
59
        {
 
60
                // This is derived from post_list_Widget, so we DO NOT ADD ANY param here!
 
61
                $r = parent::get_param_definitions( $params );
 
62
                // We only change the defaults and hide some params.
 
63
                $r['title_link']['no_edit'] = true;
 
64
                $r['follow_mainlist']['no_edit'] = true;
 
65
                $r['blog_ID']['defaultvalue'] = 0;              // zero is a magic number that we'll use to try and use defaults used in previous versions of B2evo
 
66
                $r['item_group_by']['defaultvalue'] = 'chapter';
 
67
                $r['item_title_link_type']['no_edit'] = true;
 
68
                $r['disp_excerpt']['no_edit'] = true;
 
69
                $r['disp_teaser']['no_edit'] = true;
 
70
                $r['disp_teaser_maxwords']['no_edit'] = true;
 
71
                $r['widget_css_class']['no_edit'] = true;
 
72
                $r['widget_ID']['no_edit'] = true;
 
73
 
 
74
                return $r;
 
75
        }
 
76
 
 
77
 
 
78
        /**
 
79
         * Get a very short desc. Used in the widget list.
 
80
         */
 
81
        function get_short_desc()
 
82
        {
 
83
                return format_to_output($this->disp_params['widget_title']);
 
84
        }
 
85
 
 
86
 
 
87
        /**
 
88
         * Get short description
 
89
         */
 
90
        function get_desc()
 
91
        {
 
92
                return $this->T_('Simplified Item list for listing links from another blog.');
 
93
        }
 
94
 
 
95
 
 
96
        /**
 
97
         * Display the widget!
 
98
         *
 
99
         * @param array MUST contain at least the basic display params
 
100
         */
 
101
        function display( $params )
 
102
        {
 
103
                global $Blog;
 
104
 
 
105
                $this->init_display( $params );
 
106
 
 
107
                // Force some params (because this is a simplified widget):
 
108
 
 
109
                if( $this->disp_params['blog_ID'] == 0 )
 
110
                {       // We want to try and use previous defaults:
 
111
                        if( !empty( $this->disp_params['linkblog_ID'] ) )
 
112
                        {
 
113
                                $params['blog_ID'] = $this->disp_params['linkblog_ID'];
 
114
                        }
 
115
                        else
 
116
                        { // Recycle the previous value from deprecated links_blog_ID param. We will eventually drop that field from the database.
 
117
                                $params['blog_ID'] = $Blog->get('links_blog_ID');
 
118
                        }
 
119
                }
 
120
 
 
121
                parent::display( $params );
 
122
 
 
123
                return true;
 
124
        }
 
125
}
 
126
 
 
127
 
 
128
?>