本文整理汇总了PHP中UniteFunctionsRev::getPostVariable方法的典型用法代码示例。如果您正苦于以下问题:PHP UniteFunctionsRev::getPostVariable方法的具体用法?PHP UniteFunctionsRev::getPostVariable怎么用?PHP UniteFunctionsRev::getPostVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UniteFunctionsRev
的用法示例。
在下文中一共展示了UniteFunctionsRev::getPostVariable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importSliderFromPost
/**
*
* import slider from multipart form
*/
public function importSliderFromPost($updateAnim = true, $updateStatic = true)
{
try {
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$sliderExists = !empty($sliderID);
if ($sliderExists) {
$this->initByID($sliderID);
}
$filepath = $_FILES["import_file"]["tmp_name"];
if (file_exists($filepath) == false) {
UniteFunctionsRev::throwError("Import file not found!!!");
}
//check if zip file or fallback to old, if zip, check if all files exist
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
if ($importZip === true) {
//true or integer. If integer, its not a correct zip file
//check if files all exist in zip
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
if (!$slider_export) {
UniteFunctionsRev::throwError("slider_export.txt does not exist!");
}
//if(!$custom_animations) UniteFunctionsRev::throwError("custom_animations.txt does not exist!");
//if(!$dynamic_captions) UniteFunctionsRev::throwError("dynamic-captions.css does not exist!");
//if(!$static_captions) UniteFunctionsRev::throwError("static-captions.css does not exist!");
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
//check for images!
} else {
//check if fallback
//get content array
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
//we have a zip
$db = new UniteDBRev();
//update/insert custom animations
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
//$animation['id'], $animation['handle'], $animation['params']
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
//update the animation, get the ID
if ($updateAnim == "true") {
//overwrite animation if exists
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
//insert with new handle
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
} else {
//insert the animation, get the ID
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
//.........这里部分代码省略.........
示例2: onSavePost
/**
*
* on save post meta. Update metaboxes data from post, add it to the post meta
*/
public static function onSavePost()
{
//protection against autosave
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
$postID = UniteFunctionsRev::getPostVariable("ID");
return $postID;
}
$postID = UniteFunctionsRev::getPostVariable("ID");
if (empty($postID)) {
return false;
}
foreach (self::$arrMetaBoxes as $box) {
$content = UniteFunctionsRev::getVal($box, "content");
if (gettype($content) != "object") {
continue;
}
$arrSettingNames = $content->getArrSettingNames();
foreach ($arrSettingNames as $name) {
$value = UniteFunctionsRev::getPostVariable($name);
update_post_meta($postID, $name, $value);
}
//end foreach settings
}
//end foreach meta
}
示例3: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
try {
switch ($action) {
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$slider->initByID($sliderID);
$slider->exportSlider();
break;
case "import_slider":
self::importSliderHandle();
break;
case "create_slider":
$newSliderID = $slider->createSliderFromOptions($data);
self::ajaxResponseSuccessRedirect("The slider successfully created", self::getViewUrl("sliders"));
break;
case "update_slider":
$slider->updateSliderFromOptions($data);
self::ajaxResponseSuccess("Slider updated");
break;
case "delete_slider":
$slider->deleteSliderFromData($data);
self::ajaxResponseSuccessRedirect("The slider deleted", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect("The duplicate successfully, refreshing page...", self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
self::ajaxResponseSuccessRedirect("Slide Created", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "update_slide":
$slide->updateSlideFromData($data);
self::ajaxResponseSuccess("Slide updated");
break;
case "delete_slide":
$slide->deleteSlideFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect("Slide Deleted Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "duplicate_slide":
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect("Slide Duplicated Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_captions_css":
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess("CSS file saved succesfully!", array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$operations->restoreCaptionsCss();
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess("Order updated successfully");
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect("Slide Changed Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$operations->previewOutput($sliderID);
break;
default:
self::ajaxResponseError("wrong ajax action: {$action} ");
break;
}
} catch (Exception $e) {
$message = $e->getMessage();
self::ajaxResponseError($message);
}
//it's an ajax action, so exit
self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
exit;
}
示例4: operate
/**
*
* operate actions
*/
public function operate()
{
$this->operations = new HelperUniteOperationsRev();
$this->action = UniteFunctionsRev::getPostVariable("action");
if (empty($this->action)) {
$this->action = UniteFunctionsRev::getPostVariable("client_action");
}
$this->data = UniteFunctionsRev::getPostVariable("data", array());
try {
switch ($this->action) {
case "add_slide":
$slideID = $this->operations->addSlideFromData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("");
break;
case "update_slider_duplicate":
$sliderID = $this->saveSlider();
$newSliderID = $this->operations->duplicateSlider($sliderID);
UniteFunctionsRev::ajaxResponseData(array("newSliderID" => $newSliderID));
break;
case "update_slider":
$sliderID = $this->saveSlider();
UniteFunctionsRev::ajaxResponseData(array("sliderID" => $sliderID));
break;
case "update_slide_close":
case "update_slide_new":
case "update_slide":
$slideID = $this->saveSlide();
UniteFunctionsRev::ajaxResponseData(array("slideID" => $slideID));
break;
case "update_slide_duplicate":
$slideID = $this->saveSlide();
$newSlideID = $this->operations->duplicateSlide($slideID);
UniteFunctionsRev::ajaxResponseData(array("slideID" => $newSlideID));
break;
case "get_captions_css":
$contentCSS = $this->operations->getCaptionsContent();
UniteFunctionsRev::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $this->operations->updateCaptionsContentData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("CSS file saved succesfully!", array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$this->operations->restoreCaptionsCss();
$contentCSS = $this->operations->getCaptionsContentOgirinal();
UniteFunctionsRev::ajaxResponseData($contentCSS);
break;
case "get_release_log":
$content = HelperUniteRev::getReleaseLogContent();
UniteFunctionsRev::ajaxResponseData($content);
break;
case "preview_slide":
$this->operations->putSlidePreviewByData($this->data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
UniteFunctionsRev::validateNotEmpty($sliderID, "SliderID");
$this->operations->previewOutput($sliderID);
break;
case "update_items_order":
$this->operations->updateSlidesOrderFromData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("order updated");
break;
case "toggle_publish_state":
//publish / unpublish item
$newState = $this->operations->publishUnpublishItemFromData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("state updated", array("newstate" => $newState));
break;
case "delete_slide":
$this->operations->deleteSlideFromData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("Slide Deleted");
break;
case "duplicate_slide":
$this->operations->duplicateSlideFromData($this->data);
UniteFunctionsRev::ajaxResponseSuccess("Slide Duplicated");
break;
default:
UniteFunctionsRev::ajaxResponseError("ajax action not found: " . $this->action);
break;
}
} catch (Exception $e) {
$message = $e->getMessage();
UniteFunctionsRev::ajaxResponseError($message);
}
exit;
}
示例5: importSliderFromPost
/**
*
* import slider from multipart form
*/
public function importSliderFromPost()
{
try {
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$this->initByID($sliderID);
$filepath = $_FILES["import_file"]["tmp_name"];
if (file_exists($filepath) == false) {
UniteFunctionsRev::throwError("Import file not found!!!");
}
//get content array
$content = @file_get_contents($filepath);
$arrSlider = @unserialize($content);
if (empty($arrSlider)) {
UniteFunctionsRev::throwError("Wrong export slider file format!");
}
//update slider params
$sliderParams = $arrSlider["params"];
$sliderParams["title"] = $this->arrParams["title"];
$sliderParams["alias"] = $this->arrParams["alias"];
$sliderParams["shortcode"] = $this->arrParams["shortcode"];
if (isset($sliderParams["background_image"])) {
$sliderParams["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($sliderParams["background_image"]);
}
$json_params = json_encode($sliderParams);
$arrUpdate = array("params" => $json_params);
$this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderID));
//-------- Slides Handle -----------
//delete current slides
$this->deleteAllSlides();
//create all slides
$arrSlides = $arrSlider["slides"];
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
$layer["image_url"] = UniteFunctionsWPRev::getImageUrlFromPath($layer["image_url"]);
$layers[$key] = $layer;
}
}
//create new slide
$arrCreate = array();
$arrCreate["slider_id"] = $sliderID;
$arrCreate["slide_order"] = $slide["slide_order"];
$arrCreate["layers"] = json_encode($layers);
$arrCreate["params"] = json_encode($params);
$this->db->insert(GlobalsRevSlider::$table_slides, $arrCreate);
}
} catch (Exception $e) {
$errorMessage = $e->getMessage();
return array("success" => false, "error" => $errorMessage, "sliderID" => $sliderID);
}
return array("success" => true, "sliderID" => $sliderID);
}
示例6: onAjaxAction
//.........这里部分代码省略.........
self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slider":
$slider->deleteSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "duplicate_slider":
$slider->duplicateSliderFromData($data);
self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
break;
case "add_slide":
$numSlides = $slider->createSlideFromData($data);
$sliderID = $data["sliderid"];
if ($numSlides == 1) {
$responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
} else {
$responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
}
$urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "add_slide_fromslideview":
$slideID = $slider->createSlideFromData($data, true);
$urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
$responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
break;
case "update_slide":
$slide->updateSlideFromData($data);
self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
break;
case "delete_slide":
$slide->deleteSlideFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
self::ajaxResponseSuccessRedirect(__("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "duplicate_slide":
$sliderID = $slider->duplicateSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "copy_move_slide":
$sliderID = $slider->copyMoveSlideFromData($data);
self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "get_captions_css":
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_captions_css":
$arrCaptions = $operations->updateCaptionsContentData($data);
self::ajaxResponseSuccess(__("CSS file saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
break;
case "restore_captions_css":
$operations->restoreCaptionsCss();
$contentCSS = $operations->getCaptionsContent();
self::ajaxResponseData($contentCSS);
break;
case "update_slides_order":
$slider->updateSlidesOrderFromData($data);
self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
break;
case "change_slide_image":
$slide->updateSlideImageFromData($data);
$sliderID = UniteFunctionsRev::getVal($data, "slider_id");
self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
break;
case "preview_slide":
$operations->putSlidePreviewByData($data);
break;
case "preview_slider":
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$operations->previewOutput($sliderID);
break;
case "toggle_slide_state":
$currentState = $slide->toggleSlideStatFromData($data);
self::ajaxResponseData(array("state" => $currentState));
break;
case "update_plugin":
self::updatePlugin(self::DEFAULT_VIEW);
break;
case "update_text":
self::updateSettingsText();
self::ajaxResponseSuccess("All files successfully updated");
break;
case "update_general_settings":
$operations->updateGeneralSettings($data);
self::ajaxResponseSuccess(__("General settings updated"));
break;
default:
self::ajaxResponseError("wrong ajax action: {$action} ");
break;
}
} catch (Exception $e) {
$message = $e->getMessage();
self::ajaxResponseError($message);
}
//it's an ajax action, so exit
self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
exit;
}
示例7: importSliderFromPost
public function importSliderFromPost($updateAnim = true, $updateStatic = true)
{
try {
$sliderID = UniteFunctionsRev::getPostVariable("sliderid");
$sliderExists = !empty($sliderID);
if ($sliderExists) {
$this->initByID($sliderID);
}
$filepath = $_FILES["import_file"]["tmp_name"];
if (file_exists($filepath) == false) {
UniteFunctionsRev::throwError("Import file not found!!!");
}
if (!class_exists("ZipArchive")) {
$importZip = false;
} else {
$zip = new ZipArchive();
$importZip = $zip->open($filepath, ZIPARCHIVE::CREATE);
}
if ($importZip === true) {
$slider_export = $zip->getStream('slider_export.txt');
$custom_animations = $zip->getStream('custom_animations.txt');
$dynamic_captions = $zip->getStream('dynamic-captions.css');
$static_captions = $zip->getStream('static-captions.css');
if (!$slider_export) {
UniteFunctionsRev::throwError("slider_export.txt does not exist!");
}
$content = '';
$animations = '';
$dynamic = '';
$static = '';
while (!feof($slider_export)) {
$content .= fread($slider_export, 1024);
}
if ($custom_animations) {
while (!feof($custom_animations)) {
$animations .= fread($custom_animations, 1024);
}
}
if ($dynamic_captions) {
while (!feof($dynamic_captions)) {
$dynamic .= fread($dynamic_captions, 1024);
}
}
if ($static_captions) {
while (!feof($static_captions)) {
$static .= fread($static_captions, 1024);
}
}
fclose($slider_export);
if ($custom_animations) {
fclose($custom_animations);
}
if ($dynamic_captions) {
fclose($dynamic_captions);
}
if ($static_captions) {
fclose($static_captions);
}
} else {
$content = @file_get_contents($filepath);
}
if ($importZip === true) {
$db = new UniteDBRev();
$animations = @unserialize($animations);
if (!empty($animations)) {
foreach ($animations as $key => $animation) {
$exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
if (!empty($exist)) {
if ($updateAnim == "true") {
$arrUpdate = array();
$arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
$id = $exist['0']['id'];
} else {
$arrInsert = array();
$arrInsert["handle"] = 'copy_' . $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
} else {
$arrInsert = array();
$arrInsert["handle"] = $animation['handle'];
$arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
$id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
}
$content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $content);
}
dmp(__("animations imported!", REVSLIDER_TEXTDOMAIN));
} else {
dmp(__("no custom animations found, if slider uses custom animations, the provided export may be broken...", REVSLIDER_TEXTDOMAIN));
}
if (!empty($static)) {
if ($updateStatic == "true") {
RevOperations::updateStaticCss($static);
} else {
$static_cur = RevOperations::getStaticCss();
$static = $static_cur . "\n" . $static;
RevOperations::updateStaticCss($static);
}
}
//.........这里部分代码省略.........