balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

dashboard.php (12085B)


      1 <?php
      2 
      3 $seedprod_api_token = get_option( 'seedprod_api_token' );
      4 $license_key        = get_option( 'seedprod_api_key' );
      5 
      6 $current_user = wp_get_current_user();
      7 $name         = '';
      8 if ( ! empty( $current_user->user_firstname ) ) {
      9 	$name = $current_user->user_firstname . ',';
     10 }
     11 $email = $current_user->user_email;
     12 
     13 $timezones = seedprod_lite_get_timezones();
     14 
     15 // Pers
     16 $per               = array();
     17 $active_license    = false;
     18 $template_dev_mode = false;
     19 
     20 
     21 
     22 $license_name = '';
     23 
     24 
     25 // Get counts for pages and subscribers
     26 
     27 global $wpdb;
     28 $tablename  = $wpdb->prefix . 'postmeta';
     29 $sql        = "SELECT count(*) FROM $tablename WHERE meta_key = '_seedprod_page'";
     30 $page_count = $wpdb->get_var( $sql );
     31 if ( empty( $page_count ) ) {
     32 	$page_count = 0;
     33 }
     34 
     35 
     36 $subscriber_count = get_option( 'seedprod_subscriber_count' );
     37 if ( empty( $subscriber_count ) ) {
     38 	$subscriber_count = 1;
     39 }
     40 
     41 
     42 // Get notifications
     43 $notifications = new SeedProd_Notifications();
     44 $notifications = $notifications->get();
     45 
     46 
     47 $seedprod_settings = get_option( 'seedprod_settings' );
     48 if ( ! empty( $seedprod_settings ) ) {
     49 	$seedprod_settings = json_decode( stripslashes( $seedprod_settings ) );
     50 } else {
     51 	// fail safe incase settings go missing
     52 	require_once SEEDPROD_PLUGIN_PATH . 'resources/data-templates/default-settings.php';
     53 	update_option( 'seedprod_settings', $seedprod_default_settings );
     54 	$seedprod_settings = json_decode( $seedprod_default_settings );
     55 }
     56 if ( empty( $seedprod_settings ) || $seedprod_settings == 'false' ) {
     57 	// fail safe incase settings go missing
     58 	require_once SEEDPROD_PLUGIN_PATH . 'resources/data-templates/default-settings.php';
     59 	update_option( 'seedprod_settings', $seedprod_default_settings );
     60 	$seedprod_settings = json_decode( $seedprod_default_settings );
     61 }
     62 $seedprod_api_key = get_option( 'seedprod_api_key' );
     63 if ( $seedprod_api_key === false ) {
     64 	$seedprod_api_key = '';
     65 }
     66 
     67 $seedprod_app_settings = get_option( 'seedprod_app_settings' );
     68 if ( ! empty( $seedprod_app_settings ) ) {
     69 	$seedprod_app_settings = json_decode( stripslashes( $seedprod_app_settings ) );
     70 } else {
     71 	// fail safe incase settings go missing
     72 	require_once SEEDPROD_PLUGIN_PATH . 'resources/data-templates/default-settings.php';
     73 	update_option( 'seedprod_app_settings', $seedprod_app_default_settings );
     74 	$seedprod_app_settings = json_decode( $seedprod_app_default_settings );
     75 }
     76 
     77 $seedprod_upgrade_link = seedprod_lite_upgrade_link( '' );
     78 
     79 $lmsg = get_option( 'seedprod_api_message' );
     80 if ( empty( $lmsg ) ) {
     81 	$lmsg = '';
     82 }
     83 
     84 $lclass = 'alert-danger';
     85 if ( seedprod_lite_cu() ) {
     86 	$lclass = 'alert-success';
     87 }
     88 
     89 // get special page ids and uuids
     90 $csp_id    = get_option( 'seedprod_coming_soon_page_id' );
     91 $mmp_id    = get_option( 'seedprod_maintenance_mode_page_id' );
     92 $p404_id   = get_option( 'seedprod_404_page_id' );
     93 $loginp_id = get_option( 'seedprod_login_page_id' );
     94 
     95 $csp_uuid                = get_post_meta( $csp_id, '_seedprod_page_uuid', true );
     96 $mmp_uuid                = get_post_meta( $mmp_id, '_seedprod_page_uuid', true );
     97 $p404_uuid               = get_post_meta( $p404_id, '_seedprod_page_uuid', true );
     98 $loginp_uuid             = get_post_meta( $loginp_id, '_seedprod_page_uuid', true );
     99 $seedprod_csp4_migrated  = get_option( 'seedprod_csp4_migrated' );
    100 $seedprod_csp4_imported  = get_option( 'seedprod_csp4_imported' );
    101 $seedprod_cspv5_migrated = get_option( 'seedprod_cspv5_migrated' );
    102 $seedprod_cspv5_imported = get_option( 'seedprod_cspv5_imported' );
    103 
    104 // one time flush permalinks
    105 if ( empty( get_option( 'seedprod_onetime_flush_rewrite' ) ) ) {
    106 	flush_rewrite_rules();
    107 	update_option( 'seedprod_onetime_flush_rewrite', true );
    108 }
    109 
    110 $csp_preview_url = '';
    111 if ( ! empty( $csp_id ) ) {
    112 	$csp_preview_url = get_preview_post_link( $csp_id );
    113 	//$csp_preview_url = home_url(). "/?post_type=seedprod&page_id=".$csp_id."&preview_nonce=".wp_create_nonce('post_preview_' . $csp_id);
    114 	//$csp_preview_url = home_url(). '/?post_type=seedprod&p='.$csp_id.'&preview=true';
    115 }
    116 $mmp_preview_url = '';
    117 if ( ! empty( $mmp_id ) ) {
    118 	$mmp_preview_url = get_preview_post_link( $mmp_id );
    119 	//$mmp_preview_url = home_url(). "/?post_type=seedprod&page_id=".$mmp_id."&preview_nonce=".wp_create_nonce('post_preview_' . $mmp_id);
    120 	//$mmp_preview_url= home_url(). '/?post_type=seedprod&p='.$mmp_id.'&preview=true';
    121 }
    122 $p404_preview_url = '';
    123 if ( ! empty( $p404_id ) ) {
    124 	$p404_preview_url = get_preview_post_link( $p404_id );
    125 	//$p404_preview_url = home_url(). "/?post_type=seedprod&page_id=".$p404_id."&preview_nonce=".wp_create_nonce('post_preview_' . $p404_id);
    126 	//$p404_preview_url= home_url(). '/?post_type=seedprod&p='.$p404_id.'&preview=true';
    127 }
    128 
    129 $loginp_preview_url = '';
    130 if ( ! empty( $loginp_id ) ) {
    131 	$loginp_preview_url = get_preview_post_link( $loginp_id );
    132 	//$loginp_preview_url = home_url(). "/?post_type=seedprod&page_id=".$loginp_id."&preview_nonce=".wp_create_nonce('post_preview_' . $loginp_id);
    133 	//$loginp_preview_url= home_url(). '/?post_type=seedprod&p='.$loginp_id.'&preview=true';
    134 }
    135 
    136 
    137 
    138 $show_topbar_cta    = true;
    139 $dismiss_topbar_cta = get_option( 'seedprod_dismiss_upsell_1' );
    140 if ( $dismiss_topbar_cta ) {
    141 	$show_topbar_cta = false;
    142 }
    143 
    144 $show_inline_cta    = true;
    145 $dismiss_inline_cta = get_option( 'seedprod_dismiss_upsell_3' );
    146 if ( $dismiss_inline_cta ) {
    147 	$show_inline_cta = false;
    148 }
    149 ?>
    150 
    151 <link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
    152 <div id="seedprod-vue-app"></div>
    153 <script>
    154 var seedprod_remote_api = "<?php echo SEEDPROD_API_URL; ?>";
    155 
    156 <?php $seedprod_nonce = wp_create_nonce( 'seedprod_nonce' ); ?>
    157 var seedprod_nonce = "<?php echo $seedprod_nonce; ?>";
    158 
    159 
    160 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_run_one_click_upgrade', 'seedprod_lite_run_one_click_upgrade' ) ); ?>
    161 var seedprod_run_one_click_upgrade_url = "<?php echo $ajax_url; ?>";
    162 
    163 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_upgrade_license', 'seedprod_lite_upgrade_license' ) ); ?>
    164 var seedprod_upgrade_license_url = "<?php echo $ajax_url; ?>";
    165 
    166 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_dismiss_upsell', 'seedprod_lite_dismiss_upsell' ) ); ?>
    167 var seedprod_dismiss_upsell = "<?php echo $ajax_url; ?>";
    168 
    169 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_archive_selected_lpages', 'seedprod_lite_archive_selected_lpages' ) ); ?>
    170 var seedprod_archive_selected_lpages = "<?php echo $ajax_url; ?>";
    171 
    172 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_unarchive_selected_lpages', 'seedprod_lite_unarchive_selected_lpages' ) ); ?>
    173 var seedprod_unarchive_selected_lpages = "<?php echo $ajax_url; ?>";
    174 
    175 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_delete_archived_lpages', 'seedprod_lite_delete_archived_lpages' ) ); ?>
    176 var seedprod_delete_archived_lpages = "<?php echo $ajax_url; ?>";
    177 
    178 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_duplicate_lpage', 'seedprod_lite_duplicate_lpage' ) ); ?>
    179 var seedprod_duplicate_lpage_url = "<?php echo $ajax_url; ?>";
    180 
    181 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_get_plugins_list', 'seedprod_lite_get_plugins_list' ) ); ?>
    182 var seedprod_get_plugins_list_url = "<?php echo $ajax_url; ?>";
    183 
    184 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_install_addon', 'seedprod_lite_install_addon' ) ); ?>
    185 var seedprod_get_install_addon_url = "<?php echo $ajax_url; ?>";
    186 
    187 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_activate_addon', 'seedprod_lite_activate_addon' ) ); ?>
    188 var seedprod_activate_addon_url = "<?php echo $ajax_url; ?>";
    189 
    190 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_deactivate_addon', 'seedprod_lite_deactivate_addon' ) ); ?>
    191 var seedprod_deactivate_addon_url = "<?php echo $ajax_url; ?>";
    192 
    193 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_notification_dismiss', 'seedprod_lite_notification_dismiss' ) ); ?>
    194 var seedprod_notification_dismiss = "<?php echo $ajax_url; ?>";
    195 
    196 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_deactivate_api_key', 'seedprod_lite_deactivate_api_key' ) ); ?>
    197 var seedprod_api_key_deactivate_url = "<?php echo $ajax_url; ?>";
    198 
    199 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_plugin_nonce', 'seedprod_lite_plugin_nonce' ) ); ?>
    200 var seedprod_plugin_nonce_url = "<?php echo $ajax_url; ?>";
    201 
    202 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_update_subscriber_count', 'seedprod_lite_update_subscriber_count' ) ); ?>
    203 var seedprod_update_subscriber_count = "<?php echo $ajax_url; ?>";
    204 
    205 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_delete_subscribers', 'seedprod_lite_delete_subscribers' ) ); ?>
    206 var seedprod_delete_subscribers_url = "<?php echo $ajax_url; ?>";
    207 
    208 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_export_subscribers', 'seedprod_lite_export_subscribers' ) ); ?>
    209 var seedprod_export_subscribers_url = "<?php echo $ajax_url; ?>";
    210 
    211 <?php $ajax_url = html_entity_decode( wp_nonce_url( 'admin-ajax.php?action=seedprod_lite_save_app_settings', 'seedprod_lite_save_app_settings' ) ); ?>
    212 var seedprod_save_app_settings_ajax_url = "<?php echo $ajax_url; ?>";
    213 
    214 <?php
    215 $seedprod_unsupported_feature = get_option( 'seedprod_unsupported_feature' );
    216 if ( ! empty( $seedprod_unsupported_feature ) ) {
    217 	$seedprod_unsupported_feature = implode( ',', $seedprod_unsupported_feature );
    218 }
    219 ?>
    220 
    221 var seedprod_data_admin =
    222 	<?php
    223 	echo wp_json_encode(
    224 		array(
    225 			'show_inline_cta'              => $show_inline_cta,
    226 			'show_topbar_cta'              => $show_topbar_cta,
    227 			'seedprod_unsupported_feature' => $seedprod_unsupported_feature,
    228 			'seedprod_csp4_migrated'       => $seedprod_csp4_migrated,
    229 			'seedprod_csp4_imported'       => $seedprod_csp4_imported,
    230 			'seedprod_cspv5_migrated'      => $seedprod_cspv5_migrated,
    231 			'seedprod_cspv5_imported'      => $seedprod_cspv5_imported,
    232 			'page_count'                   => $page_count,
    233 			'subscriber_count'             => $subscriber_count,
    234 			'notifications'                => $notifications,
    235 			'csp_id'                       => $csp_id,
    236 			'csp_uuid'                     => $csp_uuid,
    237 			'csp_preview_url'              => $csp_preview_url,
    238 			'mmp_id'                       => $mmp_id,
    239 			'mmp_uuid'                     => $mmp_uuid,
    240 			'mmp_preview_url'              => $mmp_preview_url,
    241 			'p404_id'                      => $p404_id,
    242 			'p404_uuid'                    => $p404_uuid,
    243 			'p404_preview_url'             => $p404_preview_url,
    244 			'loginp_id'                    => $loginp_id,
    245 			'loginp_uuid'                  => $loginp_uuid,
    246 			'loginp_preview_url'           => $loginp_preview_url,
    247 			'api_token'                    => $seedprod_api_token,
    248 			'license_key'                  => $license_key,
    249 			'license_name'                 => $license_name,
    250 			'per'                          => $per,
    251 			'active_license'               => $active_license,
    252 			'page_path'                    => 'seedprod_lite',
    253 			'plugin_path'                  => SEEDPROD_PLUGIN_URL,
    254 			'home_url'                     => home_url(),
    255 			'upgrade_link'                 => $seedprod_upgrade_link,
    256 			'timezones'                    => $timezones,
    257 			'api_key'                      => $seedprod_api_key,
    258 			'name'                         => $name,
    259 			'email'                        => $email,
    260 			'lmsg'                         => $lmsg,
    261 			'lclass'                       => $lclass,
    262 			'settings'                     => $seedprod_settings,
    263 			'app_settings'                 => $seedprod_app_settings,
    264 			'template_dev_mode'            => $template_dev_mode,
    265 			'dismiss_settings_lite_cta'    => get_option( 'seedprod_dismiss_settings_lite_cta' ),
    266 		)
    267 	);
    268 	?>
    269 			;
    270 
    271 
    272 
    273 </script>