SZGoogleAdminAuthenticator

The SZ - Google SZGoogleAdminAuthenticator class.

Defined (1)

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

/admin/classes/SZGoogleAdminAuthenticator.php  
  1. class SZGoogleAdminAuthenticator extends SZGoogleAdmin 
  2. /** 
  3. * Creating the menu on the admin panel using values ** 
  4. * such as configuration variables object (parent function) 
  5. */ 
  6.  
  7. function moduleAddMenu() 
  8. // Definition of general values **for the creation of a menu associated  
  9. // with the module options. Example slug, page title and menu title 
  10.  
  11. $this->menuslug = 'sz-google-admin-authenticator.php'; 
  12. $this->pagetitle = ucwords(__('google authenticator', 'szgoogleadmin')); 
  13. $this->menutitle = ucwords(__('google authenticator', 'szgoogleadmin')); 
  14.  
  15. // Definition of sections that need to be made **in HTML 
  16. // sections must be passed as an array of name = > title 
  17.  
  18. $this->sectionstabs = array( 
  19. '01' => array('anchor' => 'general' , 'description' => __('general', 'szgoogleadmin')),  
  20. ); 
  21.  
  22. $this->sections = array( 
  23. array('tab' => '01', 'section' => 'sz-google-admin-authenticator.php' , 'title' => ucwords(__('settings', 'szgoogleadmin'))),  
  24. array('tab' => '01', 'section' => 'sz-google-admin-authenticator-emergency.php', 'title' => ucwords(__('emergency file', 'szgoogleadmin'))),  
  25. ); 
  26.  
  27. $this->sectionstitle = $this->menutitle; 
  28. $this->sectionsoptions = array('sz_google_options_authenticator'); 
  29.  
  30. // Calling up the function of the parent class to process the  
  31. // variables that contain the values **of configuration section 
  32.  
  33. parent::moduleAddMenu(); 
  34.  
  35. /** 
  36. * Function to add sections and the corresponding options in the configuration 
  37. * page, each option belongs to a section, which is linked to a general tab  
  38. */ 
  39.  
  40. function moduleAddFields() 
  41. // General definition array containing a list of sections 
  42. // On every section you have to define an array to list fields 
  43.  
  44. $this->sectionsmenu = array( 
  45. '01' => array('section' => 'sz_google_authenticator_enabled' , 'title' => $this->null, 'callback' => $this->callbacksection, 'slug' => 'sz-google-admin-authenticator.php'),  
  46. '02' => array('section' => 'sz_google_authenticator_emergency', 'title' => $this->null, 'callback' => $this->callbacksection, 'slug' => 'sz-google-admin-authenticator-emergency.php'),  
  47. ); 
  48.  
  49. // General definition array containing a list of fields 
  50. // All fields are added to the previously defined sections 
  51.  
  52. $this->sectionsfields = array( 
  53. '01' => array(array('field' => 'authenticator_login_enable' , 'title' => ucfirst(__('enable' , 'szgoogleadmin')), 'callback' => array($this, 'callback_authenticator_login_enable')),  
  54. array('field' => 'authenticator_discrepancy' , 'title' => ucfirst(__('discrepancy' , 'szgoogleadmin')), 'callback' => array($this, 'callback_authenticator_discrepancy')), ),  
  55. '02' => array(array('field' => 'authenticator_emergency_codes', 'title' => ucfirst(__('emergency codes' , 'szgoogleadmin')), 'callback' => array($this, 'callback_authenticator_emergency_codes')),  
  56. array('field' => 'authenticator_emergency' , 'title' => ucfirst(__('emergency enable', 'szgoogleadmin')), 'callback' => array($this, 'callback_authenticator_emergency_enable')),  
  57. array('field' => 'authenticator_emergency_file' , 'title' => ucfirst(__('emergency file' , 'szgoogleadmin')), 'callback' => array($this, 'callback_authenticator_emergency_file')), ),  
  58. ); 
  59.  
  60. // Calling up the function of the parent class to process the  
  61. // variables that contain the values **of configuration section 
  62.  
  63. parent::moduleAddFields(); 
  64.  
  65. /** 
  66. * Definition functions for the creation of the various options that should be included  
  67. * in the general form of configuration and saved on a database of wordpress (options)  
  68. */ 
  69.  
  70. function callback_authenticator_login_enable()  
  71. {  
  72. $this->moduleCommonFormCheckboxYesNo('sz_google_options_authenticator', 'authenticator_login_enable'); 
  73. $this->moduleCommonFormDescription(__('enable this option to integrate the control of google authenticator in login panel. Deactivation is used to implement login with PHP functions in the case has been heavily customized. See online documentation for more details.', 'szgoogleadmin')); 
  74.  
  75. /** 
  76. * Definition functions for the creation of the various options that should be included  
  77. * in the general form of configuration and saved on a database of wordpress (options)  
  78. */ 
  79.  
  80. function callback_authenticator_discrepancy()  
  81. {  
  82. $values = array( 
  83. '1' => __('30 seconds', 'szgoogleadmin'),  
  84. '2' => __('1 Minutes' , 'szgoogleadmin'),  
  85. '4' => __('2 Minutes' , 'szgoogleadmin'),  
  86. '6' => __('3 Minutes' , 'szgoogleadmin'),  
  87. '8' => __('4 Minutes' , 'szgoogleadmin'),  
  88. '10' => __('5 Minutes' , 'szgoogleadmin') 
  89. );  
  90.  
  91. $this->moduleCommonFormSelect('sz_google_options_authenticator', 'authenticator_discrepancy', $values, 'medium', ''); 
  92. $this->moduleCommonFormDescription(__('indicate time of discrepancy that should be used by the plugin. This value indicates the time of tolerance that is applied to the generation of the authenticator code with respect to time auto-generation. Default value is 30 seconds.', 'szgoogleadmin')); 
  93.  
  94. /** 
  95. * Definition functions for the creation of the various options that should be included  
  96. * in the general form of configuration and saved on a database of wordpress (options)  
  97. */ 
  98.  
  99. function callback_authenticator_emergency_codes()  
  100. {  
  101. $this->moduleCommonFormCheckboxYesNo('sz_google_options_authenticator', 'authenticator_emergency_codes'); 
  102. $this->moduleCommonFormDescription(__('Enable this option to manage the emergency codes. Are of backup codes that can be used in case of emergency, for example, when our smartphones is inoperable or have problems on-time password. Each code can be used only once.', 'szgoogleadmin')); } 
  103.  
  104. function callback_authenticator_emergency_enable()  
  105. {  
  106. $this->moduleCommonFormCheckboxYesNo('sz_google_options_authenticator', 'authenticator_emergency'); 
  107. $this->moduleCommonFormDescription(__('Enable this option to manage the files of an emergency. With this option enabled you can disable the authenticator will be sending in FTP a file in the root directory of wordpress. The file name is specified in the next field.', 'szgoogleadmin')); 
  108.  
  109. function callback_authenticator_emergency_file()  
  110. {  
  111. $this->moduleCommonFormText('sz_google_options_authenticator', 'authenticator_emergency_file', 'large', __('google-authenticator-disable.php', 'szgoogleadmin')); 
  112. $this->moduleCommonFormDescription(__('Indicates the name of the file to be used for the emergency function. If the file specified in this field is found on the root of the wordpress function authenticator is temporarily suspended. Default name is <b>google-authenticator-disable.php<b/>.', 'szgoogleadmin'));