本文整理汇总了PHP中RevOperations::updateDynamicCaptions方法的典型用法代码示例。如果您正苦于以下问题:PHP RevOperations::updateDynamicCaptions方法的具体用法?PHP RevOperations::updateDynamicCaptions怎么用?PHP RevOperations::updateDynamicCaptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevOperations
的用法示例。
在下文中一共展示了RevOperations::updateDynamicCaptions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteSlideFromData
/**
*
* delete slide from data
*/
public function deleteSlideFromData($data)
{
$sliderID = UniteFunctionsRev::getVal($data, "sliderID");
$slider = new RevSlider();
$slider->initByID($sliderID);
$isPost = $slider->isSlidesFromPosts();
if ($isPost == true) {
//delete post
$postID = UniteFunctionsRev::getVal($data, "slideID");
UniteFunctionsWPRev::deletePost($postID);
} else {
//delete slide
$slideID = UniteFunctionsRev::getVal($data, "slideID");
$this->initByID($slideID);
$this->deleteChildren();
$this->deleteSlide();
}
RevOperations::updateDynamicCaptions();
}
示例2: sds_caption_css_init
public static function sds_caption_css_init($parseCssToDb)
{
if ((bool) $parseCssToDb === true) {
$revOperations = new RevOperations();
$revOperations->importCaptionsCssContentArray();
$revOperations->moveOldCaptionsCss();
$revOperations->updateDynamicCaptions(true);
return TRUE;
}
}
示例3: createTable
/**
*
* craete tables
*/
public static function createTable($tableName)
{
global $wpdb;
$parseCssToDb = false;
//check if database is empty
$result = $wpdb->get_row("SELECT COUNT( DISTINCT id ) AS NumberOfEntrys FROM " . self::$table_prefix . GlobalsRevSlider::TABLE_CSS_NAME);
if ($result->NumberOfEntrys == 0) {
$parseCssToDb = true;
}
if ($parseCssToDb) {
$revOperations = new RevOperations();
$revOperations->importCaptionsCssContentArray();
$revOperations->moveOldCaptionsCss();
$revOperations->updateDynamicCaptions(true);
}
/*
//if table exists - don't create it.
$tableRealName = self::$table_prefix.$tableName;
if(UniteFunctionsWPRev::isDBTableExists($tableRealName))
return(false);
$charset_collate = '';
if(method_exists($wpdb, "get_charset_collate"))
$charset_collate = $wpdb->get_charset_collate();
else{
if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
$charset_collate .= " COLLATE $wpdb->collate";
}
switch($tableName){
case GlobalsRevSlider::TABLE_SLIDERS_NAME:
$sql = "CREATE TABLE " .self::$table_prefix.$tableName ." (
id int(9) NOT NULL AUTO_INCREMENT,
title tinytext NOT NULL,
alias tinytext,
params text NOT NULL,
PRIMARY KEY (id)
)$charset_collate;";
break;
case GlobalsRevSlider::TABLE_SLIDES_NAME:
$sql = "CREATE TABLE " .self::$table_prefix.$tableName ." (
id int(9) NOT NULL AUTO_INCREMENT,
slider_id int(9) NOT NULL,
slide_order int not NULL,
params text NOT NULL,
layers text NOT NULL,
PRIMARY KEY (id)
)$charset_collate;";
break;
case GlobalsRevSlider::TABLE_SETTINGS_NAME:
$sql = "CREATE TABLE " .self::$table_prefix.$tableName ." (
id int(9) NOT NULL AUTO_INCREMENT,
general TEXT NOT NULL,
params TEXT NOT NULL,
PRIMARY KEY (id)
)$charset_collate;";
break;
case GlobalsRevSlider::TABLE_CSS_NAME:
$sql = "CREATE TABLE " .self::$table_prefix.$tableName ." (
id int(9) NOT NULL AUTO_INCREMENT,
handle TEXT NOT NULL,
settings TEXT,
hover TEXT,
params TEXT NOT NULL,
PRIMARY KEY (id)
)$charset_collate;";
$parseCssToDb = true;
break;
case GlobalsRevSlider::TABLE_LAYER_ANIMS_NAME:
$sql = "CREATE TABLE " .self::$table_prefix.$tableName ." (
id int(9) NOT NULL AUTO_INCREMENT,
handle TEXT NOT NULL,
params TEXT NOT NULL,
PRIMARY KEY (id)
)$charset_collate;";
break;
default:
UniteFunctionsRev::throwError("table: $tableName not found");
break;
}
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
*/
}
示例4: importSliderFromPost
//.........这里部分代码省略.........
$sliderParams = $arrSlider["params"];
if ($sliderExists) {
$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);
//update slider or craete new
if ($sliderExists) {
$arrUpdate = array("params" => $json_params);
$this->db->update(GlobalsRevSlider::$table_sliders, $arrUpdate, array("id" => $sliderID));
} else {
//new slider
$arrInsert = array();
$arrInsert["params"] = $json_params;
$arrInsert["title"] = UniteFunctionsRev::getVal($sliderParams, "title", "Slider1");
$arrInsert["alias"] = UniteFunctionsRev::getVal($sliderParams, "alias", "slider1");
$sliderID = $this->db->insert(GlobalsRevSlider::$table_sliders, $arrInsert);
}
//-------- Slides Handle -----------
//delete current slides
if ($sliderExists) {
$this->deleteAllSlides();
}
//create all slides
$arrSlides = $arrSlider["slides"];
$alreadyImported = array();
foreach ($arrSlides as $slide) {
$params = $slide["params"];
$layers = $slide["layers"];
//convert params images:
if (isset($params["image"])) {
//import if exists in zip folder
if (trim($params["image"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image = $zip->getStream('images/' . $params["image"]);
if (!$image) {
echo $params["image"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $params["image"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]] = $importImage['path'];
$params["image"] = $importImage['path'];
}
} else {
$params["image"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $params["image"]];
}
}
}
}
$params["image"] = UniteFunctionsWPRev::getImageUrlFromPath($params["image"]);
}
//convert layers images:
foreach ($layers as $key => $layer) {
if (isset($layer["image_url"])) {
//import if exists in zip folder
if (trim($layer["image_url"]) !== '') {
if ($importZip === true) {
//we have a zip, check if exists
$image_url = $zip->getStream('images/' . $layer["image_url"]);
if (!$image_url) {
echo $layer["image_url"] . ' not found!<br>';
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]])) {
$importImage = UniteFunctionsWPRev::import_media('zip://' . $filepath . "#" . 'images/' . $layer["image_url"], $sliderParams["alias"] . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $layer["image_url"]] = $importImage['path'];
$layer["image_url"] = $importImage['path'];
}
} else {
$layer["image_url"] = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $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);
}
//update dynamic-captions.css
RevOperations::updateDynamicCaptions();
return array("success" => true, "sliderID" => $sliderID);
}
示例5: createTable
/**
*
* craete tables
*/
public static function createTable($tableName)
{
global $wpdb;
$parseCssToDb = false;
$checkIfTableExists = $wpdb->get_row("SELECT COUNT(*) AS exist\n\t\t\t\t\tFROM information_schema.tables\n\t\t\t\t\tWHERE table_schema = '" . DB_NAME . "' \n\t\t\t\t\tAND table_name = '" . self::$table_prefix . GlobalsRevSlider::TABLE_CSS_NAME . "';");
if ($checkIfTableExists->exist > 0) {
//check if database is empty
$result = $wpdb->get_row("SELECT COUNT( DISTINCT id ) AS NumberOfEntrys FROM " . self::$table_prefix . GlobalsRevSlider::TABLE_CSS_NAME);
if ($result->NumberOfEntrys == 0) {
$parseCssToDb = true;
}
}
if ($parseCssToDb) {
$revOperations = new RevOperations();
$revOperations->importCaptionsCssContentArray();
$revOperations->moveOldCaptionsCss();
$revOperations->updateDynamicCaptions(true);
}
//if table exists - don't create it.
$tableRealName = self::$table_prefix . $tableName;
if (UniteFunctionsWPRev::isDBTableExists($tableRealName)) {
return false;
}
$charset_collate = '';
if (method_exists($wpdb, "get_charset_collate")) {
$charset_collate = $wpdb->get_charset_collate();
} else {
if (!empty($wpdb->charset)) {
$charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
}
if (!empty($wpdb->collate)) {
$charset_collate .= " COLLATE {$wpdb->collate}";
}
}
switch ($tableName) {
case GlobalsRevSlider::TABLE_SLIDERS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t title tinytext NOT NULL,\n\t\t\t\t\t\t\t alias tinytext,\n\t\t\t\t\t\t\t params text NOT NULL,\n\t\t\t\t\t\t\t PRIMARY KEY (id)\n\t\t\t\t\t\t\t){$charset_collate};";
break;
case GlobalsRevSlider::TABLE_SLIDES_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t slider_id int(9) NOT NULL,\n\t\t\t\t\t\t\t\t slide_order int not NULL,\t\n\t\t\t\t\t\t\t\t params text NOT NULL,\n\t\t\t\t\t\t\t\t layers text NOT NULL,\n\t\t\t\t\t\t\t\t PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
break;
case GlobalsRevSlider::TABLE_SETTINGS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t general TEXT NOT NULL,\n\t\t\t\t\t\t\t\t params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
break;
case GlobalsRevSlider::TABLE_CSS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t handle TEXT NOT NULL,\n\t\t\t\t\t\t\t\t settings TEXT,\n\t\t\t\t\t\t\t\t hover TEXT,\n\t\t\t\t\t\t\t\t params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
$parseCssToDb = true;
break;
case GlobalsRevSlider::TABLE_LAYER_ANIMS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\n\t\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t\t\t handle TEXT NOT NULL,\n\t\t\t\t\t\t\t\t params TEXT NOT NULL,\n\t\t\t\t\t\t\t\t PRIMARY KEY (id)\n\t\t\t\t\t\t\t\t){$charset_collate};";
break;
default:
UniteFunctionsRev::throwError("table: {$tableName} not found");
break;
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
if ($parseCssToDb) {
$revOperations = new RevOperations();
$revOperations->importCaptionsCssContentArray();
$revOperations->moveOldCaptionsCss();
$revOperations->updateDynamicCaptions(true);
}
}