wordpress/wp-content/themes/basic/themify/themify-admin.php
/**
 * Outputs module to manage links to be shown using the corresponding widget
 * @param array $data
 * @return string
 * @since 1.2.7
 */
Outputs module to manage links to be shown using the corresponding widget
@param array $data
@return string
@since 1.2.7
Outputs module to manage links to be shown using the corresponding widget @param array $data @return string @since 1 . 2 . 7
function themify_manage_links( $data = array() ) {
	$data = themify_get_data();
	$pre = 'setting-link_';
	$field_hash = !empty( $data[$pre.'field_hash'] )? (int)$data[$pre.'field_hash'] : 8;
	$start = array();
	for ( $i=0; $i < $field_hash; ++$i ) {
		$start['themify-link-'.$i] = 'themify-link-'.$i;
	}
	$field_ids=themify_get( $pre.'field_ids',false,true );
	if ( $field_ids) {
		$field_ids=json_decode( $field_ids, true );
		if ( ! is_array( $field_ids ) ) {
			$field_ids = array();
		}
	} else {
		$field_ids = $start;
		$data[$pre.'type_themify-link-0'] = 'image-icon';
		$data[$pre.'type_themify-link-1'] = 'image-icon';
		$data[$pre.'type_themify-link-2'] = 'image-icon';
		$data[$pre.'type_themify-link-3'] = 'image-icon';
		$data[$pre.'title_themify-link-0'] = 'Twitter';
		$data[$pre.'title_themify-link-1'] = 'Facebook';
		$data[$pre.'title_themify-link-2'] = 'YouTube';
		$data[$pre.'title_themify-link-3'] = 'Pinterest';
		$data[$pre.'link_themify-link-0'] = '';
		$data[$pre.'link_themify-link-1'] = '';
		$data[$pre.'link_themify-link-2'] = '';
		$data[$pre.'link_themify-link-3'] = '';
		$data[$pre.'img_themify-link-0'] = THEMIFY_URI . '/img/social/twitter.png';
		$data[$pre.'img_themify-link-1'] = THEMIFY_URI . '/img/social/facebook.png';
		$data[$pre.'img_themify-link-2'] = THEMIFY_URI . '/img/social/youtube.png';
		$data[$pre.'img_themify-link-3'] = THEMIFY_URI . '/img/social/pinterest.png';
		$data[$pre.'type_themify-link-4'] = 'font-icon';
		$data[$pre.'type_themify-link-5'] = 'font-icon';
		$data[$pre.'type_themify-link-6'] = 'font-icon';
		$data[$pre.'type_themify-link-7'] = 'font-icon';
		$data[$pre.'title_themify-link-4'] = 'Twitter';
		$data[$pre.'title_themify-link-5'] = 'Facebook';
		$data[$pre.'title_themify-link-6'] = 'YouTube';
		$data[$pre.'title_themify-link-7'] = 'Pinterest';
		$data[$pre.'link_themify-link-4'] = '';
		$data[$pre.'link_themify-link-5'] = '';
		$data[$pre.'link_themify-link-6'] = '';
		$data[$pre.'link_themify-link-7'] = '';
		$data[$pre.'ficon_themify-link-4'] = 'fa-twitter';
		$data[$pre.'ficon_themify-link-5'] = 'fa-facebook';
		$data[$pre.'ficon_themify-link-6'] = 'fa-youtube';
		$data[$pre.'ficon_themify-link-7'] = 'fa-pinterest';
		$data[$pre.'ficolor_themify-link-4'] = '';
		$data[$pre.'ficolor_themify-link-5'] = '';
		$data[$pre.'ficolor_themify-link-6'] = '';
		$data[$pre.'ficolor_themify-link-7'] = '';
		$data[$pre.'fibgcolor_themify-link-4'] = '';
		$data[$pre.'fibgcolor_themify-link-5'] = '';
		$data[$pre.'fibgcolor_themify-link-6'] = '';
		$data[$pre.'fibgcolor_themify-link-7'] = '';
		$data = apply_filters('themify_default_social_links', $data);
	}
	$out = '<div class="themify-info-link">' . sprintf( __( 'To display the links: go to Appearance > <a href="%s">Widgets</a> and drop a Themify - Social Links widget in a widget area (<a href="%s" target="_blank">learn more</a>)', 'themify' ), admin_url('widgets.php'), 'https://themify.me/docs/social-media-links') . '</div>';
	$out .= '<div id="social-link-type">';
		$out .= '<label for="' . $pre . 'font_icon">';
		$out .= '<input ' . checked( isset( $data[$pre.'icon_type'] )? $data[$pre.'icon_type'] : 'font-icon', 'font-icon', false) . ' type="radio" id="' . $pre . 'font_icon" name="' .  $pre . 'icon_type" value="font-icon" data-hide="image-icon" /> ';
		$out .= __( 'Icon Font', 'themify' ) . '</label>';
		$out .= '<label for="' . $pre . 'image_icon">';
		$out .= '<input ' . checked( isset( $data[$pre.'icon_type'] )? $data[$pre.'icon_type'] : '', 'image-icon', false ) . ' type="radio" id="' . $pre . 'image_icon" name="' . $pre . 'icon_type" value="image-icon" data-hide="font-icon" /> ';
		$out .= __( 'Image', 'themify' ) . '</label>';
	$out .= '</p>';
	$out .=  '<ul id="social-links-wrapper">';
		foreach ( $field_ids as $fid ) {
			$out .= themify_add_link_template( $fid, $data );
		}
	$out .= '</ul>';
	$out .= '<p class="add-link add-social-link"><a href="#">' . __('Add Link', 'themify') . '</a></p>';
	$out .= '<input type="hidden" id="' .  $pre . 'field_ids" name="' . $pre . 'field_ids" value=\'' . json_encode( $field_ids ) . '\'/>';
	$out .= '<input type="hidden" id="' .  $pre . 'field_hash" name="' . $pre . 'field_hash" value="' . esc_attr( $field_hash ) . '"/>';
	return $out;
}
function themify_manage_links ( $ data = array ( ) ) { $ data = themify_get_data ( ) ; $ pre = 'setting-link_' ; $ field_hash = ! empty ( $ data [ $ pre . 'field_hash' ] ) ? ( int ) $ data [ $ pre . 'field_hash' ] : 8 ; $ start = array ( ) ; for ( $ i = 0 ; $ i < $ field_hash ; ++ $ i ) { $ start [ 'themify-link-' . $ i ] = 'themify-link-' . $ i ; } $ field_ids = themify_get ( $ pre . 'field_ids' , false , true ) ; if ( $ field_ids ) { $ field_ids = json_decode ( $ field_ids , true ) ; if ( ! is_array ( $ field_ids ) ) { $ field_ids = array ( ) ; } } else { $ field_ids = $ start ; $ data [ $ pre . 'type_themify-link-0' ] = 'image-icon' ; $ data [ $ pre . 'type_themify-link-1' ] = 'image-icon' ; $ data [ $ pre . 'type_themify-link-2' ] = 'image-icon' ; $ data [ $ pre . 'type_themify-link-3' ] = 'image-icon' ; $ data [ $ pre . 'title_themify-link-0' ] = 'Twitter' ; $ data [ $ pre . 'title_themify-link-1' ] = 'Facebook' ; $ data [ $ pre . 'title_themify-link-2' ] = 'YouTube' ; $ data [ $ pre . 'title_themify-link-3' ] = 'Pinterest' ; $ data [ $ pre . 'link_themify-link-0' ] = '' ; $ data [ $ pre . 'link_themify-link-1' ] = '' ; $ data [ $ pre . 'link_themify-link-2' ] = '' ; $ data [ $ pre . 'link_themify-link-3' ] = '' ; $ data [ $ pre . 'img_themify-link-0' ] = THEMIFY_URI . '/img/social/twitter.png' ; $ data [ $ pre . 'img_themify-link-1' ] = THEMIFY_URI . '/img/social/facebook.png' ; $ data [ $ pre . 'img_themify-link-2' ] = THEMIFY_URI . '/img/social/youtube.png' ; $ data [ $ pre . 'img_themify-link-3' ] = THEMIFY_URI . '/img/social/pinterest.png' ; $ data [ $ pre . 'type_themify-link-4' ] = 'font-icon' ; $ data [ $ pre . 'type_themify-link-5' ] = 'font-icon' ; $ data [ $ pre . 'type_themify-link-6' ] = 'font-icon' ; $ data [ $ pre . 'type_themify-link-7' ] = 'font-icon' ; $ data [ $ pre . 'title_themify-link-4' ] = 'Twitter' ; $ data [ $ pre . 'title_themify-link-5' ] = 'Facebook' ; $ data [ $ pre . 'title_themify-link-6' ] = 'YouTube' ; $ data [ $ pre . 'title_themify-link-7' ] = 'Pinterest' ; $ data [ $ pre . 'link_themify-link-4' ] = '' ; $ data [ $ pre . 'link_themify-link-5' ] = '' ; $ data [ $ pre . 'link_themify-link-6' ] = '' ; $ data [ $ pre . 'link_themify-link-7' ] = '' ; $ data [ $ pre . 'ficon_themify-link-4' ] = 'fa-twitter' ; $ data [ $ pre . 'ficon_themify-link-5' ] = 'fa-facebook' ; $ data [ $ pre . 'ficon_themify-link-6' ] = 'fa-youtube' ; $ data [ $ pre . 'ficon_themify-link-7' ] = 'fa-pinterest' ; $ data [ $ pre . 'ficolor_themify-link-4' ] = '' ; $ data [ $ pre . 'ficolor_themify-link-5' ] = '' ; $ data [ $ pre . 'ficolor_themify-link-6' ] = '' ; $ data [ $ pre . 'ficolor_themify-link-7' ] = '' ; $ data [ $ pre . 'fibgcolor_themify-link-4' ] = '' ; $ data [ $ pre . 'fibgcolor_themify-link-5' ] = '' ; $ data [ $ pre . 'fibgcolor_themify-link-6' ] = '' ; $ data [ $ pre . 'fibgcolor_themify-link-7' ] = '' ; $ data = apply_filters ( 'themify_default_social_links' , $ data ) ; } $ out = '<div class="themify-info-link">' . sprintf ( __ ( 'To display the links: go to Appearance > <a href="%s">Widgets</a> and drop a Themify - Social Links widget in a widget area (<a href="%s" target="_blank">learn more</a>)' , 'themify' ) , admin_url ( 'widgets.php' ) , 'https://themify.me/docs/social-media-links' ) . '</div>' ; $ out .= '<div id="social-link-type">' ; $ out .= '<label for="' . $ pre . 'font_icon">' ; $ out .= '<input ' . checked ( isset ( $ data [ $ pre . 'icon_type' ] ) ? $ data [ $ pre . 'icon_type' ] : 'font-icon' , 'font-icon' , false ) . ' type="radio" id="' . $ pre . 'font_icon" name="' . $ pre . 'icon_type" value="font-icon" data-hide="image-icon" /> ' ; $ out .= __ ( 'Icon Font' , 'themify' ) . '</label>' ; $ out .= '<label for="' . $ pre . 'image_icon">' ; $ out .= '<input ' . checked ( isset ( $ data [ $ pre . 'icon_type' ] ) ? $ data [ $ pre . 'icon_type' ] : '' , 'image-icon' , false ) . ' type="radio" id="' . $ pre . 'image_icon" name="' . $ pre . 'icon_type" value="image-icon" data-hide="font-icon" /> ' ; $ out .= __ ( 'Image' , 'themify' ) . '</label>' ; $ out .= '</p>' ; $ out .= '<ul id="social-links-wrapper">' ; foreach ( $ field_ids as $ fid ) { $ out .= themify_add_link_template ( $ fid , $ data ) ; } $ out .= '</ul>' ; $ out .= '<p class="add-link add-social-link"><a href="#">' . __ ( 'Add Link' , 'themify' ) . '</a></p>' ; $ out .= '<input type="hidden" id="' . $ pre . 'field_ids" name="' . $ pre . 'field_ids" value=\'' . json_encode ( $ field_ids ) . '\'/>' ; $ out .= '<input type="hidden" id="' . $ pre . 'field_hash" name="' . $ pre . 'field_hash" value="' . esc_attr ( $ field_hash ) . '"/>' ; return $ out ; }
Outputs module to manage links to be shown using the corresponding widget
 @param array $data
 @return string
 @since 1.2.7
Outputs module to manage links to be shown using the corresponding widget @param array $data @return string @since 1 . 2 . 7
//$data[$pre.'field_ids'] = json_encode($start); // Image Icons // Font Icons // Icon Font // Image //$out .= '<p>Fields: '.json_encode($field_ids).'</p><p>Hash: '.$field_hash.'</p>';