コード例 #1
0
 /**
  * Creates a new instance of this class.
  *
  * @param int     $reference the `post_id` or a page URL that uniquely identifies a page.
  * @param boolean $internal  whether this page is internal to WordPress or external.
  *                           Default: `true`.
  *
  * @return NelioABPageAccessedAction a new instance of this class.
  *
  * @since PHPDOC
  */
 public function __construct($reference, $internal = true)
 {
     if (!$internal) {
         parent::__construct(NelioABAction::EXTERNAL_PAGE_ACCESSED);
     } else {
         parent::__construct(NelioABAction::POST_ACCESSED);
     }
     $this->reference = $reference;
     $this->title = __('Undefined', 'nelioab');
     $this->indirect = false;
     $this->internal = $internal;
     // Fixing type appropriately
     if ($internal) {
         $p = get_post($this->get_reference(), ARRAY_A);
         if ($p) {
             if ($p['post_type'] == 'page') {
                 $this->type = NelioABAction::PAGE_ACCESSED;
             } else {
                 $this->type = NelioABAction::POST_ACCESSED;
             }
         }
     }
 }
コード例 #2
0
 /**
  * Creates a new instance of this class.
  *
  * @param string $type    PHPDOC
  * @param string $form_id PHPDOC
  *
  * @return NelioABFormSubmissionAction a new instance of this class.
  *
  * @since PHPDOC
  */
 public function __construct($type, $form_id)
 {
     parent::__construct($type);
     $this->form_id = $form_id;
     $this->indirect = false;
 }
コード例 #3
0
 /**
  * Creates a new instance of this class.
  *
  * @param string $mode  PHPDOC
  * @param string $value PHPDOC
  *
  * @return NelioABClickElementAction a new instance of this class.
  *
  * @since PHPDOC
  */
 public function __construct($mode, $value)
 {
     parent::__construct(self::CLICK_ELEMENT);
     $this->mode = $mode;
     $this->value = $value;
 }
コード例 #4
0
 /**
  * PHPDOC
  *
  * @param object            $json_goal PHPDOC
  * @param NelioABExperiment $exp       PHPDOC
  *
  * @return NelioABAltExpGoal PHPDOC
  *
  * @since PHPDOC
  */
 public static function build_goal_using_json4js($json_goal, $exp)
 {
     $goal = new NelioABAltExpGoal($exp);
     // If the goal was new, but it was also deleted, do nothing...
     if (isset($json_goal->wasDeleted) && $json_goal->wasDeleted) {
         if ($json_goal->id < 0) {
             return false;
         } else {
             $goal->set_to_be_deleted(true);
         }
     }
     $goal->set_id($json_goal->id);
     $goal->set_name($json_goal->name);
     if (isset($json_goal->benefit) && !empty($json_goal->benefit)) {
         $goal->set_benefit($json_goal->benefit);
     } else {
         $goal->set_benefit(NelioABSettings::get_def_conv_value());
     }
     foreach ($json_goal->actions as $json_action) {
         $action = NelioABAction::build_action_using_json4js($json_action);
         if ($action) {
             $goal->add_action($action);
         }
     }
     return $goal;
 }
コード例 #5
0
 /**
  * Creates a new instance of this class.
  *
  * @param int $product_id the `product_id` that identifies a product.
  *
  * @return NelioABWooCommerceOrderCompletedAction a new instance of this class.
  *
  * @since PHPDOC
  */
 public function __construct($product_id)
 {
     parent::__construct(NelioABAction::WC_ORDER_COMPLETED);
     $this->product_id = $product_id;
 }