Example #1
0
 function axiom_options_show_field($id, $field, $value = null)
 {
     global $AXIOM_GLOBALS;
     // Set start field value
     if ($value !== null) {
         $field['val'] = $value;
     }
     if (!isset($field['val']) || $field['val'] == '') {
         $field['val'] = 'inherit';
     }
     if (!empty($field['subset'])) {
         $sbs = axiom_get_theme_option($field['subset'], '', $AXIOM_GLOBALS['to_data']);
         $field['val'] = isset($field['val'][$sbs]) ? $field['val'][$sbs] : '';
     }
     if (empty($id)) {
         $id = 'axiom_options_id_' . str_replace('.', '', mt_rand());
     }
     if (!isset($field['title'])) {
         $field['title'] = '';
     }
     // Divider before field
     $divider = !isset($field['divider']) && !in_array($field['type'], array('info', 'partition', 'tab', 'toggle')) || isset($field['divider']) && $field['divider'] ? ' axiom_options_divider' : '';
     // Setup default parameters
     if ($field['type'] == 'media') {
         if (!isset($field['before'])) {
             $field['before'] = array('title' => __('Choose image', 'axiom'), 'action' => 'media_upload', 'type' => 'image', 'multiple' => false, 'linked_field' => '', 'captions' => array('choose' => __('Choose image', 'axiom'), 'update' => __('Select image', 'axiom')));
         }
         if (!isset($field['after'])) {
             $field['after'] = array('icon' => 'iconadmin-cancel', 'action' => 'media_reset');
         }
     }
     // Buttons before and after field
     $before = $after = $buttons_classes = '';
     if (!empty($field['before'])) {
         list($before, $class) = axiom_options_action_button($field['before'], 'before');
         $buttons_classes .= $class;
     }
     if (!empty($field['after'])) {
         list($after, $class) = axiom_options_action_button($field['after'], 'after');
         $buttons_classes .= $class;
     }
     if (in_array($field['type'], array('list', 'select', 'fonts')) || $field['type'] == 'socials' && (empty($field['style']) || $field['style'] == 'icons')) {
         $buttons_classes .= ' axiom_options_button_after_small';
     }
     // Is it inherit field?
     $inherit = axiom_is_inherit_option($field['val']) ? 'inherit' : '';
     // Is it cloneable field?
     $cloneable = isset($field['cloneable']) && $field['cloneable'];
     // Prepare field
     if (!$cloneable) {
         $field['val'] = array($field['val']);
     } else {
         if (!is_array($field['val'])) {
             $field['val'] = array($field['val']);
         } else {
             if ($field['type'] == 'socials' && (!isset($field['val'][0]) || !is_array($field['val'][0]))) {
                 $field['val'] = array($field['val']);
             }
         }
     }
     // Field container
     if (axiom_options_is_group($field['type'])) {
         // Close nested containers
         if (empty($field['start']) && (!in_array($field['type'], array('group', 'toggle')) || !empty($field['end']))) {
             echo trim(axiom_options_close_nested_groups($field['type'], !empty($field['end'])));
             if (!empty($field['end'])) {
                 return;
             }
         }
     } else {
         // Start field layout
         if ($field['type'] != 'hidden') {
             echo '<div class="axiom_options_field' . ' axiom_options_field_' . (in_array($field['type'], array('list', 'fonts')) ? 'select' : $field['type']) . (in_array($field['type'], array('media', 'fonts', 'list', 'select', 'socials', 'date', 'time')) ? ' axiom_options_field_text' : '') . ($field['type'] == 'socials' && !empty($field['style']) && $field['style'] == 'images' ? ' axiom_options_field_images' : '') . ($field['type'] == 'socials' && (empty($field['style']) || $field['style'] == 'icons') ? ' axiom_options_field_icons' : '') . (isset($field['dir']) && $field['dir'] == 'vertical' ? ' axiom_options_vertical' : '') . (!empty($field['multiple']) ? ' axiom_options_multiple' : '') . (isset($field['size']) ? ' axiom_options_size_' . esc_attr($field['size']) : '') . (isset($field['class']) ? ' ' . esc_attr($field['class']) : '') . (!empty($field['columns']) ? ' axiom_options_columns axiom_options_columns_' . esc_attr($field['columns']) : '') . $divider . '">' . "\n";
             echo '<label class="axiom_options_field_label' . (!empty($AXIOM_GLOBALS['to_flags']['add_inherit']) && isset($field['std']) ? ' axiom_options_field_label_inherit' : '') . '" for="' . esc_attr($id) . '">' . $field['title'] . (!empty($AXIOM_GLOBALS['to_flags']['add_inherit']) && isset($field['std']) ? '<span id="' . esc_attr($id) . '_inherit" class="axiom_options_button_inherit' . ($inherit ? '' : ' axiom_options_inherit_off') . '" title="' . __('Unlock this field', 'axiom') . '"></span>' : '') . '</label>' . "\n";
             echo '<div class="axiom_options_field_content' . $buttons_classes . ($cloneable ? ' axiom_options_cloneable_area' : '') . '">' . "\n";
         }
     }
     // Parse field type
     foreach ($field['val'] as $clone_num => $clone_val) {
         if ($cloneable) {
             echo '<div class="axiom_options_cloneable_item">' . '<span class="axiom_options_input_button axiom_options_clone_button axiom_options_clone_button_del">-</span>';
         }
         switch ($field['type']) {
             case 'group':
                 echo '<fieldset id="' . esc_attr($id) . '" class="axiom_options_container axiom_options_group axiom_options_content' . esc_attr($divider) . '">';
                 if (!empty($field['title'])) {
                     echo '<legend>' . (!empty($field['icon']) ? '<span class="' . esc_attr($field['icon']) . '"></span>' : '') . esc_html($field['title']) . '</legend>' . "\n";
                 }
                 array_push($AXIOM_GLOBALS['to_flags']['nesting'], 'group');
                 break;
             case 'toggle':
                 array_push($AXIOM_GLOBALS['to_flags']['nesting'], 'toggle');
                 echo '<div id="' . esc_attr($id) . '" class="axiom_options_container axiom_options_toggle' . esc_attr($divider) . '">';
                 echo '<h3 id="' . esc_attr($id) . '_title"' . ' class="axiom_options_toggle_header' . (empty($field['closed']) ? ' ui-state-active' : '') . '"' . (!empty($field['action']) ? ' onclick="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . '>' . (!empty($field['icon']) ? '<span class="axiom_options_toggle_header_icon ' . esc_attr($field['icon']) . '"></span>' : '') . $field['title'] . '<span class="axiom_options_toggle_header_marker iconadmin-left-open"></span>' . '</h3>' . '<div class="axiom_options_content axiom_options_toggle_content"' . (!empty($field['closed']) ? ' style="display:none;"' : '') . '>';
                 break;
             case 'accordion':
                 array_push($AXIOM_GLOBALS['to_flags']['nesting'], 'accordion');
                 if (!empty($field['start'])) {
                     echo '<div id="' . esc_attr($field['start']) . '" class="axiom_options_container axiom_options_accordion' . esc_attr($divider) . '">';
                 }
                 echo '<div id="' . esc_attr($id) . '" class="axiom_options_accordion_item">' . '<h3 id="' . esc_attr($id) . '_title"' . ' class="axiom_options_accordion_header"' . (!empty($field['action']) ? ' onclick="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . '>' . (!empty($field['icon']) ? '<span class="axiom_options_accordion_header_icon ' . esc_attr($field['icon']) . '"></span>' : '') . $field['title'] . '<span class="axiom_options_accordion_header_marker iconadmin-left-open"></span>' . '</h3>' . '<div id="' . esc_attr($id) . '_content" class="axiom_options_content axiom_options_accordion_content">';
                 break;
             case 'tab':
                 array_push($AXIOM_GLOBALS['to_flags']['nesting'], 'tab');
                 if (!empty($field['start'])) {
                     echo '<div id="' . esc_attr($field['start']) . '" class="axiom_options_container axiom_options_tab' . esc_attr($divider) . '">' . '<ul>' . trim(axiom_options_collect_tabs($field['type'], $field['start'])) . '</ul>';
                 }
                 echo '<div id="' . esc_attr($id) . '_content"  class="axiom_options_content axiom_options_tab_content">';
                 break;
             case 'partition':
                 array_push($AXIOM_GLOBALS['to_flags']['nesting'], 'partition');
                 if (!empty($field['start'])) {
                     echo '<div id="' . esc_attr($field['start']) . '" class="axiom_options_container axiom_options_partition' . esc_attr($divider) . '">' . '<ul>' . trim(axiom_options_collect_tabs($field['type'], $field['start'])) . '</ul>';
                 }
                 echo '<div id="' . esc_attr($id) . '_content" class="axiom_options_content axiom_options_partition_content">';
                 break;
             case 'hidden':
                 echo '<input class="axiom_options_input axiom_options_input_hidden" name="' . esc_attr($id) . '" id="' . esc_attr($id) . '" type="hidden" value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '" />';
                 break;
             case 'date':
                 if (isset($field['style']) && $field['style'] == 'inline') {
                     echo '<div class="axiom_options_input_date" id="' . esc_attr($id) . '_calendar"' . ' data-format="' . (!empty($field['format']) ? $field['format'] : 'yy-mm-dd') . '"' . ' data-months="' . (!empty($field['months']) ? max(1, min(3, $field['months'])) : 1) . '"' . ' data-linked-field="' . (!empty($data['linked_field']) ? $data['linked_field'] : $id) . '"' . '></div>' . '<input id="' . esc_attr($id) . '"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['mask']) ? ' data-mask="' . esc_attr($field['mask']) . '"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 } else {
                     echo '<input class="axiom_options_input axiom_options_input_date' . (!empty($field['mask']) ? ' axiom_options_input_masked' : '') . '"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . ' data-format="' . (!empty($field['format']) ? $field['format'] : 'yy-mm-dd') . '"' . ' data-months="' . (!empty($field['months']) ? max(1, min(3, $field['months'])) : 1) . '"' . (!empty($field['mask']) ? ' data-mask="' . esc_attr($field['mask']) . '"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . $before . $after;
                 }
                 break;
             case 'text':
                 echo '<input class="axiom_options_input axiom_options_input_text' . (!empty($field['mask']) ? ' axiom_options_input_masked' : '') . '"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['mask']) ? ' data-mask="' . esc_attr($field['mask']) . '"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . $before . $after;
                 break;
             case 'textarea':
                 $cols = isset($field['cols']) && $field['cols'] > 10 ? $field['cols'] : '40';
                 $rows = isset($field['rows']) && $field['rows'] > 1 ? $field['rows'] : '8';
                 echo '<textarea class="axiom_options_input axiom_options_input_textarea"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' cols="' . esc_attr($cols) . '"' . ' rows="' . esc_attr($rows) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . '>' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '</textarea>';
                 break;
             case 'editor':
                 $cols = isset($field['cols']) && $field['cols'] > 10 ? $field['cols'] : '40';
                 $rows = isset($field['rows']) && $field['rows'] > 1 ? $field['rows'] : '10';
                 wp_editor(axiom_is_inherit_option($clone_val) ? '' : $clone_val, $id . ($cloneable ? '[]' : ''), array('wpautop' => false, 'textarea_rows' => $rows));
                 break;
             case 'spinner':
                 echo '<input class="axiom_options_input axiom_options_input_spinner' . (!empty($field['mask']) ? ' axiom_options_input_masked' : '') . '" name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['mask']) ? ' data-mask="' . esc_attr($field['mask']) . '"' : '') . (isset($field['min']) ? ' data-min="' . esc_attr($field['min']) . '"' : '') . (isset($field['max']) ? ' data-max="' . esc_attr($field['max']) . '"' : '') . (!empty($field['step']) ? ' data-step="' . esc_attr($field['step']) . '"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . '<span class="axiom_options_arrows"><span class="axiom_options_arrow_up iconadmin-up-dir"></span><span class="axiom_options_arrow_down iconadmin-down-dir"></span></span>';
                 break;
             case 'tags':
                 if (!axiom_is_inherit_option($clone_val)) {
                     $tags = explode($AXIOM_GLOBALS['to_delimiter'], $clone_val);
                     if (count($tags) > 0) {
                         foreach ($tags as $tag) {
                             if (empty($tag)) {
                                 continue;
                             }
                             echo '<span class="axiom_options_tag iconadmin-cancel">' . $tag . '</span>';
                         }
                     }
                 }
                 echo '<input class="axiom_options_input_tags"' . ' type="text"' . ' value=""' . ' />' . '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 break;
             case "checkbox":
                 echo '<input type="checkbox" class="axiom_options_input axiom_options_input_checkbox"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' value="true"' . ($clone_val == 'true' ? ' checked="checked"' : '') . (!empty($field['disabled']) ? ' readonly="readonly"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . '<label for="' . esc_attr($id) . '" class="' . (!empty($field['disabled']) ? 'axiom_options_state_disabled' : '') . ($clone_val == 'true' ? ' axiom_options_state_checked' : '') . '"><span class="axiom_options_input_checkbox_image iconadmin-check"></span>' . (!empty($field['label']) ? $field['label'] : $field['title']) . '</label>';
                 break;
             case "radio":
                 foreach ($field['options'] as $key => $title) {
                     echo '<span class="axiom_options_radioitem">' . '<input class="axiom_options_input axiom_options_input_radio" type="radio"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' value="' . esc_attr($key) . '"' . ($clone_val == $key ? ' checked="checked"' : '') . ' id="' . esc_attr($id . '_' . $key) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . '<label for="' . esc_attr($id . '_' . $key) . '"' . ($clone_val == $key ? ' class="axiom_options_state_checked"' : '') . '><span class="axiom_options_input_radio_image iconadmin-circle-empty' . ($clone_val == $key ? ' iconadmin-dot-circled' : '') . '"></span>' . $title . '</label></span>';
                 }
                 break;
             case "switch":
                 $opt = array();
                 foreach ($field['options'] as $key => $title) {
                     $opt[] = array('key' => $key, 'title' => $title);
                     if (count($opt) == 2) {
                         break;
                     }
                 }
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) || empty($clone_val) ? $opt[0]['key'] : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . '<span class="axiom_options_switch' . ($clone_val == $opt[1]['key'] ? ' axiom_options_state_off' : '') . '"><span class="axiom_options_switch_inner iconadmin-circle"><span class="axiom_options_switch_val1" data-value="' . esc_attr($opt[0]['key']) . '">' . $opt[0]['title'] . '</span><span class="axiom_options_switch_val2" data-value="' . esc_attr($opt[1]['key']) . '">' . $opt[1]['title'] . '</span></span></span>';
                 break;
             case 'media':
                 echo '<input class="axiom_options_input axiom_options_input_text axiom_options_input_media"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!isset($field['readonly']) || $field['readonly'] ? ' readonly="readonly"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . $before . $after;
                 if (!empty($clone_val) && !axiom_is_inherit_option($clone_val)) {
                     $info = pathinfo($clone_val);
                     $ext = isset($info['extension']) ? $info['extension'] : '';
                     echo '<a class="axiom_options_image_preview" data-rel="popup" target="_blank" href="' . esc_url($clone_val) . '">' . (!empty($ext) && axiom_strpos('jpg,png,gif', $ext) !== false ? '<img src="' . esc_url($clone_val) . '" alt="" />' : '<span>' . $info['basename'] . '</span>') . '</a>';
                 }
                 break;
             case 'button':
                 list($button, $class) = axiom_options_action_button($field, 'button');
                 echo $button;
                 break;
             case 'range':
                 echo '<div class="axiom_options_input_range" data-step="' . (!empty($field['step']) ? $field['step'] : 1) . '">';
                 echo '<span class="axiom_options_range_scale"><span class="axiom_options_range_scale_filled"></span></span>';
                 if (axiom_strpos($clone_val, $AXIOM_GLOBALS['to_delimiter']) === false) {
                     $clone_val = max($field['min'], intval($clone_val));
                 }
                 if (axiom_strpos($field['std'], $AXIOM_GLOBALS['to_delimiter']) !== false && axiom_strpos($clone_val, $AXIOM_GLOBALS['to_delimiter']) === false) {
                     $clone_val = $field['min'] . ',' . $clone_val;
                 }
                 $sliders = explode($AXIOM_GLOBALS['to_delimiter'], $clone_val);
                 foreach ($sliders as $s) {
                     echo '<span class="axiom_options_range_slider"><span class="axiom_options_range_slider_value">' . intval($s) . '</span><span class="axiom_options_range_slider_button"></span></span>';
                 }
                 echo '<span class="axiom_options_range_min">' . $field['min'] . '</span><span class="axiom_options_range_max">' . $field['max'] . '</span>';
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 echo '</div>';
                 break;
             case "checklist":
                 foreach ($field['options'] as $key => $title) {
                     echo '<span class="axiom_options_listitem' . (axiom_strpos($AXIOM_GLOBALS['to_delimiter'] . $clone_val . $AXIOM_GLOBALS['to_delimiter'], $AXIOM_GLOBALS['to_delimiter'] . $key . $AXIOM_GLOBALS['to_delimiter']) !== false ? ' axiom_options_state_checked' : '') . '"' . ' data-value="' . esc_attr($key) . '"' . '>' . esc_attr($title) . '</span>';
                 }
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 break;
             case 'fonts':
                 foreach ($field['options'] as $key => $title) {
                     $field['options'][$key] = $key;
                 }
             case 'list':
             case 'select':
                 if (!isset($field['options']) && !empty($field['from']) && !empty($field['to'])) {
                     $field['options'] = array();
                     for ($i = $field['from']; $i <= $field['to']; $i += !empty($field['step']) ? $field['step'] : 1) {
                         $field['options'][$i] = $i;
                     }
                 }
                 list($list, $caption) = axiom_options_menu_list($field, $clone_val);
                 if (empty($field['style']) || $field['style'] == 'select') {
                     echo '<input class="axiom_options_input axiom_options_input_select" type="text" value="' . esc_attr($caption) . '"' . ' readonly="readonly"' . ' />' . $before . '<span class="axiom_options_field_after axiom_options_with_action iconadmin-down-open" onclick="axiom_options_action_show_menu(this);return false;"></span>';
                 }
                 echo $list;
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 break;
             case 'images':
                 list($list, $caption) = axiom_options_menu_list($field, $clone_val);
                 if (empty($field['style']) || $field['style'] == 'select') {
                     echo '<div class="axiom_options_caption_image iconadmin-down-open">' . '<span style="background-image: url(' . esc_url($caption) . ')"></span>' . '</div>';
                 }
                 echo $list;
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 break;
             case 'icons':
                 if (isset($field['css']) && $field['css'] != '' && file_exists($field['css'])) {
                     $field['options'] = axiom_parse_icons_classes($field['css']);
                 }
                 list($list, $caption) = axiom_options_menu_list($field, $clone_val);
                 if (empty($field['style']) || $field['style'] == 'select') {
                     echo '<div class="axiom_options_caption_icon iconadmin-down-open"><span class="' . esc_attr($caption) . '"></span></div>';
                 }
                 echo $list;
                 echo '<input name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 break;
             case 'socials':
                 if (!is_array($clone_val)) {
                     $clone_val = array('url' => '', 'icon' => '');
                 }
                 list($list, $caption) = axiom_options_menu_list($field, $clone_val);
                 if (empty($field['style']) || $field['style'] == 'icons') {
                     list($after, $class) = axiom_options_action_button(array('action' => empty($field['style']) || $field['style'] == 'icons' ? 'select_icon' : '', 'icon' => (empty($field['style']) || $field['style'] == 'icons') && !empty($clone_val['icon']) ? $clone_val['icon'] : 'iconadmin-users-1'), 'after');
                 } else {
                     $after = '';
                 }
                 echo '<input class="axiom_options_input axiom_options_input_text axiom_options_input_socials' . (!empty($field['mask']) ? ' axiom_options_input_masked' : '') . '"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text" value="' . esc_attr(axiom_is_inherit_option($clone_val['url']) ? '' : $clone_val['url']) . '"' . (!empty($field['mask']) ? ' data-mask="' . esc_attr($field['mask']) . '"' : '') . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />' . $after;
                 if (!empty($field['style']) && $field['style'] == 'images') {
                     echo '<div class="axiom_options_caption_image iconadmin-down-open">' . '<span style="background-image: url(' . esc_url($caption) . ')"></span>' . '</div>';
                 }
                 echo $list;
                 echo '<input name="' . esc_attr($id) . '_icon' . ($cloneable ? '[]' : '') . '" type="hidden" value="' . esc_attr(axiom_is_inherit_option($clone_val['icon']) ? '' : $clone_val['icon']) . '" />';
                 break;
             case "color":
                 echo '<input class="axiom_options_input axiom_options_input_color' . (isset($field['style']) && $field['style'] == 'custom' ? ' axiom_options_input_color_custom' : '') . '"' . ' name="' . esc_attr($id) . ($cloneable ? '[]' : '') . '"' . ' id="' . esc_attr($id) . '"' . ' type="text"' . ' value="' . esc_attr(axiom_is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="axiom_options_action_' . esc_attr($field['action']) . '(this);return false;"' : '') . ' />';
                 if (isset($field['style']) && $field['style'] == 'custom') {
                     echo '<span class="axiom_options_input_colorpicker iColorPicker"></span>';
                 }
                 break;
             default:
                 if (function_exists('axiom_show_custom_field')) {
                     echo trim(axiom_show_custom_field($id, $field, $clone_val));
                 }
         }
         if ($cloneable) {
             echo '<input type="hidden" name="' . esc_attr($id) . '_numbers[]" value="' . esc_attr($clone_num) . '" />' . '</div>';
         }
     }
     if (!axiom_options_is_group($field['type']) && $field['type'] != 'hidden') {
         if ($cloneable) {
             echo '<div class="axiom_options_input_button axiom_options_clone_button axiom_options_clone_button_add">' . __('+ Add item', 'axiom') . '</div>';
         }
         if (!empty($AXIOM_GLOBALS['to_flags']['add_inherit']) && isset($field['std'])) {
             echo '<div class="axiom_options_content_inherit"' . ($inherit ? '' : ' style="display:none;"') . '><div>' . __('Inherit', 'axiom') . '</div><input type="hidden" name="' . esc_attr($id) . '_inherit" value="' . esc_attr($inherit) . '" /></div>';
         }
         echo '</div>';
         if (!empty($field['desc'])) {
             echo '<div class="axiom_options_desc">' . $field['desc'] . '</div>' . "\n";
         }
         echo '</div>' . "\n";
     }
 }
Example #2
0
 function axiom_get_list_icons($prepend_inherit = false)
 {
     global $AXIOM_GLOBALS;
     if (isset($AXIOM_GLOBALS['list_icons'])) {
         $list = $AXIOM_GLOBALS['list_icons'];
     } else {
         $AXIOM_GLOBALS['list_icons'] = $list = axiom_parse_icons_classes(axiom_get_file_dir("css/fontello/css/fontello-codes.css"));
     }
     return $prepend_inherit ? axiom_array_merge(array('inherit' => __("Inherit", 'axiom')), $list) : $list;
 }