Skip to content

Commit

Permalink
More structural changes
Browse files Browse the repository at this point in the history
  • Loading branch information
actual-saurabh committed Dec 19, 2012
1 parent 1c50cc5 commit 043add6
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 48 deletions.
31 changes: 7 additions & 24 deletions BPMedia.php → BuddyPressMedia.php
Expand Up @@ -10,23 +10,17 @@
if ( ! defined( 'ABSPATH' ) )
exit;

class BPMedia {
class BuddyPressMedia {

public $text_domain = 'bp-media';

public function __construct() {
global $bp_text_domain;
$bp_text_domain = $this->text_domain;
global $bpm_text_domain;
$bpm_text_domain = $this->text_domain;
}

public function constants() {

if ( ! defined( 'BP_MEDIA_PATH' ) )
define( 'BP_MEDIA_PATH', plugin_dir_path( __FILE__ ) );

if ( ! defined( 'BP_MEDIA_URL' ) )
define( 'BP_MEDIA_URL', plugin_dir_url( __FILE__ ) );

/* A constant that can be checked to see if the BP Media is installed or not. */
if ( ! defined( 'BP_MEDIA_IS_INSTALLED' ) )
define( 'BP_MEDIA_IS_INSTALLED', 1 );
Expand Down Expand Up @@ -64,19 +58,6 @@ public function constants() {
define( 'BP_MEDIA_AC_API_CATEGORY_ID', '224' );
}

function __autoload( $class_name ) {
$rtlibpath = array(
BP_MEDIA_PATH . 'rtlib/' . $class_name . '.php',
BP_MEDIA_PATH . 'admin/' . $class_name . '.php',
BP_MEDIA_PATH . 'includes/' . $class_name . '.php',
);
foreach ( $rtlibpath as $i => $path ) {
if ( file_exists( $path ) ) {
include $path;
break;
}
}
}

private function init() {

Expand All @@ -90,8 +71,10 @@ private function deactivate() {

}

public function autoload_js_css(){

}

}

global $bp_media;
$bp_media = new BPMedia();
?>
37 changes: 37 additions & 0 deletions index.php
@@ -0,0 +1,37 @@
<?php
/*
Plugin Name: BuddyPress Media
Plugin URI: http://rtcamp.com/buddypress-media/
Description: This plugin adds missing media rich features like photos, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
Version: 2.3.2
Author: rtCamp
Author URI: http://rtcamp.com
*/

if ( ! defined( 'BP_MEDIA_PATH' ) )
define( 'BP_MEDIA_PATH', plugin_dir_path( __FILE__ ) );

if ( ! defined( 'BP_MEDIA_URL' ) )
define( 'BP_MEDIA_URL', plugin_dir_url( __FILE__ ) );

function buddypress_media_autoloader( $class_name ) {
$rtlibpath = array(
'app/helper/' . $class_name . '.php',
'app/admin/' . $class_name . '.php',
'app/main/' . $class_name . '.php',
'lib/rtlib/' . $class_name . '.php',
);
foreach ( $rtlibpath as $i => $path ) {
if ( file_exists( $path ) ) {
include $path;
break;
}
}
}

spl_autoload_register('buddypress_media_autoloader');

global $bp_media, $bp_admin;
$bp_admin = new BPMAdmin();
$bp_media = new BuddyPressMedia();
?>
9 changes: 1 addition & 8 deletions loader.php
@@ -1,12 +1,5 @@
<?php
/*
Plugin Name: BuddyPress Media
Plugin URI: http://rtcamp.com/buddypress-media/
Description: This plugin adds missing media rich features like photos, videos and audios uploading to BuddyPress which are essential if you are building social network, seriously!
Version: 2.3.2
Author: rtCamp
Author URI: http://rtcamp.com
*/


/* A constant that can be checked to see if the BP Media is installed or not. */
define('BP_MEDIA_IS_INSTALLED', 1);
Expand Down
33 changes: 17 additions & 16 deletions phpunit.xml
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="BuddyPress Media">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php"
>
<testsuites>
<testsuite name="BuddyPress Media">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 043add6

Please sign in to comment.