function get_section_loop_data($records, $tokens, $section)
 {
     $convert_context_name = array('comment' => 'comments', 'plugin' => 'plugins', 'profile' => 'profiles', 'session' => 'sessions', 'setting' => 'settings', 'theme' => 'themes', 'posts' => 'post', 'pages' => 'page', 'widget' => 'widgets', 'menu' => 'menus', 'backups' => 'mainwp_backups', 'backup' => 'mainwp_backups', 'sucuri' => 'mainwp_sucuri');
     $convert_action_name = array('restored' => 'untrashed', 'spam' => 'spammed', 'backup' => 'mainwp_backup');
     $some_allowed_data = array('name', 'title', 'oldversion', 'currentversion', 'date', 'count', 'author', 'old.version', 'current.version');
     $context = $action = '';
     $str_tmp = str_replace(array('[', ']'), '', $section);
     $array_tmp = explode('.', $str_tmp);
     if (is_array($array_tmp)) {
         if (2 === count($array_tmp)) {
             list($str1, $context) = $array_tmp;
         } else {
             if (3 === count($array_tmp)) {
                 list($str1, $context, $action) = $array_tmp;
             }
         }
     }
     $context = isset($convert_context_name[$context]) ? $convert_context_name[$context] : $context;
     $action = isset($convert_action_name[$action]) ? $convert_action_name[$action] : $action;
     $loops = array();
     $loop_count = 0;
     foreach ($records as $record) {
         $theme_edited = $users_updated = $plugin_edited = false;
         if ($plugin_edited) {
             // ok next
         } else {
             if ('themes' === $context && 'edited' === $action) {
                 if ($record->action !== 'updated' || $record->connector !== 'editor') {
                     continue;
                 } else {
                     $theme_edited = true;
                 }
             } else {
                 if ('users' === $context && 'updated' === $action) {
                     if ($record->context !== 'profiles' || $record->connector !== 'users') {
                         continue;
                     } else {
                         $users_updated = true;
                     }
                 } else {
                     if ('mainwp_backups' === $context) {
                         if ($record->context !== 'mainwp_backups' && $record->context !== 'updraftplus_backups' && $record->context !== 'backupwordpress_backups') {
                             continue;
                         }
                     } else {
                         if ('mainwp_sucuri' === $context) {
                             if ($record->context !== 'mainwp_sucuri') {
                                 continue;
                             }
                         } else {
                             if ($action !== $record->action) {
                                 continue;
                             }
                             if ('comments' === $context && 'comments' !== $record->connector) {
                                 continue;
                             } else {
                                 if ('media' === $context && 'media' !== $record->connector) {
                                     continue;
                                 } else {
                                     if ('widgets' === $context && 'widgets' !== $record->connector) {
                                         continue;
                                     } else {
                                         if ('menus' === $context && 'menus' !== $record->connector) {
                                             continue;
                                         }
                                     }
                                 }
                             }
                             //                else if ($context === "themes" && $record->connector !== "themes")
                             //                    continue;
                             if ('comments' !== $context && 'media' !== $context && 'widgets' !== $context && 'menus' !== $context && $record->context !== $context) {
                                 continue;
                             }
                             if ('updated' === $action && ('post' === $context || 'page' === $context)) {
                                 $new_status = $this->get_stream_meta_data($record, 'new_status');
                                 if ('draft' === $new_status) {
                                     // avoid auto save post
                                     continue;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $token_values = array();
         foreach ($tokens as $token) {
             $data = '';
             $token_name = str_replace(array('[', ']'), '', $token);
             $array_tmp = explode('.', $token_name);
             if ('user.name' === $token_name) {
                 $data = 'display_name';
             } else {
                 if (1 === count($array_tmp)) {
                     list($data) = $array_tmp;
                 } else {
                     if (2 === count($array_tmp)) {
                         list($str1, $data) = $array_tmp;
                     } else {
                         if (3 === count($array_tmp)) {
                             list($str1, $str2, $data) = $array_tmp;
                         }
                     }
                 }
                 if ('version' === $data) {
                     if ('old' === $str2) {
                         $data = 'old_version';
                     } else {
                         if ('current' === $str2 && 'wordpress' === $str1) {
                             $data = 'new_version';
                         }
                     }
                 }
             }
             if ('role' === $data) {
                 $data = 'roles';
             }
             switch ($data) {
                 case 'date':
                     $token_values[$token] = MainWP_Helper::formatTimestamp(MainWP_Helper::getTimestamp(strtotime($record->created)));
                     break;
                 case 'area':
                     $data = 'sidebar_name';
                     $token_values[$token] = $this->get_stream_meta_data($record, $data);
                     break;
                 case 'name':
                 case 'version':
                 case 'old_version':
                 case 'new_version':
                 case 'display_name':
                 case 'roles':
                     if ('name' === $data) {
                         if ($theme_edited) {
                             $data = 'theme_name';
                         } else {
                             if ($plugin_edited) {
                                 $data = 'plugin_name';
                             } else {
                                 if ($users_updated) {
                                     $data = 'display_name';
                                 }
                             }
                         }
                     }
                     if ('roles' === $data && $users_updated) {
                         $user_info = get_userdata($record->object_id);
                         if (!(is_object($user_info) && $user_info instanceof WP_User)) {
                             $roles = '';
                         } else {
                             $roles = implode(', ', $user_info->roles);
                         }
                         $token_values[$token] = $roles;
                     } else {
                         $token_values[$token] = $this->get_stream_meta_data($record, $data);
                     }
                     break;
                 case 'title':
                     if ('comments' === $context) {
                         $token_values[$token] = $record->summary;
                     } else {
                         if ('page' === $context || 'post' === $context) {
                             $data = 'post_title';
                         } else {
                             if ('menus' === $record->connector) {
                                 $data = 'name';
                             }
                         }
                         $token_values[$token] = $this->get_stream_meta_data($record, $data);
                     }
                     break;
                 case 'author':
                     $data = 'author_meta';
                     $value = $this->get_stream_meta_data($record, $data);
                     if (empty($value) && 'comments' === $context) {
                         $value = __('Guest', 'mainwp-child-reports');
                     }
                     $token_values[$token] = $value;
                     break;
                 case 'status':
                     // sucuri cases
                 // sucuri cases
                 case 'webtrust':
                     if ('mainwp_sucuri' === $context) {
                         $token_values[$token] = $this->get_stream_meta_data($record, $data);
                     } else {
                         $token_values[$token] = $token;
                     }
                     break;
                 case 'destination':
                     // backup cases
                 // backup cases
                 case 'type':
                     if ('mainwp_backups' === $context) {
                         $token_values[$token] = $this->get_stream_meta_data($record, $data);
                     } else {
                         $token_values[$token] = $token;
                     }
                     break;
                 default:
                     $token_values[$token] = 'N/A';
                     break;
             }
         }
         // foreach $tokens
         if (!empty($token_values)) {
             $loops[$loop_count] = $token_values;
             $loop_count++;
         }
     }
     // foreach $records
     return $loops;
 }
    public static function renderCron()
    {
        $cron_array = _get_cron_array();
        $schedules = wp_get_schedules();
        ?>
		<table id="mainwp-table" class="wp-list-table widefat" cellspacing="0">
			<thead>
			<tr>
				<th scope="col" class="manage-column column-posts" style="">
					<span><?php 
        esc_html_e('Next due', 'mainwp');
        ?>
</span></th>
				<th scope="col" class="manage-column column-posts" style="">
					<span><?php 
        esc_html_e('Schedule', 'mainwp');
        ?>
</span></th>
				<th scope="col" class="manage-column column-posts" style="">
					<span><?php 
        esc_html_e('Hook', 'mainwp');
        ?>
</span></th>
			</tr>
			</thead>
			<tbody id="the-sites-list" class="list:sites">
			<?php 
        foreach ($cron_array as $time => $cron) {
            foreach ($cron as $hook => $cron_info) {
                foreach ($cron_info as $key => $schedule) {
                    ?>
						<tr>
							<td><?php 
                    echo esc_html(MainWP_Helper::formatTimestamp(MainWP_Helper::getTimestamp($time)));
                    ?>
</td>
							<td><?php 
                    echo esc_html(isset($schedule['schedule']) && isset($schedules[$schedule['schedule']]) && isset($schedules[$schedule['schedule']]['display']) ? $schedules[$schedule['schedule']]['display'] : '');
                    ?>
 </td>
							<td><?php 
                    echo esc_html($hook);
                    ?>
</td>
						</tr>
						<?php 
                }
            }
        }
        ?>
			</tbody>
		</table>
		<?php 
    }