XPressME Integration Kit

Trac

Changeset 792


Ignore:
Timestamp:
Oct 7, 2011, 8:59:37 AM (12 years ago)
Author:
toemon
Message:

マルチサイト用、最近の投稿(全ブログ)ブロックのオプションに「対象ブログの除外」、「ブログ毎に抽出」を追加、ブロックオプションのデフォルトテンプレートの誤りを修正

Location:
branches/Ver2.4/xpressme_integration_kit
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/Ver2.4/xpressme_integration_kit/blocks/block_common.php

    r583 r792  
    9191} 
    9292endif; 
     93if(!function_exists("blog_select")): 
     94function blog_select($option_name = '',$value='',$exclusion=false ,$row_num=0) 
     95{ 
     96    $mydirpath = dirname(dirname(__FILE__)); 
     97        $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; 
     98        $wp_prefix = preg_replace('/wordpress/','wp',$mydirname) . '_'; 
     99        $xoopsDB =& Database::getInstance(); 
     100        $myts =& MyTextSanitizer::getInstance(); 
     101    $selected = explode(',' , $value); 
     102        $isAll = (count($selected)==0||empty($selected[0]))?true:false; 
     103     
     104    if (empty($row_num)) $size = ''; else $size = 'size="' . $row_num . '"'; 
     105        include $mydirpath.'/wp-includes/version.php'; 
     106         
     107        $option = "\t<option value=\"0\" "; 
     108        if ($isAll) $option .= " selected=\"selected\""; 
     109        if ($exclusion){ 
     110                $option .= ">"._MB_XP2_NONE ."</option>\n"; 
     111    } else { 
     112                $option .= ">"._MB_XP2_ALL ."</option>\n"; 
     113        } 
     114 
     115        if ($wp_db_version > 6124) { 
     116                $db_xpress_blogs = $xoopsDB->prefix($wp_prefix . 'blogs'); 
     117                $query = " 
     118                SELECT blog_id  
     119                FROM $db_xpress_blogs  
     120                ORDER BY blog_id 
     121                "; 
     122                 
     123            if ($res =  $xoopsDB->query($query, 0, 0)){ 
     124                        while($row = $xoopsDB->fetchArray($res)){ 
     125                                 
     126                    $blog_id = $row['blog_id']; 
     127                    if ($blog_id == 1) { 
     128                        $blog_selector = ''; 
     129                    } else { 
     130                        $blog_selector = $blog_id . '_'; 
     131                    } 
     132                                $db_xpress_options = $xoopsDB->prefix($wp_prefix . $blog_selector . 'options'); 
     133                    $options_query = " 
     134                                SELECT option_value  
     135                                FROM $db_xpress_options  
     136                                WHERE option_name = 'blogname' 
     137                                "; 
     138                        if ($options_res =  $xoopsDB->query($options_query, 0, 0)){ 
     139                                $options_row = $xoopsDB->fetchArray($options_res); 
     140                                $blog_name = $options_row['option_value']; 
     141                        } else { 
     142                                $blog_name = 'Blog_' . $blog_id ; 
     143                        } 
     144                         
     145                    $option .= "\t<option value=\"".$blog_id."\""; 
     146                    if (in_array($blog_id, $selected)) 
     147                                $option .= ' selected="selected"'; 
     148                                $option .= '>'; 
     149                                $option .= $myts->htmlspecialchars($blog_name); 
     150                                $option .= "</option>\n"; 
     151                } 
     152            } 
     153    } 
     154        if ($exclusion){ 
     155                $output = _MB_XP2_EXCLUSION_BLOGS_SELECT ."<br />\n"; 
     156    } else { 
     157                $output = _MB_XP2_SHOW_BLOGS_SELECT ."<br />\n"; 
     158        } 
     159    $output .= '&nbsp;&nbsp;<select name="blogs" id="blog_sel" '.$size.' multiple="multiple" onclick="BlogSelect()">' ."\n"; 
     160    $output .= $option; 
     161    $output .= '</select>'; 
     162    $output .=  '&emsp;' .  _MB_XP2_BLOGS_DIRECT_SELECT . " <input type='text' name='$option_name' id='blog_csv' value='$value' /><br />\n"; 
     163    $output .= ' 
     164<script type="text/javascript"> 
     165    function BlogSelect(){ 
     166        var idx=new Array(); 
     167        var sel = document.getElementById("blog_sel").options; 
     168        for(var i=0, n=0; i<sel.length; i++){ 
     169            if(sel[i].selected){ idx[n++]=sel[i].value; } 
     170        } 
     171        if(idx.length>0){ 
     172                document.getElementById("blog_csv").value = idx; 
     173                } 
     174    } 
     175</script> 
     176'; 
     177     
     178    return $output; 
     179 
     180} 
     181endif; 
    93182 
    94183if(!function_exists("comment_type_select")): 
  • branches/Ver2.4/xpressme_integration_kit/blocks/global_recent_comments_block.php

    r543 r792  
    1818        { 
    1919                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 
    20                 $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_comments_block.html' : trim( $options[1] ); 
     20                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_global_recent_comments_block.html' : trim( $options[1] ); 
    2121                $disp_count = empty( $options[2] ) ? '10' : $options[2] ; 
    2222                $disp_length = empty( $options[3] ) ? '30' : $options[3] ; 
  • branches/Ver2.4/xpressme_integration_kit/blocks/global_recent_posts_list_block.php

    r537 r792  
    1717        { 
    1818                $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 
    19                 $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_posts_list_block.html' : trim( $options[1] ); 
     19                $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_global_recent_posts_list_block.html' : trim( $options[1] ); 
    2020                $disp_count = empty( $options[2] ) ? '10' : $options[2] ; 
    2121                $disp_red = empty( $options[3] ) ? '1' : $options[3] ; 
     
    2323                $date_format = empty( $options[5] ) ? '' : $options[5] ; 
    2424                $time_format = empty( $options[6] ) ? '' : $options[6] ; 
     25                $Shown_for_each_blog = empty( $options[7] ) ? false : true ;             
     26                $exclusion_blog = empty( $options[8] ) ? '0' : $options[8] ; 
    2527 
    2628                $mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname; 
     
    3739                $form .= _MB_XP2_DATE_FORMAT .": <input type='text' name='options[5]' value='" . $date_format . "' /><br />\n"; 
    3840                $form .= _MB_XP2_TIME_FORMAT .": <input type='text' name='options[6]' value='" . $time_format . "' /><br />\n"; 
     41                $form .= yes_no_radio_option('options[7]', _MB_XP2_SHOWN_FOR_EACH_BLOG , $Shown_for_each_blog) . "<br />\n"; 
     42            $form .= blog_select('options[8]' , $exclusion_blog,true); 
    3943 
    4044                return $form; 
  • branches/Ver2.4/xpressme_integration_kit/language/english/blocks.php

    r716 r792  
    148148        define("_MB_XP2_BLOG_COUNT","count"); 
    149149        define("_MB_XP2_BLOG_ID","ID"); 
     150// global_blog_list 
     151        define("_MB_XP2_SHOW_BLOGS_SELECT","Select Display Blogs"); 
     152        define("_MB_XP2_EXCLUSION_BLOGS_SELECT","Select Exclusion Blogs"); 
     153        define("_MB_XP2_BLOGS_DIRECT_SELECT","Direct input of ID(Comma separated list of blog ID)"); 
     154        define("_MB_XP2_SHOWN_FOR_EACH_BLOG","Shown for each blog"); 
    150155 
    151156} 
  • branches/Ver2.4/xpressme_integration_kit/language/ja_utf8/blocks.php

    r716 r792  
    149149        define("_MB_XP2_BLOG_COUNT","ブログの投稿数"); 
    150150        define("_MB_XP2_BLOG_ID","ブログID"); 
     151// global_blog_list 
     152        define("_MB_XP2_SHOW_BLOGS_SELECT","表示ブログの選択"); 
     153        define("_MB_XP2_EXCLUSION_BLOGS_SELECT","除外ブログの選択"); 
     154        define("_MB_XP2_BLOGS_DIRECT_SELECT","ブログIDを直接指定(複数ある場合はカンマ区切りで入力)"); 
     155        define("_MB_XP2_SHOWN_FOR_EACH_BLOG","ブログ毎に表示する。"); 
    151156 
    152157} 
  • branches/Ver2.4/xpressme_integration_kit/language/japanese/blocks.php

    r716 r792  
    148148        define("_MB_XP2_BLOG_COUNT","¥Ö¥í¥°¤ÎÅê¹Æ¿ô"); 
    149149        define("_MB_XP2_BLOG_ID","¥Ö¥í¥°ID"); 
     150// global_blog_list 
     151        define("_MB_XP2_SHOW_BLOGS_SELECT","ɽ¼¨¥Ö¥í¥°¤ÎÁªÂò"); 
     152        define("_MB_XP2_EXCLUSION_BLOGS_SELECT","½ü³°¥Ö¥í¥°¤ÎÁªÂò"); 
     153        define("_MB_XP2_BLOGS_DIRECT_SELECT","¥Ö¥í¥°ID¤òľÀÜ»ØÄê(Ê£¿ô¤¢¤ë¾ì¹ç¤Ï¥«¥ó¥Þ¶èÀÚ¤ê¤ÇÆþÎÏ)"); 
     154        define("_MB_XP2_SHOWN_FOR_EACH_BLOG","¥Ö¥í¥°Ëè¤Ëɽ¼¨¤¹¤ë¡£"); 
    150155 
    151156} 
  • branches/Ver2.4/xpressme_integration_kit/language/pt-br_utf8/blocks.php

    r716 r792  
    149149        define("_MB_XP2_BLOG_COUNT","n° de posts"); 
    150150        define("_MB_XP2_BLOG_ID","ID"); 
     151// global_blog_list 
     152        define("_MB_XP2_SHOW_BLOGS_SELECT","Selecione Exibir Blogs"); 
     153        define("_MB_XP2_EXCLUSION_BLOGS_SELECT","Selecione Blogs Exclusão"); 
     154        define("_MB_XP2_BLOGS_DIRECT_SELECT","Entrada direta de ID (lista separada por vírgulas de ID blog)"); 
     155        define("_MB_XP2_SHOWN_FOR_EACH_BLOG","Mostrados para cada blog"); 
    151156 
    152157} 
  • branches/Ver2.4/xpressme_integration_kit/templates/source/global_recent_posts_list_block.html

    r545 r792  
    22        The template tag of the following list can be used.  
    33                <{$block.err_message}>                                  // When the block cannot be displayed, this outputs the reason. Please do not delete it.  
     4                <{$block.shown_for_each_blog}>                  // Shown for each blog 
    45                <{$block.data_count}>                                   // The number of contents is displayed. 
    56                <{$block.contents}>                                             // Data array of contents.  
     
    2829************************* End of usage ************************ *}> 
    2930<{* Start Template *}> 
    30  
    3131<div class="xpress_block"> 
    3232        <{$block.err_message}> 
    3333        <div class="xpress_global_recent_post_list_block"> 
    3434                <ul> 
    35                 <{foreach from=$block.contents item=content}> 
    36                         <li> 
    37                         <{$content.new_mark}> <{$content.title_link}><br /> 
    38                         <{$content.post_date_time}><br /> 
    39                         <{$content.blog_link}><br /> 
    40                         <{$content.post_author}><br /> 
    41                         </li> 
    42                 <{/foreach}> 
     35                <{if $block.shown_for_each_blog}> 
     36                        <{ assign var="b_id" value=0 }> 
     37                        <{foreach from=$block.contents item=content}> 
     38                                <{if $b_id != $content.blog_id}> 
     39                                        <{if $b_id != 0}> 
     40                                                        </ul> 
     41                                                </li> 
     42                                        <{/if}> 
     43                                                <li><{$content.blog_link}> 
     44                                                        <ul> 
     45                                        <{ assign var="b_id" value=$content.blog_id }> 
     46                                <{/if}> 
     47                                                                <li> 
     48                                                                        <{$content.new_mark}> <{$content.title_link}><br /> 
     49                                                                        <{$content.post_thumbnail}><br /> 
     50                                                                        <{$content.post_date_time}><br /> 
     51                                                                        <{$content.author_avatar}><{$content.post_author}><br /> 
     52                                                                </li> 
     53                        <{/foreach}> 
     54                                                        </ul> 
     55                                                </li> 
     56                <{else}> 
     57                        <{foreach from=$block.contents item=content}> 
     58                                <li> 
     59                                <{$content.new_mark}> <{$content.title_link}><br /> 
     60                                <{$content.post_date_time}><br /> 
     61                                <{$content.blog_link}><br /> 
     62                                <{$content.post_author}><br /> 
     63                                </li> 
     64                        <{/foreach}> 
     65                <{/if}> 
    4366                </ul> 
    4467        </div> 
  • branches/Ver2.4/xpressme_integration_kit/wp-content/plugins/xpressme/include/custom_functions.php

    r688 r792  
    891891} 
    892892 
    893 function xpress_grobal_recent_posts($num = 10,$post_list='') 
     893function xpress_grobal_recent_posts($num = 10,$exclusion_blog = 0, $shown_for_each_blog = false) 
    894894{ 
    895895        global $wpdb, $wp_rewrite , $switched , $blog_id; 
    896896        if (empty($date_format)) $date_format = get_settings('date_format'); 
    897897        if (empty($time_format)) $time_format = get_settings('time_format'); 
     898        $exclusion = explode(',' , $exclusion_blog); 
     899 
    898900 
    899901        $first_blogid = $blog_id; 
     
    904906                $blogs = get_blog_list(0,'all'); 
    905907                foreach ($blogs AS $blog) { 
     908                        if (!in_array(0, $exclusion) && in_array($blog['blog_id'], $exclusion)) continue; 
    906909                        switch_to_blog($blog['blog_id']); 
    907910                        $wp_rewrite->init();  // http://core.trac.wordpress.org/ticket/12040 is solved, it is unnecessary. 
     
    922925                                                ob_end_clean(); 
    923926                                                 
    924                                                 $data->brog_id = $blog['blog_id']; 
     927                                                $data->blog_id = $blog['blog_id']; 
    925928                                                $data->blog_name = get_bloginfo('name'); 
    926929                                                $data->blog_url = get_bloginfo('url'); 
     
    995998                                                 
    996999                                                $data->post_views = xpress_post_views_count('post_id=' . $data->post_id . '&blogid=' . $data->brog_id . '&format=' . __('Views :%d', 'xpress'). '&echo=0'); 
     1000                                                if (function_exists('the_qf_get_thumb_one')){ 
     1001                                                        $data->post_thumbnail = the_qf_get_thumb_one("num=0&width=120&tag=1","",$data->the_full_content); 
     1002                                                } else { 
     1003                                                        $data->post_thumbnail = get_the_post_thumbnail(null,'thumbnail'); 
     1004                                                } 
     1005                                                $data->author_avatar =get_avatar(get_the_author_meta('ID'),$size = '32'); 
    9971006 
    9981007                                                $data_array[] = $data; 
     
    10061015 
    10071016                restore_current_blog(); 
     1017        } 
     1018        if (!$shown_for_each_blog){ 
    10081019                usort($data_array, "the_time_cmp"); 
    1009         } 
    1010          
    1011         if (!empty($num)){ 
    1012                 $data_array = array_slice($data_array,0,$num); 
     1020                if (!empty($num)){ 
     1021                        $data_array = array_slice($data_array,0,$num); 
     1022                } 
    10131023        } 
    10141024        return $data_array; 
  • branches/Ver2.4/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/global_popular_posts_block_theme.php

    r555 r792  
    44{ 
    55        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 
    6         $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_block_popular.html' : trim( $options[1] ); 
     6        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_grobal_popular_posts_block.html' : trim( $options[1] ); 
    77        $disp_count = empty( $options[2] ) ? '10' : $options[2] ; 
    88        $show_month_range = empty( $options[3] ) ? '0' : $options[3] ; 
  • branches/Ver2.4/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/global_recent_comments_block_theme.php

    r554 r792  
    44{ 
    55        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 
    6         $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_comments_block.html' : trim( $options[1] ); 
     6        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_global_recent_comments_block.html' : trim( $options[1] ); 
    77        $disp_count = empty( $options[2] ) ? '10' : $options[2] ; 
    88        $disp_length = empty( $options[3] ) ? '30' : $options[3] ; 
  • branches/Ver2.4/xpressme_integration_kit/wp-content/themes/xpress_default/blocks/global_recent_posts_list_block_theme.php

    r545 r792  
    44{ 
    55        $mydirname = empty( $options[0] ) ? 'xpress' : $options[0] ; 
    6         $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_recent_posts_list_block.html' : trim( $options[1] ); 
     6        $this_template = empty( $options[1] ) ? 'db:'.$mydirname.'_global_recent_posts_list_block.html' : trim( $options[1] ); 
    77        $disp_count = empty( $options[2] ) ? '10' : $options[2] ; 
    88        $disp_red = empty( $options[3] ) ? '1' : $options[3] ; 
     
    1010        $date_format = empty( $options[5] ) ? '' : $options[5] ; 
    1111        $time_format = empty( $options[6] ) ? '' : $options[6] ; 
     12        $shown_for_each_blog = empty( $options[7] ) ? false : true ;             
     13        $exclusion_blog = empty( $options[8] ) ? '0' : $options[8] ; 
     14         
    1215        $mydirpath = get_xpress_dir_path(); 
    1316         
     
    2023                $block = array(); 
    2124                 
    22                 $data_array = xpress_grobal_recent_posts($disp_count); 
     25                $data_array = xpress_grobal_recent_posts($disp_count,$exclusion_blog,$shown_for_each_blog); 
    2326                $item_no = 0; 
    2427                $red_sec = $disp_red *60*60*24; 
     
    4144                } 
    4245                $block['data_count'] = $item_no;  //xml unserialise error 
     46                $block['shown_for_each_blog'] = $shown_for_each_blog; 
    4347        } else { 
    4448                $block['err_message'] = __('This blog is not set to the multi blog.', 'xpress'); 
  • branches/Ver2.4/xpressme_integration_kit/xoops_version.php

    r771 r792  
    386386                'show_func'     => "b_". $mydirname . "_global_posts_show" , 
    387387                'edit_func'     => "b_". $mydirname . "_global_posts_edit" , 
    388                 'options'               => $mydirname. '||10|1|7||' , 
     388                'options'               => $mydirname. '||10|1|7||0|0' , 
    389389                'can_clone'             => true , 
    390390                'func_num'              => $b_no,        
Note: See TracChangeset for help on using the changeset viewer.