Ejemplo n.º 1
0
function _hw_ps_options()
{
    add_submenu_page('options-general.php', 'hiWeb Server Settings', 'hiWeb Plugins Server', 'activate_plugins', HW_PLUGINS_SERVER_OPTIONS_PAGE_SLUG, '_hw_plugins_server_options_settings');
    add_submenu_page('plugins.php', 'hiWeb Remote Plugins', 'hiWeb Remote Plugins', 'activate_plugins', HW_PLUGINS_SERVER_REMOTE_PAGE_SLUG, '_hw_plugins_server_remote_page');
    if (hiweb_plugins_server()->host()->status()) {
        $count = count(hiweb_plugins_server()->plugins_compare_local_host());
        add_menu_page('Plugins Server', 'Plugins Server' . ($count > 0 ? ' <span class="update-plugins count-' . $count . '"><span class="plugin-count">' . $count . '</span></span>' : ''), 'activate_plugins', HW_PLUGINS_SERVER_PAGE_SLUG, '_hw_plugins_server_page', 'dashicons-list-view');
    }
}
</b>
									</p></div>
							</td>
						</tr>
					<?php 
        }
    }
    ?>
			</tbody>
			
			<tfoot>
			<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>
			</tfoot>
			
			</table><?php 
} else {
    ?>
<h2>Unable to get the list of plugins</h2><h3>Reason: <?php 
    echo hiweb_plugins_server()->remote()->status(true);
    ?>
</h3><?php 
}
?>


</div>
Ejemplo n.º 3
0
<?php

/**
 * Created by PhpStorm.
 * User: hiweb
 * Date: 01.06.2016
 * Time: 21:02
 */
///HOOKS
add_filter('plugin_action_links', array(hiweb_plugins_server()->hooks(), 'plugin_action_links'), 99999, 2);
add_filter('plugin_action_links_hiweb-plugins-server/hiweb-plugins-server.php', array(hiweb_plugins_server()->hooks(), 'plugin_action_links_settings'));
add_action('admin_notices', array(hiweb_plugins_server()->hooks(), 'admin_notices'));
add_action('pre_current_active_plugins', array(hiweb_plugins_server()->hooks(), 'pre_current_active_plugins'));
//
///AJAX
add_action('wp_ajax_hw_plugins_server_status_toggle', array(hiweb_plugins_server()->hooks(), 'ajax_host_toggle_status'));
add_action('wp_ajax_hw_plugins_server_kickback_status_toggle', array(hiweb_plugins_server()->hooks(), 'ajax_host_toggle_kickback_status'));
add_action('wp_ajax_hw_plugins_server_host_action', array(hiweb_plugins_server()->hooks(), 'ajax_host_plugin_action'));
add_action('wp_ajax_hw_plugins_server_remote', array(hiweb_plugins_server()->hooks(), 'ajax_remote_plugin_action'));
add_action('wp_ajax_hw_plugins_server_remote_url_update', array(hiweb_plugins_server()->hooks(), 'ajax_remote_url_update'));
add_action('wp_ajax_nopriv_hw_plugins_server', array(hiweb_plugins_server()->hooks(), 'ajax_server_get'));
 public function plugin_action_links($links, $plugin)
 {
     if (hiweb_plugins_server()->remote()->status() == true) {
         if ($plugin != 'hiweb-plugins-server/hiweb-plugins-server.php') {
             //$links[] = '<a href=""><i class="dashicons dashicons-upload"></i> Upload To Server</a>';
         }
     }
     return $links;
 }
 /**
  * @return hw_plugins_server_host_plugin
  */
 private function host()
 {
     return hiweb_plugins_server()->host()->plugin($this->slug);
 }
 /**
  * Обновить архив плагина с локального
  * @return bool
  */
 public function do_update()
 {
     if (!$this->local()->is_exists()) {
         return false;
     }
     ///
     if (!hiweb_plugins_server()->make_archive($this->slug)) {
         return false;
     }
     ///
     $this->Version = $this->local()->Version;
     return $this->data_update();
 }
?>
</code>
				<p class="description">Allow remote clients to upload their plugins. These plug-ins will be packaged in the archive file and can not be started automatically or via the URL-request. To unpack the plugin, you must go to the section for
					unpacking and installing plug-ins.</p>
			</th>
			<td id="front-static-pages">
				<?php 
if (!hiweb_plugins_server()->host()->status()) {
    ?>
					<button class="button button-primary-disabled" disabled>Unable to enable.</button>
					<p class="description">Start server first, after that enable KICKBACK</p>
				<?php 
} else {
    ?>
					<?php 
    if (!hiweb_plugins_server()->host()->kickback_status()) {
        ?>
						<button class="button button-primary" id="hw_plugins_server_kickback_status_toggle">ENABLE KICKBACK</button>
						<p class="description">Press on button for enable / disable server kickback</p>
					<?php 
    } else {
        ?>
						<button class="button" id="hw_plugins_server_kickback_status_toggle">DISABLE KICKBACK</button>
						<p class="description">Press on button for enable / disable server kickback</p>
					<?php 
    }
    ?>
				<?php 
}
?>
			</td>
		<table id="the-comment-list" 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>
			</tr>
			</thead>
			
			<tbody id="the-list">
			
			<?php 
if (is_array($plugins)) {
    foreach ($plugins as $slug => $plugin) {
        $hostPlugin = hiweb_plugins_server()->host()->plugin($slug);
        $localPlugin = hiweb_plugins_server()->local()->plugin($slug);
        $versionNotCompare = hiweb_plugins_server()->compare_version_local_host($slug) == 1;
        $class = array('');
        if ($versionNotCompare) {
            $class[] = 'unapproved';
        } elseif ($hostPlugin->is_hosted()) {
            $class[] = 'active';
        } else {
            $class[] = 'inactive';
        }
        ?>
					<tr class="<?php 
        echo implode(' ', $class);
        ?>
" data-slug="<?php 
        echo dirname($slug);
        ?>