-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwpzoom-recipe-card.php
64 lines (59 loc) · 1.86 KB
/
wpzoom-recipe-card.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* Plugin Name: Recipe Card Blocks PRO by WPZOOM
* Plugin URI: https://www.wpzoom.com/plugins/recipe-card-blocks/
* Description: Beautiful Recipe Card Blocks for Food Bloggers with Schema Markup for the new WordPress editor (Gutenberg).
* Author: WPZOOM
* Author URI: https://www.wpzoom.com/
* Version: 3.2.1
* Copyright: (c) 2019 WPZOOM
* License: GPL2+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wpzoom-recipe-card
* Domain Path: /languages
*
* @package WPZOOM_Recipe_Card_Block
* @author Vicolas Petru
* @license GPL-2+
*/
require_once 'src/classes/class-wpzoom-plugin-loader.php';
/**
* Redirect to the WPZOOM Recipe Card Getting Started page on single plugin activation
*
* @since 1.2.0
*/
if ( ! function_exists( 'recipe_card_block_plugin_activation_redirect' ) ) {
function recipe_card_block_plugin_activation_redirect() {
if ( get_option( 'wpzoom_rcb_do_activation_redirect', false ) ) {
delete_option( 'wpzoom_rcb_do_activation_redirect' );
if ( ! isset( $_GET['activate-multi'] ) ) {
wp_redirect( 'admin.php?page=wpzoom-recipe-card-settings' );
}
}
}
}
add_action( 'admin_init', 'recipe_card_block_plugin_activation_redirect' );
/**
* Check block is registered.
*
* @since 2.0.1
*/
if ( ! function_exists('wpzoom_rcb_block_is_registered') ) {
function wpzoom_rcb_block_is_registered( $name ) {
$WP_Block_Type_Registry = new WP_Block_Type_Registry();
return $WP_Block_Type_Registry->is_registered( $name );
}
}
/**
* Function to show the rating form or number
*/
function wpzoom_rating_stars( $recipe_ID, $type = 'form', $label = '' ) {
if ( '1' !== WPZOOM_Settings::get('wpzoom_rcb_settings_user_ratings') ) {
return '';
}
if ( $type == 'number' ) {
return WPZOOM_Rating_Stars::get_rating_star( $recipe_ID, $label );
} else {
return WPZOOM_Rating_Stars::get_rating_form( $recipe_ID );
}
}