Plugin Directory

Changeset 1705547


Ignore:
Timestamp:
07/31/2017 08:58:01 AM (9 years ago)
Author:
vashkatsi
Message:

1.0.4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bbq/tags/1.0.4/includes/class-bbq.php

    r1705511 r1705547  
    193193        $this->loader->add_filter('the_content', $plugin_public, 'place_content_ad_blocks');
    194194
     195        // супер мега экстра бау вау костыль @todo разобраться с виджетами
     196        $this->loader->add_action('the_content', $this, 'initWidgets');
     197
    195198    }
    196199
     
    203206    {
    204207        $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)
    209217    {
    210218        $blocks = Bbq::$option->blocks;
    211219        if(!$blocks) {
    212             return;
     220            return $content;
    213221        }
    214222        $blocks = json_decode(Bbq::$option->blocks);
     
    216224            if($block->blockPosition === BbqBlockPosition::SIDEBAR) {
    217225
    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                            }
    225236                        }
    226                     }
    227                     if(!$flag) {
    228                         continue;
     237                        if(!$flag) {
     238                            continue;
     239                        }
    229240                    }
    230241                }
     
    279290        }
    280291
     292        return $content;
    281293    }
    282294
Note: See TracChangeset for help on using the changeset viewer.