diff --git a/e107_admin/cpage.php b/e107_admin/cpage.php index 911f2248c..8b639cd88 100644 --- a/e107_admin/cpage.php +++ b/e107_admin/cpage.php @@ -349,12 +349,13 @@ class page_admin_ui extends e_admin_ui 'page_order' => array('title'=> LAN_ORDER, 'tab' => 1, 'type' => 'number', 'width' => 'auto', 'inline'=>true), // Menu Tab XXX 'page_theme' is 'menu_name' - not caption. - 'page_theme' => array('title'=> "Menu Name", 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {MENU=name} in your theme."), + 'page_theme' => array('title'=> "Menu Name", 'tab' => 2, 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name or may be called using {MENU|name} in your theme."), 'menu_title' => array('title'=> "Menu Title", 'nolist'=>true, 'tab' => 2, 'type' => 'text', 'inline'=>true, 'width'=>'25%', "help"=>"Caption displayed on the menu item."), 'menu_text' => array('title'=> "Menu Body", 'nolist'=>true, 'tab' => 2, 'type' => 'bbarea', 'data'=>'str', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page' ), - 'menu_image' => array('title' =>"Menu Image", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>false), 'menu_template' => array('title'=> "Menu Template", 'nolist'=>true, 'tab' => 2, 'type' => 'dropdown', 'width' => 'auto','filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), - + + 'menu_image' => array('title' =>"Menu Image", 'nolist'=>true, 'tab' => 2, 'type' => 'image', 'width' => '110px', 'thclass' => 'center', 'class' => "center", 'nosort' => false, 'readParms'=>'thumb=60&thumb_urlraw=0&thumb_aw=60','readonly'=>false), + // 'page_ip_restrict' => array('title'=> LXXAN_USER_07, 'type' => 'text', 'width' => 'auto'), // Avatar @@ -390,14 +391,14 @@ class page_admin_ui extends e_admin_ui 'menu_image' => array('title' =>"Menu Image", 'type' => 'image', 'width' => '110px', 'thclass' => 'left', 'class' => "left", 'nosort' => false, 'readParms'=>'thumb=80&thumb_urlraw=0&thumb_aw=80','readonly'=>false), 'page_theme' => array('title'=> "Menu Name", 'type' => 'text', 'width' => 'auto','nolist'=>true, "help"=>"Will be listed in the Menu-Manager under this name"), - + 'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => 'auto', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), + // 'page_author' => array('title'=> LAN_AUTHOR, 'tab' => 0, 'type' => 'user', 'data'=>'int','width' => 'auto', 'thclass' => 'left'), 'page_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1&readonly=1'), 'menu_title' => array('title'=> "Menu Title", 'forced'=> TRUE, 'type' => 'text', 'inline'=>true, 'width'=>'25%'), 'menu_text' => array('title'=> "Menu Body", 'type' => 'bbarea', 'data'=>'str', 'width' => 'auto', 'readParms' => 'expand=...&truncate=50&bb=1', 'writeParms'=>'media=page'), - 'menu_template' => array('title'=> "Menu Template", 'type' => 'dropdown', 'width' => 'auto', 'filter' => true, 'batch'=>true, 'inline'=>true, 'writeParms'=>''), - + 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'noselector' => true, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center','readParms'=>'deleteClass=252') ); diff --git a/e107_core/shortcodes/batch/page_shortcodes.php b/e107_core/shortcodes/batch/page_shortcodes.php index 4488f0d82..5512d4cf1 100644 --- a/e107_core/shortcodes/batch/page_shortcodes.php +++ b/e107_core/shortcodes/batch/page_shortcodes.php @@ -168,7 +168,7 @@ class cpage_shortcodes extends e_shortcode return ''.$this->sc_cpagetitle().''; } - function sc_cpagebutton($parm) + function sc_cpagebutton($parm,$options) { $url = $this->sc_cpageurl(); @@ -176,13 +176,23 @@ class cpage_shortcodes extends e_shortcode { return $url; } - return 'Read More..'; + + parse_str($options,$options); + + $text = vartrue($options['text'], "Read more.."); + $size = vartrue($options['size'], ""); + $inc = ($size) ? " btn-".$size : ""; + + return ''.$text.''; } function sc_cmenutitle($parm='') - { - return e107::getParser()->toHTML($this->getParserVars()->menu_title, true, 'TITLE'); + { + $tp = e107::getParser(); + $title = $tp->glyph($this->page['menu_title']); // (preg_replace('/i_([\w]*)/',"",$this->page['menu_title']); + + return $tp->toHTML($title, true, 'TITLE'); } @@ -197,6 +207,11 @@ class cpage_shortcodes extends e_shortcode { // print_a($this); $img = e107::getParser()->thumbUrl($this->page['menu_image']); + if($parm == 'url') + { + return $img; + } + return ""; } diff --git a/e107_core/shortcodes/single/menu.php b/e107_core/shortcodes/single/menu.php index f87223088..b84373271 100644 --- a/e107_core/shortcodes/single/menu.php +++ b/e107_core/shortcodes/single/menu.php @@ -1,9 +1,33 @@ renderArea($parm); + exit(); +} + +function menu_shortcode($parm, $mode='') +{ + list($path,$echo) = explode(':', $parm); + + if($mode) // New in v2.x. eg. {MENU|feature-1} Renders a menu called 'feature-1' as found in the e107_page table See admin Pages/Menus . + { + return e107::getMenu()->renderMenu($mode, false); + } + + if(is_numeric($path)) // eg. {MENU=1} - renders area 1 as found in the e107_menu db table. + { + return e107::getMenu()->renderArea($parm); + } + else // eg. {MENU=contact} for e107_plugins/contact/contact_menu.php OR {MENU=contact/other} for e107_plugins/contact/other_menu.php + { + list($plugin,$menu) = explode("/",$path,2); + + if($menu == '') + { + $menu = $plugin; + } + + return e107::getMenu()->renderMenu($plugin,$menu."_menu"); + } } diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php index 24fd96b48..0a69d7f8c 100644 --- a/e107_handlers/menu_class.php +++ b/e107_handlers/menu_class.php @@ -209,7 +209,7 @@ class e_menu $buffer_output = (E107_DBG_INCLUDES) ? false : true; // Turn off when trouble-shooting includes. Default - return all output. - + if(isset($tmp[1])&&$tmp[1]=='echo') { $buffer_output = false; @@ -222,6 +222,7 @@ class e_menu { ob_start(); } + e107::getRender()->eMenuArea = $tmp[0]; foreach($this->eMenuActive[$tmp[0]] as $row) { @@ -246,11 +247,18 @@ class e_menu * @param boolean $return * return string if required */ - public function renderMenu($mpath, $mname, $parm = '', $return = false) + public function renderMenu($mpath, $mname='', $parm = '', $return = false) { - global $sql; // required at the moment. - global $ns, $tp, $sc_style, $e107_debug; + // global $sql; // required at the moment. + global $sc_style, $e107_debug; + + $e107 = e107::getInstance(); + + $sql = e107::getDb(); + $ns = e107::getRender(); + $tp = e107::getParser(); + if($return) { @@ -263,12 +271,14 @@ class e_menu } e107::getDB()->db_Mark_Time($mname); - if(is_numeric($mpath)) // Custom Page/Menu + if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu { - $sql->select("page", "*", "page_id=".intval($mpath)." "); + $query = ($mname === false) ? "page_theme = '".$mpath."' " : "page_id=".intval($mpath)." "; // load by ID or load by menu-name (page_theme) + + $sql->select("page", "*", $query); $page = $sql->fetch(); - $caption = $e107->tp->toHTML($page['page_title'], true, 'parse_sc, constants'); + $caption = $tp->toHTML($page['page_title'], true, 'parse_sc, constants'); if(vartrue($page['menu_template'])) // New v2.x templates. see core/menu_template.php { @@ -279,15 +289,19 @@ class e_menu // print_a($template['body']); $text = $tp->parseTemplate($template['body'], true, $page_shortcodes); // echo "TEMPLATE= ($mpath)".$page['menu_template']; + + // e107::getRender()->tablerender($caption, $text); + echo $text; } else { $text = $e107->tp->toHTML($page['page_text'], true, 'parse_sc, constants'); + e107::getRender()->tablerender($caption, $text); } - e107::getRender()->tablerender($caption, $text); + } else @@ -302,13 +316,9 @@ class e_menu //{ // $mpath .= '/'; //} + $mpath = trim($mpath, '/').'/'; // faster... $e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php'); - - /*if(file_exists(e_PLUGIN.$mpath."/".$mname.".php")) - { - include_once (e_PLUGIN.$mpath."/".$mname.".php"); - }*/ } e107::getDB()->db_Mark_Time("(After ".$mname.")"); if($error_handler->debug==true)