* @copyright (c) 2006-2019 Eoxia * @license AGPLv3 * @package beflex * @since 3.0.0 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials */ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if ( ! function_exists( 'is_wpshop' ) ) : /** * Returns true if wpshop plugin is active in the theme * * @return boolean */ function is_wpshop() { if ( is_plugin_active( 'wpshop/wpshop.php' ) ) : return true; endif; } endif; if ( ! function_exists( 'is_acf' ) ) : /** * Returns true if ACF plugin is active in the theme * * @return boolean */ function is_acf() { if ( is_plugin_active( 'advanced-custom-fields-pro/acf.php' ) && class_exists( 'acf' ) ) : return true; endif; } endif; if ( ! function_exists( 'is_beflex_pro' ) ) : /** * Returns true if YOAST plugin is active in the theme * * @return boolean */ function is_beflex_pro() { if ( is_plugin_active( 'beflex-pro/beflex-pro.php' ) ) : return true; endif; } endif; if ( ! function_exists( 'is_beflex_AFT' ) ) : /** * Returns true if AFT module of Beflex Pro exists * * @return boolean */ function is_beflex_AFT() { if ( is_plugin_active( 'beflex-pro/beflex-pro.php' ) && class_exists( '\beflex_pro\AFT_Action' ) ) : return true; endif; } endif; if ( ! function_exists( 'is_beflex_mega_menu' ) ) : /** * Returns true if AFT module of Beflex Pro exists * * @return boolean */ function is_beflex_mega_menu() { if ( is_plugin_active( 'beflex-pro/beflex-pro.php' ) && class_exists( '\beflex_pro\Beflex_Mega_Menu' ) ) : return true; endif; } endif; if ( ! function_exists( 'is_beflex_settings' ) ) : /** * Returns true if settings module of Beflex Pro exists * * @return boolean */ function is_beflex_settings() { if ( is_plugin_active( 'beflex-pro/beflex-pro.php' ) && class_exists( '\beflex_pro\Settings_Action' ) ) : return true; endif; } endif; if ( ! function_exists( 'beflex_notification' ) ) : /** * Print an alert for the user * * @param string $string The message. * @param string $alert The class type for css. * @param string $link a possible link to another page. * @return void */ function beflex_notification( $string = '', $alert = 'info', $link = '' ) { if ( ! empty( $link ) ) : $link = ''; endif; printf( wp_kses( __( '
%2$s%3$s
', 'beflex' ), array( 'div' => array( 'class' => array(), ), 'i' => array( 'class' => array(), ), ) ), esc_html( $alert ), esc_html( $string ), $link ); } endif; if ( ! function_exists( 'beflex_allowed' ) ) : /** * Check if the user have the allowed role * * @param array $user Current user role. * @param string $role Roles allowed separated by comma. * @return boolean */ function beflex_allowed( $user = 'editor', $role = 'editor,administrator' ) { $allowed_roles = explode( ',', $role ); if ( is_user_logged_in() && array_intersect( $allowed_roles, $user ) ) : return true; else : return false; endif; } endif; if ( ! function_exists( 'beflex_darken_color' ) ) : /** * Change the Hue of a color * * @param string $couleur Hexa couleur. * @param integer $changement_ton Lighten or Darken. * @return string The final color */ function beflex_change_color( $couleur, $changement_ton ) { $couleur = substr( $couleur, 1, 6 ); $cl = explode( 'x', wordwrap( $couleur, 2, 'x', 3 ) ); $couleur = ''; for ( $i = 0; $i <= 2; $i++ ) { $cl[ $i ] = hexdec( $cl[ $i ] ); $cl[ $i ] = $cl[ $i ] + $changement_ton; if ( $cl[ $i ] < 0 ) : $cl[ $i ] = 0; endif; if ( $cl[ $i ] > 255 ) : $cl [ $i ] = 255; endif; $couleur .= StrToUpper( substr( '0' . dechex( $cl[ $i ] ), -2 ) ); } return '#' . $couleur; } endif;