array( 'description' => 'dd Month yyyy', 'date' => date( 'dS F Y', time() ), ), 'F d Y' => array( 'description' => 'Month dd yyyy', 'date' => date( 'F d Y', time() ), ), 'Y-m-d' => array( 'description' => 'yyyy-mm-dd', 'date' => date( 'Y-m-d', time() ), ), 'Y/m/d' => array( 'description' => 'yyyy/mm/dd', 'date' => date( 'Y/m/d', time() ), ), 'd/m/Y' => array( 'description' => 'dd/mm/yyyy', 'date' => date( 'd/m/Y', time() ), ), ); if ( $format == 'all' ) { return $all_formats; } $extracted = array(); foreach ( $all_formats as $k => $v ) { if ( $format == $k ) { $extracted[ $k ] = $v; } } return $extracted; } /** * Get the timezone int * * @param $tzstring * * @return mixed */ public static function get_timezone( $tzstring ) { $timezone = 0; if ( $tzstring ) { if ( preg_match( '/^UTC[+-]/', $tzstring ) ) { $timezone = preg_replace( '/UTC\+?/', '', $tzstring ); } else { $timezone_obj = new DateTimeZone( $tzstring ); $timezone = timezone_offset_get( $timezone_obj, date_create() ) / 3600; } } return $timezone; } /** * Design types with details * name translated name * description translated description * * @return array */ public static function campaign_types_details() { return array( static::CAMPAIGN_TYPE_ABSOLUTE => array( 'name' => __( 'Fixed Dates Campaign', 'thrive-ult' ), 'image' => 'tvd-absolute-campaign.png', 'tooltip' => __( 'Use this campaign type for an offer with predefined start and end dates. For instance, an offer available between the 5th and 12th of November.', 'thrive-ult' ), ), static::CAMPAIGN_TYPE_ROLLING => array( 'name' => __( 'Recurring Campaign', 'thrive-ult' ), 'image' => 'tvd-rolling-campaign.png', 'tooltip' => __( 'Use this campaign type for an offer with a definite repetition cycle. For instance, an offer that starts on November 5th and is repeated monthly.', 'thrive-ult' ), ), static::CAMPAIGN_TYPE_EVERGREEN => array( 'name' => __( 'Evergreen Campaign', 'thrive-ult' ), 'image' => 'tvd-evergreen-campaign.png', 'tooltip' => __( 'Use this campaign type for offers triggered by user actions, not by dates. For instance, an offer showing for 7 days after a new user subscribes to a newsletter', 'thrive-ult' ), ), ); } /** * Design types with details * name translated name * description translated description * * @return array */ public static function design_types_details() { return array( static::DESIGN_TYPE_HEADER_BAR => array( 'name' => __( 'Top ribbon', 'thrive-ult' ), 'description' => __( 'shows at the top of the screen', 'thrive-ult' ), 'image' => 'tvu-header-bar-design.png', 'edit_selector' => '.thrv_ult_bar', ), static::DESIGN_TYPE_FOOTER_BAR => array( 'name' => __( 'Bottom ribbon', 'thrive-ult' ), 'description' => __( 'shows at the bottom of the screen', 'thrive-ult' ), 'image' => 'tvu-footer-bar-design.png', 'edit_selector' => '.thrv_ult_bar', ), static::DESIGN_TYPE_WIDGET => array( 'name' => __( 'Widget', 'thrive-ult' ), 'description' => __( 'displays in any widget area on your site', 'thrive-ult' ), 'image' => 'tvu-widget-design.png', 'edit_selector' => '.thrv_ult_widget', ), static::DESIGN_TYPE_SHORTCODE => array( 'name' => __( 'Shortcode', 'thrive-ult' ), 'description' => __( 'display shortcode design in your content', 'thrive-ult' ), 'image' => 'tvu-shortcode-design.png', 'edit_selector' => '.thrv_ult_shortcode', ), ); } /** * Gets details for a specific design type * * @param $design_type * * @return null|array */ public static function design_details( $design_type ) { $designs = static::design_types_details(); if ( ! array_key_exists( $design_type, $designs ) ) { return null; } return $designs[ $design_type ]; } /** * Campaign attribute templates with details * name translated name * description translated description * * @return array */ public static function campaign_attribute_templates() { $event = TU_Event_Action::get_details( TU_Event_Action::DESIGN_SHOW ); return array( '0' => array( 'id' => '0', 'is_empty' => true, 'name' => __( 'Build from scratch', 'thrive-ult' ), 'description' => 'Build a campaign from scratch with no predefined settings', 'image' => static::plugin_url( 'admin/img/tvu-campaign-template1.png' ), 'type' => '', 'rolling_type' => '', 'status' => static::CAMPAIGN_STATUS_PAUSED, 'settings' => '', ), '1' => array( 'id' => '1', 'name' => __( '7 day offer', 'thrive-ult' ), 'description' => __( '7 day Evergreen offer triggered when a user first visits the site. 3 days before the end of the 7 day period, the state is changed to display that the offer is in its last 3 days.', 'thrive-ult' ), 'image' => static::plugin_url( 'admin/img/tvu-campaign-template2.png' ), 'type' => static::CAMPAIGN_TYPE_EVERGREEN, 'rolling_type' => '', 'status' => static::CAMPAIGN_STATUS_PAUSED, 'settings' => array( 'start' => array( 'date' => tve_ult_current_time( 'j F Y' ), 'time' => '00:00', ), 'end' => '10000', 'duration' => '7', 'repeat' => 0, 'real' => 0, 'repeatOn' => array(), 'trigger' => array( 'type' => static::TRIGGER_TYPE_FIRST_VISIT, 'ids' => '', ), ), 'designs' => array( 'design_0' => array( 'post_type' => static::DESIGN_TYPE_HEADER_BAR, 'post_title' => '7 day offer', 'post_parent' => '', 'post_status' => TVE_Ult_Const::STATUS_PUBLISH, 'parent_id' => 0, 'tcb_fields' => array(), 'tpl' => 'ribbon|set_01', 'states' => array( 'state_0' => array( 'post_title' => 'Last 3 days', 'post_type' => static::DESIGN_TYPE_HEADER_BAR, 'post_parent' => '', 'post_status' => TVE_Ult_Const::STATUS_PUBLISH, 'parent_id' => 0, 'tcb_fields' => array(), 'tpl' => 'ribbon|set_01', ), ), ), ), 'events' => array( 'event_0' => array( 'campaign_id' => 0, 'actions' => array( '0' => array( 'key' => $event['key'], 'design' => 'design_0', 'state' => 'state_0', 'name' => $event['name'] . ' 7 day offer (Last 3 days!)', ), ), 'days' => 3, 'hours' => 0, ), ), ), '2' => array( 'id' => '2', 'name' => __( 'Christmas special', 'thrive-ult' ), 'description' => __( 'Triggered to start and end on specific dates. When the offer has 2 days left, the state is changed to reflect the small amount of time before the offer expires.', 'thrive-ult' ), 'image' => static::plugin_url( 'admin/img/tvu-campaign-template3.png' ), 'type' => static::CAMPAIGN_TYPE_ABSOLUTE, 'rolling_type' => '', 'status' => static::CAMPAIGN_STATUS_PAUSED, 'settings' => array( 'start' => array( 'date' => '17 December ' . tve_ult_current_time( 'Y' ), 'time' => '00:00', ), 'end' => array( 'date' => '24 December ' . tve_ult_current_time( 'Y' ), 'time' => '00:00', ), 'duration' => '1', 'repeat' => '1', 'repeatOn' => array(), 'trigger' => array( 'type' => '', 'ids' => '', ), ), 'designs' => array( 'design_0' => array( 'post_type' => static::DESIGN_TYPE_HEADER_BAR, 'post_title' => 'Christmas special', 'post_parent' => '', 'post_status' => TVE_Ult_Const::STATUS_PUBLISH, 'parent_id' => 0, 'tcb_fields' => array(), 'tpl' => 'ribbon|set_01', 'states' => array( 'state_0' => array( 'post_title' => '2 days left!', 'post_type' => static::DESIGN_TYPE_HEADER_BAR, 'post_parent' => '', 'post_status' => TVE_Ult_Const::STATUS_PUBLISH, 'parent_id' => 0, 'tcb_fields' => array(), 'tpl' => 'ribbon|set_01', ), ), ), ), 'events' => array( 'event_0' => array( 'campaign_id' => 0, 'actions' => array( '0' => array( 'key' => $event['key'], 'design' => 'design_0', 'state' => 'state_0', 'name' => $event['name'] . ' Christmas special (2 days left!)', ), ), 'days' => 2, 'hours' => 0, ), ), ), '3' => array( 'id' => '3', 'name' => __( 'End of month specials', 'thrive-ult' ), 'description' => __( 'Triggered to start on a certain day of the month and to last for 2 days.', 'thrive-ult' ), 'image' => static::plugin_url( 'admin/img/tvu-campaign-template4.png' ), 'type' => static::CAMPAIGN_TYPE_ROLLING, 'rolling_type' => static::CAMPAIGN_ROLLING_TYPE_MONTHLY, 'status' => static::CAMPAIGN_STATUS_PAUSED, 'settings' => array( 'start' => array( 'date' => tve_ult_current_time( 'j F Y' ), 'time' => '00:00', ), 'end' => '', 'duration' => '2', 'repeat' => '1', 'repeatOn' => array( 28 ), 'trigger' => array( 'type' => '', 'ids' => '', ), ), 'designs' => array( 'design_0' => array( 'post_type' => static::DESIGN_TYPE_HEADER_BAR, 'post_parent' => '', 'post_status' => TVE_Ult_Const::STATUS_PUBLISH, 'parent_id' => 0, 'tcb_fields' => array(), 'tpl' => 'ribbon|set_01', 'states' => array(), ), ), 'events' => array(), ), ); } /** * Gets details for a specific campaign attribute template * * @param $template_key * * @return null|array */ public static function campaign_template_details( $template_key ) { $templates = static::campaign_attribute_templates(); if ( ! array_key_exists( $template_key, $templates ) ) { return null; } return $templates[ $template_key ]; } /** * A list with all fields that TCB uses to store various pieces of content / flags * * @return array */ public static function editor_fields() { return array( static::FIELD_CUSTOM_FONTS, static::FIELD_GLOBALS, static::FIELD_MASONRY, static::FIELD_TYPEFOCUS, static::FIELD_ICON_PACK, static::FIELD_INLINE_CSS, static::FIELD_CONTENT, static::FIELD_USER_CSS, static::FIELD_TEMPLATE, static::FIELD_STATE_INDEX, static::FIELD_STATE_VISIBILITY, static::FIELD_DISPLAY_POSITION, ); } /** * All possible event types * * @return array */ public static function event_types() { return array( static::EVENT_TYPE_START => static::EVENT_TYPE_START, static::EVENT_TYPE_TIME => static::EVENT_TYPE_TIME, static::EVENT_TYPE_CONV => static::EVENT_TYPE_CONV, static::EVENT_TYPE_END => static::EVENT_TYPE_END, ); } /** * Possible log types. * * @return array */ public static function log_types() { return array( static::LOG_TYPE_CONVERSION, static::LOG_TYPE_IMPRESSION, ); } }