本文整理汇总了PHP中ubermenu_op函数的典型用法代码示例。如果您正苦于以下问题:PHP ubermenu_op函数的具体用法?PHP ubermenu_op怎么用?PHP ubermenu_op使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ubermenu_op函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ubermenu_add_toolbar_items
function ubermenu_add_toolbar_items($admin_bar)
{
if (!current_user_can('manage_options')) {
return;
}
if (ubermenu_op('ubermenu_toolbar', 'general') != 'on') {
return;
}
$admin = is_admin();
$admin_bar->add_node(array('id' => 'ubermenu', 'title' => ubermenu_toolbar_icon('gears') . 'UberMenu', 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => __('UberMenu', 'UberMenu'))));
$admin_bar->add_node(array('id' => 'ubermenu_customize', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('eye') . __('Customize', 'ubermenu'), 'href' => admin_url('customize.php'), 'meta' => array('title' => __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_control_panel', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('sliders') . __('UberMenu Control Panel', 'ubermenu'), 'href' => admin_url('themes.php?page=ubermenu-settings'), 'meta' => array('title' => '<i class="fa fa-sliders"></i> ' . __('Configure the UberMenu Settings', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_edit_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('pencil') . __('Edit Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php'), 'meta' => array('title' => __('Add, remove, and configure menu items', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$menus = wp_get_nav_menus(array('orderby' => 'name'));
foreach ($menus as $menu) {
$admin_bar->add_node(array('id' => 'ubermenu_edit_menus_' . $menu->slug, 'parent' => 'ubermenu_edit_menus', 'title' => $menu->name, 'href' => admin_url('nav-menus.php?action=edit&menu=' . $menu->term_id), 'meta' => array('title' => __('Configure', 'ubermenu') . ' ' . $menu->name, 'target' => '_blank', 'class' => '')));
}
$admin_bar->add_node(array('id' => 'ubermenu_assign_menus', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('bars') . __('Assign Menus', 'ubermenu'), 'href' => admin_url('nav-menus.php?action=locations'), 'meta' => array('title' => __('Theme Location Manager', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_knowledgebase', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('book') . __('Knowledgebase', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_docs', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('book') . __('Documentation', 'ubermenu'), 'href' => UBERMENU_KB_URL, 'meta' => array('title' => __('UberMenu Knowledgebase / Support Guide', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_video_tutorials', 'parent' => 'ubermenu_knowledgebase', 'title' => ubermenu_toolbar_icon('video-camera') . __('Video Tutorials', 'ubermenu'), 'href' => UBERMENU_VIDEOS_URL, 'meta' => array('title' => __('UberMenu Video Tutorials', 'ubermenu'), 'target' => '_blank', 'class' => '')));
$admin_bar->add_node(array('id' => 'ubermenu_support', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('life-ring') . __('Support / Help', 'ubermenu'), 'href' => UBERMENU_SUPPORT_URL, 'meta' => array('title' => __('UberMenu Support Center', 'ubermenu'), 'target' => '_blank', 'class' => '')));
if (!is_admin()) {
//Diagnostics
if (ubermenu_op('diagnostics', 'general') == 'on') {
$admin_bar->add_node(array('id' => 'ubermenu_diagnostics', 'parent' => 'ubermenu', 'title' => ubermenu_toolbar_icon('stethoscope') . __('Diagnostics (Alpha)', 'ubermenu'), 'href' => '#', 'meta' => array('title' => __('Load diagnostics script (experimental feature in Alpha development)', 'ubermenu'), 'class' => 'ubermenu-diagnostics-loader-button')));
}
//Loading Message
$admin_bar->add_node(array('id' => 'ubermenu_loading', 'title' => ubermenu_toolbar_icon('exclamation-triangle') . ' UberMenu Loading...', 'href' => '#'));
$loading_msg = __('If this message does not disappear, it means that UberMenu\'s javascript has not been able to load. This most commonly indicates that you have a javascript error on this page, which will need to be resolved in order to allow UberMenu to run.', 'ubermenu');
//$loading_msg.= ' <a target="_blank" href="http://goo.gl/oS6L6C">How to check for javascript errors.</a>';
$admin_bar->add_node(array('id' => 'ubermenu_loading_msg', 'parent' => 'ubermenu_loading', 'title' => $loading_msg, 'href' => 'http://goo.gl/oS6L6C', 'meta' => array('target' => '_blank')));
}
}
示例2: ubermenu_get_menu_style_custom_font
function ubermenu_get_menu_style_custom_font($field, $menu_id, &$menu_styles)
{
$font_value = ubermenu_op($field['name'], $menu_id);
if ($font_value) {
$selector = ".ubermenu-{$menu_id}, .ubermenu-{$menu_id} .ubermenu-target, .ubermenu-{$menu_id} .ubermenu-nav .ubermenu-item-level-0 .ubermenu-target";
$menu_styles[$selector]['font'] = $font_value;
}
}
示例3: ubermenu_run_backups
function ubermenu_run_backups()
{
if (!defined('DOING_AJAX') && current_user_can('update_plugins')) {
if (ubermenu_op('backup_custom_assets', 'updates') != 'off') {
ubermenu_backup_custom_assets();
//ubermenu_restore_custom_assets(); //Just for testing
}
}
}
示例4: ubermenu_pro_load_assets
function ubermenu_pro_load_assets()
{
$assets = UBERMENU_URL . 'pro/assets/';
//Load Core UberMenu CSS unless disabled
if (ubermenu_op('load_ubermenu_css', 'general') != 'off') {
wp_deregister_style('ubermenu');
//wp_dequeue_style( 'ubermenu' );
wp_enqueue_style('ubermenu', $assets . 'css/ubermenu.min.css', false, UBERMENU_VERSION);
}
}
示例5: ubermenu_diagnostics_item_info_callback
function ubermenu_diagnostics_item_info_callback()
{
if (ubermenu_op('diagnostics', 'general') != 'on') {
die;
}
if (isset($_POST['menu_item_id'])) {
$item_id = $_POST['menu_item_id'];
$settings = ubermenu_diagnostics_get_item_settings($item_id);
//print_r( $settings );
echo json_encode($settings);
}
die;
}
示例6: ubermenu_get_widget_areas
function ubermenu_get_widget_areas()
{
$widget_areas = array();
$num_widget_areas = ubermenu_op('num_widget_areas', 'general', 0);
$widget_area_names = ubermenu_op('widget_area_names', 'general', '');
$names = explode(',', $widget_area_names);
if ($num_widget_areas) {
for ($k = 0; $k < $num_widget_areas; $k++) {
$id = 'ubermenu-sidebar-' . ($k + 1);
//echo $id;
$name = isset($names[$k]) && trim($names[$k]) ? trim($names[$k]) : 'UberMenu Widget Area ' . ($k + 1);
$widget_areas[$id] = $name;
}
}
return $widget_areas;
}
示例7: uberMenu_easyIntegrate
function uberMenu_easyIntegrate($config_id = 'main', $args = array())
{
//Check that Easy Integration is enabled
if (ubermenu_op('ubermenu_theme_location', 'general') != 'on') {
$msg = 'To use Easy Integration, please enable the <strong>Register Easy Integration UberMenu Theme Location</strong> setting in the <a target="_blank" href="' . admin_url('themes.php?page=ubermenu-settings') . '">UberMenu Control Panel > General Settings > Advanced</a> and <a target="_blank" href="' . admin_url('nav-menus.php?action=locations') . '">assign a menu</a> to the <strong>UberMenu [Easy Integration]</strong> theme locaiton';
ubermenu_admin_notice($msg);
return;
} else {
if (!has_nav_menu('ubermenu')) {
$msg = 'To use Easy Integration, please <a target="_blank" href="' . admin_url('nav-menus.php?action=locations') . '">assign a menu</a> to the <strong>UberMenu [Easy Integration]</strong> theme location';
ubermenu_admin_notice($msg);
return;
}
}
//$args = array();
$args['theme_location'] = 'ubermenu';
return ubermenu($config_id, $args);
}
示例8: ubermenu_get_menu_style_dropdown_within_mega
function ubermenu_get_menu_style_dropdown_within_mega($field, $menu_id, &$menu_styles)
{
if (ubermenu_op($field['name'], $menu_id) == 'on') {
$menu_styles[".ubermenu-{$menu_id} .ubermenu-item .ubermenu-submenu-drop.ubermenu-submenu-type-mega"]['overflow'] = 'visible';
}
}
示例9: ubermenu_check_menu_assignment
function ubermenu_check_menu_assignment()
{
$display = ubermenu_op('display_main', 'ubermenu-main');
if ($display == 'on') {
if (!has_nav_menu('ubermenu')) {
?>
<div class="update-nag"><strong>Important!</strong> There is no menu assigned to the <strong>UberMenu [Main]</strong> Menu Location. <a href="<?php
echo admin_url('nav-menus.php?action=locations');
?>
">Assign a menu</a></div>
<br/><br/>
<?php
}
}
}
示例10: ubermenu_remove_custom_admin_walker
function ubermenu_remove_custom_admin_walker()
{
if (ubermenu_op('disable_custom_admin_walker', 'general') == 'on') {
remove_all_actions('wp_edit_nav_menu_walker');
}
}
示例11: get_widget_area
function get_widget_area()
{
$html = '';
$widget_area_id = $this->getSetting('widget_area');
if ($this->getSetting('auto_widget_area')) {
$custom_area_id = 'umitem_' . $this->ID;
if (is_active_sidebar($custom_area_id)) {
$widget_area_id = $custom_area_id;
} else {
$notice = __('The widget area is empty.', 'ubermenu');
$notice .= ' <a target="_blank" href="' . admin_url('widgets.php') . '">' . __('Assign a widget', 'ubermenu') . '</a>';
global $wp_registered_sidebars;
if (isset($wp_registered_sidebars[$custom_area_id])) {
$sidebar = $wp_registered_sidebars[$custom_area_id];
$notice .= ' to <strong>' . $sidebar['name'] . '</strong>';
}
$html .= ubermenu_admin_notice($notice, false);
return $html;
}
}
//If this is a top level widget and that setting is not enabled, show an admin message
if ($this->depth == 0 && $widget_area_id && ubermenu_op('allow_top_level_widgets', 'general') != 'on') {
$msg = '<strong>[Menu Item: ' . $this->item->title . ']</strong> ' . __('You have assigned a widget area to a top level menu item. If you want the widget to appear in a submenu, please attach it to a child menu item. If you want the widget to appear in the menu bar (always visible), please enable the setting in the UberMenu Control Panel > General Settings > Widgets > Allow Top Level Widgets', 'ubermenu');
ubermenu_admin_notice($msg, true);
//Deliberately printed BEFORE the menu rather than within it because the message is so long.
//$html.= ubermenu_admin_notice( $msg , true );
return $html;
}
if ($widget_area_id && is_active_sidebar($widget_area_id)) {
global $wp_registered_sidebars;
global $wp_registered_widgets;
//global $_wp_sidebars_widgets;
$sidebars_widgets = wp_get_sidebars_widgets();
$num_widgets = count($sidebars_widgets[$widget_area_id]);
//Evenly divided
$cols = 'ubermenu-column-1-' . $num_widgets;
//If col number is set
$widget_area_columns = $this->getSetting('widget_area_columns');
if (is_numeric($widget_area_columns)) {
$cols = 'ubermenu-column-1-' . $widget_area_columns;
}
foreach ($sidebars_widgets[$widget_area_id] as $widget_id) {
$wp_registered_widgets[$widget_id]['classname'] .= ' ' . $cols;
}
//ob_flush();
ob_start();
dynamic_sidebar($widget_area_id);
$widget_area = ob_get_contents();
//$widget_area = ob_get_clean(); //ob_get_contents();
ob_end_clean();
$html .= '<ul class="ubermenu-content-block ubermenu-widget-area ubermenu-row ubermenu-autoclear">';
$html .= $widget_area;
$html .= '</ul>';
} else {
if ($widget_area_id) {
global $wp_registered_sidebars;
$notice = __('The widget area is empty. ', 'ubermenu');
$notice .= '<a target="_blank" href="' . admin_url('widgets.php') . '">' . __('Assign a widget', 'ubermenu') . '</a>';
if (isset($wp_registered_sidebars[$widget_area_id])) {
$sidebar = $wp_registered_sidebars[$widget_area_id];
$notice .= ' to <strong>' . $sidebar['name'] . '</strong>';
}
$html .= ubermenu_admin_notice($notice, false);
return $html;
} else {
//Nothing assigned - fine if a normal menu item, but if this is a Widget Area menu item, stop the presses.
if ($this->type == 'widget_area') {
$notice = __('Please enter a name for your Custom Widget Area, or assign a Reusable Widget Area to this menu item.', 'ubermenu');
$notice .= ' <strong>Item ID: ' . $this->ID . ' ' . $this->item->title . '</strong>';
$html .= ubermenu_admin_notice($notice, false);
}
}
}
return $html;
}
示例12: ubermenu_admin_notice
function ubermenu_admin_notice($content, $echo = true)
{
//$showtips = false;
if (ubermenu_op('admin_notices', 'general') == 'on') {
if (ubermenu_user_is_admin()) {
$notice = '<div class="ubermenu-admin-notice"><i class="ubermenu-admin-notice-icon fa fa-lightbulb-o"></i>' . $content . '</div>';
if ($echo) {
echo $notice;
}
return $notice;
}
}
}
示例13: ubermenu_get_menu_style_sticky_toggle_color
function ubermenu_get_menu_style_sticky_toggle_color($field, $menu_id, &$menu_styles)
{
$val = ubermenu_op($field['name'], $menu_id);
if ($val) {
$selector = ".ubermenu-responsive-toggle-{$menu_id}.ubermenu-sticky";
$menu_styles[$selector]['background'] = $val;
//$menu_styles[$selector]['margin-top'] = $val;
}
}
示例14: ubermenu_sticky_custom_styles
function ubermenu_sticky_custom_styles($styles)
{
if (ubermenu_op('sticky_disable_css', 'general') == 'on') {
return $styles;
}
if (UM_STICKY()->sticky_apply()) {
$css = '';
$css .= "\n/** UberMenu Sticky CSS **/\n";
$css .= ".ubermenu.ubermenu-sticky, .ubermenu-responsive-toggle.ubermenu-sticky{ z-index:1000; }";
$css .= ".ubermenu-sticky.ubermenu-sticky-full-width{ left:0; width:100%; max-width:100%; }\n";
$css .= ".ubermenu-sticky-full-width.ubermenu-sticky .ubermenu-nav{ padding-left:1px; }\n";
$breakpoint = ubermenu_op('responsive_breakpoint', 'general');
if ($breakpoint === '') {
$breakpoint = 959;
}
if (is_numeric($breakpoint)) {
$breakpoint .= 'px';
}
//Responsive Sticky Styles
$css .= "@media screen and (max-width: {$breakpoint}){ \n" . " .ubermenu-responsive-toggle.ubermenu-sticky{ height:43px; left:0; width:100% !important; } \n" . " .ubermenu.ubermenu-responsive.ubermenu-sticky{ margin-top:43px; left:0; width:100% !important; } \n";
//" .ubermenu-sticky-wrapper{ max-height:0; min-height:0 !important; } \n".
$css .= " /* Mobile Sticky */\n";
$css .= " .ubermenu.ubermenu-is-mobile.ubermenu-sticky { min-height:400px; max-height:600px; overflow-y:auto !important; -webkit-overflow-scrolling:touch; }\n";
$css .= " .ubermenu.ubermenu-is-mobile.ubermenu-sticky > .ubermenu-nav{ height:100%; }\n";
$css .= " .ubermenu.ubermenu-is-mobile.ubermenu-sticky .ubermenu-active > .ubermenu-submenu-drop{ max-height:none; }\n";
$css .= "}\n";
//End media query
//Special Sticky Classes
$css .= "/* Special Classes */ ";
$css .= ".ubermenu .ubermenu-item.um-sticky-only{ display:none !important; } ";
$css .= ".ubermenu.ubermenu-sticky .ubermenu-item-level-0.um-sticky-only{ display:inline-block !important; } ";
$css .= ".ubermenu.ubermenu-sticky .ubermenu-submenu .ubermenu-item.um-sticky-only{ display:block !important; } ";
$css .= ".ubermenu .ubermenu-item-level-0.um-unsticky-only{ display:inline-block !important; } ";
$css .= ".ubermenu .ubermenu-submenu .ubermenu-item.um-unsticky-only{ display:block !important; } ";
$css .= ".ubermenu.ubermenu-sticky .ubermenu-item.um-unsticky-only{ display:none !important; }\n";
/*
// The actual sticky CSS
$css.= "{$stickyMegaMenu}{ margin: 0 !important; z-index:1000; position:fixed !important; top: {$offset}px; bottom: auto !important; -webkit-transition:none; -moz-transition:none; transition:none; }\n";
if( !$alwaysSticky ){
//Special Sticky Classes
$css.= "#megaMenu ul.megaMenu li.um-sticky-only{ display: none !important; }";
$css.= "#megaMenu-sticky-wrapper #megaMenu.ubermenu-sticky li.um-sticky-only{ display: block !important; }";
$css.= "#megaMenu ul.megaMenu li.um-unsticky-only{ display: block !important; }";
$css.= "#megaMenu-sticky-wrapper #megaMenu.ubermenu-sticky li.um-unsticky-only{ display: none !important; }";
}
if( $settings->op( 'ubersticky-mobile' ) ){
$css.= "\n/* Mobile Sticky */
/*\n";
$stickyWrapper = '#megaMenu-sticky-wrapper.uber-sticky-mobile '; //trailing space is important
if( $alwaysSticky ) $stickyWrapper = ''; //Apply if we're not using
$css.= "{$stickyWrapper}#megaMenu ul.megaMenu.megaMenuToggleOpen{ overflow-y:scroll !important; -webkit-overflow-scrolling: touch; }"; // overflow-scrolling: touch;
}
//At smaller sizes, make align left, full width!
if( $settings->op( 'ubersticky-expand-menu-bar' ) ){
$css.= "\n/* Expand Menu Bar */
/*\n";
$css.= "{$stickyMegaMenu}{ left: 0; right:auto; width: 100%; border-radius: 0; }\n";
if( is_numeric( $settings->op( 'ubersticky-center-inner' ) ) ){
$css.= "/* Center Inner Menu */
/*\n";
$css.= "#megaMenu.ubermenu-sticky ul.megaMenu{ padding-left:2px; margin: 0 auto; float:none; max-width: {$settings->op( 'ubersticky-center-inner' )}px; }\n"; //leave selectors as is, use core UM settings instead
$css.= "#megaMenu.megaMenuHorizontal ul.megaMenu > li:first-child > a{ box-shadow:none; }\n";
}
}
//If UberMenu was supposed to be centered
if( $settings->op( 'center-menubar' ) ){
$css.= "/* Center Menubar */
/*\n";
$css.= "#megaMenu-sticky-wrapper{ margin:0 auto; max-width: 100%; width: {$settings->op( 'wpmega-container-w' )}px; }\n";
}
if( ( $bkg_color = $settings->op( 'ubersticky-background-color' ) ) != '' ){
$css.= "/* Menu Bar Background */
/*\n";
$css.= "#megaMenu-sticky-wrapper #megaMenu.ubermenu-sticky{ background: #$bkg_color; }\n";
}
*/
if (ubermenu_op('sticky_toolbar_footer', 'general') == 'on') {
$css .= "/* Move Admin Bar to bottom */\n@media screen and (min-width:783px){\n * html body { margin-top: 0 !important; }\n body.admin-bar { margin-top: -28px; padding-bottom: 28px; }\n body.wp-admin #footer { padding-bottom: 28px; }\n #wpadminbar { top: auto !important; bottom: 0; }\n #wpadminbar .quicklinks .ab-sub-wrapper { bottom: 28px; }\n #wpadminbar .quicklinks .ab-sub-wrapper ul .ab-sub-wrapper { bottom: -7px; } }\n";
} else {
$breakpoint = ubermenu_op('responsive_breakpoint', 'general');
if (is_numeric($breakpoint)) {
$breakpoint .= 'px';
}
$css .= "@media screen and (min-width:783px){ .admin-bar .ubermenu.ubermenu-sticky, .admin-bar .ubermenu-responsive-toggle.ubermenu-sticky{ margin-top:32px; } }\n";
$css .= "@media screen and (min-width:783px) and (max-width:{$breakpoint}){ .admin-bar .ubermenu.ubermenu-sticky{ margin-top:78px; } }\n";
$css .= "@media screen and (min-width:600px) and (max-width:782px){ .admin-bar .ubermenu.ubermenu-sticky, .admin-bar .ubermenu-responsive-toggle.ubermenu-sticky{ margin-top:46px; } .admin-bar .ubermenu.ubermenu-sticky{ margin-top:89px; } }\n";
}
$styles[70] = $css;
//uberp( $styles );
}
return $styles;
}
示例15: ubermenu_custom_responsive_styles
function ubermenu_custom_responsive_styles()
{
$breakpoint_primary = ubermenu_op('responsive_breakpoint', 'general');
if (!$breakpoint_primary) {
//$breakpoint_primary = 959;
return;
}
$dir = UBERMENU_DIR . 'assets/css/less/';
$css = '';
$breakpoint_primary = intval($breakpoint_primary);
$breakpoint_expand = $breakpoint_primary + 1;
$breakpoint_secondary = 480;
//Above
$above = file_get_contents($dir . 'responsive_breakpoint_above.less');
if ($above) {
$above .= ' .ubermenu-responsive-toggle{ display:none; }';
$above = str_replace('&', '', $above);
$above = str_replace("\t", '', $above);
$above = str_replace("\n", ' ', $above);
$above = "@media screen and (min-width: {$breakpoint_expand}px){\n " . $above . "\n}\n";
$css .= $above;
}
//Primary
$primary = file_get_contents($dir . 'responsive_breakpoint_primary.less');
if ($primary) {
$primary .= ' .ubermenu-responsive-toggle{ display:block; }';
$primary = str_replace('&', '', $primary);
$primary = str_replace("\t", '', $primary);
$primary = str_replace("\n", ' ', $primary);
$primary = "@media screen and (max-width: {$breakpoint_primary}px){\n " . $primary . "\n}\n";
$css .= $primary;
//$primary = str_replace( '}' , "}\n" , $primary );
}
//Secondary
$secondary = file_get_contents($dir . 'responsive_breakpoint_secondary.less');
if ($secondary) {
$secondary = str_replace('&', '', $secondary);
$secondary = str_replace("\t", '', $secondary);
$secondary = str_replace("\n", ' ', $secondary);
$secondary = "@media screen and (max-width: {$breakpoint_secondary}px){\n " . $secondary . "\n}\n";
$css .= $secondary;
//$primary = str_replace( '}' , "}\n" , $primary );
}
//echo '<pre>'.$css.'</pre>';
return $css;
}