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


PHP seo::updateSection方法代码示例

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


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

示例1: COUNT

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/stdf.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/seo.php';
/*
 * Исправление сбитых позиций в SEO-каталоге /catalog/ 
 */
$sql = 'SELECT parent FROM seo_sections 
        WHERE parent <> 0 
        GROUP BY parent 
        HAVING COUNT(parent) <> MAX(pos_num) OR MIN(pos_num) <> 1';
$parents = $DB->rows($sql);
$seo = new seo();
if ($parents) {
    foreach ($parents as $k => $v) {
        $sql = "SELECT id FROM seo_sections WHERE parent = {$v['parent']} ORDER BY id ASC";
        $rows = $DB->rows($sql);
        if ($rows) {
            foreach ($rows as $i => $row) {
                $info['pos_num'] = $i + 1;
                $seo->updateSection($row['id'], $info);
            }
            echo "Update parent - {$v['parent']}<br/>";
        }
    }
}
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:26,代码来源:fix_position_seocatalog.php

示例2: createSection

/**
 * Создание раздела/подраздела
 *
 * @param array $info Данные создания
 * @return object xajaxResponse
 */
function createSection($info, $action = 'create')
{
    global $GLOBALS;
    session_start();
    if (!hasPermissions('seo')) {
        return false;
    }
    $objResponse = new xajaxResponse();
    $info['id'] = intval($info['id']);
    $info['bind'] = intval($info['bind']);
    $info['subdomain'] = intval($info['subdomain']);
    $info['parent'] = intval($info['parent']);
    $info['old_position'] = intval($info['old_position']);
    $info['new_position'] = intval($info['new_position']);
    $info['direct_id'] = $direct_id = intval($info['direction']);
    $info['old_direction'] = intval($info['old_direction']);
    $saved_disable_link_processing = $GLOBALS['disable_link_processing'];
    $GLOBALS['disable_link_processing'] = TRUE;
    $section = array("bind" => 0, "parent" => (int) $info['parent'], "name_section" => (string) change_q_x($info['name_section'], true), "name_section_link" => (string) change_q_x($info['name_section_link'], true), "meta_description" => (string) change_q_x($info['meta_description'], true), "meta_keywords" => (string) change_q_x($info['meta_keywords'], true), "content_before" => (string) __paramValue('ckeditor', $info['content_before']), "content_after" => (string) __paramValue('ckeditor', $info['content_after']), "date_create" => "NOW();");
    $GLOBALS['disable_link_processing'] = $saved_disable_link_processing;
    $seo = new seo($_SESSION['subdomain']);
    if ($info['direct_id']) {
        $section['direct_id'] = $info['direct_id'];
    } else {
        $objResponse->script("alert('Не указано направление');");
        $objResponse->script("\$('s_direction').focus();");
        return $objResponse;
    }
    if ($info['is_subcategory'] && $info['subdomain'] == 0) {
        $objResponse->script("alert('Не указан регион');");
        return $objResponse;
    }
    if (trim($info['name_section']) == "") {
        $objResponse->script("alert('Введите название раздела');");
        $objResponse->script("\$('name_section').focus();");
        return $objResponse;
    }
    if (preg_match('/[^A-Za-z0-9_\\-]/', $info['name_section_link'])) {
        $objResponse->script("alert('Название ссылки раздела должно содержать только латинские буквы, цифры, нижнее подчеркивание или тире');");
        $objResponse->script("\$('name_section_link').focus();");
        return $objResponse;
    }
    if ($seo->checkLink('section', $section['name_section_link'], $info['direct_id'], $info['parent'], $info['id'], $info['subdomain'])) {
        $objResponse->script("alert('В выбранном разделе уже есть элемент с такой ссылкой');");
        $objResponse->script("\$('name_section_link').focus();");
        return $objResponse;
    }
    switch ($action) {
        default:
        case 'create':
            $section['name_section'] = stripslashes($section['name_section']);
            $section['meta_description'] = stripslashes($section['meta_description']);
            $section['meta_keywords'] = stripslashes($section['meta_keywords']);
            $section['content_before'] = stripslashes($section['content_before']);
            $section['content_after'] = stripslashes($section['content_after']);
            $new_section = $seo->createSection($section, $info['subdomain'], (int) $info['is_draft']);
            $section['id'] = $new_section['id'];
            $pos_old = $new_section['pos'];
            $section['pos_num'] = (int) $info['new_position'];
            if ($section['pos_num'] != -1) {
                $seo->updatePosition($pos_old, $info['new_position'], $info['parent'], $direct_id);
                $seo->updateSection($section['id'], $section, $info['bind'], $info['subdomain'], (int) $info['is_draft']);
            }
            if ($info['is_subcategory']) {
                $success_text = "Подраздел успешно добавлен";
                $url['msgok'] = 5;
            } else {
                $success_text = "Раздел успешно добавлен";
                $url['msgok'] = 1;
            }
            break;
        case 'update':
            if ($info['old_parent'] == $info['parent']) {
                $section['pos_num'] = (int) $info['new_position'];
                if ($info['old_direction'] != $direct_id) {
                    $seo->updatePosition($info['old_position'], null, $info['parent'], $info['old_direction']);
                    $section['pos_num'] = intval($seo->getPositions($section['parent'], $direct_id)) + 1;
                } else {
                    if ($info['new_position'] == -1) {
                        $section['pos_num'] = intval($seo->getPositions($section['parent'], $direct_id));
                        $info['new_position'] = $section['pos_num'];
                    }
                    $seo->updatePosition($info['old_position'], $info['new_position'], $info['parent'], $direct_id);
                }
                $seo->updateSection($info['id'], $section, $info['bind'], $info['subdomain'], (int) $info['is_draft']);
            } else {
                $new_position = $seo->getPositions($info['parent'], $direct_id) + 1;
                $section['pos_num'] = (int) $new_position;
                $seo->updatePositionsByParent($info['old_parent'], $info['old_position'], $direct_id);
                $seo->updateSection($info['id'], $section, $info['bind'], $info['subdomain'], (int) $info['is_draft']);
                if ($info['new_position'] != -1) {
                    $pos_old = $section['pos_num'];
                    $pos_new = $info['new_position'];
                    $seo->updatePosition($pos_old, $pos_new, $info['parent'], $direct_id);
//.........这里部分代码省略.........
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:101,代码来源:seo.server.php


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