Plugin Directory

Changeset 135455


Ignore:
Timestamp:
07/15/2009 04:35:41 PM (17 years ago)
Author:
binnyva
Message:

New version.

Location:
quartz/trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • quartz/trunk/import.php

    r75565 r135455  
    11<?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();
     2require('wpframe.php');
     3stopDirectCall(__FILE__);
    44
    55if(isset($_REQUEST['submit']) and $_REQUEST['submit']) {
     
    3838
    3939<div class="wrap">
    40 <h2><?php echo __("Import Quotes"); ?></h2>
     40<h2><?php e("Import Quotes"); ?></h2>
    4141
    4242<form name="post" action="" method="post" id="post" enctype="multipart/form-data">
    4343<div id="poststuff">
    4444
    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">
    4850<input type="file" name="textfile" />
     51</div></div>
    4952
    5053<p>OR</p>
    5154
    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">
    5358<input type="text" name="text-url"  />
    54 
     59</div></div>
    5560
    5661<p class="submit">
     
    5863<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
    5964<span id="autosave"></span>
    60 <input type="submit" name="submit" value="<?php echo __('Import') ?>" style="font-weight: bold;" tabindex="4" />
     65<input type="submit" name="submit" value="<?php e('Import') ?>" style="font-weight: bold;" tabindex="4" />
    6166</p>
    6267
  • quartz/trunk/quartz.php

    r75565 r135455  
    22/*
    33Plugin Name: Quartz
    4 Plugin URI: http://www.bin-co.com/blog/2008/11/quartz-wordpress-plugin/
     4Plugin URI: http://www.bin-co.com/tools/wordpress/plugins/quartz/
    55Description: 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.00.0
     6Version: 1.01.0
    77Author: Binny V A
    8 Author URI: http://www.binnyva.com/
     8Author URI: http://binnyva.com/
    99*/
     10require_once('wpframe.php');
    1011
    1112/**
     
    1415add_action( 'admin_menu', 'quartz_add_menu_links' );
    1516function quartz_add_menu_links() {
     17    global $wp_version;
    1618    $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');
    2024}
    2125
     
    2327 * User Function - Called from the Template
    2428 */
    25 function quartz_show($quote_count = 1, $joiner = '<br />') {
     29function quartz_show($quote_count = 1, $joiner = '<br />', $mode = 'print') {
    2630    global $wpdb;
    2731    $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;
    2936}
     37
     38function 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
     49function 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}
     65add_action('plugins_loaded', 'quartz_widget_init');
    3066
    3167
     
    3773    global $wpdb;
    3874   
    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');
    4777   
     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    }
    4894}
  • quartz/trunk/quote_form.php

    r75565 r135455  
    11<?php
    2 if(preg_match('#' . basename(__FILE__) . '#', $_SERVER['PHP_SELF'])) die('Don\'t call this page directly.'); // Stop direct call
     2require('wpframe.php');
     3stopDirectCall(__FILE__);
    34
    4 $home = get_option('home');
     5$home = $wpframe_home;
    56$action = 'new';
    67if($_REQUEST['action'] == 'edit') $action = 'edit';
     
    3435<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
    3536
    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>
    3842
    39 <h3><?php _e('Status') ?></h3>
     43<div class="postbox">
     44<h3 class="hndle"><span><?php _e('Status') ?></span></h3>
     45<div class="inside">
    4046<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>
    4148
    4249</div>
  • quartz/trunk/readme.txt

    r75565 r135455  
    11=== Quartz ===
    22Contributors: binnyva
    3 Donate link: http://www.binnyva.com/
     3Donate link: http://binnyva.com/
    44Tags: event, quote, random, quotes
    55Requires at least: 2.5
    6 Tested up to: 2.6
     6Tested up to: 2.8
    77Quartz Plugin lets you show random quotes/tips/links/pictures/something to visitors. These quotes can be added from the admin side.
    88
    99== Description ==
    1010
    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/
     11You can add the quotes one by one - or you can bulk import the stuff from a text file. 
    1412
    1513== Installation ==
     
    2321== ChangeLog ==
    2422
    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.