public static function get_fonts_options() { $fonts_arr = WPiArray::get_fonts(); $fonts_names = WPiTools::get_field_names($fonts_arr); $fonts = WPiTools::array2object($fonts_names); return $fonts; }
public function js_wp_urls() { wp_register_script('wpi_js_urls', WPIDB_URL . 'inc/wpi_script.js'); wp_localize_script('wpi_js_urls', 'WPiURLS', array('WPIDB_URL' => WPIDB_URL)); $fonts_list = WPiArray::get_fonts(); $fonts = WPiTools::get_field_names($fonts_list); wp_localize_script('wpi_js_urls', 'WPIDB_FONTS', $fonts); $font_sizes = WPiArray::get_font_sizes(); $font_sizes = WPiTools::get_list(array("suffix" => "px", "list" => $font_sizes, "keys" => false)); wp_localize_script('wpi_js_urls', 'WPIDB_FONTS_SIZES', $font_sizes); $font_weights = WPiArray::get_font_weights(); $font_weights = WPiTools::get_list(array("list" => $font_weights, "keys" => false)); wp_localize_script('wpi_js_urls', 'WPIDB_FONTS_WEIGHTS', $font_weights); $letter_spacing = WPiArray::get_letter_spacing(); $letter_spacing = WPiTools::get_list(array("suffix" => "px", "list" => $letter_spacing, "keys" => false)); wp_localize_script('wpi_js_urls', 'WPIDB_LETTER_SPACING', $letter_spacing); $margin = WPiArray::get_margin(); $margin = WPiTools::get_list(array("suffix" => "px", "list" => $margin, "keys" => false)); wp_localize_script('wpi_js_urls', 'WPIDB_MARGIN', $margin); $border_width = WPiArray::get_border_width(); $border_width = WPiTools::get_list(array("suffix" => "px", "list" => $border_width, "keys" => false)); wp_localize_script('wpi_js_urls', 'WPIDB_BORDER_WIDTH', $border_width); $WPIDB = array("fonts" => $fonts, "font_sizes" => $font_sizes, "font_weights" => $font_weights, "letter_spacing" => $letter_spacing, "margin" => $margin, "border_width" => $border_width); wp_localize_script('wpi_js_urls', 'WPIDB', $WPIDB); wp_enqueue_script('wpi_js_urls'); }