XPressME Integration Kit

Trac

Changeset 96 for trunk/wp-content


Ignore:
Timestamp:
Mar 6, 2009, 5:16:22 PM (15 years ago)
Author:
toemon
Message:

途中経過でインストール、アップデートできなくなってしまっていたバグ修正
イベント通知の部分をFix、(ゲストのモジュールアクセス権限がないと通知できないのは直らない)
ブロックのキャッシュを見直し、キャッシュがない場合と、ブロックオプションが変更された場合にリフレッシュする機能を追加
ブロックキャッシュの更新にてポスト削除時のイベントをDB削除前にとっていたバグを修正。

Location:
trunk/wp-content
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/custom_functions.php

    r95 r96  
    33function xpress_credit($show = false) 
    44{ 
    5         global $xoopsModule,$wp_version; 
    6          
    7         $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xoopsModule->getInfo('version'),$xoopsModule->getInfo('codename')) .'</a>'; 
     5        global $wp_version , $modversion; 
     6         
     7        $xpress_version = $modversion['version']; 
     8        $xpress_codename = $modversion['codename']; 
     9        $ret = '<a href="http://www.toemon.com"'. " target='_blank'" . '>XPressME Ver.' . sprintf('%.2f %s',$xpress_version,$xpress_codename) .'</a>'; 
    810        if (strstr($wp_version,'ME')){ 
    911                $ret .= '(included <a href="http://wpme.sourceforge.jp/" title="Powered by WordPress"'." target='_blank'". '>WordPress ' . $wp_version . '</a>)'; 
     
    192194// Set post views given a post ID or post object.  
    193195function post_views_counting($post_id = 0) { 
     196        global $xoops_db,$wpdb; 
    194197        global $table_prefix; 
    195198        static $views; 
     
    201204 
    202205 
    203         $views_db = $table_prefix . "views"; 
     206        $views_db = get_wp_prefix() . 'views'; 
    204207 
    205208        if($post_id==0 || !empty($views[$post_id])) return null; 
     
    212215 
    213216    $sql = "SELECT post_views FROM " . $views_db . " WHERE post_id=$post_id"; 
    214     $exist = false; 
    215     if ($result = $GLOBALS["xoopsDB"]->query($sql)) { 
    216         while($row = $GLOBALS["xoopsDB"]->fetchArray($result)){ 
    217                 $exist = true; 
    218                 break; 
    219         } 
    220         } 
    221         if($exist){ 
     217        $post_views_found = $xoops_db->get_var($sql); 
     218        if($post_views_found){ 
    222219        $sql = "UPDATE " . $views_db . " SET post_views=post_views+1 WHERE post_id=$post_id"; 
    223220    }else{ 
    224221        $sql = "INSERT INTO " . $views_db . " (post_id, post_views) VALUES ($post_id, 1)"; 
    225222    } 
    226     if ($result = $GLOBALS["xoopsDB"]->queryF($sql)) { 
    227         $views[$post_id] = 1; 
    228     } 
    229      
     223    $xoops_db->query($sql); 
    230224        return true; 
    231225} 
  • trunk/wp-content/plugins/xpressme/include/notify_functions.php

    r95 r96  
    4848                $_SERVER['REQUEST_METHOD'] = 'POST'; 
    4949        } 
    50          
    51         include_once $xoops_config->xoops_mainfile_path;        // load XOOPS System 
    52         include_once $xoops_config->xoops_root_path . '/include/notification_functions.php' ; 
     50//      set_error_handler("xpress_error_handler"); 
     51        require $xoops_config->xoops_mainfile_path;     // load XOOPS System 
    5352        $module_id = get_xpress_modid() ; 
    5453        $notification_handler =& xoops_gethandler( 'notification' ) ; 
     
    5857function do_CommentWaiting($commentID, $comment_post_ID) 
    5958{ 
    60 //      global $xoops_config; 
    61 //      require_once $xoops_config->xoops_mainfile_path; 
    62 //      xoops_mainfile_path; 
    6359//      require_once XOOPS_ROOT_PATH . '/include/notification_functions.php' ; 
    6460//      $notification_handler =& xoops_gethandler( 'notification' ) ; 
     
    120116{ 
    121117        global $xoops_config, $xoops_db; 
    122         xpress_debug(); 
    123118         
    124119 
  • trunk/wp-content/plugins/xpressme/include/pluggable-override.php

    r87 r96  
    5656endif; 
    5757 
     58if ( !function_exists('xpress_login') ) : 
    5859function xpress_login(){ 
    5960        global $current_user; 
     
    8182        return 0;        
    8283} 
     84endif; 
    8385 
     86if ( !function_exists('check_xpress_auth_cookie') ) : 
    8487function check_xpress_auth_cookie() {           // for wp2.5 
    8588        if ( empty($_COOKIE[AUTH_COOKIE]) ){ 
     
    112115        return false; 
    113116} 
     117endif; 
    114118 
    115119if ( !function_exists('wp_check_password') ) : 
  • trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r95 r96  
    4949} 
    5050 
     51function is_block_cache_found($block_name) 
     52{ 
     53        global $xoops_config; 
     54        $mydirname = get_xpress_dir_name(); 
     55 
     56        if(defined('XOOPS_ROOT_PATH')){ 
     57                $cache_dir = XOOPS_ROOT_PATH . '/cache/'; 
     58        } else { 
     59                $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
     60        } 
     61        $xml_name = $block_name . '.xml'; 
     62 
     63    $filename = $cache_dir .$mydirname . '_' . $xml_name; 
     64        $cache_time = 0; 
     65//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
     66    if (file_exists($filename)) { 
     67        return true; 
     68        } else { 
     69                return false; 
     70        } 
     71} 
     72 
     73 
     74//When there is no block cash, and an optional block is different, false is returned. 
     75function is_block_cache_normal() 
     76{ 
     77        global $xoops_config; 
     78        global $xoops_db; 
     79        $mid = get_xpress_modid(); 
     80        $sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid "; 
     81        $blocks = $xoops_db->get_results($sql); 
     82        $mydirname = get_xpress_dir_name(); 
     83        require_once get_xpress_dir_path() . '/include/xpress_block_render.php'; 
     84 
     85        foreach($blocks as $block){ 
     86                $func_file = $block->func_file; 
     87                $call_theme_function_name = str_replace(".php", "", $func_file); 
     88                $inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php'; 
     89                $cache_title = str_replace(".php", "", $func_file); 
     90                $blockID = $block->bid; 
     91                $options = explode("|", $block->options); 
     92                 
     93                if (!is_block_cache_found($cache_title . $blockID)) return false; 
     94                $xml = xpress_block_cache_read($mydirname,$cache_title. $blockID); 
     95                $options = ''; 
     96                $options = @$xml['block']['options']; 
     97                if( strcmp($options,$block->options) != 0 ) return false; 
     98        } 
     99        return true; 
     100} 
     101 
     102 
    51103function block_cache_refresh() 
    52104{ 
     
    71123                $block_render = $call_theme_function_name($options);            //The block name and the called function name should be assumed to be the same name.                     
    72124                $xml['block'] = $block_render; 
     125                $xml['block']['options'] = $block->options; 
    73126                xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml); 
    74127        } 
  • trunk/wp-content/plugins/xpressme/xpressme.php

    r95 r96  
    2727        remove_action( 'pre_post_update', 'wp_save_post_revision' );                    // Not Save Post Revision 
    2828} 
     29 
     30//XOOPS Bloack Cache Refresh 
    2931add_action("comment_post",      "block_cache_refresh"); 
    3032add_action("edit_comment",      "block_cache_refresh"); 
    31 add_action("delete_comment","block_cache_refresh"); 
    32 add_action("delete_post",       "block_cache_refresh"); 
     33add_action("wp_set_comment_status","block_cache_refresh"); //wp_delete_comment() at deleted 
     34add_action("deleted_post",      "block_cache_refresh"); 
    3335add_action("publish_post",      "block_cache_refresh"); 
    3436add_action("edit_post",         "block_cache_refresh"); 
    3537add_action("private_to_published",      "block_cache_refresh"); 
    36 add_action("wp_set_comment_status" , "block_cache_refresh"); 
     38add_action("transition_post_status", "block_cache_refresh"); 
    3739 
    3840add_action("the_content",       "set_post_views_count"); 
  • trunk/wp-content/themes/xpress_default/index.php

    r64 r96  
    3333                                </div> 
    3434 
    35                                 <p class="postmetadata"><!-- Post author start --><?php/* _e('Posted:', 'xpress'); echo '&nbsp;'; the_author_posts_link(); echo '<br />' ; */?><!-- Post author end --><?php if(function_exists('the_tags')) : ?><?php the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />'); ?><?php endif; ?><?php printf(__('Posted in %s', 'xpress'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'xpress'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') ); ?></p> 
    36                                 <?php xpress_post_views_count($post->id,__('Views :%d', 'xpress'),true) ?> 
     35                                <p class="postmetadata"><!-- Post author start --> 
     36                                <!-- Post author end --> 
     37                                <?php 
     38                                        if(function_exists('the_tags')) 
     39                                                echo the_tags(__('Tags:', 'xpress') . ' ', ', ', '<br />'); 
     40                                        printf(__('Posted in %s', 'xpress'), get_the_category_list(', ')); 
     41                                        echo ' | '; 
     42                                        edit_post_link(__('Edit', 'xpress'), '', ' | '); 
     43                                        comments_popup_link(__('No Comments &#187;', 'xpress'), __('1 Comment &#187;', 'xpress'), __('% Comments &#187;', 'xpress'), '', __('Comments Closed', 'xpress') ); 
     44                                ?> 
     45                                </p> 
     46                                <?php xpress_post_views_count($post->ID,__('Views :%d', 'xpress'),true) ?> 
    3747 
    3848                                </div> 
  • trunk/wp-content/themes/xpress_default/searchform.php

    r64 r96  
    11<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/"> 
    22<label class="hidden" for="s"><?php _e('Search for:', 'xpress'); ?></label> 
    3 <div><input type="text" value="<?php if(function_exists('the_serch_query')) : ?><?php the_search_query(); ?><?php else : ?><?php echo attribute_escape($s); ?><?php endif; ?>" name="s" id="s" /> 
     3<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> 
    44<input type="submit" id="searchsubmit" value="<?php _e('Search', 'xpress'); ?>" /> 
    55</div> 
Note: See TracChangeset for help on using the changeset viewer.