Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I patched my version of the script.

    <?php
    /*
    Plugin Name: jQuery Collapse-O-Matic
    Plugin URI: http://www.twinpictures.de/jquery-collapse-o-matic-1-3/
    Description: Collapse-O-Matic adds an <code>[expand]</code> shortcode that wraps content into a lovely, jQuery collapsible div.
    Version: 1.3.13
    Author: Twinpictures
    Author URI: http://www.twinpictures.de
    License: GPL2
    */
    
    /*  Copyright 2012 Twinpictures (www.twinpictures.de)
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License, version 2, as
        published by the Free Software Foundation.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    */
    
    function collapsTronicInit() {
            wp_enqueue_script('jquery');
    
            $plugin_url = trailingslashit( get_bloginfo('wpurl') ).PLUGINDIR.'/'. dirname( plugin_basename(__FILE__) );
            if (!is_admin()){
                //collapse script
                wp_register_script('collapseomatic-js', $plugin_url.'/collapse.js', array ('jquery'), '1.2.7' );
                wp_enqueue_script('collapseomatic-js');
    
                    //css
                wp_register_style( 'collapseomatic-css', $plugin_url.'/style.css', array (), '1.4' );
                wp_enqueue_style( 'collapseomatic-css' );
            }
    
            add_shortcode('expand', 'collapsTronic');
            add_shortcode('expandsub1', 'collapsTronic');
            add_shortcode('expandsub2', 'collapsTronic');
            add_shortcode('expandsub3', 'collapsTronic');
    
            //add the filter to the sidebar widgets
            add_filter('widget_text', 'do_shortcode');
    
    }
    
    add_action('init', 'collapsTronicInit');
    
    function collapsTronic($atts, $content = null){
        //find a random number, incase there is no id assigned
            $ran = rand(1, 10000);
            extract(shortcode_atts(array(
                    'title' => '',
                    'swaptitle' => '',
                    'alt' => '',
                    'id' => 'id'.$ran,
                    'tag' => 'span',
                    'trigclass' => '',
                    'targclass' => '',
                    'rel' => '',
                    'expanded' => '',
                    'excerpt' => '',
                    'excerptpos' => 'below-trigger',
                    'excerpttag' => 'div',
                    'excerptclass' => '',
            ), $atts));
    
            if($excerpt){
                    if($excerptpos == 'above-trigger'){
                            $nibble = '<'.$excerpttag.' class="'.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
                    }
                    else{
                            $nibble = '<'.$excerpttag.' class="collapseomatic_excerpt '.$excerptclass.'">'.$excerpt.'</'.$excerpttag.'>';
                    }
    
            }
            $altatt = '';
            if($alt){
                    $altatt = 'alt="'.$alt.'" title="'.$alt.'"';
            }
            else{
                    $altatt = 'title="'.$title.'"';
            }
            $relatt = '';
            if($rel){
                    $relatt = 'rel="'.$rel.'"';
            }
            if($expanded){
                    $trigclass .= ' colomat-close';
            }
            $link = '<'.$tag.' class="collapseomatic '.$trigclass.'" id="'.$id.'" '.$relatt.' '.$altatt.'>'.$title.'</'.$tag.'>';
            if($swaptitle){
                    $link .= '<'.$tag.' id="swap-'.$id.'" style="display:none;">'.$swaptitle.'</'.$tag.'>';
            }
            $eDiv = '';
            if($content != ' '){
                    $eDiv = '<div id="target-'.$id.'" class="collapseomatic_content '.$targclass.'">'.do_shortcode($content).'</div>';
            }
            if($excerpt){
                    if($excerptpos == 'above-trigger'){
                            return $nibble . $link . $eDiv;
                    }
                    else if($excerptpos == 'below-trigger'){
                            return $link . $nibble . $eDiv;
                    }
                    else{
                            return $link . $eDiv . $nibble;
                    }
            }
            else{
                    return $link . $eDiv;
            }
    }
    Thread Starter lancehudson

    (@lancehudson)

    Updated patched version to allow upload of mm files

    <?php
    /*
    Plugin Name: Freemind Viewer
    Plugin URI: http://www.semeteys.org/wp-freemind
    Description: Integration of Freemind Flash viewer into WordPress
    Version: 1.0
    Author: Raphaël Semeteys
    Author URI: http://www.semeteys.org
    
    Copyright 2009  Raphaël Semeteys  (email: [email protected])
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    
    */
    
    function freemind_init() {
        //Register the flashobject JS library
        wp_enqueue_script('flashobject', '/wp-content/plugins/wp-freemind/flashobject.js', array(), true);
    }
    
    add_action('init', 'freemind_init');
    add_filter('upload_mimes', 'freemind_mime_types');
    
    //Function to allow mm files to be uploaded
    function freemind_mime_types( $mime_types = array() ) {
    
    	$mime_types['mm'] = 'application/freemind';
    
    	return $mime_types;
    }
    
    //Function to replace the [mindmap] shortcode
    function handle_freemind_shortcode($atts, $content) {
    $defaults_array = array(
       'width' => false,
       'height' => '600px',
       );
    //Generate unique id for DIV to be replaced
    $id = 'wpf'.time().rand(0,1000);
    if ($content == '') $content = plugins_url('wp-freemind.mm', __FILE__);
    $a = shortcode_atts($defaults_array, $atts);
    $height = 'height:'.$a['height'];
    $width = ($a['width'])?(';width:'.$a['width']):'';
    return '<div id="'.$id.'" style="'.$height.$width.'">JavaScript or Flash plugin need to be activated in your browser.</div>
    <script type="text/javascript">
    <!--
    var fo = new FlashObject("'.plugins_url('visorFreemind.swf', __FILE__).'", "visorFreeMind", "100%", "100%", 6, "#9999ff");
    fo.addVariable("initLoadFile","'.$content.'");
    fo.write("'.$id.'");
    //-->
    </script>';
    }
    
    add_shortcode('freemind', 'handle_freemind_shortcode');
    ?>

    Thread Starter lancehudson

    (@lancehudson)

    One cause of the bluescreens is if wordpress is in a subdir.

    after some stumbling around it looks like you should use
    define(‘DOING_CRON’, true);

    Good luck,

    –Xomen

Viewing 4 replies - 1 through 4 (of 4 total)