-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from codersaiful/5.9.1
5.9.1
- Loading branch information
Showing
15 changed files
with
350 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
namespace WC_MMQ\Admin\Adm_Inc; | ||
|
||
class Plugin_Installer | ||
{ | ||
public $plugin_zip_url; | ||
|
||
|
||
/** | ||
* Initializing static property for Class | ||
* We will use this Trait acutally | ||
* | ||
* @var null|object | ||
*/ | ||
public static $init; | ||
|
||
/** | ||
* Initializing method init() | ||
* If we want to make any Class as Standalone | ||
* then we have to use this trait | ||
* | ||
* @since 1.0.0.11 | ||
* | ||
* @author Saiful Islam <[email protected]> | ||
* @return null|object | ||
*/ | ||
public static function init() | ||
{ | ||
if( self::$init && self::$init instanceof self ) return self::$init; | ||
|
||
self::$init = new self(); | ||
|
||
return self::$init; | ||
} | ||
|
||
public function run() | ||
{ | ||
add_action('admin_init', [$this,'handle_install']); | ||
} | ||
public function set_plugin_zip_url( $url = '' ) | ||
{ | ||
$this->plugin_zip_url = $url; | ||
} | ||
public function handle_install() | ||
{ | ||
if (isset($_POST['install_plugin']) && check_admin_referer('pssg_install_plugin_nonce', 'pssg_install_plugin_nonce')) { | ||
// URL to the zip file of the custom plugin | ||
$this->plugin_zip_url = 'https://example.com/path/to/your-plugin.zip'; | ||
|
||
// Install and activate the plugin | ||
$result = $this->install_zip( $this->plugin_zip_url ); | ||
echo '<pre>'; | ||
var_dump($result); | ||
echo '</pre>'; | ||
exit(); | ||
exit; | ||
die(); | ||
die; | ||
if (is_wp_error($result)) { | ||
// Handle error, if any | ||
echo 'Error installing the plugin: ' . esc_html($result->get_error_message()); | ||
} else { | ||
// Redirect to your admin page menu | ||
// wp_redirect(admin_url('admin.php?page=wcmmq-product-quick-edit')); | ||
exit; | ||
} | ||
} | ||
} | ||
public function install_zip( $plugin_zip_url ) | ||
{ | ||
require_once ABSPATH . 'wp-admin/includes/file.php'; | ||
require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; | ||
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; | ||
|
||
$upgrader = new \Plugin_Upgrader(new \Automatic_Upgrader_Skin()); | ||
$install_result = $upgrader->install( $plugin_zip_url ); | ||
|
||
return $install_result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
use WC_MMQ\Core\Base; | ||
use WC_MMQ\Modules\Module_Controller; | ||
use WC_MMQ\Includes\Min_Max_Controller;; | ||
|
||
class Page_Loader extends Base | ||
{ | ||
|
@@ -58,6 +59,40 @@ public function module_page_html() | |
include $this->module_controller->dir . '/module-page.php'; | ||
} | ||
|
||
/** | ||
* Connectivity with Product Stock Sync with Google Sheet for WooCommerce | ||
* | ||
* | ||
* @since 5.9.0 | ||
* @return void | ||
* | ||
* @author Saiful Islam <[email protected]> | ||
*/ | ||
public function product_quick_edit() | ||
{ | ||
add_filter( 'pssg_products_columns', [$this,'handle_columns'] ); | ||
$this->topbar_sub_title = __( 'Min Max Quick Edit','wcmmq' ); | ||
include $this->topbar_file; | ||
include $this->page_folder_dir . '/product-quick-edit.php'; | ||
} | ||
|
||
public function handle_columns( $columns ) | ||
{ | ||
if( ! class_exists('PSSG_Init') ) $columns; | ||
|
||
$new_columns = []; | ||
$new_columns['title'] = $columns['title']; | ||
|
||
|
||
$controller = new Min_Max_Controller(); | ||
$new_columns[$controller->min_quantity] = $columns[$controller->min_quantity]; | ||
$new_columns[$controller->max_quantity] = $columns[$controller->max_quantity]; | ||
$new_columns[$controller->product_step] = $columns[$controller->product_step]; | ||
|
||
$new_columns['stock'] = $columns['stock']; | ||
return $new_columns; | ||
} | ||
|
||
public function browse_plugins_html() | ||
{ | ||
add_filter( 'plugins_api_result', [$this, 'plugins_api_result'], 1, 3 ); | ||
|
@@ -110,6 +145,7 @@ public function admin_menu() | |
//Module page adding | ||
add_submenu_page( $this->main_slug, $this->module_controller->menu_title . $proString, $this->module_controller->menu_title, $capability, 'wcmmq_modules', [$this, 'module_page_html'] ); | ||
|
||
add_submenu_page( $this->main_slug, esc_html__( 'Min Max Bulk Edit', 'wcmmq' ) . $proString, __( 'Min Max Bulk Edit', 'wcmmq' ), $capability, 'wcmmq-product-quick-edit', [$this, 'product_quick_edit'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Browse Plugins', 'wcmmq' ) . $proString, __( 'Browse Plugins', 'wcmmq' ), $capability, 'wcmmq-browse-plugins', [$this, 'browse_plugins_html'] ); | ||
add_submenu_page( $this->main_slug, esc_html__( 'Addons', 'wcmmq' ) . $proString, __( 'Addons', 'wcmmq' ), $capability, 'wcmmq-addons-list', [$this, 'addons_list_html'] ); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
use Product_Stock_Sync\App\Handle\Quick_Table; | ||
|
||
?> | ||
<div class="wrap wcmmq_wrap wcmmq-content"> | ||
|
||
<h1 class="wp-heading "></h1> | ||
<div class="fieldwrap"> | ||
|
||
<?php | ||
if( class_exists( 'Product_Stock_Sync\App\Handle\Quick_Table' ) ){ | ||
?> | ||
<p class="wcmmq-quick-table-header-topbar"> | ||
To update All content. <a class="wcmmq-other-link" href="<?php echo esc_url( admin_url( 'admin.php?page=pssg-quick-edit' ) ); ?>" target="_blank">Click Here</a> | ||
|
||
<span>For min, max and step - Only able to edit/update for single product.</span> | ||
</p> | ||
<?php | ||
$Quick_Table = Quick_Table::init(); | ||
$Quick_Table->display_table_full(); | ||
}else{ | ||
|
||
|
||
|
||
/** | ||
* ekhane amra debo jate | ||
* install na thakle free version install dite pare | ||
*/ | ||
$image_url = $this->assets_url . 'images/features/Qucck-Edit-Table.jpg'; | ||
?> | ||
<div class="wcmmq-section-panel no-background wcmmq-clearfix"> | ||
<div class="wcmmq-section-panel no-background quick-edit-section-wrapper"> | ||
<div class="wcmmq-section-panel wcmmq-quick-edit-section" id="wcmmq-quick-edit-section" data-icon="wcmmq_icon-home"> | ||
|
||
<div class="wcmmq-qes-wrapper"> | ||
<div class="free-plugin-install-info-wrapper"> | ||
<div style="float: left;"> | ||
<h3>Need a plugin [Product Stock Sync with Google Sheet for WooCommerce]</h3> | ||
<p><b>Free Download</b>, Install and Activate to get following table. <a href="https://codeastrology.com/downloads/product-stock-sync-with-google-sheet-for-woocommerce/">https://codeastrology.com/downloads/product-stock-sync...</a></p> | ||
<p class="premium-version-wrapper"> | ||
Get Premium Version. Just Click on - <a href="https://codeastrology.com/downloads/product-sync-master-sheet-premium/" target="_blank" class="wcmmq-btn wcmmq-btn small wcmmq-btn-small btn-small">Purchase Now</a> | ||
</p> | ||
</div> | ||
<iframe style="text-align: right;float:right;" width="560" height="315" | ||
src="https://www.youtube-nocookie.com/embed/fJWAnMvpBQk?si=REPvxfE4UnElPLxD&start=6" | ||
title="YouTube video player" frameborder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
allowfullscreen></iframe> | ||
</div> | ||
<img src="<?php echo esc_attr( $image_url ); ?>" alt="Quick Edit Table Image" style="opacity: 0.6;"> | ||
|
||
</div> | ||
|
||
</div> | ||
</div> | ||
</div> | ||
<?php | ||
} | ||
|
||
?> | ||
|
||
|
||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.