本文整理汇总了PHP中UniteFunctionsRev::throwError方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsRev::throwError方法的具体用法?PHP UniteFunctionsRev::throwError怎么用?PHP UniteFunctionsRev::throwError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsRev
的用法示例。
在下文中一共展示了UniteFunctionsRev::throwError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getControlFields
/**
*
* get fields that relevant for the control
*/
public function getControlFields()
{
$arrControls = array();
//get base elements array
$arrBase = array();
$arrBase["parent"] = (string) UniteFunctionsRev::getVal($this->element, 'parent');
$arrBase["value"] = (string) UniteFunctionsRev::getVal($this->element, 'value');
$arrBase["ctype"] = (string) UniteFunctionsRev::getVal($this->element, 'ctype');
//validate fields:
if (empty($arrBase["parent"])) {
UniteFunctionsRev::throwError("The parent can't be empty in control");
}
if (empty($arrBase["value"])) {
UniteFunctionsRev::throwError("The value can't be empty in control: {$arrBase['parent']}");
}
if (empty($arrBase["ctype"])) {
UniteFunctionsRev::throwError("The ctype can't be empty in control: {$arrBase['parent']}");
}
//get children
$strchild = (string) UniteFunctionsRev::getVal($this->element, 'child');
//validate child
if (empty($strchild)) {
UniteFunctionsRev::throwError("The child can't be empty in control: {$arrBase['parent']}");
}
$strchild = trim($strchild);
$children = explode(",", $strchild);
foreach ($children as $child) {
$arrControl = $arrBase;
$arrControl["child"] = $child;
$arrControls[] = $arrControl;
}
return $arrControls;
}
示例2: getSliderID
/**
*
* get slider id
*/
public function getSliderID()
{
$sliderID = JRequest::getCmd("id");
if (empty($sliderID)) {
UniteFunctionsRev::throwError("Slider ID url argument not found (id)");
}
return $sliderID;
}
示例3: checkCopyCaptionsCssFile
/**
*
* check that captions file exists and if not - copy it to it's place.
*/
private function checkCopyCaptionsCssFile()
{
if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) {
copy(GlobalsUniteRev::$pathCaptionsCssOriginal, GlobalsUniteRev::$pathCaptionsCss);
}
if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) {
UniteFunctionsRev::throwError("The captions file couldn't be copied to it's place: {GlobalsUniteRev::{$pathCaptionsCss}}, please copy it by hand from captions-original.css from the same folder, or turn to support.");
}
}
示例4: update
public function update($table, $arrItems, $where)
{
$response = $this->wpdb->update($table, $arrItems, $where);
if ($response === false) {
UniteFunctionsRev::throwError("no update action taken!");
}
$this->checkForErrors("Update query error");
return $response;
}
示例5: getFieldFromDB
/**
*
* get field from db
*/
public function getFieldFromDB($name)
{
$arr = $this->db->fetch(GlobalsRevSlider::$table_settings);
if (empty($arr)) {
return "";
}
$arr = $arr[0];
if (array_key_exists($name, $arr) == false) {
UniteFunctionsRev::throwError("The settings db should cotnain field: {$name}");
}
$value = $arr[$name];
return $value;
}
示例6: isDBTableExists
/**
*
* check if some db table exists
*/
public static function isDBTableExists($tableName)
{
global $wpdb;
if (empty($tableName)) {
UniteFunctionsRev::throwError("Empty table name!!!");
}
$sql = "show tables like '{$tableName}'";
$table = $wpdb->get_var($sql);
if ($table == $tableName) {
return true;
}
return false;
}
示例7: displayMasterTemplate
/**
*
* display master template (master.php from tpl folder)
*/
private function displayMasterTemplate()
{
//each view has self controls
UniteControlsRev::emptyControls();
if (isset($this->form)) {
UniteControlsRev::loadControlsFromForm($this->form);
}
$filepath = dirname(__FILE__) . "/tpl/master.php";
if (!is_file($filepath)) {
UniteFunctionsRev::throwError("master template not found: {$filepath}");
}
$arrControls = UniteControlsRev::getArrayForJsOutput();
$jsonControls = json_encode($arrControls);
//prepare content
ob_start();
require $filepath;
$output = ob_get_contents();
ob_end_clean();
//output content
echo $output;
}
示例8: checkPurchaseVerification
public function checkPurchaseVerification($data)
{
global $wp_version;
$response = wp_remote_post('http://updates.themepunch.com/activate.php', array('user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'), 'body' => array('name' => urlencode($data['username']), 'api' => urlencode($data['api_key']), 'code' => urlencode($data['code']), 'product' => urlencode('revslider'))));
$response_code = wp_remote_retrieve_response_code($response);
$version_info = wp_remote_retrieve_body($response);
if ($response_code != 200 || is_wp_error($version_info)) {
return false;
}
if ($version_info == 'valid') {
update_option('revslider-valid', 'true');
update_option('revslider-api-key', $data['api_key']);
update_option('revslider-username', $data['username']);
update_option('revslider-code', $data['code']);
return true;
} elseif ($version_info == 'exist') {
UniteFunctionsRev::throwError(__('Purchase Code already registered!', REVSLIDER_TEXTDOMAIN));
} else {
return false;
}
}
示例9: validateInited
/**
*
* validate that the slide is inited and the id exists.
*/
private function validateInited()
{
if (empty($this->id)) {
UniteFunctionsRev::throwError("The slide is not inited!!!");
}
}
示例10: trimArrayItems
/**
*
* do "trim" operation on all array items.
*/
public static function trimArrayItems($arr)
{
if (gettype($arr) != "array") {
UniteFunctionsRev::throwError("trimArrayItems error: The type must be array");
}
foreach ($arr as $key => $item) {
if (is_array($item)) {
foreach ($item as $key => $value) {
$arr[$key][$key] = trim($value);
}
} else {
$arr[$key] = trim($item);
}
}
return $arr;
}
示例11: updatePlugin
/**
*
* Enter description here ...
*/
protected static function updatePlugin($viewBack = false)
{
$linkBack = self::getViewUrl($viewBack);
$htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");
//check if css table exist, if not, we need to verify that the current captions.css can be parsed
if (UniteFunctionsWPRev::isDBTableExists(GlobalsRevSlider::TABLE_CSS_NAME)) {
$captions = RevOperations::getCaptionsCssContentArray();
if ($captions === false) {
$message = "CSS parse error! Please make sure your captions.css is valid CSS before updating the plugin!";
echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
echo $htmlLinkBack;
exit;
}
}
$zip = new UniteZipRev();
try {
if (function_exists("unzip_file") == false) {
if (UniteZipRev::isZipExists() == false) {
UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
}
}
dmp("Update in progress...");
$arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
if (empty($arrFiles)) {
UniteFunctionsRev::throwError("Update file don't found.");
}
$filename = UniteFunctionsRev::getVal($arrFiles, "name");
if (empty($filename)) {
UniteFunctionsRev::throwError("Update filename not found.");
}
$fileType = UniteFunctionsRev::getVal($arrFiles, "type");
/*
$fileType = strtolower($fileType);
if($fileType != "application/zip")
UniteFunctionsRev::throwError("The file uploaded is not zip.");
*/
$filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
if (file_exists($filepathTemp) == false) {
UniteFunctionsRev::throwError("Can't find the uploaded file.");
}
//crate temp folder
UniteFunctionsRev::checkCreateDir(self::$path_temp);
//create the update folder
$pathUpdate = self::$path_temp . "update_extract/";
UniteFunctionsRev::checkCreateDir($pathUpdate);
//remove all files in the update folder
if (is_dir($pathUpdate)) {
$arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate, false);
if (!empty($arrNotDeleted)) {
$strNotDeleted = print_r($arrNotDeleted, true);
UniteFunctionsRev::throwError("Could not delete those files from the update folder: {$strNotDeleted}");
}
}
//copy the zip file.
$filepathZip = $pathUpdate . $filename;
$success = move_uploaded_file($filepathTemp, $filepathZip);
if ($success == false) {
UniteFunctionsRev::throwError("Can't move the uploaded file here: " . $filepathZip . ".");
}
if (function_exists("unzip_file") == true) {
WP_Filesystem();
$response = unzip_file($filepathZip, $pathUpdate);
} else {
$zip->extract($filepathZip, $pathUpdate);
}
//get extracted folder
$arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
if (empty($arrFolders)) {
UniteFunctionsRev::throwError("The update folder is not extracted");
}
if (count($arrFolders) > 1) {
UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");
}
//get product folder
$productFolder = $arrFolders[0];
if (empty($productFolder)) {
UniteFunctionsRev::throwError("Wrong product folder.");
}
if ($productFolder != self::$dir_plugin) {
UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");
}
$pathUpdateProduct = $pathUpdate . $productFolder . "/";
//check some file in folder to validate it's the real one:
$checkFilepath = $pathUpdateProduct . $productFolder . ".php";
if (file_exists($checkFilepath) == false) {
UniteFunctionsRev::throwError("Wrong update extracted folder. The file: " . $checkFilepath . " not found.");
}
//copy the plugin without the captions file.
//$pathOriginalPlugin = $pathUpdate."copy/";
$pathOriginalPlugin = self::$path_plugin;
$arrBlackList = array();
$arrBlackList[] = "rs-plugin/css/captions.css";
$arrBlackList[] = "rs-plugin/css/dynamic-captions.css";
$arrBlackList[] = "rs-plugin/css/static-captions.css";
UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
//.........这里部分代码省略.........
示例12: getWPQuery
/**
*
* get meta query
*/
public static function getWPQuery($filterType, $sortBy)
{
$dayMs = 60 * 60 * 24;
$time = current_time('timestamp');
$todayStart = strtotime(date('Y-m-d', $time));
$todayEnd = $todayStart + $dayMs - 1;
$tomorrowStart = $todayEnd + 1;
$tomorrowEnd = $tomorrowStart + $dayMs - 1;
//dmp(UniteFunctionsRev::timestamp2DateTime($tomorrowStart));exit();
$start_month = strtotime(date('Y-m-1', $time));
$end_month = strtotime(date('Y-m-t', $time)) + 86399;
$next_month_middle = strtotime('+1 month', $time);
//get the end of this month + 1 day
$start_next_month = strtotime(date('Y-m-1', $next_month_middle));
$end_next_month = strtotime(date('Y-m-t', $next_month_middle)) + 86399;
$query = array();
switch ($filterType) {
case self::DEFAULT_FILTER:
//none
break;
case "today":
$query[] = array('key' => '_start_ts', 'value' => $todayEnd, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
break;
case "future":
$query[] = array('key' => '_start_ts', 'value' => $time, 'compare' => '>');
break;
case "tomorrow":
$query[] = array('key' => '_start_ts', 'value' => $tomorrowEnd, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
break;
case "past":
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '<');
break;
case "month":
$query[] = array('key' => '_start_ts', 'value' => $end_month, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $start_month, 'compare' => '>=');
break;
case "nextmonth":
$query[] = array('key' => '_start_ts', 'value' => $end_next_month, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $start_next_month, 'compare' => '>=');
break;
default:
UniteFunctionsRev::throwError("Wrong event filter");
break;
}
if (!empty($query)) {
$response["meta_query"] = $query;
}
//convert sortby
switch ($sortBy) {
case "event_start_date":
$response["orderby"] = "meta_value_num";
$response["meta_key"] = "_start_ts";
break;
case "event_end_date":
$response["orderby"] = "meta_value_num";
$response["meta_key"] = "_end_ts";
break;
}
return $response;
}
示例13: drawCustomInputs
/**
*
* draw custom inputs for rev slider
* @param $setting
*/
protected function drawCustomInputs($setting)
{
$customType = UniteFunctionsRev::getVal($setting, "custom_type");
switch ($customType) {
case "slider_size":
$this->drawSliderSize($setting);
break;
case "responsitive_settings":
$this->drawResponsitiveSettings($setting);
break;
default:
UniteFunctionsRev::throwError("No handler function for type: {$customType}");
break;
}
}
示例14: validateWpmlExists
/**
*
* valdiate that wpml exists
*/
private static function validateWpmlExists()
{
if (!self::isWpmlExists()) {
UniteFunctionsRev::throwError("The wpml plugin don't exists");
}
}
示例15: getSettings
/**
*
* get settings object
*/
protected static function getSettings($key)
{
if (!isset(self::$arrSettings[$key])) {
UniteFunctionsRev::throwError("Settings {$key} not found");
}
$settings = self::$arrSettings[$key];
return $settings;
}