gde_profile_form

Outputs profile form (called from multiple places).

Description

gde_profile_form( (int) $id = 1 ); 

Parameters (1)

0. $id — Optional. (int) => 1
The id.

Usage

  1. if ( !function_exists( 'gde_profile_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/libs/lib-profile.php'; 
  3.  
  4. // The id. 
  5. $id = 1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gde_profile_form($id); 
  9.  

Defined (1)

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

/libs/lib-profile.php  
  1. function gde_profile_form( $id = 1 ) { 
  2. global $healthy; 
  3.  
  4. // get requested profile 
  5. if ( ! $healthy ) { 
  6. echo "<p>" . gde_show_error( __('Unable to load profile settings. Please re-activate GDE and if the problem persists, request help using the "Support" tab.', 'google-document-embedder') ) . "</p>\n"; 
  7. } else { 
  8. $p = gde_get_profiles( $id ); 
  9.  
  10. // minimize FOUC 
  11. if ( $p['viewer'] == "standard" ) { 
  12. $hideenh = " hide"; 
  13. } else { 
  14. $hideenh = ''; 
  15.  
  16. // setup title & nonce 
  17. if ( $id == 1 ) { 
  18. $title = __('Default Settings', 'google-document-embedder'); 
  19. $desc = __('These settings define the default viewer profile, which is used when no other profile is specified.', 'google-document-embedder'); 
  20. $naction = "update-default-opts"; 
  21. $nname = "_general_default"; 
  22. } else { 
  23. $title = __('Edit Profile', 'google-document-embedder'); 
  24. $naction = "update-profile-opts"; 
  25. $nname = "_profile_edit"; 
  26. ?> 
  27.  
  28. <div id="profile-form"> 
  29.  
  30. <form action="" method="post"> 
  31. <?php wp_nonce_field($naction, $nname); ?> 
  32. <input type="hidden" name="profile_id" value="<?php echo esc_attr($id); ?>"> 
  33.  
  34. <?php gde_help_link( GDE_STDOPT_URL, 'right' ); ?> 
  35. <h3><?php echo $title; ?></h3> 
  36.  
  37. <?php if ( isset( $desc ) ) { echo htmlentities($desc); } ?> 
  38.  
  39. <table class="form-table"> 
  40. <tbody> 
  41. <tr valign="top"> 
  42. <th scope="row"><?php _e('Viewer Mode', 'google-document-embedder'); ?></th> 
  43. <td> 
  44. <select name="viewer" id="viewer"> 
  45. <?php 
  46. gde_profile_option( $p['viewer'], 'standard', __('Standard Viewer', 'google-document-embedder'), __('Embed the basic viewer only', 'google-document-embedder') ); 
  47. //gde_profile_option( $p['viewer'], 'enhanced', __('Enhanced Viewer', 'google-document-embedder'), __('Enable extended viewer options', 'google-document-embedder') ); 
  48. ?> 
  49. </select><br/> 
  50. <span class="gde-fnote" id="viewer-h"></span> 
  51.  
  52. <p><b>To find out why Enhanced Mode is no longer available, see the notice on our  
  53. <a href="https://wordpress.org/plugins/google-document-embedder/" target="_blank">plugin homepage</a>. 
  54. </b></p> 
  55. </td> 
  56. </tr> 
  57. </tbody> 
  58. </table> 
  59. <!-- 
  60. <fieldset class="gde-inner<?php echo $hideenh; ?>" id="gde-enh-fs"> 
  61. <legend><?php _e('Enhanced Viewer Settings', 'google-document-embedder'); ?></legend> 
  62. <table class="form-table"> 
  63. <tbody> 
  64. <tr valign="top"> 
  65. <th scope="row"><?php _e('Toolbar', 'google-document-embedder'); ?></th> 
  66. <td> 
  67. <?php gde_help_link( GDE_ENHOPT_URL, 'right' ); ?> 
  68. <?php 
  69. gde_profile_checkbox( $p['tb_flags'], 'gdet_h', __('Remove Toolbar', 'google-document-embedder') ); 
  70. ?> 
  71. </td> 
  72. </tr> 
  73. <tr valign="top" id="mobiletb"> 
  74. <th scope="row"><?php _e('Use Mobile Toolbar', 'google-document-embedder'); ?></th> 
  75. <td> 
  76. <select name="tb_mobile" id="tb_mobile"> 
  77. <?php 
  78. gde_profile_option( $p['tb_mobile'], 'default', __('Mobile Devices Only (Default)', 'google-document-embedder'), __('Use mobile toolbar when mobile device detected', 'google-document-embedder') ); 
  79. gde_profile_option( $p['tb_mobile'], 'always', __('Always', 'google-document-embedder'), __('Use mobile toolbar for all visitors', 'google-document-embedder') ); 
  80. gde_profile_option( $p['tb_mobile'], 'never', __('Never', 'google-document-embedder'), __('Never use mobile toolbar', 'google-document-embedder') ); 
  81. ?> 
  82. </select><br/> 
  83. <span class="gde-fnote" id="mobile-h"></span> 
  84. </td> 
  85. </tr> 
  86. <tr valign="top" id="toolbuttons"> 
  87. <th scope="row"><?php _e('Toolbar Items', 'google-document-embedder'); ?></th> 
  88. <td> 
  89. <?php 
  90. gde_profile_checkbox( $p['tb_flags'], 'gdet_p', __('Page Numbers', 'google-document-embedder') ); 
  91. gde_profile_checkbox( $p['tb_flags'], 'gdet_r', __('Previous/Next Page', 'google-document-embedder') ); 
  92. gde_profile_checkbox( $p['tb_flags'], 'gdet_z', __('Zoom In/Out', 'google-document-embedder') ); 
  93. gde_profile_checkbox( $p['tb_flags'], 'gdet_n', __('Full Screen/New Window', 'google-document-embedder'), 'allowNewWin' ); 
  94. ?> 
  95. <br/> 
  96. <span class="gde-fnote"><?php _e('Uncheck items to remove from toolbar. Buttons will vary based on file type and device used.', 'google-document-embedder'); ?></span> 
  97. </td> 
  98. </tr> 
  99. <tr valign="top" id="fullscreen"> 
  100. <th scope="row"><?php _e('Full Screen Behavior', 'google-document-embedder'); ?></th> 
  101. <td> 
  102. <select name="tb_fullscr" id="tb_fullscr"> 
  103. <?php 
  104. gde_profile_option( $p['tb_fullscr'], 'default', __('Google-Hosted Page (Default)', 'google-document-embedder') ); 
  105. //gde_profile_option( $p['tb_fullscr'], 'branded', __('Custom-Branded Page', 'google-document-embedder') ); 
  106. gde_profile_option( $p['tb_fullscr'], 'viewer', __('Full Screen Viewer', 'google-document-embedder') ); 
  107. ?> 
  108. </select><br/> 
  109.  
  110. <?php 
  111. gde_profile_checkbox( $p['tb_fullwin'], 'fs_win', __('Open in New Window', 'google-document-embedder') ); 
  112. gde_profile_checkbox( $p['tb_fulluser'], 'fs_user', __('Allow Logged-in Users Only', 'google-document-embedder'), 'blockAnon' ); 
  113. //gde_profile_checkbox( $p['tb_print'], 'fs_print', __('Allow Printing', 'google-document-embedder'), 'allowPrint' ); 
  114. ?> 
  115. </td> 
  116. </tr> 
  117. <tr valign="top" id="bgcolor"> 
  118. <th scope="row"><?php _e('Page Area Background Color', 'google-document-embedder'); ?></th> 
  119. <td> 
  120. <?php 
  121. gde_profile_text( $p['vw_bgcolor'], 'vw_bgcolor', 'gde-color-field', 10 ); 
  122. gde_profile_checkbox( $p['vw_flags'], 'gdev_t', __('None (Transparent)', 'google-document-embedder') ); 
  123. ?> 
  124. </td> 
  125. </tr> 
  126. <tr valign="top" id="pbcolor"> 
  127. <th scope="row"><?php _e('Page Border Color', 'google-document-embedder'); ?></th> 
  128. <td> 
  129. <?php 
  130. gde_profile_text( $p['vw_pbcolor'], 'vw_pbcolor', 'gde-color-field', 10 ); 
  131. gde_profile_checkbox( $p['vw_flags'], 'gdev_b', __('No Border', 'google-document-embedder') ); 
  132. ?> 
  133. </td> 
  134. </tr> 
  135. <tr valign="top" id="cssfile"> 
  136. <th scope="row"><?php _e('Custom CSS File', 'google-document-embedder'); ?></th> 
  137. <td> 
  138. <?php 
  139. @gde_profile_text( $p['vw_css'], 'vw_css', '', '65' ); 
  140. ?> 
  141. <br/> 
  142. <span class="gde-fnote"><?php _e('URL of custom CSS file (may override some of the above options)', 'google-document-embedder'); ?></span> 
  143. </td> 
  144. </tr> 
  145. <tr valign="top" id="docsec"> 
  146. <th scope="row"><?php _e('Security', 'google-document-embedder'); ?></th> 
  147. <td> 
  148. <?php 
  149. gde_profile_checkbox( $p['vw_flags'], 'gdev_x', __('Hide ability to select/copy/paste text', 'google-document-embedder'), 'hideselect', 1 ); 
  150. gde_profile_checkbox( $p['link_block'], 'block', __('Block all downloadrequestsfor file', 'google-document-embedder'), 'linkblock', 1 ); 
  151. ?> 
  152. </td> 
  153. </tr> 
  154. </tbody> 
  155. </table> 
  156. </fieldset> 
  157. --> 
  158. <table class="form-table"> 
  159. <tbody> 
  160. <tr valign="top"> 
  161. <th scope="row"><?php _e('Default Language', 'google-document-embedder'); ?></th> 
  162. <td> 
  163. <select name="language" id="language"> 
  164. <?php 
  165. require_once( GDE_PLUGIN_DIR . 'libs/lib-langs.php' ); 
  166. $langs = gde_supported_langs(); 
  167.  
  168. foreach ( $langs as $code => $desc ) { 
  169. gde_profile_option( $p['language'], $code, $desc ); 
  170. ?> 
  171. </select><br/> 
  172. <span class="gde-fnote"><?php _e('Language of toolbar button tips', 'google-document-embedder'); ?></span> 
  173. </td> 
  174. </tr> 
  175. <tr valign="top"> 
  176. <th scope="row"><?php _e('Default Size', 'google-document-embedder'); ?></th> 
  177. <td> 
  178.  <?php _e('Width', 'google-document-embedder'); ?>  
  179. <?php 
  180. gde_profile_text( $p['default_width'], 'default_width', '', '5' ); 
  181. ?> 
  182.     <?php _e('Height', 'google-document-embedder'); ?>  
  183. <?php 
  184. gde_profile_text( $p['default_height'], 'default_height', '', '5' ); 
  185. ?> 
  186. <br/> 
  187. <span class="gde-fnote"><?php _e('Enter as pixels or percentage (example: 500px or 100%)', 'google-document-embedder'); ?></span> 
  188. </td> 
  189. </tr> 
  190. <tr valign="top"> 
  191. <th scope="row"><?php _e('File Base URL', 'google-document-embedder'); ?></th> 
  192. <td> 
  193. <?php 
  194. gde_profile_text( $p['base_url'], 'base_url', '', '65' ); 
  195. ?> 
  196. <br/> 
  197. <span class="gde-fnote"><?php _e('Any file not starting with <code>http</code> will be prefixed by this value', 'google-document-embedder'); ?></span> 
  198. </td> 
  199. </tr> 
  200. <tr valign="top"> 
  201. <th scope="row"><?php _e('Download Link', 'google-document-embedder'); ?></th> 
  202. <td> 
  203. <select name="link_show" id="link_show"> 
  204. <?php 
  205. gde_profile_option( $p['link_show'], 'all', __('All Users', 'google-document-embedder'), __('Download link visible to everyone by default', 'google-document-embedder') ); 
  206. gde_profile_option( $p['link_show'], 'users', __('Logged-in Users', 'google-document-embedder'), __('Download link visible to logged-in users', 'google-document-embedder') ); 
  207. gde_profile_option( $p['link_show'], 'none', __('None', 'google-document-embedder'), __('Download link is not visible by default', 'google-document-embedder') ); 
  208. ?> 
  209. </select><br/> 
  210. <span class="gde-fnote" id="linkshow-h"></span> 
  211. </td> 
  212. </tr> 
  213. <tr valign="top" id="linktext"> 
  214. <th scope="row"><?php _e('Link Text', 'google-document-embedder'); ?></th> 
  215. <td> 
  216. <input size="50" name="link_text" value="<?php echo esc_attr($p['link_text']); ?>" type="text"><br/> 
  217. <span class="gde-fnote"><?php _e('You can further customize text using these dynamic replacements:', 'google-document-embedder'); ?></span><br> 
  218. <code>%FILE</code> : <?php _e('filename', 'google-document-embedder'); ?>     
  219. <code>%TYPE</code> : <?php _e('file type', 'google-document-embedder'); ?>     
  220. <code>%SIZE</code> : <?php _e('file size', 'google-document-embedder'); ?> 
  221. </td> 
  222. </tr> 
  223. <tr valign="top" id="linkpos"> 
  224. <th scope="row"><?php _e('Link Position', 'google-document-embedder'); ?></th> 
  225. <td> 
  226. <select name="link_pos"> 
  227. <?php 
  228. gde_profile_option( $p['link_pos'], 'above', __('Above Viewer', 'google-document-embedder') ); 
  229. gde_profile_option( $p['link_pos'], 'below', __('Below Viewer', 'google-document-embedder') ); 
  230. ?> 
  231. </select> 
  232. </td> 
  233. </tr> 
  234. <tr valign="top" id="linkbehavior"> 
  235. <th scope="row"><?php _e('Link Behavior', 'google-document-embedder'); ?></th> 
  236. <td> 
  237. <?php 
  238. gde_profile_checkbox( $p['link_force'], 'force', __('Force download (bypass browser plugins)', 'google-document-embedder'), 'linkforce', 1 ); 
  239. //gde_profile_checkbox( $p['link_mask'], 'mask', __('Shorten URL', 'google-document-embedder'), 'linkmask', 1 ); 
  240. ?> 
  241. </td> 
  242. </tr> 
  243. </tbody> 
  244. </table> 
  245.  
  246. <p class="gde-submit"> 
  247. <input id="pro-submit" class="button-primary" type="submit" value="<?php _e('Save Changes', 'google-document-embedder'); ?>" name="submit"> 
  248. </p> 
  249.  
  250. </form> 
  251.  
  252. </div> 
  253.  
  254. <?php