Changeset 1079
- Timestamp:
- 04/23/07 13:18:33 (2 years ago)
- Files:
-
- devel/mod/blog/default_template.php (modified) (1 diff)
- devel/mod/blog/lib.php (modified) (1 diff)
- devel/mod/blog/lib/weblogs_actions.php (modified) (1 diff)
- devel/mod/blog/lib/weblogs_posts_add.php (modified) (1 diff)
- devel/mod/blog/lib/weblogs_posts_edit.php (modified) (1 diff)
- devel/mod/blog/lib/weblogs_text_process.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/mod/blog/default_template.php
r1077 r1079 47 47 ); 48 48 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 70 49 $template['weblogpost'] = file_get_contents(dirname(__FILE__)."/templates/blog_post.html"); 71 50 $template['weblogcomments'] = file_get_contents(dirname(__FILE__)."/templates/blog_comments.html"); 72 51 $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");75 52 ?> devel/mod/blog/lib.php
r1077 r1079 144 144 145 145 $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"); 147 148 148 149 $CFG->templates->variables_substitute['blog'][]= "blog_keyword"; devel/mod/blog/lib/weblogs_actions.php
r1077 r1079 167 167 // Email comment if applicable 168 168 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)); 170 170 $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"); 172 172 $message = wordwrap($message); 173 173 message_user($post->owner,$comment->owner,stripslashes($post->title),$message); devel/mod/blog/lib/weblogs_posts_add.php
r1077 r1079 56 56 57 57 // 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 } 64 63 65 64 $body .= templates_draw(array( devel/mod/blog/lib/weblogs_posts_edit.php
r1077 r1079 67 67 68 68 // 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 } 75 73 76 74 $body .= templates_draw(array( devel/mod/blog/lib/weblogs_text_process.php
r1077 r1079 2 2 3 3 // Processes text 4 4 5 5 if (isset($parameter)) { 6 6 if (is_array($parameter)) { … … 11 11 $addrelnofollow = false; 12 12 } 13 13 14 14 $cachekey = sha1($addrelnofollow . "_" . $run_result); 15 15 if($cached = elggcache_get("weblogs_text_process:weblogs", $cachekey)) { 16 16 $run_result = $cached; 17 17 } else { 18 19 20 21 18 22 19 //check for mismatched <>s and force escaping if necessary 23 20 $numlt = substr_count($run_result, "<"); … … 26 23 $run_result = htmlspecialchars($run_result, ENT_COMPAT, 'utf-8'); 27 24 } 28 29 // Videos 30 31 $functionbody = <<< END 32 33 \$matches[1] = str_replace("&","&",\$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 42 30 // URLs to links 43 31 $run_result = run("weblogs:html_activate_urls", $run_result); 44 32 45 33 // Remove the evil font tag 46 34 $run_result = preg_replace("/<font[^>]*>/i","",$run_result); 47 35 $run_result = preg_replace("/<\/font>/i","",$run_result); 48 36 49 37 // add rel="nofollow" to any links 50 38 if ($addrelnofollow) { … … 52 40 $run_result = preg_replace('/<a\s+/i', '<a rel="nofollow" ', $run_result); 53 41 } 54 42 55 43 // Text cutting 56 44 // Commented out for the moment as it seems to disproportionately increase 57 45 // memory usage / load 58 46 59 47 /* 60 48 global $individual; 61 49 62 50 if (!isset($individual) || $individual != 1) { 63 51 $run_result = preg_replace("/\{\{cut\}\}(.|\n)*(\{\{uncut\}\})?/","{{more}}",$run_result); … … 68 56 } 69 57 */ 70 71 58 $setresult = elggcache_set("weblogs_text_process:weblogs", $cachekey, $run_result); 72 59 }
