';
$tabs = array( 'afc_plugin_options' => 'General Options', 'afc_import_export' => 'Import/Export' );
echo '
' . __( 'Advanced Font Changer', 'afc_textdomain' ) . '
';
settings_errors('afc_ioPage');
echo '';
$current = 'afc_import_export';
foreach( $tabs as $tab => $name ){
$classnames = ( $tab == $current ) ? ' nav-tab-active' : '';
echo "$name";
}
echo '
';
?>
getCols( array( 'selectorName', 'properties', 'pageType', 'editorData' ) );
$selectors = json_encode( $selectors );
$afcFonts = new afcfonts();
$fonts = $afcFonts->getCols( array( 'name', 'status', 'metadata' ) );
$fonts = json_encode( $fonts );
echo __( 'These are your selectors.', 'afc_textdomain' ) . '
';
?>
';
?>
generateLocalFontFaces();
$output .= "\n" . $style->generateStyles( 'all', 'yes' );
$output = preg_replace('/\t+/', '', $output);
$googleStyle = $style->generateGoogleFontsStyle();
echo __( 'This is a ready to use stylesheet for inserting directly in your theme style file . keep in mind you must edit links to font files.', 'afc_textdomain' ) . '
';
?>
';
?>
';
?>
';
?>
', 'afc_textdomain' );
echo __( 'Warning: be aware of submitting this form with empty data in import textarea. doing this will removes all your saved data', 'afc_textdomain' );
}
/*
* This function checks values intered in import/export page
*/
function afc_validate_io( $input ){
$mustImportSelectors = str_replace( '\n', '', trim( $input['afc_selectors_to_import'] ) );
$mustImportFonts = str_replace( '\n', '', trim( $input['afc_fonts_to_import'] ) );
$afcSelectors = new afcselectors();
$afcFonts = new afcfonts();
$message = '';
$type = '';
if( $mustImportSelectors != '' ){
$mustImportSelectors = json_decode( $mustImportSelectors, true );
if( is_array( $mustImportSelectors ) && count( $mustImportSelectors ) > 0 ){
$safeData = array();
foreach( $mustImportSelectors as $key){
if( $afcSelectors->isValidSelector( $key ) ){
$safeData[] = $key;
}
}
if( count( $safeData ) > 0 ){
$afcSelectors->addelems( $safeData );
$message = count( $safeData ) . __( ' Entry(s) successfully imported.', 'afc_textdomain' );
$type = 'updated';
}
else {
$message = __( 'Your data is incorrect.', 'afc_textdomain' );
$type = 'error';
}
}
else{
$message = __( 'Your data is incorrect.', 'afc_textdomain' );
$type = 'error';
}
}
if( $mustImportFonts != '' ){
$mustImportFonts = json_decode( $mustImportFonts, true );
if( is_array( $mustImportFonts ) && count( $mustImportFonts ) > 0 ){
$safeData = array();
foreach( $mustImportFonts as $key){
if( $afcFonts->isValidFont( $key ) ){
$safeData[] = $key;
}
}
if( count( $safeData ) > 0 ){
$safeData = $afcFonts->unserializeIt($safeData);
$afcFonts->addFonts( $safeData );
$message = count( $safeData ) . __( ' Entry(s) successfully imported.', 'afc_textdomain' );
$type = 'updated';
}
else {
$message = __( 'Your data is incorrect.', 'afc_textdomain' );
$type = 'error';
}
}
else{
$message = __( 'Your data is incorrect.', 'afc_textdomain' );
$type = 'error';
}
}
if($mustImportFonts == '' && $mustImportSelectors == '' ) {
$afcSelectors->reset();
$message = __( 'All your selectors successfully removed.', 'afc_textdomain' );
$type = 'updated';
}
add_settings_error( 'afc_ioPage', 'afc', $message, $type );
}
?>