Falcon_Connector_WordPress::network_notification_settings PHP Метод

network_notification_settings() публичный Метод

public network_notification_settings ( $user = null, $sites )
    public function network_notification_settings($user = null, $sites)
    {
        // Are we on the notification defaults screen?
        $is_defaults_screen = empty($user);
        $available = $this->get_available_settings();
        $short_names = $this->get_available_settings_short();
        $defaults = $this->get_default_settings();
        ?>
		<table class="widefat falcon-grid">
			<thead>
				<tr>
					<th></th>
					<th colspan="<?php 
        echo esc_attr(count($available['post']));
        ?>
"
						class="last_of_col"><?php 
        esc_html_e('Posts', 'falcon');
        ?>
</th>
					<th colspan="<?php 
        echo esc_attr(count($available['comment']));
        ?>
"><?php 
        esc_html_e('Comments', 'falcon');
        ?>
</th>
				</tr>
				<tr>
					<th></th>
					<?php 
        foreach ($available as $type => $opts) {
            $last = key(array_slice($opts, -1, 1, true));
            foreach ($opts as $key => $title) {
                printf('<td class="%s"><abbr title="%s">%s</abbr>%s</td>', $key === $last ? 'last_of_col' : '', esc_attr($title), esc_html($short_names[$type][$key]), $key === $defaults[$type] ? ' <strong>*</strong>' : '');
            }
        }
        ?>
				</tr>
			</thead>

			<?php 
        foreach ($sites as $site) {
            $details = get_blog_details($site);
            $settings = $this->get_settings_for_user($user->ID, $site);
            $title = esc_html($details->blogname) . '<br >';
            $path = $details->path;
            if ($path === '/') {
                $path = '';
            }
            $title .= '<span class="details">' . esc_html($details->domain . $path) . '</span>';
            ?>
				<tr>
					<th scope="row"><?php 
            echo $title;
            ?>
</th>

					<?php 
            foreach ($available as $type => $opts) {
                $default = isset($defaults[$type]) ? $defaults[$type] : false;
                $current = isset($settings[$type]) ? $settings[$type] : $default;
                $name = $this->key_for_setting('notifications.' . $type, $site);
                foreach ($opts as $key => $title) {
                    printf('<td><input type="radio" name="%s" value="%s" %s /></td>', esc_attr($name), esc_attr($key), checked($key, $current, false));
                }
            }
            ?>
				</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
    }