~quam-plures-gatekeepers/quam-plures/trunk

« back to all changes in this revision

Viewing changes to qp_inc/templates/model/_template.class.php

  • Committer: EdB
  • Date: 2015-01-11 21:06:42 UTC
  • Revision ID: 1912webworks@gmail.com-20150111210642-dmxpswipw0kk34fq
tweaks along the way to QP2, copyright year

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *
5
5
 * @todo (1111) vars here are missing a title - they only have an at-var tag :(
6
6
 *
7
 
 * @copyright (c) 2014 by {@link http://quamplures.net/ the Quam Plures project}
 
7
 * @copyright (c) 2009 by {@link http://quamplures.net/ the Quam Plures project}
8
8
 * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License v3
9
9
 * @package templates
10
10
 */
29
29
         */
30
30
        var $container_list = NULL;
31
31
        /**
32
 
         * FIX THIS
 
32
         * Container Order
33
33
         * @var array Template's ordering of containers, mostly for the Widgets page
34
34
         */
35
35
        var $container_order = NULL;
49
49
         */
50
50
        var $poweredby_linkback;
51
51
        /**
52
 
         * FIX THIS
 
52
         * Template's Type
53
53
         * @var array Type of template (xhtml, html5, feed, other)
54
54
         */
55
55
        var $type;
 
56
        /**
 
57
         * Template's Version
 
58
         * @var string use "date(yz)+1" on release day for the template
 
59
         */
 
60
        var $version;
56
61
 
57
62
        /**
58
63
         * Constructor
95
100
                {
96
101
                        // Wa are loading an object
97
102
                        $this->ID = $db_row->template_ID;
 
103
                        $this->folder = $db_row->template_folder;
98
104
                        $this->name = $db_row->template_name;
99
 
                        $this->folder = $db_row->template_folder;
100
105
                        $this->type = $db_row->template_type;
101
106
                }
102
107
 
217
222
                        debug_die( 'Different number of ontainers discovered and those listed in this template\'s class file.' );
218
223
                }
219
224
 
220
 
 
221
225
                // if list and database are the same length then we changed either name(s) or order
222
226
                if( count( $this->container_list ) == count( $db_container_list ) )
223
227
                {
831
835
 
832
836
 
833
837
        /**
 
838
         * Get definitions for editable params
 
839
         *
 
840
         * @todo this is destined to be overridden by derived Template classes
 
841
         * @see Plugin::GetDefaultSettings()
 
842
         * @param local params like 'for_editing' => true
 
843
         */
 
844
        function get_param_definitions( $params )
 
845
        {
 
846
                $r = array();
 
847
                return $r;
 
848
        }
 
849
 
 
850
 
 
851
        /**
 
852
         * Get a template-specific param value from current Blog
 
853
         */
 
854
        function get_setting( $parname )
 
855
        {
 
856
                global $Blog;
 
857
 
 
858
                // Name of the setting in the blog settings
 
859
                $blog_setting_name = 'template'.$this->ID.'_'.$parname;
 
860
 
 
861
                $value = $Blog->get_setting( $blog_setting_name );
 
862
 
 
863
                if( ! is_null( $value ) )
 
864
                {
 
865
                        // We have a value for this param
 
866
                        return $value;
 
867
                }
 
868
 
 
869
                // Try default values
 
870
                $params = $this->get_param_definitions( NULL );
 
871
                if( isset( $params[$parname]['defaultvalue'] ) )
 
872
                {
 
873
                        // We have a default value
 
874
                        return $params[$parname]['defaultvalue'] ;
 
875
                }
 
876
 
 
877
                return NULL;
 
878
        }
 
879
 
 
880
 
 
881
        /**
834
882
         * Get credits for linkback on credits page
835
883
         *
836
884
         * Each template can and should provide an array for credits for domains/authors
865
913
 
866
914
 
867
915
        /**
868
 
         * Get definitions for editable params
869
 
         *
870
 
         * @todo this is destined to be overridden by derived Template classes
871
 
         * @see Plugin::GetDefaultSettings()
872
 
         * @param local params like 'for_editing' => true
873
 
         */
874
 
        function get_param_definitions( $params )
875
 
        {
876
 
                $r = array();
877
 
                return $r;
878
 
        }
879
 
 
880
 
 
881
 
        /**
882
 
         * Get a template-specific param value from current Blog
883
 
         */
884
 
        function get_setting( $parname )
885
 
        {
886
 
                global $Blog;
887
 
 
888
 
                // Name of the setting in the blog settings
889
 
                $blog_setting_name = 'template'.$this->ID.'_'.$parname;
890
 
 
891
 
                $value = $Blog->get_setting( $blog_setting_name );
892
 
 
893
 
                if( ! is_null( $value ) )
894
 
                {
895
 
                        // We have a value for this param
896
 
                        return $value;
897
 
                }
898
 
 
899
 
                // Try default values
900
 
                $params = $this->get_param_definitions( NULL );
901
 
                if( isset( $params[$parname]['defaultvalue'] ) )
902
 
                {
903
 
                        // We have a default value
904
 
                        return $params[$parname]['defaultvalue'] ;
905
 
                }
906
 
 
907
 
                return NULL;
908
 
        }
909
 
 
910
 
 
911
 
        /**
912
916
         * Install current template to DB
913
917
         *
914
918
         * @return boolean True on success, false on failure.