_x( 'Rating Funnels', 'Post Type General Name', '5-stars-rating-funnel' ) . $version, 'singular_name' => _x( 'Rating Funnel', 'Post Type Singular Name', '5-stars-rating-funnel' ), 'menu_name' => _x( 'RRatingg', 'Admin Menu text', '5-stars-rating-funnel' ) . $version, 'name_admin_bar' => _x( 'Rating Funnel', 'Add New on Toolbar', '5-stars-rating-funnel' ), 'archives' => __( 'Rating Funnel Archives', '5-stars-rating-funnel' ), 'attributes' => __( 'Rating Funnel Attributes', '5-stars-rating-funnel' ), 'parent_item_colon' => __( 'Parent Rating Funnel:', '5-stars-rating-funnel' ), 'all_items' => __( 'All Rating Funnels', '5-stars-rating-funnel' ), 'add_new_item' => __( 'Add New Rating Funnel', '5-stars-rating-funnel' ), 'add_new' => __( 'Add New', '5-stars-rating-funnel' ), 'new_item' => __( 'New Rating Funnel', '5-stars-rating-funnel' ), 'edit_item' => __( 'Edit Rating Funnel', '5-stars-rating-funnel' ), 'update_item' => __( 'Update Rating Funnel', '5-stars-rating-funnel' ), 'view_item' => __( 'View Rating Funnel', '5-stars-rating-funnel' ), 'view_items' => __( 'View Rating Funnels', '5-stars-rating-funnel' ), 'search_items' => __( 'Search Rating Funnel', '5-stars-rating-funnel' ), 'not_found' => __( 'Not found', '5-stars-rating-funnel' ), 'not_found_in_trash' => __( 'Not found in Trash', '5-stars-rating-funnel' ), 'featured_image' => __( 'Funnel Logo', '5-stars-rating-funnel' ), 'set_featured_image' => __( 'Set funnel logo', '5-stars-rating-funnel' ), 'remove_featured_image' => __( 'Remove funnel logo', '5-stars-rating-funnel' ), 'use_featured_image' => __( 'Use as funnel logo', '5-stars-rating-funnel' ), 'insert_into_item' => __( 'Insert into Rating Funnel', '5-stars-rating-funnel' ), 'uploaded_to_this_item' => __( 'Uploaded to this Rating Funnel', '5-stars-rating-funnel' ), 'items_list' => __( 'Rating Funnels list', '5-stars-rating-funnel' ), 'items_list_navigation' => __( 'Rating Funnels list navigation', '5-stars-rating-funnel' ), 'filter_items_list' => __( 'Filter Rating Funnels list', '5-stars-rating-funnel' ) ]; $args = [ 'label' => __( 'Rating Funnel', '5-stars-rating-funnel' ), 'description' => __( '', '5-stars-rating-funnel' ), 'labels' => $labels, 'menu_icon' => 'dashicons-star-filled', 'supports' => ['title', 'thumbnail'], // 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'revisions', 'author', 'comments', 'trackbacks', 'page-attributes', 'post-formats', 'custom-fields'), 'taxonomies' => [], 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 5, 'show_in_admin_bar' => true, 'show_in_nav_menus' => false, 'can_export' => true, 'has_archive' => false, 'hierarchical' => false, 'exclude_from_search' => true, 'show_in_rest' => false, 'publicly_queryable' => true, 'capability_type' => 'post' ]; register_post_type( 'rratingg', $args ); } public static function flush_rewrite_rules() { $flush_rewrite_rules = get_option( 'rrtngg_flush_rewrite_rules' ); if ( empty( $flush_rewrite_rules ) ) { flush_rewrite_rules(); update_option( 'rrtngg_flush_rewrite_rules', 1 ); } } public static function metaboxes() { $metaboxes = self::get_metaboxes(); foreach ( $metaboxes as $id => $metabox ) { $template = RRTNGG_ABS_PATH . 'templates/admin/metaboxes/funnel/' . $metabox['callback_args']['id'] . '.php'; if ( file_exists( $template ) ) { add_meta_box( $id, $metabox['title'], ['RRTNGG_Funnel_CPT', 'generate_metabox'], 'rratingg', $metabox['context'], $metabox['priority'], $metabox['callback_args'] ); } } } public static function generate_metabox( $post, $metabox ) { $mb_id = $metabox['args']['id']; $fields = $metabox['args']['fields']; include_once RRTNGG_ABS_PATH . 'templates/admin/metaboxes/funnel/' . $mb_id . '.php'; } public static function get_metaboxes() { return [ 'footer_settings' => [ 'title' => __( 'Page settings', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'footer_settings', 'fields' => self::get_metabox_fields( 'footer_settings' ) ] ], 'general_settings' => [ 'title' => __( 'Services Integration Settings', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'general_settings', 'fields' => self::get_metabox_fields( 'general_settings' ) ] ], 'rating_page' => [ 'title' => __( 'Rating Page', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'rating_page', 'fields' => self::get_metabox_fields( 'rating_page' ) ] ], 'positive_response' => [ 'title' => __( 'Positive Answers', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'positive_answer', 'fields' => self::get_metabox_fields( 'positive_answer' ) ] ], 'negative_response' => [ 'title' => __( 'Negative Answers', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'negative_answer', 'fields' => self::get_metabox_fields( 'negative_answer' ) ] ], 'feedback_page' => [ 'title' => __( 'Feedback Page', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'feedback_page', 'fields' => self::get_metabox_fields( 'feedback_page' ) ] ], 'email_reminders' => [ 'title' => __( 'Funnel Emails', '5-stars-rating-funnel' ), 'callback' => 'generate_metabox', 'context' => 'normal', 'priority' => 'high', 'callback_args' => [ 'id' => 'email_reminders', 'fields' => self::get_metabox_fields( 'email_reminders' ) ] ] ]; } public static function get_fields() { $fields = []; $services = RRTNGG_Services_Manager::get_services(); $services_fields = []; $post_language = get_post_meta( get_the_ID( ), 'rrtngg_funnel_created_language', true ); $current_user_profile_url = get_edit_profile_url( get_current_user_id() ); $general_settings_url = admin_url( 'options-general.php' ); $lang_settings = []; if(!empty($post_language) && $post_language != '' ){ $lang_settings = [ /* translators: %s is a placeholder for the external link */ 'label' => __( 'Language', '5-stars-rating-funnel' ), 'type' => 'html', 'html' => sprintf( __( 'Funnel created in %s language . Funnel frontend language stays in its language when site or user language is changed. To change the funnel language, switch to the language you like in current user or general settings and create a new funnel.', '5-stars-rating-funnel' ), get_language_name_from_abbreviation($post_language), $current_user_profile_url , $general_settings_url ), ]; } else{ $lang_settings = [ /* translators: %s is a placeholder for the external link */ 'label' => '', 'type' => 'html', 'html' => '', ]; } if ( ! empty( $services ) ) { $i = 1; foreach ( $services as $sid => $service ) { $services_fields['rrtngg_service_divider_' . $sid] = [ 'type' => 'html', 'html' => rrtngg_get_table_divider() ]; if ( empty( $service['available'] ) ) { $services_fields['rrtngg_services_' . $sid . '_hide_open'] = [ 'type' => 'html', 'html' => rrtngg_get_email_only_pro_description( $service['label'] ) . '