Ejemplo n.º 1
0
 /**
  * Gather and generate the information required globally by all the template files.
  *
  * @param  array $params A hash containing the pseudo-variable name as the key and the value that will replace it.
  * @return array         A complementary list of pseudo-variables for the template files.
  */
 private static function shared_params($params = array())
 {
     $params = is_array($params) ? $params : array();
     // Base parameters, required to render all the pages.
     $params = self::links_and_navbar($params);
     // Global parameters, used through out all the pages.
     $params['PageTitle'] = isset($params['PageTitle']) ? '(' . $params['PageTitle'] . ')' : '';
     $params['PageNonce'] = wp_create_nonce('sucuriscan_page_nonce');
     $params['PageStyleClass'] = isset($params['PageStyleClass']) ? $params['PageStyleClass'] : 'base';
     $params['CleanDomain'] = self::get_domain();
     $params['AdminEmails'] = '';
     // Get a list of admin users for the API key generation.
     if (SucuriScanAPI::get_plugin_key() === false) {
         $admin_users = SucuriScan::get_users_for_api_key();
         $params['AdminEmails'] = self::get_select_options($admin_users);
     }
     // Hide the advertisements from the layout.
     if (SucuriScanOption::is_disabled(':ads_visibility')) {
         $params['LayoutType'] = 'onecolumn';
         $params['AdsVisibility'] = 'hidden';
         $params['ReviewNavbarButton'] = 'visible';
         $params['PageSidebarContent'] = '';
     } else {
         $params['LayoutType'] = 'twocolumns';
         $params['AdsVisibility'] = 'visible';
         $params['ReviewNavbarButton'] = 'hidden';
         $params['PageSidebarContent'] = self::get_template('bsidebar', $params, 'section');
     }
     return $params;
 }