<?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
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 = "
=======
<?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);
?>