/**
  * Define custom columns for icons.
  * @param  array $existing_columns
  * @return array
  */
 public function social_icons_columns($existing_columns)
 {
     $columns = array();
     $columns['cb'] = $existing_columns['cb'];
     $columns['name'] = __('Name', 'social-icons');
     $columns['shortcode'] = __('Shortcode', 'social-icons') . si_help_tip(__('Copy and paste the shortcode on your post, page to render social icons.', 'social-icons'));
     $columns['author'] = __('Author', 'social-icons');
     $columns['date'] = __('Date', 'social-icons');
     return $columns;
 }
/**
 * Output a radio input box.
 * @param array $field
 */
function social_icons_wp_radio($field)
{
    global $thepostid, $post;
    $thepostid = empty($thepostid) ? $post->ID : $thepostid;
    $field['class'] = isset($field['class']) ? $field['class'] : 'select short';
    $field['style'] = isset($field['style']) ? $field['style'] : '';
    $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';
    $field['value'] = isset($field['value']) ? $field['value'] : get_post_meta($thepostid, $field['id'], true);
    $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];
    echo '<fieldset class="form-field ' . esc_attr($field['id']) . '_field ' . esc_attr($field['wrapper_class']) . '"><legend>' . wp_kses_post($field['label']) . '</legend><ul class="si-radios">';
    foreach ($field['options'] as $key => $value) {
        echo '<li><label><input
				name="' . esc_attr($field['name']) . '"
				value="' . esc_attr($key) . '"
				type="radio"
				class="' . esc_attr($field['class']) . '"
				style="' . esc_attr($field['style']) . '"
				' . checked(esc_attr($field['value']), esc_attr($key), false) . '
				/> ' . esc_html($value) . '</label>
		</li>';
    }
    echo '</ul>';
    if (!empty($field['description'])) {
        if (isset($field['desc_tip']) && false !== $field['desc_tip']) {
            echo si_help_tip($field['description']);
        } else {
            echo '<span class="description">' . wp_kses_post($field['description']) . '</span>';
        }
    }
    echo '</fieldset>';
}
    /**
     * Output the meta box.
     * @param WP_Post $post
     */
    public static function output($post)
    {
        global $post, $thepostid;
        wp_nonce_field('social_icons_save_data', 'social_icons_meta_nonce');
        $thepostid = $post->ID;
        ?>
		<style type="text/css">
			#edit-slug-box, #minor-publishing-actions { display:none }
		</style>
		<div id="group_options" class="panel-wrap group_data">
			<ul class="group_data_tabs si-tabs">
				<?php 
        $group_data_tabs = apply_filters('social_icons_group_data_tabs', array('general' => array('label' => __('General', 'social-icons'), 'target' => 'general_group_data', 'class' => 'general_group_data'), 'linked_icons' => array('label' => __('Linked Icons', 'social-icons'), 'target' => 'linked_group_data', 'class' => 'linked_group_data')));
        foreach ($group_data_tabs as $key => $tab) {
            ?>
<li class="<?php 
            echo $key;
            ?>
_options <?php 
            echo $key;
            ?>
_tab <?php 
            echo implode(' ', (array) $tab['class']);
            ?>
">
							<a href="#<?php 
            echo $tab['target'];
            ?>
"><?php 
            echo esc_html($tab['label']);
            ?>
</a>
						</li><?php 
        }
        do_action('social_icons_group_write_panel_tabs');
        ?>
			</ul>
			<div id="general_group_data" class="panel social_icons_options_panel hidden"><?php 
        echo '<div class="options_group">';
        // Background Style
        social_icons_wp_select(array('id' => 'background_style', 'label' => __('Background Style', 'social-icons'), 'options' => array('none' => __('None', 'social-icons'), 'square' => __('Square', 'social-icons'), 'rounded' => __('Rounded', 'social-icons'), 'square centre' => __('Square Centre', 'social-icons'), 'rounded centre' => __('Rounded Centre', 'social-icons')), 'desc_tip' => 'true', 'description' => __('Define whether or not the entire background should be style based, or just with the default style.', 'social-icons')));
        // Choose Icon size
        social_icons_wp_text_input(array('id' => 'icon_font_size', 'label' => __('Choose Icon Size', 'social-icons'), 'placeholder' => __('Default', 'social-icons'), 'desc_tip' => true, 'description' => __('Leave blank for default icon font size.', 'social-icons'), 'type' => 'number', 'custom_attributes' => array('step' => '1', 'min' => '14', 'max' => '40')));
        echo '</div>';
        echo '<div class="options_group">';
        // Manage Label
        social_icons_wp_checkbox(array('id' => '_manage_label', 'label' => __('Manage Label', 'social-icons'), 'description' => __('Enable this to display social icons label.', 'social-icons')));
        // Greyscale Icon
        social_icons_wp_checkbox(array('id' => '_greyscale_icons', 'label' => __('Greyscale Icon', 'social-icons'), 'description' => __('Enable this to allow greyscale social icons.', 'social-icons')));
        // Open in New tab
        social_icons_wp_checkbox(array('id' => '_open_new_tab', 'label' => __('Open New Tab', 'social-icons'), 'description' => __('Enable this to allow links to open in new tab.', 'social-icons')));
        echo '</div>';
        do_action('social_icons_group_options_general');
        ?>
</div>
			<div id="linked_group_data" class="panel social_icons_options_panel hidden"><?php 
        echo '<div class="options_group">';
        ?>
				<div class="form-field sortable_icons">
					<label><?php 
        _e('Sortable Icons', 'social-icons');
        ?>
</label>
					<table class="widefat">
						<thead>
							<tr>
								<th class="sort">&nbsp;</th>
								<th><?php 
        _e('Label', 'social-icons');
        ?>
 <?php 
        echo si_help_tip(__('This is the label of the social icon shown to the users.', 'social-icons'));
        ?>
</th>
								<th colspan="2"><?php 
        _e('Social URL', 'social-icons');
        ?>
 <?php 
        echo si_help_tip(__('This is the URL to the social media which users will surf.', 'social-icons'));
        ?>
</th>
							</tr>
						</thead>
						<tbody><?php 
        if (metadata_exists('post', $post->ID, '_sortable_icons')) {
            $sortable_icons = get_post_meta($post->ID, '_sortable_icons', true);
        } else {
            $sortable_icons = array('twitter' => array('url' => 'https://twitter.com/', 'label' => __('Follow Me', 'social-icons')), 'facebook' => array('url' => 'https://facebook.com/', 'label' => __('Friend me on Facebook', 'social-icons')));
        }
        if ($sortable_icons) {
            foreach ($sortable_icons as $name => $icon) {
                $name = esc_attr('socicon-' . $name);
                include 'views/html-group-social-icon.php';
            }
        } else {
            printf('<tr class="no-items"><td colspan="5"><p>%s</p></td></tr>', esc_html('No sortable icons found.', 'social-icons'));
        }
        ?>
</tbody>
						<tfoot>
							<tr>
								<th colspan="5">
									<a href="#" class="button insert" data-row="<?php 
        $name = 'dashicons-plus';
        $icon = array('label' => '', 'url' => '');
        ob_start();
        include 'views/html-group-social-icon.php';
        echo esc_attr(ob_get_clean());
        ?>
"><?php 
        _e('Add Icon', 'social-icons');
        ?>
</a>
								</th>
							</tr>
						</tfoot>
					</table>
				</div>
				<?php 
        echo '</div>';
        ?>
</div>
			<?php 
        do_action('social_icons_group_data_panels');
        ?>
			<div class="clear"></div>
		</div>
		<?php 
    }