当前位置: 首页>>代码示例>>PHP>>正文


PHP stdClass::def方法代码示例

本文整理汇总了PHP中stdClass::def方法的典型用法代码示例。如果您正苦于以下问题:PHP stdClass::def方法的具体用法?PHP stdClass::def怎么用?PHP stdClass::def使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在stdClass的用法示例。


在下文中一共展示了stdClass::def方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFirstLevelItem

 function getFirstLevelItem($mitem)
 {
     global $Itemid, $mosConfig_live_site, $mainframe, $sess;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $sess->getShopItemid();
             break;
     }
     $id = 'id="menu' . $mitem->id . '"';
     $mitem->link = vmAmpReplace($mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $this->parent->_params->get('class_sfx');
     // Active Menu highlighting
     $current_itemid = trim(vmRequest::getInt('Itemid'));
     if (in_array($mitem->id, $this->parent->open)) {
         $menuclass = 'mainlevel_active' . $this->parent->_params->get('class_sfx');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name;
             if ($this->parent->hasSubItems($mitem->id)) {
                 $txt .= '&nbsp;&nbsp;<img border="0" src="' . $this->parent->_params->get('LSPath') . '/img/tabarrow.gif" alt="arrow" />';
             }
             $txt .= '</a>';
             break;
     }
     if ($this->parent->_params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($this->parent->_params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }
开发者ID:dalinhuang,项目名称:joomla-goods-china,代码行数:74,代码来源:transmenu.php

示例2: genMenuItem

 function genMenuItem(&$row, $level, $pos)
 {
     global $Itemid, $mosConfig_live_site, $mainframe;
     $txt = '';
     switch ($row->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'url':
             if (eregi('index.php\\?', $row->link)) {
                 if (!eregi('Itemid=', $row->link)) {
                     $row->link .= '&Itemid=' . $row->id;
                 }
             }
             break;
         case 'content_item_link':
         case 'content_typed':
             // load menu params
             $menuparams = new mosParameters($row->params, $mainframe->getPath('menu_xml', $row->type), 'menu');
             $unique_itemid = $menuparams->get('unique_itemid', 1);
             if ($unique_itemid) {
                 $row->link .= '&Itemid=' . $row->id;
             } else {
                 $temp = split('&task=view&id=', $row->link);
                 if ($row->type == 'content_typed') {
                     $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 1, 0);
                 } else {
                     $row->link .= '&Itemid=' . $mainframe->getItemid($temp[1], 0, 1);
                 }
             }
             break;
         default:
             $row->link .= '&Itemid=' . $row->id;
             break;
     }
     $row->link = ampReplace($row->link);
     if (strcasecmp(substr($row->link, 0, 4), 'http')) {
         $row->link = sefRelToAbs($row->link);
     }
     $active = in_array($row->id, $this->parent->open) ? "class = \"active\"" : "";
     $id = 'id="menu' . $row->id . '"';
     $txt = $row->name;
     if ($this->getParam('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($row->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $row->name . '"/>';
             if ($this->getParam('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     $title = " title=\"{$row->name}\"";
     if ($active) {
         $active = $row->parent == 0 && $pos == 0 ? "class=\"active-first-item\"" : "class = \"active\"";
     } else {
         $active = $row->parent == 0 && $pos == 0 ? "class=\"first-item\"" : "";
     }
     switch ($row->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $row->link . '" target="_blank" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $row->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\"  " . $active . " " . $id . $title . "><span>" . $txt . "</span></a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<a href="#" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $row->link . '" ' . $active . ' ' . $id . $title . '><span>' . $txt . '</span></a>';
             break;
     }
     echo $txt;
 }
开发者ID:allenahner,项目名称:mizzou,代码行数:83,代码来源:ja-cssmenu.php

示例3: showArchiveSection

function showArchiveSection($id = NULL, $gid, &$access, $pop, $option)
{
    global $database, $mainframe, $mosConfig_offset;
    global $Itemid;
    $noauth = !$mainframe->getCfg('shownoauth');
    // Paramters
    $year = mosGetParam($_REQUEST, 'year', date('Y'));
    $month = mosGetParam($_REQUEST, 'month', date('m'));
    $params = new stdClass();
    if ($Itemid) {
        $menu = new mosMenu($database);
        $menu->load($Itemid);
        $params =& new mosParameters($menu->params);
    } else {
        $menu = "";
        $params =& new mosParameters('');
    }
    $params->set('intro_only', 1);
    $params->set('year', $year);
    $params->set('month', $month);
    // Ordering control
    $orderby_sec = $params->def('orderby_sec', 'rdate');
    $orderby_pri = $params->def('orderby_pri', '');
    $order_sec = _orderby_sec($orderby_sec);
    $order_pri = _orderby_pri($orderby_pri);
    // used in query
    $where = _where(-1, $access, $noauth, $gid, $id, NULL, $year, $month);
    // checks to see if 'All Sections' options used
    if ($id == 0) {
        $check = '';
    } else {
        $check = 'AND a.sectionid = ' . $id;
    }
    // query to determine if there are any archived entries for the section
    $query = "SELECT a.id" . "\n FROM #__content as a" . "\n WHERE a.state = '-1'" . $check;
    $database->setQuery($query);
    $items = $database->loadObjectList();
    $archives = count($items);
    // Main Query
    $query = "SELECT a.*, ROUND(v.rating_sum/v.rating_count) AS rating, v.rating_count, u.name AS author, u.usertype, cc.name AS category, g.name AS groups" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n LEFT JOIN #__users AS u ON u.id = a.created_by" . "\n LEFT JOIN #__content_rating AS v ON a.id = v.content_id" . "\n LEFT JOIN #__sections AS s ON a.sectionid = s.id" . "\n LEFT JOIN #__groups AS g ON a.access = g.id" . (count($where) ? "\n WHERE " . implode("\n AND ", $where) : '') . "\n AND s.access <= " . $gid . "\n ORDER BY " . $order_pri . $order_sec;
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // initiate form
    echo '<form action="' . sefRelToAbs('index.php?option=' . $option . '&amp;task=archivesection&amp;id=' . $id . '&amp;Itemid=' . $Itemid) . '" method="post">';
    // Dynamic Page Title
    $mainframe->SetPageTitle($menu->name);
    if (!$archives) {
        // if no archives for category, hides search and outputs empty message
        echo '<br /><div align="center">' . _CATEGORY_ARCHIVE_EMPTY . '</div>';
    } else {
        BlogOutput($rows, $params, $gid, $access, $pop, $menu, 1);
    }
    echo '</form>';
}
开发者ID:cwcw,项目名称:cms,代码行数:54,代码来源:content.php

示例4: mosGetMenuLink

 /**
  * Utility function for writing a menu link
  */
 function mosGetMenuLink($mitem, $level = 0, &$params)
 {
     global $Itemid, $mosConfig_live_site, $mainframe;
     $txt = '';
     switch ($mitem->type) {
         case 'separator':
         case 'component_item_link':
             break;
         case 'content_item_link':
             $temp = split("&task=view&id=", $mitem->link);
             $mitem->link .= '&Itemid=' . $mainframe->getItemid($temp[1]);
             break;
         case 'url':
             if (eregi('index.php\\?', $mitem->link)) {
                 if (!eregi('Itemid=', $mitem->link)) {
                     $mitem->link .= '&Itemid=' . $mitem->id;
                 }
             }
             break;
         case 'content_typed':
         default:
             $mitem->link .= '&Itemid=' . $mitem->id;
             break;
     }
     // Active Menu highlighting
     $current_itemid = trim(mosGetParam($_REQUEST, 'Itemid', 0));
     if (!$current_itemid) {
         $id = '';
     } else {
         if ($current_itemid == $mitem->id) {
             $id = 'id="active_menu' . $params->get('class_sfx') . '"';
         } else {
             $id = '';
         }
     }
     $mitem->link = str_replace('&', '&amp;', $mitem->link);
     if (strcasecmp(substr($mitem->link, 0, 4), 'http')) {
         $mitem->link = sefRelToAbs($mitem->link);
     }
     $menuclass = 'mainlevel' . $params->get('class_sfx');
     if ($level > 0) {
         $menuclass = 'sublevel' . $params->get('class_sfx ');
     }
     switch ($mitem->browserNav) {
         // cases are slightly different
         case 1:
             // open in a new window
             $txt = '<a href="' . $mitem->link . '" target="_blank" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
         case 2:
             // open in a popup window
             $txt = "<a href=\"#\" onclick=\"javascript: window.open('" . $mitem->link . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"{$menuclass}\" " . $id . ">" . $mitem->name . "</a>\n";
             break;
         case 3:
             // don't link it
             $txt = '<span class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</span>';
             break;
         default:
             // formerly case 2
             // open in parent window
             $txt = '<a href="' . $mitem->link . '" class="' . $menuclass . '" ' . $id . '>' . $mitem->name . '</a>';
             break;
     }
     if ($params->get('menu_images')) {
         $menu_params = new stdClass();
         $menu_params =& new mosParameters($mitem->params);
         $menu_image = $menu_params->def('menu_image', -1);
         if ($menu_image != '-1' && $menu_image) {
             $image = '<img src="' . $mosConfig_live_site . '/images/stories/' . $menu_image . '" border="0" alt="' . $mitem->name . '"/>';
             if ($params->get('menu_images_align')) {
                 $txt = $txt . ' ' . $image;
             } else {
                 $txt = $image . ' ' . $txt;
             }
         }
     }
     return $txt;
 }
开发者ID:cwcw,项目名称:cms,代码行数:81,代码来源:mod_mainmenu.php


注:本文中的stdClass::def方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。