示例#1
0
 /**
  * Run administrative actions on landing page
  */
 public static function run_actions()
 {
     if (!isset($_GET['post'])) {
         return;
     }
     $post = get_post($_GET['post']);
     if (!isset($post) || $post->post_type != 'landing-page') {
         return;
     }
     self::$current_vid = Landing_Pages_Variations::get_current_variation_id($post->ID);
     self::$variations = Landing_Pages_Variations::get_variations($post->ID);
     /*check for delete command */
     if (isset($_GET['ab-action']) && $_GET['ab-action'] == 'delete-variation') {
         Landing_Pages_Variations::delete_variation($post->ID, $_REQUEST['action-variation-id']);
     }
     /*check for pause command */
     if (isset($_GET['ab-action']) && $_GET['ab-action'] == 'pause-variation') {
         Landing_Pages_Variations::pause_variation($post->ID, $_REQUEST['action-variation-id']);
     }
     /*check for pause command */
     if (isset($_GET['ab-action']) && $_GET['ab-action'] == 'play-variation') {
         Landing_Pages_Variations::play_variation($post->ID, $_REQUEST['action-variation-id']);
     }
     self::$is_new = isset($_GET['new-variation']) ? 1 : 0;
     self::$is_clone = isset($_GET['clone']) ? $_GET['clone'] : null;
     self::$content_area = Landing_Pages_Variations::get_post_content($post->ID);
     isset($_GET['new-variation']) && $_GET['new-variation'] == 1 ? $new_variation = 1 : ($new_variation = 0);
     /*if new variation and cloning then programatically prepare the next variation id */
     if (self::$is_new) {
         $_SESSION['lp_ab_test_open_variation'] = Landing_Pages_Variations::prepare_new_variation_id($post->ID);
     }
 }