array( 'type' => 'str', 'restricted' => array_keys( self::placement_positions() ), ), 'disable_consent' => array( 'type' => 'bool', ), 'within_content_position' => array( 'type' => 'int', 'default' => 10, 'restricted' => array( 10, 20, 30, 40, 50, 60, 70, 80, 90 ), 'required' => array( 'placement_position' => 'within_content' ), ), 'paragraph_number' => array( 'type' => 'int', 'default' => 2, 'required' => array( 'placement_position' => 'after_p_tag' ), ), 'post_list_position' => array( 'type' => 'int', 'default' => 1, 'required' => array( 'placement_position' => 'post_list' ), ), 'popup_display_when' => array( 'type' => 'str', 'default' => 'after_num_seconds', 'required' => array( 'placement_position' => 'popup' ), ), 'popup_after_num_seconds' => array( 'type' => 'int', 'default' => 20, 'required' => array( 'placement_position' => 'popup' ), ), 'popup_after_percent_scroll' => array( 'type' => 'int', 'default' => 20, 'required' => array( 'placement_position' => 'popup' ), ), 'popup_hide_close_btn' => array( 'type' => 'bool', 'required' => array( 'placement_position' => 'popup' ), ), 'popup_auto_close_seconds' => array( 'type' => 'int', 'default' => 0, 'required' => array( 'placement_position' => 'popup' ), ), 'popup_overlay_bg' => array( 'type' => 'str', 'default' => 'rgba(0, 0, 0, 0.25)', 'required' => array( 'placement_position' => 'popup' ), ), 'popup_position' => array( 'type' => 'str', 'default' => 0, 'required' => array( 'placement_position' => 'popup' ), 'restricted' => array_keys( self::allowed_popup_positions() ), ), 'sticky_display_when' => array( 'type' => 'str', 'default' => 'on_load', 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_after_num_seconds' => array( 'type' => 'int', 'default' => 20, 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_after_percent_scroll' => array( 'type' => 'int', 'default' => 20, 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_auto_close_seconds' => array( 'type' => 'int', 'default' => 0, 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_position' => array( 'type' => 'str', 'default' => 'center-top', 'required' => array( 'placement_position' => 'sticky' ), 'restricted' => array_keys( self::allowed_sticky_positions() ), ), 'sticky_margin_top' => array( 'type' => 'int', 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_margin_right' => array( 'type' => 'int', 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_margin_bottom' => array( 'type' => 'int', 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_margin_left' => array( 'type' => 'int', 'required' => array( 'placement_position' => 'sticky' ), ), 'sticky_show_close_button' => array( 'type' => 'bool', 'required' => array( 'placement_position' => 'sticky' ), ), 'disable_wrappers_body' => array( 'type' => 'bool', 'default' => 1, 'required' => array( 'placement_position' => 'body_close_tag' ), ), 'force_serverside_body' => array( 'type' => 'bool', 'default' => 1, 'required' => array( 'placement_position' => 'body_close_tag' ), ), 'placement_items' => array( 'type' => 'str', ), 'order' => array( 'type' => 'int', 'default' => 1, ), 'inject_at_bbpress_post' => array( 'type' => 'int', 'default' => 1, 'required' => array( 'placement_position' => bbPressInterface::bbpress_theme_placements() ), ), 'inject_at_buddypress_entry' => array( 'type' => 'int', 'default' => 1, 'required' => array( 'placement_position' => array_keys( buddyPressInterface::buddypress_placement_positions() ) ), ), ), TargetingMeta::post_meta_keys(), ); } /** * Insert position key/value array for use in admin and elsewhere. * * @return array */ public static function placement_positions() { $placements = array( 'before_content' => __( 'Content: Before Content', 'ad-commander' ), 'after_content' => __( 'Content: After Content', 'ad-commander' ), 'within_content' => __( 'Content: Within Content', 'ad-commander' ), 'after_p_tag' => __( 'Content: After Paragraph #', 'ad-commander' ), // 'above_title' => __( 'Above Title', 'ad-commander' ), 'post_list' => __( 'Post Lists (Blog, Archives, etc)', 'ad-commander' ), 'popup' => __( 'Popup Overlay', 'ad-commander' ), 'sticky' => __( 'Sticky', 'ad-commander' ), 'head_close_tag' => __( 'HTML: Before ', 'ad-commander' ), 'body_close_tag' => __( 'HTML: Before ', 'ad-commander' ), ); if ( bbPressInterface::is_bbpress_active() ) { $placements = array_merge( $placements, bbPressInterface::bbpress_placement_positions() ); } if ( buddyPressInterface::is_buddypress_active() ) { $placements = array_merge( $placements, buddyPressInterface::buddypress_placement_positions() ); } return $placements; } /** * Allowed popup positions */ public static function allowed_popup_positions() { return array( 'left-top' => __( 'Left Top', 'ad-commander' ), 'center-top' => __( 'Center Top', 'ad-commander' ), 'right-top' => __( 'Right Top', 'ad-commander' ), 'left-center' => __( 'Left Center', 'ad-commander' ), 'center-center' => __( 'Center Center', 'ad-commander' ), 'right-center' => __( 'Right Center', 'ad-commander' ), 'left-bottom' => __( 'Left Bottom', 'ad-commander' ), 'center-bottom' => __( 'Center Bottom', 'ad-commander' ), 'right-bottom' => __( 'Right Bottom', 'ad-commander' ), ); } public static function allowed_sticky_positions() { return self::allowed_popup_positions(); } }