SZGoogleAdminDocumentation

The SZ - Google SZGoogleAdminDocumentation class.

Defined (1)

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

/admin/classes/SZGoogleAdminDocumentation.php  
  1. class SZGoogleAdminDocumentation extends SZGoogleAdmin 
  2. /** 
  3. * Definition of variables that contain the configurations 
  4. * to be applied to various processing of the current class 
  5. */ 
  6.  
  7. protected $HelpIndexItems = ''; 
  8.  
  9. /** 
  10. * Creating the menu on the admin panel using values ** 
  11. * such as configuration variables object (parent function) 
  12. */ 
  13.  
  14. function moduleAddMenu() 
  15. // Definition of general values **for the creation of a menu associated  
  16. // with the module options. Example slug, page title and menu title 
  17.  
  18. $this->menuslug = 'sz-google-admin-documentation.php'; 
  19. $this->pagetitle = ucwords(__('documentation', 'szgoogleadmin')); 
  20. $this->menutitle = ucwords(__('documentation', 'szgoogleadmin')); 
  21.  
  22. // Definition of sections that need to be made **in HTML 
  23. // sections must be passed as an array of name = > title 
  24.  
  25. $this->sectionstabs = array( 
  26. '01' => array('anchor' => 'general', 'description' => __('general', 'szgoogleadmin')),  
  27. '02' => array('anchor' => 'reviews', 'description' => __('reviews', 'szgoogleadmin')),  
  28. '03' => array('anchor' => 'modules', 'description' => __('modules', 'szgoogleadmin')),  
  29. ); 
  30.  
  31. $this->sections = array( 
  32. array('tab' => '01', 'section' => 'sz-google-admin-documentation-gplus.php' , 'title' => ucwords(__('google+', 'szgoogleadmin'))),  
  33. array('tab' => '01', 'section' => 'sz-google-admin-documentation-analytics.php' , 'title' => ucwords(__('google analytics', 'szgoogleadmin'))),  
  34. array('tab' => '01', 'section' => 'sz-google-admin-documentation-authenticator.php', 'title' => ucwords(__('google authenticator', 'szgoogleadmin'))),  
  35. array('tab' => '01', 'section' => 'sz-google-admin-documentation-calendar.php' , 'title' => ucwords(__('google calendar', 'szgoogleadmin'))),  
  36. array('tab' => '01', 'section' => 'sz-google-admin-documentation-drive.php' , 'title' => ucwords(__('google drive', 'szgoogleadmin'))),  
  37. array('tab' => '01', 'section' => 'sz-google-admin-documentation-groups.php' , 'title' => ucwords(__('google groups', 'szgoogleadmin'))),  
  38. array('tab' => '01', 'section' => 'sz-google-admin-documentation-hangouts.php' , 'title' => ucwords(__('google hangouts', 'szgoogleadmin'))),  
  39. array('tab' => '01', 'section' => 'sz-google-admin-documentation-panoramio.php' , 'title' => ucwords(__('google panoramio', 'szgoogleadmin'))),  
  40. array('tab' => '01', 'section' => 'sz-google-admin-documentation-translate.php' , 'title' => ucwords(__('google translate', 'szgoogleadmin'))),  
  41. array('tab' => '01', 'section' => 'sz-google-admin-documentation-youtube.php' , 'title' => ucwords(__('youtube', 'szgoogleadmin'))),  
  42. array('tab' => '02', 'section' => 'sz-google-admin-documentation-reviews.php' , 'title' => ucwords(__('reviews', 'szgoogleadmin'))),  
  43. array('tab' => '03', 'section' => 'sz-google-admin-documentation-modules.php' , 'title' => ucwords(__('modules', 'szgoogleadmin'))),  
  44. ); 
  45.  
  46. $this->formsavebutton = '0'; 
  47. $this->sectionstitle = $this->menutitle; 
  48. $this->sectionsoptions = array('sz_google_options_documentation'); 
  49.  
  50. // Calling up the function of the parent class to process the  
  51. // variables that contain the values **of configuration section 
  52.  
  53. parent::moduleAddMenu(); 
  54.  
  55. // Definition array containing the main structure of the documentation 
  56. // Creating index of documentation for the composition of the navigator 
  57.  
  58. $this->HelpIndexItems = array( 
  59. array('slug'=>'sz-google-help-plus-author.php' , 'title'=>__('google+ badge author' , 'szgoogleadmin')),  
  60. array('slug'=>'sz-google-help-plus-profile.php' , 'title'=>__('google+ badge profile' , 'szgoogleadmin')),  
  61. array('slug'=>'sz-google-help-plus-page.php' , 'title'=>__('google+ badge page' , 'szgoogleadmin')),  
  62. array('slug'=>'sz-google-help-plus-community.php' , 'title'=>__('google+ badge community' , 'szgoogleadmin')),  
  63. array('slug'=>'sz-google-help-plus-plusone.php' , 'title'=>__('google+ button +1' , 'szgoogleadmin')),  
  64. array('slug'=>'sz-google-help-plus-share.php' , 'title'=>__('google+ button share' , 'szgoogleadmin')),  
  65. array('slug'=>'sz-google-help-plus-follow.php' , 'title'=>__('google+ button follow' , 'szgoogleadmin')),  
  66. array('slug'=>'sz-google-help-plus-comments.php' , 'title'=>__('google+ widget comments' , 'szgoogleadmin')),  
  67. array('slug'=>'sz-google-help-plus-post.php' , 'title'=>__('google+ embedded post' , 'szgoogleadmin')),  
  68. array('slug'=>'sz-google-help-plus-followers.php' , 'title'=>__('google+ badge followers' , 'szgoogleadmin')),  
  69. array('slug'=>'sz-google-help-plus-author-publisher.php' , 'title'=>__('google+ author & publisher', 'szgoogleadmin')),  
  70. array('slug'=>'sz-google-help-plus-redirect.php' , 'title'=>__('google+ redirect' , 'szgoogleadmin')),  
  71. array('slug'=>'sz-google-help-plus-recommendations.php' , 'title'=>__('google+ recommendations' , 'szgoogleadmin')),  
  72. array('slug'=>'sz-google-help-ga-setup.php' , 'title'=>__('analytics setup' , 'szgoogleadmin')),  
  73. array('slug'=>'sz-google-help-ga-functions.php' , 'title'=>__('analytics PHP functions' , 'szgoogleadmin')),  
  74. array('slug'=>'sz-google-help-authenticator-setup.php' , 'title'=>__('authenticator setup' , 'szgoogleadmin')),  
  75. array('slug'=>'sz-google-help-authenticator-functions.php', 'title'=>__('authenticator PHP' , 'szgoogleadmin')),  
  76. array('slug'=>'sz-google-help-authenticator-device.php' , 'title'=>__('authenticator device' , 'szgoogleadmin')),  
  77. array('slug'=>'sz-google-help-calendar.php' , 'title'=>__('widget calendar' , 'szgoogleadmin')),  
  78. array('slug'=>'sz-google-help-drive-embed.php' , 'title'=>__('drive embed' , 'szgoogleadmin')),  
  79. array('slug'=>'sz-google-help-drive-viewer.php' , 'title'=>__('drive viewer' , 'szgoogleadmin')),  
  80. array('slug'=>'sz-google-help-drive-save.php' , 'title'=>__('drive save button' , 'szgoogleadmin')),  
  81. array('slug'=>'sz-google-help-groups.php' , 'title'=>__('widget groups' , 'szgoogleadmin')),  
  82. array('slug'=>'sz-google-help-hangout-start.php' , 'title'=>__('hangout start button' , 'szgoogleadmin')),  
  83. array('slug'=>'sz-google-help-panoramio.php' , 'title'=>__('widget panoramio' , 'szgoogleadmin')),  
  84. array('slug'=>'sz-google-help-translate.php' , 'title'=>__('translate setup' , 'szgoogleadmin')),  
  85. array('slug'=>'sz-google-help-translate-functions.php' , 'title'=>__('translate PHP functions' , 'szgoogleadmin')),  
  86. array('slug'=>'sz-google-help-youtube-video.php' , 'title'=>__('youtube video' , 'szgoogleadmin')),  
  87. array('slug'=>'sz-google-help-youtube-playlist.php' , 'title'=>__('youtube playlist' , 'szgoogleadmin')),  
  88. array('slug'=>'sz-google-help-youtube-badge.php' , 'title'=>__('youtube badge' , 'szgoogleadmin')),  
  89. array('slug'=>'sz-google-help-youtube-link.php' , 'title'=>__('youtube link' , 'szgoogleadmin')),  
  90. array('slug'=>'sz-google-help-youtube-button.php' , 'title'=>__('youtube button' , 'szgoogleadmin')),  
  91. ); 
  92.  
  93. /** 
  94. * Function to add sections and the corresponding options in the configuration 
  95. * page, each option belongs to a section, which is linked to a general tab  
  96. */ 
  97.  
  98. function moduleAddFields() 
  99. // General definition array containing a list of sections 
  100. // On every section you have to define an array to list fields 
  101.  
  102. $this->sectionsmenu = array( 
  103. '01' => array('section' => 'sz_google_documentation_gplus' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpPlus') , 'slug' => 'sz-google-admin-documentation-gplus.php'),  
  104. '02' => array('section' => 'sz_google_documentation_analytics' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpAnalytics') , 'slug' => 'sz-google-admin-documentation-analytics.php'),  
  105. '03' => array('section' => 'sz_google_documentation_authenticator', 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpAuthenticator'), 'slug' => 'sz-google-admin-documentation-authenticator.php'),  
  106. '04' => array('section' => 'sz_google_documentation_calendar' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpCalendar') , 'slug' => 'sz-google-admin-documentation-calendar.php'),  
  107. '05' => array('section' => 'sz_google_documentation_drive' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpDriveSave') , 'slug' => 'sz-google-admin-documentation-drive.php'),  
  108. '06' => array('section' => 'sz_google_documentation_groups' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpGroups') , 'slug' => 'sz-google-admin-documentation-groups.php'),  
  109. '07' => array('section' => 'sz_google_documentation_hangouts' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpHangouts') , 'slug' => 'sz-google-admin-documentation-hangouts.php'),  
  110. '08' => array('section' => 'sz_google_documentation_panoramio' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpPanoramio') , 'slug' => 'sz-google-admin-documentation-panoramio.php'),  
  111. '09' => array('section' => 'sz_google_documentation_translate' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpTranslate') , 'slug' => 'sz-google-admin-documentation-translate.php'),  
  112. '10' => array('section' => 'sz_google_documentation_youtube' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpYoutube') , 'slug' => 'sz-google-admin-documentation-youtube.php'),  
  113. '11' => array('section' => 'sz_google_documentation_reviews' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpReviews') , 'slug' => 'sz-google-admin-documentation-reviews.php'),  
  114. '12' => array('section' => 'sz_google_documentation_modules' , 'title' => $this->null, 'callback' => array($this, 'moduleAddHelpModules') , 'slug' => 'sz-google-admin-documentation-modules.php'),  
  115. ); 
  116.  
  117. // Calling up the function of the parent class to process the  
  118. // variables that contain the values **of configuration section 
  119.  
  120. parent::moduleAddFields(); 
  121.  
  122. /** 
  123. * Call the general function for the creation of the general form 
  124. * sections must be passed as an array of name = > title 
  125. */ 
  126.  
  127. function moduleCallback() 
  128. // Check if you specify a section of the help documentation 
  129. // in the directory of the file and if it is existing 
  130.  
  131. if (isset($_GET['help']))  
  132. $LANGUAGE = get_bloginfo('language'); 
  133. $FILENAM1 = dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/help/'.$LANGUAGE.'/'.trim($_GET['help']); 
  134. $FILENAM2 = dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/help/'.substr($LANGUAGE, 0, 2).'/'.trim($_GET['help']); 
  135. $FILENAM3 = dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/help/en/'.trim($_GET['help']); 
  136.  
  137. if (is_readable($FILENAM1)) { @include($FILENAM1); return; } 
  138. if (is_readable($FILENAM2)) { @include($FILENAM2); return; } 
  139. if (is_readable($FILENAM3)) { @include($FILENAM3); return; } 
  140.  
  141. // If you can not find any specific 
  142. // documentation files is called the main page 
  143.  
  144. parent::moduleCallback(); 
  145.  
  146. /** 
  147. * Function to add the icons section with arrays containing 
  148. * the slug of the link and the title of the document 
  149. */ 
  150.  
  151. function moduleAddHelpLinks($options) 
  152. echo '<div class="help-index">'; 
  153.  
  154. foreach ($options as $key => $value)  
  155. echo '<div class="help-items">'; 
  156. echo '<div class="help-image"><a href="'.menu_page_url($this->menuslug, false).'&help='.$value['slug'].'"><img src="'.plugin_dir_url(SZ_PLUGIN_GOOGLE_MAIN).'admin/files/images/help/'.basename($value['slug'], ".php").'.jpg" alt=""></a></div>'; 
  157. echo '<div class="help-title"><a href="'.menu_page_url($this->menuslug, false).'&help='.$value['slug'].'">'.ucwords($value['title']).'</a></div>'; 
  158. echo '</div>'; 
  159.  
  160. echo '</div>'; 
  161.  
  162. /** 
  163. * Functions to add the various sections with the index 
  164. * for icons of the documents module GOOGLE PLUS 
  165. */ 
  166.  
  167. function moduleAddHelpPlus() 
  168. $this->moduleAddHelpLinks(array( 
  169. array('slug'=>'sz-google-help-plus-author.php' , 'title'=>__('badge author', 'szgoogleadmin')),  
  170. array('slug'=>'sz-google-help-plus-profile.php' , 'title'=>__('badge profile', 'szgoogleadmin')),  
  171. array('slug'=>'sz-google-help-plus-page.php' , 'title'=>__('badge page', 'szgoogleadmin')),  
  172. array('slug'=>'sz-google-help-plus-community.php' , 'title'=>__('badge community', 'szgoogleadmin')),  
  173. array('slug'=>'sz-google-help-plus-plusone.php' , 'title'=>__('button +1', 'szgoogleadmin')),  
  174. array('slug'=>'sz-google-help-plus-share.php' , 'title'=>__('button share', 'szgoogleadmin')),  
  175. array('slug'=>'sz-google-help-plus-follow.php' , 'title'=>__('button follow', 'szgoogleadmin')),  
  176. array('slug'=>'sz-google-help-plus-comments.php' , 'title'=>__('widget comments', 'szgoogleadmin')),  
  177. array('slug'=>'sz-google-help-plus-post.php' , 'title'=>__('embedded post', 'szgoogleadmin')),  
  178. array('slug'=>'sz-google-help-plus-followers.php' , 'title'=>__('badge followers', 'szgoogleadmin')),  
  179. array('slug'=>'sz-google-help-plus-author-publisher.php' , 'title'=>__('author & publisher', 'szgoogleadmin')),  
  180. array('slug'=>'sz-google-help-plus-redirect.php' , 'title'=>__('redirect +', 'szgoogleadmin')),  
  181. array('slug'=>'sz-google-help-plus-recommendations.php' , 'title'=>__('recommendations', 'szgoogleadmin')),  
  182. )); 
  183.  
  184. /** 
  185. * Functions to add the various sections with the index 
  186. * for icons of the documents module GOOGLE ANALYTICS 
  187. */ 
  188.  
  189. function moduleAddHelpAnalytics() 
  190. $this->moduleAddHelpLinks(array( 
  191. array('slug'=>'sz-google-help-ga-setup.php' , 'title'=>__('analytics setup', 'szgoogleadmin')),  
  192. array('slug'=>'sz-google-help-ga-functions.php', 'title'=>__('analytics PHP functions', 'szgoogleadmin')),  
  193. )); 
  194.  
  195. /** 
  196. * Functions to add the various sections with the index 
  197. * for icons of the documents module GOOGLE AUTHENTICATOR 
  198. */ 
  199.  
  200. function moduleAddHelpAuthenticator() 
  201. $this->moduleAddHelpLinks(array( 
  202. array('slug'=>'sz-google-help-authenticator-setup.php' , 'title'=>__('authenticator setup', 'szgoogleadmin')),  
  203. array('slug'=>'sz-google-help-authenticator-functions.php', 'title'=>__('authenticator PHP', 'szgoogleadmin')),  
  204. array('slug'=>'sz-google-help-authenticator-device.php' , 'title'=>__('authenticator device', 'szgoogleadmin')),  
  205. )); 
  206.  
  207. /** 
  208. * Functions to add the various sections with the index 
  209. * for icons of the documents module GOOGLE CALENDAR 
  210. */ 
  211.  
  212. function moduleAddHelpCalendar() 
  213. $this->moduleAddHelpLinks(array( 
  214. array('slug'=>'sz-google-help-calendar.php', 'title'=>__('widget calendar', 'szgoogleadmin')),  
  215. )); 
  216.  
  217. /** 
  218. * Functions to add the various sections with the index 
  219. * for icons of the documents module GOOGLE DRIVE 
  220. */ 
  221.  
  222. function moduleAddHelpDriveSave() 
  223. $this->moduleAddHelpLinks(array( 
  224. array('slug'=>'sz-google-help-drive-embed.php' , 'title'=>__('drive embed', 'szgoogleadmin')),  
  225. array('slug'=>'sz-google-help-drive-viewer.php', 'title'=>__('drive viewer', 'szgoogleadmin')),  
  226. array('slug'=>'sz-google-help-drive-save.php' , 'title'=>__('drive save button', 'szgoogleadmin')),  
  227. )); 
  228.  
  229. /** 
  230. * Functions to add the various sections with the index 
  231. * for icons of the documents module GOOGLE GROUPS 
  232. */ 
  233.  
  234. function moduleAddHelpGroups() 
  235. $this->moduleAddHelpLinks(array( 
  236. array('slug'=>'sz-google-help-groups.php', 'title'=>__('widget groups', 'szgoogleadmin')),  
  237. )); 
  238.  
  239. /** 
  240. * Functions to add the various sections with the index 
  241. * for icons of the documents module GOOGLE HANGOUTS 
  242. */ 
  243.  
  244. function moduleAddHelpHangouts() 
  245. $this->moduleAddHelpLinks(array( 
  246. array('slug'=>'sz-google-help-hangout-start.php', 'title'=>__('hangout start button', 'szgoogleadmin')),  
  247. )); 
  248.  
  249. /** 
  250. * Functions to add the various sections with the index 
  251. * for icons of the documents module GOOGLE PANORAMIO 
  252. */ 
  253.  
  254. function moduleAddHelpPanoramio() 
  255. $this->moduleAddHelpLinks(array( 
  256. array('slug'=>'sz-google-help-panoramio.php', 'title'=>__('widget panoramio', 'szgoogleadmin')),  
  257. )); 
  258.  
  259. /** 
  260. * Functions to add the various sections with the index 
  261. * for icons of the documents module GOOGLE TRANSLATE 
  262. */ 
  263.  
  264. function moduleAddHelpTranslate() 
  265. $this->moduleAddHelpLinks(array( 
  266. array('slug'=>'sz-google-help-translate.php' , 'title'=>__('translate setup', 'szgoogleadmin')),  
  267. array('slug'=>'sz-google-help-translate-functions.php', 'title'=>__('translate PHP functions', 'szgoogleadmin')),  
  268. )); 
  269.  
  270. /** 
  271. * Functions to add the various sections with the index 
  272. * for icons of the documents module GOOGLE YOUTUBE 
  273. */ 
  274.  
  275. function moduleAddHelpYoutube() 
  276. $this->moduleAddHelpLinks(array( 
  277. array('slug'=>'sz-google-help-youtube-video.php' , 'title'=>__('youtube video' , 'szgoogleadmin')),  
  278. array('slug'=>'sz-google-help-youtube-playlist.php', 'title'=>__('youtube playlist', 'szgoogleadmin')),  
  279. array('slug'=>'sz-google-help-youtube-badge.php' , 'title'=>__('youtube badge' , 'szgoogleadmin')),  
  280. array('slug'=>'sz-google-help-youtube-link.php' , 'title'=>__('youtube link' , 'szgoogleadmin')),  
  281. array('slug'=>'sz-google-help-youtube-button.php' , 'title'=>__('youtube button' , 'szgoogleadmin')),  
  282. )); 
  283.  
  284. /** 
  285. * Function to add the various sections on tabs reviews 
  286. * present in the official documentation of the plugin 
  287. */ 
  288.  
  289. function moduleAddHelpReviews() { 
  290. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/templates/sz-google-template-reviews.php'); 
  291.  
  292. /** 
  293. * Function to add the various sections on tabs modules 
  294. * present in the official documentation of the plugin 
  295. */ 
  296.  
  297. function moduleAddHelpModules() { 
  298. @include(dirname(SZ_PLUGIN_GOOGLE_MAIN).'/admin/templates/sz-google-template-modules.php'); 
  299.  
  300. /** 
  301. * Call the general function for the creation of the general form 
  302. * sections must be passed as an array of name = > title 
  303. */ 
  304.  
  305. function moduleAddNavs($name) 
  306. // Calculating the keys to elements in the array  
  307. // that correspond to the current, previous and next 
  308.  
  309. $KeyPrecedente = false; 
  310. $KeyAttuale = false; 
  311. $KeySeguente = false; 
  312.  
  313. foreach ($this->HelpIndexItems as $key => $value) { 
  314. if($value['slug'] == $name) { 
  315. $KeyAttuale = $key; break; 
  316.  
  317. if ($KeyAttuale > 0) $KeyPrecedente = $KeyAttuale - 1; 
  318. if ($KeyAttuale < (count($this->HelpIndexItems)-1)) $KeySeguente = $KeyAttuale + 1; 
  319.  
  320. // Creating a link to the previous and next 
  321. // Create HTML for the browser to help index 
  322.  
  323. $LINKPREV = ''; $LINKNEXT = ''; 
  324.  
  325. if ($KeyPrecedente !== false) $LINKPREV = '<a href="'.menu_page_url($this->menuslug, false).'&help='.$this->HelpIndexItems[$KeyPrecedente]['slug'].'""><-- '.ucfirst($this->HelpIndexItems[$KeyPrecedente]['title']).'</a>'; 
  326. if ($KeySeguente !== false) $LINKNEXT = '<a href="'.menu_page_url($this->menuslug, false).'&help='.$this->HelpIndexItems[$KeySeguente]['slug'].'"">'.ucfirst($this->HelpIndexItems[$KeySeguente]['title']).' --></a>'; 
  327.  
  328. $HTML = '<div class="navs">'; 
  329. $HTML .= '<div class="prev">'.$LINKPREV.'</div>'; 
  330. $HTML .= '<div class="capo"><a href="'.menu_page_url($this->menuslug, false).'">'.$this->pagetitle.'</a></div>'; 
  331. $HTML .= '<div class="next">'.$LINKNEXT.'</div>'; 
  332. $HTML .= '</div>'; 
  333.  
  334. return $HTML; 
  335.  
  336. /** 
  337. * Call the general function for the creation of the general form 
  338. * sections must be passed as an array of name = > title 
  339. */ 
  340.  
  341. function moduleCommonFormHelp($title, $setting, $sections, $formsavebutton, $HTML, $slug) 
  342. $NAVS = $this->moduleAddNavs($slug); 
  343. $HTML = $NAVS.$HTML.$NAVS; 
  344. $this->moduleCommonForm($title, $setting, $sections, $formsavebutton, $HTML);