WordPress.org

Plugin Directory

Changeset 67967 for sermon-browser/trunk


Ignore:
Timestamp:
10/08/08 09:27:02 (6 years ago)
Author:
mark8barnes
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sermon-browser/trunk/sermon.php

    r67681 r67967  
    55Description: Add sermons to your Wordpress blog. Main coding by <a href="http://codeandmore.com/">Tien Do Xuan</a>. Design and additional coding 
    66Author: Mark Barnes 
    7 Version: 0.37 
     7Version: 0.37.1 
    88Author URI: http://www.4-14.org.uk/ 
    99 
     
    2626 
    2727/*************************************** 
    28  ** Set up                            ** 
     28 ** Initialisation                    ** 
    2929 **************************************/ 
    30 define('SB_CURRENT_VERSION', '0.37'); 
    31 define('SB_DATABASE_VERSION', '1.5'); 
    32 $directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__)); 
    33 if ($directories[count($directories)-1] == 'mu-plugins') { 
    34     define('IS_MU', TRUE); 
    35 } else { 
    36     define('IS_MU', FALSE); 
    37 } 
    38 $sermon_domain = 'sermon-browser'; 
    39 if (IS_MU) { 
    40     load_plugin_textdomain($sermon_domain, '', 'sb-includes'); 
    41 } else { 
    42     load_plugin_textdomain($sermon_domain, '', 'sermon-browser/sb-includes'); 
    43 } 
    44 require_once('sb-includes/dictionary.php'); // Template functions 
    45 include_once('sb-includes/filetypes.php'); // User-defined icons 
    46 include('sb-includes/frontend.php'); // Everything related to displaying sermons 
    47  
    48 if ($_POST['sermon'] == 1) sb_return_ajax_data(); // Return AJAX data if that is all that is required 
    49  
    5030// Add admin menu items and check to see whether install/upgrade is necessary 
     31add_action('init', 'sb_sermon_init'); 
    5132add_action('admin_menu', 'sb_add_pages'); 
    52 sb_sermon_install(); 
    5333add_action('rightnow_end', 'sb_rightnow'); 
    5434register_activation_hook( __FILE__, 'sb_activate' ); 
    5535 
    56 // Add Sermons menu and sub-menus in admin 
    57 function sb_add_pages() { 
    58     global $sermon_domain; 
    59     add_menu_page(__('Sermons', $sermon_domain), __('Sermons', $sermon_domain), 'edit_posts', __FILE__, 'sb_manage_sermons'); 
    60     add_submenu_page(__FILE__, __('Sermons', $sermon_domain), __('Sermons', $sermon_domain), 'edit_posts', __FILE__, 'sb_manage_sermons'); 
    61     if ($_REQUEST['page'] == 'sermon-browser/new_sermon.php' && $_REQUEST['mid']) { 
    62         add_submenu_page(__FILE__, __('Edit Sermon', $sermon_domain), __('Edit Sermon', $sermon_domain), 'publish_posts', 'sermon-browser/new_sermon.php', 'sb_new_sermon'); 
     36// Initialisation 
     37function sb_sermon_init () { 
     38    //Set global constants 
     39    define('SB_CURRENT_VERSION', '0.37.1'); 
     40    define('SB_DATABASE_VERSION', '1.5'); 
     41    $directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__)); 
     42    if ($directories[count($directories)-1] == 'mu-plugins') { 
     43        define('IS_MU', TRUE); 
    6344    } else { 
    64         add_submenu_page(__FILE__, __('Add Sermon', $sermon_domain), __('Add Sermon', $sermon_domain), 'publish_posts', 'sermon-browser/new_sermon.php', 'sb_new_sermon'); 
     45        define('IS_MU', FALSE); 
    6546    } 
    66     add_submenu_page(__FILE__, __('Preachers', $sermon_domain), __('Preachers', $sermon_domain), 'manage_categories', 'sermon-browser/preachers.php', 'sb_manage_preachers'); 
    67     add_submenu_page(__FILE__, __('Series &amp; Services', $sermon_domain), __('Series &amp; Services', $sermon_domain), 'manage_categories', 'sermon-browser/manage.php', 'sb_manage_everything'); 
    68     add_submenu_page(__FILE__, __('Uploads', $sermon_domain), __('Uploads', $sermon_domain), 'upload_files', 'sermon-browser/uploads.php', 'sb_uploads'); 
    69     add_submenu_page(__FILE__, __('Options', $sermon_domain), __('Options', $sermon_domain), 'manage_options', 'sermon-browser/options.php', 'sb_options'); 
    70     add_submenu_page(__FILE__, __('Templates', $sermon_domain), __('Templates', $sermon_domain), 'manage_options', 'sermon-browser/templates.php', 'sb_templates'); 
    71     add_submenu_page(__FILE__, __('Help', $sermon_domain), __('Help', $sermon_domain), 'read', 'sermon-browser/help.php', 'sb_help'); 
    72 } 
    73  
    74 /*************************************** 
    75  ** Main Functions in Admin           ** 
    76  **************************************/ 
    77  
    78 // Installer 
    79 function sb_sermon_install () { 
     47    $sermon_domain = 'sermon-browser'; 
     48    if (IS_MU) { 
     49            load_plugin_textdomain($sermon_domain, '', 'sb-includes'); 
     50    } else { 
     51            load_plugin_textdomain($sermon_domain, '', 'sermon-browser/sb-includes'); 
     52    } 
     53     
     54    // Include required files 
     55    require_once('sb-includes/dictionary.php'); // Template functions 
     56    include_once('sb-includes/filetypes.php'); // User-defined icons 
     57    include('sb-includes/frontend.php'); // Everything related to displaying sermons 
     58 
     59    // Return AJAX data if that is all that is required 
     60    if ($_POST['sermon'] == 1) sb_return_ajax_data(); 
     61 
    8062    //Attempt to set php.ini directives 
    8163    if (sb_return_kbytes(ini_get('upload_max_filesize'))<15360) ini_set('upload_max_filesize', '15M'); 
     
    8567    if (intval(ini_get('max_execution_time'))<600) ini_set('max_execution_time', '600'); 
    8668    if (ini_get('file_uploads')<>'1') ini_set('file_uploads', '1'); 
     69 
    8770    // Only proceed with install if necessary 
    8871    $db_version = get_option('sb_sermon_db_version'); 
     
    9275    require_once(ABSPATH . 'wp-includes/pluggable.php'); 
    9376    require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 
     77 
    9478    // Create folders 
    9579    $sermonUploadDir = sb_get_default('sermon_path'); 
     
    9983        sb_mkdir(sb_get_value('wordpress_path').$sermonUploadDir.'images'); 
    10084    $books = sb_get_default('bible_books'); 
    101      //Upgrade database from earlier versions 
     85 
     86    //Upgrade database from earlier versions 
    10287    if ($db_version) { 
    10388        switch ($db_version) { 
     
    319304    } 
    320305} 
     306 
     307// Add Sermons menu and sub-menus in admin 
     308function sb_add_pages() { 
     309    global $sermon_domain; 
     310    add_menu_page(__('Sermons', $sermon_domain), __('Sermons', $sermon_domain), 'edit_posts', __FILE__, 'sb_manage_sermons'); 
     311    add_submenu_page(__FILE__, __('Sermons', $sermon_domain), __('Sermons', $sermon_domain), 'edit_posts', __FILE__, 'sb_manage_sermons'); 
     312    if ($_REQUEST['page'] == 'sermon-browser/new_sermon.php' && $_REQUEST['mid']) { 
     313        add_submenu_page(__FILE__, __('Edit Sermon', $sermon_domain), __('Edit Sermon', $sermon_domain), 'publish_posts', 'sermon-browser/new_sermon.php', 'sb_new_sermon'); 
     314    } else { 
     315        add_submenu_page(__FILE__, __('Add Sermon', $sermon_domain), __('Add Sermon', $sermon_domain), 'publish_posts', 'sermon-browser/new_sermon.php', 'sb_new_sermon'); 
     316    } 
     317    add_submenu_page(__FILE__, __('Preachers', $sermon_domain), __('Preachers', $sermon_domain), 'manage_categories', 'sermon-browser/preachers.php', 'sb_manage_preachers'); 
     318    add_submenu_page(__FILE__, __('Series &amp; Services', $sermon_domain), __('Series &amp; Services', $sermon_domain), 'manage_categories', 'sermon-browser/manage.php', 'sb_manage_everything'); 
     319    add_submenu_page(__FILE__, __('Uploads', $sermon_domain), __('Uploads', $sermon_domain), 'upload_files', 'sermon-browser/uploads.php', 'sb_uploads'); 
     320    add_submenu_page(__FILE__, __('Options', $sermon_domain), __('Options', $sermon_domain), 'manage_options', 'sermon-browser/options.php', 'sb_options'); 
     321    add_submenu_page(__FILE__, __('Templates', $sermon_domain), __('Templates', $sermon_domain), 'manage_options', 'sermon-browser/templates.php', 'sb_templates'); 
     322    add_submenu_page(__FILE__, __('Help', $sermon_domain), __('Help', $sermon_domain), 'read', 'sermon-browser/help.php', 'sb_help'); 
     323} 
     324 
     325/*************************************** 
     326 ** Main Functions in Admin           ** 
     327 **************************************/ 
    321328 
    322329// Runs upon activation 
Note: See TracChangeset for help on using the changeset viewer.