Пример #1
0
 private function setValueInput($id = 0)
 {
     $name = '';
     if ($id == 0) {
         for ($i = 0; $i < count($this->options); $i++) {
             if (!isset($this->options[$i]['default'])) {
                 $this->options[$i]['default'] = '';
             }
         }
     } else {
         $obj = PGL_Megamenu_Widget::getInstance();
         $values = $obj->getWidgetById($id);
         if (is_array($values->params)) {
             foreach ($values->params as $key => $value) {
                 for ($i = 0; $i < count($this->options); $i++) {
                     if ($this->options[$i]['id'] == $key) {
                         if (is_array($value)) {
                             $value = implode(',', $value);
                         }
                         $this->options[$i]['default'] = $value;
                         break;
                     }
                 }
             }
         }
         $name = $values->name;
     }
     return $name;
 }
 protected function _render_widget($col)
 {
     $widget = $col['position'];
     $dwidgets = PGL_Megamenu_Widget::getInstance()->loadWidgets();
     $shortcode = PGL_Shortcodes::getInstance();
     $output = '';
     $o = $dwidgets->getWidgetById($widget);
     if ($o) {
         $output .= '<div class="pgl-module module">';
         $output .= $shortcode->renderContent($o->type, $o->params);
         $output .= '</div>';
     }
     return $output;
 }
Пример #3
0
function pgl_install_config_megamenu()
{
    $megamenu_json = file_get_contents(PGL_FRAMEWORK_PATH . 'samples/megamenu/megamenu.json');
    $megamenu_json = json_decode($megamenu_json);
    PGL_Megamenu_Widget::getInstance();
    $pgl_megamenu = PGL_MegamenuEditor::getInstance();
    $megamenu_widgets = $megamenu_json->widgets;
    if (count($megamenu_widgets) > 0) {
        foreach ($megamenu_widgets as $value) {
            $pgl_megamenu->insertMegaMenuTable($value->name, $value->type, $value->params);
        }
    }
    if (get_option('PGL_MEGAMENU_DATA')) {
        update_option('PGL_MEGAMENU_DATA', $megamenu_json->menu);
    } else {
        add_option('PGL_MEGAMENU_DATA', $megamenu_json->menu);
    }
    if (get_option('PGL_MEGAMENU_VERTICAL_DATA')) {
        update_option('PGL_MEGAMENU_VERTICAL_DATA', $megamenu_json->menu_vertical);
    } else {
        add_option('PGL_MEGAMENU_VERTICAL_DATA', $megamenu_json->menu_vertical);
    }
}
Пример #4
0
 public function ajax_shortcode_delete()
 {
     if (isset($_POST['id']) && $_POST['id'] != '') {
         $obj = PGL_Megamenu_Widget::getInstance();
         $obj->delete($_POST['id']);
         echo $_POST['id'];
     } else {
         echo false;
     }
     exit;
 }