WordPress.org

Plugin Directory

Changeset 76786 for sermon-browser/trunk


Ignore:
Timestamp:
12/01/08 18:32:22 (5 years ago)
Author:
mark8barnes
Message:
 
Location:
sermon-browser/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • sermon-browser/trunk/sb-includes/datepicker.css

    r57080 r76786  
    7777    height: 17px; 
    7878    text-align: center; 
     79    padding: 0; 
     80    border-bottom: none; 
    7981} 
    8082div.popup-calendar table td.inactive { 
  • sermon-browser/trunk/sb-includes/dictionary.php

    r76389 r76786  
    1212        '[series_link]' => '<a href="<?php sb_print_series_link($sermon) ?>"><?php echo stripslashes($sermon->series) ?></a>', 
    1313        '[service_link]' => '<a href="<?php sb_print_service_link($sermon) ?>"><?php echo stripslashes($sermon->service) ?></a>',    
    14         '[date]' => '<?php echo date(get_option("date_format"), strtotime($sermon->date." 00:00 ".date("O"))) ?>', 
     14        '[date]' => '<?php echo sb_format_date(strtotime($sermon->date." 00:00 ".date("O"))) ?>', 
    1515        '[first_passage]' => '<?php $foo = unserialize($sermon->start); $bar = unserialize($sermon->end); echo sb_get_books($foo[0], $bar[0]) ?>', 
    1616        '[files_loop]' => '<?php foreach ((array) $stuff["Files"] as $file): ?>', 
     
    4343        '[series_link]' => '<a href="<?php sb_print_series_link($sermon["Sermon"]) ?>"><?php echo stripslashes($sermon["Sermon"]->series) ?></a>', 
    4444        '[service_link]' => '<a href="<?php sb_print_service_link($sermon["Sermon"]) ?>"><?php echo stripslashes($sermon["Sermon"]->service) ?></a>', 
    45         '[date]' => '<?php echo date(get_option("date_format"), strtotime($sermon["Sermon"]->date." 00:00 ".date("O"))) ?>', 
     45        '[date]' => '<?php echo sb_format_date(strtotime($sermon["Sermon"]->date." 00:00 ".date("O"))) ?>', 
    4646        '[passages_loop]' => '<?php for ($i = 0; $i < count($sermon["Sermon"]->start); $i++): ?>', 
    4747        '[/passages_loop]' => '<?php endfor ?>', 
  • sermon-browser/trunk/sb-includes/frontend.php

    r76389 r76786  
    494494} 
    495495 
     496function sb_format_date ($the_date) { 
     497    if (WPLANG == '' | WPLANG == "en_EN" | WPLANG == "en") { 
     498        return date(get_option("date_format"), $the_date); 
     499    } else { 
     500        return strftime("%e %B %Y", $the_date); 
     501    } 
     502} 
     503 
    496504// Returns podcast URL 
    497505function sb_podcast_url() { 
     
    602610    } 
    603611    global $siteicons, $default_site_icon ,$filetypes; 
     612    $pathinfo = pathinfo($url); 
     613    $ext = $pathinfo['extension']; 
    604614    if (substr($url,0,7) == "http://") { 
    605615        $url=sb_display_url().htmlspecialchars_decode(sb_query_char()).'show&url='.URLencode($url); 
    606616    } else { 
    607         $url=sb_display_url().htmlspecialchars_decode(sb_query_char()).'show&file_name='.URLencode($url); 
     617        if (strtolower($ext) == 'mp3' && function_exists('ap_insert_player_widgets')) { 
     618            $url=sb_display_url().htmlspecialchars_decode(sb_query_char()).'show&file_name='.URLencode($url); 
     619        } else { 
     620            $url=sb_display_url().htmlspecialchars_decode(sb_query_char()).'download&file_name='.URLencode($url); 
     621        } 
    608622    } 
    609623    $icon_url = sb_get_value('plugin_url').'/sb-includes/icons/'; 
     
    615629        } 
    616630    } 
    617     $pathinfo = pathinfo($url); 
    618     $ext = $pathinfo['extension']; 
    619631    $uicon = isset($filetypes[$ext]['icon']) ? $filetypes[$ext]['icon'] : $uicon; 
    620632    if (strtolower($ext) == 'mp3' && function_exists('ap_insert_player_widgets')) { 
  • sermon-browser/trunk/sb-includes/widget.php

    r76389 r76786  
    3434            <?php   if ($display_passage): ?><span class="sermon-passage">(<?php $foo = unserialize($sermon->start); $bar = unserialize($sermon->end); echo sb_get_books($foo[0], $bar[0]) ?>)</span><?php endif;  
    3535                    if ($display_preacher): ?><span class="sermon-preacher"> <?php _e('by', $sermon_domain) ?> <a href="<?php sb_print_preacher_link($sermon) ?>"><?php echo stripslashes($sermon->preacher) ?></a></span><?php endif;  
    36                     if ($display_date): ?><span class="sermon-date"><?php _e(' on ', $sermon_domain); echo date("j F Y", strtotime($sermon->date)); ?></span><?php endif ?>. 
     36                    if ($display_date): ?><span class="sermon-date"><?php _e(' on ', $sermon_domain); echo sb_format_date(strtotime($sermon->date)); ?></span><?php endif ?>. 
    3737        </li>        
    3838    <?php endforeach ?> 
     
    5454    foreach ( array_keys($options) as $o ) { 
    5555        // Old widgets can have null values for some reason 
    56         if ( !isset($options[$o]['limit']) ) // we used 'something' above in our example.  Replace with with whatever your real data are. 
     56        if ( !isset($options[$o]['limit']) ) 
    5757            continue; 
    5858 
     
    102102            <?php   if ($book): ?><span class="sermon-passage">(<?php $foo = unserialize($sermon->start); $bar = unserialize($sermon->end); echo sb_get_books($foo[0], $bar[0]) ?>)</span><?php endif; 
    103103                    if ($preacherz): ?><span class="sermon-preacher"> <?php _e('by', $sermon_domain) ?> <a href="<?php sb_print_preacher_link($sermon) ?>"><?php echo stripslashes($sermon->preacher) ?></a></span><?php endif; 
    104                     if ($date): ?><span class="sermon-date"> <?php _e(' on ', $sermon_domain); echo date("j F Y", strtotime($sermon->date)); ?></span><?php endif ?>. 
     104                    if ($date): ?><span class="sermon-date"> <?php _e(' on ', $sermon_domain); echo sb_format_date(strtotime($sermon->date)); ?></span><?php endif ?>. 
    105105        </li>        
    106106    <?php endforeach ?> 
  • sermon-browser/trunk/sermon.php

    r76392 r76786  
    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.38 
     7Version: 0.39 
    88Author URI: http://www.4-14.org.uk/ 
    99 
     
    5555    global $sermon_domain; 
    5656    //Set global constants 
    57     define('SB_CURRENT_VERSION', '0.38'); 
     57    define('SB_CURRENT_VERSION', '0.39'); 
    5858    define('SB_DATABASE_VERSION', '1.5'); 
    5959    $directories = explode(DIRECTORY_SEPARATOR,dirname(__FILE__)); 
     
    6969            load_plugin_textdomain($sermon_domain, '', 'sermon-browser/sb-includes'); 
    7070    } 
     71     
     72    if (WPLANG != '') 
     73        setlocale(LC_ALL, WPLANG.'.UTF-8'); 
    7174     
    7275    // Return AJAX data if that is all that is required 
     
    352355    if ($sbmf) update_option('sb_sermon_multi_output', base64_encode(strtr(stripslashes(base64_decode($sbmf)), sb_search_results_dictionary()))); 
    353356    $sbsf = get_option('sb_sermon_single_form'); 
    354     if ($sbsf) update_option('sb_sermon_single_output', base64_encode(strtr(stripslashes(base64_decode($sbsf)), sb_sermon_page_dictionary()))); 
     357    if ($sbsf) { 
     358        update_option('sb_sermon_single_output', base64_encode(strtr(stripslashes(base64_decode($sbsf)), sb_sermon_page_dictionary()))); 
     359        sb_ping_gallery(); 
     360    } 
     361    wp_die("Activated"); 
    355362} 
    356363 
     
    363370        wp_enqueue_script('sb_64'); 
    364371        wp_enqueue_style ('sb_datepicker'); 
     372        wp_enqueue_style ('sb_style'); 
    365373    } 
    366374} 
     
    385393        update_option('sb_sermons_per_page', '15'); 
    386394        if (!is_dir(sb_get_value('wordpress_path').$dir)) { 
    387           //Create that folder 
    388395          if (sb_mkdir(sb_get_value('wordpress_path').$dir)) { 
    389              //try CHMOD it to 777 
    390396             @chmod(sb_get_value('wordpress_path').$dir, 0777);  
    391397          } 
     
    395401        } 
    396402        $books = sb_get_default('bible_books'); 
     403        $eng_books = sb_get_default('eng_bible_books'); 
     404        // Reset bible books database 
    397405        $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}sb_books");  
    398         for ($i=0; $i < count($books); $i++) { // Reset bible books database 
     406        for ($i=0; $i < count($books); $i++) {  
    399407            $wpdb->query("INSERT INTO {$wpdb->prefix}sb_books VALUES (null, '$books[$i]')"); 
    400         } 
     408            $wpdb->query("UPDATE {$wpdb->prefix}sb_books_sermons SET book_name='{$books[$i]}' WHERE book_name='{$eng_books[$i]}'"); 
     409        } 
     410        // Rewrite booknames for non-English locales 
     411        if ($books != $eng_books) { 
     412            $sermon_books = $wpdb->get_results("SELECT id, start, end FROM {$wpdb->prefix}sb_sermons"); 
     413            foreach ($sermon_books as $sermon_book) { 
     414                $start_verse = unserialize($sermon_book->start); 
     415                $end_verse = unserialize($sermon_book->end); 
     416                $start_index = array_search($start_verse[0]['book'], $eng_books, TRUE); 
     417                $end_index = array_search($end_verse[0]['book'], $eng_books, TRUE); 
     418                if ($start_index !== FALSE) 
     419                    $start_verse[0]['book'] = $books[$start_index]; 
     420                if ($end_index !== FALSE) 
     421                    $end_verse[0]['book'] = $books[$end_index]; 
     422                $sermon_book->start = serialize ($start_verse); 
     423                $sermon_book->end = serialize ($end_verse); 
     424                $wpdb->query("UPDATE {$wpdb->prefix}sb_sermons SET start='{$sermon_book->start}', end='{$sermon_book->end}' WHERE id={$sermon_book->id}"); 
     425            } 
     426        } 
     427         
    401428        $checkSermonUpload = sb_checkSermonUploadable(); 
    402429        switch ($checkSermonUpload) { 
     
    431458        update_option('sb_podcast', $_POST['podcast']); 
    432459        if (intval($_POST['perpage']) > 0) update_option('sb_sermons_per_page', $_POST['perpage']); 
     460        if (intval($_POST['perpage']) == -100) update_option('sb_show_donate_reminder', 'off'); 
    433461        update_option('sb_sermon_upload_dir', $dir); 
    434462        update_option('sb_sermon_upload_url', get_bloginfo('wpurl').$dir);       
     
    505533        delete_option('sb_sermons_per_page'); 
    506534        delete_option('sb_sermon_db_version'); 
     535        delete_option('sb_show_donate_reminder'); 
    507536        if (IS_MU) { 
    508537            echo '<div id="message" class="updated fade"><p><b>'.__('All sermon data has been removed.', $sermon_domain).'</b></div>'; 
     
    13441373} 
    13451374 
     1375// Pings the sermon-browser gallery 
     1376function sb_ping_gallery() { 
     1377    global $wpdb; 
     1378    if((ini_get('allow_url_fopen') | function_exists(curl_init)) & get_option('blog_public') == 1 & get_option('ping_sites') != "") { 
     1379        $url = "http://ping.preachingcentral.com/?sg_ping"; 
     1380        $url = $url."&name=".URLencode(get_option('blogname')); 
     1381        $url = $url."&tagline=".URLencode(get_option('blogdescription')); 
     1382        $url = $url."&site_url=".URLencode(get_option('siteurl')); 
     1383        $url = $url."&sermon_url=".URLencode(sb_display_url()); 
     1384        $url = $url."&most_recent=".URLencode($wpdb->get_var("SELECT date FROM {$wpdb->prefix}sb_sermons ORDER BY date DESC LIMIT 1")); 
     1385        $url = $url."&num_sermons=".URLencode($wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}sb_sermons")); 
     1386        $url = $url."&ver=".SB_CURRENT_VERSION; 
     1387        if (ini_get('allow_url_fopen')) { 
     1388            $headers = @get_headers($url, 1); 
     1389            if ($headers !="") { 
     1390                $headers = array_change_key_case($headers,CASE_LOWER); 
     1391            } 
     1392        } else { 
     1393            $curl = curl_init(); 
     1394            curl_setopt ($curl, CURLOPT_URL, $url); 
     1395            curl_setopt ($curl, CURLOPT_HEADER, 1); 
     1396            curl_setopt ($curl, CURLOPT_NOBODY, 1); 
     1397            curl_setopt ($curl, CURLOPT_TIMEOUT, 2); 
     1398            curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1); 
     1399            curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1); 
     1400            curl_setopt ($curl, CURLOPT_MAXREDIRS, 10); 
     1401            $execute = curl_exec ($curl); 
     1402            $info = curl_getinfo ($curl); 
     1403            curl_close ($curl); 
     1404        } 
     1405    } 
     1406} 
     1407 
    13461408// Displays Sermons page 
    13471409function sb_manage_sermons() { 
     
    13531415    if ($_GET['saved']) { 
    13541416        echo '<div id="message" class="updated fade"><p><b>'.__('Sermon saved to database.', $sermon_domain).'</b></div>'; 
     1417        if (get_option('sb_show_donate_reminder') != 'off') 
     1418            echo '<div id="message" class="updated"><p><b>'.sprintf(__('If you find SermonBrowser useful, please consider a %1$ssmall donation%2$s.', $sermon_domain), '<a href="http://www.4-14.org.uk/sermon-browser#support" target="_blank">', '</a>').'</b></div>'; 
    13551419    } 
    13561420     
     
    16091673        // everything is fine, get out of here! 
    16101674        if(!$error) { 
     1675            sb_ping_gallery(); 
    16111676            echo "<script>document.location = '".sb_get_value('admin_url')."sermon.php&saved=true';</script>"; 
    16121677            die(); 
     
    23862451            if ($wpdb->get_var("SELECT COUNT(id) FROM wp_sb_stuff WHERE name LIKE '%.mp3'")>0) 
    23872452                echo '<div id="message" class="updated"><p><b>'.sprintf(__('Tip: Installing the %1$sWordpress Audio Player%2$s will allow users to listen to your sermons more easily.', $sermon_domain), '<a href="http://wpaudioplayer.com/" target="_blank">', '</a>').'</b></div>'; 
    2388         } else { 
    2389             if (rand (1,5) == 1) 
    2390                 echo '<div id="message" class="updated"><p><b>'.sprintf(__('If you find SermonBrowser useful, please consider a %1$ssmall donation%2$s.', $sermon_domain), '<a href="http://www.4-14.org.uk/sermon-browser#support" target="_blank">', '</a>').'</b></div>'; 
    23912453        } 
    23922454    } 
     
    26212683        case 'attachment_url': return get_bloginfo('wpurl').'/'.get_option('upload_path').'/sermons/'; 
    26222684        case 'bible_books': return array(__('Genesis', $sermon_domain), __('Exodus', $sermon_domain), __('Leviticus', $sermon_domain), __('Numbers', $sermon_domain), __('Deuteronomy', $sermon_domain), __('Joshua', $sermon_domain), __('Judges', $sermon_domain), __('Ruth', $sermon_domain), __('1 Samuel', $sermon_domain), __('2 Samuel', $sermon_domain), __('1 Kings', $sermon_domain), __('2 Kings', $sermon_domain), __('1 Chronicles', $sermon_domain), __('2 Chronicles',$sermon_domain), __('Ezra', $sermon_domain), __('Nehemiah', $sermon_domain), __('Esther', $sermon_domain), __('Job', $sermon_domain), __('Psalm', $sermon_domain), __('Proverbs', $sermon_domain), __('Ecclesiastes', $sermon_domain), __('Song of Solomon', $sermon_domain), __('Isaiah', $sermon_domain), __('Jeremiah', $sermon_domain), __('Lamentations', $sermon_domain), __('Ezekiel', $sermon_domain), __('Daniel', $sermon_domain), __('Hosea', $sermon_domain), __('Joel', $sermon_domain), __('Amos', $sermon_domain), __('Obadiah', $sermon_domain), __('Jonah', $sermon_domain), __('Micah', $sermon_domain), __('Nahum', $sermon_domain), __('Habakkuk', $sermon_domain), __('Zephaniah', $sermon_domain), __('Haggai', $sermon_domain), __('Zechariah', $sermon_domain), __('Malachi', $sermon_domain), __('Matthew', $sermon_domain), __('Mark', $sermon_domain), __('Luke', $sermon_domain), __('John', $sermon_domain), __('Acts', $sermon_domain), __('Romans', $sermon_domain), __('1 Corinthians', $sermon_domain), __('2 Corinthians', $sermon_domain), __('Galatians', $sermon_domain), __('Ephesians', $sermon_domain), __('Philippians', $sermon_domain), __('Colossians', $sermon_domain), __('1 Thessalonians', $sermon_domain), __('2 Thessalonians', $sermon_domain), __('1 Timothy', $sermon_domain), __('2 Timothy', $sermon_domain), __('Titus', $sermon_domain), __('Philemon', $sermon_domain), __('Hebrews', $sermon_domain), __('James', $sermon_domain), __('1 Peter', $sermon_domain), __('2 Peter', $sermon_domain), __('1 John', $sermon_domain), __('2 John', $sermon_domain), __('3 John', $sermon_domain), __('Jude', $sermon_domain), __('Revelation', $sermon_domain)); 
     2685        case 'eng_bible_books': return array('Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy', 'Joshua', 'Judges', 'Ruth', '1 Samuel', '2 Samuel', '1 Kings', '2 Kings', '1 Chronicles', '2 Chronicles', 'Ezra', 'Nehemiah', 'Esther', 'Job', 'Psalm', 'Proverbs', 'Ecclesiastes', 'Song of Solomon', 'Isaiah', 'Jeremiah', 'Lamentations', 'Ezekiel', 'Daniel', 'Hosea', 'Joel', 'Amos', 'Obadiah', 'Jonah', 'Micah', 'Nahum', 'Habakkuk', 'Zephaniah', 'Haggai', 'Zechariah', 'Malachi', 'Matthew', 'Mark', 'Luke', 'John', 'Acts', 'Romans', '1 Corinthians', '2 Corinthians', 'Galatians', 'Ephesians', 'Philippians', 'Colossians', '1 Thessalonians', '2 Thessalonians', '1 Timothy', '2 Timothy', 'Titus', 'Philemon', 'Hebrews', 'James', '1 Peter', '2 Peter', '1 John', '2 John', '3 John', 'Jude', 'Revelation'); 
    26232686    } 
    26242687} 
Note: See TracChangeset for help on using the changeset viewer.