Skip to content

Commit

Permalink
Merge pull request #975 from Codeinwp/feat/pro/523
Browse files Browse the repository at this point in the history
Removed some free features for new users
  • Loading branch information
selul authored Jul 10, 2024
2 parents 5c58fbf + 84d7961 commit da0b9b5
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 34 deletions.
9 changes: 9 additions & 0 deletions includes/admin/class-rop-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,15 @@ public function enqueue_scripts() {
$rop_api_settings['tracking'] = 'yes' === get_option( 'tweet_old_post_logger_flag', 'no' );
$rop_api_settings['tracking_info_link'] = sanitize_url( 'https://docs.revive.social/article/2008-revive-old-posts-usage-tracking' );

$is_new_user = (int) get_option( 'rop_is_new_user', 0 );
$install_time = ! $is_new_user ? (int) get_option( 'rop_first_install_date', 0 ) : 0;

if ( ! $is_new_user && ( $install_time && $install_time >= strtotime( '-1 hour' ) ) ) {
$is_new_user = update_option( 'rop_is_new_user', 1 );
}

$rop_api_settings['is_new_user'] = $is_new_user;

wp_localize_script( $this->plugin_name . '-' . $page, 'ropApiSettings', $rop_api_settings );
wp_localize_script( $this->plugin_name . '-' . $page, 'ROP_ASSETS_URL', array( ROP_LITE_URL . 'assets/' ) );
wp_localize_script( $this->plugin_name . '-' . $page, 'ropAuthAppData', $rop_auth_app_data );
Expand Down
14 changes: 7 additions & 7 deletions includes/admin/class-rop-global-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -207,7 +207,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -229,7 +229,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -252,7 +252,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -273,7 +273,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -294,7 +294,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand All @@ -316,7 +316,7 @@ class Rop_Global_Settings {
'url_from_meta' => false,
'url_meta_key' => '',
'short_url' => false,
'short_url_service' => 'is.gd',
'short_url_service' => 'rviv.ly',
'hashtags' => 'no-hashtags',
'hashtags_length' => '200',
'hashtags_common' => '',
Expand Down
18 changes: 12 additions & 6 deletions includes/admin/models/class-rop-settings-model.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,42 +52,48 @@ class Rop_Settings_Model extends Rop_Model_Abstract {
* @var array $shorteners The class defaults for shorteners.
*/
private static $shorteners = array(
'rviv.ly' => array(
'id' => 'rviv.ly',
'name' => 'rviv.ly',
'active' => true,
'is_free' => true,
),
'bit.ly' => array(
'id' => 'bit.ly',
'name' => 'bit.ly',
'active' => true,
'is_free' => false,
),
'firebase' => array(
'id' => 'firebase',
'name' => 'google firebase',
'active' => true,
'is_free' => false,
),
'ow.ly' => array(
'id' => 'ow.ly',
'name' => 'ow.ly',
'active' => true,
'is_free' => false,
),
'is.gd' => array(
'id' => 'is.gd',
'name' => 'is.gd',
'active' => true,
'is_free' => false,
),
'rebrand.ly' => array(
'id' => 'rebrand.ly',
'name' => 'rebrand.ly',
'active' => true,
'is_free' => false,
),
'wp_short_url' => array(
'id' => 'wp_short_url',
'name' => 'wp_short_url',
'active' => true,
'is_free' => true,
),
// TODO Reintroduce Rvivly after refactor
// 'rviv.ly' => array(
// 'id' => 'rviv.ly',
// 'name' => 'rviv.ly',
// 'active' => false,
// ),
);

/**
Expand Down
3 changes: 3 additions & 0 deletions includes/class-rop-i18n.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ public static function get_labels( $key = '' ) {
'instagram_image_post_default' => sprintf( __( '%1$sNote:%2$s Instagram posts need to be an image.', 'tweet-old-post' ), '<strong>', '</strong>' ),
'vk_unsupported_shorteners' => sprintf( __( '%1$sNote:%2$s is.gd shortener is not currently supported by VK.com.', 'tweet-old-post' ), '<strong>', '</strong>' ),
'not_available_with_rop_server' => __( 'This feature is not available for X accounts authorized via Revival Social.', 'tweet-old-post' ),
'custom_meta_field_upsell' => __( 'Custom meta fields are only available in the Pro version.', 'tweet-old-post' ),
'custom_meta_upsell' => __( 'Custom fields are only available in the Pro version.', 'tweet-old-post' ),
'hashtag_field_upsell' => __( 'The selected option is only available in the Pro version.', 'tweet-old-post' ),
),
'schedule' => array(
'menu_item' => __( 'Custom Schedule', 'tweet-old-post' ),
Expand Down
2 changes: 1 addition & 1 deletion tests/test-post-format.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function test_post_format() {
$this->assertEquals( 'post_title', $defaults['post_content'] );
$this->assertEquals( '240', $defaults['maximum_length'] );
$this->assertEquals( false, $defaults['short_url'] );
$this->assertEquals( 'is.gd', $defaults['short_url_service'] );
$this->assertEquals( 'rviv.ly', $defaults['short_url_service'] );
$this->assertEquals( true, $defaults['include_link'] );
$new_data = $defaults;
$new_data['include_link'] = false;
Expand Down
1 change: 1 addition & 0 deletions uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
'rop_tumblr_via_rs_app',
'rop_data_migrated_tax',
'rop_changed_shortener',
'rop_is_new_user',
/**
* Old ROP options
*/
Expand Down
1 change: 1 addition & 0 deletions vue/src/models/rop_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export default new Vuex.Store({
rop_cron_remote: ropApiSettings.rop_cron_remote,
dom_updated: false,
tracking: Boolean( ropApiSettings.tracking ),
is_new_user: Boolean( ropApiSettings.is_new_user ),
},
mutations: {

Expand Down
Loading

0 comments on commit da0b9b5

Please sign in to comment.