本文整理汇总了PHP中FLBuilderModel::get_help_button_defaults方法的典型用法代码示例。如果您正苦于以下问题:PHP FLBuilderModel::get_help_button_defaults方法的具体用法?PHP FLBuilderModel::get_help_button_defaults怎么用?PHP FLBuilderModel::get_help_button_defaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FLBuilderModel
的用法示例。
在下文中一共展示了FLBuilderModel::get_help_button_defaults方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_help_button
/**
* Saves the help button settings.
*
* @since 1.0
* @access private
* @return void
*/
private static function save_help_button()
{
if (isset($_POST['fl-help-button-nonce']) && wp_verify_nonce($_POST['fl-help-button-nonce'], 'help-button')) {
$settings = FLBuilderModel::get_help_button_defaults();
$settings['enabled'] = isset($_POST['fl-help-button-enabled']) ? true : false;
$settings['tour'] = isset($_POST['fl-help-tour-enabled']) ? true : false;
$settings['video'] = isset($_POST['fl-help-video-enabled']) ? true : false;
$settings['knowledge_base'] = isset($_POST['fl-knowledge-base-enabled']) ? true : false;
$settings['forums'] = isset($_POST['fl-forums-enabled']) ? true : false;
// Disable everything if the main button is disabled.
if (!$settings['enabled']) {
$settings['tour'] = false;
$settings['video'] = false;
$settings['knowledge_base'] = false;
$settings['forums'] = false;
}
// Clean the video embed.
$video_embed = wp_kses($_POST['fl-help-video-embed'], array('iframe' => array('src' => array(), 'frameborder' => array(), 'webkitallowfullscreen' => array(), 'mozallowfullscreen' => array(), 'allowfullscreen' => array())));
// Save the video embed.
if (!empty($video_embed) && !stristr($video_embed, 'iframe')) {
self::add_error(__("Error! Please enter an iframe for the video embed code.", 'fl-builder'));
} else {
if (!empty($video_embed)) {
$settings['video_embed'] = $video_embed;
}
}
// Save the knowledge base URL.
if (!empty($_POST['fl-knowledge-base-url'])) {
$settings['knowledge_base_url'] = sanitize_text_field($_POST['fl-knowledge-base-url']);
}
// Save the forums URL.
if (!empty($_POST['fl-forums-url'])) {
$settings['forums_url'] = sanitize_text_field($_POST['fl-forums-url']);
}
// Make sure we have at least one help feature enabled.
if ($settings['enabled'] && !$settings['tour'] && !$settings['video'] && !$settings['knowledge_base'] && !$settings['forums']) {
self::add_error(__("Error! You must have at least one feature of the help button enabled.", 'fl-builder'));
return;
}
FLBuilderModel::update_admin_settings_option('_fl_builder_help_button', $settings, false);
}
}