diff --git a/helpcenter.r7-office.ru/Web/App_Data/PublishProfiles/helpcenter.r7-office.ru.pubxml b/helpcenter.r7-office.ru/Web/App_Data/PublishProfiles/helpcenter.r7-office.ru.pubxml index e6a98b91d..731fe9d12 100644 --- a/helpcenter.r7-office.ru/Web/App_Data/PublishProfiles/helpcenter.r7-office.ru.pubxml +++ b/helpcenter.r7-office.ru/Web/App_Data/PublishProfiles/helpcenter.r7-office.ru.pubxml @@ -10,7 +10,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt Any CPU True - False + True helpcenter.r7-office.ru helpcenter.r7-office.ru @@ -22,6 +22,24 @@ by editing this MSBuild file. In order to learn more about this please visit htt True True False - DonotMerge + MergeAllPagesAndControlToASingleAssembly + True + ASC.Merge.dll + + + + <_XMLFiles Include="Bin\*.xml" /> + <_ConfigFiles Include="web.autofac.config" /> + + Bin\%(RecursiveDir)%(Filename)%(Extension) + + + %(RecursiveDir)%(Filename)%(Extension) + + + + + CustomCollectFiles; + ; \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Basic.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Basic.ascx index 1e2ad6a67..3e0a4c662 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Basic.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Basic.ascx @@ -13,7 +13,6 @@

Javascript файл API может быть найден в следующей папке редактора:

https://documentserver/web-apps/apps/api/documents/api.js

Где documentserver - имя сервера, на котором установлен Сервер документов.

-
Для версий Сервера Документов ниже 4.0 путь к API будет выглядеть следующим образом:
https://documentserver/OfficeWeb/apps/api/documents/api.js

Целевой HTML файл, в который должны быть встроены редакторы, должен иметь тег-заполнитель div, в который будет передана вся информация о редакторе:

diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Callback.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Callback.ascx index 22428de3e..4d222f787 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Callback.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Callback.ascx @@ -1,6 +1,4 @@ -<%@ Control Language="C#" Inherits="BaseContentUserControls" %> -<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %> -
-

Callback handler

-

- The document editing service informs the document storage service about the status of the document editing using the callbackUrl from ">JavaScript API. - The document editing service use the POST request with the information in body. -

+

Обработчик обратных вызовов

+

Сервис редактирования документов оповещает сервис хранения документов о статусе редактирования документа, используя callbackUrl из ">JavaScript API. Сервис редактирования документов использует POST запросы с параметрами в теле.

-

Parameters and their description:

+

Параметры и их описание:

@@ -24,99 +19,95 @@ - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + - - - + + + - - - + + + - - - + + +
ParameterDescriptionTypePresenceПараметрОписаниеТипНаличие
Defines the object received if the new user connected to the document co-editing or disconnected from it. In the first case the type field value is 1, in the other case - 0. The userid field value is the identifier of the user who connected to or disconnected from the document co-editing.array of objectoptionalОпределяет полученный объект, если новый пользователь, был подключен к совместному редактированию документа или отключен от него. В первом случае значение поля тип равно 1, во втором - 0. Значение поля userid является идентификатором пользователя, который был подключен к совместному редактированию документа, или отключен от него.массив объектовнеобязательный
Defines the array of objects with the document changes history. The object is present when the status value is equal to 2 or 3 only. Must be sent as a property changes of the object sent as the argument to the ">refreshHistory method. Deprecated since version 4.2, please use history instead.array of objectoptionalОпределяет массив объектов с историей изменения документа. Объект присутствует только если значение параметра status равно 2 или 3. Должен быть отправлен как свойство changes, объекта, который был передан методу ">refreshHistory в качестве аргумента. Удалено, начиная с версии 4.2, пожалуйста, используйте history.массив объектовнеобязательный
Defines the link to the file with the document editing data used to track and display the document changes history. The link is present when the status value is equal to 2 or 3 only. The file must be saved and its address must be sent as changesUrl parameter using the ">setHistoryData method to show the changes corresponding to the specific document version.stringoptionalОпределяет ссылку на файл с данными об изменениях документа, используемый для отображения истории изменения этого документа. Ссылка присутствует только если значение параметра status равно 2 или 3. Файл должен быть сохранён, а его адрес должен быть отправлен как параметр changesUrl, используя метод ">setHistoryData, чтобы показать изменения, относящиеся к конкретной версии документа.строканеобязательный
Defines the type of initiator when the ">force saving request is performed. Can have the following values: -
    -
  • 0 - the force saving request is performed to the ">command service,
  • -
  • 1 - the force saving request is performed each time the saving is done (e.g. the Save button is clicked), which is only available when the ">forcesave option is set to true.
  • -
  • 2 - the force saving request is performed by timer with the settings from the server config.
  • -
- The type is present when the status value is equal to 6 or 7 only. -
integeroptionalОпределяет тип инициатора запроса на выполнение ">принудительного сохранения. Может быть равным следующим значениям:
    +
  • 0 - запрос на принудительное сохранение отправляется к ">командному сервису.
  • +
  • 1 - запрос на принудительное сохранение выполняется каждый раз, когда производится сохранение (например, нажимается кнопка Сохранить), что доступно лишь в случае, если значение параметра ">forcesave равно true.
  • +
  • 2 - запрос на принудительное сохранение выполняется таймером с настройками от конфигурации сервера.
  • +
Тип присутствует только если значение параметра status равно 6 или 7.
целочисленныйнеобязательный
Defines the object with the document changes history. The object is present when the status value is equal to 2 or 3 only. It contains the object serverVersion and changes, which must be sent as properties serverVersion and changes of the object sent as the argument to the ">refreshHistory method.objectoptionalОпределяет объект с информацией об истории изменения документа. Объект присутствует только если значение параметра status равно 2 или 3. Содержит объекты serverVersion и changes, которые должны быть отправлены как свойства serverVersion и changes объекта, который был передан в качестве аргумента методу ">refreshHistory.объектнеобязательный
Defines the edited document identifier.stringrequiredОпределяет идентификатор отредактированного документа.строкаобязательный
Defines the status of the document. Can have the following values: -
    -
  • 0 - no document with the key identifier could be found,
  • -
  • 1 - document is being edited,
  • -
  • 2 - document is ready for saving,
  • -
  • 3 - document saving error has occurred,
  • -
  • 4 - document is closed with no changes,
  • -
  • 6 - document is being edited, but the current document state is saved,
  • -
  • 7 - error has occurred while force saving the document.
  • +
Определяет статус документа. Может быть равным следующим значениям:
    +
  • 0 - не найден документ с данным идентификатором,
  • +
  • 1 - документ редактируется,
  • +
  • 2 - документ готов к сохранению,
  • +
  • 3 - во время сохранения документа произошла ошибка,
  • +
  • 4 - документ был закрыт без изменений,
  • +
  • 6 - документ редактируется, но текущее его состояние сохранено,
  • +
  • 7 - во время принудительного сохранения документа произошла ошибка.
integerrequiredцелочисленныйобязательный
Defines the link to the edited document to be saved with the document storage service. The link is present when the status value is equal to 2 or 3 only.stringoptionalОпределяет ссылку на отредактированный документ, который будет сохранён сервисом хранения документов. Ссылка присутствует только если значение параметра status равно 2 или 3.строканеобязательный
Defines the custom information sent to the ">command service in case it was present in the request.stringoptionalОпределяет пользовательскую информацию, отправляемую ">командному сервису в случае, если она была передана в запросе.строканеобязательный
Defines the list of the identifiers of the users who opened the document for editing; when the document has been changed the users will return the identifier of the user who was the last to edit the document (for status 2 and status 6 replies).array of stringoptionalОпределяет список идентификаторов пользователей, который открыли документ для редактирования; когда документ был изменён, объект users вернёт идентификатор пользователя, который последним редактировал документ (для ответов со статусами 2 и 6).массив строкнеобязательный
-

Status 1 is received every user connection to or disconnection from document co-editing.

-

Status 2 (3) is received ">10 seconds after the document is closed for editing with the identifier of the user who was the last to send the changes to the document editing service.

-

Status 4 is received after the document is closed for editing with no changes by the last user.

-

Status 6 (7) is received when the force saving request is performed.

+

Статус 1 будет получен каждый раз, когда пользователь подключается к совместному редактированию документа или отключается от него.

+

Статус 2 (3) будет получен через ">10 секунд после закрытия документа, с идентификатором пользователя, от которого сервисом редактирования документов в последний раз были получены изменения.

+

Статус 4 будет получен после закрытия документа, если пользователь не вносил в него никаких изменений.

+

Статус 6 (7) будет получен при выполнении запроса на принудительное сохранение.

- +
 {
     "actions": [{"type": 1, "userid": "78e1e841"}],
@@ -126,7 +117,7 @@
 }
 
- +
 {
     "actions": [{"type": 0, "userid": "78e1e841"}],
@@ -142,7 +133,7 @@
 }
 
- +
 {
     "key": "Khirz6zTPdfd7",
@@ -150,7 +141,7 @@
 }
 
- +
 {
     "changesurl": "https://documentserver/url-to-changes.zip",
@@ -167,18 +158,18 @@
 }
 
- + -

The document storage service must return the following response, otherwise the document editor will display an error message:

+

Сервис хранения документов должен отправить следующий ответ, в противном случае, редактор документов покажет сообщение об ошибке:

 {
     "error": 0
 }
 
-

The document manager and document storage service are either included to Community Server or must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server.

+

Менеджер документов и сервис хранения документов включены в Сервер совместной работы или должны быть реализованы разработчиками, использующими Сервер документов на своих собственных серверах.

- +
 public class WebEditor : IHttpHandler
 {
@@ -206,9 +197,9 @@ public class WebEditor : IHttpHandler
     }
 }
 
-
PATH_FOR_SAVE is the absolute path to your computer folder where the file will be saved including the file name.
+
PATH_FOR_SAVE - абсолютный путь к папке на вашем компьютере, включая имя файла, в которую будет сохранён этот файл.
- +
 public class IndexServlet extends HttpServlet {
     @Override
@@ -245,9 +236,9 @@ public class IndexServlet extends HttpServlet {
     }
 }
 
-
pathForSave is the absolute path to your computer folder where the file will be saved including the file name.
+
pathForSave - абсолютный путь к папке на вашем компьютере, включая имя файла, в которую будет сохранён этот файл.
- +
 var fs = require("fs");
 
@@ -282,9 +273,9 @@ app.post("/track", function (req, res) {
     }
 });
 
-
pathForSave is the absolute path to your computer folder where the file will be saved including the file name.
+
pathForSave - абсолютный путь к папке на вашем компьютере, включая имя файла, в которую будет сохранён этот файл.
- +
 <?php
 
@@ -307,9 +298,9 @@ echo "{\"error\":0}";
 
 ?>
 
-
$path_for_save is the absolute path to your computer folder where the file will be saved including the file name.
+
$path_for_save - абсолютный путь к папке на вашем компьютере, включая имя файла, в которую будет сохранён этот файл.
- +
 class ApplicationController < ActionController::Base
     def index
@@ -340,5 +331,5 @@ class ApplicationController < ActionController::Base
     end
 end
 
-
path_for_save is the absolute path to your computer folder where the file will be saved including the file name.
+
path_for_save - абсолютный путь к папке на вашем компьютере, включая имя файла, в которую будет сохранён этот файл.
\ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Command.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Command.ascx index 4eb4028d8..62e1cbee1 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Command.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Command.ascx @@ -9,8 +9,6 @@

Командный сервис

Для взаимодействия с командным сервисом документов используются POST запросы. Параметры запроса указываются в теле запроса в формате JSON. Запросы отправляются к https://documentserver/coauthoring/CommandService.ashx, где documentserver - имя сервера, на котором установлен Сервер документов.

-
В Сервере документов версии ниже 4.2 использовались GET запросы с параметрами в QueryString.
-

Параметры и их описание:

diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Document/Permissions.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Document/Permissions.ascx index b76541d6b..afc8c4bdd 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Document/Permissions.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Document/Permissions.ascx @@ -1,6 +1,4 @@ -<%@ Control Language="C#" Inherits="BaseContentUserControls" %> -<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %> -
-

Document Permissions

+

Разрешения документа

-
Description
-

The document permission section allows to change the permission for the document to be edited and downloaded or not.

+
Описание
+

Раздел разрешений документа позволяет изменять права на его редактирование и скачивание.

-
Parameters
+
Параметры
@@ -23,80 +21,66 @@ - - - - + + + + - - + +
NameDescriptionTypeExampleИмяОписаниеТипПример
Defines if the document can be commented or not. In case the commenting permission is set to "true" the document side bar will contain the Comment menu option; the document commenting will only be available for the document editor if the ">mode parameter is set to edit. The default value coincides with the value of the edit parameter.booleanОпределяет, можно ли оставлять комментарии к документу. В случае, если вышеописанный параметр установлен в значение "true", боковая панель в редакторе документов будет иметь пункт меню Комментирование; комментирование документа будет доступно в редакторе документов только если параметр ">mode установлен в значение edit. Значение по умолчанию совпадает со значением параметра edit.логический true
-
- In case edit is set to "true" and comment is also set to "true", the user will be able to edit the document and comment. - In case edit is set to "true" and comment is set to "false", the user will be able to edit only, the corresponding commenting functionality will be available for viewing only, the adding and editing of comments will be unavailable. - In case edit is set to "false" and comment is set to "true", the document will be available for commenting only. - In case edit is set to "false" and review is set to "false" and comments is set to "true" the fillForms value is not considered and filling the forms is not available. -
+
В случае, если параметр edit установлен в значение "true" и параметр comment также установлен в значение "true", пользователь сможет редактировать и комментировать документ. В случае, если параметр edit установлен в значение "true", а параметр comment установлен в значение "false", пользователь сможет лишь редактировать документ, добавление или редактирование комментариев будет невозможным. В случае, если параметр edit установлен в значение "false", а параметр comment установлен в значение "true", документ будет доступен только для комментирования. В случае, если параметр edit установлен в значение "false" и параметр review также имеет значение "false", а параметр comments установлен в значение "true", значение параметра fillForms не принимается во внимание и заполнение форм невозможно.
- - - + + + - - + + - - + + - - + +
Defines if the document can be downloaded or only viewed or edited online. In case the downloading permission is set to "false" the Download as... menu option will be absent from the File menu. The default value is true.booleanОпределяет, может ли документ быть скачан, или лишь может быть просмотрен и отредактирован онлайн. В случае если параметр разрешения на скачивание установлен в значение "false", пункт меню Скачать как... не будет отображён в меню Файл. Значением по умолчанию является true.логический true
Defines if the document can be edited or only viewed. In case the editing permission is set to "true" the File menu will contain the Edit Document menu option; please note that if the editing permission is set to "false" the document will be opened in viewer and you will not be able to switch it to the editor even if the ">mode parameter is set to edit. The default value is true.booleanОпределяет, может ли документ быть отредактирован или лишь просмотрен. В случае если параметр разрешения на редактирование установлен в значение "true", меню Файл будет содержать пункт Редактировать документ; учтите, пожалуйста, что, если параметр разрешения на редактирование установлен в значение "false", документ будет открыт в режиме просмотра, и вы не сможете переключиться в режим редактирования, даже если параметр ">mode установлен в значение edit. Значением по умолчанию является true.логический true
Defines if the document can be printed or not. In case the printing permission is set to "false" the Print menu option will be absent from the File menu. The default value is true.booleanОпределяет, можно ли распечатать документ. В случае если параметр разрешения на печать установлен в значение "false", пункт меню Распечатать не будет отображён в меню Файл. Значением по умолчанию является true.логический true
Defines if the forms can be filled. Filling in forms will only be available for the document editor if the ">mode parameter is set to edit. The default value coincides with the value of the edit or the review parameter.booleanОпределяет, могут ли формы быть заполнены. Заполнение форм будет доступно в редакторе документов только если параметр ">mode установлен в значение edit. Значение по умолчанию совпадает со значением параметра edit или параметра review.логический true
-
- In case edit is set to "true" or review is set to "true", the fillForms value is not considered and the form filling is possible. - In case edit is set to "false" and review is set to "false" and fillForms is also set to "true", the user can only fill forms in the document. - In case edit is set to "false" and review is set to "false" and fillForms is set to "true" the comments value is not considered and the commenting is not available. - The form filling only mode is currently available for Document Editor only. -
+
В случае, если параметр edit установлен в значение "true" или параметр review установлен в значение "true", значение параметра fillForms не принимается во внимание, и заполнение форм возможно. В случае, если параметр edit установлен в значение "false" и параметр review также имеет значение "false", а значение параметра fillForms равно "true", пользователь может заполнять лишь формы в документе. В случае, если параметр edit установлен в значение "false" и параметр review также имеет значение "false", а параметр fillForms установлен в значение "true", значение параметра comments не принимается во внимание и комментирование недоступно. На данный момент режим "Только заполнение форм" доступен лишь для Редактора Документов.
- - + +
Defines if the document can be reviewed or not. In case the reviewing permission is set to "true" the document status bar will contain the Review menu option; the document review will only be available for the document editor if the ">mode parameter is set to edit. The default value coincides with the value of the edit parameter.booleanОпределяет, можно ли рецензировать документ. В случае, если параметр разрешения на рецензирование установлен в значение "true", строка состояния документа будет иметь пункт меню Рецензирование; рецензирование документа будет доступно лишь в случае, если параметр ">mode установлен в значение edit. Значение по умолчанию совпадает со значением параметра edit.логический true
-
- In case edit is set to "true" and review is also set to "true", the user will be able to edit the document, accept/reject the changes made and switch to the review mode him-/herself. - In case edit is set to "true" and review is set to "false", the user will be able to edit only. - In case edit is set to "false" and review is set to "true", the document will be available in review mode only. -
+
В случае, если параметр edit установлен в значение "true" и параметр review также установлен в значение "true", пользователь сможет редактировать документ, принимать или отклонять выполненные в документе изменения и переключаться в режим рецензирования. В случае, если параметр edit установлен в значение "true", а параметр review установлен в значение "false", пользователь сможет лишь редактировать документ. В случае, если параметр edit установлен в значение "false", а параметр review установлен в значение "true", документ будет доступен только в режиме рецензирования.
-
Example
+
Пример
 var docEditor = new DocsAPI.DocEditor("placeholder", {
     "document": {
diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor.ascx
index 5cb30216f..4c1e624f9 100644
--- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor.ascx
+++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor.ascx
@@ -1,6 +1,4 @@
-<%@ Control Language="C#" Inherits="BaseContentUserControls" %>
-<%@ Register Namespace="TeamLab.Controls" Assembly="__Code" TagPrefix="cc" %>
-
 
-

Editor config

+

Конфигурация редактора

-
Description
-

The editorConfig section allows to change the parameters pertaining to the editor interface: opening mode (viewer or editor), interface language, additional buttons, etc.).

+
Описание
+

Раздел конфигурации редактора позволяет изменять параметры, относящиеся к интерфейсу редактора: режим открытия (просмотр или редактирование), язык интерфейса, дополнительные кнопки, и т.д.

-
Parameters
+
Параметры
@@ -23,125 +21,77 @@ - - - - + + + + - - + + - - + + - - - + + + - - + + - - + - - + -
NameDescriptionTypeExampleИмяОписаниеТипПример
Specifies absolute URL to the document storage service (which ">must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server).stringОпределяет абсолютную ссылку на сервис хранения документов (который ">должнен быть разработан интеграторами, которые используют Сервер документов на своём собственном сервере).строка "https://example.com/url-to-callback.ashx"
Defines the absolute URL of the document where it will be created and available after creation. If not specified, there will be no creation button. - stringОпределяет абсолютную ссылку расположения, по которому документ будет доступен после создания. Если не указано, то кнопка создания не будет отображена.строка "https://example.com/url-to-create-document/"
Defines the editor interface language (if some other languages other than English are present). Is set using the two letter (de, ru, it, etc.) or four letter (en-US, fr-FR, etc.) language codes. The default value is "en-US".string"en-US"Определяет язык интерфейса редактора (если доступны какие-либо другие языки, кроме русского), Устанавливается при помощи двух букв (de, ru, it, и т.д.) или четырёхсимвольных языкрвых кодов (en-US, fr-FR, и т.д.). Значением по умолчанию является "ru-RU".строка"ru-RU"
Defines the editor opening mode. Can be either view to open the document for viewing, or edit to open the document in the editing mode allowing to apply changes to the document data. The default value is "edit".stringОпределяет режим открытия редактора документов. Может быть равным view, для открытия документа для просмотра, или edit - для открытия на редактирование. Значением по умолчанию является "edit".строка "edit"
Defines the presence or absence of the documents in the Open Recent... menu option where the following document parameters can be set: -
    -
  • - folder - the folder where the document is stored (can be empty in case the document is stored in the root folder), -
    - type: string, -
    - example: "Example Files"; -
  • -
  • - title - the document title that will be displayed in the Open Recent... menu option, -
    - type: string, -
    - example: "exampledocument1.docx"; -
  • -
  • - url - the absolute URL to the document where it is stored, -
    - type: string, -
    - example: "https://example.com/exampledocument1.docx". -
  • +
Определяет наличие или отсутствие документов в пункте меню Открыть последние..., значение которого может быть задано следующим образом:
    +
  • folder - папка, в которой хранится документ (может быть пустым, в случае, если документ хранится в корневой директории),
    тип: строка,
    пример: "Примеры файлов";
  • +
  • Title - зголовок документа, который будет отображён в пункте меню Открыть последние...,
    тип: строка,
    пример: "exampledocument1.docx";
  • +
  • url - абсолютная ссылка на место расположения файла документа,
    тип: строка,
    пример: "https://example.com/exampledocument1.docx".
array of objectмассив объектов
Defines the user currently viewing or editing the document: -
    -
  • - firstname - the first name of the user. Deprecated since version 4.2, please use name instead, -
    - type: string, -
    - example: "John"; -
  • -
  • - id - the identification of the user, -
    - type: string, -
    - example: "78e1e841"; -
  • -
  • - lastname - the last name of the user. Deprecated since version 4.2, please use name instead, -
    - type: string, -
    - example: "Smith"; -
  • -
  • - name - the full name of the user. Used since version 4.2, -
    - type: string, -
    - example: "John Smith". -
  • +
Определяет пользователя, который в данный момент просматривает или редактирует документ:
    +
  • firstname - имя пользователя. Удалено, начиная с версии 4.2, пожалуйста, используйте параметр name,
    тип: строка,
    пример: "Иван";
  • +
  • Id - идентификатор пользователя,
    тип: строка,
    пример: "78e1e841";
  • +
  • lastname - фамилия пользователя. Удалено, начиная с версии 4.2, пожалуйста, используйте параметр name,
    тип: строка,
    пример: "Smith";
  • +
  • name - полное имя пользователя. Используется, начиная с версии 4.2,
    тип: строка,
    пример: "John Smith".
objectобъект
- -* - required field -
Example
+* - обязательное поле
Пример
 var docEditor = new DocsAPI.DocEditor("placeholder", {
     "editorConfig": {
         "callbackUrl": "https://example.com/url-to-callback.ashx",
         "createUrl": "https://example.com/url-to-create-document/",
-        "lang": "en-US",
+        "lang": "ru-RU",
         "mode": "edit",
         "recent": [
             {
-                "folder": "Example Files",
+                "folder": "Примеры файлов",
                 "title": "exampledocument1.docx",
                 "url": "https://example.com/exampledocument1.docx"
             },
             {
-                "folder": "Example Files",
+                "folder": "Примеры файлов",
                 "title": "exampledocument2.docx",
                 "url": "https://example.com/exampledocument2.docx"
             },
@@ -149,12 +99,12 @@ var docEditor = new DocsAPI.DocEditor("placeholder", {
         ],
         "user": {
             "id": "78e1e841",
-            "name": "John Smith"
+            "name": "Иван Петров"
         }
     },
     ...
 });
 
-

Where the example.com is the name of the the server where document manager and document storage service are installed. See the ">How it works section to find out more on Document Server service client-server interactions.

+

Где example.com - имя сервера, на котором установлены менеджер документов и сервис хранения документов. Смотрите раздел ">Как это работает, чтобы узнать больше о клиент-серверных взаимодействиях Сервера документов.

\ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Customization.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Customization.ascx index fa61b8a37..ed35d262c 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Customization.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Customization.ascx @@ -169,6 +169,4 @@ var docEditor = new DocsAPI.DocEditor("placeholder", { });

Где example.com - имя сервера, на котором установлены менеджер документов и сервис хранения документов. Смотрите раздел ">Как это работает, чтобы узнать больше о клиент-серверных взаимодействиях Сервера документов.

- -

Если у вас есть дополнительные вопросы, пожалуйста, свяжитесь с нами по адресу integration@onlyoffice.com.

\ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Plugins.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Plugins.ascx index 89b2c6fc7..eed5c9b49 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Plugins.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/Config/Editor/Plugins.ascx @@ -72,6 +72,4 @@ var docEditor = new DocsAPI.DocEditor("placeholder", {

Где example.com - имя сервера, на котором расположены плагины, а также установлены менеджер документов и сервис хранения документов. Смотрите раздел ">Как это работает, чтобы узнать больше о клиент-серверных взаимодействиях Сервера документов.

-

Если у вас есть дополнительные вопросы, пожалуйста, свяжитесь с нами по адресу integration@onlyoffice.com.

- \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/ConversionApi.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/ConversionApi.ascx index f072251dd..a158b3d93 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/ConversionApi.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/APIEditors/ConversionApi.ascx @@ -9,8 +9,6 @@

API конвертации

Для взаимодействия с сервисом конвертации документов используются POST запросы. Параметры запроса указываются в теле запроса в формате JSON. Запросы отправляются по адресу https://documentserver/ConvertService.ashx, где documentserver - имя сервера, на котором установлен Сервер документов.

-
В Сервере документов версии ниже 4.2 использовались GET запросы с параметрами в QueryString.
-

Параметры и их описание:

diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4100_mobile_documents_main/4100_mobile_documents_main.ru.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4100_mobile_documents_main/4100_mobile_documents_main.ru.ascx index dda67c9a5..7edcf98be 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4100_mobile_documents_main/4100_mobile_documents_main.ru.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4100_mobile_documents_main/4100_mobile_documents_main.ru.ascx @@ -1,3 +1,3 @@ <%@ Control Language="C#" %> ">ONLYOFFICE Документы \ No newline at end of file + href="<%=VirtualPathUtility.ToAbsolute("~/Mobile-Applications/Documents/index.aspx")%>">Р7-Офис. Документы \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4107_mobile_documents_overview/4107_mobile_documents_overview.ru.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4107_mobile_documents_overview/4107_mobile_documents_overview.ru.ascx index 0a944eb5d..399e6a200 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4107_mobile_documents_overview/4107_mobile_documents_overview.ru.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4107_mobile_documents_overview/4107_mobile_documents_overview.ru.ascx @@ -1,3 +1,3 @@ <%@ Control Language="C#" %> ">ONLYOFFICE Документы для iOS - Обзор \ No newline at end of file + href="<%=VirtualPathUtility.ToAbsolute("~/Mobile-Applications/Documents/overview.aspx")%>">Р7-Офис. Документы для iOS - Обзор \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4300_mobile_android_overview/4300_mobile_android_overview.ru.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4300_mobile_android_overview/4300_mobile_android_overview.ru.ascx index f3dc37fef..8371e37bf 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4300_mobile_android_overview/4300_mobile_android_overview.ru.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4300_mobile_android_overview/4300_mobile_android_overview.ru.ascx @@ -1,3 +1,3 @@ <%@ Control Language="C#" %> ">ONLYOFFICE Документы для Android - Обзор \ No newline at end of file + href="<%=VirtualPathUtility.ToAbsolute("~/mobile-applications/Documents/android/overview.aspx")%>">Р7-Офис. Документы для Android - Обзор \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4528_mobile_android_available_languages/4528_mobile_android_available_languages.ru.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4528_mobile_android_available_languages/4528_mobile_android_available_languages.ru.ascx index c8405e370..2a1f28373 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4528_mobile_android_available_languages/4528_mobile_android_available_languages.ru.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/ArticlesCompleteList/MobileApps/4528_mobile_android_available_languages/4528_mobile_android_available_languages.ru.ascx @@ -1,3 +1,3 @@ <%@ Control Language="C#" %> ">Языки, доступные для интерфейса приложения ONLYOFFICE Документы для Android \ No newline at end of file + href="<%=VirtualPathUtility.ToAbsolute("~/mobile-applications/documents/android/available-languages.aspx")%>">Языки, доступные для интерфейса приложения Р7-Офис. Документы для Android \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/GettingStarted/Configuration/Configuration.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/GettingStarted/Configuration/Configuration.ascx index 9ab916f98..983b94518 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/GettingStarted/Configuration/Configuration.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/GettingStarted/Configuration/Configuration.ascx @@ -252,7 +252,7 @@

Чтобы включить и настроить SSO-аутентификацию на портале, необходимо интегрировать его с поставщиком учетных записей, а именно:

    -
  1. Укажите данные портала в аккаунте поставщика учетных записей. Эта процедура различается в зависимости от выбранного поставщика учетных записей. Например, для сервиса OneLogin надо открыть вкладку 'Configuration' и ввести https://@@@/samllogin.ashx/ в поле 'SAML Consumer URL', где @@@ - это DNS-имя портала (например, https://test.onlyoffice.com/samllogin.ashx/). Сохраните настройки. Для получения более подробных сведений о настройке поставщика учетных записей обратитесь к нашему разделу ">Советы и приемы.
  2. +
  3. Укажите данные портала в аккаунте поставщика учетных записей. Эта процедура различается в зависимости от выбранного поставщика учетных записей. Например, для сервиса OneLogin надо открыть вкладку 'Configuration' и ввести https://@@@/samllogin.ashx/ в поле 'SAML Consumer URL', где @@@ - это DNS-имя портала (например, https://test.r7-office.ru/samllogin.ashx/). Сохраните настройки. Для получения более подробных сведений о настройке поставщика учетных записей обратитесь к нашему разделу ">Советы и приемы.
  4. Укажите данные поставщика учетных записей на странице настроек портала. Для этого установите флажок Включить SSO, выберите подходящий Тип SSO (SAML или JWT) и заполните необходимые поля. Сведения, которые необходимо указать в полях URL-адрес поставщика, URL-адрес конечной точки SSO, URL-адрес конечной точки SLO, Тип проверки подписи и Ключ, можно найти в аккаунте поставщика учетных записей. Когда все параметры будут заданы, нажмите на кнопку Сохранить.
@@ -342,7 +342,7 @@

Можно установить флажок Мгновенная регистрация новых пользователей, чтобы новые пользователи смогли регистрироваться без подтверждения со стороны администратора. В противном случае они могут отправить запрос администратору портала с помощью контактной формы на странице Входа.

-

После того как вы сделаете портал публичным, возможности изменить статус портала на приватный в Настройках портала не будет, но вы можете отправить запрос в нашу службу поддержки.

--%> +

После того как вы сделаете портал публичным, возможности изменить статус портала на приватный в Настройках портала не будет, но вы можете отправить запрос в нашу службу поддержки.

--%>
diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/AndroidAvailableLanguages/AndroidAvailableLanguages.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/AndroidAvailableLanguages/AndroidAvailableLanguages.ascx index 1be552792..2ff460caa 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/AndroidAvailableLanguages/AndroidAvailableLanguages.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/AndroidAvailableLanguages/AndroidAvailableLanguages.ascx @@ -4,16 +4,16 @@
-

Языки, доступные для интерфейса приложения ONLYOFFICE Документы для Android

+

Языки, доступные для интерфейса приложения Р7-Офис. Документы для Android

-

Интерфейс приложения ONLYOFFICE Документы для Android доступен на языках. Список меняется, так как новые переводчики хотят использовать приложение Документы для Android на своем языке и помогают нам, принимая участие в переводе. Ниже приводится таблица всех языков, доступных в настоящее время для приложения Документы для Android:

+

Интерфейс приложения Р7-Офис. Документы для Android доступен на языках. Список меняется, так как новые переводчики хотят использовать приложение Документы для Android на своем языке и помогают нам, принимая участие в переводе. Ниже приводится таблица всех языков, доступных в настоящее время для приложения Документы для Android:

@@ -27,11 +27,11 @@

Обновлено:

Пояснения

-

1 Степень завершенности, выраженная в процентах, отражает выполнение перевода на один из доступных языков. 100% означает, что в приложении ONLYOFFICE Документы уже все переведено. 50% означает, что половина интерфейса приложения Документы по-прежнему остается на английском языке. Значения степени завершенности округлены в большую сторону.

+

1 Степень завершенности, выраженная в процентах, отражает выполнение перевода на один из доступных языков. 100% означает, что в приложении Р7-Офис. Документы уже все переведено. 50% означает, что половина интерфейса приложения Документы по-прежнему остается на английском языке. Значения степени завершенности округлены в большую сторону.

Если вы хотите принять участие в переводе

-

Если вы переводчик или просто хотите использовать приложение ONLYOFFICE Документы на своем языке, вы тоже можете принять участие в переводе. Обратитесь к ">этой инструкции, объясняющей, как стать переводчиком ONLYOFFICE, или напишите нам по адресу documentation@onlyoffice.com.

+

Если вы переводчик или просто хотите использовать приложение Р7-Офис. Документы на своем языке, вы тоже можете принять участие в переводе. Обратитесь к ">этой инструкции, объясняющей, как стать переводчиком Р7-Офис, или напишите нам по адресу documentation@onlyoffice.com.

Я закончил перевод, что дальше?

-

Когда переводы будут готовы, сообщите нам об этом по адресу электронной почты documentation@onlyoffice.com. Мы проверим переводы и добавим их в следующий выпуск, так что ваш язык будет доступен как новый язык интерфейса приложения ONLYOFFICE Документы.

-

Если вас интересует более подробная информация и статистика по языкам и переводам для других продуктов ONLYOFFICE, она доступна на ">этой странице.

+

Когда переводы будут готовы, сообщите нам об этом по адресу электронной почты documentation@onlyoffice.com. Мы проверим переводы и добавим их в следующий выпуск, так что ваш язык будет доступен как новый язык интерфейса приложения Р7-Офис. Документы.

+

Если вас интересует более подробная информация и статистика по языкам и переводам для других продуктов Р7-Офис, она доступна на ">этой странице.

\ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/MobileDocumentsAndroid.ascx b/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/MobileDocumentsAndroid.ascx index 3ba041c84..f23b41972 100644 --- a/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/MobileDocumentsAndroid.ascx +++ b/helpcenter.r7-office.ru/Web/Controls/Help/MobileApps/MobileDocuments/MobileDocumentsAndroid/MobileDocumentsAndroid.ascx @@ -4,7 +4,7 @@ - - - \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/parse.php b/helpcenter.r7-office.ru/Web/parse.php deleted file mode 100644 index c9f4a9679..000000000 --- a/helpcenter.r7-office.ru/Web/parse.php +++ /dev/null @@ -1,117 +0,0 @@ -Editor: ' . $editorsPrint . ', language: ' . $languagePrint . '

'; - echo '

Try if it works correctly: ' . $localwebURL . 'OfficeWeb/apps/' . $varEditors. '/main/resources/help/' . $languageLocale. '/search/search.html?query=document

'; - echo '

Go to indexes.js file

'; - echo '

___________________________________________

'; - - foreach($pages as $url) { - $page_link_for_array = ''; - $title_for_array = ''; - $body_for_array = ''; - $html = ''; - - $page_link = $url; - - $page_link = str_replace('OfficeWeb/apps/' . $varEditors. '/main/resources/help/' . $languageLocale. '/',"",$page_link); - $page_link_for_array = '"id": "' . $page_link . '", '; - - $html = file_get_html($url); - - $titleTag = $html->find('title'); - foreach($titleTag as $titleValue) { - $title = $titleValue->plaintext; - $title = str_replace("\\","\\\\",$title); - $title = str_replace('"','\"',$title); - $title_for_array = '"title": "' . $title . '", '; - } - $bodyTag = $html->find('body'); - foreach($bodyTag as $bodyValue) { - $body = $bodyValue->plaintext; - $bodyTrimmed = trim($body); - $bodyTrimmed = str_replace("\t"," ",$bodyTrimmed); - $bodyTrimmed = str_replace("\n"," ",$bodyTrimmed); - $bodyTrimmed = str_replace("\r"," ",$bodyTrimmed); - $bodyTrimmed = preg_replace('/\s\s+/', ' ', $bodyTrimmed); - $bodyTrimmed = str_replace("\\","\\\\",$bodyTrimmed); - $bodyTrimmed = str_replace('"','\"',$bodyTrimmed); - - if (substr($bodyTrimmed, 0, strlen($title)) == $title) { - $bodyTrimmed = substr($bodyTrimmed, strlen($title)); - } - $bodyTrimmed = trim($bodyTrimmed); - - $body_for_array = '"body": "' . $bodyTrimmed . '"'; - } - - $json .= PHP_EOL . ' {' . PHP_EOL . ' ' . $page_link_for_array . PHP_EOL . ' ' . $title_for_array . PHP_EOL . ' ' . $body_for_array . PHP_EOL . ' },'; - - echo '

' . $page_link . ' — done!

'; - $totalPages += 1; - } - $file_start = 'var indexes = ' . PHP_EOL . '['; - $file_end = PHP_EOL . ']'; - $json = rtrim($json,","); - file_put_contents('OfficeWeb/apps/' . $varEditors. '/main/resources/help/' . $languageLocale. '/search/indexes.js', $file_start . $json . $file_end); - echo '

___________________________________________

Total pages: ' . $totalPages . '

'; - echo '

===========================================

indexes.js (file path: \\\\SITESERVER2\Sites\helpcenter.teamlab.com\helpcenter.r7-office.ru\Web\OfficeWeb\apps\\' . $varEditors. '\main\resources\help\\' . $languageLocale. '\search\indexes.js):

'; - echo '
' . file_get_contents('OfficeWeb/apps/' . $varEditors. '/main/resources/help/' . $languageLocale. '/search/indexes.js') . '
'; - } - } -?> - - - Build indexes.js for documentation search - - - -

Build indexes.js for documentation search

- Select the editor and its language from the list and click the Start! button.

The indexes.js file will be formed based on all the pages present in the selected editor/language folder.

The file will be placed to the editor folder and used for the documentation on-page search.

'; - ?> - - - - - \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/shared/backToLink.php b/helpcenter.r7-office.ru/Web/shared/backToLink.php deleted file mode 100644 index c93ed18ac..000000000 --- a/helpcenter.r7-office.ru/Web/shared/backToLink.php +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/shared/form.php b/helpcenter.r7-office.ru/Web/shared/form.php deleted file mode 100644 index 0da06aa1a..000000000 --- a/helpcenter.r7-office.ru/Web/shared/form.php +++ /dev/null @@ -1,13 +0,0 @@ -
-
- - - -
-
\ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/shared/headLinks.php b/helpcenter.r7-office.ru/Web/shared/headLinks.php deleted file mode 100644 index 05f70c37a..000000000 --- a/helpcenter.r7-office.ru/Web/shared/headLinks.php +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/helpcenter.r7-office.ru/Web/shared/simple_html_dom.php b/helpcenter.r7-office.ru/Web/shared/simple_html_dom.php deleted file mode 100644 index 19936adc5..000000000 --- a/helpcenter.r7-office.ru/Web/shared/simple_html_dom.php +++ /dev/null @@ -1,1721 +0,0 @@ -size is the "real" number of bytes the dom was created from. - * but for most purposes, it's a really good estimation. - * Paperg - Added the forceTagsClosed to the dom constructor. Forcing tags closed is great for malformed html, but it CAN lead to parsing errors. - * Allow the user to tell us how much they trust the html. - * Paperg add the text and plaintext to the selectors for the find syntax. plaintext implies text in the innertext of a node. text implies that the tag is a text node. - * This allows for us to find tags based on the text they contain. - * Create find_ancestor_tag to see if a tag is - at any level - inside of another specific tag. - * Paperg: added parse_charset so that we know about the character set of the source document. - * NOTE: If the user's system has a routine called get_last_retrieve_url_contents_content_type availalbe, we will assume it's returning the content-type header from the - * last transfer or curl_exec, and we will parse that and use it in preference to any other method of charset detection. - * - * Found infinite loop in the case of broken html in restore_noise. Rewrote to protect from that. - * PaperG (John Schlick) Added get_display_size for "IMG" tags. - * - * Licensed under The MIT License - * Redistributions of files must retain the above copyright notice. - * - * @author S.C. Chen - * @author John Schlick - * @author Rus Carroll - * @version 1.5 ($Rev: 196 $) - * @package PlaceLocalInclude - * @subpackage simple_html_dom - */ - -/** - * All of the Defines for the classes below. - * @author S.C. Chen - */ -define('HDOM_TYPE_ELEMENT', 1); -define('HDOM_TYPE_COMMENT', 2); -define('HDOM_TYPE_TEXT', 3); -define('HDOM_TYPE_ENDTAG', 4); -define('HDOM_TYPE_ROOT', 5); -define('HDOM_TYPE_UNKNOWN', 6); -define('HDOM_QUOTE_DOUBLE', 0); -define('HDOM_QUOTE_SINGLE', 1); -define('HDOM_QUOTE_NO', 3); -define('HDOM_INFO_BEGIN', 0); -define('HDOM_INFO_END', 1); -define('HDOM_INFO_QUOTE', 2); -define('HDOM_INFO_SPACE', 3); -define('HDOM_INFO_TEXT', 4); -define('HDOM_INFO_INNER', 5); -define('HDOM_INFO_OUTER', 6); -define('HDOM_INFO_ENDSPACE',7); -define('DEFAULT_TARGET_CHARSET', 'UTF-8'); -define('DEFAULT_BR_TEXT', "\r\n"); -define('DEFAULT_SPAN_TEXT', " "); -define('MAX_FILE_SIZE', 600000); -// helper functions -// ----------------------------------------------------------------------------- -// get html dom from file -// $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. -function file_get_html($url, $use_include_path = false, $context=null, $offset = 0, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) -{ - // We DO force the tags to be terminated. - $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); - // For sourceforge users: uncomment the next line and comment the retreive_url_contents line 2 lines down if it is not already done. - $contents = file_get_contents($url, $use_include_path, $context, $offset); - // Paperg - use our own mechanism for getting the contents as we want to control the timeout. - //$contents = retrieve_url_contents($url); - if (empty($contents) || strlen($contents) > MAX_FILE_SIZE) - { - return false; - } - // The second parameter can force the selectors to all be lowercase. - $dom->load($contents, $lowercase, $stripRN); - return $dom; -} - -// get html dom from string -function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) -{ - $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); - if (empty($str) || strlen($str) > MAX_FILE_SIZE) - { - $dom->clear(); - return false; - } - $dom->load($str, $lowercase, $stripRN); - return $dom; -} - -// dump html dom tree -function dump_html_tree($node, $show_attr=true, $deep=0) -{ - $node->dump($node); -} - - -/** - * simple html dom node - * PaperG - added ability for "find" routine to lowercase the value of the selector. - * PaperG - added $tag_start to track the start position of the tag in the total byte index - * - * @package PlaceLocalInclude - */ -class simple_html_dom_node -{ - public $nodetype = HDOM_TYPE_TEXT; - public $tag = 'text'; - public $attr = array(); - public $children = array(); - public $nodes = array(); - public $parent = null; - // The "info" array - see HDOM_INFO_... for what each element contains. - public $_ = array(); - public $tag_start = 0; - private $dom = null; - - function __construct($dom) - { - $this->dom = $dom; - $dom->nodes[] = $this; - } - - function __destruct() - { - $this->clear(); - } - - function __toString() - { - return $this->outertext(); - } - - // clean up memory due to php5 circular references memory leak... - function clear() - { - $this->dom = null; - $this->nodes = null; - $this->parent = null; - $this->children = null; - } - - // dump node's tree - function dump($show_attr=true, $deep=0) - { - $lead = str_repeat(' ', $deep); - - echo $lead.$this->tag; - if ($show_attr && count($this->attr)>0) - { - echo '('; - foreach ($this->attr as $k=>$v) - echo "[$k]=>\"".$this->$k.'", '; - echo ')'; - } - echo "\n"; - - if ($this->nodes) - { - foreach ($this->nodes as $c) - { - $c->dump($show_attr, $deep+1); - } - } - } - - - // Debugging function to dump a single dom node with a bunch of information about it. - function dump_node($echo=true) - { - - $string = $this->tag; - if (count($this->attr)>0) - { - $string .= '('; - foreach ($this->attr as $k=>$v) - { - $string .= "[$k]=>\"".$this->$k.'", '; - } - $string .= ')'; - } - if (count($this->_)>0) - { - $string .= ' $_ ('; - foreach ($this->_ as $k=>$v) - { - if (is_array($v)) - { - $string .= "[$k]=>("; - foreach ($v as $k2=>$v2) - { - $string .= "[$k2]=>\"".$v2.'", '; - } - $string .= ")"; - } else { - $string .= "[$k]=>\"".$v.'", '; - } - } - $string .= ")"; - } - - if (isset($this->text)) - { - $string .= " text: (" . $this->text . ")"; - } - - $string .= " HDOM_INNER_INFO: '"; - if (isset($node->_[HDOM_INFO_INNER])) - { - $string .= $node->_[HDOM_INFO_INNER] . "'"; - } - else - { - $string .= ' NULL '; - } - - $string .= " children: " . count($this->children); - $string .= " nodes: " . count($this->nodes); - $string .= " tag_start: " . $this->tag_start; - $string .= "\n"; - - if ($echo) - { - echo $string; - return; - } - else - { - return $string; - } - } - - // returns the parent of node - // If a node is passed in, it will reset the parent of the current node to that one. - function parent($parent=null) - { - // I am SURE that this doesn't work properly. - // It fails to unset the current node from it's current parents nodes or children list first. - if ($parent !== null) - { - $this->parent = $parent; - $this->parent->nodes[] = $this; - $this->parent->children[] = $this; - } - - return $this->parent; - } - - // verify that node has children - function has_child() - { - return !empty($this->children); - } - - // returns children of node - function children($idx=-1) - { - if ($idx===-1) - { - return $this->children; - } - if (isset($this->children[$idx])) return $this->children[$idx]; - return null; - } - - // returns the first child of node - function first_child() - { - if (count($this->children)>0) - { - return $this->children[0]; - } - return null; - } - - // returns the last child of node - function last_child() - { - if (($count=count($this->children))>0) - { - return $this->children[$count-1]; - } - return null; - } - - // returns the next sibling of node - function next_sibling() - { - if ($this->parent===null) - { - return null; - } - - $idx = 0; - $count = count($this->parent->children); - while ($idx<$count && $this!==$this->parent->children[$idx]) - { - ++$idx; - } - if (++$idx>=$count) - { - return null; - } - return $this->parent->children[$idx]; - } - - // returns the previous sibling of node - function prev_sibling() - { - if ($this->parent===null) return null; - $idx = 0; - $count = count($this->parent->children); - while ($idx<$count && $this!==$this->parent->children[$idx]) - ++$idx; - if (--$idx<0) return null; - return $this->parent->children[$idx]; - } - - // function to locate a specific ancestor tag in the path to the root. - function find_ancestor_tag($tag) - { - global $debugObject; - if (is_object($debugObject)) { $debugObject->debugLogEntry(1); } - - // Start by including ourselves in the comparison. - $returnDom = $this; - - while (!is_null($returnDom)) - { - if (is_object($debugObject)) { $debugObject->debugLog(2, "Current tag is: " . $returnDom->tag); } - - if ($returnDom->tag == $tag) - { - break; - } - $returnDom = $returnDom->parent; - } - return $returnDom; - } - - // get dom node's inner html - function innertext() - { - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - $ret = ''; - foreach ($this->nodes as $n) - $ret .= $n->outertext(); - return $ret; - } - - // get dom node's outer text (with tag) - function outertext() - { - global $debugObject; - if (is_object($debugObject)) - { - $text = ''; - if ($this->tag == 'text') - { - if (!empty($this->text)) - { - $text = " with text: " . $this->text; - } - } - $debugObject->debugLog(1, 'Innertext of tag: ' . $this->tag . $text); - } - - if ($this->tag==='root') return $this->innertext(); - - // trigger callback - if ($this->dom && $this->dom->callback!==null) - { - call_user_func_array($this->dom->callback, array($this)); - } - - if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER]; - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - // render begin tag - if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) - { - $ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup(); - } else { - $ret = ""; - } - - // render inner text - if (isset($this->_[HDOM_INFO_INNER])) - { - // If it's a br tag... don't return the HDOM_INNER_INFO that we may or may not have added. - if ($this->tag != "br") - { - $ret .= $this->_[HDOM_INFO_INNER]; - } - } else { - if ($this->nodes) - { - foreach ($this->nodes as $n) - { - $ret .= $this->convert_text($n->outertext()); - } - } - } - - // render end tag - if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) - $ret .= 'tag.'>'; - return $ret; - } - - // get dom node's plain text - function text() - { - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; - switch ($this->nodetype) - { - case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - case HDOM_TYPE_COMMENT: return ''; - case HDOM_TYPE_UNKNOWN: return ''; - } - if (strcasecmp($this->tag, 'script')===0) return ''; - if (strcasecmp($this->tag, 'style')===0) return ''; - - $ret = ''; - // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL. - // NOTE: This indicates that there is a problem where it's set to NULL without a clear happening. - // WHY is this happening? - if (!is_null($this->nodes)) - { - foreach ($this->nodes as $n) - { - $ret .= $this->convert_text($n->text()); - } - - // If this node is a span... add a space at the end of it so multiple spans don't run into each other. This is plaintext after all. - if ($this->tag == "span") - { - $ret .= $this->dom->default_span_text; - } - - - } - return $ret; - } - - function xmltext() - { - $ret = $this->innertext(); - $ret = str_ireplace('', '', $ret); - return $ret; - } - - // build node's text with tag - function makeup() - { - // text, comment, unknown - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); - - $ret = '<'.$this->tag; - $i = -1; - - foreach ($this->attr as $key=>$val) - { - ++$i; - - // skip removed attribute - if ($val===null || $val===false) - continue; - - $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; - //no value attr: nowrap, checked selected... - if ($val===true) - $ret .= $key; - else { - switch ($this->_[HDOM_INFO_QUOTE][$i]) - { - case HDOM_QUOTE_DOUBLE: $quote = '"'; break; - case HDOM_QUOTE_SINGLE: $quote = '\''; break; - default: $quote = ''; - } - $ret .= $key.$this->_[HDOM_INFO_SPACE][$i][1].'='.$this->_[HDOM_INFO_SPACE][$i][2].$quote.$val.$quote; - } - } - $ret = $this->dom->restore_noise($ret); - return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; - } - - // find elements by css selector - //PaperG - added ability for find to lowercase the value of the selector. - function find($selector, $idx=null, $lowercase=false) - { - $selectors = $this->parse_selector($selector); - if (($count=count($selectors))===0) return array(); - $found_keys = array(); - - // find each selector - for ($c=0; $c<$count; ++$c) - { - // The change on the below line was documented on the sourceforge code tracker id 2788009 - // used to be: if (($levle=count($selectors[0]))===0) return array(); - if (($levle=count($selectors[$c]))===0) return array(); - if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); - - $head = array($this->_[HDOM_INFO_BEGIN]=>1); - - // handle descendant selectors, no recursive! - for ($l=0; $l<$levle; ++$l) - { - $ret = array(); - foreach ($head as $k=>$v) - { - $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k]; - //PaperG - Pass this optional parameter on to the seek function. - $n->seek($selectors[$c][$l], $ret, $lowercase); - } - $head = $ret; - } - - foreach ($head as $k=>$v) - { - if (!isset($found_keys[$k])) - $found_keys[$k] = 1; - } - } - - // sort keys - ksort($found_keys); - - $found = array(); - foreach ($found_keys as $k=>$v) - $found[] = $this->dom->nodes[$k]; - - // return nth-element or array - if (is_null($idx)) return $found; - else if ($idx<0) $idx = count($found) + $idx; - return (isset($found[$idx])) ? $found[$idx] : null; - } - - // seek for given conditions - // PaperG - added parameter to allow for case insensitive testing of the value of a selector. - protected function seek($selector, &$ret, $lowercase=false) - { - global $debugObject; - if (is_object($debugObject)) { $debugObject->debugLogEntry(1); } - - list($tag, $key, $val, $exp, $no_key) = $selector; - - // xpath index - if ($tag && $key && is_numeric($key)) - { - $count = 0; - foreach ($this->children as $c) - { - if ($tag==='*' || $tag===$c->tag) { - if (++$count==$key) { - $ret[$c->_[HDOM_INFO_BEGIN]] = 1; - return; - } - } - } - return; - } - - $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0; - if ($end==0) { - $parent = $this->parent; - while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) { - $end -= 1; - $parent = $parent->parent; - } - $end += $parent->_[HDOM_INFO_END]; - } - - for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) { - $node = $this->dom->nodes[$i]; - - $pass = true; - - if ($tag==='*' && !$key) { - if (in_array($node, $this->children, true)) - $ret[$i] = 1; - continue; - } - - // compare tag - if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;} - // compare key - if ($pass && $key) { - if ($no_key) { - if (isset($node->attr[$key])) $pass=false; - } else { - if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false; - } - } - // compare value - if ($pass && $key && $val && $val!=='*') { - // If they have told us that this is a "plaintext" search then we want the plaintext of the node - right? - if ($key == "plaintext") { - // $node->plaintext actually returns $node->text(); - $nodeKeyValue = $node->text(); - } else { - // this is a normal search, we want the value of that attribute of the tag. - $nodeKeyValue = $node->attr[$key]; - } - if (is_object($debugObject)) {$debugObject->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);} - - //PaperG - If lowercase is set, do a case insensitive test of the value of the selector. - if ($lowercase) { - $check = $this->match($exp, strtolower($val), strtolower($nodeKeyValue)); - } else { - $check = $this->match($exp, $val, $nodeKeyValue); - } - if (is_object($debugObject)) {$debugObject->debugLog(2, "after match: " . ($check ? "true" : "false"));} - - // handle multiple class - if (!$check && strcasecmp($key, 'class')===0) { - foreach (explode(' ',$node->attr[$key]) as $k) { - // Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form. - if (!empty($k)) { - if ($lowercase) { - $check = $this->match($exp, strtolower($val), strtolower($k)); - } else { - $check = $this->match($exp, $val, $k); - } - if ($check) break; - } - } - } - if (!$check) $pass = false; - } - if ($pass) $ret[$i] = 1; - unset($node); - } - // It's passed by reference so this is actually what this function returns. - if (is_object($debugObject)) {$debugObject->debugLog(1, "EXIT - ret: ", $ret);} - } - - protected function match($exp, $pattern, $value) { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - switch ($exp) { - case '=': - return ($value===$pattern); - case '!=': - return ($value!==$pattern); - case '^=': - return preg_match("/^".preg_quote($pattern,'/')."/", $value); - case '$=': - return preg_match("/".preg_quote($pattern,'/')."$/", $value); - case '*=': - if ($pattern[0]=='/') { - return preg_match($pattern, $value); - } - return preg_match("/".$pattern."/i", $value); - } - return false; - } - - protected function parse_selector($selector_string) { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - // pattern of CSS selectors, modified from mootools - // Paperg: Add the colon to the attrbute, so that it properly finds like google does. - // Note: if you try to look at this attribute, yo MUST use getAttribute since $dom->x:y will fail the php syntax check. -// Notice the \[ starting the attbute? and the @? following? This implies that an attribute can begin with an @ sign that is not captured. -// This implies that an html attribute specifier may start with an @ sign that is NOT captured by the expression. -// farther study is required to determine of this should be documented or removed. -// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; - preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); - if (is_object($debugObject)) {$debugObject->debugLog(2, "Matches Array: ", $matches);} - - $selectors = array(); - $result = array(); - //print_r($matches); - - foreach ($matches as $m) { - $m[0] = trim($m[0]); - if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue; - // for browser generated xpath - if ($m[1]==='tbody') continue; - - list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false); - if (!empty($m[2])) {$key='id'; $val=$m[2];} - if (!empty($m[3])) {$key='class'; $val=$m[3];} - if (!empty($m[4])) {$key=$m[4];} - if (!empty($m[5])) {$exp=$m[5];} - if (!empty($m[6])) {$val=$m[6];} - - // convert to lowercase - if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);} - //elements that do NOT have the specified attribute - if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;} - - $result[] = array($tag, $key, $val, $exp, $no_key); - if (trim($m[7])===',') { - $selectors[] = $result; - $result = array(); - } - } - if (count($result)>0) - $selectors[] = $result; - return $selectors; - } - - function __get($name) { - if (isset($this->attr[$name])) - { - return $this->convert_text($this->attr[$name]); - } - switch ($name) { - case 'outertext': return $this->outertext(); - case 'innertext': return $this->innertext(); - case 'plaintext': return $this->text(); - case 'xmltext': return $this->xmltext(); - default: return array_key_exists($name, $this->attr); - } - } - - function __set($name, $value) { - switch ($name) { - case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; - case 'innertext': - if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; - return $this->_[HDOM_INFO_INNER] = $value; - } - if (!isset($this->attr[$name])) { - $this->_[HDOM_INFO_SPACE][] = array(' ', '', ''); - $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; - } - $this->attr[$name] = $value; - } - - function __isset($name) { - switch ($name) { - case 'outertext': return true; - case 'innertext': return true; - case 'plaintext': return true; - } - //no value attr: nowrap, checked selected... - return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]); - } - - function __unset($name) { - if (isset($this->attr[$name])) - unset($this->attr[$name]); - } - - // PaperG - Function to convert the text from one character set to another if the two sets are not the same. - function convert_text($text) - { - global $debugObject; - if (is_object($debugObject)) {$debugObject->debugLogEntry(1);} - - $converted_text = $text; - - $sourceCharset = ""; - $targetCharset = ""; - - if ($this->dom) - { - $sourceCharset = strtoupper($this->dom->_charset); - $targetCharset = strtoupper($this->dom->_target_charset); - } - if (is_object($debugObject)) {$debugObject->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);} - - if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0)) - { - // Check if the reported encoding could have been incorrect and the text is actually already UTF-8 - if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text))) - { - $converted_text = $text; - } - else - { - $converted_text = iconv($sourceCharset, $targetCharset, $text); - } - } - - // Lets make sure that we don't have that silly BOM issue with any of the utf-8 text we output. - if ($targetCharset == 'UTF-8') - { - if (substr($converted_text, 0, 3) == "\xef\xbb\xbf") - { - $converted_text = substr($converted_text, 3); - } - if (substr($converted_text, -3) == "\xef\xbb\xbf") - { - $converted_text = substr($converted_text, 0, -3); - } - } - - return $converted_text; - } - - /** - * Returns true if $string is valid UTF-8 and false otherwise. - * - * @param mixed $str String to be tested - * @return boolean - */ - static function is_utf8($str) - { - $c=0; $b=0; - $bits=0; - $len=strlen($str); - for($i=0; $i<$len; $i++) - { - $c=ord($str[$i]); - if($c > 128) - { - if(($c >= 254)) return false; - elseif($c >= 252) $bits=6; - elseif($c >= 248) $bits=5; - elseif($c >= 240) $bits=4; - elseif($c >= 224) $bits=3; - elseif($c >= 192) $bits=2; - else return false; - if(($i+$bits) > $len) return false; - while($bits > 1) - { - $i++; - $b=ord($str[$i]); - if($b < 128 || $b > 191) return false; - $bits--; - } - } - } - return true; - } - /* - function is_utf8($string) - { - //this is buggy - return (utf8_encode(utf8_decode($string)) == $string); - } - */ - - /** - * Function to try a few tricks to determine the displayed size of an img on the page. - * NOTE: This will ONLY work on an IMG tag. Returns FALSE on all other tag types. - * - * @author John Schlick - * @version April 19 2012 - * @return array an array containing the 'height' and 'width' of the image on the page or -1 if we can't figure it out. - */ - function get_display_size() - { - global $debugObject; - - $width = -1; - $height = -1; - - if ($this->tag !== 'img') - { - return false; - } - - // See if there is aheight or width attribute in the tag itself. - if (isset($this->attr['width'])) - { - $width = $this->attr['width']; - } - - if (isset($this->attr['height'])) - { - $height = $this->attr['height']; - } - - // Now look for an inline style. - if (isset($this->attr['style'])) - { - // Thanks to user gnarf from stackoverflow for this regular expression. - $attributes = array(); - preg_match_all("/([\w-]+)\s*:\s*([^;]+)\s*;?/", $this->attr['style'], $matches, PREG_SET_ORDER); - foreach ($matches as $match) { - $attributes[$match[1]] = $match[2]; - } - - // If there is a width in the style attributes: - if (isset($attributes['width']) && $width == -1) - { - // check that the last two characters are px (pixels) - if (strtolower(substr($attributes['width'], -2)) == 'px') - { - $proposed_width = substr($attributes['width'], 0, -2); - // Now make sure that it's an integer and not something stupid. - if (filter_var($proposed_width, FILTER_VALIDATE_INT)) - { - $width = $proposed_width; - } - } - } - - // If there is a width in the style attributes: - if (isset($attributes['height']) && $height == -1) - { - // check that the last two characters are px (pixels) - if (strtolower(substr($attributes['height'], -2)) == 'px') - { - $proposed_height = substr($attributes['height'], 0, -2); - // Now make sure that it's an integer and not something stupid. - if (filter_var($proposed_height, FILTER_VALIDATE_INT)) - { - $height = $proposed_height; - } - } - } - - } - - // Future enhancement: - // Look in the tag to see if there is a class or id specified that has a height or width attribute to it. - - // Far future enhancement - // Look at all the parent tags of this image to see if they specify a class or id that has an img selector that specifies a height or width - // Note that in this case, the class or id will have the img subselector for it to apply to the image. - - // ridiculously far future development - // If the class or id is specified in a SEPARATE css file thats not on the page, go get it and do what we were just doing for the ones on the page. - - $result = array('height' => $height, - 'width' => $width); - return $result; - } - - // camel naming conventions - function getAllAttributes() {return $this->attr;} - function getAttribute($name) {return $this->__get($name);} - function setAttribute($name, $value) {$this->__set($name, $value);} - function hasAttribute($name) {return $this->__isset($name);} - function removeAttribute($name) {$this->__set($name, null);} - function getElementById($id) {return $this->find("#$id", 0);} - function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);} - function getElementByTagName($name) {return $this->find($name, 0);} - function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);} - function parentNode() {return $this->parent();} - function childNodes($idx=-1) {return $this->children($idx);} - function firstChild() {return $this->first_child();} - function lastChild() {return $this->last_child();} - function nextSibling() {return $this->next_sibling();} - function previousSibling() {return $this->prev_sibling();} - function hasChildNodes() {return $this->has_child();} - function nodeName() {return $this->tag;} - function appendChild($node) {$node->parent($this); return $node;} - -} - -/** - * simple html dom parser - * Paperg - in the find routine: allow us to specify that we want case insensitive testing of the value of the selector. - * Paperg - change $size from protected to public so we can easily access it - * Paperg - added ForceTagsClosed in the constructor which tells us whether we trust the html or not. Default is to NOT trust it. - * - * @package PlaceLocalInclude - */ -class simple_html_dom -{ - public $root = null; - public $nodes = array(); - public $callback = null; - public $lowercase = false; - // Used to keep track of how large the text was when we started. - public $original_size; - public $size; - protected $pos; - protected $doc; - protected $char; - protected $cursor; - protected $parent; - protected $noise = array(); - protected $token_blank = " \t\r\n"; - protected $token_equal = ' =/>'; - protected $token_slash = " />\r\n\t"; - protected $token_attr = ' >'; - // Note that this is referenced by a child node, and so it needs to be public for that node to see this information. - public $_charset = ''; - public $_target_charset = ''; - protected $default_br_text = ""; - public $default_span_text = ""; - - // use isset instead of in_array, performance boost about 30%... - protected $self_closing_tags = array('img'=>1, 'br'=>1, 'input'=>1, 'meta'=>1, 'link'=>1, 'hr'=>1, 'base'=>1, 'embed'=>1, 'spacer'=>1); - protected $block_tags = array('root'=>1, 'body'=>1, 'form'=>1, 'div'=>1, 'span'=>1, 'table'=>1); - // Known sourceforge issue #2977341 - // B tags that are not closed cause us to return everything to the end of the document. - protected $optional_closing_tags = array( - 'tr'=>array('tr'=>1, 'td'=>1, 'th'=>1), - 'th'=>array('th'=>1), - 'td'=>array('td'=>1), - 'li'=>array('li'=>1), - 'dt'=>array('dt'=>1, 'dd'=>1), - 'dd'=>array('dd'=>1, 'dt'=>1), - 'dl'=>array('dd'=>1, 'dt'=>1), - 'p'=>array('p'=>1), - 'nobr'=>array('nobr'=>1), - 'b'=>array('b'=>1), - 'option'=>array('option'=>1), - ); - - function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) - { - if ($str) - { - if (preg_match("/^http:\/\//i",$str) || is_file($str)) - { - $this->load_file($str); - } - else - { - $this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); - } - } - // Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html. - if (!$forceTagsClosed) { - $this->optional_closing_array=array(); - } - $this->_target_charset = $target_charset; - } - - function __destruct() - { - $this->clear(); - } - - // load html from string - function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) - { - global $debugObject; - - // prepare - $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); - // strip out comments - $this->remove_noise("''is"); - // strip out cdata - $this->remove_noise("''is", true); - // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037 - // Script tags removal now preceeds style tag removal. - // strip out