本文整理汇总了PHP中RevSliderFunctionsWP::update_option方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP::update_option方法的具体用法?PHP RevSliderFunctionsWP::update_option怎么用?PHP RevSliderFunctionsWP::update_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSliderFunctionsWP
的用法示例。
在下文中一共展示了RevSliderFunctionsWP::update_option方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _update_images
//.........这里部分代码省略.........
private function _update_images()
{
$templates = get_option('rs-templates', array());
$curl = new WP_Http_Curl();
if (!$curl->test()) {
$curl = false;
}
$connection = 0;
$reload = array();
if (!empty($templates) && is_array($templates)) {
$upload_dir = wp_upload_dir();
// Set upload folder
if (!empty($templates['slider']) && is_array($templates['slider'])) {
foreach ($templates['slider'] as $key => $temp) {
if ($connection > 3) {
continue;
}
//cant connect to server
// Check folder permission and define file location
if (wp_mkdir_p($upload_dir['basedir'] . $this->templates_path)) {
$file = $upload_dir['basedir'] . $this->templates_path . '/' . $temp['img'];
$file_plugin = RS_PLUGIN_PATH . $this->templates_path_plugin . '/' . $temp['img'];
if (!file_exists($file) && !file_exists($file_plugin) || isset($temp['push_image'])) {
if ($curl !== false) {
$image_data = @$curl->request($this->templates_url . $this->templates_server_path . $temp['img']);
// Get image data
if (isset($image_data['body']) && isset($image_data['response']) && isset($image_data['response']['code']) && $image_data['response']['code'] == '200') {
$image_data = $image_data['body'];
} else {
$image_data = false;
}
} else {
$image_data = @file_get_contents($this->templates_url . $this->templates_server_path . $temp['img']);
// Get image data
}
if ($image_data !== false) {
$reload[$temp['alias']] = true;
unset($templates['slider'][$key]['push_image']);
@mkdir(dirname($file));
@file_put_contents($file, $image_data);
} else {
//could not connect to server
$connection++;
}
} else {
//use default image
}
} else {
//use default images
}
}
}
if (!empty($templates['slides']) && is_array($templates['slides'])) {
foreach ($templates['slides'] as $key => $temp) {
foreach ($temp as $k => $tvalues) {
if ($connection > 3) {
continue;
}
//cant connect to server
// Check folder permission and define file location
if (wp_mkdir_p($upload_dir['basedir'] . $this->templates_path)) {
$file = $upload_dir['basedir'] . $this->templates_path . '/' . $tvalues['img'];
$file_plugin = RS_PLUGIN_PATH . $this->templates_path_plugin . '/' . $tvalues['img'];
if (!file_exists($file) && !file_exists($file_plugin) || isset($reload[$key])) {
//update, so load again
if ($curl !== false) {
$image_data = @$curl->request($this->templates_url . $this->templates_server_path . $tvalues['img']);
// Get image data
if (isset($image_data['body']) && isset($image_data['response']) && isset($image_data['response']['code']) && $image_data['response']['code'] == '200') {
$image_data = $image_data['body'];
} else {
$image_data = false;
}
} else {
$image_data = @file_get_contents($this->templates_url . $this->templates_server_path . $tvalues['img']);
// Get image data
}
if ($image_data !== false) {
@mkdir(dirname($file));
@file_put_contents($file, $image_data);
} else {
//could not connect to server
$connection++;
}
} else {
//use default image
}
} else {
//use default images
}
}
}
}
}
if ($connection > 3) {
//set value that the server cant be contacted
}
RevSliderFunctionsWP::update_option('rs-templates', $templates, false);
//remove the push_image
}
示例2: update_preset_setting
/**
* @since: 5.0
**/
public static function update_preset_setting($data)
{
if (!isset($data['name'])) {
return __('Missing values to update preset', 'revslider');
}
$customer_presets = get_option('revslider_presets', array());
if (!empty($customer_presets)) {
foreach ($customer_presets as $key => $preset) {
if ($preset['settings']['name'] == $data['name']) {
$customer_presets[$key]['values'] = $data['values'];
break;
}
}
}
RevSliderFunctionsWP::update_option('revslider_presets', $customer_presets, 'off');
return true;
}