PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.1
Forumax – AI Powered Advanced Community Forum Plugin v2.5.1
2.5.1 2.5.0 2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 All 31 releases
← All changes | includes/template-functions.php +15 -10 2.4.3 → 2.5.1 View file →
@@ -70,25 +70,30 @@
70 70 *
71 71 * @return bool
72 72 */
73 73 function forumax_is_hello_theme() {
74 - $theme = wp_get_theme();
75 - $stylesheet = $theme->get_stylesheet();
76 - $template = $theme->get_template();
74 + // Runs on every bbPress template lookup; resolve it once per request/theme.
75 + static $cache = array();
77 76
77 + $stylesheet = get_stylesheet();
78 + $template = get_template();
79 + $key = $stylesheet . '|' . $template;
80 +
81 + if ( isset( $cache[ $key ] ) ) {
82 + return $cache[ $key ];
83 + }
84 +
78 85 $hello_slugs = array( 'hello-elementor', 'hello-biz' );
79 86
87 + $cache[ $key ] = false;
80 88 foreach ( $hello_slugs as $slug ) {
81 - if ( $slug === $template || 0 === strpos( $template, $slug ) ) {
82 - return true;
89 + if ( 0 === strpos( $template, $slug ) || 0 === strpos( $stylesheet, $slug ) ) {
90 + $cache[ $key ] = true;
91 + break;
83 92 }
84 -
85 - if ( $slug === $stylesheet || 0 === strpos( $stylesheet, $slug ) ) {
86 - return true;
87 - }
88 93 }
89 94
90 - return false;
95 + return $cache[ $key ];
91 96 }
92 97
93 98 /**
94 99 * Ensure Forumax templates are preferred on Hello theme.