• R/O
  • SSH
  • HTTPS

jeanscms: コミット


コミットメタ情報

リビジョン272 (tree)
日時2010-09-13 04:05:49
作者kmorimatsu

ログメッセージ

jp_Nucleus ver 0.2.0

変更サマリ

差分

--- plugins/Nucleus/tags/v020/jp_Nucleus.php (nonexistent)
+++ plugins/Nucleus/tags/v020/jp_Nucleus.php (revision 272)
@@ -0,0 +1,33 @@
1+<?php
2+/*
3+ * Jeans CMS (GPL license)
4+ * $Id$
5+ */
6+
7+class jp_Nucleus extends plugin{
8+ static public function name(){
9+ return 'Nucleus skin Plugin';
10+ }
11+ static public function author(){
12+ return 'Katsumi';
13+ }
14+ static public function url(){
15+ return 'http://jeanscms.sourceforge.jp/';
16+ }
17+ static public function desc(){
18+ return '_JP_NUCLEUS_DESC';
19+ }
20+ static public function version(){
21+ return '0.2';
22+ }
23+ static public function if_skin(&$data,$type,$p1=false,$p2=false){
24+ $args=array(&$data,$p1,$p2);
25+ $method=array('jp_Nucleus_skin','if_'.$type);
26+ return call_user_func_array($method,$args);
27+ }
28+ static public function if_template(&$data,$type,$p1=false,$p2=false){
29+ $args=array(&$data,$p1,$p2);
30+ $method=array('jp_Nucleus_template','if_'.$type);
31+ return call_user_func_array($method,$args);
32+ }
33+}
\ No newline at end of file
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
--- plugins/Nucleus/tags/v020/nucleus/language/english.php (nonexistent)
+++ plugins/Nucleus/tags/v020/nucleus/language/english.php (revision 272)
@@ -0,0 +1,9 @@
1+<?php
2+define('_JP_NUCLEUS_DESC','This is to support Nucleus skins.');
3+define('_JP_NUCLEUS_NOTHING_TO_CONVERT','Nothing to convert');
4+define('_JP_NUCLEUS_CONVERT_TO_JEANS_SKIN','Convert Nucleus skin to Jeans skin');
5+define('_JP_NUCLEUS_CONVERT','Convert');
6+define('_JP_NUCLEUS_CONVERETED','<%0%> was convereted to Jeans skin.');
7+define('_JP_NUCLEUS_FAILED','Conversion of <%0%> was failed. Please confirm that the permission of directory is writable value.');
8+define('_JP_NUCLEUS_SKINBACKUP_DOES_NOT_EXIST','skinbackup.xml does not exist.');
9+define('_JP_NUCLEUS_NOTE','If the Nucleus skin to be convereted does not appear in the selection list, please confirm that skinbackup.xml exists in the skin directory and that skin.inc does not exist in the directory');
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
--- plugins/Nucleus/tags/v020/nucleus/language/japanese.php (nonexistent)
+++ plugins/Nucleus/tags/v020/nucleus/language/japanese.php (revision 272)
@@ -0,0 +1,9 @@
1+<?php
2+define('_JP_NUCLEUS_DESC','このプラグインは、Nucleusのスキンをサポートするためのものです。');
3+define('_JP_NUCLEUS_NOTHING_TO_CONVERT','変換するものは何もありません');
4+define('_JP_NUCLEUS_CONVERT_TO_JEANS_SKIN','NucleusのスキンをJeansのスキンに変換');
5+define('_JP_NUCLEUS_CONVERT','変換');
6+define('_JP_NUCLEUS_CONVERETED','<%0%>をJeans用のスキンに変換しました。');
7+define('_JP_NUCLEUS_FAILED','<%0%>の変換に失敗しました。ディレクトリのパーミッションが読み書き可能な値になっているかどうかを、確認してください。');
8+define('_JP_NUCLEUS_SKINBACKUP_DOES_NOT_EXIST','skinbackup.xmlが見つかりません。');
9+define('_JP_NUCLEUS_NOTE','変換すべきNucleusスキンが選択肢に現れない場合は、そのスキンのディレクトリにskinbackup.xmlが存在していることと、skin.incが無いことを確認してください。');
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
--- plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_admin.php (nonexistent)
+++ plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_admin.php (revision 272)
@@ -0,0 +1,160 @@
1+<?php
2+
3+class jp_Nucleus_admin extends jeans {
4+ static public function init(){
5+ if (!member::is_admin()) {
6+ error::quit('_ADMIN_NO_PERMISSION');
7+ }
8+ }
9+ static public function tag_nucskinlist(&$data,$skin=false){
10+ $array=array();
11+ $skins=dir(_DIR_SKINS);
12+ while($skin=$skins->read()){
13+ if (!preg_match('/^[a-z0-9]+$/',$skin)) continue;
14+ if (!self::local_file_exists(_DIR_SKINS,$skin.'/skinbackup.xml')) continue;
15+ if (self::local_file_exists(_DIR_SKINS,$skin.'/skin.inc')) continue;
16+ $array[]=array('name'=>$skin);
17+ }
18+ view::show_using_array($data,$array,$skin);
19+ }
20+ static public function action_post_convert(){
21+ $skin=$_POST['jp_nucleus_skin_name'];
22+ $xml=self::local_file_contents(_DIR_SKINS,$skin.'/skinbackup.xml');
23+ if (!$xml) {
24+ return error::note('_JP_NUCLEUS_SKINBACKUP_DOES_NOT_EXIST');
25+ }
26+ $xml=new SimpleXMLElement($xml);
27+ // Convert skin scripts
28+ self::convert_skin($skin,$xml);
29+ // Convert template scripts
30+ self::convert_template($skin,$xml);
31+ // Finally, create skin.inc
32+ self::skin_inc($skin);
33+ // All done.
34+ if (self::local_file_exists(_DIR_SKINS,$skin.'/skin.inc')) {
35+ error::note('_JP_NUCLEUS_CONVERETED',$skin);
36+ } else {
37+ error::note('_JP_NUCLEUS_FAILED',$skin);
38+ }
39+ }
40+ static private function convert_skin($skin,$xml){
41+ $skins=array();
42+ foreach(array('archive','archivelist','error','imagepopup','item','member','search') as $type){
43+ $skins[$type]='<%view.include(jindex.inc)%>';
44+ }
45+ foreach($xml->skin->part as $part){
46+ $skins[(string)$part['name']]=(string)$part;
47+ }
48+ foreach($skins as $file=>$script){
49+ file_put_contents(_DIR_SKINS.$skin.'/j'.$file.'.inc',$script);
50+ }
51+ }
52+ static private function convert_template($skin,$xml){
53+ @mkdir(_DIR_SKINS.$skin.'/templates');
54+ foreach($xml->template as $template){
55+ $prefix=preg_replace('/[^a-zA-Z0-9]/','_',(string)$template['name']).'_';
56+ // Pickup all template entries
57+ self::$templates=array();
58+ foreach($template->part as $part){
59+ self::$templates[(string)$part['name']]=(string)$part;
60+ }
61+ // Just a tiny modification for archivelist template
62+ if (isset(self::$templates['ARCHIVELIST_LISTITEM'])) {
63+ self::$templates['ARCHIVELIST_LISTITEM']=preg_replace('/([^<])(%[a-zA-Z])/','$1<%date.strftime($2)%>',self::$templates['ARCHIVELIST_LISTITEM']);
64+ }
65+ // Construct template inc files.
66+ self::template_item($skin,$prefix);
67+ self::template_comment($skin,$prefix);
68+ self::template_archivelist($skin,$prefix);
69+ self::template_bloglist($skin,$prefix);
70+ self::template_catlist($skin,$prefix);
71+ }
72+ }
73+ static private $templates=array();
74+ static private function addtab($type,$key1,$key2=false,$key3=false){
75+ if (isset(self::$templates[$key1])) $text=self::$templates[$key1];
76+ else $text='';
77+ if ($key2 && isset(self::$templates[$key2])) $text.=self::$templates[$key2];
78+ if ($key3 && isset(self::$templates[$key3])) $text.=self::$templates[$key3];
79+ if (strlen($text)==0) return '';
80+ $text=preg_replace('/(^|\r|\n)([^\r\n])/','$1'."\t".'$2',$text);
81+ return "<%case($type)%>\n$text\n";
82+ }
83+ static private function template_item($skin,$prefix){
84+ $script='';
85+ $script.=self::addtab('body','ITEM_HEADER','ITEM','ITEM_FOOTER');
86+ $script.=self::addtab('more','MORELINK');
87+ $script.=self::addtab('edit','EDITLINK');
88+ $script.=self::addtab('new','NEW');
89+ $script.=self::addtab('date','DATE_HEADER','FORMAT_DATE','DATE_FOOTER');
90+ $script.=self::addtab('time','FORMAT_TIME');
91+ if (strlen($script)==0) return;
92+ $script="<%select(template)%>\n$script<%endselect%>";
93+ file_put_contents(_DIR_SKINS.$skin.'/templates/'.$prefix.'item.inc',$script);
94+ }
95+ static private function template_comment($skin,$prefix){
96+ $script='';
97+ $script.=self::addtab('head','COMMENTS_HEADER');
98+ $script.=self::addtab('body','COMMENTS_BODY');
99+ $script.=self::addtab('foot','COMMENTS_FOOTER');
100+ $script.=self::addtab('none','COMMENTS_NONE');
101+ $script.=self::addtab('one','COMMENTS_ONE');
102+ $script.=self::addtab('two','COMMENTS_CONTINUED');
103+ $script.=self::addtab('many','COMMENTS_TOOMUCH');
104+ $script.=self::addtab('auth','COMMENTS_AUTH');
105+ if (strlen($script)==0) return;
106+ $script="<%select(template)%>\n$script<%endselect%>";
107+ file_put_contents(_DIR_SKINS.$skin.'/templates/'.$prefix.'comment.inc',$script);
108+ }
109+ static private function template_archivelist($skin,$prefix){
110+ $script='';
111+ $script.=self::addtab('head','ARCHIVELIST_HEADER');
112+ $script.=self::addtab('body','ARCHIVELIST_LISTITEM');
113+ $script.=self::addtab('foot','ARCHIVELIST_FOOTER');
114+ if (strlen($script)==0) return;
115+ $script="<%select(template)%>\n$script<%endselect%>";
116+ file_put_contents(_DIR_SKINS.$skin.'/templates/'.$prefix.'archivelist.inc',$script);
117+ }
118+ static private function template_bloglist($skin,$prefix){
119+ $script='';
120+ $script.=self::addtab('head','BLOGLIST_HEADER');
121+ $script.=self::addtab('body','BLOGLIST_LISTITEM');
122+ $script.=self::addtab('foot','BLOGLIST_FOOTER');
123+ if (strlen($script)==0) return;
124+ $script="<%select(template)%>\n$script<%endselect%>";
125+ file_put_contents(_DIR_SKINS.$skin.'/templates/'.$prefix.'bloglist.inc',$script);
126+ }
127+ static private function template_catlist($skin,$prefix){
128+ $script='';
129+ $script.=self::addtab('head','CATLIST_HEADER');
130+ $script.=self::addtab('body','CATLIST_LISTITEM');
131+ $script.=self::addtab('foot','CATLIST_FOOTER');
132+ if (strlen($script)==0) return;
133+ $script="<%select(template)%>\n$script<%endselect%>";
134+ file_put_contents(_DIR_SKINS.$skin.'/templates/'.$prefix.'catlist.inc',$script);
135+ }
136+
137+ static private function skin_inc($skin){
138+ $script=
139+'<%using(jp.nucleus.skin,jp.nucleus.template)%>
140+<%select(template)%>
141+<%case(item)%>
142+<%view.parse(jitem.inc)%>
143+<%case(archive)%>
144+<%view.parse(jarchive.inc)%>
145+<%case(archivelist)%>
146+<%view.parse(jarchivelist.inc)%>
147+<%case(search)%>
148+<%view.parse(jsearch.inc)%>
149+<%case(member)%>
150+<%view.parse(jmember.inc)%>
151+<%case(imagepopup)%>
152+<%view.parse(jimagepopup.inc)%>
153+<%case(error)%>
154+<%view.parse(jerror.inc)%>
155+<%case.else%>
156+<%view.parse(jindex.inc)%>
157+<%endselect%>';
158+ file_put_contents(_DIR_SKINS.$skin.'/skin.inc',$script);
159+ }
160+}
\ No newline at end of file
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
--- plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_skin.php (nonexistent)
+++ plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_skin.php (revision 272)
@@ -0,0 +1,471 @@
1+<?php
2+/*
3+ * Notes:
4+ *
5+ * The template must be stored in skin directry as follows.
6+ * For example, 'default/index' will be changed to 'templates/default_index_item.inc' etc.
7+ */
8+
9+class jp_Nucleus_skin extends jeans {
10+ static private function convert_template($skin,$type){
11+ if (substr($skin,-4)=='.inc') return $skin;
12+ return 'templates/'.preg_replace('/[^a-zA-Z0-9]/','_',$skin)."_$type.inc";
13+ }
14+ static public function tag_additemform(&$data){
15+ view::tag_parse($data,'/jp/nucleus/forms/additemform.inc');
16+ }
17+ static public function tag_addlink(&$data){
18+ if (!member::is_admin()) return;
19+ self::p(_CONF_URL_ADMIN.'?page=edititem&itemid=0&sgid='.group::setting('id'));
20+ }
21+ static public function tag_addpopupcode(&$data){
22+ ?>
23+ if (event &amp;&amp; event.preventDefault) event.preventDefault();
24+ winbm=window.open(this.href,&amp;jeansbm&amp;,&amp;scrollbars=yes,width=600,height=500,left=10,top=10,status=yes,resizable=yes&amp;);
25+ winbm.focus();
26+ return false;
27+ <?php
28+ }
29+ static public function tag_adminurl(&$data){
30+ self::p(_CONF_URL_ADMIN);
31+ }
32+ static public function tag_archive(&$data,$skin,$category=false,$blogid=false){
33+ $skin=self::convert_template($skin,'item');
34+ if ($category) {
35+ $temp_globals=new jp_Nucleus_temp_global('_GET','sgid',$category);
36+ }
37+ blog::tag_narrowby($data,'archive');
38+ self::blog($data,$skin,$blogid);
39+ }
40+ static public function tag_archivedate(&$data,$locale=false,$format=false){
41+ if (!$format) {
42+ switch(strlen($_GET['archive'])){
43+ case 4:
44+ $format='%Y';
45+ break;
46+ case 7:
47+ $format='%m/%Y';
48+ break;
49+ case 10:
50+ $format='%m/%d/%Y';
51+ }
52+ }
53+ blog::tag_archivedate($data,$format);
54+ }
55+ static public function tag_archivedaylist(&$data){
56+ self::tag_archivelist($data,$template,false,'day');
57+ }
58+ static public function tag_archivelink(&$data,$linktext=false){
59+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_archivelink($data);
60+ $url=view::create_link(array('archivelist'=>blog::setting('id')));
61+ if ($linktext==false) $html='<%url%>';
62+ else $html='<a href="<%url%>"><%text%></a>';
63+ $array=array('url'=>$url,'text'=>$linktext);
64+ self::echo_html($html,$array);
65+ }
66+ static public function tag_archivelist(&$data,$template,$blogid=false,$mode='month'){
67+ $skin=self::convert_template($template,'archivelist');
68+ $ut=new jp_nucleus_use_template($data);
69+ blog::tag_archivelist($data,$skin,$blogid,$mode);
70+ }
71+ static public function tag_archivetype(&$data){
72+ /*Skinvar: archivetype
73+ Either day or month, indicating which type of archive is currently being shown
74+ Arguments
75+ None
76+ Skintypes
77+ archive*/
78+ switch(strlen($_GET['archive'])){
79+ case 4:
80+ return self::t('_JEANS_YEAR');
81+ case 7:
82+ return self::t('_JEANS_MONTH');
83+ case 10:
84+ return self::t('_JEANS_DAY');
85+ }
86+ self::p("<%archivetype%>","hsc");
87+ }
88+ static public function tag_archiveyearlist(&$data){
89+ self::tag_archivelist($data,$template,false,'year');
90+ }
91+ static public function tag_blog(&$data,$template,$amount=10,$category=false,$blogid=false){
92+ $skin=self::convert_template($template,'item');
93+ if ($category) {
94+ $temp_globals=new jp_Nucleus_temp_global('_GET','sgid',$category);
95+ }
96+ blog::tag_narrowby($data,'category');
97+ self::blog($data,$skin,$blogid,$amount);
98+ }
99+ static private function blog(&$data,$skin,$blogid=false,$amount=10){
100+ $ut=new jp_nucleus_use_template($data);
101+ blog::tag_blog($data,$skin,$amount,true,$blogid);
102+ }
103+ static private function usetemplate(&$data){
104+ return !empty($data['jp']['nucleus']['usetemplate']);
105+ }
106+ static public function tag_bloglist(&$data,$template){
107+ /*Skinvar: bloglist
108+ * Optional parameters, bnametype, orderby, and direction cannot be used.
109+ */
110+ $ut=new jp_nucleus_use_template($data);
111+ $skin=self::convert_template($template,'bloglist');
112+ blog::tag_bloglist($data,$skin);
113+ }
114+ static public function tag_blogsetting(&$data,$type){
115+ /*Skinvar: blogsetting
116+ $type: either id, url, name, or desc (short cannot be used)
117+ */
118+ self::p(blog::setting($type));
119+ }
120+ static public function tag_category(&$data,$type='name'){
121+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_category($data);
122+ blog::tag_sgsetting($data,$type);
123+ }
124+ static public function tag_categorylist(&$data,$template,$blogid=false){
125+ /*Skinvar: categorylist
126+ blogname cannot be used. Instead, use blogid.
127+ */
128+ $ut=new jp_nucleus_use_template($data);
129+ $blogid=blog::setting('id',$blogid);
130+ $data['jp']['nucleus']['blogid']=$blogid;
131+ $skin=self::convert_template($template,'catlist');
132+ blog::tag_categorylist($data,$skin,$blogid);
133+ }
134+ static public function tag_charset(&$data){
135+ self::p('UTF-8');
136+ }
137+ static public function tag_commentform(&$data){
138+ /*Skinvar: commentform
139+ * destinationurl is not supported
140+ */
141+ view::tag_parse($data,'/jp/nucleus/forms/commentform.inc');
142+ }
143+ static public function tag_comments(&$data,$skin_or_maxtoshow=false){
144+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_comments($data,$skin_or_maxtoshow);
145+ $ut=new jp_nucleus_use_template($data);
146+ comments::tag_comments($data,self::convert_template($skin_or_maxtoshow,'comment'));
147+ }
148+ static public function tag_error(&$data){
149+ return self::tag_errormessage($data);
150+ }
151+ static public function tag_errormessage(&$data){
152+ self::p(implode("\n",error::get_note()));
153+ }
154+ static public function tag_image(&$data,$type='imgtag'){
155+ /*Skinvar: image
156+ * The type is fixed to 'imgtag'.
157+ */
158+ if (showmedia::if_popupdb()) return showmedia::tag_imgdb($data);
159+ else return showmedia::tag_img($data);
160+ }
161+ static public function tag_imagepopup(&$data){
162+ }
163+ static public function tag_imagetext(&$data){
164+ showmedia::tag_popuptext();
165+ }
166+ static public function tag_include(&$data,$skin){
167+ view::tag_include($data,$skin,'html');
168+ }
169+ static public function tag_item(&$data,$template){
170+ $ut=new jp_nucleus_use_template($data);
171+ item::tag_item($data,self::convert_template($template,'item'));
172+ }
173+ static public function tag_itemid(&$data){
174+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_itemid($data);
175+ item::tag_data($data,'id');
176+ }
177+ static public function tag_itemlink(&$data){
178+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_itemlink($data);
179+ item::tag_data($data,'link');
180+ }
181+ static public function tag_itemtitle(&$data){
182+ if (self::usetemplate($data)) return jp_Nucleus_template::tag_itemtitle($data);
183+ item::tag_data($data,'title');
184+ }
185+ static public function tag_loginform(&$data){
186+ view::tag_parse($data,'/jp/nucleus/forms/loginform.inc');
187+ }
188+ static public function tag_member(&$data,$type){
189+ /*Skinvar: member
190+ * The types, yournotes and notes cannot be used.
191+ */
192+ if (preg_match('/^your([a-z]+)$/',$type,$m)) {
193+ $memberinfo=false;
194+ $type=strtolowerer($m[1]);
195+ } else {
196+ $memberinfo=true;
197+ $type=strtolower($type);
198+ }
199+ switch($type){
200+ case 'realname':
201+ $type='name';
202+ break;
203+ case 'url':
204+ $type='web';
205+ break;
206+ default:
207+ break;
208+ }
209+ if ($memberinfo) memberinfo::tag_memberinfo($data,$type);
210+ else member::tag_setting($data,$type);
211+ }
212+ static public function tag_membermailform(&$data){
213+ /*Skinvar: membermailform
214+ * The options, rows, cols, and destinaion cannot be used.
215+ */
216+ view::tag_parse($data,'/jp/nucleus/forms/membermailform.inc');
217+ }
218+ static public function tag_nextarchive(&$data){
219+ /*Skinvar: nextarchive
220+ * This skin var is not supported.
221+ * Instead, use <%nextlink%>
222+ */
223+ self::p("<%nextarchive%>","hsc");
224+ }
225+ static public function tag_nextitem(&$data){
226+ item::tag_newer($data,'id');
227+ }
228+ static public function tag_nextitemtitle(&$data){
229+ item::tag_newer($data,'title');
230+ }
231+ static public function tag_nextlink(&$data,$linktext=false){
232+ if ($linktext!==false) self::echo_html('<a href="');
233+ if (isset($_GET['itemid'])) item::tag_newer($data,'link');
234+ elseif (isset($_GET['archive'])) blog::tag_archivelink($data,'newer');
235+ if ($linktext!==false) self::echo_html('"><%0%></a>',$linktext);
236+ }
237+ static public function tag_nucleusbutton(&$data,$file='/jeans/images/jeans.gif',$width=85,$height=31){
238+ $array=array('file'=>view::skinfile($data,$file), 'width'=>$width, 'height'=>$height);
239+ $html='<a href="http://jeanscms.sourceforge.jp/">';
240+ $html.='<img src="<%file%>" alt="Jeans button" width="<%width%>" height="<%height%>" />';
241+ $html.='</a>';
242+ self::echo_html($html,$array);
243+ }
244+ static public function tag_otherarchive(&$data,$blogid,$template,$category=false){
245+ self::tag_archive($data,$template,$category,$blogid);
246+ }
247+ static public function tag_otherarchivedaylist(&$data,$blogid,$template){
248+ self::tag_archivelist($data,$template,$blogid,'day');
249+ }
250+ static public function tag_otherarchivelist(&$data,$blogid,$template){
251+ self::tag_archivelist($data,$template,$blogid);
252+ }
253+ static public function tag_otherarchiveyearlist(&$data,$blogid,$template){
254+ self::tag_archivelist($data,$template,$blogid,'year');
255+ }
256+ static public function tag_otherblog(&$data,$blogid,$template,$amount=10,$category=false){
257+ self::tag_blog($data,$template,$amount,$category,$blogid);
258+ }
259+ static public function tag_othersearchresults(&$data,$blogid,$template,$limit=10,$category=false){
260+ blog::tag_narrowby($data,'search');
261+ self::tag_blog($data,$template,$limit,$category,$blogid);
262+ }
263+ static public function tag_parsedinclude(&$data,$skin){
264+ /*Skin/Templatevar: parsedinclude
265+ Includes a file into the output. The contents of the file is parsed by the Nucleus skin/template parser, so you can use skin/templatevars. (see phpinclude and include for other include options)
266+ Arguments
267+ filename: the name of the file to be included (either relative to the position of index.php, or absolute)
268+ Notes
269+ This tag is affected by the parser settings IncludeMode and IncludePrefix
270+ From inside the included file, you can call <%parsedinclude(filename)%> again. To avoid endless loops, the maximum depth level you can go is 3.
271+ Skintypes
272+ all
273+ Examples
274+ <%parsedinclude(filename.txt)%>
275+ <%parsedinclude(/home/user/myself/filename.txt)%>*/
276+ view::tag_parse($data,$skin);
277+ }
278+ static public function tag_phpinclude(&$data,$skin){
279+ /*Skin/Templatevar: phpinclude
280+ Includes a php-file into the output. The contents of the file is parsed by the PHP parser, so be careful. Nucleus skin/templatevars are not parsed! (see parsedinclude and include for other include options).
281+ Arguments
282+ filename: the name of the file to be included (either relative to the position of index.php, or absolute)
283+ Notes
284+ This tag is affected by the parser settings IncludeMode and IncludePrefix
285+ Your file will be included using the standard php include() command. This command will be called from inside a class method, so you'll need to declare which global variables you want to access yourself. Most of the standard variables are automatically declared global by Nucleus itself.
286+ Skintypes
287+ all
288+ Examples
289+ <%phpinclude(filename.php)%>
290+ <%phpinclude(/home/user/myself/filename.php)%>*/
291+ view::tag_parse($data,$skin);
292+ }
293+ static public function tag_plugin(&$data){
294+ /*Skin/Templatevar: plugin
295+ * This skinvar is not supported.
296+ * Instead, use <%jp.xxxxx%>
297+ */
298+ self::p("<%plugin%>","hsc");
299+ }
300+ static public function tag_prevarchive(&$data){
301+ /*Skinvar: prevarchive
302+ * This skinvar is not supported.
303+ * Instead, use <%prevlink%>
304+ */
305+ self::p("<%prevarchive%>","hsc");
306+ }
307+ static public function tag_preview(&$data){
308+ /*
309+ * This skinvar is not supported
310+ */
311+ self::p("<%preview%>","hsc");
312+ }
313+ static public function tag_previtem(&$data){
314+ item::tag_older($data,'id');
315+ }
316+ static public function tag_previtemtitle(&$data){
317+ item::tag_older($data,'title');
318+ }
319+ static public function tag_prevlink(&$data,$linktext=false){
320+ if ($linktext!==false) self::echo_html('<a href="');
321+ if (isset($_GET['itemid'])) item::tag_older($data,'link');
322+ elseif (isset($_GET['archive'])) blog::tag_archivelink($data,'older');
323+ if ($linktext!==false) self::echo_html('"><%0%></a>',$linktext);
324+ }
325+ static public function tag_query(&$data){
326+ self::p($_GET['query_text'],'hsc');
327+ }
328+ static public function tag_referer(&$data){
329+ if (isset($_SERVER['HTTP_REFERER'])) self::p($_SERVER['HTTP_REFERER']);
330+ }
331+ static public function tag_searchform(&$data,$gid=0){
332+ if ($gid) view::tag_parse($data,'/jp/nucleus/forms/searchform.inc',$gid);
333+ else view::tag_parse($data,'/jp/nucleus/forms/searchform.inc');
334+ }
335+ static public function tag_searchresults(&$data,$template,$limit=10){
336+ blog::tag_narrowby($data,'search');
337+ self::tag_blog($data,$template,$limit);
338+ }
339+ static public function tag_self(&$data){
340+ self::p(_CONF_SELF);
341+ }
342+ static public function tag_set(&$data){
343+ /*
344+ * This skinvar is not supported.
345+ */
346+ self::p("<%set%>","hsc");
347+ }
348+ static public function tag_sitevar(&$data,$type){
349+ switch($type){
350+ case 'url':
351+ return self::p(_CONF_URL_INDEX);
352+ case 'name':
353+ return self::p(_CONF_SITE_NAME);
354+ case 'admin':
355+ return self::p(_CONF_ADMIN_EMAIL);
356+ }
357+ }
358+ static public function tag_skinfile(&$data,$filename){
359+ return view::tag_skinfile($data,$filename);
360+ }
361+ static public function tag_skinname(&$data){
362+ if (preg_match('#$/([^/]+)/#',$data['skin'],$m)) self::p($m[1]);
363+ }
364+ static public function tag_sticky(&$data,$itemid,$template){
365+ $ut=new jp_nucleus_use_template($data);
366+ $skin=self::convert_template($template,'item');
367+ $query=self::query_select('i.id=<%itemid%> AND NOT (i.flags & <%const:sql::FLAG_INVALID%>)');
368+ $array=array('itemid'=>$itemid);
369+ view::show_using_query($data,$query,$array,$skin,array('blog','_blog_cb'),array('blog','_blog_cb2'));
370+ }
371+ static public function tag_todaylink(&$data,$linktext=false){
372+ if ($linktext==false) $html='<%url%>';
373+ else $html='<a href="<%url%>"><%text%></a>';
374+ $array=array('url'=>blog::setting('url'),'text'=>$linktext);
375+ self::echo_html($html,$array);
376+ }
377+ static public function tag_version(&$data){
378+ self::p('Jeans CMS ver '._JEANS_VERSION);
379+ }
380+/*
381+ * Skinvars: if/ifnot/else/elseif/elseifnot/endif
382+ * hasplugin and PluginName are not supported.
383+ */
384+ static public function if_nextitem(&$data){
385+ return item::if_neweris($data);
386+ }
387+ static public function if_previtem(&$data){
388+ return item::if_olderis($data);
389+ }
390+ static public function if_blogsetting(&$data,$key,$value){
391+ return blog::setting($key)==$value;
392+ }
393+ static public function if_category(&$data,$type=false,$value=false){
394+ switch($type){
395+ case 'catid':
396+ return blog::sgsetting('id')==$value;
397+ case 'catname':
398+ return blog::sgsetting('name')==$value;
399+ case false:
400+ default:
401+ return 0<blog::sgsetting('id');
402+ }
403+ }
404+ static public function if_skintype(&$data,$type){
405+ return blog::if_skintype($data,$type);
406+ }
407+ static public function if_loggedin(){
408+ return member::logged_in();
409+ }
410+ static public function if_archiveprevexists(&$data){
411+ /*
412+ * Not yet implemented
413+ */
414+ return true;
415+ }
416+ static public function if_archivenextexists(&$data){
417+ /*
418+ * Not yet implemented
419+ */
420+ return true;
421+ }
422+ static public function if_admin(){
423+ return member::is_admin();
424+ }
425+ static public function if_onteam(){
426+ return member::is_admin();
427+ }
428+ static public function if_hasplugin(){
429+ return false;
430+ }
431+}
432+
433+class jp_Nucleus_temp_global {
434+ /*
435+ * Usage: new jp_Nucleus_temp_global(var,key,value[,var,key,value[,var,key,value ... ]]])
436+ * For example,
437+ * $temp_globals=new jp_Nucleus_temp_global('_GET','sgid',$category);
438+ */
439+ private $org_globals=array(),$args;
440+ public function __construct(){
441+ $this->args=$args=func_get_args();
442+ while(2<count($args)){
443+ $var=array_shift($args);
444+ $key=array_shift($args);
445+ $value=array_shift($args);
446+ if (!isset($this->org_globals[$var])) $this->org_globals[$var]=array();
447+ if (isset($GLOBALS[$var][$key])) $this->org_globals[$var][$key]=$GLOBALS[$var][$key];
448+ $GLOBALS[$var][$key]=$value;
449+ }
450+ }
451+ public function __destruct(){
452+ while(2<count($this->args)){
453+ $var=array_shift($this->args);
454+ $key=array_shift($this->args);
455+ $value=array_shift($this->args);
456+ if (isset($this->org_globals[$var][$key])) $GLOBALS[$var][$key]=$this->org_globals[$var][$key];
457+ else unset($GLOBALS[$var][$key]);
458+ }
459+ }
460+}
461+class jp_nucleus_use_template {
462+ private $data,$before;
463+ public function __construct(&$data){
464+ $this->data=&$data;
465+ $this->before=!empty($data['jp']['nucleus']['usetemplate']);
466+ $data['jp']['nucleus']['usetemplate']=true;
467+ }
468+ public function __destruct(){
469+ $this->data['jp']['nucleus']['usetemplate']=$this->before;
470+ }
471+}
\ No newline at end of file
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
--- plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_template.php (nonexistent)
+++ plugins/Nucleus/tags/v020/nucleus/jp_Nucleus_template.php (revision 272)
@@ -0,0 +1,306 @@
1+<?php
2+/*
3+ * Following templatevars are not supported
4+ * karma, daylink, karmaposlink, karmaneglink, new, popup, relevance
5+ */
6+class jp_Nucleus_template extends jeans {
7+/*
8+ * Templates: Category Lists
9+
10+The category lists are formatted as listed below:
11+
12+categorylist header
13+ categorylist listitem (repeated)
14+categorylist footer
15+
16+Available variables: (in the header and footer, only blogid, blogurl and self are allowed)
17+Name Description
18+blogid ID of the weblog
19+blogurl URL of the blog (as defined in blogsettings)
20+self Current page, without parameters (e.g. index.php)
21+catlink a link to the most recent items for a category, which you can embed in a <a href=".."> tag.
22+catid Category ID
23+catname Category name
24+catdesc Category description
25+catiscurrent yes if category is currently selected, no if it is not. Useful to style current category.
26+currentcat Synonym of catiscurrent
27+ */
28+ static private function select_template(&$data){
29+ if (preg_match('/([a-zA-Z0-9]+)\.inc$/',$data['skin'],$m)) return $m[1];
30+ else return 'unknown';
31+ }
32+ static public function tag_blogid(&$data){
33+ self::p($data['jp']['nucleus']['blogid']);
34+ }
35+ static public function tag_blogurl(&$data){
36+ switch(self::select_template($data)){
37+ case 'catlist':
38+ return self::p(blog::setting('url',$data['jp']['nucleus']['blogid']));
39+ case 'bloglist':
40+ return self::p($data['link']);
41+ }
42+ }
43+ static public function tag_self(&$data){
44+ self::p(_CONF_SELF);
45+ }
46+ static public function tag_catlink(&$data){
47+ self::p($data['link']);
48+ }
49+ static public function tag_catid(&$data){
50+ self::p($data['id']);
51+ }
52+ static public function tag_catname(&$data){
53+ self::p($data['name']);
54+ }
55+ static public function tag_catdesc(&$data){
56+ self::p($data['desc']);
57+ }
58+ static public function if_catiscurrent(&$data){
59+ return $_GET['sgid']==$data['id'];
60+ }
61+ static public function if_currentcat(&$data){
62+ return self::if_catiscurrent($data);
63+ }
64+/*
65+ * Templates: Blog Lists
66+
67+The blog lists are formatted as listed below:
68+
69+bloglist header
70+ bloglist listitem (repeated)
71+bloglist footer
72+
73+Available variables in list item field:
74+Name Description
75+bloglink URL of the blog (as generated by createBlogIdLink() function)
76+blogurl URL of the blog (as defined in blogsettings)
77+blogdesc Description of the blog
78+blogname Name of the blog (either full or short, depending on skinvar parameter).
79+
80+Available variables in header and footer fields:
81+Name Description
82+siteurl URL of the site (as defined in global settings)
83+sitename Name of the site (as defined in global settings).
84+ */
85+ static public function tag_bloglink(&$data){
86+ self::p($data['link']);
87+ }
88+ /*static public function tag_blogurl(&$data){
89+ * see above;
90+ }*/
91+ static public function tag_blogdesc(&$data){
92+ self::p($data['desc']);
93+ }
94+ static public function tag_blogname(&$data){
95+ self::p($data['name']);
96+ }
97+ static public function tag_siteurl(&$data){
98+ self::p(_CONF_URL_INDEX);
99+ }
100+ static public function tag_sitename(&$data){
101+ self::p(_CONF_SITE_NAME);
102+ }
103+/*
104+ * Template variables: Basic variables
105+
106+All these variables concern the item that's currently being parsed.
107+Name Description
108+title item title
109+body body text
110+more extended text
111+category name of the category
112+categorylink raw link to the category
113+karma karma score
114+authorlink raw link to the author
115+itemlink raw permanent link for the item
116+author name of the author
117+smartbody either the body text or the extended text
118+morelink 'read more'-link
119+date Formatted date
120+time Formatted time
121+daylink raw link to the daily archive
122+comments comments block or commentcount
123+itemid ID of the item
124+blogurl URL of the blog
125+
126+Template variables: Advanced variables
127+Name Description
128+authorid ID of the current items author
129+blogid ID of the blog
130+catid ID of the category for the current item
131+query search query (if there is one)
132+syndicate_title Syndicated title
133+syndicate_description Syndicated body text
134+karmaposlink raw vote link
135+karmaneglink raw vote link
136+new 'New Item!'-text
137+include includes a file, whithout parsing
138+parsedinclude includes a file, parsing it
139+phpinclude includes a file, parsing by PHP
140+plugin executes a plugin
141+edit inserts an 'edit this item' link
142+editlink raw 'edit item' link (links to bookmarklet)
143+editpopupcode javascript code to open a popup window for editlink
144+skinfile includes the correct URL for a file belonging to an imported skin
145+set sets a parser property
146+image inline image from media library
147+popup popup image from media dir
148+media other media object from media dir
149+relevance Includes the 'search hit relevance' in templates that display search results
150+ */
151+ public static function tag_more(&$data){
152+ self::echo_html($data['more']);
153+ }
154+ public static function tag_editlink(&$data){
155+ self::p(_CONF_URL_ADMIN.'?page=edititem&itemid='.$data['id']);
156+ }
157+ public static function tag_editpopupcode(&$data){
158+ self::p('window.open(this.href);return false;');
159+ }
160+ public static function tag_morelink(&$data){
161+ if (0<strlen($data['more'])) view::tag_template($data,'more');
162+ }
163+ public static function tag_comments(&$data,$maxtoshow=0){
164+ $skin=preg_replace('/_item\.inc$/','_comment.inc',$data['skin']);
165+ if ($data['comments']==0) {
166+ view::tag_template($data,'none',$skin);
167+ } elseif ($maxtoshow<$data['comments']) {
168+ view::tag_template($data,'many',$skin);
169+ } else {
170+ comments::tag_comments($data,$skin);
171+ }
172+ }
173+ public static function tag_body(&$data){
174+ self::echo_html($data['body']);
175+ }
176+ public static function tag_smartbody(&$data){
177+ if (0<strlen($data['more'])) self::echo_html($data['more']);
178+ else self::echo_html($data['body']);
179+ }
180+ public static function tag_itemid(&$data){
181+ self::p($data['id']);
182+ }
183+ public static function tag_authorid(&$data){
184+ self::p(&$data['author']);
185+ }
186+ public static function tag_edit(&$data){
187+ if (!member::is_admin()) return;
188+ view::tag_template($data,'edit');
189+ }
190+ public static function tag_author(&$data){
191+ self::p($data['aname']);
192+ }
193+ public static function tag_authorlink(&$data){
194+ self::p($data['alink']);
195+ }
196+ public static function tag_category(&$data){
197+ self::p($data['cname']);
198+ }
199+ public static function tag_categorylink(&$data){
200+ self::p($data['clink']);
201+ }
202+ public static function tag_itemlink(&$data){
203+ self::p($data['link']);
204+ }
205+ public static function tag_date(&$data){
206+ view::tag_strftime($data,'date');
207+ }
208+ public static function tag_time(&$data){
209+ view::tag_strftime($data,'time');
210+ }
211+ public static function tag_title(&$data,$format = ''){
212+ switch($format){
213+ case 'raw':
214+ return self::echo_html($data['title']);
215+ case 'xml':
216+ case 'attribute':
217+ default:
218+ return self::p($data['title']);
219+ }
220+ }
221+/*
222+ * Template variables: Comments
223+Name Description
224+body comment body
225+user user name
226+userid users URL or e-mail address
227+userlink a smart link to either the e-mail or URL for non members, or the member detail page for members. Note: this link already includes the <a href="..."> and </a> tags ! (when no valid URL or e-mail is available, only the name of the member will be shown)
228+userlinkraw same as above, but without the <a href.., empty when no valid URL or e-mail available
229+useremail the e-mail address of the user, empty if the e-mail address was not provided by the user
230+userwebsite the URL of the users website, empty if the URL was not provided by the user
231+userwebsitelink a smart link to URL for non members, or the member detail page for members. Note: this link already includes the <a href="..."> and </a> tags ! (when no valid URL, only the name of the member will be shown)
232+memberid ID of the member (0 for non-members)
233+commentcount total amount of comments for the item
234+commentword 1 'comment', 2 'comments'
235+date date on which comment was added
236+time time at which comment was added
237+host host from where comment was added
238+ip IP-address from where comment was added
239+commentid ID of the current comment
240+itemid ID of the current item
241+itemlink link to the detailed item page
242+itemtitle Title of the current item
243+blogid ID of the weblog
244+blogurl URL of the weblog
245+authtext the extra text for members, empty for non members
246+short a cut off version of the body, which truncates after the first line break. A link is added at the end according to the template
247+excerpt the body of the comment, cut at 60 characters and appended with '...'
248+timestamp time at which comment was added
249+include includes a file, whithout parsing
250+parsedinclude includes a file, parsing it
251+phpinclude includes a file, parsing by PHP
252+plugin executes a plugin
253+skinfile includes the correct URL for a file belonging to an imported skin
254+set sets a parser property
255+ */
256+ /*
257+ *
258+ */
259+ static public function tag_memberid(&$data){
260+ self::p($data['author']);
261+ }
262+ static public function tag_userlinkraw(&$data){
263+ self::p($data['link']);
264+ }
265+ static public function tag_ip(&$data){
266+ self::p($data['ip']);
267+ }
268+ static public function tag_user(&$data){
269+ self::p($data['user']);
270+ }
271+ static public function tag_commentcount(&$data){
272+ self::p($data['comments']);
273+ }
274+ static public function tag_commentword(&$data){
275+ switch($data['comments']){
276+ case 0:
277+ case 1:
278+ return view::tag_template($data,'one');
279+ default:
280+ return view::tag_template($data,'two');
281+ }
282+ }
283+ static public function tag_itemtitle(&$data){
284+ self::p($data['title']);
285+ }
286+/*
287+ * Templates: Archive Lists
288+
289+The archive lists are formatted as listed below:
290+
291+archivelist header
292+ archivelist listitem (repeated for each archive)
293+archivelist footer
294+
295+Available variables: (in the header and footer, only blogid is allowed)
296+Name Description
297+blogid ID of the weblog
298+archivelink link to the archive, which you can embed in a <a href=".."> tag.
299+month Number of the month (2 digits: 01-12)
300+year Year (4 digits)
301+day Day of month (2 digits; only when in day mode)
302+ */
303+ static public function tag_archivelink(&$data){
304+ self::p($data['link']);
305+ }
306+}
\ No newline at end of file
Added: svn:eol-style
## -0,0 +1 ##
+CRLF
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id HeadURL LastChangedDate LastChangedBy LastChangedRevision
\ No newline at end of property
旧リポジトリブラウザで表示