gwi_settings

The Google WebFonts Integrate gwi settings function.

Description

gwi_settings(); 

Usage

  1. if ( !function_exists( 'gwi_settings' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-webfonts-integrate/admin-area.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = gwi_settings(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/admin-area.php  
  1. function gwi_settings() { 
  2. if (!current_user_can('manage_options')) { 
  3. wp_die( __('You do not have sufficient permissions to access this page.') ); 
  4. global $gwiopts, $_POST; 
  5. //Define update (mp3_listen and video watch defined above) 
  6. @$gwiopts['gwi_font'] = $_POST['gwi_font']; 
  7. @$gwiopts['gwi_script'] = $_POST['gwi_script']; 
  8. @$gwiopts['use_style_where'] = $_POST['use_style_where']; 
  9. @$gwiopts['use_style_where2'] = $_POST['use_style_where2']; 
  10. @$gwiopts['gwi_sl1'] = $_POST['gwi_sl1']; 
  11. @$gwiopts['gwi_prvw'] = $_POST['gwi_prvw']; 
  12. @$gwiopts['gwi_sub'] = $_POST['gwi_sub']; 
  13.  
  14.  
  15. update_option('OPTIONS', $gwiopts); 
  16.  
  17. //Start to write admin area 
  18. ?> 
  19. <div class='wrap' style="width:49%"> 
  20. <div id="icon-plugins" class="icon32"></div><h2><?php _e('Google Webfonts Integrate', 'gwi') ?> (<?php echo plugin1_get_version(); ?>)</h2> 
  21. <?php include 'right-side.php'; ?> 
  22. <form method="post" action="options.php"> 
  23. <?php wp_nonce_field('update-options') ?> 
  24.  
  25. <h4><strong><?php _e('Select Where you want to use fonts:', 'gwi')?></strong></h4> 
  26. <label><strong><?php _e('For Font 1', 'gwi')?> </strong></label><input type="text" name="use_style_where" size="45" value="<?php echo get_option('use_style_where'); ?>" /><br /> 
  27. <label><strong><?php _e('For Font 2', 'gwi')?> </strong></label><input type="text" name="use_style_where2" size="45" value="<?php echo get_option('use_style_where2'); ?>" /><br /> 
  28. <span style="font-size: 10px;text-align:justify;"><em><?php _e('Write div or anything <em>id, class etc.</em>. Sperate them with comma. For example: <code>#content, .entry, #breadcrumb a, ....</code>', 'gwi')?></em></span><br /> 
  29. <h4><strong><?php _e('Select Your Font:', 'gwi')?></strong></h4> 
  30. <span style="font-size: 10px;text-align:justify;"><em><?php _e('You can choose two different font. It\'s optional. If you choose second font you can use two different fonts for two different areas', 'gwi')?></em></span><br /> 
  31. <strong><?php _e('Font 1', 'gwi')?> </strong> 
  32.  
  33. <?php 
  34. $font_values = array ("", "Ubuntu", "Patrick+Hand", "Istok+Web", "Modern+Antiqua", "Forum", "Varela", "Tenor+Sans", "Ruslan+Display", "Jura", "Caudex", "Play", "Francois+One", "Didact+Gothic", "EB+Garamond", "MedievalSharp", "Anton", "Open+Sans", "Anonymous+Pro", "Neuton", "Lobster", "Andika", "Gentium+Basic", "Kelly+Slab", "Sorts+Mill+Goudy", "Abril+Fatface", "Cardo", "Playfair+Display", "GFS+Didot", "GFS+Neohellenic", "Nova+Mono", "PT+Serif", "PT+Sans+Narrow", "PT+Sans+Caption", "Cuprum", "Philosopher", "Neucha", "PT+Serif+Caption"); 
  35. $subsets = array ("", "greek", "greek-ext", "cyrillic", "cyrillic-ext", "vietnamese", "latin-ext"); 
  36. $charopt = get_option('gwi_sub'); 
  37. $optme = get_option('gwi_font'); 
  38. $optme2 = get_option('gwi_sl1'); 
  39. ?> 
  40. <select name="gwi_font"> 
  41. <?php 
  42. foreach($font_values as $f_v) { 
  43. $f_v_str = str_replace("+", " ", $f_v);  
  44. $selected =($optme==$f_v) ? 'selected="selected"' : ''; 
  45. $selected1 = ($optme2==$f_v) ? 'selected="selected"' : ''; 
  46. ?> 
  47. <option name="gwi_font" value="<?php echo $f_v; ?>" <?php echo $selected; ?> /><?php echo $f_v_str; ?></option> 
  48. <?php } ?> 
  49. </select> 
  50.  
  51. <small><?php _e('Also Preview Font', 'gwi') ?></small> 
  52. <br /> 
  53. <label><strong><?php _e('Font 2', 'gwi')?> </strong></label> 
  54. <select name="gwi_sl1"> 
  55. <?php 
  56. foreach($font_values as $f_v1) { 
  57. $f_v_str1 = str_replace("+", " ", $f_v1);  
  58. $selected1 = ($optme2==$f_v1) ? 'selected="selected"' : ''; 
  59. ?> 
  60. <option name="gwi_sl1" value="<?php echo $f_v1; ?>" <?php echo $selected1; ?> /><?php echo $f_v_str1; ?></option> 
  61. <?php } ?> 
  62. </select><br /> 
  63. <h4><?php _e('Character Set (subset)', 'gwi') ?></h4> 
  64. <span style="font-size: 10px;text-align:justify;"><em><?php _e('Dont select anything if you use "<strong>only</strong>" Latin character set. Latin is <strong>default</strong>.', 'gwi') ?></em></span><br /> 
  65. <select name="gwi_sub"> 
  66. <?php  
  67. foreach($subsets as $subset) { 
  68. $subset_str = str_replace("+", " ", $subset);  
  69. $selectedc =($charopt==$subset) ? 'selected="selected"' : ''; 
  70. ?> 
  71. <option name="gwi_sub" value="<?php echo $subset; ?>" <?php echo $selectedc; ?> /><?php echo $subset_str; ?></option> 
  72. <?php } ?> 
  73. </select><br /> 
  74.  
  75.  
  76. <h4><?php _e('Preview Word', 'gwi') ?></h4> 
  77. <input type="text" name="gwi_prvw" size="45" value="<?php echo get_option('gwi_prvw'); ?>" /> 
  78.  
  79. <p><input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" class="button-primary" /></p> 
  80.  
  81. <input type="hidden" name="action" value="update" /> 
  82. <input type="hidden" name="page_options" value="gwi_font, use_style_where, gwi_sl1, use_style_where2, gwi_prvw, gwi_sub" /> 
  83.  
  84. </form> 
  85.  
  86. </div> 
  87.  
  88. <?php 
  89. //Admin area finish