Skip to content

WordPress plugin fixes #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
=== Plugin Name ===
Contributors: schilippe
Tags: code insert, head tag, tipsy
=== Tipsy Payment Info ===
Contributors: schilippe, geekysoft
Tags: tipsy, monetization, micropayments, paypal, dwolla
Requires at least: 2.1
Tested up to: 4
Stable tag: 2.0
Tested up to: 4.7.2
Stable tag: 2.1

Inserts Tipsy Payment Info into head tag of wordpress webpage
Enables micropayments from visitors with the [Tipsy browser extension](http://tipsy.csail.mit.edu/).

== Description ==

This plugin makes it easy for content creators to include the necessary information in their page's source so that they can be paid by Tipsy users. It opens as a simple form under the Tools menu.
This plugin makes it easy for content creators to include the necessary information in their page's source so that they can be paid by Tipsy users. Invisible metadata with payment information is added to your pages, so Tipsy works with any and all theme.


== Installation ==
Expand Down
56 changes: 56 additions & 0 deletions wordpress-plugin/tipsy-payments/tipsy-payments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/*
Plugin Name: Tipsy Payment Info
Plugin URI: http://tipsy.csail.mit.edu/
Description: Enables micropayments from visitors with the Tipsy browser extension.
Version: 2.1
Author: schilippe
License: GPL
*/

if (!defined('ABSPATH')) {
header('HTTP/1.1 403 Forbidden');
exit('HTTP/1.1 403 Forbidden');
}

add_option("tipsy_paypal_email");
add_option("tipsy_dwolla_key");
add_action("admin_menu" , 'tipsy_wp_admin_options_page');
add_action("wp_head" , 'tipsy_inject');

function tipsy_wp_admin_options_page(){
add_management_page("Tipsy Payment Info" , "Tipsy Payment Info", "administrator" , "tipsy-payments" , "tipsy_options_input");
}

function tipsy_options_input(){
$inputs = "<div><h2>Insert Tipsy Payment Info</h2></br>" ;
$inputs .= "<form method='post' action='options.php'>" . wp_nonce_field('update-options');
$inputs .= "<p>Enter your PayPal email: <br><input type='email' value = '" . esc_html(get_option(tipsy_paypal_email)) . "' name='tipsy_paypal_email'/></p><br/>" ;
$inputs .= "<p>Enter your Dwolla key : <br> <input type='text' value = '" . esc_html(get_option(tipsy_dwolla_key)) . "' name='tipsy_dwolla_key'/></p><br/>" ;
$inputs .= "<input type='submit' value='Update' /><input type='hidden' name='action' value='update' />
<input type='hidden' name='page_options' value='tipsy_paypal_email,tipsy_dwolla_key' /></form></div>";
echo $inputs;
}

function tipsy_inject($content){
$ppe = esc_html(get_option(tipsy_paypal_email));
$dwk = esc_html(get_option(tipsy_dwolla_key));

if ($ppe === '' && $dwk === '' ) {
return;
}
$string = '<link rel="author" name="' . get_bloginfo('name') . '"';

if ($ppe !== '') {
$string .= ' data-paypal="' . $ppe . '"';
}

if ($dwk !== '') {
$string .= ' data-dwolla="' . $dwk . '"';
}

$string .= ">\n";
print($string);
return;
}
?>
51 changes: 0 additions & 51 deletions wp-tipsy-payment-info/TipsyInjection.php

This file was deleted.