Example #1
0
function op_init_page_theme($load_modules = true)
{
    require_once OP_FUNC . 'page.php';
    op_page_file('functions');
    op_page_file('functions', array(), OP_PAGES . 'global/');
    $tpl_type = op_page_option('theme', 'type');
    $tpl_dir = op_page_option('theme', 'dir');
    if ($tpl_dir) {
        define('OP_PAGE_DIR', OP_PAGES . $tpl_type . '/' . $tpl_dir . '/');
        define('OP_PAGE_DIR_REL', '/pages/' . $tpl_type . '/' . $tpl_dir . '/');
        define('OP_PAGE_URL', OP_URL . 'pages/' . $tpl_type . '/' . $tpl_dir . '/');
        require_once OP_FUNC . 'feature_area.php';
        $class = 'OptimizePress_Page_Feature_Area';
        if (file_exists(OP_PAGE_DIR . 'feature_area.php')) {
            require_once OP_PAGE_DIR . 'feature_area.php';
        } elseif (file_exists(OP_PAGES . 'global/feature_areas/' . $tpl_type . '.php')) {
            require_once OP_PAGES . 'global/feature_areas/' . $tpl_type . '.php';
        } else {
            $class = 'OptimizePress_Page_Feature_Area_Base';
        }
        $GLOBALS['op_feature_area'] = new $class();
    }
    if ($load_modules) {
        if (!(op_page_config('disable', 'functionality') === true)) {
            require_once OP_LIB . 'sections/page/functionality.php';
            $object = new OptimizePress_Sections_Functionality();
            $GLOBALS['functionality_sections'] = $object->sections();
            foreach ($GLOBALS['functionality_sections'] as $name => $section) {
                if (isset($section['module'])) {
                    op_mod($section['module'], op_get_var($section, 'module_type', 'blog'), array('section' => $name));
                }
            }
        }
        do_action('op_page_module_init');
    }
}
Example #2
0
 function save_page()
 {
     //exit;
     $this->check_nonce();
     $this->init_page();
     $GLOBALS['op_feature_area']->save_features();
     wp_update_post(array('ID' => OP_PAGEBUILDER_ID, 'post_status' => $_POST['status']));
     $layouts = op_post('layouts');
     //die(print_r($layouts));
     if (!is_array($layouts)) {
         $layouts = array();
     }
     $usedTypes = array();
     foreach ($layouts as $name => $layout) {
         $usedTypes[] = $name;
         $this->_save_layout($layout, $name);
     }
     /*
      * We need to delete rows that are obsolete
      */
     op_page_clean_layouts($usedTypes);
     $op = $_POST['op'];
     //die(print_r($op));exit;
     $section = 'functionality';
     if (!(op_page_config('disable', $section) === true)) {
         require_once OP_LIB . 'sections/page/functionality.php';
         $object = new OptimizePress_Sections_Functionality();
         $data['sections'] = $object->sections();
         foreach ($data['sections'] as $name => $section) {
             if (is_array($section)) {
                 if (isset($section['save_action'])) {
                     call_user_func_array($section['save_action'], array(op_get_var($op, $name, array())));
                 }
                 if (isset($section['module'])) {
                     $mod_ops = op_get_var($op, $name, array());
                     $opts = op_get_var($section, 'options', array());
                     op_mod($section['module'], op_get_var($section, 'module_type', 'blog'))->save_settings($name, $opts, $mod_ops);
                 }
             }
         }
     }
     op_update_page_option('typography', $this->_save_typography(true));
 }