Changeset 135455
- Timestamp:
- 07/15/2009 04:35:41 PM (17 years ago)
- Location:
- quartz/trunk
- Files:
-
- 1 added
- 4 edited
-
import.php (modified) (3 diffs)
-
quartz.php (modified) (4 diffs)
-
quote_form.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
wpframe.php (added)
Legend:
- Unmodified
- Added
- Removed
-
quartz/trunk/import.php
r75565 r135455 1 1 <?php 2 if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) die('Don\'t call this page directly.'); // Stop direct call 3 /* :DEBUG: */ $wpdb->show_errors();2 require('wpframe.php'); 3 stopDirectCall(__FILE__); 4 4 5 5 if(isset($_REQUEST['submit']) and $_REQUEST['submit']) { … … 38 38 39 39 <div class="wrap"> 40 <h2><?php e cho __("Import Quotes"); ?></h2>40 <h2><?php e("Import Quotes"); ?></h2> 41 41 42 42 <form name="post" action="" method="post" id="post" enctype="multipart/form-data"> 43 43 <div id="poststuff"> 44 44 45 <p><?php echo __("You can import quotes from a text file. Each line in the text file must have a quote in it. An example is the <a href='http://binnyva.com/pro/dos/boot_booster/quotes/celebrity.txt'>Celebrity Quotes File</a>. You can import that file by entering the value 'http://binnyva.com/pro/dos/boot_booster/quotes/celebrity.txt' in the 'Remote Text File' field."); ?></p> 46 47 <h3><?php echo __("Upload Text File"); ?></h3> 45 <p><?php e("You can import quotes from a text file. Each line in the text file must have a quote in it. An example is the <a href='http://binnyva.com/pro/dos/boot_booster/quotes/celebrity.txt'>Celebrity Quotes File</a>. You can import that file by entering the value 'http://binnyva.com/pro/dos/boot_booster/quotes/celebrity.txt' in the 'Remote Text File' field."); ?></p> 46 47 <div class="postbox"> 48 <h3 class="hndle"><span><?php e("Upload Text File"); ?></span></h3> 49 <div class="inside"> 48 50 <input type="file" name="textfile" /> 51 </div></div> 49 52 50 53 <p>OR</p> 51 54 52 <h3><?php echo __("Remote Text File"); ?></h3> 55 <div class="postbox"> 56 <h3 class="hndle"><span><?php e("Remote Text File"); ?></span></h3> 57 <div class="inside"> 53 58 <input type="text" name="text-url" /> 54 59 </div></div> 55 60 56 61 <p class="submit"> … … 58 63 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 59 64 <span id="autosave"></span> 60 <input type="submit" name="submit" value="<?php e cho __('Import') ?>" style="font-weight: bold;" tabindex="4" />65 <input type="submit" name="submit" value="<?php e('Import') ?>" style="font-weight: bold;" tabindex="4" /> 61 66 </p> 62 67 -
quartz/trunk/quartz.php
r75565 r135455 2 2 /* 3 3 Plugin Name: Quartz 4 Plugin URI: http://www.bin-co.com/ blog/2008/11/quartz-wordpress-plugin/4 Plugin URI: http://www.bin-co.com/tools/wordpress/plugins/quartz/ 5 5 Description: Quartz Plugin lets you show random quotes/tips/links/pictures/something to visitors. These quotes can be added from the admin side. 6 Version: 1.0 0.06 Version: 1.01.0 7 7 Author: Binny V A 8 Author URI: http:// www.binnyva.com/8 Author URI: http://binnyva.com/ 9 9 */ 10 require_once('wpframe.php'); 10 11 11 12 /** … … 14 15 add_action( 'admin_menu', 'quartz_add_menu_links' ); 15 16 function quartz_add_menu_links() { 17 global $wp_version; 16 18 $view_level= 2; 17 add_submenu_page( 'edit.php', __('Manage Quotes'), 18 __('Manage Quotes'), $view_level, 19 'quartz/all_quotes.php' ); 19 $page = 'edit.php'; 20 if($wp_version >= '2.7') $page = 'tools.php'; 21 22 add_submenu_page($page, t('Manage Quotes'), t('Manage Quotes'), $view_level, 'quartz/all_quotes.php' ); 23 wpf_register_pages(array('import.php','quote_form.php'), 'quartz'); 20 24 } 21 25 … … 23 27 * User Function - Called from the Template 24 28 */ 25 function quartz_show($quote_count = 1, $joiner = '<br />' ) {29 function quartz_show($quote_count = 1, $joiner = '<br />', $mode = 'print') { 26 30 global $wpdb; 27 31 $quotes = $wpdb->get_col("SELECT quote FROM {$wpdb->prefix}quartz_quote WHERE status='1' ORDER BY RAND() LIMIT 0, $quote_count", 0); 28 print implode($joiner, $quotes); 32 $final = implode($joiner, $quotes); 33 34 if($mode == 'return') return $final; 35 print $final; 29 36 } 37 38 function quartz_show_widget() { 39 $count = get_option('quartz_widget_quote_count'); 40 41 print "<li><h3>". get_option('quartz_widget_title') . "</h3>"; 42 if($count > 1) print "<ul><li>" . quartz_show($count, '</li><li>', 'return') . "</li></ul>"; 43 else print quartz_show(1,'','return'); 44 45 print "</li>"; 46 } 47 48 /// Quartz as a Sidebar widget 49 function quartz_widget_init() { 50 if (! function_exists("register_sidebar_widget")) return; 51 52 function quartz_show_options() { 53 if ( $_POST['quartz-submit'] ) { 54 update_option('quartz_widget_title', $_REQUEST['quartz_widget_title']); 55 update_option('quartz_widget_quote_count', $_REQUEST['quartz_widget_quote_count']); 56 } 57 echo '<p style="text-align:right;"><label for="quartz_widget_title">Title: <input style="width: 200px;" id="quartz_widget_title" name="quartz_widget_title" type="text" value="'.get_option("quartz_widget_title").'" /></label></p>'; 58 echo '<p style="text-align:right;"><label for="quartz_widget_quote_count">Number of Quotes to be Shown: <input style="width: 200px;" id="quartz_widget_quote_count" name="quartz_widget_quote_count" type="text" value="'.get_option("quartz_widget_quote_count").'" /></label></p>'; 59 echo '<input type="hidden" id="quartz-submit" name="quartz-submit" value="1" />'; 60 } 61 62 register_sidebar_widget('Show Quartz Column', 'quartz_show_widget'); 63 register_widget_control('Show Quartz Column', 'quartz_show_options', 200, 100); 64 } 65 add_action('plugins_loaded', 'quartz_widget_init'); 30 66 31 67 … … 37 73 global $wpdb; 38 74 39 // Create the table structure 40 $wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}quartz_quote` ( 41 `ID` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT , 42 `quote` TEXT NOT NULL , 43 `status` ENUM( '1', '0' ) NOT NULL DEFAULT '1', 44 PRIMARY KEY ( `ID` ) 45 );"); 46 $wpdb->query("INSERT INTO `{$wpdb->prefix}quartz_quote` (`quote` ,`status`) VALUES ('Powered by <a href=\"http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/\">Quartz Plugin</a>', '1');"); 75 $database_version = '1'; 76 $installed_db = get_option('quartz_db_version'); 47 77 78 if($database_version != $installed_db) { 79 require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); 80 // Create the table structure 81 dbDelta("CREATE TABLE IF NOT EXISTS {$wpdb->prefix}quartz_quote ( 82 ID INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT , 83 quote TEXT NOT NULL , 84 status ENUM( '1', '0' ) NOT NULL DEFAULT '1', 85 PRIMARY KEY ( `ID` ) 86 );"); 87 update_option( "quartz_db_version", $database_version ); 88 } 89 if(!$installed_db) { 90 add_option("quartz_widget_title", "Quotes"); 91 add_option("quartz_widget_quote_count", 1); 92 $wpdb->query("INSERT INTO `{$wpdb->prefix}quartz_quote` (`quote` ,`status`) VALUES ('Powered by <a href=\"http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/\">Quartz Plugin</a>', '1');"); 93 } 48 94 } -
quartz/trunk/quote_form.php
r75565 r135455 1 1 <?php 2 if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) die('Don\'t call this page directly.'); // Stop direct call 2 require('wpframe.php'); 3 stopDirectCall(__FILE__); 3 4 4 $home = get_option('home');5 $home = $wpframe_home; 5 6 $action = 'new'; 6 7 if($_REQUEST['action'] == 'edit') $action = 'edit'; … … 34 35 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea"> 35 36 36 <h3><?php _e('Quote') ?></h3> 37 <?php the_editor($quote->quote); ?><br /><br /> 37 <div class="postbox"> 38 <h3 class="hndle"><span><?php _e('Quote') ?></span></h3> 39 <div class="inside"> 40 <?php the_editor($quote->quote); ?> 41 </div></div> 38 42 39 <h3><?php _e('Status') ?></h3> 43 <div class="postbox"> 44 <h3 class="hndle"><span><?php _e('Status') ?></span></h3> 45 <div class="inside"> 40 46 <label for="status">Active</label> <input type="checkbox" name="status" value="1" id="status" <?php if($quote->status or $action=='new') print " checked='checked'"; ?> /><br /> 47 </div></div> 41 48 42 49 </div> -
quartz/trunk/readme.txt
r75565 r135455 1 1 === Quartz === 2 2 Contributors: binnyva 3 Donate link: http:// www.binnyva.com/3 Donate link: http://binnyva.com/ 4 4 Tags: event, quote, random, quotes 5 5 Requires at least: 2.5 6 Tested up to: 2. 66 Tested up to: 2.8 7 7 Quartz Plugin lets you show random quotes/tips/links/pictures/something to visitors. These quotes can be added from the admin side. 8 8 9 9 == Description == 10 10 11 You can add the quotes one by one - or you can bulk import the stuff from a text file. 12 13 http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/ 11 You can add the quotes one by one - or you can bulk import the stuff from a text file. 14 12 15 13 == Installation == … … 23 21 == ChangeLog == 24 22 25 1.00.0: 26 Beta release made. 23 = 1.00.0 = 24 * Beta release made. 25 26 = 1.01.0 = 27 * Made the plugin WP 2.8 compitible. 28 * Made the forms a bit prettier. 29 * Made it a widget.
Note: See TracChangeset
for help on using the changeset viewer.