WordPress.org

Ready to get started?Download WordPress

Forums

WikitoWordpress Plugin (1 post)

  1. noolaham
    Member
    Posted 5 years ago #

    Hi,

    I tried to Install Wikitowordpress Plugin as Described here

    The Code got Installed as a Mediawiki Extension. However when I tried to install the the same Code as WordPress Extension, It shows a Fatal Error.

    Here the Code:

    <?php
    /*
    Plugin Name: WikiToWordPress extension
    Plugin URI: http://www.emuwiki.com
    Description: Scans new articles created in a wiki and adds them to a Word Press 'Collective blog'
    Version: 0.1
    Author: Jean-Francois Gariépy
    Author URI: http://www.emuwiki.com
    */
    //Those were the extensions credits that show up on the WordPress plugin panel.
    
    /**
     * Protect against register_globals vulnerabilities.
     * This line must be present before any global variable is referenced.
     */
    if (!defined('MEDIAWIKI')) die();
    
    //Extension credits that show up on Special:Version
    $wgExtensionCredits['other'][] = array(
            'name' => 'WikiToWordPress',
            'version' => '0.1',
            'author' => 'Jean-Francois Gariépy',
            'url' => 'http://www.mediawiki.org/wiki/Extension:WikiToWordPress',
            'description' => 'Scans new articles created in a wiki and adds them to a WordPress blog.',
    );
    
    $WordpressConfig = '/home/noolaham/public_html/wordpress/wp-config.php';
    
    $wgHooks['ArticleSaveComplete'][] = 'postAWikiNews';
    
    require_once($WordpressConfig);
    
    function postAWikiNews(&$article, &$user, &$text, &$summary, &$minoredit, &$watchthis, &$sectionanchor, &$flags, $revision) {
    
    $SearchString = 'Category:News';
    $PassFlag = '7';
    
    if (strpos($text, $SearchString)) {
    if (strpos($flags, $PassFlag)) {
    
    // create post object
    class wm_mypost {
        var $post_title;
        var $post_content;
        var $post_status;
        var $post_author;    /* author user id (optional) */
        var $post_name;      /* slug (optional) */
        var $post_type;      /* 'page' or 'post' (optional, defaults to 'post') */
        var $comment_status; /* open or closed for commenting (optional) */
    }
    
    $wm_mypost = new wm_mypost();
    
    $wm_mypost->post_title = $article->mTitle;
    $wm_mypost->post_content = $text;
    $wm_mypost->post_status = 'publish';
    $wm_mypost->post_author = 1;
    $wp_rewrite->feeds = 'no';
    
    // Optional; uncomment as needed
    // $wm_mypost->post_type = 'page';
    // $wm_mypost->comment_status = 'closed';
    
    wp_insert_post($wm_mypost);
    
    return true;
    }
    }
    
    return true;
    
    }

Topic Closed

This topic has been closed to new replies.

About this Topic