Plugin Directory

Changeset 230896


Ignore:
Timestamp:
04/20/2010 07:03:35 AM (16 years ago)
Author:
andreabelvedere
Message:

updated autoload, now using spl_autoload

Location:
private-network/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • private-network/trunk/private-network.php

    r85109 r230896  
    11<?php
    22/*
    3 Plugin Name: Private Network
    4 Plugin URI: http://www.andreabelvedere.com/private-network
    5 Description: Allows Administrators at different WordPress installations, for example www.alice.com and www.bob.com, to share their posts within categories, posts with selected tags or single posts and pages. Within categories and tags is possible to share only private or include public posts.
    6 Author: Andrea Belvedere
    7 Version: 1.1
    8 Author URI: http://www.andreabelvedere.com/
     3  Plugin Name: Private Network
     4  Plugin URI: http://www.andreabelvedere.com/private-network
     5  Description: Allows Administrators at different WordPress installations, for example www.alice.com and www.bob.com, to share their posts within categories, posts with selected tags or single posts and pages. Within categories and tags is possible to share only private or include public posts.
     6  Author: Andrea Belvedere
     7  Version: 1.2
     8  Author URI: http://www.andreabelvedere.com/
    99*/
    1010/*  Copyright 2008  Andrea Belvedere  (email : scieck at gmail dot com)
     
    2424    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    2525*/
    26 define('PN_VERSION', '1.1');
     26define('PN_VERSION', '1.2');
    2727define('PN_DB_VERSION', '1.1');
    2828define('PN_PROTOCOL', '1.0');
     
    4343
    4444
    45 function __autoload($class)
     45function pn_autoload($class)
    4646{
    47     if (class_exists($class, false) || interface_exists($class, false)) {
    48         return;
    49     }
    50     $classfile = str_replace("_", "/", $class) . ".php";
     47    if (class_exists($class, false) || interface_exists($class, false)) {
     48        return;
     49    }
     50    $classfile = str_replace("_", "/", $class) . ".php";
    5151
    52     $include_path = array(PN_DIR.'/controller',
    53                           PN_DIR.'/lib',
    54                           PN_DIR.'/include',
    55                           PN_DIR.'/model');
     52    $include_path = array(PN_DIR.'/controller',
     53                          PN_DIR.'/lib',
     54                          PN_DIR.'/include',
     55                          PN_DIR.'/model');
    5656
    57     foreach ($include_path as $path) {
    58         $classpath = $path.'/'.$classfile;
    59         if(file_exists($classpath)) {
    60             include_once $classpath;
    61             return;
    62         }
    63     }
     57    foreach ($include_path as $path) {
     58        $classpath = $path.'/'.$classfile;
     59        if(file_exists($classpath)) {
     60            include_once $classpath;
     61            return;
     62        }
     63    }
    6464}
    6565
    6666class PrivateNetwork
    6767{
    68     protected $_pnSession;
     68    protected $_pnSession;
    6969
    70     public function __construct()
    71     {
    72         $this->_pnSession = new pnSession();
    73         register_activation_hook( __FILE__, array(&$this, 'activate_pn'));
    74         register_deactivation_hook( __FILE__, array(&$this, 'deactivate_pn'));
    75         add_action('shutdown', array(&$this->_pnSession, 'cleanSession'));
    76         if (is_admin()) {
    77             new pnAdminController();
    78         }
    79         else {
    80             new pnPrivateNetworkController();
    81         }
    82     }
     70    public function __construct()
     71    {
     72        $this->_pnSession = new pnSession();
     73        register_activation_hook( __FILE__, array(&$this, 'activate_pn'));
     74        register_deactivation_hook( __FILE__, array(&$this, 'deactivate_pn'));
     75        add_action('shutdown', array(&$this->_pnSession, 'cleanSession'));
     76        if (is_admin()) {
     77            new pnAdminController();
     78        }
     79        else {
     80            new pnPrivateNetworkController();
     81        }
     82    }
    8383
    84     public function activate_pn()
    85     {
    86         $contact = new pnContact();
    87         $contact->create();
    88         $admin = new pnAdmin();
    89         $admin->create();
    90         $this->_pnSession->create();
    91         $acl = new pnACL();
    92         $acl->create();
    93     }
     84    public function activate_pn()
     85    {
     86        $contact = new pnContact();
     87        $contact->create();
     88        $admin = new pnAdmin();
     89        $admin->create();
     90        $this->_pnSession->create();
     91        $acl = new pnACL();
     92        $acl->create();
     93    }
    9494
    95     public function deactivate_pn()
    96     {
    97        
    98     }
     95    public function deactivate_pn()
     96    {
     97
     98    }
    9999}
     100if (false === spl_autoload_functions())
     101{
     102    if (function_exists('__autoload')) {
     103        spl_autoload_register('__autoload');
     104    }
     105}
     106spl_autoload_register('pn_autoload');
    100107
    101108new PrivateNetwork();
  • private-network/trunk/readme.txt

    r85938 r230896  
    44Tags: post, page, private, network, private network
    55Requires at least: 2.5.0
    6 Tested up to: 2.7
    7 Stable tag: 1.1
     6Tested up to: 2.9.2
     7Stable tag: 1.2
    88
    99Allows Administrators at different WP installations, for example alice.com and bob.com, to share remotely their private and public posts and pages.
     
    1414
    1515= How does it work: =
    16 Lets say that Alice, the Administrator of www.alice.com wants to share her private posts with her best friend Bob, the Administrator of www.bob.com; 
     16Lets say that Alice, the Administrator of www.alice.com wants to share her private posts with her best friend Bob, the Administrator of www.bob.com;
    1717this are the steps that both Alice and Bob would have to follow:
    1818
     
    3131= Features =
    3232
     33* Version 1.2 - No features enhancement in this release, bug fixes only (i.e. better class autoloading)
    3334* Version 1.1 - Share entire categories, posts with specific tags, single posts or pages.
    3435* Version 1.1 - Possible to share both private and public items
Note: See TracChangeset for help on using the changeset viewer.