public function get_css_font_family($value = false) { if (!$value) { return ''; } if (is_array($value)) { $value = $value['font_family']; } // Todo: Validate this!!! $font = json_decode($value); if (!empty($font->family)) { $value = $font->family; } if (isset($font->import_family)) { $styles = Styles_Plugin::get_instance(); $styles->css->google_fonts[$value] = "@import url(//fonts.googleapis.com/css?family={$font->import_family});\r"; } $css = ''; if ($value) { $args = array('template' => $this->template_font_family, 'value' => $value); $css = $this->apply_template($args); } // Filter effects final CSS output, but not postMessage updates return apply_filters('styles_css_font_family', $css); }
/** * Find all theme options in this site and run updates * @return void */ public function upgrade_site() { global $wpdb; $plugin = Styles_Plugin::get_instance(); // Get option keys for all Styles theme settings $query = "SELECT option_name\n\t\t\tFROM {$wpdb->options}\n\t\t\tWHERE option_name LIKE 'storm-styles-%'\n\t\t\tAND option_name NOT LIKE 'storm-styles-%-css'\n\t\t"; $option_keys = $wpdb->get_col($query); foreach ((array) $option_keys as $option_key) { $this->old_options = $this->backup_before_upgrade($option_key, '1.1.0'); $this->upgrade_font_families($option_key); } // This must be updated to avoid the updater running in an infinite loop $plugin->set_option('db_version', self::NEW_DB_VERSION); }
public function __construct() { $this->plugin = Styles_Plugin::get_instance(); }