function themerex_media_view_filters($settings, $post = null) { $taxes = array('media_folder'); foreach ($taxes as $tax) { //$terms = get_terms($tax); $terms = getTermsByTaxonomy(array($tax)); if (count($terms) > 0) { $settings['mimeTypes'][$tax . '.'] = __('Media without folders', 'themerex'); $settings['mimeTypes'] = themerex_array_merge($settings['mimeTypes'], getTermsHierarchicalList($terms, array('prefix_key' => 'media_folder.', 'prefix_level' => '-'))); } } return $settings; }
// Switcher choises $THEMEREX_shortcodes_yes_no = getYesNoList(); $THEMEREX_shortcodes_on_off = getOnOffList(); $THEMEREX_shortcodes_dir = getDirectionList(); $THEMEREX_shortcodes_align = getAlignmentList(); $THEMEREX_shortcodes_text_align = getAlignList(); $THEMEREX_shortcodes_float = getFloatList(); $THEMEREX_shortcodes_show_hide = getShowHideList(); $THEMEREX_shortcodes_box_style = getBoxStyles(); $THEMEREX_shortcodes_sorting = getSortingList(); $THEMEREX_shortcodes_ordering = getOrderingList(); $THEMEREX_shortcodes_sliders = getSlidersList(); $THEMEREX_shortcodes_users = getUsersList(); $THEMEREX_shortcodes_categories = getCategoriesList(); $THEMEREX_shortcodes_columns = getColumnsList(); $THEMEREX_shortcodes_images = themerex_array_merge(array('none' => "none"), getListFiles("/images/icons", "png")); $THEMEREX_shortcodes_icons = array_merge(array("none"), getIconsList()); $THEMEREX_shortcodes_locations = getDedicatedLocationsList(); global $THEMEREX_shortcodes_yes_no; // Current elemnt id $THEMEREX_shortcodes_id = array("id" => "id", "title" => __("Element ID", "themerex"), "desc" => __("ID for current element", "themerex"), "divider" => false, "value" => "", "type" => "text"); // Width and height params function THEMEREX_shortcodes_width($w = '') { return array("id" => "width", "title" => __("Width", "themerex"), "divider" => false, "value" => $w, "type" => "text"); } function THEMEREX_shortcodes_height($h = '', $des = 'Width (in pixels or percent) and height (only in pixels) of element') { return array("id" => "height", "title" => __("Height", "themerex"), "desc" => __($des, "themerex"), "value" => $h, "type" => "text"); } /*indent*/
$THEMEREX_theme_options[] = array("name" => __('Related posts order', 'themerex'), "desc" => __('Select the desired ordering method for related posts', 'themerex'), "id" => $THEMEREX_shortname . "_" . "post_related_order", "std" => "desc", "type" => "select", "options" => $ordering); $THEMEREX_theme_options[] = array("name" => __('Show comments', 'themerex'), "desc" => __("Show comments block on single post page", 'themerex'), "id" => $THEMEREX_shortname . '_' . "show_post_comments", "override" => "category,post,page", "std" => "yes", "type" => "radio", "style" => "horizontal", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __('Puzzles-style: Post excerpt background', 'themerex'), "desc" => __('Use this color as background for post excerpt on puzzles-styled pages', 'themerex'), "id" => $THEMEREX_shortname . "_" . "puzzles_post_bg", "override" => "category,post,page", "std" => "#0080af", "type" => "color"); $THEMEREX_theme_options[] = array("name" => __('Puzzles-style: Post excerpt position', 'themerex'), "desc" => __('Post excerpt position on puzzles-styled pages', 'themerex'), "id" => $THEMEREX_shortname . "_" . "puzzles_post_position", "override" => "category,post,page", "std" => "down-1", "type" => "images", "options" => $puzzles); /* ############################### #### Main slider #### ############################### */ $THEMEREX_theme_options[] = array("name" => __('Slider', 'themerex'), "override" => "category,page", "type" => "heading"); $THEMEREX_theme_options[] = array("name" => __('Main slider parameters', 'themerex'), "std" => __('Select parameters for main slider (you can override it in each category and page)', 'themerex'), "override" => "category,page", "type" => "info"); $THEMEREX_theme_options[] = array("name" => __('Show Slider', 'themerex'), "desc" => __('Do you want to show slider on each page (post)', 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_show", "override" => "category,page", "std" => "no", "type" => "radio", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __('Slider display', 'themerex'), "desc" => __('How display slider: fixed width or fullscreen width', 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_display", "override" => "category,page", "std" => "none", "type" => "select", "options" => array("fixed" => __("Fixed width", 'themerex'), "fullscreen" => __("Fullscreen", 'themerex'))); $THEMEREX_theme_options[] = array("name" => __('Slider engine', 'themerex'), "desc" => __('What engine use to show slider: Revolution slider (need to install additional plugin from theme package), Flex Slider or None (don\'t show slider)', 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_engine", "override" => "category,page", "std" => "flex", "type" => "select", "options" => $sliders); $THEMEREX_theme_options[] = array("name" => __('Revolution Slider alias', 'themerex'), "desc" => __("Slider alias (see in Revolution plugin settings)", 'themerex'), "id" => $THEMEREX_shortname . '_' . "slider_alias", "override" => "category,page", "std" => "", "type" => "text"); $THEMEREX_theme_options[] = array("name" => __('Flexslider: Category to show', 'themerex'), "desc" => __('Select category to show in Flexslider (ignored for Revolution slider)', 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_category", "override" => "category,page", "std" => "", "type" => "select", "options" => themerex_array_merge(array(0 => __('- Any category -', 'themerex')), $categories)); $THEMEREX_theme_options[] = array("name" => __('Flexslider: Number posts or comma separated posts list', 'themerex'), "desc" => __("How many recent posts display in slider or comma separated list of posts ID (in this case selected category ignored)", 'themerex'), "override" => "category,page", "id" => $THEMEREX_shortname . '_' . "slider_posts", "std" => "5", "type" => "text"); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Post's order by", 'themerex'), "desc" => __("Posts in slider ordered by date (default), comments, views, author rating, users rating, random or alphabetically", 'themerex'), "override" => "category,page", "id" => $THEMEREX_shortname . '_' . "slider_orderby", "std" => "date", "type" => "select", "options" => $sorting); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Post's order", 'themerex'), "desc" => __('Select the desired ordering method for posts', 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_order", "override" => "category,page", "std" => "desc", "type" => "select", "options" => $ordering); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Show post's infobox", 'themerex'), "desc" => __("Do you want to show post's title, reviews rating and description on slides in flex-slider", 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_info_box", "override" => "category,page", "std" => "yes", "type" => "radio", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Infobox fixed", 'themerex'), "desc" => __("Do you want to fix infobox on slides in flex-slider or hide it in hover", 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_info_fixed", "override" => "category,page", "std" => "no", "type" => "radio", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Show post's category", 'themerex'), "desc" => __("Do you want to show post's category on slides in flex-slider", 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_info_category", "override" => "category,page", "std" => "yes", "type" => "radio", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Show post's reviews rating", 'themerex'), "desc" => __("Do you want to show post's reviews rating on slides in flex-slider", 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_reviews", "override" => "category,page", "std" => "yes", "type" => "radio", "options" => $yes_no); $THEMEREX_theme_options[] = array("name" => __("Flexslider: Show post's descriptions", 'themerex'), "desc" => __("Do you want to show post's description on slides in flex-slider", 'themerex'), "id" => $THEMEREX_shortname . "_" . "slider_descriptions", "override" => "category,page", "std" => "yes", "type" => "radio", "options" => $yes_no); /* ############################### #### Google map #### ############################### */ $THEMEREX_theme_options[] = array("name" => __('Google map', 'themerex'), "override" => "category,page,post", "type" => "heading"); $THEMEREX_theme_options[] = array("name" => __('Google map parameters', 'themerex'), "std" => __('Select parameters for Google map (you can override it in each category and page)', 'themerex'), "override" => "category,page,post", "type" => "info");
function themerex_array_merge($a1, $a2) { if (is_array($a2) && count($a2) > 0) { foreach ($a2 as $k => $v) { if (is_array($v)) { $a1[$k] = themerex_array_merge($a1[$k], $v); } else { $a1[$k] = $v; } } } return $a1; }
function getThemeFontsList($prepend_inherit = false) { $list = array(); if ($prepend_inherit) { $list['inherit'] = __("Inherit", 'themerex'); } $list = themerex_array_merge($list, getCustomFontsList()); // Google and custom fonts list: //$list['Advent Pro'] = array( // 'family'=>'sans-serif', // (required) font family // 'link'=>'Advent+Pro:100,100italic,300,300italic,400,400italic,500,500italic,700,700italic,900,900italic', // (optional) if you use Google font repository // 'css'=>themerex_get_file_url('/css/font-face/Advent-Pro/stylesheet.css') // (optional) if you use custom font-face // ); $list['Advent Pro'] = array('family' => 'sans-serif'); $list['Alegreya Sans'] = array('family' => 'sans-serif'); $list['Arimo'] = array('family' => 'sans-serif'); $list['Asap'] = array('family' => 'sans-serif'); $list['Averia Sans Libre'] = array('family' => 'cursive'); $list['Averia Serif Libre'] = array('family' => 'cursive'); $list['Bree Serif'] = array('family' => 'serif'); $list['Cabin'] = array('family' => 'sans-serif'); $list['Cabin Condensed'] = array('family' => 'sans-serif'); $list['Caudex'] = array('family' => 'serif'); $list['Comfortaa'] = array('family' => 'cursive'); $list['Cousine'] = array('family' => 'sans-serif'); $list['Crimson Text'] = array('family' => 'serif'); $list['Cuprum'] = array('family' => 'sans-serif'); $list['Dosis'] = array('family' => 'sans-serif'); $list['Economica'] = array('family' => 'sans-serif'); $list['Exo'] = array('family' => 'sans-serif'); $list['Expletus Sans'] = array('family' => 'cursive'); $list['Karla'] = array('family' => 'sans-serif'); $list['Lato'] = array('family' => 'sans-serif'); $list['Lekton'] = array('family' => 'sans-serif'); $list['Lobster Two'] = array('family' => 'cursive'); $list['Maven Pro'] = array('family' => 'sans-serif'); $list['Merriweather'] = array('family' => 'serif'); $list['Montserrat'] = array('family' => 'sans-serif'); $list['Neuton'] = array('family' => 'serif'); $list['Noticia Text'] = array('family' => 'serif'); $list['Old Standard TT'] = array('family' => 'serif'); $list['Open Sans'] = array('family' => 'sans-serif'); $list['Orbitron'] = array('family' => 'sans-serif'); $list['Oswald'] = array('family' => 'sans-serif'); $list['Overlock'] = array('family' => 'cursive'); $list['Oxygen'] = array('family' => 'sans-serif'); $list['PT Serif'] = array('family' => 'serif'); $list['Puritan'] = array('family' => 'sans-serif'); $list['Raleway'] = array('family' => 'sans-serif'); $list['Roboto'] = array('family' => 'sans-serif'); $list['Roboto Slab'] = array('family' => 'sans-serif'); $list['Roboto Condensed'] = array('family' => 'sans-serif'); $list['Rosario'] = array('family' => 'sans-serif'); $list['Share'] = array('family' => 'cursive'); $list['Signika'] = array('family' => 'sans-serif'); $list['Signika Negative'] = array('family' => 'sans-serif'); $list['Source Sans Pro'] = array('family' => 'sans-serif'); $list['Tinos'] = array('family' => 'serif'); $list['Ubuntu'] = array('family' => 'sans-serif'); $list['Vollkorn'] = array('family' => 'serif'); return apply_filters('theme_skin_list_fonts', $list); }
$THEMEREX_options[] = array("title" => __('Select top sidebar', 'themerex'), "desc" => __('Select top sidebar for the blog page', 'themerex'), "id" => "sidebar_top", "override" => "category,post,page", "divider" => false, "std" => "sidebar-top", "options" => $sidebars, "type" => "select"); $THEMEREX_options[] = array("title" => __('Show main sidebar', 'themerex'), "desc" => __('Select main sidebar position on blog page', 'themerex'), "id" => 'show_sidebar_main', "override" => "category,post,page", "std" => "right", "options" => $positions, "type" => "radio"); $THEMEREX_options[] = array("title" => __('Select main sidebar', 'themerex'), "desc" => __('Select main sidebar for the blog page', 'themerex'), "id" => "sidebar_main", "override" => "category,post,page", "divider" => false, "std" => "sidebar-main", "options" => $sidebars, "type" => "select"); $THEMEREX_options[] = array("title" => __('Show footer sidebar', 'themerex'), "desc" => __('Show footer sidebar', 'themerex'), "id" => "show_sidebar_footer", "override" => "category,post,page", "std" => "yes", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __('Footer sidebar style', 'themerex'), "desc" => __('Select color style for the footer sidebar', 'themerex'), "id" => "sidebar_footer_style", "override" => "category,post,page", "divider" => false, "std" => "light", "size" => "medium", "options" => array('light' => __('Light', 'themerex'), 'dark' => __('Dark', 'themerex')), "type" => "switch"); $THEMEREX_options[] = array("title" => __('Select footer sidebar', 'themerex'), "desc" => __('Select footer sidebar for the blog page', 'themerex'), "id" => "sidebar_footer", "override" => "category,post,page", "divider" => false, "std" => "sidebar-footer", "options" => $sidebars, "type" => "select"); $THEMEREX_options[] = array("title" => __('Show sidebar in the right panel', 'themerex'), "desc" => __('Show sidebar in the right panel (in tab)', 'themerex'), "id" => 'show_sidebar_panel', "override" => "category,post,page", "std" => "yes", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __('Select panel sidebar', 'themerex'), "desc" => __('Select panel sidebar for the blog page', 'themerex'), "id" => "sidebar_panel", "override" => "category,post,page", "divider" => false, "std" => "sidebar-panel", "options" => $sidebars, "type" => "select"); $THEMEREX_options[] = array("title" => __('Slider', 'themerex'), "id" => "customization_slider", "icon" => "iconadmin-picture", "override" => "category,page", "type" => "tab"); $THEMEREX_options[] = array("title" => __('Main slider parameters', 'themerex'), "desc" => __('Select parameters for main slider (you can override it in each category and page)', 'themerex'), "override" => "category,page", "type" => "info"); $THEMEREX_options[] = array("title" => __('Show Slider', 'themerex'), "desc" => __('Do you want to show slider on each page (post)', 'themerex'), "id" => "slider_show", "divider" => false, "override" => "category,page", "std" => "no", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __('Slider display', 'themerex'), "desc" => __('How display slider: fixed height or fullscreen height', 'themerex'), "id" => "slider_display", "override" => "category,page", "std" => "none", "options" => array("fixed" => __("Fixed height", 'themerex'), "fullscreen" => __("Fullscreen", 'themerex')), "size" => "big", "type" => "switch"); $THEMEREX_options[] = array("title" => __("Height (in pixels)", 'themerex'), "desc" => __("Slider height (in pixels) - only if slider display with fixed height.", 'themerex'), "id" => "slider_height", "override" => "category,page", "std" => 500, "min" => 100, "increment" => 10, "type" => "spinner"); $THEMEREX_options[] = array("title" => __('Slider engine', 'themerex'), "desc" => __('What engine use to show slider?', 'themerex'), "id" => "slider_engine", "override" => "category,page", "std" => "flex", "options" => $sliders, "type" => "radio"); $THEMEREX_options[] = array("title" => __('Layer Slider: Alias (for Revolution) or ID (for Royal)', 'themerex'), "desc" => __("Revolution Slider alias or Royal Slider ID (see in slider settings on plugin page)", 'themerex'), "id" => "slider_alias", "override" => "category,page", "std" => "", "type" => "text"); $THEMEREX_options[] = array("title" => __('Posts Slider: Category to show', 'themerex'), "desc" => __('Select category to show in Flexslider (ignored for Revolution and Royal sliders)', 'themerex'), "id" => "slider_category", "override" => "category,page", "std" => "", "options" => themerex_array_merge(array(0 => __('- Any category -', 'themerex')), $categories), "type" => "select", "multiple" => true, "style" => "list"); $THEMEREX_options[] = array("title" => __('Posts Slider: Number posts or comma separated posts list', 'themerex'), "desc" => __("How many recent posts display in slider or comma separated list of posts ID (in this case selected category ignored)", 'themerex'), "override" => "category,page", "id" => "slider_posts", "std" => "5", "type" => "text"); $THEMEREX_options[] = array("title" => __("Posts Slider: Posts order by", 'themerex'), "desc" => __("Posts in slider ordered by date (default), comments, views, author rating, users rating, random or alphabetically", 'themerex'), "override" => "category,page", "id" => "slider_orderby", "std" => "date", "options" => $sorting, "type" => "select"); $THEMEREX_options[] = array("title" => __("Posts Slider: Posts order", 'themerex'), "desc" => __('Select the desired ordering method for posts', 'themerex'), "id" => "slider_order", "override" => "category,page", "std" => "desc", "options" => $ordering, "size" => "big", "type" => "switch"); $THEMEREX_options[] = array("title" => __("Posts Slider: Slide change interval", 'themerex'), "desc" => __("Interval (in ms) for slides change in flex-slider", 'themerex'), "id" => "slider_interval", "override" => "category,page", "std" => 7000, "min" => 100, "increment" => 100, "type" => "spinner"); $THEMEREX_options[] = array("title" => __("Posts Slider: Pagination", 'themerex'), "desc" => __("Choose pagination style for the slider", 'themerex'), "id" => "slider_pagination", "override" => "category,page", "std" => "no", "options" => array('no' => __('None', 'themerex'), 'yes' => __('Dots', 'themerex'), 'over' => __('Titles', 'themerex')), "type" => "checklist"); $THEMEREX_options[] = array("title" => __("Posts Slider: Show infobox", 'themerex'), "desc" => __("Do you want to show post's title, reviews rating and description on slides in flex-slider", 'themerex'), "id" => "slider_info_box", "override" => "category,page", "std" => "yes", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __("Posts Slider: Infobox fixed", 'themerex'), "desc" => __("Do you want to fix infobox on slides in flex-slider or hide it in hover", 'themerex'), "id" => "slider_info_fixed", "override" => "category,page", "std" => "no", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __("Posts Slider: Show post's category", 'themerex'), "desc" => __("Do you want to show post's category on slides in flex-slider", 'themerex'), "id" => "slider_info_category", "override" => "category,page", "std" => "yes", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __("Posts Slider: Show post's reviews rating", 'themerex'), "desc" => __("Do you want to show post's reviews rating on slides in flex-slider", 'themerex'), "id" => "slider_reviews", "override" => "category,page", "std" => "yes", "options" => $yes_no, "type" => "switch"); $THEMEREX_options[] = array("title" => __("Posts Slider: Show post's descriptions", 'themerex'), "desc" => __("Do you want to show post's description on slides in flex-slider", 'themerex'), "id" => "slider_descriptions", "override" => "category,page", "std" => 0, "min" => 0, "increment" => 10, "type" => "spinner"); $THEMEREX_options[] = array("title" => __("Header & Footer", 'themerex'), "id" => 'customization_header_footer', "override" => "category,post,page", "icon" => 'iconadmin-window', "type" => "tab"); $THEMEREX_options[] = array("title" => __("Header settings", 'themerex'), "desc" => __("Select components of the page header, set style and put the content for the user's header area", 'themerex'), "override" => "category,page,post", "type" => "info"); $THEMEREX_options[] = array("title" => __("Show user's header", 'themerex'), "desc" => __("Select display options for the user's header area. 'Grey' and 'Global' - theme styled variants, 'Custom' - you must put all style properties in the inserted html-code and shortcodes", 'themerex'), "id" => "show_user_header", "divider" => false, "override" => "category,page,post", "std" => "none", "options" => $headers, "type" => "radio"); $THEMEREX_options[] = array("title" => __("User's header content", 'themerex'), "desc" => __('Put header html-code and/or shortcodes here. You can use any html-tags and shortcodes', 'themerex'), "id" => "user_header_content", "override" => "category,page,post", "std" => "", "rows" => "10", "type" => "editor"); $THEMEREX_options[] = array("title" => __('Show Top of page section', 'themerex'), "desc" => __('Show top section with post/page/category title and breadcrumbs', 'themerex'), "id" => "show_top_page", "override" => "category,post,page", "std" => "yes", "options" => $yes_no, "type" => "switch");
function getPortfolioThumbSizes($opt) { $opt = themerex_array_merge(array('thumb_crop' => true, 'thumb_size' => 'excerpt'), $opt); $thumb_sizes = array('image-square-1' => array('w' => 420, 'h' => $opt['thumb_crop'] ? 420 : null, 'h_crop' => 420), 'image-square-2' => array('w' => 840, 'h' => $opt['thumb_crop'] ? 840 : null, 'h_crop' => 840), 'image-rectangle' => array('w' => 840, 'h' => $opt['thumb_crop'] ? 420 : null, 'h_crop' => 420)); return isset($thumb_sizes[$opt['thumb_size']]) ? $thumb_sizes[$opt['thumb_size']] : ''; }
function theme_options_show_field($field, $value = null, &$flags) { if ($value !== null) { $field['val'] = $value; } if (!isset($field['val']) || $field['val'] == '') { $field['val'] = 'default'; } if ($flags['inherit'] && isset($field['options']) && is_array($field['options'])) { $field['options'] = themerex_array_merge(array('default' => 'Inherit'), $field['options']); } if (isset($flags['radio_as_select']) && $flags['radio_as_select'] && $field['type'] == 'radio') { $field['type'] = 'select'; } if (isset($flags['clear_shortname']) && $flags['clear_shortname'] && isset($field['id'])) { $field['id'] = get_option_name($field['id']); } $menu = ''; $output = ''; $name_hook = str_replace(" ", "-", preg_replace("[^A-Za-z0-9]", "", themerex_strtolower($field['name']))); if (isset($flags['heading_as_tabs']) && $flags['heading_as_tabs'] && $field['type'] == 'heading') { $field['type'] = 'group'; $field['tab'] = $name_hook; $field['tabs'] = array($name_hook => $field['name']); } if (in_array($field['type'], array('group', 'groupend', 'heading')) && $flags['group_opened']) { $output .= '</div>'; if (!$flags['tabs_opened']) { $output .= '</div>'; } else { if (in_array($field['type'], array('groupend', 'heading'))) { $output .= '</div>'; $flags['tabs_opened'] = false; } } $flags['group_opened'] = false; } if ($field['type'] == 'group') { $flags['group_opened'] = true; if (isset($field['tabs'])) { if (!isset($flags['heading_as_tabs']) || !$flags['heading_as_tabs']) { $output .= '<div class="opt_tabs"' . (isset($field['std']) ? ' id="' . $field['std'] . '"' : '') . '><ul>'; } foreach ($field['tabs'] as $id => $title) { if (!isset($flags['heading_as_tabs']) || !$flags['heading_as_tabs']) { $output .= '<li id="tab_' . $id . '"><a href="#content_' . $id . '">' . $title . '</a></li>'; } else { $menu .= '<li id="tab_' . $id . '"><a href="#content_' . $id . '">' . $title . '</a></li>'; } } if (!isset($flags['heading_as_tabs']) || !$flags['heading_as_tabs']) { $output .= '</ul>'; } $flags['tabs_opened'] = true; } if (isset($field['tab'])) { $output .= '<div class="opt_group opt_content" id="content_' . $field['tab'] . '">'; } else { $output .= '<div class="opt_group' . (isset($field['tabs']) ? ' opt_tabs' : '') . '"' . (isset($field['std']) ? ' id="' . $field['std'] . '"' : '') . '>'; $output .= '<h3 class="toggle">' . $field['name'] . '</h3><div class="opt_content' . (isset($field['closed']) && $field['closed'] ? ' closed' : '') . '">'; } } if (!in_array($field['type'], array("heading", "hidden", "group", "groupend"))) { $class = ''; if (isset($field['class'])) { $class = $field['class']; } $output .= '<div class="section section-' . str_replace(array('list', 'range'), array('select', 'select'), $field['type']) . ' ' . $class . '">' . "\n"; $output .= '<h3 class="heading">' . $field['name'] . '</h3>' . "\n"; $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n"; } if (isset($field['enable'])) { $tmp = explode('|', $field['val']); $field['val'] = $tmp[0]; if (isset($tmp[1])) { $field['enable'] = $tmp[1]; } } switch ($field['type']) { case 'hidden': $output .= '<input class="of-input" name="' . $field['id'] . '" id="' . $field['id'] . '" type="' . $field['type'] . '" value="' . htmlspecialchars($field['val'] == 'default' ? '' : $field['val']) . '" />'; break; case 'text': $inc = isset($field['increment']) && $field['increment']; if ($inc) { $arr = explode(',', $field['val']); $output .= '<div class="of-increment-area">'; } else { $arr = array($field['val']); } for ($i = 0; $i < count($arr); $i++) { $sb = explode('|', $arr[$i]); if (count($sb) == 1) { $sb[1] = $i + 1; } $output .= ($inc ? '<div class="of-increment-item"><input type="hidden" name="' . $field['id'] . '_numbers[]" value="' . $sb[1] . '" />' : '') . '<input class="of-input' . ($inc ? ' of-incremented' : '') . '" name="' . $field['id'] . ($inc ? '[]' : '') . '" id="' . $field['id'] . '" type="' . $field['type'] . '" value="' . htmlspecialchars($sb[0] == 'default' ? '' : $sb[0]) . '" />' . ($inc ? '<a href="#" class="of-increment-button of-increment-del">-</a></div>' : ''); } if ($inc) { $output .= '</div><a href="#" class="of-increment-button of-increment-add">' . __('+ Add item', 'themerex') . '</a>'; } break; case 'textarea': $cols = isset($field['cols']) && $field['cols'] > 10 ? $field['cols'] : '40'; $rows = isset($field['rows']) && $field['rows'] > 1 ? $field['rows'] : '8'; $output .= '<textarea class="of-input" name="' . $field['id'] . '" id="' . $field['id'] . '" cols="' . $cols . '" rows="' . $rows . '">' . htmlspecialchars($field['val'] == 'default' ? '' : $field['val']) . '</textarea>'; break; case 'select': $multiple = isset($field['multiple']) && $field['multiple']; $output .= '<select class="of-input" name="' . $field['id'] . ($multiple ? '[]' : '') . '" id="' . $field['id'] . '"' . (isset($field['size']) ? ' size="' . $field['size'] . '"' : '') . ($multiple ? ' multiple="multiple"' : '') . '>'; foreach ($field['options'] as $k => $option) { if (is_array($option)) { $title = isset($option['name']) ? $option['name'] : (isset($option['title']) ? $option['title'] : $k); } else { $title = $option; } $output .= '<option' . ($multiple ? in_array($k, explode(',', $field['val'])) : $field['val'] == $k ? ' selected="selected"' : '') . ' value="' . $k . '">' . htmlspecialchars($title) . '</option>'; } $output .= '</select>'; break; case 'checklist': $multiple = isset($field['multiple']) && $field['multiple']; $i = 0; $id = $field['id']; $output .= '<ul class="checklist">'; foreach ($field['options'] as $k => $val) { $i++; $output .= '<li>'; $output .= '<input type="' . ($multiple ? 'checkbox' : 'radio') . '" value="' . $k . '" name="' . $id . ($multiple ? '[]' : '') . '" id="' . $id . $i . '"' . (in_array($k, explode(',', $field['val'])) ? ' checked="checked"' : '') . '><label for="' . $id . $i . '">' . $val . '</label>'; $output .= '</li>'; } $output .= '</ul>'; break; case 'list': $output .= '<select class="of-input" name="' . $field['id'] . '" id="' . $field['id'] . '">'; foreach ($field['options'] as $option) { $output .= '<option' . ($field['val'] == $option ? ' selected="selected"' : '') . ' value="' . $option . '">' . htmlspecialchars($option) . '</option>'; } $output .= '</select>'; break; case 'range': $output .= '<select class="of-input" name="' . $field['id'] . '" id="' . $field['id'] . '">'; $output .= '<option value="default">Inherit</option>'; for ($i = $field['from']; $i <= $field['to']; $i++) { $output .= '<option value="' . $i . '" ' . ($field['val'] == $i ? ' selected="selected"' : '') . '>' . $i . '</option>'; } $output .= '</select>'; break; case 'fontsize': $output .= '<select class="of-typography of-typography-size" name="' . $field['id'] . '" id="' . $field['id'] . '_size">'; for ($i = 9; $i < 71; $i++) { $output .= '<option value="' . $i . '" ' . ($field['val'] == $i ? ' selected="selected"' : '') . '>' . $i . 'px</option>'; } $output .= '</select>'; break; case "radio": foreach ($field['options'] as $key => $option) { $output .= '<input class="of-input of-radio" type="radio" name="' . $field['id'] . '" value="' . $key . '" ' . ($field['val'] == $key ? ' checked="checked"' : '') . ' id="' . $field['id'] . '_' . $key . '" /><label for="' . $field['id'] . '_' . $key . '">' . $option . '</label>' . (isset($field['style']) && $field['style'] == 'vertical' ? '<br />' : ''); } break; case "checkbox": $output .= '<input type="checkbox" class="checkbox of-input" name="' . $field['id'] . '" id="' . $field['id'] . '" value="true" ' . ($field['val'] == 'true' ? ' checked="checked"' : '') . ' /><label for="' . $field['id'] . '">' . $field['name'] . '</label>'; break; case "upload": case "upload_min": case "mediamanager": $upload = $field['val'] == 'default' ? '' : $field['val']; if (!empty($upload)) { $hide = ''; } else { $hide = 'hide'; } $output .= '<input class="of-input" name="' . $field['id'] . '" id="' . $field['id'] . '_upload" value="' . $upload . '" type="' . ($field['type'] == 'upload_min' ? 'hidden' : 'text') . '" />' . '<div class="upload_button_div">' . '<span class="button image_' . ($field['type'] == 'mediamanager' ? 'media' : 'upload') . '_button" id="' . $field['id'] . '"' . ($field['type'] == 'mediamanager' ? ' data-choose="' . (isset($field['multiple']) && $field['multiple'] ? __('Choose Images', 'themerex') : __('Choose Image', 'themerex')) . '"' . ' data-update="' . (isset($field['multiple']) && $field['multiple'] ? __('Add to Gallery', 'themerex') : __('Choose Image', 'themerex')) . '"' . ' data-multiple="' . (isset($field['multiple']) && $field['multiple'] ? 'true' : 'false') . '"' . ' data-linked-field="' . $field['id'] . '_upload"' : '') . '>' . __('Upload Image', 'themerex') . '</span>' . '<span class="button image_reset_button ' . $hide . '" id="reset_' . $field['id'] . '"' . (empty($upload) ? ' style="display:none;"' : '') . '>' . __('Remove', 'themerex') . '</span>' . '</div>' . "\n"; // . '<div class="clear"></div>' . "\n"; if (!empty($upload)) { $output .= '<a class="of-uploaded-image" target="_blank" href="' . $upload . '">'; $ext = pathinfo($upload, PATHINFO_EXTENSION); if (in_array(themerex_strtolower($ext), array('jpg', 'png', 'gif'))) { $output .= '<img class="of-option-image" id="image_' . $field['id'] . '" src="' . $upload . '" alt="" />'; } else { $fname = pathinfo($upload, PATHINFO_BASENAME); $output .= '<span id="image_' . $field['id'] . '">' . $fname . '</span>'; } $output .= '</a>'; $output .= '<div class="clear"></div>' . "\n"; } break; case "color": $output .= '<input class="of-color colorSelector" name="' . $field['id'] . '" id="' . $field['id'] . '" type="text" value="' . ($field['val'] == 'default' ? '' : $field['val']) . '" />'; break; case "images": $output .= '<input type="hidden" value="' . $field['val'] . '" name="' . $field['id'] . '" />'; $i = 0; foreach ($field['options'] as $key => $option) { $i++; $selected = ''; if ($field['val'] == $key || $i == 1 && $field['val'] == '') { $selected = 'of-radio-img-selected'; } $output .= '<span>'; if ($key == 'default') { $option = get_template_directory_uri() . '/images/spacer.png'; } $output .= '<img src="' . $option . '" data-icon="' . $key . '" alt="" class="of-radio-img-img ' . $selected . '" />'; $output .= '</span>'; } break; case "icons": $i = 0; if (isset($field['css']) && $field['css'] != '' && file_exists($field['css'])) { $field['options'] = parseIconsClasses($field['css']); } $output .= '</div>'; $output .= '<input type="hidden" value="' . $field['val'] . '" name="' . $field['id'] . '" />'; foreach ($field['options'] as $option) { $i++; $selected = ''; if ($field['val'] == $option || $i == 1 && $field['val'] == '') { $selected = 'of-radio-icon-selected'; } $output .= '<span>'; $output .= '<span class="of-radio-icon-icon ' . $option . ' ' . $selected . '" data-icon="' . $option . '"></span>'; $output .= '</span>'; } $output .= '<div>'; break; case 'socials': $arr = explode(',', $field['val']); $output .= '<div class="of-increment-area of-socials-area">'; for ($i = 0; $i < count($arr); $i++) { $sb = explode('|', $arr[$i]); if (count($sb) == 1) { $sb[1] = $i + 1; } if (count($sb) == 2) { $sb[2] = ''; } $j = 0; $icons = ''; $button = ''; foreach ($field['options'] as $k => $option) { $j++; $selected = ''; if ($sb[2] == $k || $j == 1 && $sb[2] == '') { $selected = 'of-radio-img-selected'; $button = $option; } $icons .= '<span>'; //$output .= '<span class="of-radio-icon-icon '. $option . ' ' . $selected .'" onClick="document.getElementById(\'of-radio-icon-'. $field['id'] . $j.'\').checked = true;"></span>'; $icons .= '<img src="' . $option . '" data-icon="' . $k . '" alt="" class="of-radio-img-img ' . $selected . '" />'; $icons .= '</span>'; } $output .= '<div class="of-increment-item"><input type="hidden" name="' . $field['id'] . '_numbers[]" value="' . $sb[1] . '" />' . '<input class="of-input of-incremented" name="' . $field['id'] . '[]" id="' . $field['id'] . '" type="text" value="' . htmlspecialchars($sb[0] == 'default' ? '' : $sb[0]) . '" />' . '<a href="#" class="of-socials-button"><img src="' . $button . '" alt="" /></a>' . '<a href="#" class="of-increment-button of-increment-del">-</a>' . '<div class="of-socials-icons">' . '<input type="hidden" value="' . $sb[2] . '" name="' . $field['id'] . '_icons[]" />' . $icons . '</div></div>'; } $output .= '</div><a href="#" class="of-increment-button of-increment-add">' . __('+ Add item', 'themerex') . '</a>'; break; case "info": $default = $field['std']; $output .= '<div class="info">' . $default . '</div>'; break; case "heading": if ($flags['heading_opened']) { $output .= '</div>' . "\n"; } $jquery_click_hook = "of-option-" . $name_hook; $menu .= '<li><a title="' . $field['name'] . '" href="#' . $jquery_click_hook . '">' . $field['name'] . '</a></li>'; $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $field['name'] . '</h2>' . "\n"; $flags['heading_opened'] = true; break; default: if (function_exists('show_custom_field')) { $output .= show_custom_field($field, $field['val']); } } if (!in_array($field['type'], array("heading", "hidden", "group", "groupend"))) { //$output .= $field['type']!='checklist' ? '<br/>' : ''; if (!isset($field['desc'])) { $descr = ''; } else { $descr = $field['desc']; } if (isset($field['enable'])) { $output .= '<input type="checkbox" class="checkbox of-enable of-input" name="' . $field['id'] . '_enable" id="' . $field['id'] . '_enable" value="1" ' . ($field['enable'] == '1' ? ' checked="checked"' : '') . ' />'; } $output .= '</div><div class="explain">' . $descr . '</div>' . "\n"; $output .= '<div class="clear"> </div></div></div>' . "\n"; } return array($output, $menu); }