DrupalBin
Submit Code
About
Recent Posts
Node id in node title
15 min 7 sec
ago
ad
16 min 28 sec
ago
Example of your custom template variable
18 min 8 sec
ago
Code
2 hours 12 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Function where I think the code should be integrated
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
/** * Search and Replace routine. Scans the body of a node and replaces every tag and its parameters with an object. */ function _flashvideo_replace_tags(&$node, $tag) { $max_num_params = 4; // The maximum number of parameters allowed. All others will be ignored. $body = ($node->body == '') ? $node->teaser : $node->body; for($pos = 0; (($pos = $startpos = strpos($body, $tag, $pos)) !== FALSE); $pos++) { // Search for tags // We need to check to see if this tag has "!" in front of it, if it does, then we will ignore this tag. if(substr($body, $pos - 1, 1) == '!') { $body = substr_replace($body, $tag, $pos - 1, strlen($tag) + 1); } else { $pos++; // So that it will skip over the "[". $params = array(); $params = _flashvideo_parse_params($body, $pos); // Parse all the parameters. $object = ($tag == '[thumbnail') ? flashvideo_get_thumbnail($node, $params) : flashvideo_get_video($node, $params); $body = substr_replace($body, $object, $startpos, ($pos - $startpos)); // Replace this tag. } } if($node->body == '') $node->teaser = $body; else $node->body = $body; }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.