about.php
5 years ago
listings.php
5 years ago
post-types.php
5 years ago
support.php
5 years ago
taxonomies.php
5 years ago
tools.php
5 years ago
utility.php
5 years ago
wp-cli.php
5 years ago
about.php
183 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Custom Post Type UI About Page. |
| 4 | * |
| 5 | * @package CPTUI |
| 6 | * @subpackage About |
| 7 | * @author WebDevStudios |
| 8 | * @since 1.3.0 |
| 9 | * @license GPL-2.0+ |
| 10 | */ |
| 11 | |
| 12 | // phpcs:disable WebDevStudios.All.RequireAuthor |
| 13 | |
| 14 | // Exit if accessed directly. |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit; |
| 17 | } |
| 18 | |
| 19 | /** |
| 20 | * Enqueue our Custom Post Type UI assets. |
| 21 | * |
| 22 | * @since 1.6.0 |
| 23 | */ |
| 24 | function cptui_about_assets() { |
| 25 | $current_screen = get_current_screen(); |
| 26 | |
| 27 | if ( ! is_object( $current_screen ) || 'toplevel_page_cptui_main_menu' !== $current_screen->base ) { |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | if ( wp_doing_ajax() ) { |
| 32 | return; |
| 33 | } |
| 34 | |
| 35 | wp_enqueue_style( 'cptui-css' ); |
| 36 | } |
| 37 | add_action( 'admin_enqueue_scripts', 'cptui_about_assets' ); |
| 38 | |
| 39 | /** |
| 40 | * Display our primary menu page. |
| 41 | * |
| 42 | * @since 0.3.0 |
| 43 | * |
| 44 | * @internal |
| 45 | */ |
| 46 | function cptui_settings() { |
| 47 | ?> |
| 48 | <div class="wrap about-wrap"> |
| 49 | <?php |
| 50 | |
| 51 | /** |
| 52 | * Fires inside and at the top of the wrapper for the main plugin landing page. |
| 53 | * |
| 54 | * @since 1.0.0 |
| 55 | */ |
| 56 | do_action( 'cptui_main_page_start' ); |
| 57 | ?> |
| 58 | <h1><?php esc_html_e( 'Custom Post Type UI', 'custom-post-type-ui' ); ?> <?php echo esc_html( CPTUI_VERSION ); ?></h1> |
| 59 | |
| 60 | <?php |
| 61 | |
| 62 | /** |
| 63 | * Fires after the main page `<h1>` heading tag. |
| 64 | * |
| 65 | * @since 1.3.0 |
| 66 | */ |
| 67 | do_action( 'cptui_main_page_after_header' ); |
| 68 | ?> |
| 69 | <div class="cptui-intro-devblock"> |
| 70 | <p class="about-text cptui-about-text"> |
| 71 | <?php esc_html_e( 'Thank you for choosing Custom Post Type UI! We hope that your experience with our plugin makes creating post types and taxonomies and organizing your content quick and easy.', 'custom-post-type-ui' ); ?> |
| 72 | </p> |
| 73 | <div class="cptui-badge"></div> |
| 74 | </div> |
| 75 | <?php |
| 76 | /** |
| 77 | * Fires before the About Page changelog. |
| 78 | * |
| 79 | * @since 1.4.0 |
| 80 | */ |
| 81 | do_action( 'cptui_main_page_before_changelog' ); |
| 82 | ?> |
| 83 | |
| 84 | <h2><?php printf( esc_html__( "What's new in version %s", 'custom-post-type-ui' ), CPTUI_VERSION ); ?></h2> |
| 85 | <div class="changelog about-integrations"> |
| 86 | <div class="cptui-feature feature-section col three-col"> |
| 87 | <div class="col"> |
| 88 | <h2><?php esc_html_e( 'Built-in WPGraphQL support options.', 'custom-post-type-ui' ); ?></h2> |
| 89 | <p><?php esc_html_e( 'If you have the WPGraphQL plugin installed and active, you will no longer need their Custom Post Type UI extension to register GraphQL support with your post types and taxonomies.', 'custom-post-type-ui' ); ?></p> |
| 90 | <p><?php printf( |
| 91 | esc_html__( 'Visit the %1$sWPGraphQL plugin page%2$s to acquire your own copy.', 'custom-post-type-ui' ), |
| 92 | sprintf( '<a href="%s">', esc_url( 'https://wordpress.org/plugins/wp-graphql/' ) ), |
| 93 | '</a>' |
| 94 | ); ?></p> |
| 95 | </div> |
| 96 | </div> |
| 97 | </div> |
| 98 | |
| 99 | <div class="extranotes"> |
| 100 | <?php |
| 101 | |
| 102 | /** |
| 103 | * Fires inside a div for extra notes. |
| 104 | * |
| 105 | * @since 1.3.0 |
| 106 | */ |
| 107 | do_action( 'cptui_main_page_extra_notes' ); |
| 108 | ?> |
| 109 | </div> |
| 110 | </div> |
| 111 | <?php |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Display Pluginize-based content. |
| 116 | * |
| 117 | * @since 1.4.0 |
| 118 | */ |
| 119 | function cptui_pluginize_content() { |
| 120 | echo '<h1>' . sprintf( esc_html__( 'More from %s', 'custom-post-type-ui' ), 'WebDevStudios' ) . '</h1>'; |
| 121 | echo '<div class="wdspromos-about">'; |
| 122 | $ads = cptui_get_ads(); |
| 123 | if ( ! empty( $ads ) ) { |
| 124 | |
| 125 | foreach ( $ads as $ad ) { |
| 126 | |
| 127 | $the_ad = sprintf( |
| 128 | '<img src="%s" alt="%s">', |
| 129 | esc_attr( $ad['image'] ), |
| 130 | esc_attr( $ad['text'] ) |
| 131 | ); |
| 132 | |
| 133 | // Escaping $the_ad breaks the html. |
| 134 | printf( |
| 135 | '<p><a href="%s">%s</a></p>', |
| 136 | esc_url( $ad['url'] ), |
| 137 | $the_ad |
| 138 | ); |
| 139 | } |
| 140 | } |
| 141 | echo '</div>'; |
| 142 | } |
| 143 | add_action( 'cptui_main_page_extra_notes', 'cptui_pluginize_content', 9 ); |
| 144 | |
| 145 | /** |
| 146 | * Render our newsletter form for the about page. |
| 147 | * |
| 148 | * @since 1.4.0 |
| 149 | */ |
| 150 | function cptui_about_page_newsletter() { |
| 151 | |
| 152 | if ( cptui_is_new_install() ) { |
| 153 | return ''; |
| 154 | } |
| 155 | |
| 156 | ?> |
| 157 | <div class='wdsoctosignup'> |
| 158 | <?php |
| 159 | cptui_newsletter_form(); |
| 160 | ?> |
| 161 | </div> |
| 162 | |
| 163 | <?php |
| 164 | |
| 165 | return ''; |
| 166 | } |
| 167 | add_action( 'cptui_main_page_before_changelog', 'cptui_about_page_newsletter' ); |
| 168 | |
| 169 | /** |
| 170 | * Marks site as not new at the end of the about/main page. |
| 171 | * |
| 172 | * Can't be done on activation or else cptui_is_new_install() will immediately start |
| 173 | * returning false. So we'll do it at the end of the redirected landing page. |
| 174 | * |
| 175 | * @since 1.5.0 |
| 176 | */ |
| 177 | function cptui_mark_not_new() { |
| 178 | if ( cptui_is_new_install() ) { |
| 179 | cptui_set_not_new_install(); |
| 180 | } |
| 181 | } |
| 182 | add_action( 'cptui_main_page_extra_notes', 'cptui_mark_not_new', 999 ); |
| 183 |