Initial commit
This commit is contained in:
38
www/backup/bk/wp-content/plugins/sitemap/css/page-list.css
Normal file
38
www/backup/bk/wp-content/plugins/sitemap/css/page-list.css
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Page-list plugin
|
||||
http://wordpress.org/extend/plugins/page-list/
|
||||
*/
|
||||
|
||||
/* default styles for [pagelist], [subpages], [siblings] */
|
||||
.page-list .current_page_item > a {
|
||||
font-weight: bold; /* hilite active item */
|
||||
}
|
||||
|
||||
/* default styles for [pagelist_ext] */
|
||||
.page-list-ext {
|
||||
clear: both;
|
||||
}
|
||||
/* clearfix-hack */
|
||||
.page-list-ext {
|
||||
*zoom: 1;
|
||||
}
|
||||
.page-list-ext:before, .page-list-ext:after {
|
||||
display: table;
|
||||
line-height: 0;
|
||||
content: "";
|
||||
}
|
||||
.page-list-ext:after {
|
||||
clear: both;
|
||||
}
|
||||
.page-list-ext .page-list-ext-item {
|
||||
clear: both;
|
||||
margin: 10px 0 30px 0;
|
||||
}
|
||||
.page-list-ext .page-list-ext-image {
|
||||
float: left;
|
||||
display: inline;
|
||||
margin: 5px 15px 15px 0;
|
||||
}
|
||||
.page-list-ext .page-list-ext-title {
|
||||
clear: none;
|
||||
}
|
||||
236
www/backup/bk/wp-content/plugins/sitemap/readme.txt
Normal file
236
www/backup/bk/wp-content/plugins/sitemap/readme.txt
Normal file
@@ -0,0 +1,236 @@
|
||||
=== Sitemap ===
|
||||
Contributors: webvitaly
|
||||
Donate link: http://web-profile.com.ua/donate/
|
||||
Tags: page, page-list, pagelist, sitemap, subpages, siblings
|
||||
Requires at least: 3.0
|
||||
Tested up to: 4.1
|
||||
Stable tag: 4.3
|
||||
License: GPLv3
|
||||
License URI: http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
[pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
||||
|
||||
== Description ==
|
||||
|
||||
**Code moved to [Page-list plugin](http://wordpress.org/plugins/page-list/)** Please, delete Sitemap plugin and install [Page-list plugin](http://wordpress.org/plugins/page-list/ "List of pages") instead. Don't be afraid, the functionality of these plugins is the same.
|
||||
|
||||
> **[WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)** |
|
||||
> **[Page-list](http://web-profile.com.ua/wordpress/plugins/page-list/ "Plugin page")** |
|
||||
> **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/)** |
|
||||
> **[Donate](http://web-profile.com.ua/donate/ "Support the development")**
|
||||
|
||||
= shortcodes: =
|
||||
|
||||
* **[pagelist]** - hierarchical tree of all pages on site (useful to show sitemap of the site);
|
||||
* **[subpages]** - hierarchical tree of subpages to the current page;
|
||||
* **[siblings]** - hierarchical tree of sibling pages to the current page;
|
||||
* **[pagelist_ext]** - list of pages with featured image and with excerpt;
|
||||
|
||||
= examples with aditional parameters: =
|
||||
|
||||
* `[pagelist child_of="4" depth="2" exclude="6,7,8"]`
|
||||
* `[pagelist_ext child_of="4" exclude="6,7,8" image_width="50" image_height="50"]`
|
||||
* **[all Page-list params](http://wordpress.org/plugins/page-list/other_notes/)**
|
||||
|
||||
= Useful: =
|
||||
* ["Anti-spam" - block spam in comments](http://wordpress.org/plugins/anti-spam/ "no spam, no captcha")
|
||||
* ["Iframe" - embed iframe with shortcode](http://wordpress.org/plugins/iframe/ "embed iframe")
|
||||
* [WordPress Pro plugins](http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly)
|
||||
|
||||
== Other Notes ==
|
||||
|
||||
= Parameters for [pagelist], [subpages] and [siblings]: =
|
||||
* **[pagelist]** - by default shows list of all pages as the hierarchical list;
|
||||
* **[subpages]** - by default shows list of subpages to the current page as the hierarchical list;
|
||||
* **[siblings]** - by default shows list of sibling pages to the current page as the hierarchical list;
|
||||
* **depth** - means how many levels in the hierarchy of pages are to be included in the list, by default depth is unlimited (depth=0), but you can specify it like this: `[pagelist depth="3"]`; If you want to show flat list of pages (not hierarchical tree) you can use this shortcode: `[pagelist depth="-1"]`;
|
||||
* **child_of** - if you want to show subpages of the specific page you can use this shortcode: `[pagelist child_of="4"]` where `4` is the ID of the specific page; If you want to show subpages of the current page you can use this shortcodes: `[subpages]` or `[pagelist child_of="current"]` or `[pagelist child_of="this"]`; If you want to show sibling pages of the current page you can use this shortcodes: `[siblings]` or `[pagelist child_of="parent"]`;
|
||||
* **exclude** - if you want to exclude some pages from the list you can use this shortcode: `[pagelist exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs; You may exclude current page with this shortcode: `[pagelist exclude="current"]`;
|
||||
* **exclude_tree** - if you want to exclude the tree of pages from the list you can use this shortcode: `[pagelist exclude_tree="7,10"]` where `exclude_tree` parameter accepts comma-separated list of Page IDs (all this pages and their subpages will be excluded);
|
||||
* **include** - if you want to include certain pages into the list of pages you can use this shortcode: `[pagelist include="6,7,8"]` where `include` parameter accepts comma-separated list of Page IDs;
|
||||
* **title_li** - if you want to specify the title of the list of pages you can use this shortcode: `[pagelist title_li="<h2>List of pages</h2>"]`; by default there is no title (title_li="");
|
||||
* **number** - if you want to specify the number of pages to be included into list of pages you can use this shortcode: `[pagelist number="10"]`; by default the number is unlimited (number="");
|
||||
* **offset** - if you want to pass over (or displace) some pages you can use this shortcode: `[pagelist offset="5"]`; by default there is no offset (offset="");
|
||||
* **meta_key** - if you want to include the pages that have this Custom Field Key you can use this shortcode: `[pagelist meta_key="metakey" meta_value="metaval"]`;
|
||||
* **show_date** - if you want to show the date of the page you can use this shortcode: `[pagelist show_date="created"]`; you can use this values for `show_date` parameter: created, modified, updated;
|
||||
* **menu_order** - if you want to specify the column by what to sort you can use this shortcode: `[pagelist sort_column="menu_order"]`; by default order columns are `menu_order` and `post_title` (sort_column="menu_order, post_title"); you can use this values for `sort_column` parameter: post_title, menu_order, post_date (sort by creation time), post_modified (sort by last modified time), ID, post_author (sort by the page author's numeric ID), post_name (sort by page slug);
|
||||
* **sort_order** - if you want to change the sort order of the list of pages (either ascending or descending) you can use this shortcode: `[pagelist sort_order="desc"]`; by default sort_order is `asc` (sort_order="asc"); you can use this values for `sort_order` parameter: asc, desc;
|
||||
* **link_before** - if you want to specify the text or html that precedes the link text inside the link tag you can use this shortcode: `[pagelist link_before="<span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
|
||||
* **link_after** - if you want to specify the text or html that follows the link text inside the link tag you can use this shortcode: `[pagelist link_after="</span>"]`; you may specify html tags only in the `HTML` tab in your Rich-text editor;
|
||||
* **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist class="listclass"]`; by default the class is empty (class="");
|
||||
|
||||
= Parameters for [pagelist_ext]: =
|
||||
* **[pagelist_ext]** - by default shows list of subpages to current page; but if there is no subpages than all pages will be shown;
|
||||
* **show_image** - show or hide featured image `[pagelist_ext show_image="0"]`; "show_image" have higher priority than "show_first_image"; by default: show_image="1";
|
||||
* **show_first_image** - show or hide first image from content if there is no featured image `[pagelist_ext show_first_image="1"]`; by default: show_first_image="0";
|
||||
* **show_title** - show or hide title `[pagelist_ext show_title="0"]`; by default: show_title="1";
|
||||
* **show_content** - show or hide content `[pagelist_ext show_content="0"]`; by default: show_content="1";
|
||||
* **more_tag** - if you want to output all content before and after more tag use this shortcode: `[pagelist_ext more_tag="0"]`; this parameter does not add "more-link" to the end of content, it just cut content before more-tag; "more_tag" parameter have higher priority than "limit_content"; by default the more_tag is enabled (more_tag="1") and showing only content before more tag;
|
||||
* **limit_content** - content is limited by "more-tag" if it is exist or by "limit_content" parameter `[pagelist_ext limit_content="100"]`; by default: limit_content="250";
|
||||
* **image_width** - width of the image `[pagelist_ext image_width="80"]`; by default: image_width="50";
|
||||
* **image_height** - height of the image `[pagelist_ext image_height="80"]`; by default: image_height="50";
|
||||
* **child_of** - if you want to show subpages of the specific page you can use this shortcode: `[pagelist_ext child_of="4"]` where `4` is the ID of the specific page; by default it shows subpages to the current page;
|
||||
* **parent** - if you want to show subpages of the specific page only you can use this shortcode: `[pagelist_ext parent="4"]` where `4` is the ID of the specific page and the depth will be only one level; by default parent="-1" and depth is unlimited;
|
||||
* **sort_order** - if you want to change the sort order of the list of pages (either ascending or descending) you can use this shortcode: `[pagelist_ext sort_order="desc"]`; by default: sort_order="asc"; you can use this values for `sort_order` parameter: asc, desc;
|
||||
* **sort_column** - if you want to specify the column by what to sort you can use this shortcode: `[pagelist_ext sort_column="menu_order"]`; by default order columns are `sort_column` and `post_title` (sort_column="menu_order, post_title"); you can use this values for `sort_column` parameter: post_title, menu_order, post_date (sort by creation time), post_modified (sort by last modified time), ID, post_author (sort by the page author's numeric ID), post_name (sort by page slug);
|
||||
* **hierarchical** - display subpages below their parent page `[pagelist_ext hierarchical="0"]`; by default: hierarchical="1";
|
||||
* **exclude** - if you want to exclude some pages from the list you can use this shortcode: `[pagelist_ext exclude="6,7,8"]` where `exclude` parameter accepts comma-separated list of Page IDs;
|
||||
* **exclude_tree** - if you want to exclude the tree of pages from the list you can use this shortcode: `[pagelist_ext exclude_tree="7,10"]` where `exclude_tree` parameter accepts comma-separated list of Page IDs (all this pages and their subpages will be excluded);
|
||||
* **include** - if you want to include certain pages into the list of pages you can use this shortcode: `[pagelist_ext include="6,7,8"]` where `include` parameter accepts comma-separated list of Page IDs;
|
||||
* **meta_key** - if you want to include the pages that have this Custom Field Key you can use this shortcode: `[pagelist_ext meta_key="metakey" meta_value="metaval"]`;
|
||||
* **authors** - only include the pages written by the given author(s) `[pagelist_ext authors="6,7,8"]`;
|
||||
* **number** - if you want to specify the number of pages to be included into list of pages you can use this shortcode: `[pagelist_ext number="10"]`; by default the number is unlimited (number="");
|
||||
* **offset** - if you want to pass over (or displace) some pages you can use this shortcode: `[pagelist_ext offset="5"]`; by default there is no offset (offset="");
|
||||
* **post_type** - `[pagelist_ext post_type="page"]`;
|
||||
* **post_status** - `[pagelist_ext post_status="publish"]`;
|
||||
* **class** - if you want to specify the CSS class for list of pages you can use this shortcode: `[pagelist_ext class="listclass"]`; by default the class is empty (class="");
|
||||
* **strip_tags** - if you want to output the content with tags use this shortcode: `[pagelist_ext strip_tags="0"]`; by default the strip_tags is enabled (strip_tags="1");
|
||||
* **strip_shortcodes** - if you want to output the content with shortcode use this shortcode: `[pagelist_ext strip_shortcodes="0"]`; by default the strip_shortcodes is enabled (strip_shortcodes="1") and all registered shortcodes are removed;
|
||||
* **show_child_count** - if you want to show child count you can use this shortcode: `[pagelist_ext show_child_count="1"]`; by default the child_count is disabled (show_child_count="0"); If show_child_count="1", but count of subpages=0, than child count is not showing;
|
||||
* **child_count_template** - if you want to specify the template of child_count you can use this shortcode: `[pagelist_ext show_child_count="1" child_count_template="Subpages: %child_count%"]`; by default child_count_template="Subpages: %child_count%";
|
||||
* **show_meta_key** - if you want to show meta key you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key"]`; by default the show_meta_key is empty (show_meta_key=""); If show_meta_key is enabled, but meta_value is empty, than meta_key is not showing;
|
||||
* **meta_template** - if you want to specify the template of meta you can use this shortcode: `[pagelist_ext show_meta_key="your_meta_key" meta_template="Meta: %meta%"]`; by default meta_template="%meta%";
|
||||
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= How to show the list of posts? =
|
||||
|
||||
To show list of posts you can use [List Category Posts](http://wordpress.org/plugins/list-category-posts/) plugin.
|
||||
|
||||
= On what functions shortcodes are based? =
|
||||
|
||||
Shortcodes [pagelist], [subpages], [siblings] are based on [wp_list_pages('title_li=')](http://codex.wordpress.org/Template_Tags/wp_list_pages) function.
|
||||
Shortcode [pagelist_ext] is based on [get_pages()](http://codex.wordpress.org/Function_Reference/get_pages) function.
|
||||
|
||||
= What is the difference between [pagelist], [subpages] and [siblings]? =
|
||||
|
||||
Shortcodes [pagelist], [subpages] and [siblings] accept the same parameters. The only difference is that [subpages] and [siblings] not accept `child_of` parameter, because [subpages] shows subpages to the current page and [siblings] shows subpages to the parent page.
|
||||
|
||||
= How to create sitemap.xml? =
|
||||
To create sitemap.xml you can use [Google XML Sitemaps](http://wordpress.org/plugins/google-sitemap-generator/) plugin.
|
||||
|
||||
= Is there "more-link" feature in the plugin? =
|
||||
No, there is no "more-link" feature in the plugin. Because "[more-link](http://web-profile.com.ua/web/web-principles/more-link/)":
|
||||
|
||||
* **bad for SEO.** Nobody will search your site with the word "more". "rel=nofollow" will not solve it too.
|
||||
* **bad for usability.** There is already link on title and "more-link" is an extra no needed element on page. If user cannot understand that the title is the link, than there is a problem in css styles and not in plugin's templates.
|
||||
|
||||
= What to do if you need to change the plugin's code? =
|
||||
When you changed the plugin's code you should also change the plugin's version to '100' (for example) to avoid updates, which could override and delete your code.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. [pagelist] shortcode
|
||||
2. [pagelist_ext] shortcode
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 4.3 - 2015.01.15 =
|
||||
* use wp_enqueue_scripts hook instead of wp_print_styles to enqueue scripts and styles (thanks to sireneweb)
|
||||
|
||||
= 4.2 - 2013.02.16 =
|
||||
* fix in css styles (clearfix added to .page-list-ext)
|
||||
* make default image size 150x150 like default thumbnail size
|
||||
|
||||
= 4.1 - 2013.01.27 =
|
||||
* change the type of output the image thumbnail in [pagelist_ext] shortcode
|
||||
|
||||
= 4.0 - 2012.10.30 =
|
||||
* remove conflict between Pagelist and Sitemap plugins
|
||||
* remove preg_match_all notice
|
||||
* minor changes
|
||||
|
||||
= 3.8 =
|
||||
* fixed default [pagelist_ext] behaviour - showing all pages if there is no subpages
|
||||
|
||||
= 3.7 =
|
||||
* executing shortcodes in [pagelist_ext strip_shortcodes="0"] in content
|
||||
|
||||
= 3.6 =
|
||||
* fixing bug with shortcode in sidebar - shortcode in comment start to execute
|
||||
|
||||
= 3.5 =
|
||||
* showing all pages for [pagelist_ext child_of="0"] shortcode
|
||||
|
||||
= 3.4 =
|
||||
* remove esc_attr() from title in [pagelist_ext] shortcode
|
||||
|
||||
= 3.3 =
|
||||
* rename "get_first_image" function to "page_list_get_first_image" for avoiding conflicts
|
||||
|
||||
= 3.2 =
|
||||
* fixed bug with "more_tag" and non english chars
|
||||
|
||||
= 3.1 =
|
||||
* fixed bug with empty image in "show_first_image" parameter
|
||||
* added "more_tag" higher priority than "limit_content" (thanks to BobyDimitrov)
|
||||
|
||||
= 3.0 =
|
||||
* added "show_first_image" parameter for showing first image from content if there is no featured image
|
||||
|
||||
= 2.9 =
|
||||
* added "more_tag" parameter and more tag support
|
||||
* hiding password protected content of the pages
|
||||
|
||||
= 2.8 =
|
||||
* added "strip_shortcodes" parameter
|
||||
|
||||
= 2.7 =
|
||||
* make excerpt link if there is no title
|
||||
|
||||
= 2.6 =
|
||||
* fixed [pagelist_ext] "parent" parameter
|
||||
|
||||
= 2.5 =
|
||||
* adding spaces between lines when tags are stripped in [pagelist_ext]
|
||||
|
||||
= 2.4 =
|
||||
* escaping attributes in title in [pagelist_ext]
|
||||
|
||||
= 2.3 =
|
||||
* fixed [pagelist_ext] with showing excerpt of the page if it is not empty, else showing content
|
||||
|
||||
= 2.2 =
|
||||
* fixed offset parameter
|
||||
|
||||
= 2.1 =
|
||||
* fixed number parameter
|
||||
|
||||
= 2.0 =
|
||||
* fixed crash bug with [pagelist_ext] if theme does not have thumbnail feature
|
||||
|
||||
= 1.9 =
|
||||
* added show_child_count parameter
|
||||
* added show_meta_key parameter
|
||||
|
||||
= 1.8 =
|
||||
* added screenshots
|
||||
* improved parameter parsing
|
||||
|
||||
= 1.7 =
|
||||
* added strip_tags parameter
|
||||
|
||||
= 1.6 =
|
||||
* improved [pagelist_ext] shortcode: added content to list, added toggle show and limit content parameters
|
||||
|
||||
= 1.5 =
|
||||
* added [pagelist_ext] shortcode - list of pages with featured image
|
||||
|
||||
= 1.4 =
|
||||
* added exclude="current" parameter
|
||||
|
||||
= 1.3.0 =
|
||||
* added class to ul elements by default
|
||||
* added "class" option (thanks to Arvind)
|
||||
|
||||
= 1.2.0 =
|
||||
* added [subpages] and [siblings] shortcodes
|
||||
|
||||
= 1.0.0 =
|
||||
* initial release
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. install and activate the plugin on the Plugins page
|
||||
2. add shortcodes to pages: `[pagelist]`, `[subpages]`, `[siblings]`, `[pagelist_ext]`
|
||||
BIN
www/backup/bk/wp-content/plugins/sitemap/screenshot-1.png
Normal file
BIN
www/backup/bk/wp-content/plugins/sitemap/screenshot-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
BIN
www/backup/bk/wp-content/plugins/sitemap/screenshot-2.png
Normal file
BIN
www/backup/bk/wp-content/plugins/sitemap/screenshot-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
528
www/backup/bk/wp-content/plugins/sitemap/sitemap.php
Normal file
528
www/backup/bk/wp-content/plugins/sitemap/sitemap.php
Normal file
@@ -0,0 +1,528 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Sitemap
|
||||
Plugin URI: http://wordpress.org/plugins/page-list/
|
||||
Description: [pagelist], [subpages], [siblings] and [pagelist_ext] shortcodes
|
||||
Version: 4.3
|
||||
Author: webvitaly
|
||||
Author URI: http://web-profile.com.ua/wordpress/plugins/
|
||||
License: GPLv3
|
||||
*/
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_add_stylesheet') ) {
|
||||
function pagelist_unqprfx_add_stylesheet() {
|
||||
wp_enqueue_style( 'page-list-style', plugins_url( '/css/page-list.css', __FILE__ ), false, '4.3', 'all' );
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'pagelist_unqprfx_add_stylesheet');
|
||||
}
|
||||
|
||||
|
||||
$pagelist_unqprfx_powered_line = "\n".'<!-- Page-list plugin v.4.3 wordpress.org/plugins/page-list/ -->'."\n";
|
||||
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_shortcode') ) {
|
||||
function pagelist_unqprfx_shortcode( $atts ) {
|
||||
global $post, $pagelist_unqprfx_powered_line;
|
||||
$return = '';
|
||||
extract( shortcode_atts( array(
|
||||
'depth' => '0',
|
||||
'child_of' => '0',
|
||||
'exclude' => '0',
|
||||
'exclude_tree' => '',
|
||||
'include' => '0',
|
||||
'title_li' => '',
|
||||
'number' => '',
|
||||
'offset' => '',
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'show_date' => '',
|
||||
'sort_column' => 'menu_order, post_title',
|
||||
'sort_order' => 'ASC',
|
||||
'link_before' => '',
|
||||
'link_after' => '',
|
||||
'class' => ''
|
||||
), $atts ) );
|
||||
|
||||
$page_list_args = array(
|
||||
'depth' => $depth,
|
||||
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
||||
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
||||
'exclude_tree' => $exclude_tree,
|
||||
'include' => $include,
|
||||
'title_li' => $title_li,
|
||||
'number' => $number,
|
||||
'offset' => $offset,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
'show_date' => $show_date,
|
||||
'date_format' => get_option('date_format'),
|
||||
'echo' => 0,
|
||||
'authors' => '',
|
||||
'sort_column' => $sort_column,
|
||||
'sort_order' => $sort_order,
|
||||
'link_before' => $link_before,
|
||||
'link_after' => $link_after,
|
||||
'walker' => ''
|
||||
);
|
||||
$list_pages = wp_list_pages( $page_list_args );
|
||||
|
||||
$return = $pagelist_unqprfx_powered_line;
|
||||
if ($list_pages) {
|
||||
$return .= '<ul class="page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
||||
}else{
|
||||
$return .= '<!-- no pages to show -->';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
add_shortcode( 'pagelist', 'pagelist_unqprfx_shortcode' );
|
||||
add_shortcode( 'page_list', 'pagelist_unqprfx_shortcode' );
|
||||
add_shortcode( 'page-list', 'pagelist_unqprfx_shortcode' ); // not good (Shortcode names should be all lowercase and use all letters, but numbers and underscores (not dashes!) should work fine too.)
|
||||
add_shortcode( 'sitemap', 'pagelist_unqprfx_shortcode' );
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('subpages_unqprfx_shortcode') ) {
|
||||
function subpages_unqprfx_shortcode( $atts ) {
|
||||
global $post, $pagelist_unqprfx_powered_line;
|
||||
$return = '';
|
||||
extract( shortcode_atts( array(
|
||||
'depth' => '0',
|
||||
//'child_of' => '0',
|
||||
'exclude' => '0',
|
||||
'exclude_tree' => '',
|
||||
'include' => '0',
|
||||
'title_li' => '',
|
||||
'number' => '',
|
||||
'offset' => '',
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'show_date' => '',
|
||||
'sort_column' => 'menu_order, post_title',
|
||||
'sort_order' => 'ASC',
|
||||
'link_before' => '',
|
||||
'link_after' => '',
|
||||
'class' => ''
|
||||
), $atts ) );
|
||||
|
||||
$page_list_args = array(
|
||||
'depth' => $depth,
|
||||
'child_of' => $post->ID,
|
||||
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
||||
'exclude_tree' => $exclude_tree,
|
||||
'include' => $include,
|
||||
'title_li' => $title_li,
|
||||
'number' => $number,
|
||||
'offset' => $offset,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
'show_date' => $show_date,
|
||||
'date_format' => get_option('date_format'),
|
||||
'echo' => 0,
|
||||
'authors' => '',
|
||||
'sort_column' => $sort_column,
|
||||
'sort_order' => $sort_order,
|
||||
'link_before' => $link_before,
|
||||
'link_after' => $link_after,
|
||||
'walker' => ''
|
||||
);
|
||||
$list_pages = wp_list_pages( $page_list_args );
|
||||
|
||||
$return = $pagelist_unqprfx_powered_line;
|
||||
if ($list_pages) {
|
||||
$return .= '<ul class="page-list subpages-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
||||
}else{
|
||||
$return .= '<!-- no pages to show -->';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
add_shortcode( 'subpages', 'subpages_unqprfx_shortcode' );
|
||||
add_shortcode( 'sub_pages', 'subpages_unqprfx_shortcode' );
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('siblings_unqprfx_shortcode') ) {
|
||||
function siblings_unqprfx_shortcode( $atts ) {
|
||||
global $post, $pagelist_unqprfx_powered_line;
|
||||
$return = '';
|
||||
extract( shortcode_atts( array(
|
||||
'depth' => '0',
|
||||
//'child_of' => '0',
|
||||
'exclude' => '0',
|
||||
'exclude_tree' => '',
|
||||
'include' => '0',
|
||||
'title_li' => '',
|
||||
'number' => '',
|
||||
'offset' => '',
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'show_date' => '',
|
||||
'sort_column' => 'menu_order, post_title',
|
||||
'sort_order' => 'ASC',
|
||||
'link_before' => '',
|
||||
'link_after' => '',
|
||||
'class' => ''
|
||||
), $atts ) );
|
||||
|
||||
if( $exclude == 'current' || $exclude == 'this' ){
|
||||
$exclude = $post->ID;
|
||||
}
|
||||
|
||||
$page_list_args = array(
|
||||
'depth' => $depth,
|
||||
'child_of' => $post->post_parent,
|
||||
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
||||
'exclude_tree' => $exclude_tree,
|
||||
'include' => $include,
|
||||
'title_li' => $title_li,
|
||||
'number' => $number,
|
||||
'offset' => $offset,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
'show_date' => $show_date,
|
||||
'date_format' => get_option('date_format'),
|
||||
'echo' => 0,
|
||||
'authors' => '',
|
||||
'sort_column' => $sort_column,
|
||||
'sort_order' => $sort_order,
|
||||
'link_before' => $link_before,
|
||||
'link_after' => $link_after,
|
||||
'walker' => ''
|
||||
);
|
||||
$list_pages = wp_list_pages( $page_list_args );
|
||||
|
||||
$return = $pagelist_unqprfx_powered_line;
|
||||
if ($list_pages) {
|
||||
$return .= '<ul class="page-list siblings-page-list '.$class.'">'."\n".$list_pages."\n".'</ul>';
|
||||
}else{
|
||||
$return .= '<!-- no pages to show -->';
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
add_shortcode( 'siblings', 'siblings_unqprfx_shortcode' );
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_ext_shortcode') ) {
|
||||
function pagelist_unqprfx_ext_shortcode( $atts ) {
|
||||
global $post, $pagelist_unqprfx_powered_line;
|
||||
$return = '';
|
||||
extract( shortcode_atts( array(
|
||||
'show_image' => 1,
|
||||
'show_first_image' => 0,
|
||||
'show_title' => 1,
|
||||
'show_content' => 1,
|
||||
'more_tag' => 1,
|
||||
'limit_content' => 250,
|
||||
'image_width' => '150',
|
||||
'image_height' => '150',
|
||||
'child_of' => '',
|
||||
'sort_order' => 'ASC',
|
||||
'sort_column' => 'menu_order, post_title',
|
||||
'hierarchical' => 1,
|
||||
'exclude' => '0',
|
||||
'include' => '0',
|
||||
'meta_key' => '',
|
||||
'meta_value' => '',
|
||||
'authors' => '',
|
||||
'parent' => -1,
|
||||
'exclude_tree' => '',
|
||||
'number' => '',
|
||||
'offset' => 0,
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'class' => '',
|
||||
'strip_tags' => 1,
|
||||
'strip_shortcodes' => 1,
|
||||
'show_child_count' => 0,
|
||||
'child_count_template' => 'Subpages: %child_count%',
|
||||
'show_meta_key' => '',
|
||||
'meta_template' => '%meta%'
|
||||
), $atts ) );
|
||||
|
||||
if( $child_of == '' ){ // show subpages if child_of is empty
|
||||
$child_of = $post->ID;
|
||||
}
|
||||
|
||||
$page_list_ext_args = array(
|
||||
'show_image' => $show_image,
|
||||
'show_first_image' => $show_first_image,
|
||||
'show_title' => $show_title,
|
||||
'show_content' => $show_content,
|
||||
'more_tag' => $more_tag,
|
||||
'limit_content' => $limit_content,
|
||||
'image_width' => $image_width,
|
||||
'image_height' => $image_height,
|
||||
'child_of' => pagelist_unqprfx_norm_params($child_of),
|
||||
'sort_order' => $sort_order,
|
||||
'sort_column' => $sort_column,
|
||||
'hierarchical' => $hierarchical,
|
||||
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
||||
'include' => $include,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
'authors' => $authors,
|
||||
'parent' => pagelist_unqprfx_norm_params($parent),
|
||||
'exclude_tree' => $exclude_tree,
|
||||
'number' => '', // $number - own counter
|
||||
'offset' => 0, // $offset - own offset
|
||||
'post_type' => $post_type,
|
||||
'post_status' => $post_status,
|
||||
'class' => $class,
|
||||
'strip_tags' => $strip_tags,
|
||||
'strip_shortcodes' => $strip_shortcodes,
|
||||
'show_child_count' => $show_child_count,
|
||||
'child_count_template' => $child_count_template,
|
||||
'show_meta_key' => $show_meta_key,
|
||||
'meta_template' => $meta_template
|
||||
);
|
||||
$page_list_ext_args_all = array(
|
||||
'show_image' => $show_image,
|
||||
'show_first_image' => $show_first_image,
|
||||
'show_title' => $show_title,
|
||||
'show_content' => $show_content,
|
||||
'more_tag' => $more_tag,
|
||||
'limit_content' => $limit_content,
|
||||
'image_width' => $image_width,
|
||||
'image_height' => $image_height,
|
||||
'child_of' => 0, // for showing all pages
|
||||
'sort_order' => $sort_order,
|
||||
'sort_column' => $sort_column,
|
||||
'hierarchical' => $hierarchical,
|
||||
'exclude' => pagelist_unqprfx_norm_params($exclude),
|
||||
'include' => $include,
|
||||
'meta_key' => $meta_key,
|
||||
'meta_value' => $meta_value,
|
||||
'authors' => $authors,
|
||||
'parent' => pagelist_unqprfx_norm_params($parent),
|
||||
'exclude_tree' => $exclude_tree,
|
||||
'number' => '', // $number - own counter
|
||||
'offset' => 0, // $offset - own offset
|
||||
'post_type' => $post_type,
|
||||
'post_status' => $post_status,
|
||||
'class' => $class,
|
||||
'strip_tags' => $strip_tags,
|
||||
'strip_shortcodes' => $strip_shortcodes,
|
||||
'show_child_count' => $show_child_count,
|
||||
'child_count_template' => $child_count_template,
|
||||
'show_meta_key' => $show_meta_key,
|
||||
'meta_template' => $meta_template
|
||||
);
|
||||
$list_pages = get_pages( $page_list_ext_args );
|
||||
if( count( $list_pages ) == 0 ){ // if there is no subpages
|
||||
$list_pages = get_pages( $page_list_ext_args_all ); // we are showing all pages
|
||||
}
|
||||
$list_pages_html = '';
|
||||
$count = 0;
|
||||
$offset_count = 0;
|
||||
if( $list_pages !== false && count( $list_pages ) > 0 ){
|
||||
foreach($list_pages as $page){
|
||||
$count++;
|
||||
$offset_count++;
|
||||
if ( !empty( $offset ) && is_numeric( $offset ) && $offset_count <= $offset ) {
|
||||
$count = 0; // number counter to zero if offset is not finished
|
||||
}
|
||||
if ( ( !empty( $offset ) && is_numeric( $offset ) && $offset_count > $offset ) || ( empty( $offset ) ) || ( !empty( $offset ) && !is_numeric( $offset ) ) ) {
|
||||
if ( ( !empty( $number ) && is_numeric( $number ) && $count <= $number ) || ( empty( $number ) ) || ( !empty( $number ) && !is_numeric( $number ) ) ) {
|
||||
$link = get_permalink( $page->ID );
|
||||
$list_pages_html .= '<div class="page-list-ext-item">';
|
||||
if( $show_image == 1 ){
|
||||
if ( function_exists( 'get_the_post_thumbnail' ) ) { // if we have WordPress 2.9+
|
||||
if( get_the_post_thumbnail( $page->ID ) ){ // if there is a featured image
|
||||
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
||||
//$list_pages_html .= get_the_post_thumbnail($page->ID, array($image_width,$image_height)); // doesn't work good with image size
|
||||
|
||||
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), array($image_width,$image_height) ); // get featured img; 'large'
|
||||
$img_url = $image[0]; // get the src of the featured image
|
||||
$list_pages_html .= '<img src="'.$img_url.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
||||
|
||||
$list_pages_html .= '</a></div> ';
|
||||
}else{
|
||||
if( $show_first_image == 1 ){
|
||||
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
||||
if( !empty( $img_scr ) ){
|
||||
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
||||
$list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" alt="'.esc_attr($page->post_title).'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
||||
$list_pages_html .= '</a></div> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{ // if we have old WordPress 2.8 or lower
|
||||
if( $show_first_image == 1 ){
|
||||
$img_scr = pagelist_unqprfx_get_first_image( $page->post_content );
|
||||
if( !empty( $img_scr ) ){
|
||||
$list_pages_html .= '<div class="page-list-ext-image"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">';
|
||||
$list_pages_html .= '<img src="'.$img_scr.'" width="'.$image_width.'" />'; // not using height="'.$image_height.'" because images could be not square shaped and they will be stretched
|
||||
$list_pages_html .= '</a></div> ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( $show_title == 1 ){
|
||||
$list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
|
||||
}
|
||||
if( $show_content == 1 ){
|
||||
//$content = apply_filters('the_content', $page->post_content);
|
||||
//$content = str_replace(']]>', ']]>', $content); // both used in default the_content() function
|
||||
|
||||
if( !empty( $page->post_excerpt ) ){
|
||||
$text_content = $page->post_excerpt;
|
||||
}else{
|
||||
$text_content = $page->post_content;
|
||||
}
|
||||
|
||||
if ( post_password_required($page) ) {
|
||||
$content = '<!-- password protected -->';
|
||||
}else{
|
||||
$content = pagelist_unqprfx_parse_content( $text_content, $limit_content, $strip_tags, $strip_shortcodes, $more_tag );
|
||||
$content = do_shortcode( $content );
|
||||
|
||||
if( $show_title == 0 ){ // make content as a link if there is no title
|
||||
$content = '<a href="'.$link.'">'.$content.'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$list_pages_html .= '<div class="page-list-ext-item-content">'.$content.'</div>';
|
||||
|
||||
}
|
||||
if( $show_child_count == 1 ){
|
||||
$count_subpages = count(get_pages("child_of=".$page->ID));
|
||||
if( $count_subpages > 0 ){ // hide empty
|
||||
$child_count_pos = strpos($child_count_template, '%child_count%'); // check if we have %child_count% marker in template
|
||||
if($child_count_pos === false) { // %child_count% not found in template
|
||||
$child_count_template_html = $child_count_template.' '.$count_subpages;
|
||||
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
||||
} else { // %child_count% found in template
|
||||
$child_count_template_html = str_replace('%child_count%', $count_subpages, $child_count_template);
|
||||
$list_pages_html .= '<div class="page-list-ext-child-count">'.$child_count_template_html.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if( $show_meta_key != '' ){
|
||||
$post_meta = get_post_meta($page->ID, $show_meta_key, true);
|
||||
if( !empty($post_meta) ){ // hide empty
|
||||
$meta_pos = strpos($meta_template, '%meta%'); // check if we have %meta% marker in template
|
||||
if($meta_pos === false) { // %meta% not found in template
|
||||
$meta_template_html = $meta_template.' '.$post_meta;
|
||||
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
||||
} else { // %meta% found in template
|
||||
$meta_template_html = str_replace('%meta%', $post_meta, $meta_template);
|
||||
$list_pages_html .= '<div class="page-list-ext-meta">'.$meta_template_html.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$list_pages_html .= '</div>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$return = $pagelist_unqprfx_powered_line;
|
||||
if ($list_pages_html) {
|
||||
$return .= '<div class="page-list page-list-ext '.$class.'">'."\n".$list_pages_html."\n".'</div>';
|
||||
}else{
|
||||
$return .= '<!-- no pages to show -->'; // this line will not work, because we show all pages if there is no pages to show
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
add_shortcode( 'pagelist_ext', 'pagelist_unqprfx_ext_shortcode' );
|
||||
add_shortcode( 'pagelistext', 'pagelist_unqprfx_ext_shortcode' );
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_norm_params') ) {
|
||||
function pagelist_unqprfx_norm_params( $str ) {
|
||||
global $post;
|
||||
$new_str = $str;
|
||||
$new_str = str_replace('this', $post->ID, $new_str); // exclude this page
|
||||
$new_str = str_replace('current', $post->ID, $new_str); // exclude current page
|
||||
$new_str = str_replace('curent', $post->ID, $new_str); // exclude curent page with mistake
|
||||
$new_str = str_replace('parent', $post->post_parent, $new_str); // exclude parent page
|
||||
return $new_str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_parse_content') ) {
|
||||
function pagelist_unqprfx_parse_content($content, $limit_content = 250, $strip_tags = 1, $strip_shortcodes = 1, $more_tag = 1) {
|
||||
|
||||
$more_tag_found = 0;
|
||||
$content_before_more_tag_length = 0;
|
||||
|
||||
if( $more_tag ){ // "more_tag" have higher priority than "limit_content"
|
||||
if ( preg_match('/<!--more(.*?)?-->/', $content, $matches) ) {
|
||||
$more_tag_found = 1;
|
||||
$more_tag = $matches[0];
|
||||
$content_temp = explode($matches[0], $content);
|
||||
$content_temp = $content_temp[0];
|
||||
$content_before_more_tag_length = strlen($content_temp);
|
||||
$content = substr_replace($content, '###more###', $content_before_more_tag_length, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// replace php and comments tags so they do not get stripped
|
||||
//$content = preg_replace("@<\?@", "#?#", $content);
|
||||
//$content = preg_replace("@<!--@", "#!--#", $content); // save html comments
|
||||
// strip tags normally
|
||||
//$content = strip_tags($content);
|
||||
if( $strip_tags ){
|
||||
$content = str_replace('</', ' </', $content); // <p>line1</p><p>line2</p> - adding space between lines
|
||||
$content = strip_tags($content); // ,'<p>'
|
||||
}
|
||||
// return php and comments tags to their origial form
|
||||
//$content = preg_replace("@#\?#@", "<?", $content);
|
||||
//$content = preg_replace("@#!--#@", "<!--", $content);
|
||||
|
||||
if( $strip_shortcodes ){
|
||||
$content = strip_shortcodes( $content );
|
||||
}
|
||||
|
||||
if( $more_tag && $more_tag_found ){ // "more_tag" have higher priority than "limit_content"
|
||||
$fake_more_pos = mb_strpos($content, '###more###', 0, 'UTF-8');
|
||||
if( $fake_more_pos === false ) {
|
||||
// substring not found in string and this is strange :)
|
||||
} else {
|
||||
$content = mb_substr($content, 0, $fake_more_pos, 'UTF-8');
|
||||
}
|
||||
}else{
|
||||
if( strlen($content) > $limit_content ){ // limiting content
|
||||
$pos = strpos($content, ' ', $limit_content); // find first space position
|
||||
if ($pos !== false) {
|
||||
$first_space_pos = $pos;
|
||||
}else{
|
||||
$first_space_pos = $limit_content;
|
||||
}
|
||||
$content = mb_substr($content, 0, $first_space_pos, 'UTF-8') . '...';
|
||||
}
|
||||
}
|
||||
|
||||
$output = force_balance_tags($content);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_get_first_image') ) {
|
||||
function pagelist_unqprfx_get_first_image( $content='' ) {
|
||||
$first_img = '';
|
||||
//ob_start();
|
||||
//ob_end_clean();
|
||||
$matchCount = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $content, $matches);
|
||||
if ( $matchCount !== 0 ) { // if we found first image
|
||||
$first_img = $matches[1][0];
|
||||
}
|
||||
return $first_img;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !function_exists('pagelist_unqprfx_plugin_meta') ) {
|
||||
function pagelist_unqprfx_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row
|
||||
if ( strpos( $file, 'sitemap.php' ) !== false ) {
|
||||
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/wordpress/plugins/page-list/" title="Plugin page">Page-list</a>' ) );
|
||||
$links = array_merge( $links, array( '<a href="http://web-profile.com.ua/donate/" title="Support the development">Donate</a>' ) );
|
||||
$links = array_merge( $links, array( '<a href="http://codecanyon.net/popular_item/by_category?category=wordpress&ref=webvitaly">WordPress Pro plugins</a>' ) );
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
add_filter( 'plugin_row_meta', 'pagelist_unqprfx_plugin_meta', 10, 2 );
|
||||
}
|
||||
Reference in New Issue
Block a user