Changeset 120 for branches/mvblog-1_6/common/functions_blog.php
- Timestamp:
- 04/11/06 22:44:51 (3 years ago)
- Files:
-
- 1 modified
-
branches/mvblog-1_6/common/functions_blog.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/mvblog-1_6/common/functions_blog.php
r118 r120 43 43 ob_start(); 44 44 $db = db_init(); 45 $version = "SVN"; 46 $plugins = array(); 47 /* populate the $plugins array */ 48 load_plugins(); 45 $version = "1.6"; 49 46 //}}}-------------------------------------------------------- 50 47 //{{{ check_admin_logged_in: are we logged in as admin user ? … … 157 154 <div class="log_body"> 158 155 <div class="log_contents"> 159 <?= run_plugins(strip_invalid_xml(stripslashes(str_replace("##BREAKPOINT##", "", $row["body"]))), "text_output")?>156 <?=strip_invalid_xml(stripslashes(str_replace("##BREAKPOINT##", "", $row["body"])))?> 160 157 </div> 161 158 </div> … … 193 190 echo "[Comment deleted by admin on ".date("d-m-Y H:i", $row["deleted"])."]"; 194 191 } else { 195 echo nl2br(stripslashes(htmlspecialchars(strip_invalid_xml( run_plugins($row["comment"], "text_output")))));192 echo nl2br(stripslashes(htmlspecialchars(strip_invalid_xml($row["comment"])))); 196 193 } 197 194 ?> … … 614 611 <? } ?> 615 612 <? 616 if (limit_text( run_plugins(strip_invalid_xml(stripslashes($row["body"])), "text_output"), 4000)) {613 if (limit_text(strip_invalid_xml(stripslashes($row["body"])), 4000)) { 617 614 ?><br /><br /><a href="index.php?action=view&id=<?=$row["id"]?>" class="link_readmore">read more</a><? 618 615 } … … 719 716 return $data; 720 717 } 721 //}}}-------------------------------------722 //{{{ load_plugins(): load all the plugins723 //----------------------------------------724 function load_plugins() {725 /* this should become a setting */726 $plugins = array();727 $plugin_dir = "plugins/";728 if (is_dir($plugin_dir)) {729 $plug_fd = opendir($plugin_dir);730 while (false !== ($fp = readdir($plug_fd))) {731 if (!preg_match("/^\./", $fp)) {732 require_once($plugin_dir.$fp);733 }734 }735 }736 }737 738 function register_plugin($name, $type) {739 $GLOBALS["plugins"][$type][] = $name;740 }741 742 function getPluginsByType($type) {743 if (is_array($GLOBALS["plugins"][$type])) {744 foreach ($GLOBALS["plugins"][$type] as $p) {745 $plugs[] = $p;746 }747 } else {748 $plugs[] = "";749 }750 return $plugs;751 }752 //}}}--------------------------------------------------753 //{{{ run_plugins($data, $types): run specified plugins754 //-----------------------------------------------------755 function run_plugins($data, $types) {756 if (!is_array($types)) {757 $plugintypes[0] = $types;758 } else {759 $plugintypes = $types;760 }761 unset($types);762 foreach($plugintypes as $type) {763 $plugins = getPluginsByType($type);764 }765 foreach ($plugins as $plugin) {766 if (function_exists("plugin_$plugin")) {767 $data = eval("return plugin_$plugin(\$data);");768 }769 }770 return $data;771 }772 718 773 719 //}}}---------------------------------------
