# gutenify/0.0.3/inc/class-helpers.php

Gutenify – Visual Site Builder Blocks &amp; Starter Templates, version 0.0.3. 65 lines.

- Page: https://pluginprobe.com/plugins/gutenify/0.0.3/code/inc/class-helpers.php
- Raw: https://pluginprobe.com/plugins/gutenify/0.0.3/raw/inc/class-helpers.php
- Modified: 2020-01-05T17:14:44+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenify/0.0.3/code/inc/class-helpers.php#L10-L20`.

```php
<?php
/**
 * Gutenify Helper file.
 *
 * @package Gutenify
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
class Gutenify_Helpers{
    public static function is_gutenberg_page() {
      if ( function_exists( 'is_gutenberg_page' ) &&
      is_gutenberg_page()
      ) {
      // The Gutenberg plugin is on.
      return true;
      }
      $current_screen = get_current_screen();
      if ( method_exists( $current_screen, 'is_block_editor' ) &&
      $current_screen->is_block_editor()
      ) {
      // Gutenberg page on 5+.
      return true;
      }
      return false;
    }
    public static function get_google_fonts(){
        if ( false === ( $gutenify_google_fonts = get_transient( 'gutenify_google_fonts' ) ) ) {
            $response = wp_remote_get( 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBwIX97bVWr3-6AIUvGkcNnmFgirefZ6Sw',
                array(
                    'timeout'     => 120,
                    'httpversion' => '1.1',
                )
            );
            $gutenify_google_fonts = self::load_request( $response);
            set_transient( 'gutenify_google_fonts', $gutenify_google_fonts, 12 * HOUR_IN_SECONDS );
        }
    
        return $gutenify_google_fonts;
    }

    public static function load_request($response) {
      try {
        $json = json_decode( $response['body'] );
      } catch ( Exception $ex ) {
        $json = null;
      }
      return $json;
    }

    public static function typography_style($typography, $screen='desktop'){
        $style = '';
        $style .= ! empty( $typography['fontFamily'] )  ? 'font-family:' . $typography['fontFamily'] . ', sans-serif;' : '';
        $style .= ! empty( $typography['weight'] )  ? 'font-weight:' . $typography['weight'] . ';' : '';
        $style .= ! empty( $typography['transform'] )  ? 'text-transform:' . $typography['transform'] . ';' : '';
        $style .= ! empty( $typography['style'] )  ? 'font-style:' . $typography['style'] . ';' : '';
        $style .= ! empty( $typography['decoration'] )  ? 'text-decoration:' . $typography['decoration'] . ';' : '';
        $style .= ! empty( $typography['size'][$screen]['value'] )  ? 'font-size:' . $typography['size'][$screen]['value'].$typography['size'][$screen]['unit'] . ';' : '';
        $style .= ! empty( $typography['lineHeight'][$screen]['value'] )  ? 'line-height:' . $typography['lineHeight'][$screen]['value'].$typography['lineHeight'][$screen]['unit'] . ';' : '';
        $style .= ! empty( $typography['letterSpacing'][$screen]['value'] )  ? 'letter-spacing:' . $typography['letterSpacing'][$screen]['value'] . 'px;' : '';
        return $style;
    }
}
```
