Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    Hi,

    I'm trying to write a plugin for textpattern that integrates with plogger. (I did this once before, but it was pretty messy.) One issue that I could use some help with is that it would be handy to be able to use functions from plog-functions.php like generate_thumb(). To do this though, I need the globals $config and $thumbnail_config, and they won't load, apparently due to a permissions issue. Is there any way I could get these variables into a textpattern plugin?
    •  
      CommentAuthormike
    • CommentTimeJul 26th 2007
     
    Really, all you should need to do is include plog-load_config.php in your textpattern plugin
    require_once('plog-load_config.php');

    And it should be immediately available in your script. Of course, you may be having a function scope problem. The $config variable will be available to you directly in the script you include that file from, however it will not be available within any functions defined in this script.

    For example

    require_once('plog-load_config.php');

    print_r($config); // should print out the configuration array

    function some_function() {
    print_r($config); // won't print anything
    }


    If you declare the variable in the global scope in both contexts, it should be available in the function.


    global $config = array();
    require_once('plog-load_config.php');

    print_r($config); // should print out the configuration array

    function some_function() {
    global $config;
    print_r($config); // should print out the configuration array, too
    }


    Another way to get configuration information from Plogger (v3) is to use the XML service. Although it would be much slower, you could use the SimpleXML library (PHP5) and write a simple parser by sending a query to plog-xml.php. Sending a query to this file with no arguments just gives you back the basic configuration settings in XML.

    For example, sending a query to http://www.plogger.org/demo/plog-xml.php sends back everything in the config array

    <plogger name="Demo Gallery">
    <config>
    <thumb_num>8</thumb_num>
    <date_format>F j, Y</date_format>
    <compression>75</compression>
    <default_sortby>date</default_sortby>
    <default_sortdir>DESC</default_sortdir>
    <gallery_name>Demo Gallery</gallery_name>
    <allow_dl>1</allow_dl>
    <allow_comments>0</allow_comments>
    <allow_print>1</allow_print>
    <truncate>12</truncate>
    <feed_num_entries>15</feed_num_entries>
    <feed_title>Plogger Photo Feed</feed_title>
    <use_mod_rewrite>0</use_mod_rewrite>
    <feed_language>en-us</feed_language>
    <comments_notify>1</comments_notify>
    <square_thumbs>1</square_thumbs>
    <gallery_url>http://plogger.org/demo/</gallery_url>
    <allow_fullpic>1</allow_fullpic>
    <comments_moderate>0</comments_moderate>
    <theme_dir>air</theme_dir>
    <album_sortby>id</album_sortby>
    <album_sortdir>DESC</album_sortdir>
    <collection_sortby>id</collection_sortby>
    <collection_sortdir>DESC</collection_sortdir>
    <enable_thumb_nav>0</enable_thumb_nav>
    <thumb_nav_range>0</thumb_nav_range>
    <baseurl>/demo/plog-xml.php</baseurl>
    <embedded>1</embedded>
    <theme_url>http://plogger.org/demo/themes/air/</theme_url>
    <charset>utf-8</charset>
    <version>Version 3.0 Beta</version>
    </config>
    </plogger>