本文整理汇总了PHP中td_util::update_option方法的典型用法代码示例。如果您正苦于以下问题:PHP td_util::update_option方法的具体用法?PHP td_util::update_option怎么用?PHP td_util::update_option使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类td_util
的用法示例。
在下文中一共展示了td_util::update_option方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: td_cake_panel
function td_cake_panel()
{
?>
<style type="text/css">
.updated, .error {
display: none !important;
}
.td-small-bottom {
font-size: 12px;
color:#686868;
margin-top: 5px;
}
.td-manual-activation {
display: none;
}
</style>
<?php
$td_key = '';
$td_server_id = '';
$td_envato_code = '';
if (!empty($_POST['td_active'])) {
//is for activation?
if (!empty($_POST['td_envato_code'])) {
$td_envato_code = $_POST['td_envato_code'];
}
if (!empty($_POST['td_server_id'])) {
$td_server_id = $_POST['td_server_id'];
}
if (!empty($_POST['td_key'])) {
$td_key = $_POST['td_key'];
}
//manual activation
if ($_POST['td_active'] == 'manual') {
if ($this->td_cake_manual($td_server_id, $td_envato_code, $td_key) === true) {
td_util::update_option('envato_key', $td_envato_code);
td_util::update_option('td_cake_status', '2');
?>
<script type="text/javascript">
alert('Thanks for activating the theme!');
window.location = "<?php
echo admin_url();
?>
";
</script>
<?php
} else {
?>
<script type="text/javascript">
alert('The code is invalid!');
</script>
<?php
}
} elseif ($_POST['td_active'] == 'auto') {
if (TD_DEPLOY_MODE == 'dev') {
//auto activation
$td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
} else {
//auto activation
$td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
}
if (is_wp_error($td_cake_response)) {
//error http
?>
<script type="text/javascript">
alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
</script>
<?php
} else {
if (isset($td_cake_response['response']['code']) and $td_cake_response['response']['code'] != '200') {
?>
<script type="text/javascript">
alert('Error accessing our activation service. Please use the manual activation. Sorry about this. Server code: <?php
echo $td_cake_response['response']['code'];
?>
');
</script>
<?php
}
if (!empty($td_cake_response['body'])) {
$api_response = @unserialize($td_cake_response['body']);
if (!empty($api_response['envato_is_valid']) and !empty($api_response['envato_is_valid_msg'])) {
if ($api_response['envato_is_valid'] == 'valid' or $api_response['envato_is_valid'] == 'td_fake_valid') {
td_util::update_option('envato_key', $td_envato_code);
td_util::update_option('td_cake_status', '2');
?>
<script type="text/javascript">
alert(<?php
echo json_encode($api_response['envato_is_valid_msg']);
?>
);
window.location = "<?php
echo admin_url();
?>
";
</script>
<?php
//.........这里部分代码省略.........
示例2: set_theme_copyright
function set_theme_copyright($text)
{
td_util::update_option('tds_footer_copyright', $text);
$this->log("set_theme_copyright({$text})", "copyright text updated");
}
示例3: array
echo td_panel_generator::box_start('Load an available translation', false);
?>
<div class="td-box-row">
<div class="td-box-description td-box-full">
<span class="td-box-title">MORE INFORMATION:</span>
<p>Available translations: English, Dutch, Finnish, German, Greek, Hindi, Indonesian, Japanese, Marathi, Polish, Portuguese, Romanian, Russian, Spanish, Tamil, Thai, Turkish and Urdu. The rest are translated via google translate. Please note that the translations are loaded from our servers.</p>
<p><strong style="margin-right: 2px">Note:</strong>English translation being the default translation of our theme, will set default values for your translate input fields.</p>
</div>
</div>
<div class="td-box-row">
<div class="td-box-description">
<div class="td-box-control-full">
<?php
td_util::update_option('tds_language', '');
$languages[] = array('text' => 'Choose a language...', 'val' => '');
foreach (td_global::$translate_languages_list as $language_code => $language_name) {
$languages[] = array('text' => $language_name, 'val' => $language_code);
}
echo td_panel_generator::dropdown(array('ds' => 'td_option', 'option_id' => 'tds_language', 'values' => $languages));
?>
</div>
</div>
<a id="load_translation" class="td-big-button td-medium-button" href="">Load translation</a>
</div>
<?php
echo td_panel_generator::box_end();
示例4: td_theme_migration
function td_theme_migration()
{
$td_db_version = td_util::get_option('td_version');
// empty -> any version
if (empty($td_db_version)) {
// wp_parse_args format
$args = array('post_type' => array('page', 'post'), 'numberposts' => '200', 'orderby' => 'post_date', 'order' => 'DESC', 'meta_query' => array('relation' => 'OR', array('key' => 'td_homepage_loop_filter'), array('key' => 'td_unique_articles'), array('key' => 'td_smart_list'), array('key' => 'td_review')), 'update_post_term_cache' => false);
$recent_posts = wp_get_recent_posts($args);
foreach ($recent_posts as $recent_post) {
// page settings
$update_td_homepage_loop = false;
$td_homepage_loop = get_post_meta($recent_post['ID'], 'td_homepage_loop');
$td_page = get_post_meta($recent_post['ID'], 'td_page');
$td_homepage_loop_filter = get_post_meta($recent_post['ID'], 'td_homepage_loop_filter');
$td_unique_articles = get_post_meta($recent_post['ID'], 'td_unique_articles');
if (!empty($td_homepage_loop_filter) and is_array($td_homepage_loop_filter) and count($td_homepage_loop_filter) > 0) {
foreach ($td_homepage_loop_filter[0] as $filter_key => $filter_value) {
$td_homepage_loop[0][$filter_key] = $filter_value;
}
$update_td_homepage_loop = true;
}
if (!empty($td_unique_articles) and is_array($td_unique_articles) and count($td_unique_articles) > 0) {
foreach ($td_unique_articles[0] as $filter_key => $filter_value) {
$td_homepage_loop[0][$filter_key] = $filter_value;
$td_page[0][$filter_key] = $filter_value;
}
$update_td_homepage_loop = true;
}
if ($update_td_homepage_loop === true) {
update_post_meta($recent_post['ID'], 'td_homepage_loop', $td_homepage_loop[0]);
update_post_meta($recent_post['ID'], 'td_page', $td_page[0]);
}
// post settings
$update_td_post_theme_settings = false;
$td_post_theme_settings = get_post_meta($recent_post['ID'], 'td_post_theme_settings');
$td_smart_list = get_post_meta($recent_post['ID'], 'td_smart_list');
$td_review = get_post_meta($recent_post['ID'], 'td_review');
if (!empty($td_review) and is_array($td_review) and count($td_review) > 0) {
foreach ($td_review[0] as $filter_key => $filter_value) {
$td_post_theme_settings[0][$filter_key] = $filter_value;
}
$update_td_post_theme_settings = true;
}
if (!empty($td_smart_list) and is_array($td_smart_list) and count($td_smart_list) > 0) {
foreach ($td_smart_list[0] as $filter_key => $filter_value) {
$td_post_theme_settings[0][$filter_key] = $filter_value;
}
$update_td_post_theme_settings = true;
}
if ($update_td_post_theme_settings === true) {
update_post_meta($recent_post['ID'], 'td_post_theme_settings', $td_post_theme_settings[0]);
}
//delete_post_meta($recent_post['ID'], 'td_homepage_loop_filter');
//delete_post_meta($recent_post['ID'], 'td_unique_articles');
//delete_post_meta($recent_post['ID'], 'td_smart_list');
//delete_post_meta($recent_post['ID'], 'td_review');
}
// the following delete operations must be done
//delete_post_meta_by_key('td_homepage_loop_filter');
//delete_post_meta_by_key('td_unique_articles');
//delete_post_meta_by_key('td_smart_list');
//delete_post_meta_by_key('td_review');
}
// update the database version
if ($td_db_version != TD_THEME_VERSION) {
td_util::update_option('td_version', TD_THEME_VERSION);
}
}
示例5: array
<div class="td-visible-tablet-portrait">
<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/rec200.png') . '" alt="" /></a>
</div>
<div class="td-visible-phone">
<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/rec300.png') . '" alt="" /></a>
</div>');
//social counter widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_social_counter_widget', array('custom_title' => 'STAY CONNECTED', 'facebook' => 'themeforest', 'twitter' => 'envato', 'youtube' => 'ChilloutLoungeMusic', 'open_in_new_window' => 'y', 'border_top' => 'no_border_top'));
//ad box widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_ad_box_widget', array('spot_id' => 'sidebar'));
//block 9 widget
$td_demo_site->add_widget_to_sidebar('default', 'td_block_9_widget', array('sort' => 'featured', 'custom_title' => 'EDITOR PICKS', 'limit' => '4', 'header_color' => '#f24b4b'));
//footer setup
$td_demo_site->set_footer($td_demo_site->get_demo_image('newsmag-footer.png'), $td_demo_site->get_demo_image('newsmag-footer@2x.png'), 'Newsmag is your news, entertainment, music fashion website. We provide you with the latest breaking news and videos straight from the entertainment industry.', 'contact@yoursite.com');
//sub-footer setup
td_util::update_option('tds_footer_copyright', 'Copyright 2014 - Newsmag by TagDiv');
// sub-footer copyright
//sub-footer menu
$td_demo_site->create_menu('Footer menu');
$td_demo_site->add_top_menu('Disclaimer');
$td_demo_site->add_top_menu('Privacy');
$td_demo_site->add_top_menu('Advertisement');
$td_demo_site->add_top_menu('Contact us');
$td_demo_site->activate_menu('footer-menu');
/* ----------------------------------------------------------------------------
create categories
$td_demo_site->add_category has an array parameter
@param[0] : name of category
@param[1] : parent category
*/
示例6: remove
/**
* remove the sidebars that begin with td_demo_
*/
static function remove()
{
$tmp_sidebars = td_util::get_option('sidebars');
if (!empty($tmp_sidebars)) {
foreach ($tmp_sidebars as $index => $sidebar) {
if (substr($sidebar, 0, 8) == 'td_demo_') {
unset($tmp_sidebars[$index]);
}
}
}
td_util::update_option('sidebars', $tmp_sidebars);
}
示例7: td_cake_panel
function td_cake_panel()
{
?>
<style type="text/css">
.updated, .error {
display: none !important;
}
.td-small-bottom {
font-size: 12px;
color:#686868;
margin-top: 5px;
}
.td-manual-activation {
display: none;
}
</style>
<?php
$td_key = '';
$td_server_id = '';
$td_envato_code = '';
if (!empty($_POST['td_active'])) {
//is for activation?
if (!empty($_POST['td_envato_code'])) {
$td_envato_code = $_POST['td_envato_code'];
}
if (!empty($_POST['td_server_id'])) {
$td_server_id = $_POST['td_server_id'];
}
if (!empty($_POST['td_key'])) {
$td_key = $_POST['td_key'];
}
//manual activation
if ($_POST['td_active'] == 'manual') {
if ($this->td_cake_manual($td_server_id, $td_envato_code, $td_key) === true) {
td_util::update_option('envato_key', $td_envato_code);
td_util::update_option('td_cake_status', '2');
?>
<script type="text/javascript">
alert('Thanks for activating the theme!');
window.location = "<?php
echo admin_url();
?>
";
</script>
<?php
} else {
?>
<script type="text/javascript">
alert('The code is invalid!');
</script>
<?php
}
} elseif ($_POST['td_active'] == 'auto') {
if (TD_DEPLOY_MODE == 'dev') {
//auto activation
$td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
} else {
//auto activation
$td_cake_response = wp_remote_post('http://td_cake.themesafe.com/td_cake/auto.php', array('method' => 'POST', 'body' => array('k' => $td_envato_code, 'n' => TD_THEME_NAME, 'v' => TD_THEME_VERSION), 'timeout' => 12));
}
if (is_wp_error($td_cake_response)) {
//error http
?>
<script type="text/javascript">
alert('Error accessing our activation service. Please use the manual activation. Sorry about this.');
</script>
<?php
} else {
if (isset($td_cake_response['response']['code']) and $td_cake_response['response']['code'] != '200') {
?>
<script type="text/javascript">
alert('Error accessing our activation service. Please use the manual activation. Sorry about this. Server code: <?php
echo $td_cake_response['response']['code'];
?>
');
</script>
<?php
}
if (!empty($td_cake_response['body'])) {
$api_response = @unserialize($td_cake_response['body']);
if (!empty($api_response['envato_is_valid']) and !empty($api_response['envato_is_valid_msg'])) {
if ($api_response['envato_is_valid'] == 'valid' or $api_response['envato_is_valid'] == 'td_fake_valid') {
td_util::update_option('envato_key', $td_envato_code);
td_util::update_option('td_cake_status', '2');
?>
<script type="text/javascript">
alert(<?php
echo json_encode($api_response['envato_is_valid_msg']);
?>
);
window.location = "<?php
echo admin_url();
?>
";
</script>
<?php
//.........这里部分代码省略.........
示例8: array
Stanford, CA 452 14 521
(650) 723-2558 (main number)
(650) 725-0247 (fax)
Email: contact@newspaper.com
[/td_text_with_title][/vc_column_inner][vc_column_inner width=\\"1/2\\"][td_social custom_title=\\"OUR SOCIAL PROFILES\\" icon_style=\\"1\\" icon_size=\\"32\\" dribbble=\\"http://www.tagdiv.com\\" facebook=\\"http://www.tagdiv.com\\" googleplus=\\"#\\" grooveshark=\\"http://www.tagdiv.com\\" linkedin=\\"#\\" twitter=\\"http://www.tagdiv.com\\" youtube=\\"http://www.tagdiv.com\\" el_position=\\"first\\"][td_text_with_title custom_title=\\"WORKING HOUR\\"]
The office is open from 8 a.m. to 5 p.m. Monday through Friday except university holidays.
[/td_text_with_title][/vc_column_inner][/vc_row_inner][contact-form-7 id=\\"1\\" title=\\"LEAVE US A MESSAGE\\"][/vc_column][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\" el_position=\\"first last\\"][/vc_column][/vc_row]', 'sidebar-right_28390' => array('name' => 'Sidebar right', 'template' => '[vc_row][vc_column width=\\"2/3\\"][/vc_column][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\"][/vc_column][/vc_row]'), 'sidebar-left_18719' => array('name' => 'Sidebar left', 'template' => '[vc_row][vc_column width=\\"1/3\\"][vc_widget_sidebar sidebar_id=\\"td-default\\"][/vc_column][vc_column width=\\"2/3\\"][/vc_column][/vc_row]')));
update_option('wpb_js_templates', $td_pagebuilder_templates);
//update the wordpress default time format
update_option('date_format', 'M j, Y');
//echo get_option('date_format');
}
add_action("after_switch_theme", "td_on_theme_activate", 10, 2);
//update_option('wpb_js_templates',unserialize(''));
//td_on_theme_activate('', false);
//echo str_replace(array("\r\n","\r"),"",serialize(get_option('wpb_js_templates'))); ;
//print_r(get_option('wpb_js_templates'));
$td_isFirstInstall = td_util::get_option('firstInstall');
if (empty($td_isFirstInstall)) {
wp_insert_term('Featured', 'category', array('description' => 'Featured posts', 'slug' => 'featured', 'parent' => 0));
td_util::update_option('firstInstall', 'themeInstalled');
}
示例9: get_template_directory_uri
$td_demo_site->add_top_menu('Products review');
$td_demo_site->add_top_menu('Custom 404');
$td_demo_site->add_top_menu('Contact us');
$td_demo_site->activate_menu('top-menu');
/* ----------------------------------------------------------------------------
logo + ad
*/
$td_demo_site->update_logo(get_template_directory_uri() . '/images/demo/logo-top.png', get_template_directory_uri() . '/images/demo/logo-top-retina.png');
$td_demo_site->add_ad_spot('demo top ad', '', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-468.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-468.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_top/ads-728.jpg') . '" alt="" /></a>');
$td_demo_site->set_header_adspot('demo top ad');
/* ----------------------------------------------------------------------------
demo sidebar 1 //create custom sidebar in our theme option
*/
//this is the new list with sidebars
$import_unique_id_key = uniqid() . '_' . rand(1, 999999);
td_util::update_option('sidebars', array($import_unique_id_key => 'demo-1'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_social_widget', array('custom_title' => 'SOCIAL', 'facebook' => '#', 'youtube' => '#', 'github' => '#', 'google' => '#', 'googledrive' => '#', 'googlemaps' => '#', 'paypal' => '#'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_block2_widget', array('sort' => '', 'custom_title' => 'LATEST REVIEWS', 'limit' => '3'));
$td_demo_site->add_widget_to_sidebar('demo-1', 'td_slide_widget', array('sort' => '', 'custom_title' => 'POPULAR VIDEO', 'limit' => '3'));
/* ----------------------------------------------------------------------------
default sidebar
*/
$td_demo_site->remove_widgets_from_sidebar('default');
//ad widget + adspot
$td_demo_site->add_ad_spot('demo sidebar ad', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-300.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-200.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-250.jpg') . '" alt="" /></a>', '<a href="#"><img src="' . $td_demo_site->get_demo_image('ad_sidebar/ads-300.jpg') . '" alt="" /></a>');
$td_demo_site->add_widget_to_sidebar('default', 'td_ad_box_widget', array('spot_name' => 'Ad spot -- demo sidebar ad'));
$td_demo_site->add_widget_to_sidebar('default', 'td_block1_widget', array('sort' => '', 'custom_title' => 'RANDOM POSTS', 'limit' => '4', 'ajax_pagination' => "next_prev"));
/* ----------------------------------------------------------------------------
footer widgets
*/
$td_demo_site->remove_widgets_from_sidebar('footer-1');
示例10: get_page
/**
* returns the html of a remote page or FALSE on error. This function also automatically logs HTTP request errors to td_log
* @param $url - the remote url
* @param string $caller_id - a string id to aid us with information about what component called this function. When we get the logs from our clients
* the $caller_id will help us to know what component generated the failed http request and what method was used to request the data
*
* @return bool|string
* - string: the page html
* - bool FALSE: if the request failed
*/
static function get_page($url, $caller_id = '')
{
$td_remote_http = td_util::get_option('td_remote_http');
// see if we have a manual channel
if (!empty($td_remote_http['manual_channel'])) {
//return here
return self::get_page_via_channel($url, $caller_id, $td_remote_http['manual_channel']);
}
// check if the test ran
if (isset($td_remote_http['test_status'])) {
// the test ran
if ($td_remote_http['test_status'] == 'all_fail') {
// all the tests fail, see if the requiered time passed to run all of them again
if (time() - $td_remote_http['test_time'] > self::run_test_on_fail_after) {
// run the test again
$channel_that_passed = '';
$test_result = self::run_test($url, $caller_id, $channel_that_passed);
$td_remote_http['test_time'] = time();
if ($test_result !== false) {
$td_remote_http['test_status'] = $channel_that_passed;
td_util::update_option('td_remote_http', $td_remote_http);
// save new status
td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> time passed -> Test passed with channel: ' . $channel_that_passed, $url);
return $test_result;
} else {
// all tests failed
$td_remote_http['test_status'] = 'all_fail';
td_util::update_option('td_remote_http', $td_remote_http);
// save new status
td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> time passed -> all_fail again', $url);
return false;
}
} else {
td_log::log_info(__FILE__, __FUNCTION__, 'all_fail -> waiting' . (time() - $td_remote_http['test_time']) . 's passed', $url);
return false;
// no working channels, and we have to wait more
}
} else {
// we have a channel that passed in test_status
// @todo here we can count the number of fails and run the test again
td_log::log_info(__FILE__, __FUNCTION__, 'we have a channel that passed in test_status: ' . $td_remote_http['test_status'], $url);
return self::get_page_via_channel($url, $caller_id, $td_remote_http['test_status']);
}
} else {
// the test was not run
$channel_that_passed = '';
$test_result = self::run_test($url, $caller_id, $channel_that_passed);
$td_remote_http['test_time'] = time();
if ($test_result !== false) {
$td_remote_http['test_status'] = $channel_that_passed;
td_util::update_option('td_remote_http', $td_remote_http);
//save
td_log::log_info(__FILE__, __FUNCTION__, 'first run -> test passed with channel: ' . $channel_that_passed, $url);
return $test_result;
} else {
// all tests failed
$td_remote_http['test_status'] = 'all_fail';
td_util::update_option('td_remote_http', $td_remote_http);
//save
td_log::log_info(__FILE__, __FUNCTION__, 'first run -> all failed', $url);
return false;
}
}
}