<?php require "class.filetotext.php"; $docObj = new Filetotext("test.doc"); //$docObj = new Filetotext("test.pdf"); $return = $docObj->convertToText(); var_dump($return);
/** * Display the payment form * @param $queuedPaymentId int * @param $queuedPayment QueuedPayment * @param $request PKPRequest */ function displayPaymentForm($queuedPaymentId, &$queuedPayment, &$request) { if (!$this->isConfigured()) { return false; } AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON); $journal =& $request->getJournal(); $user =& $request->getUser(); $assocId = $queuedPayment->getAssocId(); $authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO'); $authorSubmission =& $authorSubmissionDao->getAuthorSubmission($assocId); $docObj = new Filetotext($authorSubmission->getSubmissionFile()->getFilePath()); $text = $docObj->convertToText(); $amount = mb_strlen($text) / 1000 * $queuedPayment->getAmount(); $liqpay = new LiqPay($this->getSetting($journal->getId(), 'liqpaypubkey'), $this->getSetting($journal->getId(), 'liqpayprivatkey')); if ($this->getSetting($journal->getId(), 'liqpaydebug')) { $debug = 1; } else { $debug = 0; } $html = $liqpay->cnb_form(array('version' => '3', 'amount' => $amount, 'currency' => $queuedPayment->getCurrencyCode(), 'description' => 'Payment for article ' . $assocId . '/' . $queuedPaymentId, 'order_id' => $assocId, 'result_url' => $queuedPayment->getRequestUrl(), 'sandbox' => $debug, 'server_url' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'notification')))); var_dump($request->url(null, 'payment', 'plugin', array($this->getName(), 'notification'))); $params = array('charset' => Config::getVar('i18n', 'client_charset'), 'item_name' => $queuedPayment->getName(), 'item_description' => $queuedPayment->getDescription(), 'amount' => sprintf('%.2F', $amount), 'lc' => String::substr(AppLocale::getLocale(), 3), 'custom' => $queuedPaymentId, 'return' => $queuedPayment->getRequestUrl(), 'cancel_return' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'cancel'))); // $params = array( // 'charset' => Config::getVar('i18n', 'client_charset'), // 'business' => $this->getSetting($journal->getId(), 'selleraccount'), // 'item_name' => $queuedPayment->getName(), // 'item_description' => $queuedPayment->getDescription(), // not a paypal parameter (PayPal uses item_name) // 'amount' => sprintf('%.2F', $queuedPayment->getAmount()), // 'quantity' => 1, // 'no_note' => 1, // 'no_shipping' => 1, // 'currency_code' => $queuedPayment->getCurrencyCode(), // 'lc' => String::substr(AppLocale::getLocale(), 3), // 'custom' => $queuedPaymentId, // 'notify_url' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'ipn')), // 'return' => $queuedPayment->getRequestUrl(), // 'cancel_return' => $request->url(null, 'payment', 'plugin', array($this->getName(), 'cancel')), // 'first_name' => ($user)?$user->getFirstName():'', // 'last_name' => ($user)?$user->getLastname():'', // 'item_number' => $queuedPayment->getAssocId(), // 'cmd' => '_xclick' // ); AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('params', $params); $templateMgr->assign('formliqpay', $html); $templateMgr->assign('liqpayFormUrl', $this->getSetting($journal->getId(), 'liqpayurl')); $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl'); return true; }