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


PHP Surfer::is_visiting方法代码示例

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


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

示例1: touch


//.........这里部分代码省略.........
             }
             if ($url = Images::get_thumbnail_href($image)) {
                 if ($this->item['icon_url'] == $url) {
                     $query[] = "icon_url = ''";
                 }
                 if ($this->item['thumbnail_url'] == $url) {
                     $query[] = "thumbnail_url = ''";
                 }
             }
         }
         // set an existing image as the article icon
     } elseif ($action == 'image:set_as_icon' && $origin) {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             if ($url = Images::get_icon_href($image)) {
                 $query[] = "icon_url = '" . SQL::escape($url) . "'";
             }
             // also use it as thumnail if none has been defined yet
             if (!(isset($this->item['thumbnail_url']) && trim($this->item['thumbnail_url'])) && ($url = Images::get_thumbnail_href($image))) {
                 $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
             }
         }
         // set an existing image as the article thumbnail
     } elseif ($action == 'image:set_as_thumbnail' && $origin) {
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             // use the thumbnail for large files, or the image itself for smaller files
             if ($image['image_size'] > $context['thumbnail_threshold']) {
                 $url = Images::get_thumbnail_href($image);
             } else {
                 $url = Images::get_icon_href($image);
             }
             $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
         } elseif ($origin) {
             $query[] = "thumbnail_url = '" . SQL::escape($origin) . "'";
         }
         // do not remember minor changes
         $silently = TRUE;
         // append a new image, and set it as the article thumbnail
     } elseif ($action == 'image:set_as_both' && $origin) {
         if (!Codes::check_embedded($this->item['description'], 'image', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [image=' . $origin . ']') . "'";
         }
         include_once $context['path_to_root'] . 'images/images.php';
         if ($image = Images::get($origin)) {
             // use the thumbnail for large files, or the image itself for smaller files
             if ($image['image_size'] > $context['thumbnail_threshold']) {
                 $url = Images::get_thumbnail_href($image);
             } else {
                 $url = Images::get_icon_href($image);
             }
             $query[] = "thumbnail_url = '" . SQL::escape($url) . "'";
         } elseif ($origin) {
             $query[] = "thumbnail_url = '" . SQL::escape($origin) . "'";
         }
         // do not remember minor changes
         $silently = TRUE;
         // add a reference to a location in the article description
     } elseif ($action == 'location:create' && $origin) {
         if (!Codes::check_embedded($this->item['description'], 'location', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . ' [location=' . $origin . ']') . "'";
         }
         // suppress a reference to a location that has been deleted
     } elseif ($action == 'location:delete' && $origin) {
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'location', $origin)) . "'";
         // add a reference to a new table in the article description
     } elseif ($action == 'table:create' && $origin) {
         if (!Codes::check_embedded($this->item['description'], 'table', $origin)) {
             $query[] = "description = '" . SQL::escape($this->item['description'] . "\n" . '[table=' . $origin . ']' . "\n") . "'";
         }
         // suppress a reference to a table that has been deleted
     } elseif ($action == 'table:delete' && $origin) {
         $query[] = "description = '" . SQL::escape(Codes::delete_embedded($this->item['description'], 'table', $origin)) . "'";
     }
     // stamp the update
     if (!$silently) {
         $query[] = "edit_name='" . SQL::escape(Surfer::get_name()) . "'," . "edit_id=" . SQL::escape(Surfer::get_id()) . "," . "edit_address='" . SQL::escape(Surfer::get_email_address()) . "'," . "edit_action='" . SQL::escape($action) . "'," . "edit_date='" . gmstrftime('%Y-%m-%d %H:%M:%S') . "'";
     }
     // update the database
     if (count($query)) {
         $query = "UPDATE " . SQL::table_name('articles') . " SET " . implode(', ', $query) . " WHERE id = " . SQL::escape($this->item['id']);
         SQL::query($query);
     }
     // add this page to the watch list of the contributor, on any action
     if (Surfer::get_id()) {
         Members::assign('article:' . $this->item['id'], 'user:' . Surfer::get_id());
     }
     // surfer is visiting this page
     Surfer::is_visiting($this->get_url(), $this->get_title(), 'article:' . $this->item['id'], $this->item['active']);
     // always clear the cache, even on no update
     Articles::clear($this->item);
     // get the parent
     if (!$this->anchor) {
         $this->anchor = Anchors::get($this->item['anchor']);
     }
     // propagate the touch upwards
     if (is_object($this->anchor)) {
         $this->anchor->touch('article:update', $this->item['id'], TRUE);
     }
 }
开发者ID:rair,项目名称:yacs,代码行数:101,代码来源:article.php

示例2: elseif

            $context['text'] .= '<form method="post" action="' . $context['script_url'] . '" id="main_form"><div>' . Users::list_for_ids($owners, 'request') . Skin::finalize_list(array(Skin::build_submit_button(i18n::s('Submit a request to get access'))), 'menu_bar') . '<input type="hidden" name="id" value="' . $item['id'] . '">' . '</div></form>';
        }
    }
    // re-enforce the canonical link
} elseif (!$zoom_type && $page == 1 && $context['self_url'] && $whole_rendering && strncmp($context['self_url'], $context['page_link'], strlen($context['page_link']))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $context['page_link']);
    Logger::error(Skin::build_link($context['page_link']));
    // display the article
} else {
    // behaviors can change page menu
    if (is_object($behaviors)) {
        $context['page_menu'] = $behaviors->add_commands('articles/view.php', 'article:' . $item['id'], $context['page_menu']);
    }
    // remember surfer visit
    Surfer::is_visiting(Articles::get_permalink($item), Codes::beautify_title($item['title']), 'article:' . $item['id'], $item['active']);
    // increment silently the hits counter if not robot, nor associate, nor owner, nor at follow-up page
    if (Surfer::is_crawler() || Surfer::is_associate()) {
    } elseif (isset($item['owner_id']) && Surfer::is($item['owner_id'])) {
    } elseif (!$zoom_type) {
        $item['hits'] = isset($item['hits']) ? $item['hits'] + 1 : 1;
        Articles::increment_hits($item['id']);
    }
    // initialize the rendering engine
    Codes::initialize(Articles::get_permalink($item));
    // neighbours information
    $neighbours = NULL;
    if (Articles::has_option('with_neighbours', $anchor, $item) && is_object($anchor)) {
        $neighbours = $anchor->get_neighbours('article', $item);
    }
    //
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php

示例3: urlencode

    if (!Surfer::is_logged()) {
        Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Users::get_permalink($item)));
    }
    // permission denied to authenticated user
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // re-enforce the canonical link
} elseif (!$zoom_type && $context['self_url'] && ($canonical = Users::get_permalink($item)) && strncmp($context['self_url'], $canonical, strlen($canonical))) {
    Safe::header('Status: 301 Moved Permanently', TRUE, 301);
    Safe::header('Location: ' . $canonical);
    Logger::error(Skin::build_link($canonical));
    // display the user profile
} else {
    if ($whole_rendering) {
        // remember surfer visit
        Surfer::is_visiting(Users::get_permalink($item), $item['full_name'] ? $item['full_name'] : $item['nick_name'], 'user:' . $item['id'], $item['active']);
        // initialize the rendering engine
        Codes::initialize(Users::get_permalink($item));
        //
        // meta-information -- $context['page_header'], etc.
        //
        // prevent search engines to present cache versions of this page
        if ($item['active'] != 'Y') {
            $context['page_header'] .= "\n" . '<meta name="robots" content="noarchive" />';
        }
        // add canonical link
        if (!$zoom_type) {
            $context['page_header'] .= "\n" . '<link rel="canonical" href="' . Users::get_permalink($item) . '" />';
        }
        // a meta link to a feeding page
        $context['page_header'] .= "\n" . '<link rel="alternate" href="' . $context['url_to_root'] . Users::get_url($item['id'], 'feed') . '" title="RSS" type="application/rss+xml" />';
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:view.php


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