• GerryBean

    (@gerrybean)


    I’m sorry but it’s been a long day and just got wind of this plugin.

    I have HUNDREDS of php files I need to get to my wordpress website.
    And possibly a couple hundred graphics within those php files.

    2 Questions…
    Do the graphics ‘magically’ stick with the php file or will I have to upload them to the media file?

    Is there a way to (again) ‘magically’ change the .php file extension to .snippet.php? vs doing it manually.

    It still looks like the best game in town.
    Bean

    http://wordpress.org/extend/plugins/php-snippets/

Viewing 1 replies (of 1 total)
  • fireproofsocks

    (@fireproofsocks)

    I’m not sure I follow you re the graphics… There ain’t no magic in PHP: it’s just code and it does what it’s told. Graphics are never “in” a PHP file unless you have somehow binary encoded them. More likely, your PHP files reference the image files. But how they are referenced can affect how easy it is to preserve those references. E.g. if you used a full URL or a full path to the file, chances are poor that the new web server uses the same URL or path. But if you used a relative path, then that might work well.

    Re the extension — currently the script looks for a “.snippet.php” extension — that was simply something that came out of me integrating APIs that had hundreds of PHP files and I just wanted one of them to correlate to the shortcode. It would make a great feature request to make this extension configurable (file a feature request here: http://code.google.com/p/wordpress-php-snippets/). Re renaming, again, I don’t believe in magic here, but a good text editing program or IDE should have the ability to rename files en masse. I would use the bash terminal for this (Mac or Linux only):

    rename 's/\.php/\.snippet\.php/' *.php

    See http://www.debian-administration.org/articles/150 for more.

    If you want to change the plugin so it looks for different extensions (e.g. simply “.php”), then you can crack open the includes/PHP_Snippet_Functions.php file and look for the following lines:

    if ( !preg_match('/^\./', $sf) && preg_match('/\.snippet\.php$/', $sf) ) {

    That occurs in 2 places. Adjust the regex so it looks like this:

    if ( !preg_match('/^\./', $sf) && preg_match('/\.php$/', $sf) ) {

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: PHP Snippets] Graphics and File extension questions’ is closed to new replies.