Commit realizado el 12:13:52 08-04-2024

This commit is contained in:
Pagina Web Monito
2024-04-08 12:13:55 -04:00
commit 0c33094de9
7815 changed files with 1365694 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
namespace DeployerForGit\Subpages\InstallPluginPage;
use DeployerForGit\Subpages\InstallPackage;
/**
* Class InstallPlugin
*
* @package DeployerForGit\Subpages\InstallPluginPage
*/
class InstallPlugin extends InstallPackage {
/**
* Initializes the menu.
*/
public function init_menu() {
$menu_slug = \DeployerForGit\Helper::menu_slug();
$page_title = esc_attr__( 'Install Plugin', 'deployer-for-git' );
$capability = is_multisite() ? 'manage_network_options' : 'manage_options';
add_submenu_page(
$menu_slug,
$page_title,
$page_title,
$capability,
"{$menu_slug}-install-plugin",
array( $this, 'init_page' )
);
}
/**
* Installs a plugin from a zip file.
*
* @param string $package_zip_url The URL of the zip file.
* @param string $package_slug The slug of the package.
* @param string $package_provider The provider of the package (github, bitbucket, gitlab, gitea).
* @param array $options The options.
* @return WP_Error|bool Returns WP_Error object for failure or true for success.
*/
public static function install_plugin_from_zip_url( $package_zip_url, $package_slug, $package_provider, $options = array() ) {
return parent::install_package_from_zip_url( $package_zip_url, $package_slug, 'plugin', $package_provider, $options );
}
/**
* Initializes the page.
*/
public function init_page() {
// Handle package installation form.
$install_result = parent::handle_package_install_form();
include_once __DIR__ . '/template.php';
}
}

View File

@@ -0,0 +1 @@
<?php // Silence is golden

View File

@@ -0,0 +1,149 @@
<?php
if ( !defined( 'ABSPATH' ) ) {
exit;
}
?>
<?php
if ( isset( $install_result ) ) {
?>
<?php
if ( !is_wp_error( $install_result ) ) {
?>
<div class="updated">
<p>
<?php
echo esc_attr__( 'Plugin was successfully installed', 'deployer-for-git' ) ;
?>
</p>
</div>
<?php
} else {
?>
<div class="error">
<p>
<!-- <strong><?php
echo esc_attr( $install_result->get_error_code() ) ;
?></strong> -->
<?php
echo esc_attr( $install_result->get_error_message() ) ;
?>
</p>
</div>
<?php
}
}
?>
<div class="wrap">
<h1><?php
echo esc_attr__( 'Install Plugin', 'deployer-for-git' ) ;
?></h1>
<form class="dfg_install_package_form" method="post" action="">
<input type="hidden" name="<?php
echo esc_attr( DFG_SLUG . '_install_package_submitted' ) ;
?>" value="1">
<input type="hidden" name="package_type" value="plugin">
<?php
wp_nonce_field( DFG_SLUG . '_install_package_form', DFG_SLUG . '_nonce' );
?>
<table class="form-table">
<tr valign="top">
<th scope="row">
<?php
echo esc_attr__( 'Provider Type', 'deployer-for-git' ) ;
?>
</th>
<td>
<select name='provider_type'>
<option value="" selected disabled><?php
echo esc_attr__( 'Choose a provider', 'deployer-for-git' ) ;
?></option>
<?php
foreach ( \DeployerForGit\Helper::available_providers() as $provider_id => $name ) {
?>
<option value="<?php
echo esc_attr( $provider_id ) ;
?>"><?php
echo esc_attr( $name ) ;
?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
echo esc_attr__( 'Repository URL', 'deployer-for-git' ) ;
?></th>
<td>
<input type="url" class="regular-text code" name="repository_url" value="" />
<p class="description dfg_repo_url_description dfg_hidden" id="bitbucket-repo-url-description"><?php
echo esc_attr__( 'Example: https://bitbucket.org/owner/wordpress-plugin-name', 'deployer-for-git' ) ;
?></p>
<p class="description dfg_repo_url_description dfg_hidden" id="github-repo-url-description"><?php
echo esc_attr__( 'Example: https://github.com/owner/wordpress-plugin-name', 'deployer-for-git' ) ;
?></p>
<p class="description dfg_repo_url_description dfg_hidden" id="gitea-repo-url-description"><?php
echo esc_attr__( 'Example: https://gitea.com/owner/wordpress-plugin-name', 'deployer-for-git' ) ;
?></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
echo esc_attr__( 'Branch', 'deployer-for-git' ) ;
?> <span class="dashicons dashicons-randomize"></span></th>
<td>
<input type="text" class="" placeholder="master" name="repository_branch" value="" />
<p class="description"><?php
echo esc_attr__( 'default is "master"', 'deployer-for-git' ) ;
?></p>
</td>
</tr>
<?php
$private_repository_row_class = 'free';
?>
<tr valign="top" class="dfg_hidden dfg_is_private_repository_row <?php
echo esc_attr( $private_repository_row_class ) ;
?>">
<th scope="row">
<?php
echo esc_attr__( 'Is Private Repository', 'deployer-for-git' ) ;
?>
<?php
?>
<br>
<small><?php
echo esc_attr__( '[Available in PRO version]', 'deployer-for-git' ) ;
?></small>
<?php
?>
<span class="dashicons dashicons-lock"></span>
</th>
<td><input type="checkbox" name="is_private_repository" value="1"></td>
</tr>
<?php
?>
</table>
<div class="submit">
<input type="submit" class="button-primary" value="<?php
echo esc_attr__( 'Install Plugin', 'deployer-for-git' ) ;
?>" /><br><br>
<p class="description"><i><?php
echo esc_attr__( 'Note that if a plugin with specified slug is already installed, this action will overwrite the already existing plugin.', 'deployer-for-git' ) ;
?><i></p>
</div>
</form>
</div>