Forum Replies Created

Viewing 5 replies - 16 through 20 (of 20 total)
  • I have done just that. See Example in Dutch. Although this is in Dutch you can see the effect. The calculator at the end is an included php file containing an Ajax form. I do not agree with the developer of the plugin that TinyMCE does not go together with php code. I use php by using an include php file as I want to separate code from html, to keep the post manageable. I can edit the post in TinyMCE. The post will show the include directive
    <?php include_once(‘xxxxx.php’) ; ?> in wysiwg-view and
    &lt ;?php include_once(‘xxxxx.php’) ; ?&gt ;?php in html-view (without the spaces for the semi-colons).

    All the action is in the runtime.php file.

    I will tell you my solution:

    (i)
    I do not want to the plugin to be activated for every post as php execution is a danger anyway. So I define a meta-tag ‘php-exec’
    and only if it ==1 the plugin will do its job. So right at the beginning of the function “eval_php()” I introduce:

    //
    // BEGIN CHANGE BY YOUR NAME HERE
    //
      $post;
      if (isset($post)) {
        $custom_fields = get_post_custom();
        if (!isset ($custom_fields['php-exec'][0])){
          return $content;
        }
        if ($custom_fields['php-exec'][0] != '1') {
          return $content;
        }
      }
      else {
        return $content; // non-posts are returned without eval
      }
    //
    // END CHANGE BY YOUR NAME HERE
    //

    (ii)
    In the same function, right before ob_start() I inserted:

    //
    // BEGIN CHANGE BY YOUR NAME HERE
    //
      $content = str_replace('&lt ;?php', '<?php', $content);
      $content = str_replace('?&gt ;', '?>', $content);
    //
    // remove spaces before semi-colons
    // END CHANGE BY YOUR NAME HERE
    //

    (iii)
    The comments are necessary when later you want with a grep-like program to find all your changes. To prevent loosing your solution (and your edited file) on upgrading the plugin, rename the edited plugin slightly in the file php-exec.php and change author name etc.
    Reinstall the original plugin but do not activate it. When WordPress warns you that you should upgrade the original plugin you will see immediately below or above it in the plugin list your own version. Then you upgrade and edits the new file again with the still present old edited file.

    (iv)
    The drawback with my solution is that if your original post contained already (although not very likely) ‘&lt ;?php’ this will be activated in a real ‘<?php’. Not what you want and possibly dangerous. The meta tag protects you already from this to a certain extent. A better way would be to use something more unique like ‘&lt ;?php&lt ;?php’ as the string to be replaced.

    (v)
    I have tried a number of other solutions, but in the above solution all the global variables are visible from within the included file.

    Thread Starter Ad Lagendijk

    (@adlag)

    Sorry, my mistake. Excellent plugin, btw.

    There are quite a number of active threads (besides this one) on this API key problem.

    I have several independent blogs and several wordpress.com accounts.
    I could not get the plugin working. Even not with brandnew blogs and
    brandnew accounts. Always this API key problem. I have abandoned the plugin and use an alternative.

    I think the developers of this plugin should seriously consider withdrawing the plugin or get their act together and solve the problem.

    Thread Starter Ad Lagendijk

    (@adlag)

    Thanks,
    but the smtp server is OK.

    You say it is gone, which seems like it was there.
    I think the problem is the following:
    in theme file single.php there is a <div> declaration for the post:
    <div id=”content” class=”widecolumn”>
    If you want room for a sidebar you have to change this into narrowcolumn
    and add <?php get_sidebar(); ?> somewhere (a good place is just
    before <?php get_footer(); ?>

Viewing 5 replies - 16 through 20 (of 20 total)