function display_listing_table($destinations, $edit_url, $delete_url)
        {
            ?>
			<table class="widefat">
				<thead>
				<tr class="form-field">
					<th class="snapshot-col-delete"><?php 
            _e('Delete', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-name"><?php 
            _e('Name', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-server"><?php 
            _e('Host', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-login"><?php 
            _e('Login', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-directory"><?php 
            _e('Directory', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-used"><?php 
            _e('Used', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
				</tr>
				<thead>
				<tbody>
				<?php 
            if (isset($destinations) && count($destinations)) {
                //echo "destinations<pre>"; print_r($destinations); echo "</pre>";
                foreach ($destinations as $idx => $item) {
                    //echo "idx=[". $idx ."] destination<pre>"; print_r($item); echo "</pre>";
                    if (!isset($row_class)) {
                        $row_class = "";
                    }
                    $row_class = $row_class == '' ? 'alternate' : '';
                    ?>
						<tr class="<?php 
                    echo $row_class;
                    if (isset($item['type'])) {
                        echo ' snapshot-row-filter-type-' . $item['type'];
                    }
                    ?>
">
							<td class="snapshot-col-delete" style="width:5px;"><input type="checkbox"
							                                                          name="delete-bulk-destination[<?php 
                    echo $idx;
                    ?>
]"
							                                                          id="delete-bulk-destination-<?php 
                    echo $idx;
                    ?>
">
							</td>

							<td class="snapshot-col-name"><a
									href="<?php 
                    echo $edit_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
"><?php 
                    echo stripslashes($item['name']);
                    ?>
</a>

								<div class="row-actions" style="margin:0; padding:0;">
									<span class="edit"><a href="<?php 
                    echo $edit_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
"><?php 
                    _e('edit', SNAPSHOT_I18N_DOMAIN);
                    ?>
</a></span> | <span class="delete"><a
											href="<?php 
                    echo $delete_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
&amp;snapshot-noonce-field=<?php 
                    echo wp_create_nonce('snapshot-delete-destination');
                    ?>
"><?php 
                    _e('delete', SNAPSHOT_I18N_DOMAIN);
                    ?>
</a></span>
								</div>
							</td>
							<td class="snapshot-col-server"><?php 
                    if (isset($item['address'])) {
                        echo $item['address'];
                    }
                    ?>
</td>
							<td class="snapshot-col-username"><?php 
                    if (isset($item['username'])) {
                        echo $item['username'];
                    }
                    ?>
</td>
							<td class="snapshot-col-username"><?php 
                    if (isset($item['directory'])) {
                        echo $item['directory'];
                    }
                    ?>
</td>

							<td class="snapshot-col-used"><?php 
                    Snapshot_Model_Destination::show_destination_item_count($idx);
                    ?>
</td>
						</tr>
					<?php 
                }
            } else {
                ?>
					<tr class="form-field">
					<td colspan="4"><?php 
                _e('No FTP Destinations', SNAPSHOT_I18N_DOMAIN);
                ?>
</td></tr><?php 
            }
            ?>
				</tbody>
			</table>
			<?php 
            if (isset($destinations) && count($destinations)) {
                ?>
				<div class="tablenav">
					<div class="alignleft actions">
						<input class="button-secondary" type="submit"
						       value="<?php 
                _e('Delete Destination', SNAPSHOT_I18N_DOMAIN);
                ?>
"/>
					</div>
				</div>
			<?php 
            }
        }
 function snapshot_init_proc()
 {
     if (!is_multisite()) {
         $role = get_role('administrator');
         if ($role) {
             $role->add_cap('manage_snapshots_items');
             $role->add_cap('manage_snapshots_destinations');
             $role->add_cap('manage_snapshots_settings');
             $role->add_cap('manage_snapshots_import');
         }
         $this->load_config();
         $this->set_backup_folder();
         $this->set_log_folders();
         if (Snapshot_Helper_Utility::is_pro()) {
             Snapshot_Model_Destination::load_destinations();
         }
     } else {
         global $current_site, $current_blog;
         if ($current_site->blog_id == $current_blog->blog_id) {
             $this->load_config();
             $this->set_backup_folder();
             $this->set_log_folders();
             if (Snapshot_Helper_Utility::is_pro()) {
                 Snapshot_Model_Destination::load_destinations();
             }
         }
     }
 }
        /**
         *
         */
        public static function render_destination_edit_panel()
        {
            ?>
			<div id="snapshot-metaboxes-destination_add" class="wrap snapshot-wrap">
					<?php 
            $item = 0;
            if (isset($_REQUEST['snapshot-action'])) {
                if (sanitize_text_field($_REQUEST['snapshot-action']) == "edit") {
                    ?>
					<h2><?php 
                    _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                    ?>
</h2>
					<p><?php 
                    _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                    ?>
</p>
					<?php 
                    if (isset($_REQUEST['item'])) {
                        $item_key = sanitize_text_field($_REQUEST['item']);
                        if (isset(WPMUDEVSnapshot::instance()->config_data['destinations'][$item_key])) {
                            $item = WPMUDEVSnapshot::instance()->config_data['destinations'][$item_key];
                        }
                    }
                } else {
                    if (sanitize_text_field($_REQUEST['snapshot-action']) == "add") {
                        ?>
					<h2><?php 
                        _ex("Add Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                        ?>
</h2>
					<p><?php 
                        _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                        ?>
</p>
					<?php 
                        unset($item);
                        $item = array();
                        if (isset($_REQUEST['type'])) {
                            $item['type'] = sanitize_text_field($_REQUEST['type']);
                        }
                    } else {
                        if (sanitize_text_field($_REQUEST['snapshot-action']) == "update") {
                            ?>
					<h2><?php 
                            _ex("Edit Snapshot Destination", "Snapshot Plugin Page Title", SNAPSHOT_I18N_DOMAIN);
                            ?>
</h2>
					<p><?php 
                            _ex("", 'Snapshot page description', SNAPSHOT_I18N_DOMAIN);
                            ?>
</p>
					<?php 
                            if (isset($_POST['snapshot-destination'])) {
                                $item = $_POST['snapshot-destination'];
                            }
                        }
                    }
                }
            }
            if ($item) {
                Snapshot_Helper_UI::form_ajax_panels();
                ?>
						<form action="<?php 
                echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
                ?>
snapshots_destinations_panel&amp;snapshot-action=<?php 
                echo urlencode(sanitize_text_field($_GET['snapshot-action']));
                ?>
&amp;type=<?php 
                echo urlencode($item['type']);
                ?>
" method="post">
							<?php 
                if (sanitize_text_field($_GET['snapshot-action']) == "edit" || sanitize_text_field($_GET['snapshot-action']) == "update") {
                    ?>
					<input type="hidden" name="snapshot-action" value="update"/>
					<input type="hidden" name="item" value="<?php 
                    echo sanitize_text_field($_GET['item']);
                    ?>
"/>
					<?php 
                    wp_nonce_field('snapshot-update-destination', 'snapshot-noonce-field');
                    ?>
				<?php 
                } else {
                    if (sanitize_text_field($_GET['snapshot-action']) == "add") {
                        ?>
					<input type="hidden" name="snapshot-action" value="add"/>
					<?php 
                        wp_nonce_field('snapshot-add-destination', 'snapshot-noonce-field');
                        ?>
				<?php 
                    }
                }
                $item_object = Snapshot_Model_Destination::get_object_from_type($item['type']);
                if ($item_object && is_object($item_object)) {
                    $item_object->display_details_form($item);
                }
                ?>
								<input class="button-primary" type="submit" value="<?php 
                _e('Save Destination', SNAPSHOT_I18N_DOMAIN);
                ?>
" />
								<a class="button-secondary" href="<?php 
                echo WPMUDEVSnapshot::instance()->get_setting('SNAPSHOT_MENU_URL');
                ?>
snapshots_destinations_panel"><?php 
                _e('Cancel', SNAPSHOT_I18N_DOMAIN);
                ?>
</a>

							</div>
						</form>
						<?php 
            }
            ?>
			</div>
			<?php 
        }
        function display_listing_table($destinations, $edit_url, $delete_url)
        {
            ?>
			<table class="widefat">
				<thead>
				<tr class="form-field">
					<th class="snapshot-col-delete"><?php 
            _e('Delete', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-name"><?php 
            _e('Name', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-login"><?php 
            _e('Login', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-authorized"><?php 
            _e('Authorized', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-directory"><?php 
            _e('Directory', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
					<th class="snapshot-col-used"><?php 
            _e('Used', SNAPSHOT_I18N_DOMAIN);
            ?>
</th>
				</tr>
				<thead>
				<tbody>
				<?php 
            if (isset($destinations) && count($destinations)) {
                foreach ($destinations as $idx => $item) {
                    if (!isset($row_class)) {
                        $row_class = "";
                    }
                    $row_class = $row_class == '' ? 'alternate' : '';
                    ?>
						<tr class="<?php 
                    echo $row_class;
                    if (isset($item['type'])) {
                        echo ' snapshot-row-filter-type-' . $item['type'];
                    }
                    ?>
">
							<td class="snapshot-col-delete"><input type="checkbox"
							                                       name="delete-bulk-destination[<?php 
                    echo $idx;
                    ?>
]"
							                                       id="delete-bulk-destination-<?php 
                    echo $idx;
                    ?>
">
							</td>

							<td class="snapshot-col-name"><a
									href="<?php 
                    echo $edit_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
"><?php 
                    echo stripslashes($item['name']);
                    ?>
</a>

								<div class="row-actions" style="margin:0; padding:0;">
									<span class="edit"><a href="<?php 
                    echo $edit_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
"><?php 
                    _e('edit', SNAPSHOT_I18N_DOMAIN);
                    ?>
</a></span> | <span class="delete"><a
											href="<?php 
                    echo $delete_url;
                    ?>
item=<?php 
                    echo $idx;
                    ?>
&amp;snapshot-noonce-field=<?php 
                    echo wp_create_nonce('snapshot-delete-destination');
                    ?>
"><?php 
                    _e('delete', SNAPSHOT_I18N_DOMAIN);
                    ?>
</a></span>
								</div>
							</td>
							<td class="snapshot-col-login"><?php 
                    if (isset($item['account_info']['display_name'])) {
                        echo $item['account_info']['display_name'];
                        if (isset($item['account_info']['email'])) {
                            echo ' (' . $item['account_info']['email'] . ')';
                        }
                    }
                    ?>
</td>
							<td class="snapshot-col-authorized"><?php 
                    if (isset($item['tokens']['access']['token']) && isset($item['tokens']['access']['token_secret'])) {
                        _e('Yes', SNAPSHOT_I18N_DOMAIN);
                    } else {
                        _e('Yes', SNAPSHOT_I18N_DOMAIN);
                    }
                    ?>
</td>
							<td class="snapshot-col-directory"><?php 
                    if (isset($item['directory'])) {
                        echo $item['directory'];
                    }
                    ?>
</td>
							<td class="snapshot-col-used"><?php 
                    Snapshot_Model_Destination::show_destination_item_count($idx);
                    ?>
</td>
						</tr>
					<?php 
                }
            } else {
                ?>
					<tr class="form-field">
					<td colspan="4"><?php 
                _e('No Dropbox Destinations', SNAPSHOT_I18N_DOMAIN);
                ?>
</td></tr><?php 
            }
            ?>
				</tbody>
			</table>
			<?php 
            if (isset($destinations) && count($destinations)) {
                ?>
				<div class="tablenav">
					<div class="alignleft actions">
						<input class="button-secondary" type="submit"
						       value="<?php 
                _e('Delete Destination', SNAPSHOT_I18N_DOMAIN);
                ?>
"/>
					</div>
				</div>
			<?php 
            }
            ?>
		<?php 
        }