本文整理汇总了PHP中ThemeHelper::getPostOption方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemeHelper::getPostOption方法的具体用法?PHP ThemeHelper::getPostOption怎么用?PHP ThemeHelper::getPostOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThemeHelper
的用法示例。
在下文中一共展示了ThemeHelper::getPostOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adminSaveMetaBox
function adminSaveMetaBox($postId)
{
if ($_POST) {
if (ThemeHelper::checkSavePost($postId, THEME_CONTEXT . '_meta_box_widget_area_noncename', 'adminSaveMetaBox') === false) {
return false;
}
$option = ThemeHelper::getPostOption('widget_area');
update_post_meta($postId, THEME_OPTION_PREFIX, $option);
}
}
示例2: adminOptionPanelSave
function adminOptionPanelSave()
{
$option = ThemeHelper::getPostOption();
ThemeHelper::removeUIndex($option, 'maintenance_mode_user_id');
$response = array('global' => array('error' => 1));
$CSS = new ThemeCSS();
$Blog = new ThemeBlog();
$Notice = new ThemeNotice();
$Easing = new ThemeEasing();
$FancyBox = new ThemeFancybox();
$Background = new ThemeBackground();
$Validation = new ThemeValidation($Notice);
$ResponsiveMode = new ThemeResponsiveMode($this->responsiveMode);
$media = $ResponsiveMode->getMedia();
$invalidValue = esc_html__('Invalid value', THEME_DOMAIN);
/* Main */
$Validation->notice('isNumber', array($option['header_enable'], 0, 1), array(ThemeHelper::getFormName('header_enable', false), $invalidValue));
if (!array_key_exists($option['header_background_image_repeat'], $Background->backgroundRepeat)) {
$Notice->addError(ThemeHelper::getFormName('header_background_image_repeat', false), $invalidValue);
}
if (!array_key_exists($option['header_background_image_size_1'], $Background->backgroundSize)) {
$Notice->addError(ThemeHelper::getFormName('header_background_image_size_1', false), $invalidValue);
}
/* Blog */
if (!in_array($option['blog_sort_field'], array_keys($Blog->sortPostBlogField))) {
$Notice->addError(ThemeHelper::getFormName('blog_sort_field', false), $invalidValue);
}
if (!in_array($option['blog_sort_direction'], array_keys($Blog->sortDirection))) {
$Notice->addError(ThemeHelper::getFormName('blog_sort_direction', false), $invalidValue);
}
$Validation->notice('isNumber', array($option['blog_automatic_excerpt_length'], 0, 999), array(ThemeHelper::getFormName('blog_automatic_excerpt_length', false), $invalidValue));
/* Post */
$Validation->notice('isNumber', array($option['post_category_visible'], 0, 1), array(ThemeHelper::getFormName('post_category_visible', false), $invalidValue));
$Validation->notice('isNumber', array($option['post_author_visible'], 0, 1), array(ThemeHelper::getFormName('post_author_visible', false), $invalidValue));
$Validation->notice('isNumber', array($option['post_tag_visible'], 0, 1), array(ThemeHelper::getFormName('post_tag_visible', false), $invalidValue));
$Validation->notice('isNumber', array($option['post_comment_count_visible'], 0, 1), array(ThemeHelper::getFormName('post_comment_count_visible', false), $invalidValue));
$Validation->notice('isNumber', array($option['post_navigation_visible'], 0, 1), array(ThemeHelper::getFormName('post_navigation_visible', false), $invalidValue));
/* Plugins / Menu top */
if (!in_array($option['menu_responsive_mode'], $this->responsiveMode)) {
$Notice->addError(ThemeHelper::getFormName('menu_responsive_mode', false), $invalidValue);
}
$Validation->notice('isNumber', array($option['menu_sticky_enable'], 0, 1), array(ThemeHelper::getFormName('menu_sticky_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_hide_scroll_enable'], 0, 1), array(ThemeHelper::getFormName('menu_hide_scroll_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_animation_enable'], 0, 1), array(ThemeHelper::getFormName('menu_animation_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_animation_speed_open'], 0, 99999), array(ThemeHelper::getFormName('menu_animation_speed_open', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_animation_speed_close'], 0, 99999), array(ThemeHelper::getFormName('menu_animation_speed_close', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_animation_delay'], 0, 99999), array(ThemeHelper::getFormName('menu_animation_delay', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_scroll_animation_enable'], 0, 1), array(ThemeHelper::getFormName('menu_scroll_animation_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['menu_scroll_animation_speed'], 0, 99999), array(ThemeHelper::getFormName('menu_scroll_animation_speed', false), $invalidValue));
if (!in_array($option['menu_scroll_animation_easing'], array_keys($Easing->easingType))) {
$Notice->addError(ThemeHelper::getFormName('menu_scroll_animation_easing', false), $invalidValue);
}
/* Footer */
$Validation->notice('isNumber', array($option['footer_enable'], 0, 1), array(ThemeHelper::getFormName('footer_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['footer_sticky_enable'], 0, 1), array(ThemeHelper::getFormName('footer_sticky_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['footer_top_enable'], 0, 1), array(ThemeHelper::getFormName('footer_top_enable', false), $invalidValue));
if (!array_key_exists($option['footer_top_background_image_repeat'], $Background->backgroundRepeat)) {
$Notice->addError(ThemeHelper::getFormName('footer_top_background_image_repeat', false), $invalidValue);
}
if (!array_key_exists($option['footer_top_background_image_size_1'], $Background->backgroundSize)) {
$Notice->addError(ThemeHelper::getFormName('footer_top_background_image_size_1', false), $invalidValue);
}
$Validation->notice('isNumber', array($option['footer_bottom_enable'], 0, 1), array(ThemeHelper::getFormName('footer_bottom_enable', false), $invalidValue));
/* Content copying */
$Validation->notice('isNumber', array($option['right_click_enable'], 0, 1), array(ThemeHelper::getFormName('right_click_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['copy_selection_enable'], 0, 1), array(ThemeHelper::getFormName('copy_selection_enable', false), $invalidValue));
/* Responsive mode */
$Validation->notice('isNumber', array($option['responsive_mode_enable'], 0, 1), array(ThemeHelper::getFormName('responsive_mode_enable', false), $invalidValue));
/* Go to page to */
$Validation->notice('isNumber', array($option['go_to_page_top_enable'], 0, 1), array(ThemeHelper::getFormName('go_to_page_top_enable', false), $invalidValue));
$Validation->notice('isNotEmpty', array($option['go_to_page_top_hash']), array(ThemeHelper::getFormName('go_to_page_top_hash', false), $invalidValue));
$Validation->notice('isNumber', array($option['go_to_page_top_animation_enable'], 0, 1), array(ThemeHelper::getFormName('go_to_page_top_animation_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['go_to_page_top_animation_duration'], 0, 99999), array(ThemeHelper::getFormName('go_to_page_top_animation_duration', false), $invalidValue));
if (!in_array($option['go_to_page_top_animation_easing'], array_keys($Easing->easingType))) {
$Notice->addError(ThemeHelper::getFormName('go_to_page_top_animation_easing', false), $invalidValue);
}
/* Font */
$font = array('base', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6');
foreach ($font as $value) {
foreach ($media as $mediaIndex => $mediaValue) {
$Validation->notice('isNumber', array($option['font_' . $value . '_size_' . $mediaIndex], 1, 100), array(ThemeHelper::getFormName('font_' . $value . '_size_' . $mediaIndex, false), $invalidValue));
}
if (!in_array($option['font_' . $value . '_style'], array_keys($CSS->fontStyle))) {
$Notice->addError(ThemeHelper::getFormName('font_' . $value . '_style', false), $invalidValue);
}
if (!in_array($option['font_' . $value . '_weight'], array_keys($CSS->fontWeight))) {
$Notice->addError(ThemeHelper::getFormName('font_' . $value . '_weight', false), $invalidValue);
}
}
/* Plugin / Fancybox for images */
$Validation->notice('isNumber', array($option['fancybox_image_padding'], 0, 999), array(ThemeHelper::getFormName('fancybox_image_padding', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_margin'], 0, 999), array(ThemeHelper::getFormName('fancybox_image_margin', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_min_width'], 1, 9999), array(ThemeHelper::getFormName('fancybox_image_min_width', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_min_height'], 1, 9999), array(ThemeHelper::getFormName('fancybox_image_min_height', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_max_width'], 1, 9999), array(ThemeHelper::getFormName('fancybox_image_max_width', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_max_height'], 1, 9999), array(ThemeHelper::getFormName('fancybox_image_max_height', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_helper_button_enable'], 0, 1), array(ThemeHelper::getFormName('fancybox_image_helper_button_enable', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_autoresize'], 0, 1), array(ThemeHelper::getFormName('fancybox_image_autoresize', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_autocenter'], 0, 1), array(ThemeHelper::getFormName('fancybox_image_autocenter', false), $invalidValue));
$Validation->notice('isNumber', array($option['fancybox_image_fittoview'], 0, 1), array(ThemeHelper::getFormName('fancybox_image_fittoview', false), $invalidValue));
//.........这里部分代码省略.........