Plugin Directory

Changeset 2422780


Ignore:
Timestamp:
11/21/2020 02:02:19 PM (5 years ago)
Author:
migrate
Message:

adjusted php file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-clone-by-wp-academy/trunk/wpclone.php

    r1583985 r2422780  
    11<?php
    22/*
    3 Plugin name: WP Clone by WP Academy
    4 Plugin URI: http://wpacademy.com/software/
     3Plugin name: WP Clone
     4Plugin URI: https://backupbliss.com
    55Description: Move or copy a WordPress site to another server or to another domain name, move to/from local server hosting, and backup sites.
    6 Author: WP Academy
    7 Version: 2.2.4
    8 Author URI: http://wpacademy.com/
     6Author: Migrate
     7Version: 2.2.10
     8Author URI: https://backupbliss.com
    99*/
     10require_once 'analyst/main.php';
     11
     12analyst_init(array(
     13    'client-id' => '9zdex5mar85kmgya',
     14    'client-secret' => 'd5702a59d32c01c211316717493096485d5156e8',
     15    'base-dir' => __FILE__
     16));
     17
     18
     19/**
     20 *
     21 * @URI https://backupbliss.com
     22 */
    1023
    1124include_once 'lib/functions.php';
     
    2336define('WPCLONE_INSTALLER_PATH', WPCLONE_DIR_PLUGIN);
    2437define('WPCLONE_WP_CONTENT' , str_replace('\\', '/', WP_CONTENT_DIR));
     38define('WPCLONE_ROOT_FILE_PATH' , __FILE__);
    2539
    2640
     
    2943register_activation_hook((__FILE__), 'wpa_wpclone_activate');
    3044register_deactivation_hook(__FILE__ , 'wpa_wpclone_deactivate');
     45register_uninstall_hook(__FILE__ , 'wpa_wpclone_uninstall');
    3146add_action('admin_menu', 'wpclone_plugin_menu');
    3247add_action( 'wp_ajax_wpclone-ajax-size', 'wpa_wpc_ajax_size' );
     
    3550add_action( 'wp_ajax_wpclone-ajax-uninstall', 'wpa_wpc_ajax_uninstall' );
    3651add_action( 'wp_ajax_wpclone-search-n-replace', 'wpa_wpc_ajax_search_n_replace' );
     52add_action( 'wp_ajax_wpclone-ajax-banner1-close', 'wpclone_ajax_banner1_close' );
     53add_action( 'wp_ajax_wpclone-ajax-banner1-removed', 'wpclone_ajax_banner1_removed' );
     54add_action( 'wp_ajax_wpclone-ajax-banner1-getstatus', 'wpclone_ajax_banner1_getstatus' );
     55add_action('admin_init', 'wpa_wpc_plugin_redirect');
     56add_action('admin_head', 'wpclone_admin_head_scripts');
     57add_action('admin_footer', 'wpclone_admin_footer_scripts');
     58add_action( 'admin_notices', 'wpclone_admin_notice__success' );
    3759
    3860function wpclone_plugin_menu() {
     
    131153
    132154function wpa_enqueue_scripts(){
    133     wp_register_script('jquery-zclip', plugin_dir_url(__FILE__) . '/lib/js/zeroclipboard.min.js', array('jquery'));
     155    wp_register_script('clipboard', plugin_dir_url(__FILE__) . '/lib/js/clipboard.min.js', array('jquery'));
    134156    wp_register_script('wpclone', plugin_dir_url(__FILE__) . '/lib/js/backupmanager.js', array('jquery'));
    135157    wp_register_style('wpclone', plugin_dir_url(__FILE__) . '/lib/css/style.css');
    136158    wp_localize_script('wpclone', 'wpclone', array( 'nonce' => wp_create_nonce( 'wpclone-ajax-submit' ), 'spinner' => esc_url( admin_url( 'images/spinner.gif' ) ) ) );
    137     wp_enqueue_script('jquery-zclip');
     159    wp_enqueue_script('clipboard');
    138160    wp_enqueue_script('wpclone');
    139161    wp_enqueue_style('wpclone');
     
    144166
    145167function wpa_wpclone_activate() {
    146     wpa_create_directory();
     168
     169    //Control after activating redirect to settings page
     170    add_option('wpa_wpc_plugin_do_activation_redirect', true);
     171
     172    wpa_create_directory();
    147173}
    148174
    149175function wpa_wpclone_deactivate() {
     176
     177    //Control after activating redirect to settings page
     178    delete_option("wpa_activation_redirect_required");
    150179
    151180    if( file_exists( WPCLONE_DIR_BACKUP ) ) {
     
    155184    }
    156185
     186}
     187
     188function wpa_wpclone_uninstall() {
     189    //Control after activating redirect to settings page
     190    delete_option("wpa_activation_redirect_required");
     191    delete_option("wpclone_ajax_banner1_close");
     192    delete_option("wpclone_ajax_banner1_removed");
    157193}
    158194
     
    235271    add_action( 'admin_notices', 'wpa_wpc_phpnotice');   
    236272}
     273
     274function wpa_wpc_plugin_redirect()
     275
     276{
     277
     278    //Control after activating redirect to settings page
     279    if (get_option('wpa_wpc_plugin_do_activation_redirect', false)) {
     280
     281        delete_option('wpa_wpc_plugin_do_activation_redirect');
     282
     283        wp_redirect(admin_url('admin.php?page=wp-clone'));
     284    }
     285}
     286
     287
     288//Banner functionality
     289function wpclone_ajax_banner1_close(){
     290    update_option("wpclone_ajax_banner1_close", true);
     291    update_option("wpclone_ajax_banner1_removed", false);
     292    wp_send_json_success(["success" => true]);
     293    exit();
     294}
     295
     296function wpclone_ajax_banner1_removed(){
     297    update_option("wpclone_ajax_banner1_close", true);
     298    update_option("wpclone_ajax_banner1_removed", true);
     299    wp_send_json_success(["success" => true]);
     300    exit();
     301}
     302
     303function wpclone_ajax_banner1_getstatus(){
     304    wp_send_json_success([
     305        'wpclone_ajax_banner1_close' => get_option("wpclone_ajax_banner1_close", "0"),
     306        'wpclone_ajax_banner1_removed' => get_option("wpclone_ajax_banner1_removed", "0")
     307    ]);
     308    exit();
     309}
     310
     311function wpclone_admin_head_scripts(){
     312    echo '<style rel="stylesheet">
     313/** Banner CSS **/
     314.banner-1{
     315    min-height: 744px;
     316    width: auto;
     317    background-size: cover;
     318    padding-top: 48px;
     319    padding-left: 61px;
     320    padding-right: 85px;
     321    font-family: \'Montserrat\', sans-serif;
     322    margin-right: 30px;
     323    margin-top: 20px;
     324}
     325
     326.banner-1 .heading{
     327    color: #0f9087;
     328    font-size: 26px;
     329}
     330
     331.banner-1 .nutshell-list{
     332    color: #3A3A3A;
     333    font-size: 18px;
     334    line-height: 22px;
     335}
     336
     337.banner-1 .nutshell-list li{
     338    list-style-position: inside;
     339    text-indent: -1em;
     340    padding-left: 20px;
     341}
     342
     343
     344.banner-1 .banner-footer {
     345    margin-top: 25px;
     346    font-size: 18px;
     347    line-height: 29px;
     348}
     349
     350.button1 span.sc-button {
     351    -webkit-font-smoothing: antialiased;
     352    background-color: #0f9087;
     353    border: none;
     354    color: #fff;
     355    display: inline-block;
     356    text-decoration: none;
     357    user-select: none;
     358    letter-spacing: 1px;
     359    padding-left: 25px;
     360    padding-right: 25px;
     361    padding-top: 12px;
     362    padding-bottom: 12px;
     363    transition: all 0.1s ease-out;
     364    border-radius: 15px;
     365}
     366
     367.banner-1 .button1{
     368   
     369
     370}
     371.banner-1 .button2{
     372    -webkit-font-smoothing: antialiased;
     373    background-color: #0f9087;
     374    border: none;
     375    color: #fff;
     376    display: inline-block;
     377    text-decoration: none;
     378    user-select: none;
     379    letter-spacing: 1px;
     380    padding: 12px 35px;
     381    text-transform: uppercase;
     382    transition: all 0.1s ease-out;
     383    border-radius: 10px;
     384}
     385
     386.banner-1 .close-icon {
     387    float: right;
     388    margin-top: -30px;
     389    margin-right: -65px;
     390    cursor: pointer;
     391}
     392
     393.plugin-large-notice .banner-1-collapsed{
     394    min-height: 63px;
     395    width: auto;
     396    /*padding-top: 48px;
     397    padding-left: 61px;
     398    padding-right: 85px;*/
     399    font-family: \'Montserrat\', sans-serif;
     400    margin-right: 30px;
     401    margin-top: 20px;
     402}
     403
     404.plugin-large-notice .banner-1-collapsed p.left-text {
     405    font-size: 20px;
     406    line-height: 25px;
     407    color: #0f9087;
     408    font-family: \'Montserrat\', sans-serif;
     409    padding-left: 15px;
     410    float: left;
     411}
     412
     413.plugin-large-notice .banner-1-collapsed p.left-text a {
     414    font-size: 15px;
     415    color: #0f9087;
     416    text-decoration: underline;
     417}
     418
     419.plugin-large-notice .banner-1-collapsed p.remove-for-good {
     420    float: right;
     421    font-size: 16px;
     422    color: #0f9087;
     423    margin-right: 30px;
     424    line-height: 35px;
     425    cursor: pointer;
     426}
     427.nutshell-list a {
     428    color: #0f9087;
     429    text-decoration: underline;
     430}
     431</style>';
     432}
     433
     434function wpclone_admin_footer_scripts(){
     435    echo '<script>
     436jQuery(function($) {
     437//Banner notice
     438$("document").ready(function (e) {
     439        $.ajax({
     440            url: ajaxurl,
     441            type: \'get\',
     442            data: {
     443                \'action\': \'wpclone-ajax-banner1-getstatus\'
     444            },
     445            success: function(data){
     446                var urlParams = new URLSearchParams(window.location.search);
     447                var currentPage = urlParams.get("page");
     448               
     449                if(data.data.wpclone_ajax_banner1_close === "1" && data.data.wpclone_ajax_banner1_removed === "1"){
     450                    $(".banner-1-collapsed").hide().remove();
     451                    $(".banner-1").hide().remove();
     452                }else if(data.data.wpclone_ajax_banner1_close === "1" && data.data.wpclone_ajax_banner1_removed != "1"){
     453                    if(currentPage === "wp-clone"){
     454                        $(".banner-1-collapsed").show();
     455                        $(".banner-1").hide();
     456                    }else{
     457                        $(".banner-1-collapsed").show();
     458                        $(".banner-1").hide();
     459                    }
     460                }else if(data.data.wpclone_ajax_banner1_close === "0" && data.data.wpclone_ajax_banner1_removed === "0"){
     461                    if(currentPage === "wp-clone"){
     462                        $(".banner-1-collapsed").hide();
     463                        $(".banner-1").show();
     464                    }else{
     465                        $(".banner-1-collapsed").show();
     466                        $(".banner-1").hide();
     467                    }
     468                }
     469            },
     470            error: function(e){
     471            }
     472        });
     473    });
     474    $("a#show-large-banner-1").on("click", function(){
     475        $(".banner-1-collapsed").hide();
     476        $(".banner-1").show(100);
     477    });
     478    $("#please-first-read-it").on("click", function(){
     479        $(".banner-1-collapsed").hide();
     480        $(".banner-1").show(100);
     481    });
     482    $(".banner-1 .close-icon").on("click", function (e) {
     483        $(".banner-1-collapsed").show(100);
     484        $(".banner-1").hide(100);
     485
     486        $.ajax({
     487            url: ajaxurl,
     488            type: \'get\',
     489            data: {
     490                \'action\': \'wpclone-ajax-banner1-close\'
     491            },
     492            success: function(data){
     493                console.log(data);
     494            },
     495            error: function(e){
     496            }
     497        });
     498    })
     499
     500    $(".banner-1-collapsed #remove-for-good-text").on("click", function (e) {
     501        $(".banner-1-collapsed").hide();
     502
     503        $.ajax({
     504            url: ajaxurl,
     505            type: \'get\',
     506            data: {
     507                \'action\': \'wpclone-ajax-banner1-removed\'
     508            },
     509            success: function(data){
     510                console.log(data);
     511            },
     512            error: function(e){
     513            }
     514        });
     515    })
     516    });
     517</script>';
     518}
     519
     520function wpclone_admin_notice__success() {
     521    ?>
     522    <script type="text/javascript" src="https://sellcodes.com/quick_purchase/q1OGuSox/embed.js" async="async"></script>
     523    <div  style="clear: both; margin-top: 2px;"></div>
     524    <div class="plugin-large-notice">
     525        <div class="banner-1-collapsed" style="display:none; background-image: url('<?php echo plugins_url( 'lib/img/banner_bg_fold_2.jpg', __FILE__ )?>')">
     526            <p class="left-text"><strong>BIG NEWS:</strong> We want WP Clone to arise from the dead. <a href="#" id="show-large-banner-1">Read more</a></p>
     527            <p class="remove-for-good"><span id="remove-for-good-text" style="text-decoration: underline">Remove for good</span> <span style="font-size: 14px; cursor: pointer;">(please first <span id="please-first-read-it" style="text-decoration: underline">read it</span>!)</span></p>
     528        </div>
     529        <div class="banner-1" style="display:none;background-image: url('<?php echo plugins_url( 'lib/img/banner_bg.jpg', __FILE__ )?>')">
     530            <div class="close-icon"><img src='<?php echo plugins_url( 'lib/img/banner_close_icon.png', __FILE__ )?>'> </div>
     531            <div class="heading">BIG NEWS: <strong>We want WP Clone to arise from the dead.</strong> Please help us!</div>
     532            <div style="margin-top: 27px; font-size: 20px; color: #3a3a3a">The key points in a nutshell:</div>
     533            <div class="nutshell-list">
     534                <ul>
     535                    <li>1.  New contributors have been added to the plugin, and with it comes new motivation to make it a kick-ass product!</li>
     536                    <li>2.  Some fixes have been applied, the plugin now works in 90% of cases (and a further 9% if you follow the process as
     537                        outlined on the <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank">plugin page</a>)</li>
     538                    <li>
     539                        3.  We want to revive the plugin, make it work in 100% of cases, and add many more features. As we’re short on cash,
     540                        we’re crowdfunding it, and need your help:
     541                        <ul style="margin-left: 30px;margin-top: 15px;">
     542                            <li>
     543                                a.  <span class="sellcodes-quick-purchase" style="float: none;"><span style="text-decoration: underline; font-family: 'Montserrat', sans-serif;" class="sc-button" data-product-id="q1OGuSox" data-option-id="FgUPGiaV">Contribution of 5 or 10 USD:</span></span> You get the warm fuzzy feeling from giving a sincere “Thank you” for a plugin which <br>
     544                                probably made your life easier in the past, and helping to further develop it. Plus: a free backlink to your site!
     545                            </li>
     546                            <li>
     547                                b.  <span class="sellcodes-quick-purchase" style="float: none;"><span style="text-decoration: underline; font-family: 'Montserrat', sans-serif;" class="sc-button" data-product-id="q1OGuSox" data-option-id="HtNSwPAK">Contribution of 15 USD:</span></span> As in a), plus you will be rewarded with a <strong>free plugin license</strong> <br>
     548                                (for the premium product which we will create). A contribution of 30 USD gets you 2 licenses.
     549                            </li>
     550                            <li>
     551                                c.  <span class="sellcodes-quick-purchase" style="float: none;"><span style="text-decoration: underline; font-family: 'Montserrat', sans-serif;" class="sc-button" data-product-id="q1OGuSox" data-option-id="3DV66HIl">Contribution of 50 USD:</span></span>  As in a), plus an <strong>unlimited websites premium license.</strong> <br>
     552                                This a fantastic, one-time deal. The plugin will provide many more features <br>
     553                                - such as backup scheduling, backup to external servers etc. - while still <br>being super-easy to use! It will be the best on the market – <strong style="text-decoration: underline">guaranteed</strong>.
     554                            </li>
     555                        </ul>
     556                    </li>
     557                </ul>
     558            </div>
     559            <div class="banner-footer">
     560                <span>All licenses are <strong>lifetime licenses</strong> and valid on both commercial and non-commercial <br>websites. The crowdfunding target is USD 3,000. If we don’t reach it you’ll be refunded*.</span> <br> <br>
     561                Thank you for your support - we <span style="text-decoration: underline;">really</span> depend on it!
     562            </div>
     563            <div style="margin-top: 33px;">
     564                <a href="#" class="button1"><span class="sellcodes-quick-purchase" style="float: none;"><span style="letter-spacing: 1.2px; color: #ffffff; text-decoration: none; font-family: 'Montserrat', sans-serif;" class="sc-button" data-product-id="q1OGuSox" data-option-id="FgUPGiaV">Contribute</span></span></a>
     565                <a href="#" class="button1"><span class="sellcodes-quick-purchase" style="float: none;"><span style="letter-spacing: 1.2px; color: #ffffff; text-decoration: none; font-family: 'Montserrat', sans-serif;" class="sc-button" data-product-id="q1OGuSox" data-option-id="3DV66HIl">Contribute & get free license(s)</span></span></a>
     566            </div>
     567            <p style="margin-top: 33px;">
     568                Also check out the <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank" style="color: #0f9087">updated plugin description.</a> To follow our funding progress please go <a href="https://sellcodes.com/q1OGuSox" target="_blank" style="color: #0f9087">here</a>.
     569            </p>
     570            <p style="margin-top: 33px; color: #0f9087">
     571                *With the exception of the 5 or 10 USD amounts. We want you to have that warm fuzzy feeling forever ;)
     572            </p>
     573        </div>
     574    </div>
     575    <?php
     576}
Note: See TracChangeset for help on using the changeset viewer.