diff --git a/layout/layout-picker-custom-control.php b/layout/layout-picker-custom-control.php index 56e8dba..2c5d8e7 100644 --- a/layout/layout-picker-custom-control.php +++ b/layout/layout-picker-custom-control.php @@ -27,15 +27,23 @@ public function render_content() $finalImageDirectory = get_stylesheet_directory_uri().$imageDirectoryInc; } ?> - + label ); ?> + + + \ No newline at end of file +?> diff --git a/select/google-font-dropdown-custom-control.php b/select/google-font-dropdown-custom-control.php index 9738f6a..0cbf4f9 100644 --- a/select/google-font-dropdown-custom-control.php +++ b/select/google-font-dropdown-custom-control.php @@ -27,17 +27,21 @@ public function render_content() { ?> +

The font list is empty.

+ get_contents($fontFile)); } else { - - $googleApi = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key={API_KEY}'; + $Api = ''; + $googleApi = 'https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key='.$Api; $fontContent = wp_remote_get( $googleApi, array('sslverify' => false) ); - $fp = fopen($fontFile, 'w'); - fwrite($fp, $fontContent['body']); - fclose($fp); + if( $wp_filesystem ) { + $wp_filesystem->put_contents( + $fontFile, + $fontContent['body'], + FS_CHMOD_FILE // predefined mode settings for WP files + ); + } $content = json_decode($fontContent['body']); } - - if($amount == 'all') - { - return $content->items; + if( !empty($content->items) ) { + if($amount == 'all') { + return $content->items; + } else { + return array_slice($content->items, 0, $amount); + } } else { - return array_slice($content->items, 0, $amount); + return false; } } } -?> \ No newline at end of file +?> diff --git a/select/taxonomy-dropdown-custom-control.php b/select/taxonomy-dropdown-custom-control.php index 8833d43..78df8ac 100644 --- a/select/taxonomy-dropdown-custom-control.php +++ b/select/taxonomy-dropdown-custom-control.php @@ -27,8 +27,8 @@ public function __construct($manager, $id, $args = array(), $options = array()) */ public function render_content() { - // call wp_dropdown_cats to get data and add to select field - add_action( 'wp_dropdown_cats', array( $this, 'wp_dropdown_cats' ) ); + // call wp_dropdown_categories to get data and add to select field + add_action( 'wp_dropdown_categories', array( $this, 'wp_dropdown_categories' ) ); // Set defaults $this->defaults = array( @@ -59,11 +59,11 @@ public function render_content() * @since 11/14/2012 * @return String $output */ - public function wp_dropdown_cats( $output ) + public function wp_dropdown_categories( $output ) { $output = str_replace( 'get_link(), $output ); return $output; } } -?> \ No newline at end of file +?>