Changeset 3357524
- Timestamp:
- 09/07/2025 08:46:11 PM (7 months ago)
- Location:
- ultimate-faq-solution/trunk
- Files:
-
- 6 edited
-
inc/Assets.php (modified) (1 diff)
-
inc/Shortcodes.php (modified) (6 diffs)
-
inc/languages/ultimate-faq-solution.pot (modified) (2 diffs)
-
init.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ultimate-faq-solution/trunk/inc/Assets.php
r3322838 r3357524 54 54 */ 55 55 public function render_resources_frontend() { 56 57 if ( $this->is_faq_present() ) { 58 wp_register_style( 'ufaqsw_fa_css', UFAQSW__PLUGIN_URL . 'assets/css/font-awesome.min.css', array(), UFAQSW_VERSION, 'all' ); 59 wp_register_style( 'ufaqsw_styles_css', UFAQSW__PLUGIN_URL . 'assets/css/styles.min.css', array(), UFAQSW_VERSION, 'all' ); 60 61 wp_enqueue_style( 'ufaqsw_fa_css' ); 62 wp_enqueue_style( 'ufaqsw_styles_css' ); 63 } 56 wp_register_style( 'ufaqsw_fa_css', UFAQSW__PLUGIN_URL . 'assets/css/font-awesome.min.css', array(), UFAQSW_VERSION, 'all' ); 57 wp_register_style( 'ufaqsw_styles_css', UFAQSW__PLUGIN_URL . 'assets/css/styles.min.css', array(), UFAQSW_VERSION, 'all' ); 58 wp_enqueue_style( 'ufaqsw_styles_css' ); 64 59 65 60 // jQuery for fronend. 66 61 wp_enqueue_script( 'jquery', 'jquery', array(), UFAQSW_VERSION, true ); 67 62 wp_register_script( 'ufaqsw-quicksearch-front-js', UFAQSW__PLUGIN_URL . 'assets/js/jquery.quicksearch.js', array( 'jquery' ), UFAQSW_VERSION, true ); 68 69 }70 71 /**72 * Checks if the FAQ shortcode or block is present in the content.73 *74 * This function checks if the FAQ shortcode or block is used in the current post content.75 * If either is found, it returns true, indicating that the FAQ assets should be enqueued.76 *77 * @return bool True if FAQ shortcode or block is present, false otherwise.78 */79 private function is_faq_present() {80 81 // Check if FAQ shortcode is present or FAQ block is used.82 global $post;83 84 $enqueue = false;85 86 if ( is_a( $post, 'WP_Post' ) ) {87 // Check for shortcode in post content.88 if ( has_shortcode( $post->post_content, 'ufaqsw-all' ) ) {89 $enqueue = true;90 }91 92 if ( has_shortcode( $post->post_content, 'ufaqsw' ) ) {93 $enqueue = true;94 }95 }96 97 // Check for FAQ block in the content (for block editor).98 if ( ! $enqueue && function_exists( 'has_block' ) && is_a( $post, 'WP_Post' ) ) {99 100 if ( has_block( 'ultimate-faq-solution/block', $post ) ) {101 $enqueue = true;102 }103 }104 105 // Check if WooCommerce is active and the FAQ tab is enabled for products.106 if ( ufaqsw_is_woocommerce_active() && is_product() ) {107 108 // Check if FAQ is present in WooCommerce product pages.109 $is_enable = get_post_meta( $post->ID, '_ufaqsw_enable_faq_tab', true );110 111 // Global option.112 if ( get_option( 'ufaqsw_enable_global_faq' ) === 'on' ) {113 $enqueue = true;114 }115 116 // Product specific.117 if ( 'yes' === $is_enable ) {118 $enqueue = true;119 }120 }121 122 // Check if FAQ is present in widgets.123 if ( ! $enqueue && $this->is_faq_present_in_widgets() ) {124 $enqueue = true;125 }126 127 /**128 * Filter to allow overriding whether FAQ assets should be enqueued.129 *130 * @param bool $enqueue Whether to enqueue FAQ assets.131 * @param WP_Post|null $post The current post object.132 */133 return apply_filters( 'ufaqsw_should_enqueue_styles', $enqueue, $post );134 }135 136 /**137 * Checks if FAQ shortcodes or blocks are present in widgets.138 *139 * @return bool True if FAQ is used in any widget, false otherwise.140 */141 private function is_faq_present_in_widgets() {142 $faq_used = false;143 144 $sidebars_widgets = wp_get_sidebars_widgets();145 146 foreach ( $sidebars_widgets as $sidebar_id => $widget_ids ) {147 if ( is_array( $widget_ids ) ) {148 foreach ( $widget_ids as $widget_id ) {149 $widget_instance = get_option( 'widget_' . _get_widget_id_base( $widget_id ) );150 151 if ( is_array( $widget_instance ) ) {152 foreach ( $widget_instance as $instance ) {153 if ( isset( $instance['content'] ) ) {154 $content = $instance['content'];155 156 // Check for FAQ shortcode.157 if ( has_shortcode( $content, 'ufaqsw-all' ) || has_shortcode( $content, 'ufaqsw' ) ) {158 $faq_used = true;159 }160 161 // Check for FAQ block.162 if ( strpos( $content, 'wp:ultimate-faq-solution/block' ) !== false ) {163 $faq_used = true;164 }165 }166 }167 }168 }169 }170 }171 172 return $faq_used;173 63 } 174 64 -
ultimate-faq-solution/trunk/inc/Shortcodes.php
r3338582 r3357524 76 76 */ 77 77 private function enqueue_assets() { 78 wp_enqueue_style( 'ufaqsw_fa_css' ); 78 79 wp_enqueue_script( 'ufaqsw-quicksearch-front-js' ); 79 80 wp_enqueue_script( self::$js_handler, UFAQSW__PLUGIN_URL . 'assets/js/script.min.js', array( 'jquery', 'ufaqsw-quicksearch-front-js' ), UFAQSW_VERSION, false ); … … 134 135 $faqs, 135 136 function ( $faq, $index ) use ( $exclude_items ) { 136 // Adjust index to start from 1 instead of 0 137 // Adjust index to start from 1 instead of 0. 137 138 $one_based_index = $index + 1; 138 139 return ! in_array( (string) $one_based_index, $exclude_items, true ); … … 163 164 } else { 164 165 // translators: %s is the name of the template that was not found. 165 echo sprintf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( $template ) );166 printf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( $template ) ); 166 167 } 167 168 } … … 171 172 $content = ob_get_clean(); 172 173 return $content; 173 174 174 } 175 175 … … 247 247 } else { 248 248 // translators: %s is the name of the template that was not found. 249 echo sprintf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( ucfirst( $template ) ) );249 printf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( ucfirst( $template ) ) ); 250 250 } 251 251 … … 265 265 } else { 266 266 // translators: %s is the name of the template that was not found. 267 echo sprintf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( ucfirst( $template ) ) );267 printf( esc_html__( '%s Template Not Found', 'ufaqsw' ), esc_html( ucfirst( $template ) ) ); 268 268 } 269 269 $content = ob_get_clean(); 270 270 271 271 return str_replace( '{{content}}', $all_content, $content ); 272 273 272 } 274 273 } -
ultimate-faq-solution/trunk/inc/languages/ultimate-faq-solution.pot
r3355614 r3357524 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Ultimate FAQ Solution 1.7. 1\n"5 "Project-Id-Version: Ultimate FAQ Solution 1.7.2\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "https://wordpress.org/support/plugin/ultimate-faq-solution\n" 8 "POT-Creation-Date: 2025-09-0 3 18:29:45+00:00\n"8 "POT-Creation-Date: 2025-09-07 20:40:13+00:00\n" 9 9 "MIME-Version: 1.0\n" 10 10 "Content-Type: text/plain; charset=utf-8\n" … … 150 150 msgstr "" 151 151 152 #: inc/Shortcodes.php:16 5inc/Shortcodes.php:249 inc/Shortcodes.php:267152 #: inc/Shortcodes.php:166 inc/Shortcodes.php:249 inc/Shortcodes.php:267 153 153 #. translators: %s is the name of the template that was not found. 154 154 msgid "%s Template Not Found" -
ultimate-faq-solution/trunk/init.php
r3355614 r3357524 10 10 * 11 11 * Plugin Name: Ultimate FAQ Solution 12 * Version: 1.7. 112 * Version: 1.7.2 13 13 * Plugin URI: https://www.braintum.com/ultimate-faq-solution/ 14 14 * Description: A WordPress plugin to create, organize, and display FAQs with responsive layouts and styles. … … 34 34 * Use `plugin_dir_path` and `plugin_dir_url` only when necessary to reduce overhead. 35 35 */ 36 define( 'UFAQSW_VERSION', '1.7. 1' );36 define( 'UFAQSW_VERSION', '1.7.2' ); 37 37 define( 'UFAQSW_PRFX', 'ufaqsw' ); 38 38 define( 'UFAQSW_BASE', plugin_basename( __FILE__ ) ); … … 96 96 register_activation_hook( __FILE__, array( 'UFAQSW_installation', 'plugin_activation' ) ); 97 97 register_deactivation_hook( __FILE__, array( 'UFAQSW_installation', 'plugin_deactivation' ) ); 98 -
ultimate-faq-solution/trunk/readme.txt
r3355614 r3357524 5 5 Requires at least: 5.1 6 6 Tested up to: 6.8.2 7 Stable tag: 1.7. 17 Stable tag: 1.7.2 8 8 Requires PHP: 7.4.0 9 9 License: GPLv2 or later … … 135 135 136 136 == Changelog == 137 138 =1.7.2= 139 * Improved compatibility: Shortcodes now work when inserted dynamically via ACF fields, popular page builders, and widgets. 140 137 141 =1.7.1= 138 142 * Fixed: Page information incorrectly populating inside the FAQ Assistant area. -
ultimate-faq-solution/trunk/vendor/composer/installed.php
r3355614 r3357524 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 67bdcb706f0b37ab316a4aac9c1a3d89e1ea3364',6 'reference' => 'aa5fd8a6a190a9aba02a8ff6ad7f48f9752b228c', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 67bdcb706f0b37ab316a4aac9c1a3d89e1ea3364',25 'reference' => 'aa5fd8a6a190a9aba02a8ff6ad7f48f9752b228c', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.