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


PHP Page::getInstance方法代码示例

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


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

示例1: __construct

 /**
  * Constructor JavaScript
  * @param string $code_javascript 
  * @param boolean $add_js_to_page [default value: false]
  */
 function __construct($code_javascript, $add_js_to_page = false)
 {
     parent::__construct();
     if (!isset($code_javascript)) {
         throw new NewException("1 argument for " . get_class($this) . "::__construct() is mandatory", 0, getDebugBacktrace(1));
     }
     $this->code_javascript = $code_javascript;
     $this->is_javascript_object = true;
     if ($add_js_to_page) {
         $page_object = Page::getInstance($_GET['p']);
         if (gettype($code_javascript) != "object") {
             // search in javascript if begin by $(document).ready(
             // then put javascript to the end (for AJAX because doc is already loaded)
             $tmp_code_javascript = trim(str_replace("\t", "", $code_javascript));
             $pos_doc_ready = find($tmp_code_javascript, "\$(document).ready(", 1);
             $pos_jquery_ready = find($tmp_code_javascript, "jQuery(document).ready(", 1);
             if ($pos_doc_ready >= 18 && $pos_doc_ready <= 30 || $pos_jquery_ready >= 23 && $pos_jquery_ready <= 35) {
                 // 30|35: beacause of tag //<![CDATA[
                 $page_object->addObject($this, false, true);
             } else {
                 $page_object->addObject($this);
             }
         } else {
             $page_object->addObject($this);
         }
     }
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:32,代码来源:JavaScript.class.php

示例2: getValues

 public function getValues($keys = null, $format = null, $maxDepth = null)
 {
     $ret = parent::getValues($keys, $format, $maxDepth);
     $ret['navigation'] = Xoops_Locale::translate('L_RELATED_NAVIGATION_OPTION' . $this->getVar('related_navigation'), 'page');
     $ret['related_links'] = Page::getInstance()->getLinkHandler()->getLinks($this->getVar('related_id'));
     return $ret;
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:7,代码来源:page_related.php

示例3: page_blocks_edit

function page_blocks_edit($options)
{
    $block_form = new Xoops\Form\BlockForm();
    if ($options[0] != 'id') {
        $mode_form = new Xoops\Form\Select(PageLocale::CONF_BLOCK_MODE, 'options[0]', $options[0], 1, false);
        $mode_form->addOption('content', PageLocale::CONF_BLOCK_L_CONTENT);
        $mode_form->addOption('list', PageLocale::CONF_BLOCK_L_LIST);
        $block_form->addElement($mode_form);
        $order_form = new Xoops\Form\Select(PageLocale::CONF_BLOCK_ORDER, 'options[1]', $options[1], 1, false);
        $order_form->addOption('create', PageLocale::CONF_BLOCK_L_RECENT);
        $order_form->addOption('hits', PageLocale::CONF_BLOCK_L_HITS);
        $order_form->addOption('rating', PageLocale::CONF_BLOCK_L_RATING);
        $order_form->addOption('random', PageLocale::CONF_BLOCK_L_RANDOM);
        $block_form->addElement($order_form);
        $sort_form = new Xoops\Form\Select(PageLocale::CONF_BLOCK_SORT, 'options[2]', $options[2], 1, false);
        $sort_form->addOption('ASC', PageLocale::CONF_BLOCK_L_ASC);
        $sort_form->addOption('DESC', PageLocale::CONF_BLOCK_L_DESC);
        $block_form->addElement($sort_form);
        $block_form->addElement(new Xoops\Form\Text(PageLocale::CONF_BLOCK_DISPLAY_NUMBER, 'options[3]', 1, 2, $options[3]), true);
        $block_form->addElement(new Xoops\Form\RadioYesNo(PageLocale::CONF_BLOCK_ALL_CONTENT, 'options[4]', $options[4]));
    } else {
        $block_form->addElement(new Xoops\Form\Hidden('options[0]', $options[0]));
        $content = Page::getInstance()->getContentHandler()->getPageTitle(1);
        $select_form = new Xoops\Form\Select(PageLocale::CONF_BLOCK_CONTENTDISPLAY, 'options[1]', $options[1], 1, false);
        foreach ($content as $value) {
            $select_form->addOption($value['content_id'], $value['content_title']);
        }
        $block_form->addElement($select_form);
    }
    return $block_form->render();
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:31,代码来源:page_blocks.php

示例4: __construct

 public function __construct()
 {
     $this->_page = Page::getInstance();
     $this->_resource = Resource::getInstance();
     $this->_lang = Lang::lang();
     $this->_db = static::$_defaultDb;
     $this->_configMain = Registry::get('main', 'config');
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:8,代码来源:Controller.php

示例5: view

 /**
  * 页面展示
  * @param  [type]  $html_file [description]
  * @param  array   $data      [description]
  * @param  integer $http_code [description]
  * @return [type]             [description]
  */
 public static function view($html_file = "", $data = [], $http_code = 200)
 {
     http_response_code($http_code);
     if (empty($html_file)) {
         return true;
     }
     $page = Page::getInstance();
     $page->parse($html_file, $data);
     return $page->outPut();
 }
开发者ID:storm12358,项目名称:toc,代码行数:17,代码来源:Response.php

示例6: __construct

 /**
  * @param PagePage_related|XoopsObject $obj
  */
 public function __construct(PagePage_related $obj)
 {
     $helper = Page::getInstance();
     $xoops = $helper->xoops();
     $xoops->theme()->addScript('modules/page/media/jquery/multi-select.0.3-7/js/jquery.multi-select.js');
     $xoops->theme()->addScript('modules/page/media/jquery/multi-select-init.js');
     $xoops->theme()->addStylesheet('modules/page/media/jquery/multi-select.0.3-7/css/multi-select.css');
     // Get handler
     $content_Handler = $helper->getContentHandler();
     $link_Handler = $helper->getLinkHandler();
     $title = $obj->isNew() ? PageLocale::A_ADD_RELATED : PageLocale::A_EDIT_RELATED;
     parent::__construct($title, 'form', 'related.php', 'post', true);
     //name
     $this->addElement(new Xoops\Form\Text(PageLocale::RELATED_NAME, 'related_name', 4, 255, $obj->getVar('related_name'), ''), true);
     //menu
     $menu = new Xoops\Form\RadioYesNo(PageLocale::RELATED_MENU, 'related_domenu', $obj->getVar('related_domenu'));
     $menu->setDescription(PageLocale::RELATED_MENU_DSC);
     $this->addElement($menu, false);
     //navigation
     $navigation = new Xoops\Form\Select(PageLocale::RELATED_NAVIGATION, 'related_navigation', $obj->getVar('related_navigation'), 1, false);
     $navigation->addOption(1, PageLocale::L_RELATED_NAVIGATION_OPTION1);
     $navigation->addOption(2, PageLocale::L_RELATED_NAVIGATION_OPTION2);
     $navigation->addOption(3, PageLocale::L_RELATED_NAVIGATION_OPTION3);
     $navigation->addOption(4, PageLocale::L_RELATED_NAVIGATION_OPTION4);
     $navigation->addOption(5, PageLocale::L_RELATED_NAVIGATION_OPTION5);
     $navigation->setClass('span3');
     $this->addElement($navigation);
     $related_links = $link_Handler->getContentByRelated($obj->getVar('related_id'));
     $contents_used = $link_Handler->getContentUsed();
     $contents = $content_Handler->getPageTitle(1);
     $related_links_form = new Xoops\Form\Select(PageLocale::RELATED_MAIN, 'datas', $related_links, $size = 20, $multiple = true);
     foreach ($contents as $k => $content) {
         if (!in_array($content['content_id'], $contents_used) || in_array($content['content_id'], $related_links)) {
             $related_links_form->addOption($content['content_id'], $content['content_title']);
         }
     }
     $this->addElement($related_links_form, true);
     $this->addElement(new Xoops\Form\Hidden('related_id', $obj->getVar('related_id')));
     /**
      * Buttons
      */
     $buttonTray = new Xoops\Form\ElementTray('', '');
     $buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
     $buttonSubmit = new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit');
     $buttonSubmit->setClass('btn btn-success');
     $buttonTray->addElement($buttonSubmit);
     $buttonReset = new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset');
     $buttonReset->setClass('btn btn-warning');
     $buttonTray->addElement($buttonReset);
     $buttonCancel = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
     $buttonCancel->setExtra("onclick='javascript:history.go(-1);'");
     $buttonCancel->setClass('btn btn-danger');
     $buttonTray->addElement($buttonCancel);
     $this->addElement($buttonTray);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:58,代码来源:page_related.php

示例7: render

 /**
  * (non-PHPdoc)
  * @see Block_Abstract::render()
  */
 public function render()
 {
     $this->_collectData();
     $tpl = new Template();
     $tpl->setData(array('config' => $this->_config, 'place' => $this->_config['place'], 'menuData' => $this->_data));
     if (static::dependsOnPage) {
         $tpl->set('page', Page::getInstance());
         $tpl->set('pagesTree', Model::factory('Page')->getTree());
     }
     return $tpl->render(Application::getTemplatesPath() . $this->_template);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:15,代码来源:Menu.php

示例8: makeignorelist

 /**
  * ignoreリストを構築する。
  */
 protected function makeignorelist()
 {
     $this->ignorelist = array();
     $page = Page::getInstance(self::ignorelistpage);
     $lines = explode("\n", $page->getsource());
     foreach ($lines as $str) {
         if (mb_ereg('^-\\[\\[(.+)\\]\\]', $str, $m)) {
             $this->ignorelist[] = $m[1];
         }
     }
 }
开发者ID:kaz6120,项目名称:BitWiki,代码行数:14,代码来源:AutoLink.php

示例9: Search_showResults

/**
 * retrieve list of search results
 *
 * @return string HTML list of search results
 */
function Search_showResults()
{
    global $PLUGINS;
    // { variables
    global $PAGEDATA;
    $start = (int) @$_REQUEST['start'];
    $search = @$_REQUEST['search'];
    if (!$search) {
        return '<em id="searchResultsTitle">no search text entered</em>';
    }
    $c = '';
    // }
    // { pages
    $q = dbAll('select * from pages where (name like "%' . $search . '%" or body like "%' . $search . '%") order by edate desc limit ' . $start . ',20');
    $n = count($q);
    if ($n > 0) {
        foreach ($q as $p) {
            Page::getInstance($p['id'], $p);
        }
        $q = array_slice($q, $start, 20);
        $c .= '<h2>Page Search Results</h2><em id="searchResultsTitle">';
        if ($n == 1) {
            $c .= '1 result found';
        } else {
            $c .= $n . ' results found';
        }
        $c .= '</em> <div>';
        if ($start > 0) {
            $c .= '[<a href="' . $PAGEDATA->getRelativeURL() . '?search=' . urlencode($search) . '&amp;start=' . ($start - 20) . '">previous 20</a>] ';
        }
        if ($start + 20 < $n) {
            $c .= '[<a href="' . $PAGEDATA->getRelativeURL() . '?search=' . urlencode($search) . '&amp;start=' . ($start + 20) . '">next 20</a>] ';
        }
        $c .= '<ol start="' . ($start + 1) . '" id="searchResults">';
        foreach ($q as $r) {
            $title = $r['title'] == '' ? $r['name'] : $r['title'];
            $c .= '<li><h4>' . htmlspecialchars($title) . '</h4>' . '<p>' . substr(preg_replace('/<[^>]*>/', '', $r['body']), 0, 200) . '...<br /><a href="/' . urlencode($r['name']) . '?search=' . $search . '">/' . htmlspecialchars($r['name']) . '</a></p></li>';
        }
        $c .= '</ol></div>';
    }
    // }
    // { others
    foreach ($PLUGINS as $plugin) {
        if (@$plugin['search']) {
            $c .= $plugin['search']();
        }
    }
    // }
    if (!$c) {
        return '<em id="searchResultsTitle">' . __('no results found', 'core') . '</em>';
    }
    return $c;
}
开发者ID:raylouis,项目名称:kvwebme,代码行数:58,代码来源:search.php

示例10: _routeModule

 protected function _routeModule()
 {
     $vers = Request::get('vers', 'int', false);
     $showRevision = false;
     $pageCode = $this->_request->getPart(0);
     if (!strlen($pageCode)) {
         $pageCode = 'index';
     }
     $pageData = Model::factory('Page')->getCachedItemByField('code', $pageCode);
     if (empty($pageData)) {
         Response::redirect('/');
     }
     $cacheManager = new Cache_Manager();
     $cache = $cacheManager->get('data');
     $blockManager = false;
     if ($vers) {
         $user = User::getInstance();
         if ($user->isAuthorized() && $user->isAdmin()) {
             $pageData = array_merge($pageData, Model::factory('Vc')->getData('page', $pageData['id'], $vers));
             $showRevision = true;
         } else {
             $vers = false;
         }
     }
     if (!$vers && $cache) {
         Blockmanager::setDefaultCache($cache);
     }
     if ($pageData['published'] == false && !$showRevision) {
         Response::redirect('/');
     }
     $page = Page::getInstance();
     foreach ($pageData as $k => $v) {
         $page->{$k} = $v;
     }
     /**
      * Check if controller attached
      */
     if (strlen($page->func_code)) {
         $fModules = Config::factory(Config::File_Array, $this->_appConfig->get('frontend_modules'));
         if ($fModules->offsetExists($page->func_code)) {
             $controllerConfig = $fModules->get($page->func_code);
             $this->runController($controllerConfig['class'], $this->_request->getPart(1));
         }
     }
     if (!$vers && $cache) {
         Blockmanager::setDefaultCache($cache);
     }
     $blockManager = new Blockmanager();
     if ($page->show_blocks) {
         $blockManager->init($page->id, $page->default_blocks, $vers);
     }
     $this->showPage($page, $blockManager);
 }
开发者ID:vgrish,项目名称:dvelum,代码行数:53,代码来源:Router.php

示例11: backend

 /**
  * Used to populate backend
  *
  * @param int $limit : Number of item for backend
  *                   Expects an array containing:
  *                   title   : Title for the backend items
  *                   link    : Link for the backend items
  *                   content : content for the backend items
  *                   date    : Date of the backend items
  *
  * @return array
  */
 public function backend($limit)
 {
     $ret = array();
     $contents = Page::getInstance()->getContentHandler()->getPagePublished(0, $limit);
     foreach ($contents as $k => $content) {
         $ret[$k]['title'] = $content->getVar('content_title');
         $ret[$k]['link'] = Page::getInstance()->url('viewpage.php') . '?id=' . $content->getVar('content_id');
         $ret[$k]['content'] = $content->getVar('content_shorttext') . '<br />' . $content->getVar('content_text');
         $ret[$k]['date'] = $content->getVar('content_create');
     }
     return $ret;
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:24,代码来源:system.php

示例12: __construct

 /**
  * get list of pages that have a common parent
  *
  * @param string  $constraint the SQL constraint to use
  * @param boolean $filter     whether to only show "published" pages
  *
  * @return object the Pages object
  */
 function __construct($constraint, $filter = true)
 {
     global $isadmin;
     $filter = $isadmin || !$filter ? '' : ' && !(special&2)';
     $rs = dbAll("select * from pages where {$constraint} {$filter} " . "order by special&2,ord,name");
     if (!count($rs)) {
         $rs = array();
     }
     foreach ($rs as $r) {
         $this->pages[] = Page::getInstance($r['id'], $r);
     }
     Pages::$instancesByParent[$constraint] =& $this;
 }
开发者ID:raylouis,项目名称:kvwebme,代码行数:21,代码来源:Pages.php

示例13: hasVoted

 public function hasVoted($content_id)
 {
     $helper = Page::getInstance();
     $uid = $helper->getUserId();
     $ip = $helper->xoops()->getenv('REMOTE_ADDR');
     $criteria = new CriteriaCompo();
     $criteria->add(new Criteria('rating_content_id', $content_id));
     $criteria2 = new CriteriaCompo();
     $criteria2->add(new Criteria('rating_uid', $uid), 'OR');
     $criteria2->add(new Criteria('rating_ip', $ip), 'OR');
     $criteria->add($criteria2, 'AND');
     return parent::getCount($criteria);
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:13,代码来源:page_rating.php

示例14: do_url

 function do_url()
 {
     if (empty(Vars::$get['page']) || empty(Vars::$get['file'])) {
         exit;
     }
     if (!mb_ereg('\\.(.+?)$', Vars::$get['file'], $m) || empty(self::$type[$m[1]])) {
         exit;
     }
     $file = AttachedFile::getInstance(Vars::$get['file'], Page::getInstance(Vars::$get['page']));
     header('Content-Type: ' . self::$type[$m[1]]);
     header('Content-Length: ' . $file->getsize());
     echo $file->getdata();
     exit;
 }
开发者ID:kaz6120,项目名称:BitWiki,代码行数:14,代码来源:image.inc.php

示例15: Forms_verificationSend

/**
 * send a random code to an email address to verify it
 *
 * @ return array saying it happened
 */
function Forms_verificationSend()
{
    if (!isset($_REQUEST['email'])) {
        return array('error' => 'no email parameter');
    }
    $email = $_REQUEST['email'];
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return array('error' => 'invalid email address');
    }
    if (!isset($_SESSION['emails'])) {
        $_SESSION['emails'] = array();
    }
    if (!isset($_SESSION['emails'][$email])) {
        $pid = (int) @$_REQUEST['page'];
        if ($pid) {
            $page = Page::getInstance($pid);
            if (!$page) {
                return array('error' => 'page not found');
            }
            $page->initValues();
            $prevent = (int) @$page->vars['forms_preventUserFromSubmitting'];
            if ($prevent) {
                $id = (int) dbOne('select id from user_accounts where email="' . addslashes($email) . '"', 'id');
                if ($id) {
                    if ($prevent == 1) {
                        // don't allow any users to submit
                        return array('error' => $page->vars['forms_preventUserFromSubmittingMessage']);
                    }
                    if ($prevent < 4) {
                        // parse conditions
                        $user = User::getInstance($id);
                        if ($user) {
                            $cond_val = $page->vars['forms_preventUserFromSubmittingCondVal'];
                            $cond_key = $page->vars['forms_preventUserFromSubmittingCondKey'];
                            if ($prevent == 3 && $user->get($cond_key) == $cond_val || $prevent == 2 && $user->get($cond_key) != $cond_val) {
                                return array('error' => $page->vars['forms_preventUserFromSubmittingMessage']);
                            }
                        }
                    }
                }
            }
        }
        $_SESSION['emails'][$email] = rand(10000, 99999);
    }
    mail($email, '[' . $_SERVER['HTTP_HOST'] . '] email verification code', 'The verification code for this email address is: ' . $_SESSION['emails'][$email]);
    return array('ok' => 1);
}
开发者ID:raylouis,项目名称:kvwebme,代码行数:52,代码来源:api.php


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