base ) { $processed = get_option( '_astra_sites_gettings_started', 'no' ); $product_name = Astra_Sites_White_Label::get_instance()->get_white_label_name( 'Astra' ); if ( 'yes' === $processed ) { return; } $arguments = array( 'page' => 'starter-templates', ); $url = add_query_arg( $arguments, admin_url( 'themes.php' ) ); ?>
ready starter templates here ยป', 'astra-sites' ), esc_html( $product_name ), esc_url( $url ) ); ?>
get_status(); $import_status = isset( $status['status'] ) ? $status['status'] : ''; $status_class = 'invalid_site_id' === $import_status || 'premium_sites' === $import_status ? 'failed' : ''; $step_class = ''; if ( ! empty( $status ) ) { $step_class = isset( $status['step'] ) && 'complete' === $status['step'] ? 'success' : ''; } ?> get_setting( 'page_builder' ); $page_builders = Astra_Sites::get_instance()->get_page_builders(); foreach ( $page_builders as $key => $page_builder ) { if ( $page_builder['slug'] === $default_page_builder ) { return $page_builder; } } return ''; } /** * Get Page Builders * * @since 2.0.0 * * @param string $slug Page Builder Slug. * @return array page builders. */ public function get_page_builder_image( $slug ) { $image = ''; switch ( $slug ) { case 'elementor': $image = ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg'; break; case 'beaver-builder': $image = ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg'; break; case 'gutenberg': $image = ASTRA_SITES_URI . 'inc/assets/images/block-editor.png'; break; case 'brizy': $image = ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg'; break; } return $image; } /** * Page Builder List * * @since 1.4.0 * @return array */ public function get_page_builders() { return array( 'gutenberg' => array( 'slug' => 'gutenberg', 'name' => esc_html__( 'Gutenberg', 'astra-sites' ), 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/block-editor.jpg', 'title' => esc_html__( 'The default WordPress editor', 'astra-sites' ), ), 'elementor' => array( 'slug' => 'elementor', 'name' => esc_html__( 'Elementor', 'astra-sites' ), 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg', ), 'beaver-builder' => array( 'slug' => 'beaver-builder', 'name' => esc_html__( 'Beaver Builder', 'astra-sites' ), 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg', ), 'brizy' => array( 'slug' => 'brizy', 'name' => esc_html__( 'Brizy', 'astra-sites' ), 'image_url' => ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg', ), ); } /** * Get and return page URL * * @param string $menu_slug Menu name. * @since 1.0.6 * @return string page url */ public function get_page_url( $menu_slug ) { $current_slug = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'starter-templates'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching GET parameter, no nonce associated with this action. $parent_page = 'themes.php'; if ( strpos( $parent_page, '?' ) !== false ) { $query_var = '&page=' . $current_slug; } else { $query_var = '?page=' . $current_slug; } $parent_page_url = admin_url( $parent_page . $query_var ); $url = $parent_page_url . '&action=' . $menu_slug; return esc_url( $url ); } /** * Converts a period of time in seconds into a human-readable format representing the interval. * * @since 2.0.0 * * Example: * * echo self::interval( 90 ); * // 1 minute 30 seconds * * @param int $since A period of time in seconds. * @return string An interval represented as a string. */ public function interval( $since ) { // Array of time period chunks. $chunks = array( /* translators: 1: The number of years in an interval of time. */ array( 60 * 60 * 24 * 365, _n_noop( '%s year', '%s years', 'astra-sites' ) ), /* translators: 1: The number of months in an interval of time. */ array( 60 * 60 * 24 * 30, _n_noop( '%s month', '%s months', 'astra-sites' ) ), /* translators: 1: The number of weeks in an interval of time. */ array( 60 * 60 * 24 * 7, _n_noop( '%s week', '%s weeks', 'astra-sites' ) ), /* translators: 1: The number of days in an interval of time. */ array( 60 * 60 * 24, _n_noop( '%s day', '%s days', 'astra-sites' ) ), /* translators: 1: The number of hours in an interval of time. */ array( 60 * 60, _n_noop( '%s hour', '%s hours', 'astra-sites' ) ), /* translators: 1: The number of minutes in an interval of time. */ array( 60, _n_noop( '%s minute', '%s minutes', 'astra-sites' ) ), /* translators: 1: The number of seconds in an interval of time. */ array( 1, _n_noop( '%s second', '%s seconds', 'astra-sites' ) ), ); if ( $since <= 0 ) { return esc_html__( 'now', 'astra-sites' ); } /** * We only want to output two chunks of time here, eg: * x years, xx months * x days, xx hours * so there's only two bits of calculation below: */ $j = count( $chunks ); // Step one: the first chunk. for ( $i = 0; $i < $j; $i++ ) { $seconds = $chunks[ $i ][0]; $name = $chunks[ $i ][1]; // Finding the biggest chunk (if the chunk fits, break). $count = floor( $since / $seconds ); if ( $count ) { break; } } // Set output var. $output = sprintf( translate_nooped_plural( $name, $count, 'astra-sites' ), $count ); // Step two: the second chunk. if ( $i + 1 < $j ) { $seconds2 = $chunks[ $i + 1 ][0]; $name2 = $chunks[ $i + 1 ][1]; $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ); if ( $count2 ) { // Add to output var. $output .= ' ' . sprintf( translate_nooped_plural( $name2, $count2, 'astra-sites' ), $count2 ); } } return $output; } /** * Check Cron Status * * Gets the current cron status by performing a test spawn. Cached for one hour when all is well. * * @since 2.0.0 * * @param bool $cache Whether to use the cached result from previous calls. * @return true|WP_Error Boolean true if the cron spawner is working as expected, or a WP_Error object if not. */ public static function test_cron( $cache = true ) { global $wp_version; if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) { return new WP_Error( 'astra_sites_cron_error', esc_html__( 'ERROR! Cron schedules are disabled by setting constant DISABLE_WP_CRON to true.