For me PHP Code as Replacement text doesn' work. I've tried the examples from the documentation as well as simple own code. The node view allways shows the original input, no filtered text.

The normal (PHP off) replacement works.

Comments

mdroste’s picture

PHP Code on works now with very simple code:
Pattern: /foo/'
PHP: On
Replacement:

if($matches[0] == 'foo')
return 'bar';

But none of the examples in the documentation or similar more advanced code seems to work.

mdroste’s picture

After hours of working with this module I run into this situation:
Some Patterns with PHP Code replacement works with 6.x-1.0-rc2 on my localhost but not on another machine with the same setup (Drupal/PHP)

Some Patterns with PHP Code replacement works with 6.x-2.x-dev, but not with 6.x-2.0-beta 7.

In neither version all Code samples from the documentation pages works. I've also tried some samples from Version 5.x (Wiki samples). Same situation: one works another not.

But in 6.x-2.x-dev one cannot edit any rule (blank form for existing rule)
See also: http://drupal.org/node/685584

I believe this is a very, very usefull module, but a little bit buggy.

avpaderno’s picture

The example code is probably not updated with the latest developed code; for sure it doesn't work with branch 6.x-2.
I don't understand why the example would work in a web site, but not in another web site with the same configuration. If the code is the same, and the version of Custom filter is the same, then probably the cause is something else.

The development snapshots should never be used on a production site, but just to help in testing the module. Thanks for reporting the issues, anyway. I am changing the branch 6.x-2 to add the support for multiple input format descriptions (one for each enabled language); after that, I will check what you reported.

mdroste’s picture

Version: 6.x-1.0-rc2 » 6.x-2.x-dev

The example code is probably not updated with the latest developed code; for sure it doesn't work with branch 6.x-2.
For sure?
On my localhost I run the lastest 6.x-2.x-dev version with example code from the 5.x Version of your module.
Pattern: /^(\={1,9})(.*?)(\={1,9})$/m
Code:

$len = strlen($matches[1]);
          $result = $matches[2];
          if (strlen($matches[3]) == $len) {
            $anchor = count($vars->headings);
            $vars->headings[] = array(
              'level' => $len,
              'text' => $result,
              'anchor' => $anchor,
            );

            $result = "<h$len><a name=\"$anchor\">$result</a></h$len>";
          }

          return $result;

And it works!

And of course I don't work with a dev Snapshot on a production site.

yukare’s picture

Status: Active » Closed (cannot reproduce)

Please, if you still have this bug reopen this, i will close it now.