Changeset 1079

Show
Ignore:
Timestamp:
04/23/07 13:18:33 (2 years ago)
Author:
ben
Message:

Minor fixes for the revamped blog code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/mod/blog/default_template.php

    r1077 r1079  
    4747    ); 
    4848 
    49     $template_definition[] = array( 
    50         'id' => 'weblogtoolbar', 
    51         'name' => __gettext("Weblog toolbar"), 
    52         'description'=> __gettext("A placeholder for weblog related buttons (resources, videos)"), 
    53         'glossary' => array( 
    54             '{{buttons}}'=> __gettext("List of buttons") 
    55         ) 
    56     ); 
    57  
    58     $template_definition[] = array( 
    59         'id' => 'weblogtoolbarbutton', 
    60         'name' => __gettext("Weblog toolbar button"), 
    61         'description'=> __gettext("A toolbar button instance"), 
    62         'glossary' => array( 
    63             '{{title}}' => __gettext("Button title"), 
    64             '{{accesskey}}' => __gettext("Access key"), 
    65             '{{value}}' => __gettext("Button value if not image is specified"), 
    66             '{{image}}' => __gettext("Button image") 
    67         ) 
    68     ); 
    69  
    7049    $template['weblogpost'] = file_get_contents(dirname(__FILE__)."/templates/blog_post.html"); 
    7150    $template['weblogcomments'] = file_get_contents(dirname(__FILE__)."/templates/blog_comments.html"); 
    7251    $template['weblogcomment'] = file_get_contents(dirname(__FILE__)."/templates/blog_comment.html"); 
    73     $template['weblogtoolbar'] = file_get_contents(dirname(__FILE__)."/templates/blog_toolbar.html"); 
    74     $template['weblogtoolbarbutton'] = file_get_contents(dirname(__FILE__)."/templates/blog_toolbarbutton.html"); 
    7552?> 
  • devel/mod/blog/lib.php

    r1077 r1079  
    144144 
    145145  $CFG->widgets->list[]= array ('name' => __gettext("Blog widget"), 
    146                                  'description' => __gettext("Displays the latest blog posts from a blog of your choice."),'type' => "blog::blog"); 
     146                                'description' => __gettext("Displays the latest blog posts from a blog of your choice."), 
     147                                'type' => "blog::blog"); 
    147148 
    148149  $CFG->templates->variables_substitute['blog'][]= "blog_keyword"; 
  • devel/mod/blog/lib/weblogs_actions.php

    r1077 r1079  
    167167                            // Email comment if applicable 
    168168                            if ($comment->owner != $post->owner) { 
    169                                 $message = __gettext(sprintf("You have received a comment from %s on your blog post '%s'. It reads as follows:", $comment->postedname, stripslashes($post->title))); 
     169                                $message = sprintf(__gettext("You have received a comment from %s on your blog post '%s'. It reads as follows:"), $comment->postedname, stripslashes($post->title)); 
    170170                                $message .= "\n\n" . stripslashes($comment->body) . "\n\n"; 
    171                                 $message .= __gettext(sprintf("To reply and see other comments on this blog post, click here: %s", $CFG->wwwroot . user_info("username",$post->weblog) . "/weblog/" . $post->ident . ".html")); 
     171                                $message .= sprintf(__gettext("To reply and see other comments on this blog post, click here: %s"), $CFG->wwwroot . user_info("username",$post->weblog) . "/weblog/" . $post->ident . ".html"); 
    172172                                $message = wordwrap($message); 
    173173                                message_user($post->owner,$comment->owner,stripslashes($post->title),$message); 
  • devel/mod/blog/lib/weblogs_posts_add.php

    r1077 r1079  
    5656 
    5757    // Add the weblog toolbar 
    58     $buttons = run("weblog:post:toolbar:button"); 
    59     $body .= templates_draw(array( 
    60                                 'context' => 'weblogtoolbar', 
    61                                 'buttons' => $buttons 
    62                             ) 
    63                            ); 
     58     
     59    $buttons = run("display:content:toolbar"); 
     60    if(!empty($buttons)){ 
     61      $body.=$buttons; 
     62    } 
    6463 
    6564    $body .= templates_draw(array( 
  • devel/mod/blog/lib/weblogs_posts_edit.php

    r1077 r1079  
    6767 
    6868    // Add the weblog toolbar 
    69     $buttons = run("weblog:post:toolbar:button"); 
    70     $body .= templates_draw(array( 
    71                                 'context' => 'weblogtoolbar', 
    72                                 'buttons' => $buttons 
    73                             ) 
    74                            ); 
     69    $buttons = run("display:content:toolbar"); 
     70    if(!empty($buttons)){ 
     71      $body.=$buttons; 
     72    } 
    7573 
    7674    $body .= templates_draw(array( 
  • devel/mod/blog/lib/weblogs_text_process.php

    r1077 r1079  
    22 
    33    // Processes text 
    4      
     4 
    55    if (isset($parameter)) { 
    66        if (is_array($parameter)) { 
     
    1111            $addrelnofollow = false; 
    1212        } 
    13          
     13 
    1414         $cachekey = sha1($addrelnofollow . "_" . $run_result); 
    1515         if($cached = elggcache_get("weblogs_text_process:weblogs", $cachekey)) { 
    1616             $run_result = $cached; 
    1717         } else { 
    18              
    19              
    20              
    21              
     18 
    2219            //check for mismatched <>s and force escaping if necessary 
    2320            $numlt = substr_count($run_result, "<"); 
     
    2623                $run_result = htmlspecialchars($run_result, ENT_COMPAT, 'utf-8'); 
    2724            } 
    28              
    29             // Videos 
    30              
    31             $functionbody = <<< END 
    32                  
    33                 \$matches[1] = str_replace("&amp;","&",\$matches[1]); 
    34                 return "<embed class=\"VideoPlayback\" type=\"application/x-shockwave-flash\" src=\"\$matches[1]\" />"; 
    35                  
    36 END; 
    37      
    38             // $run_result = preg_replace_callback("/\{\{video:([A-Za-z0-9\.\:\_\-\/\\?\=\&\+]+)\}\}/i",create_function('$matches',$functionbody),$run_result); 
    39             $run_result = preg_replace_callback("/\{\{video:([^}]+)\}\}/i",create_function('$matches',$functionbody),$run_result); 
    40              
    41              
     25 
     26            if(run("video:text:process",$run_result)!=null){ 
     27              $run_result = run("video:text:process",$run_result); 
     28            } 
     29 
    4230            // URLs to links 
    4331            $run_result = run("weblogs:html_activate_urls", $run_result); 
    44              
     32 
    4533            // Remove the evil font tag 
    4634            $run_result = preg_replace("/<font[^>]*>/i","",$run_result); 
    4735            $run_result = preg_replace("/<\/font>/i","",$run_result); 
    48              
     36 
    4937            // add rel="nofollow" to any links 
    5038            if ($addrelnofollow) { 
     
    5240                $run_result = preg_replace('/<a\s+/i', '<a rel="nofollow" ', $run_result); 
    5341            } 
    54              
     42 
    5543            // Text cutting 
    5644            // Commented out for the moment as it seems to disproportionately increase 
    5745            // memory usage / load 
    58              
     46 
    5947            /* 
    6048            global $individual; 
    61              
     49 
    6250            if (!isset($individual) || $individual != 1) { 
    6351                $run_result = preg_replace("/\{\{cut\}\}(.|\n)*(\{\{uncut\}\})?/","{{more}}",$run_result); 
     
    6856            } 
    6957            */ 
    70              
    7158             $setresult = elggcache_set("weblogs_text_process:weblogs", $cachekey, $run_result); 
    7259         }