Changeset 1705547
- Timestamp:
- 07/31/2017 08:58:01 AM (9 years ago)
- File:
-
- 1 edited
-
bbq/tags/1.0.4/includes/class-bbq.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bbq/tags/1.0.4/includes/class-bbq.php
r1705511 r1705547 193 193 $this->loader->add_filter('the_content', $plugin_public, 'place_content_ad_blocks'); 194 194 195 // супер мега экстра бау вау костыль @todo разобраться с виджетами 196 $this->loader->add_action('the_content', $this, 'initWidgets'); 197 195 198 } 196 199 … … 203 206 { 204 207 $this->loader->run(); 205 $this->initWidgets(); 206 } 207 208 public function initWidgets() 208 209 //@todo надо разобраться с виджетами 210 //ух я и накостылял 211 if(is_admin()) { 212 $this->initWidgets(null); 213 } 214 } 215 216 public function initWidgets($content) 209 217 { 210 218 $blocks = Bbq::$option->blocks; 211 219 if(!$blocks) { 212 return ;220 return $content; 213 221 } 214 222 $blocks = json_decode(Bbq::$option->blocks); … … 216 224 if($block->blockPosition === BbqBlockPosition::SIDEBAR) { 217 225 218 //checking if current page type allowed 219 if(isset($block->blockPageTypes)) { 220 $flag = false; 221 $allowedPageTypes = json_decode($block->blockPageTypes); 222 foreach ($allowedPageTypes as $allowedPageType => $isAllowed) { 223 if($isAllowed && $flag = $allowedPageType()) { 224 break; 226 //эта проверка нужна для вывода виджета в админке без ошибок 227 if(!is_admin()) { 228 //checking if current page type allowed 229 if(isset($block->blockPageTypes)) { 230 $flag = false; 231 $allowedPageTypes = json_decode($block->blockPageTypes); 232 foreach ($allowedPageTypes as $allowedPageType => $isAllowed) { 233 if($isAllowed && $flag = $allowedPageType()) { 234 break; 235 } 225 236 } 226 }227 if(!$flag) {228 continue;237 if(!$flag) { 238 continue; 239 } 229 240 } 230 241 } … … 279 290 } 280 291 292 return $content; 281 293 } 282 294
Note: See TracChangeset
for help on using the changeset viewer.