hypweb.net
XOOPSマニア  最新情報のRSS(サイト全体)
[ 自宅サーバーWebRing |ID=54 前後5表示乱移動サイト一覧 ]

TOP » xpwiki » xpWiki開発日記 » 2007-12-20

2007 12月 20 (木)
 

Ver 3.50 (外部(d3pipesなど)から利用できる関数群を追加) anchor.png Edit

XOOPSのブロックや他のモジュールから簡単に呼び出せる関数群を追加しました。

とはいっても、今回は実質 "xpwiki_saf_getRecentPages_base()" のみですが・・・。

また、ついでに RSS 関連で調整を行いました。

とりあえず、d3pipes の「サイト内新着情報パイプ作成ウイザード」などで使用できる、内部情報取得用ジョイントを作って見ました。

次の fileD3pipesBlockXpwikipages.class.phpXOOPS_TRUST_PATH/modules/d3pipes/joints/block ディレクトリに放り込むと、サイト内新着情報パイプ作成ウイザードで xpWiki が設定できるようになります。


xpWiki Ver 3.51 以降では、D3pipesBlockXpwikipages.class.php は単なるラッパーにできますので、もっと簡潔になりました。
-> Ver 3.51 (d3pipes 用プラグイン追加)

fileD3pipesBlockXpwikipages.class.php
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
 
require_once dirname(dirname(__FILE__)).'/D3pipesBlockAbstract.class.php' ;
 
class D3pipesBlockXpwikipages extends D3pipesBlockAbstract {
 
    var $target_dirname = '' ;
    var $trustdirname = 'xpwiki' ;
 
    function init()
    {
        // parse and check option for this class
        $params = array_map( 'trim' , explode( '|' , $this->option ) ) ;
        if( empty( $params[0] ) ) {
            $this->errors[] = _MD_D3PIPES_ERR_INVALIDDIRNAMEINBLOCK."\n($this->pipe_id)" ;
            return false ;
        }
        $this->target_dirname = preg_replace( '/[^0-9a-zA-Z_-]/' , '' , $params[0] ) ;
 
        // configurations (file, name, block_options)
        $this->func_file = XOOPS_TRUST_PATH.'/modules/'.$this->trustdirname.'/include/stand_alone_functions.php' ;
        $this->func_name = 'xpwiki_saf_getRecentPages_base' ;
        
        $as_guest = (@ $params[3] === 'No')? false : true;
        $this->block_options = array(
            0 => $this->target_dirname , // mydirname
            1 => strval(@ $params[1]) ,  // base page
            2 => empty( $params[2] ) ? 10 : intval( $params[2] ) , // max_entries
            'as_guest' => $as_guest ,    // Get as guest always
        ) ;
 
        return true ;
    }
 
    function reassign( $data )
    {
        $entries = array() ;
        foreach( $data['entries'] as $entry ) {
            $entry['fingerprint'] = $entry['link'] ;
            $entries[] = $entry ;
        }
 
        return $entries ;
    }
 
    function renderOptions( $index , $current_value = null )
    {
        $index = intval( $index ) ;
        $options = explode( '|' , $current_value ) ;
 
        // options[0]  (dirname)
        $dirnames = $this->getValidDirnames() ;
        $ret_0 = '<select name="joint_options['.$index.'][0]">' ;
        foreach( $dirnames as $dirname ) {
            $ret_0 .= '<option value="'.$dirname.'" '.($dirname==@$options[0]?'selected="selected"':'').'>'.$dirname.'</option>' ;
        }
        $ret_0 .= '</select>' ;
 
        // options[1]  (base page)
        $options[1] = preg_replace( '/[^0-9a-zA-Z_-]/' , '' , @$options[1] ) ;
        $ret_1 = 'Base page'.'<input type="text" name="joint_options['.$index.'][1]" value="'.$options[1].'" size="15" />' ;
 
        // options[2]  (max_entries)
        $options[2] = empty( $options[2] ) ? 10 : intval( $options[2] ) ;
        $ret_2 = _MD_D3PIPES_N4J_MAXENTRIES.'<input type="text" name="joint_options['.$index.'][2]" value="'.$options[2].'" size="2" style="text-align:right;" />' ;
 
        // options[3]  (Get as guest?)
        $options[3] = ( @$options[3] === 'No' ) ? 'No' : 'Yes' ;
        $ret_3 = 'Get as guest always?'.'<select name="joint_options['.$index.'][3]">' ;
        foreach( array('Yes', 'No') as $name ) {
            $ret_3 .= '<option value="'.$name.'" '.($name === $options[3]?'selected="selected"':'').'>'.$name.'</option>' ;
        }
        $ret_3 .= '</select>' . '(Never cache it when you select "No".)';
        
        return '<input type="hidden" name="joint_option['.$index.']" id="joint_option_'.$index.'" value="" />'.$ret_0.' '.$ret_1.' '.$ret_2.'<br />'.$ret_3 ;
    }
 
}
 
?>
Page Top

CVS 更新内容 anchor.png Edit

  • 2007-12-20 18:38 nao-pon
    • * xoops_version.php (1.262):
      • Version 3.50
  • 2007-12-20 17:09 nao-pon
    • * include/stand_alone_functions.php (1.1):
      • Stand alone functions, this is called from the outside.
  • 2007-12-20 16:25 nao-pon
    • * class/: func/xpwiki_func.php (1.128), xpwiki.php (1.62), extension/whatsnew.php (1.13):
      • Function rename 'get_page_count' to 'get_page_views'.
  • 2007-12-20 16:23 nao-pon
    • * plugin/rss.inc.php (1.22):
      • Changed to use from $userinfo to $pginfo.
  • 2007-12-20 14:54 nao-pon
    • * plugin/rss.inc.php (1.21):
      • The entity reference value in discription is not removed.
Page Top

一行コメント anchor.png Edit




トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 129, today: 1, yesterday: 0
初版日時: 2007-12-20 (木) 20:32:34
最終更新: 2007-12-21 (金) 18:00:49 (JST) (5969d) by nao-pon
このページのTopへ
メインメニュー
ログイン

ユーザー名:


パスワード:





パスワード紛失  |新規登録
オンライン状況
281 人のユーザが現在オンラインです。 (2 人のユーザが xpwiki を参照しています。)

登録ユーザ: 0
ゲスト: 281

もっと...
サイト情報