diff --git a/DEVTOOLS b/DEVTOOLS new file mode 100644 index 0000000000..dfc3231b84 --- /dev/null +++ b/DEVTOOLS @@ -0,0 +1,42 @@ +# Additional development tools + +Various components used within Textpattern (such as the bundled themes and language translations) are maintained in other repositories. Textpattern has a simple development toolset built on [Node.js](https://nodejs.org/) to pull the distribution files of those repositories into the core as required. + +You can install Node.js using the [installer](https://nodejs.org/en/download/) or [package manager](https://nodejs.org/en/download/package-manager/). + +Install required dev tools: + +```ShellSession +npm install +``` + +Pull the following components from the CLI: + +```ShellSession +npm run get-default-theme +npm run get-classic-admin-theme +npm run get-hive-admin-theme +npm run get-pophelp +npm run get-textpacks +npm run get-dependencies +``` + +To request a specific tag or branch: + +```ShellSession +npm run get-default-theme 4.9.0 +npm run get-classic-admin-theme 4.9.0 +npm run get-classic-admin-theme 4.9.x +npm run get-hive-admin-theme 4.9.x +npm run get-textpacks 4.9.x +``` + +Release tools: + +Usage: `npm run txp-gitdist [dest-dir]` (`dest-dir` defaults to a temporary location). + +```ShellSession +npm run txp-index +npm run txp-checksums ./textpattern +npm run txp-gitdist 1.2.3 ../my-dest-dir +``` diff --git a/README.md b/README.md index 87a25827b0..6e123d4094 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,15 @@ Ensure the server meets or exceeds the [system requirements](https://textpattern ## Download Textpattern -The current production release is version 4.8.8. It can be downloaded from the Textpattern website or GitHub in .zip and .tar.gz varieties. +The current production release is version 4.9.0. It can be downloaded from the Textpattern website or GitHub in .zip, .tar.gz, and .tar.xz varieties. -If you want to use the multi-site functionality in Textpattern, get the .tar.gz archive. +If you want to use the multi-site functionality in Textpattern, get the .tar.gz or .tar.xz archive. | | textpattern.com | GitHub | |--------|:-------:|:-----:| -| .zip | [Download](https://textpattern.com/file_download/118/textpattern-4.8.8.zip) | [Download](https://github.com/textpattern/textpattern/releases/download/4.8.8/textpattern-4.8.8.zip) | -| .tar.gz | [Download](https://textpattern.com/file_download/117/textpattern-4.8.8.tar.gz) | [Download](https://github.com/textpattern/textpattern/releases/download/4.8.8/textpattern-4.8.8.tar.gz) | +| .zip | [Download](https://textpattern.com/file_download/124/textpattern-4.9.0.zip) | [Download](https://github.com/textpattern/textpattern/releases/download/4.9.0/textpattern-4.9.0.zip) | +| .tar.gz | [Download](https://textpattern.com/file_download/125/textpattern-4.9.0.tar.gz) | [Download](https://github.com/textpattern/textpattern/releases/download/4.9.0/textpattern-4.9.0.tar.gz) | +| .tar.xz | [Download](https://textpattern.com/file_download/126/textpattern-4.9.0.tar.xz) | [Download](https://github.com/textpattern/textpattern/releases/download/4.9.0/textpattern-4.9.0.tar.xz) | ## Install Textpattern @@ -44,11 +45,11 @@ Please see [README.txt](https://github.com/textpattern/textpattern/blob/main/REA ## Upgrade Textpattern -Please see [README.txt](https://github.com/textpattern/textpattern/blob/main/README.txt) for details on upgrading Textpattern. +Please see [UPGRADE.txt](https://github.com/textpattern/textpattern/blob/main/UPGRADE.txt) for details on upgrading Textpattern. ## Help and Support -The [Textpattern support forum](https://forum.textpattern.com) is home to a friendly and helpful community of Textpattern users and experts. Textpattern also has a social network presence on [Mastodon](https://textpattern.com/mastodon) and [Twitter](https://textpattern.com/twitter). +The [Textpattern support forum](https://forum.textpattern.com) is home to a friendly and helpful community of Textpattern users and experts. Textpattern also has a social network presence on [Mastodon](https://textpattern.com/mastodon) and [X](https://textpattern.com/x). ## Development @@ -62,20 +63,26 @@ The following table outlines anticipated forthcoming changes to system requireme #### Textpattern development versions -Note that targeted versions listed may change multiple times during the development process. +We are targeting Textpattern 5 as the next major release. Refer to the following table for anticipated changes to system requirements for Textpattern 5. -We are targeting Textpattern 4.9 as the next minor release. Refer to the following table for anticipated changes to system requirements. +We generally recommend running Textpattern on platforms with active vendor support where possible, though we also maintain a minimum system requirements list for situations where that isn't viable. + +Note that versions listed may change multiple times during the development process. | | Minimum | Recommended | |--------|:-------:|:-----:| -| PHP | 5.6 | [vendor supported](https://php.net/supported-versions.php)
(8.1, 8.2 or 8.3) | -| MySQL | 5.5 | [vendor supported LTS](https://www.mysql.com/support/supportedplatforms/database.html)
(8.0) | -| Apache | — | vendor supported
(2.4) | -| Nginx | — | mainline (1.25) or stable (1.24) | +| PHP | — | [vendor supported](https://php.net/supported-versions.php) | +| MySQL | — | [vendor supported LTS](https://www.mysql.com/support/supportedplatforms/database.html) | +| Apache | — | vendor supported | +| Nginx | — | mainline or stable | ## Contributing -Do you want to help with the development of Textpattern? Please refer to the [contributing documentation](https://github.com/textpattern/textpattern/blob/dev/CONTRIBUTING.md) for full details. +Please refer to the [contributing documentation](https://github.com/textpattern/textpattern/blob/dev/CONTRIBUTING.md) for more details of Textpattern development. + +## Additional development tools + +Please refer to the [additional devevelopment tools](https://github.com/textpattern/textpattern/blob/dev/DEVTOOLS.md) document. ## GitHub topic tags @@ -87,50 +94,6 @@ If you use GitHub for Textpattern-related development please consider adding som * [`textpattern-website`](https://github.com/topics/textpattern-website) (for websites built with Textpattern) * [`textpattern-development`](https://github.com/topics/textpattern-development) (for development resources) -## Additional development tools - -Various components used within Textpattern (such as the bundled themes and language translations) are maintained in standalone repositories. Textpattern has a simple development toolset built on [Node.js](https://nodejs.org/) to pull the distribution files of those repositories into the core as required. - -You can install Node.js using the [installer](https://nodejs.org/en/download/) or [package manager](https://nodejs.org/en/download/package-manager/). - -Install required dev tools: - -```ShellSession -npm install -``` - -You can then pull the following components from the CLI, like so: - -```ShellSession -npm run get-default-theme -npm run get-classic-admin-theme -npm run get-hive-admin-theme -npm run get-pophelp -npm run get-textpacks -npm run get-dependencies -``` - -To request a specific tag or branch: - -```ShellSession -npm run get-default-theme 4.8.8 -npm run get-classic-admin-theme 4.8.8 -npm run get-classic-admin-theme 4.8.x -npm run get-hive-admin-theme 4.8.x -npm run get-textpacks 4.8.x -``` - -Release tools: - -Usage: `npm run txp-gitdist [dest-dir]` (`dest-dir` defaults to a -temporary location). - -```ShellSession -npm run txp-index -npm run txp-checksums -npm run txp-gitdist 1.2.3 ../my-dest-dir -``` - ## Thank You Thank you to our [GitHub sponsors](https://github.com/sponsors/textpattern). Your continued support is greatly appreciated! diff --git a/textpattern/include/txp_plugin.php b/textpattern/include/txp_plugin.php index d9c55a7e83..b306a03c78 100644 --- a/textpattern/include/txp_plugin.php +++ b/textpattern/include/txp_plugin.php @@ -451,11 +451,15 @@ function plugin_help() pagetop(gTxt('plugin_help')); $help = ($name) ? safe_field('help', 'txp_plugin', "name = '".doSlash($name)."'") : ''; - $helpArray = do_list($help, n); - if (preg_match('/^#@language\s+(.+)$/', $helpArray[0], $m)) { - $lang_plugin = $m[1]; - $help = implode(n, array_slice($helpArray, 1)); + if (preg_match('/^<\?xml/', $help)) { + $help = \Txp::get('\Textpattern\Module\Help\HelpAdmin')->render_xml($help, "", "?event=plugin&step=plugin_help&name={$name}&lang="); + } else { + $helpArray = do_list($help, n); + if (preg_match('/^#@language\s+(.+)$/', $helpArray[0], $m)) { + $lang_plugin = $m[1]; + $help = implode(n, array_slice($helpArray, 1)); + } } if ($lang_plugin !== $default_lang) { diff --git a/textpattern/lang/en-gb_help.xml b/textpattern/lang/en-gb_help.xml new file mode 100644 index 0000000000..43c17a16f2 --- /dev/null +++ b/textpattern/lang/en-gb_help.xml @@ -0,0 +1,169 @@ + + + + + + + + + About roles +

Publisher

+
    +
  • can manage articles, comments and links
  • +
  • can use PHP in articles if admin preference ‘Allow PHP in articles?’ is set to ‘Yes’
  • +
  • can manage images and files
  • +
  • can manage sections and categories
  • +
  • can manage pages, forms and style
  • +
  • can view diagnostic information
  • +
  • can manage site preferences
  • +
  • can manage users
  • +
  • can manage visitor logs
  • +
  • can manage plugins
  • +
  • can import data
  • +
+

Managing Editor

+
    +
  • can manage articles, comments and links
  • +
  • can use PHP in articles if admin preference ‘Allow PHP in articles?’ is set to ‘Yes’
  • +
  • can manage images and files
  • +
  • can manage sections and categories
  • +
  • can manage pages, forms and style
  • +
  • can view diagnostic information
  • +
  • can manage site preferences
  • +
  • can view users
  • +
  • can manage visitor logs
  • +
  • can manage plugins
  • +
  • can import data
  • +
+

Copy Editor

+
    +
  • can manage articles with one limitation: +
      +
    • cannot delete those belonging to other users
    • +
    +
  • +
  • can manage comments and links
  • +
  • can manage images and files
  • +
  • can manage categories
  • +
  • can manage pages and forms
  • +
  • can view users
  • +
  • can manage visitor logs
  • +
+

Staff Writer

+
    +
  • can manage own articles, view other users’ articles
  • +
  • can manage images and files
  • +
+

Freelancer

+
    +
  • can manage own articles in a limited sense: +
      +
    • can only modify article until is published
    • +
    • can apply status of only Draft, Hidden or Pending
    • +
    +
  • +
  • can view other users’ articles
  • +
+

Designer

+
    +
  • can manage own articles in a limited sense: +
      +
    • can only modify article until is published
    • +
    • can apply status of only Draft, Hidden or Pending
    • +
    +
  • +
  • can view other users’ articles
  • +
  • can manage images
  • +
  • can manage sections
  • +
  • can manage pages, forms and style
  • +
+ ]]>
+ Add new author +

A password, welcome message and login instructions will be emailed to the new author.

+ ]]>
+
+ + + Article image +

If you would like to associate a single image with this article, place one of the following here:

+
    +
  1. a Textpattern image ID
  2. +
  3. a relative URL to the image (e.g. /images/my_pic.jpg)
  4. +
  5. a fully-qualified URL (e.g. http://example.com/path/to/images/my_pic.jpg)
  6. +
+

The image can be displayed by placing a <txp:article_image /> tag (opens an external link in a new window) inside an article form. It will output a complete HTML <img> tag to your chosen image.

+ ]]>
+ Body +

The main content of an article is contained within the article body.

+

When composing or preparing articles for publication in Textpattern, you can switch between three views of the article: plain text, HTML markup (the code with which a web browser renders the article), and a rendered preview.

+ ]]>
+ Description +

The article description is an optional component that can help search engines and website crawlers better identify and sort content.

+

The article description is limited to a maximum of 255 characters. Note that some search engines place character limits on the length of a page’s meta description for practicality of display in search engine results pages (SERPs) and this may be less than the 255 character limit in Textpattern.

+

Note that the article description differs from the article excerpt, though they both accept similar content. The article description should be primarily intended for use with search engines and crawlers, whereas the the article excerpt is more suited for a human-readable article summary where desired.

+ ]]>
+ Excerpt +

Article excerpts are optional. Excerpts could be used as a short summary of the article that is displayed as part of a table of contents, used in place of the full article body in the site’s RSS/Atom feeds, or a number of other uses.

+ ]]>
+ Expire date +

The time an article is labelled as expired. The time is optional and can be set to an arbitrary time in the past or future.

+

The boxes correspond to the following information:

+
    +
  • Year / Month / Day
  • +
  • Hour (24-hour format) : Minute : Second
  • +
+

When the time arrives, or in the case where a time in the past is provided, the article expires.

+

If the option to display expired articles is enabled, the article remains visible. If the option to display expired articles is disabled, visitors to the article page will be served an HTTP 410 error in place of the article content.

+ ]]>
+ Keywords +

Keywords are useful for refining the relationships between articles beyond those provided by categories.

+

Keywords must be individual words separated by commas.

+ ]]>
+ Override form +

If you wish for an article to use a form different from that assigned by default - for example if you want to show only an article excerpt with <txp:excerpt /> (opens an external link in a new window) where you normally show the entire article with <txp:body /> (opens an external link in a new window) - this can be set here.

+ ]]>
+ Publish date +

The time an article or file is published or most-recently revised. The time can be set to the moment the item is published, or to an arbitrary time in the past or future.

+

The boxes correspond to the following information:

+
    +
  • Year / Month / Day
  • +
  • Hour (24-hour format) : Minute : Second
  • +
+

An item with a timestamp greater than the current time (i.e. in the future) will not appear on the front end and the RSS/Atom feeds until that time arrives.

+ ]]>
+ Title +

Add an appropriate title for this article.

+

An article title is limited to a maximum of 255 characters.

+ ]]>
+ URL-only title +

If you would like to have a specific title attached to the permalink URL for your article, enter it here. If it is left blank, the URL title will be automatically generated from the article title.

+

This is particularly useful if the title of your article uses non-ASCII characters.

+ ]]>
+
+
+ + + + + +
diff --git a/textpattern/lib/txplib_head.php b/textpattern/lib/txplib_head.php index 00b8d08ffd..89f13c3ef9 100644 --- a/textpattern/lib/txplib_head.php +++ b/textpattern/lib/txplib_head.php @@ -324,6 +324,7 @@ function areas() gTxt('tab_languages') => 'lang', $adminString => 'admin', gTxt('tab_plugins') => 'plugin', + gTxt('tab_help') => 'help', ); $areas['extensions'] = array( diff --git a/textpattern/vendors/Textpattern/Module/Help/HelpAdmin.php b/textpattern/vendors/Textpattern/Module/Help/HelpAdmin.php index 1b72c83f81..6e4b2c6926 100644 --- a/textpattern/vendors/Textpattern/Module/Help/HelpAdmin.php +++ b/textpattern/vendors/Textpattern/Module/Help/HelpAdmin.php @@ -34,6 +34,7 @@ class HelpAdmin { private static $available_steps = array( 'pophelp' => false, + 'custom' => false, 'dashboard' => false, ); @@ -187,6 +188,171 @@ public static function pophelp($string = '', $lang = null) public static function dashboard() { - pagetop(gTxt('tab_help')); +// pagetop(gTxt('tab_help')); + //TODO: Autodetect LANG and User Role, show relevant help, allow override it + self::custom('en-gb_help'); } + + public static function custom($name='') + { + $name = empty($name) ? gps('name') : $name; + if (empty($name) || preg_match('/[^\w\-]/i', $name)) { + exit; + } + $file = txpath."/lang/{$name}.xml"; + + pagetop(gTxt('help_custom')); + if ($data = @file_get_contents($file)) { + echo hardcode_css_test(); + echo self::render_xml($data, "", "?event=help&step=custom&name={$name}&lang="); + } else { + echo "Help file: `{$name}` not found"; + } + } + + + /** + * render_xml - xml2html + * + * @param string $data Raw XML + * @param string/array? $option Allow or not css/js/toc blocks + * @param string $href Link for lang menu + * + */ + + public static function render_xml($data='', $option='', $hreflang='') + { + $out = ''; + if ($xml = simplexml_load_string($data, "SimpleXMLElement", LIBXML_NOCDATA)) { + if (!empty($xml->css)) { + $out .= ''.n; + } + + // Multilang part, If the file contains more than one language. + $langs = array(); + foreach ($xml->help as $help) { + $key = $help->attributes()->lang ? (string)$help->attributes()->lang : 'default'; + $langs[$key] = $help; + } + $lang_available = array_keys($langs); + + // detect language + $lang = gps('lang') ? gps('lang') : get_pref('language_ui', LANG); + $help = !empty($langs[$lang]) ? $langs[$lang] : array_shift($langs); + + if (count($lang_available) > 1 && !empty($hreflang)) { + //FIXME: UI, build some language dropdown menu. + $out .= '
    '; + foreach ($lang_available as $lng) { + $out .= "
  • {$lng}
  • "; + } + $out .= '
'; + } + + + $menu = array(); + self::$textile = new \Netcarver\Textile\Parser(); + if (!empty($help->toc)) { + $out .= self::render_item($help->toc, $class='help-toc-static'); + } + $out2 = ''; + foreach ($help->children() as $key => $children) { + if ($key == 'group') { + $id = (string)$children->attributes()->id; + $title = (string)$children->attributes()->title; + + $out2 .= "

{$title}

"; + $items = array(); + foreach ($children->item as $item) { + $items[] = self::render_item($item); + } + $out2 .= doWrap($items, '', '')."
"; + $menu[] = tag($title, 'a', array('href' => "#group-{$id}") ); + } + if ($key == 'item') { + $out2 .= self::render_item($children); + } + } + $out .= "
".doWrap($menu, 'ul', 'li')."
"; + + if (!empty($xml->js)) { + $out2 .= ''.n; + } + } + + return $out.$out2; + } + + public static function render_item($item , $class='help-item') + { + $id = $item->attributes()->id; + $format = $item->attributes()->format; + $item = trim($item); + if ($format == 'textile') { + $out = self::$textile->textileThis($item); + } else { + $out = $item; + } + +// return tag($out, 'div', array('class' => $class, 'id' => $id)); + return "
$out
\n"; + } +} + + +// Temporary code, it will be deleted. +function hardcode_css_test() +{ + return << +@media screen and (min-width: 500px) { +.help-toc { + top: 50px; + position: fixed; + width: 200px; +} +.help-group { + margin-right: 200px; + +} +} + +.help-toc { + padding-right: 10px; + right: 0; + text-align: right; + border-radius: 50px 0 0 0px; + box-shadow: -120px 20px 50px #f9f3c0 inset; + border: 1px solid #f9f3c0; +} +.help-toc a { + color: #333; +} +.help-group:target > h1 { + color: red; + margin-top: 40px; +} + +.help-group:target { + display: block; +} + +.help-toc ul { + list-style-type: none; +} + +.help-group { + border-top: 1px dotted blue; + border-left: 1px dotted blue; + padding-left: 10px; + display: none; + background-color: #fafafa; +} + +.help-item { + border-bottom: 1px dotted blue; + margin: 10px; +} + +EOF; }