<?php makeTabbloid('linkName','fileName', showThumbnail); ?> in your template (linkName and fileName are strings and showThumbnail is a boolean). Author: Martin Hawksey Author URI: http://www.rsc-ne-scotland.org.uk/mashe Version: 0.9.2 */ /* Copyright 2009 Martin Hawksey (email : martin.hawksey@gmail.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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 */ define(MAKE_TABBLOID_WIDGET_ID, "widget_make_tabbloid"); if (!class_exists("MakeTabbloid")) { class MakeTabbloid { var $adminOptionsName = "MakeTabbloidAdminOptionsName"; function MakeTabbloid() { } function init() { $this->getAdminOptions(); } function getAdminOptions() { $MakeTabbloidAdminOptions = array('mt_apikey' => '', 'mt_validkey' => 'false', 'mt_feeds' => array()); $devOptions = get_option($this->adminOptionsName); if (!empty($devOptions)) { foreach ($devOptions as $key => $option) $MakeTabbloidAdminOptions[$key] = $option; } update_option($this->adminOptionsName, $MakeTabbloidAdminOptions); return $MakeTabbloidAdminOptions; } function printAdminPage() { $devOptions = $this->getAdminOptions(); if (isset($_POST['update_makeTabbloidPluginSeriesSettings'])) { if (isset($_POST['makeTabbloidAPIKey'])) { $devOptions['mt_validkey'] = mt_checkAPI($_POST['makeTabbloidAPIKey']); if ($devOptions['mt_validkey'] =='true'){ update_option('tabbloid_api_key', $_POST['makeTabbloidAPIKey']); } } update_option($this->adminOptionsName, $devOptions); ?>

Make Tabbloid

Tabbloid API Key

To use Make Tabbloid you need to register with http://www.tabbloid.com/developer and enter the generated API key below:

Valid Key"; } else {echo "Invalid API Key"; } ?>

Add Blog Feed

Current Feeds

You can add a link to your "Tabbloid" edition via the widgets or by adding <?php makeTabbloid('linkName','fileName', showThumbnail); ?> in your template.

1){ echo ""; } else { echo ""; } ?>
1024){ $fileBuilt = TRUE; } } else { $lastBuild = -1; } if ($lastBuild < 0 || $fileSize < 1024){ // start check to see if posts have been made since last file was made $api_key = get_option('tabbloid_api_key'); $pdfData = tabbliodHTTPPost($api_key, 'make_pdf',''); $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $pdfData); fclose($fh); $fileSize = filesize($myFile); if ($fileSize > 1024){ $fileBuilt = TRUE; } } $pdfURL = str_replace(" ","%20",get_bloginfo('url')."/".$myFile); // Prepare POST request if ($mt_preview == "TRUE"){ $build_array = array( 'url' => $pdfURL); $request_data = http_build_query($build_array); // Send the POST request (with cURL) $c = curl_init('http://view.samurajdata.se/ps.php'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($c); $status = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($status == '200'){ $strStart = stripos($result,"id=")+3; $strEnd = stripos($result,"&page"); $previewID = substr($result,$strStart,$strEnd-$strStart); } if (strlen($previewID) < 64){ $previewHTML = "

Preview powered by:
http://view.samurajdata.se
"; } } if ($fileBuilt){?> $api_key, 'method' => $method ); if ($method == 'add_feed'){ $build_array['feed_url'] = $feed_name; } elseif ($method == 'remove_feed'){ $build_array['feed_id'] = $feed_name; } $request_data = http_build_query($build_array); // Send the POST request (with cURL) $c = curl_init('http://tabbloid.com/api'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($c); $status = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); return $result; } function widget_make_tabbloid($args) { extract($args, EXTR_SKIP); $options = get_option(MAKE_TABBLOID_WIDGET_ID); echo $before_widget; echo $before_title . $options['mt_title'] . $after_title; echo $options['mt_text']; makeTabbloid($options['mt_link_name'],$options['mt_file_name'],$options['mt_show_preview']); //makeTabbloid("TabbloidEdition2",TRUE); echo $after_widget; } function widget_make_tabbloid_init() { wp_register_sidebar_widget(MAKE_TABBLOID_WIDGET_ID, __('Make Tabbloid'), 'widget_make_tabbloid'); wp_register_widget_control(MAKE_TABBLOID_WIDGET_ID, __('Make Tabbloid'), 'widget_make_tabbloid_control'); } function widget_make_tabbloid_control() { $options = get_option(MAKE_TABBLOID_WIDGET_ID); if (!is_array($options)) { $options = array(); } $widget_data = $_POST[MAKE_TABBLOID_WIDGET_ID]; if ($widget_data['submit']) { $options['mt_title'] = $widget_data['mt_title']; $options['mt_text'] = $widget_data['mt_text']; $options['mt_link_name'] = $widget_data['mt_link_name']; $options['mt_file_name'] = $widget_data['mt_file_name']; $options['mt_show_preview'] = $widget_data['mt_show_preview']; update_option(MAKE_TABBLOID_WIDGET_ID, $options); } // Render form $mt_title = $options['mt_title']; $mt_text = $options['mt_text']; $mt_link_name = $options['mt_link_name']; $mt_file_name = $options['mt_file_name']; $mt_show_preview = $options['mt_show_preview']; ?>

======= <?php makeTabbloid('linkName','fileName', showThumbnail); ?> in your template (linkName and fileName are strings and showThumbnail is a boolean). Author: Martin Hawksey Author URI: http://www.rsc-ne-scotland.org.uk/mashe Version: 0.9.1 */ /* Copyright 2009 Martin Hawksey (email : martin.hawksey@gmail.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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 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 */ define(MAKE_TABBLOID_WIDGET_ID, "widget_make_tabbloid"); if (!class_exists("MakeTabbloid")) { class MakeTabbloid { var $adminOptionsName = "MakeTabbloidAdminOptionsName"; function MakeTabbloid() { } function init() { $this->getAdminOptions(); } function getAdminOptions() { $MakeTabbloidAdminOptions = array('mt_apikey' => '', 'mt_validkey' => 'false', 'mt_feeds' => array()); $devOptions = get_option($this->adminOptionsName); if (!empty($devOptions)) { foreach ($devOptions as $key => $option) $MakeTabbloidAdminOptions[$key] = $option; } update_option($this->adminOptionsName, $MakeTabbloidAdminOptions); return $MakeTabbloidAdminOptions; } function printAdminPage() { $devOptions = $this->getAdminOptions(); if (isset($_POST['update_makeTabbloidPluginSeriesSettings'])) { if (isset($_POST['makeTabbloidAPIKey'])) { $devOptions['mt_validkey'] = mt_checkAPI($_POST['makeTabbloidAPIKey']); if ($devOptions['mt_validkey'] =='true'){ update_option('tabbloid_api_key', $_POST['makeTabbloidAPIKey']); } } update_option($this->adminOptionsName, $devOptions); ?>

Make Tabbloid

">

Tabbloid API Key

To use Make Tabbloid you need to register with http://www.tabbloid.com/developer and enter the generated API key below:

Valid Key"; } else {echo "Invalid API Key"; } ?>
">

Add Blog Feed

Current Feeds

You can add a link to your "Tabbloid" edition via the widgets or by adding <?php makeTabbloid('linkName','fileName', showThumbnail); ?> in your template.

1){ echo ""; } else { echo ""; } ?>
$pdfURL); $request_data = http_build_query($build_array); // Send the POST request (with cURL) $c = curl_init('http://view.samurajdata.se/ps.php'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($c); $status = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); if ($status == '200'){ $strStart = stripos($result,"id=")+3; $strEnd = stripos($result,"&page"); $previewID = substr($result,$strStart,$strEnd-$strStart); } if (strlen($previewID) < 64){ $previewHTML = "

Preview powered by:
http://view.samurajdata.se
"; } } ?> $api_key, 'method' => $method ); if ($method == 'add_feed'){ $build_array['feed_url'] = $feed_name; } elseif ($method == 'remove_feed'){ $build_array['feed_id'] = $feed_name; } $request_data = http_build_query($build_array); // Send the POST request (with cURL) $c = curl_init('http://tabbloid.com/api'); curl_setopt($c, CURLOPT_POST, true); curl_setopt($c, CURLOPT_POSTFIELDS, $request_data); curl_setopt($c, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($c); $status = curl_getinfo($c, CURLINFO_HTTP_CODE); curl_close($c); return $result; } function widget_make_tabbloid($args) { extract($args, EXTR_SKIP); $options = get_option(MAKE_TABBLOID_WIDGET_ID); echo $before_widget; echo $before_title . $options['mt_title'] . $after_title; echo $options['mt_text']; makeTabbloid($options['mt_link_name'],$options['mt_file_name'],$options['mt_show_preview']); //makeTabbloid("TabbloidEdition2",TRUE); echo $after_widget; } function widget_make_tabbloid_init() { wp_register_sidebar_widget(MAKE_TABBLOID_WIDGET_ID, __('Make Tabbloid'), 'widget_make_tabbloid'); wp_register_widget_control(MAKE_TABBLOID_WIDGET_ID, __('Make Tabbloid'), 'widget_make_tabbloid_control'); } function widget_make_tabbloid_control() { $options = get_option(MAKE_TABBLOID_WIDGET_ID); if (!is_array($options)) { $options = array(); } $widget_data = $_POST[MAKE_TABBLOID_WIDGET_ID]; if ($widget_data['submit']) { $options['mt_title'] = $widget_data['mt_title']; $options['mt_text'] = $widget_data['mt_text']; $options['mt_link_name'] = $widget_data['mt_link_name']; $options['mt_file_name'] = $widget_data['mt_file_name']; $options['mt_show_preview'] = $widget_data['mt_show_preview']; update_option(MAKE_TABBLOID_WIDGET_ID, $options); } // Render form $mt_title = $options['mt_title']; $mt_text = $options['mt_text']; $mt_link_name = $options['mt_link_name']; $mt_file_name = $options['mt_file_name']; $mt_show_preview = $options['mt_show_preview']; ?>