p_enqueue_style( 'fs_admin', trailingslashit( $this->get_plugin_assets_url() ) . 'css/admin.css', [], $this->scripts_version ); wp_enqueue_style( 'fs_font', trailingslashit( $this->get_plugin_assets_url() ) . 'css/font' . $suffix . '.css', [], $this->scripts_version ); $this->enqueue_rules_scripts( $suffix ); do_action( 'flexible-shipping/admin/enqueue_scripts', $this, $suffix ); } } /** * Should enqueue admin scripts? */ private function should_enqueue_admin_scripts() { $current_screen = get_current_screen(); if ( ! $current_screen ) { return false; } $wc_screen_id = sanitize_title( __( 'WooCommerce', 'woocommerce' ) ); if ( 'woocommerce_page_wc-orders' === $current_screen->id || in_array( $current_screen->post_type, [ 'shop_order', 'shop_subscription', ], true ) || $wc_screen_id . '_page_wc-settings' === $current_screen->id || 'woocommerce_page_wc-settings' === $current_screen->id ) { return true; } return false; } /** * Enqueue Wordpress scripts. */ public function wp_enqueue_scripts() { $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; } /** * Links filter. * * @param array $links . * * @return array */ public function links_filter( $links ) { $docs_link = get_locale() === 'pl_PL' ? 'https://octol.io/fs-docs-pl' : 'https://octol.io/fs-docs'; $support_link = get_locale() === 'pl_PL' ? 'https://octol.io/fs-support-pl' : 'https://octol.io/fs-support'; $settings_url = admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=' . WPDesk_Flexible_Shipping_Settings::METHOD_ID ); $plugin_links = [ '' . __( 'Settings', 'flexible-shipping' ) . '', '' . __( 'Docs', 'flexible-shipping' ) . '', '' . __( 'Support', 'flexible-shipping' ) . '', ]; $pro_link = get_locale() === 'pl_PL' ? 'https://octol.io/fs-upgrade-pl' : 'https://octol.io/fs-upgrade'; if ( ! wpdesk_is_plugin_active( 'flexible-shipping-pro/flexible-shipping-pro.php' ) ) { $plugin_links[] = '' . __( 'Buy PRO', 'flexible-shipping' ) . ''; } return array_merge( $plugin_links, $links ); } /** * . * @param string $method_id . * @param array $shipping_method . * * @return string */ public function flexible_shipping_method_rate_id( $method_id, array $shipping_method ) { if ( isset( $shipping_method['id_for_shipping'] ) && '' !== $shipping_method['id_for_shipping'] ) { $method_id = $shipping_method['id_for_shipping']; } return $method_id; } }