/** * Specifically for creating fast starting files. * however it can also be used as a standalone function call from the H264Format object. * * @access public * @author Oliver Lillie * @param Media $media * @return Media */ public function postProcessFastStart(Media $media) { // TODO possibly look at setting -movflags faststart options on ffmpeg instead of this. // set the yamdi input and output options. $output = $media->getMediaPath(); $temp_output = $output . '.qtfaststart.' . pathinfo($output, PATHINFO_EXTENSION); // build the qtfaststart process $qtfaststart_process = new ProcessBuilder('qtfaststart', $this->_config); $exec = $qtfaststart_process->add($output)->add($temp_output)->getExecBuffer(); // execute the process. $exec->setBlocking(true)->execute(); // check for any qt-faststart errors if ($exec->hasError() === true) { if (is_file($temp_output) === true) { //@unlink($temp_output); } if ($this->_enforce_qt_faststart_success === true) { //@unlink($output); throw new FfmpegProcessPostProcessException('qt-faststart post processing of "' . $output . '" failed. The output file has been removed. Any additional qt-faststart message follows: ' . $exec->getExecutedCommand() . ' ' . $exec->getBuffer()); } // TODO, log or exception not sure as the original file is ok. } else { // nope everything went ok. so delete ffmpeg file, and then rename yamdi file to that of the original. unlink($output); rename($temp_output, $output); } return $media; }
public static function getMediaFilename($filename, $sampleRate = NULL, $exists = FALSE) { $filename = Media::getMediaPath() . $filename; // If we're working with FreeSWITCH we need to tack on the samplerate to the folder name for accuracy if it's an 8/16/32/48k .WAV file if (Kohana::config('telephony.driver') == 'FreeSwitch') { $dirname = dirname($filename); $basename = basename($filename); // If there is a samplerate requested and it's a valid rate, try to use it if ($sampleRate and in_array($sampleRate, array('8000', '16000', '32000', '48000'))) { $newfile = $dirname . DIRECTORY_SEPARATOR . $sampleRate . DIRECTORY_SEPARATOR . $basename; if ($exists and file_exists($newfile)) { return $newfile; } elseif ($exists) { return $filename; } else { return $filename; } } else { return $filename; } } else { // For Asterisk just return the file & dir as they were - no changes return $filename; } }
public function hookDisplayPaymentEU($params) { if (!$this->active) { return; } if (!$this->checkCurrency($params['cart'])) { return; } $payment_options = array('cta_text' => $this->l('Pay by Swipp mobile payment'), 'logo' => Media::getMediaPath(_PS_MODULE_DIR_ . $this->name . '/swipp.jpg'), 'action' => $this->context->link->getModuleLink($this->name, 'validation', array(), true)); return $payment_options; }
/** * addCSS return stylesheet path. * * @param mixed $css_uri * @param string $css_media_type * @param bool $need_rtl * @return string */ public static function getCSSPath($css_uri, $css_media_type = 'all', $need_rtl = true) { // RTL Ready: search and load rtl css file if it's not originally rtl if ($need_rtl && Context::getContext()->language->is_rtl) { $css_uri_rtl = preg_replace('/(^[^.].*)(\\.css)$/', '$1_rtl.css', $css_uri); $rtl_media = Media::getMediaPath($css_uri_rtl, $css_media_type); if ($rtl_media != false) { return $rtl_media; } } // End RTL return Media::getMediaPath($css_uri, $css_media_type); }
/** * Gets a new, unused filename for the given filename and returns it with * the full path to the new filename. * * @param string $filename The original filename, no paths. * * @return An array, first element is the new filename, the second is the full path. */ private static function _getNewNameAndPath($filename) { if (!($filesPath = Media::getFilesPath())) { self::$_error = 'Files directory doesn\'t exist or isn\'t writable.'; return false; } if (!($mediaPath = Media::getMediaPath())) { self::$_error = 'Media directory doesn\'t exist or isn\'t writable.'; return false; } $uploadPath = $filesPath . $mediaPath; $newFilename = self::_getAvailFilename($filename, $uploadPath); $fullPath = ROOT . $uploadPath . $newFilename; return array($newFilename, $fullPath); }
public function hookDisplayPaymentEU($params) { if (!$this->active) { return; } // Check if cart has product download if ($this->hasProductDownload($params['cart'])) { return false; } return array('cta_text' => $this->l('Pay with cash on delivery (COD)'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/cashondelivery.png'), 'action' => $this->context->link->getModuleLink($this->name, 'validation', array('confirm' => true), true)); }
public function create() { $reqPath = ''; if (isset($_POST['path']) and isset($_POST['newfolder'])) { $reqPath = $_POST['path']; $path = Media::getMediaPath() . $reqPath; kohana::log('debug', 'Creating ' . $path . DIRECTORY_SEPARATOR . $_POST['newfolder']); if ($this->createFolder($path . DIRECTORY_SEPARATOR . $_POST['newfolder'])) { message::set('Folder created.'); url::redirect(Router_Core::$controller . '/index'); } else { message::set('The path ' . $_POST['path'] . ' does not exist or could not be created! Does your web user have write access?'); } } plugins::views($this); $this->view->soundPath = Media::getMediaPath(); $this->view->reqPath = $reqPath; }
public function hookAdvancedPaymentOptions($params) { if (!$this->active) { return; } if (!$this->checkCurrency($params['cart'])) { return; } $options = array(); $paysystems = $this->getPaySystems($params); foreach ($paysystems as $paysystem) { $po = new Core_Business_Payment_PaymentOption(); $po->setCallToActionText($paysystem['name'])->setAction($this->context->link->getModuleLink($this->name, 'payment', array('id_universalpay_system' => $paysystem['id_universalpay_system']), true))->setLogo(Media::getMediaPath(_PS_IMG_ . 'pay/' . $paysystem['id_universalpay_system'] . '.jpg'))->setModuleName($this->name); $options[] = $po; } return $options; }
public function hookDisplayPaymentEU($params) { if (!$this->active) { return; } global $smarty; // Check if cart has product download foreach ($params['cart']->getProducts() as $product) { $pd = ProductDownload::getIdFromIdProduct((int) $product['id_product']); if ($pd and Validate::isUnsignedInt($pd)) { return false; } } return array('cta_text' => $this->l('Pay with cash on delivery (COD)'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/cashondelivery.png'), 'action' => $this->context->link->getModuleLink($this->name, 'validation', array('confirm' => true))); }
public function hookDisplayPaymentEU($params) { if (!$this->active) { return; } if (!$this->checkCurrency($params['cart'])) { return; } return array('cta_text' => $this->l('Pay by Cheque'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/cheque.png'), 'action' => $this->context->link->getModuleLink($this->name, 'validation', array(), true)); }
public function getIframePaymentOption() { $iframeOption = new PaymentOption(); $iframeOption->setCallToActionText($this->l('Pay iframe'))->setAdditionalInformation($this->context->smarty->fetch('module:paymentexample/views/templates/front/payment_infos.tpl'))->setLogo(Media::getMediaPath(_PS_MODULE_DIR_ . $this->name . '/payment.jpg')); return $iframeOption; }
/** * @return string */ public function hookdisplayPaymentEU() { if (!$this->active) { return; } $private_key = Configuration::get('PIGMBH_PAYMILL_PRIVATEKEY'); $public_key = Configuration::get('PIGMBH_PAYMILL_PUBLICKEY'); $this->context->smarty->assign(array('this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name, 'debit' => Configuration::get('PIGMBH_PAYMILL_DEBIT'), 'creditcard' => Configuration::get('PIGMBH_PAYMILL_CREDITCARD'), 'valid_key' => !empty($private_key) && !empty($public_key))); return array(array('cta_text' => $this->l('Paymill Directdebit'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/img/icon-hook.png'), 'action' => $this->context->link->getModuleLink($this->name, 'payment', array('payment' => 'debit'))), array('cta_text' => $this->l('Paymill Creditcard'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/img/icon-hook.png'), 'action' => $this->context->link->getModuleLink($this->name, 'payment', array('payment' => 'creditcard')))); }
public function hookDisplayPaymentEU($params) { global $smarty, $cookie; /*if (!Configuration::get('MB_PARAMETERS') OR !Configuration::get('MB_PARAMETERS_2') OR (Configuration::get('MB_LOCAL_METHODS') == '' AND Configuration::get('MB_INTER_METHODS') == '')) return;*/ $flag = false; $allowedCurrencies = $this->getCurrency((int) $params['cart']->id_currency); foreach ($allowedCurrencies as $allowedCurrency) { if ($allowedCurrency['id_currency'] == $params['cart']->id_currency) { $flag = true; break; } } if ($flag) { $localMethods = Configuration::get('MB_LOCAL_METHODS'); $interMethods = Configuration::get('MB_INTER_METHODS'); $local = $localMethods ? explode('|', $localMethods) : array(); $inter = $interMethods ? explode('|', $interMethods) : array(); $local_logos = $this->_localPaymentMethods; $inter_logos = $this->_internationalPaymentMethods; /* Load objects */ $address = new Address((int) $params['cart']->id_address_delivery); $countryObj = new Country((int) $address->id_country, Configuration::get('PS_LANG_DEFAULT')); $customer = new Customer((int) $params['cart']->id_customer); $currency = new Currency((int) $params['cart']->id_currency); $lang = new Language((int) $cookie->id_lang); $mbParams = array(); $mbParams['base_url'] = __PS_BASE_URI__; /* About the merchant */ $mbParams['pay_to_email'] = Configuration::get('MB_PAY_TO_EMAIL'); $mbParams['recipient_description'] = Configuration::get('PS_SHOP_NAME'); $mbParams['hide_login'] = (int) Configuration::get('MB_HIDE_LOGIN'); $mbParams['id_logo'] = (int) Configuration::get('MB_ID_LOGO'); $mbParams['return_url'] = (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $params['cart']->id . '&id_module=' . (int) $this->id . '&key=' . $customer->secure_key; $mbParams['cancel_url'] = Configuration::get('MB_CANCEL_URL'); /* About the customer */ $mbParams['pay_from_email'] = $customer->email; $mbParams['firstname'] = $address->firstname; $mbParams['lastname'] = $address->lastname; $mbParams['address'] = $address->address1; $mbParams['address2'] = $address->address2; $mbParams['phone_number'] = !empty($address->phone_mobile) ? $address->phone_mobile : $address->phone; $mbParams['postal_code'] = $address->postcode; $mbParams['city'] = $address->city; $mbParams['country'] = isset($this->_country[strtoupper($countryObj->iso_code)]) ? $this->_country[strtoupper($countryObj->iso_code)] : ''; $mbParams['language'] = strtoupper($lang->iso_code); $mbParams['date_of_birth'] = substr($customer->birthday, 5, 2) . substr($customer->birthday, 8, 2) . substr($customer->birthday, 0, 4); /* About the cart */ $mbParams['transaction_id'] = (int) $params['cart']->id . '_' . date('YmdHis') . '_' . $params['cart']->secure_key; $mbParams['currency'] = $currency->iso_code; $mbParams['amount'] = number_format($params['cart']->getOrderTotal(), 2, '.', ''); /* URLs */ $mbParams['status_url'] = (Configuration::get('PS_SSL_ENABLED') ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php'; /* Assign settings to Smarty template */ $smarty->assign($mbParams); $result = array(); $metods = array('inter' => $inter, 'local' => $local); foreach ($metods as $k => $method_list) { $logos = ${$k . '_logos'}; foreach ($method_list as $index => $method) { $smarty->assign('code', $logos[$method]['code']); array_push($result, array('cta_text' => $this->l('Pay using') . ' ' . $logos[$method]['name'], 'logo' => Media::getMediaPath(dirname(__FILE__) . '/logos/' . ($k == 'local' ? $k : 'international') . '/' . $logos[$method]['file'] . '.gif'), 'form' => $smarty->fetch(dirname(__FILE__) . '/moneybookers_eu.tpl'))); } } return sizeof($result) ? $result : false; } }
public function hookDisplayPaymentEU($params) { if (!$this->active) { return; } if (!$this->checkCurrency($params['cart'])) { return; } $payment_options = array('cta_text' => $this->l('Pay by Bank Wire'), 'logo' => Media::getMediaPath(dirname(__FILE__) . '/bankwire.jpg'), 'action' => $this->context->link->getModuleLink($this->name, 'validation', array(), true)); return $payment_options; }
/** * addCSS return stylesheet path. * * @param mixed $css_uri * @param string $css_media_type * @return string */ public static function getCSSPath($css_uri, $css_media_type = 'all') { return Media::getMediaPath($css_uri, $css_media_type); }
/** * Specifically for authomatic post processing of FLV output to inject metadata, * however it can also be used as a standalone function call from the FLVFormat object. * * @access public * @author Oliver Lillie * @param Media $media * @return Media */ public function postProcessMetaData(Media $media) { // set the yamdi input and output options. $output = $media->getMediaPath(); $temp_output = $output . '.yamdi.flv'; // build the yamdi process $yamdi_process = new ProcessBuilder('yamdi', $this->_config); $exec = $yamdi_process->add('-i')->add($output)->add('-o')->add($temp_output)->add('-s')->add('-k')->getExecBuffer(); // execute the process. $exec->setBlocking(true)->execute(); // check for any yamdi errors if ($exec->hasError() === true) { if (is_file($temp_output) === true) { @unlink($temp_output); } if ($this->_enforce_meta_data_success === true) { @unlink($output); throw new FfmpegProcessPostProcessException('Yamdi post processing of "' . $output . '" failed. The output file has been removed. Any additional Yamdi message follows: ' . $exec->getBuffer()); } // TODO, log or exception not sure as the original file is ok. } else { // nope everything went ok. so delete ffmpeg file, and then rename yamdi file to that of the original. unlink($output); rename($temp_output, $output); } return $media; }
public function hookDisplayPaymentEU($params) { global $smarty; if (!Configuration::get('MB_PARAMETERS') or !Configuration::get('MB_PARAMETERS_2') or Configuration::get('MB_LOCAL_METHODS') == '' and Configuration::get('MB_INTER_METHODS') == '') { return; } if ($this->hasAllowedCurrencies($params)) { $result = array(); $methods = $this->getMoneybookersPaymentOptions($params); if (isset($methods['methods']) && isset($methods['logos'])) { foreach ($methods['methods'] as $k => $method_list) { $logos = $methods['logos'][$k]; foreach ($method_list as $method) { $smarty->assign('code', $logos[$method]['code']); array_push($result, array('cta_text' => $this->l('Pay using') . ' ' . $logos[$method]['name'], 'logo' => Media::getMediaPath(dirname(__FILE__) . '/logos/' . ($k == 'local' ? $k : 'international') . '/' . $logos[$method]['file'] . '.gif'), 'form' => $smarty->fetch(dirname(__FILE__) . '/moneybookers_eu.tpl'))); } } } return count($result) ? $result : false; } }