Skip to content

Commit

Permalink
Merge pull request #1 from kprajapatii/master
Browse files Browse the repository at this point in the history
Update textdomain - CHANGED
  • Loading branch information
kprajapatii authored Dec 14, 2023
2 parents 1af7cde + 1f35551 commit d9d9ba8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 37 deletions.
48 changes: 12 additions & 36 deletions ayecode-connect-helper.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand All @@ -13,7 +12,7 @@
class AyeCode_Connect_Helper {

// Hold the version number
var $version = "1.0.3";
var $version = "1.0.4";

// Hold the default strings.
var $strings = array();
Expand All @@ -30,24 +29,20 @@ class AyeCode_Connect_Helper {
* @param array $pages
*/
public function __construct( $strings = array(), $pages = array() ) {

// Only fire if not localhost and the current user has the right permissions.
if ( ! $this->is_localhost() && current_user_can( 'manage_options' ) ) {


// set default strings
$default_strings = array(
'connect_title' => __( "Thanks for choosing an AyeCode Product!" ),
'connect_external' => __( "Please confirm you wish to connect your site?" ),
'connect' => sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s" ), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>" ),
'connect_button' => __( "Connect Site" ),
'connecting_button' => __( "Connecting..." ),
'error_localhost' => __( "This service will only work with a live domain, not a localhost." ),
'error' => __( "Something went wrong, please refresh and try again." ),
'connect_title' => __( "Thanks for choosing an AyeCode Product!", 'ayecode-connect' ),
'connect_external' => __( "Please confirm you wish to connect your site?", 'ayecode-connect' ),
'connect' => wp_sprintf( __( "<strong>Have a license?</strong> Forget about entering license keys or downloading zip files, connect your site for instant access. %slearn more%s", 'ayecode-connect' ), "<a href='https://ayecode.io/introducing-ayecode-connect/' target='_blank'>", "</a>" ),
'connect_button' => __( "Connect Site", 'ayecode-connect' ),
'connecting_button' => __( "Connecting...", 'ayecode-connect' ),
'error_localhost' => __( "This service will only work with a live domain, not a localhost.", 'ayecode-connect' ),
'error' => __( "Something went wrong, please refresh and try again.", 'ayecode-connect' ),
);
$this->strings = array_merge( $default_strings, $strings );


// set default pages
$default_pages = array();
$this->pages = array_merge( $default_pages, $pages );
Expand All @@ -65,7 +60,6 @@ public function __construct( $strings = array(), $pages = array() ) {
if ( ! has_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed' ) ) {
add_action( 'wp_ajax_nopriv_ayecode_connect_helper_installed', array( $this, 'ayecode_connect_helper_installed' ) );
}

}

/**
Expand Down Expand Up @@ -99,7 +93,6 @@ private function format_plugin_slug( $key ) {
* Install and activate the AyeCode Connect Plugin
*/
public function ayecode_connect_install() {

// bail if localhost
if ( $this->is_localhost() ) {
wp_send_json_error( $this->strings['error_localhost'] );
Expand Down Expand Up @@ -302,19 +295,13 @@ public function ayecode_connect_install_notice() {
</span>
<span class="acch-float-left acch-text">
<h3 class="acch-title"><?php echo esc_attr( $connect_title_string ); ?></h3>
<p>
<?php
echo $connect_string;
?>
<p><?php echo $connect_string; ?>
</p>
</span>

<span class="acch-float-left acch-button">
<button onclick="ayecode_connect_helper(this);" id="gd-connect-site"
class="button button-primary"
data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button>
<button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button>
</span>

</div>

<?php
Expand Down Expand Up @@ -361,11 +348,8 @@ class="button button-primary"
</span>

<span class="acch-float-left acch-button">
<button onclick="ayecode_connect_helper(this);" id="gd-connect-site"
class="button button-primary"
data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button>
<button onclick="ayecode_connect_helper(this);" id="gd-connect-site" class="button button-primary" data-connecting="<?php echo esc_attr( $connecting_button_string ); ?>"><?php echo esc_attr( $connect_button_string ) ?></button>
</span>

</div>
</div>
<?php
Expand Down Expand Up @@ -414,7 +398,6 @@ public function script() {
.acch-button {
zoom: 1.3;
}

</style>
<script>
/**
Expand Down Expand Up @@ -450,9 +433,7 @@ function ayecode_connect_helper($this) {
}
}
});
}


}
<?php
// add thickbox if external request is requested
if(! empty( $_REQUEST['external-connect-request'] )) {
Expand All @@ -465,7 +446,6 @@ function ayecode_connect_helper($this) {
<?php
}
?>

</script>
<?php
}
Expand All @@ -480,17 +460,13 @@ public function maybe_show() {

// check if on a page set to show
if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $this->pages ) ) {

// check if not active and connected
if ( ! defined( 'AYECODE_CONNECT_VERSION' ) || ! get_option( 'ayecode_connect_blog_token' ) ) {
$show = true;
}

}

return $show;
}

}

}
3 changes: 3 additions & 0 deletions change-log.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
= 1.0.4 - 2023-12-14 =
* Update textdomain - CHANGED

= 1.0.3 =
* Added version comparisons so we know if the connect message will show or not - ADDED
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ayecode/ayecode-connect-helper",
"version": "1.0.3",
"version": "1.0.4",
"type": "library",
"description": "Provides helper functionality for installing AyeCode Connect.",
"keywords": ["AyeCode","AyeCode Connect","wp"],
Expand Down

0 comments on commit d9d9ba8

Please sign in to comment.