Location: PHPKode > projects > Gallina 4 Wordpress > gallina/index.php

Plugin Name: Gmail Posting
Plugin URI: http://www.jaco.it/friends/?p=4431
Description: Automatic post from google gmail - based on a work of Jonathan Hernandez <hide@address.com>
Version: The plugin's Version Number, e.g.: 1.0
Author: jaco
Author URI: http://www.jaco.it/friends

Copyright 2007 Fabio Farnesi (email : hide@address.com)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


require_once "include/Gallina.php";

function mt_add_pages() {
    add_options_page('Gallina Options', 'Gallina Options', 8, 'gallinaptions', 'mt_options_page'); 

function mt_options_page() {

   // variables for the field and option names 
    $opt_name = array(0=>'g_email',1=>'g_passwd');
    $hidden_field_name = 'mt_submit_hidden';
    $data_field_name = array(0=>'g_email',1=>'g_passwd');

    // Read in existing option value from database
    $opt_val['g_email'] = get_option( $opt_name[0]);
	$opt_val['g_passwd'] = get_option( $opt_name[1]);
    // See if the user has posted us some information
    // If they did, this hidden field will be set to 'Y'
    if( $_POST[ $hidden_field_name ] == 'Y' ) {
        // Read their posted value
        $opt_val['g_email'] = $_POST[ $data_field_name[0]];
        $opt_val['g_passwd'] = $_POST[ $data_field_name[1]];

        // Save the posted value in the database
        update_option( $opt_name[0], $opt_val['g_email'] );
	    update_option( $opt_name[1], $opt_val['g_passwd'] );

        // Put an options updated message on the screen
        echo '<div id="message" class="updated fade"><p><strong>option saved</strong></p></div>';

    // Now display the options editing screen

    echo '<div class="wrap">';

    // header

    echo "<h2>" . __( 'Gallina Plugin Options', 'mt_trans_domain' ) . "</h2>";

    // options form
echo '<form name="form1" method="post" action="'.str_replace( '%7E', '~', $_SERVER['REQUEST_URI']).'">';   
echo '<input type="hidden" name="'.$hidden_field_name.'" value="Y">';
echo '<p>'._e("Gmail account:", 'mt_trans_domain'); 
echo '<input type="text" name="'.$data_field_name[0].'" value="'.$opt_val['g_email'].'"size="20">';
echo '<br>';
echo '<p>'._e("password:", 'mt_trans_domain'); 
echo '<input type="password" name="'.$data_field_name[1].'" value="'.$opt_val['g_passwd'].'"size="20">';
echo '</p><hr />';

echo '<p class="submit">';
echo '<input type="submit" name="Submit" value="Update Options"/>';
echo '</p>';

echo '</form>';
echo '</div>';


$g = new Gallina (get_option('g_email'), get_option('g_passwd'), '0');

$g->Connect ();

add_action('admin_menu', 'mt_add_pages');
add_action ( 'wp_head', $g->updatePost());

Return current item: Gallina 4 Wordpress