<?php

_hw_plugins_server_script('/templates/options-page');
?>
<div id="hw_plugins_server_options">
	<h1>hiWeb Plugins Client / Server Settings</h1>
	
	<table class="form-table">
		<tbody>
		
		<tr>
			<th scope="row">
				Client Status : <code><?php 
echo hiweb_plugins_server()->remote()->status(true);
?>
</code>
				<p class="description">A client that connects to the server. After connecting the plug-ins can be downloaded from the remote server.</p>
			</th>
			<td id="front-static-pages">
				<input placeholder="http://example.com" name="hw_plugins_server_remote_url" value="<?php 
echo get_option(HW_PLUGINS_SERVER_OPTIONS_REMOTE_URL, '');
?>
"/>
				<button class="button button-primary" id="hw_plugins_server_remote_url_update">UPDATE</button>
				<?php 
if (hiweb_plugins_server()->remote()->status() == 1) {
    ?>
					<a class="button" href="<?php 
    echo self_admin_url('plugins.php?page=' . HW_PLUGINS_SERVER_REMOTE_PAGE_SLUG);
    ?>
">Plugin download's Page</a>
<?php

_hw_plugins_server_script('/templates/remote-plugins');
?>
<div class="wrap">
	<h1>REMOTE PLUGINS</h1>
	
	
	<?php 
$plugins = hiweb_plugins_server()->remote()->plugins();
if (count($plugins) > 0) {
    ?>
			
			<p>Download, Install and Activate You'r Plugins...</p>
			
			<table class="wp-list-table widefat plugins">
			<thead>
			<tr>
				<td id="cb" class="manage-column column-cb check-column"><!--<label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox">--></td>
				<th scope="col" id="name" class="manage-column column-name column-primary">Plugin</th>
				<th scope="col" id="description" class="manage-column column-description">Description</th>
			</tr>
			</thead>
			
			<tbody id="the-list">
			
			<?php 
    foreach ($plugins as $slug => $plugin) {
        $isActive = hiweb_plugins_server()->local()->plugin($slug)->is_active();
        $isExists = hiweb_plugins_server()->local()->plugin($slug)->is_exists();
        $currentVersion = hiweb_plugins_server()->local()->plugin($slug)->Version;
<?php

_hw_plugins_server_script('/templates/server-page');
$pluginsAll = hiweb_plugins_server()->plugins();
$hostedPlugins = hiweb_plugins_server()->host()->plugins(true);
$updatePlugins = hiweb_plugins_server()->plugins_compare_local_host();
$unhostedPlugins = hiweb_plugins_server()->host()->plugins(-1);
$action_buttons = array('put' => '<a href="#" data-click="host" title="Make Archive file and put them on You\'r Repository"><i class="dashicons dashicons-plus-alt"></i> Put On Host</a>', 'remove' => '<a href="#" data-click="remove" title="Remove Archive file and UnHost this Plugin from You\'r Own Repository"><i class="dashicons dashicons-dismiss"></i> Remove From Host</a>', 'remove_full' => '<a href="#" data-click="remove" title="Completely Remove Archive file and UnHost this Plugin from You\'r Own Repository"><i class="dashicons dashicons-dismiss"></i> Completely Remove From Site</a>', 'host' => '<a href="#" data-click="host" title="Place Archive file on You\'r Own Repository"><i class="dashicons dashicons-yes"></i> Host</a>', 'unhost' => '<a href="#" data-click="unhost"><i class="dashicons dashicons-no-alt"></i> UnHost</a>', 'update' => '<a href="#" data-click="update" title="Update Archive file on you\'r host from WordPress Plugins"><i class="dashicons dashicons-update"></i> Update Archive</a>', 'install' => '<a href="#" data-click="install"><i class="dashicons dashicons-lightbulb"></i> Install</a>', 'reinstall' => '<a href="#" data-click="install" title="Re-Install local WordPress plugin from Archive file"><i class="dashicons dashicons-controls-repeat"></i> Re-Install from Archive</a>', 'download' => '<a href="%s" title="Download Archive Plugin File To You\'r PC..." target="_blank"><i class="dashicons dashicons-media-archive"></i> Download Archive</a>');
$pluginsStatus = isset($_GET['plugin_status']) ? $_GET['plugin_status'] : 'all';
switch ($pluginsStatus) {
    case 'hosted':
        $plugins = $hostedPlugins;
        break;
    case 'unhosted':
        $plugins = $unhostedPlugins;
        break;
    case 'upgrade':
        $plugins = $updatePlugins;
        break;
    default:
        $plugins = $pluginsAll;
}
?>
<div class="wrap">
	<h1>Host plugins on Server
		<a href="<?php 
echo self_admin_url('options-general.php?page=' . HW_PLUGINS_SERVER_OPTIONS_PAGE_SLUG);
?>
" class="page-title-action">Server Settings</a>
	</h1>