Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-20T09:50:06-05:00 http://www.primothemes.com/forums/feed.php?f=40&t=13051 2011-12-20T09:50:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=57782#p57782 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: December 20, 2011, 9:50 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 20th, 2011, 9:50 am


]]>
2011-12-07T01:03:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=55464#p55464 <![CDATA[s2Member v111206 / Source Code: s2member\i...]]>
s2Member v111206
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: December 7, 2011, 1:03 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 7th, 2011, 1:03 am


]]>
2011-11-05T19:26:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=51838#p51838 <![CDATA[s2Member v111105 / Source Code: s2member\i...]]>
s2Member v111105
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: November 5, 2011, 8:26 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — November 5th, 2011, 7:26 pm


]]>
2011-10-29T20:35:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=49933#p49933 <![CDATA[s2Member v111029 / Source Code: s2member\i...]]>
s2Member v111029
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: October 29, 2011, 9:35 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 29th, 2011, 8:35 pm


]]>
2011-10-17T15:39:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=47727#p47727 <![CDATA[s2Member v111017 / Source Code: s2member\i...]]>
s2Member v111017
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: October 17, 2011, 1:39 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 17th, 2011, 3:39 pm


]]>
2011-10-11T14:35:04-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=46128#p46128 <![CDATA[s2Member v111011 / Source Code: s2member\i...]]>
s2Member v111011
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: October 11, 2011, 12:35 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 11th, 2011, 2:35 pm


]]>
2011-10-03T15:47:28-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=44258#p44258 <![CDATA[s2Member v111003 / Source Code: s2member\i...]]>
s2Member v111003
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: October 3, 2011, 1:47 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:47 pm


]]>
2011-10-03T03:40:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=42965#p42965 <![CDATA[s2Member v111002 / Source Code: s2member\i...]]>
s2Member v111002
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: October 3, 2011, 1:40 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:40 am


]]>
2011-09-27T05:26:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=41211#p41211 <![CDATA[s2Member v110927 / Source Code: s2member\i...]]>
s2Member v110927
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: September 27, 2011, 3:26 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 27th, 2011, 5:26 am


]]>
2011-09-26T21:03:10-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=39967#p39967 <![CDATA[s2Member v110926 / Source Code: s2member\i...]]>
s2Member v110926
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: September 26, 2011, 7:03 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 26th, 2011, 9:03 pm


]]>
2011-09-17T16:20:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=38111#p38111 <![CDATA[s2Member v110915 / Source Code: s2member\i...]]>
s2Member v110915
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: September 17, 2011, 2:20 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 17th, 2011, 4:20 pm


]]>
2011-09-14T01:27:48-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=36692#p36692 <![CDATA[s2Member v110913 / Source Code: s2member\i...]]>
s2Member v110913
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: September 13, 2011, 11:27 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 14th, 2011, 1:27 am


]]>
2011-09-13T12:02:51-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=35420#p35420 <![CDATA[s2Member v110912 / Source Code: s2member\i...]]>
s2Member v110912
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: September 13, 2011, 10:02 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 13th, 2011, 12:02 pm


]]>
2011-08-15T14:13:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=31527#p31527 <![CDATA[s2Member v110815 / Source Code: s2member\i...]]>
s2Member v110815
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: August 15, 2011, 3:13 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\readmes.inc.php ?php /** * Readme file parsing. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\Readmes * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_readmes" ) ) { /** * Readme file parsing. * * @package s2Member\Readmes * @since 3.5 */ class c_ws_plugin__s2member_readmes { /** * Handles readme parsing. * * @package s2Member\Readmes * @since 3.5 * * @param str $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself. * When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt. * @param str $specific_section Optional. The title of a specific section to parse, instead of the entire file. * @param bool $_blank_targets Optional. Defaults to true. If false, no target attribute is used. * @param bool $process_wp_syntax Optional. Defaults to false. * If true, and WP Syntax is installed; it will be used to parse code samples. * @return str Parsed readme file, or a parsed readme file section; based on parameter configuration. */ public static function parse_readme ( $specific_path = FALSE , $specific_section = FALSE , $_blank_targets = TRUE , $process_wp_syntax = FALSE ) { if ( ! ( $path = $specific_path ) ) /* Was a specific path passed in? */ { $path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme.txt" ; $dev_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme-dev.txt" ; $path = ( file_exists ( $dev_path ) ) ? $dev_path : $path ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_parse_readme" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( file_exists ( $path ) ) /* Give hooks a chance. */ { $o_pcre = @ ini_get ( "pcre.backtrack_limit" ) ; @ ini_set ( "pcre.backtrack_limit" , 10000000 ) ; /**/ if ( ! function_exists ( "NC_Markdown" ) ) include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/markdown/nc-markdown.inc.php" ; /**/ $rm = file_get_contents ( $path ) ; /* Get readme.txt file contents. */ $mb = function_exists ( "mb_convert_encoding" ) ? @ mb_convert_encoding ( $rm , "UTF-8" ,@ mb_detect_encoding ( $rm , "WINDOWS-1252, UTF-8" ) ) : $rm ; $rm = ( $mb ) ? $mb : $rm ; /* Double check this, just in case conversion fails on an unpredicted charset. */ /**/ if ( $specific_section ) /* If we are ONLY parsing a specific section. This is a very useful way of pulling details out. */ { preg_match ( "/(\=\= )(" . preg_quote ( $specific_section , "/" ) . ")( \=\=)(.+?)([\r \n]+\=\= |$)/si" , $rm , $m ) ; /**/ if ( $rm = trim ( $m [ 4 ] ) ) /* Looking for a specific section, indicated by `$specific_section`. */ { $rm = preg_replace ( "/(\=\=\=)( )(.+?)( )(\=\=\=)/" , "h4 id=\"rm-specs\"Specifications/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Installation)( )(\=\=)/" , "h4 id=\"rm-installation\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Description)( )(\=\=)/" , "h4 id=\"rm-description\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Screenshots)( )(\=\=)/" , "h4 id=\"rm-screenshots\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Frequently Asked Questions)( )(\=\=)/" , "h4 id=\"rm-faqs\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Changelog)( )(\=\=)/" , "h4 id=\"rm-changelog\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(.+?)( )(\=\=)/" , "h4$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=)( )(.+?)( )(\=)/" , "h6$3/h6" , $rm ) ; /**/ $y1 = "/\[youtube http\:\/\/www\.youtube\.com\/view_play_list\?p\=(.+?)[\s\/]*?\]/i" ; $y2 = "/\[youtube http\:\/\/www\.youtube\.com\/watch\?v\=(.+?)[\s\/]*?\]/i" ; /**/ $rm = preg_replace ( $y1 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/p/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; $rm = preg_replace ( $y2 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/v/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; /**/ $rm = NC_Markdown ( $rm ) ; /* Parse out the Markdown syntax. */ /**/ $r1 = "/(\a)( href)/i" ; /* Modify all links. Assume nofollow. */ /**/ if ( $_blank_targets ) /* Modify all links. Always nofollow. ( with _blank targets ? ). */ $rm = preg_replace ( $r1 , "$1" . ' target="_blank" rel="nofollow external"' . "$2" , $rm ) ; else /* Otherwise, we don't need to set _blank targets. So external is removed also. */ $rm = preg_replace ( $r1 , "$1" . ' rel="nofollow"' . "$2" , $rm ) ; /**/ if ( $process_wp_syntax ) /* If we're processing precode tags for WP-Syntax. */ if ( function_exists ( "wp_syntax_before_filter" ) && function_exists ( "wp_syntax_before_filter" ) ) { $rm = preg_replace ( "/\pre\\code\/i" , 'pre lang="php" escaped="true"' , $rm ) ; $rm = preg_replace ( "/\\/code\\\/pre\/i" , '/pre' , $rm ) ; $rm = wp_syntax_after_filter (wp_syntax_before_filter ( $rm ) ) ; } } /**/ @ ini_set ( "pcre.backtrack_limit" , $o_pcre ) ; /**/ $readme = 'div class="readme"' . "\n" ; $readme .= $rm . "\n" ; /* Content. */ $readme .= '/div' . "\n" ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme" , $readme , get_defined_vars ( ) ) ; } else /* Otherwise, we're going for the entire readme file. Here we have lots of work to do. */ { $rm = preg_replace ( "/(\=\=\=)( )(.+?)( )(\=\=\=)/" , "h2 id=\"rm-specs\"Specifications/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Installation)( )(\=\=)/" , "h2 id=\"rm-installation\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Description)( )(\=\=)/" , "h2 id=\"rm-description\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Screenshots)( )(\=\=)/" , "h2 id=\"rm-screenshots\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Frequently Asked Questions)( )(\=\=)/" , "h2 id=\"rm-faqs\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Changelog)( )(\=\=)/" , "h2 id=\"rm-changelog\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(.+?)( )(\=\=)/" , "h2$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=)( )(.+?)( )(\=)/" , "h3$3/h3" , $rm ) ; /**/ $y1 = "/\[youtube http\:\/\/www\.youtube\.com\/view_play_list\?p\=(.+?)[\s\/]*?\]/i" ; $y2 = "/\[youtube http\:\/\/www\.youtube\.com\/watch\?v\=(.+?)[\s\/]*?\]/i" ; /**/ $rm = preg_replace ( $y1 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/p/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; $rm = preg_replace ( $y2 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/v/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; /**/ $rm = NC_Markdown ( $rm ) ; /* Parse out the Markdown syntax. */ /**/ $r1 = "/(\h2(.*?)\)(.+?)(\\/h2\)(.+?)(\h2(.*?)\|$)/si" ; $r2 = "/(\\/div\)(\h2(.*?)\)(.+?)(\\/h2\)(.+?)(\div class\=\"section\"\\h2(.*?)\|$)/si" ; $r3 = "/(\div class\=\"section\"\)(\h2 id\=\"rm-specs\"\)(Specifications)(\\/h2\)(\div class\=\"content\"\)(.+?)(\\/div\\\/div\)/sei" ; $r4 = "/(\div class\=\"section\"\)(\h2 id\=\"rm-screenshots\"\)(Screenshots)(\\/h2\)(\div class\=\"content\"\)(.+?)(\\/div\\\/div\)/sei" ; $r5 = "/(\a)( href)/i" ; /* Modify all links. Assume a nofollow relationship since destinations are unknown. */ /**/ $rm = preg_replace ( $r1 , 'div class="section"' . "$1 $3 $4" . 'div class="content"' . "$5" . '/div/div' . "$6" , $rm ) ; $rm = preg_replace ( $r2 , "$1" . 'div class="section"' . "$2 $4 $5" . 'div class="content"' . "$6" . '/div/div' . "$7" , $rm ) ; $rm = stripslashes ( preg_replace ( $r3 , "'$1 $2 $3 $4 $5'.c_ws_plugin__s2member_readmes::_parse_readme_specs('$6').'$7'" , $rm , 1 ) ) ; $rm = preg_replace ( $r4 , "" , $rm , 1 ) ; /* Here we just remove the screenshots completely. */ /**/ if ( $_blank_targets ) /* Modify all links. Always nofollow. ( with _blank targets ? ). */ $rm = preg_replace ( $r5 , "$1" . ' target="_blank" rel="nofollow external"' . "$2" , $rm ) ; else /* Otherwise, we don't need to set _blank targets. So external is removed also. */ $rm = preg_replace ( $r5 , "$1" . ' rel="nofollow"' . "$2" , $rm ) ; /**/ if ( $process_wp_syntax ) /* If we're processing precode tags for WP-Syntax. */ if ( function_exists ( "wp_syntax_before_filter" ) && function_exists ( "wp_syntax_before_filter" ) ) { $rm = preg_replace ( "/\pre\\code\/i" , 'pre lang="php" escaped="true"' , $rm ) ; $rm = preg_replace ( "/\\/code\\\/pre\/i" , '/pre' , $rm ) ; $rm = wp_syntax_after_filter (wp_syntax_before_filter ( $rm ) ) ; } /**/ @ ini_set ( "pcre.backtrack_limit" , $o_pcre ) ; /**/ $readme = 'div class="readme"' . "\n" ; $readme .= $rm . "\n" ; /* Content. */ $readme .= '/div' . "\n" ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme" , $readme , get_defined_vars ( ) ) ; } } else /* Just in case readme.txt was deleted by the site owner. */ { return "Unable to parse /readme.txt." ; } } /** * Callback parses specs in a readme file. * * @package s2Member\Readmes * @since 3.5 * * @param str $str A string *( i.e. the specs section )*. * @return str Parsed specs. With HTML markup for list item display. */ public static function _parse_readme_specs ( $str = FALSE ) { do_action ( "_ws_plugin__s2member_before_parse_readme_specs" , get_defined_vars ( ) ) ; /**/ $str = preg_replace ( "/(\p\|^)(.+?)(\:)( )(.+?)($|\\/p\)/mi" , "$1" . 'listrong' . "$2" . '/strong' . "$3" . '    code' . "$5" . '/code/li' . "$6" , $str ) ; $str = preg_replace ( "/\p\\li\/i" , 'ulli' , $str ) ; /* Open the list items. */ $str = preg_replace ( "/\\/li\\\/p\/i" , '/li/ulbr /' , $str ) ; /**/ return apply_filters ( "_ws_plugin__s2member_parse_readme_specs" , $str , get_defined_vars ( ) ) ; } /** * Parses readme specification keys. * * @package s2Member\Readmes * @since 3.5 * * @param str $key A key *( within the specs section )*. * @param str $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself. * When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt. * @return str|bool The value of the key, else false if not found. */ public static function parse_readme_value ( $key = FALSE , $specific_path = FALSE ) { static $readme = array ( ) ; /* For repeated lookups. */ /**/ if ( ! ( $path = $specific_path ) ) /* Was a specific path passed in? */ { $path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme.txt" ; $dev_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme-dev.txt" ; $path = ( file_exists ( $dev_path ) ) ? $dev_path : $path ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_parse_readme_value" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ! empty ( $readme [ $path ] ) || file_exists ( $path ) ) { if ( empty ( $readme [ $path ] ) ) /* If not already opened. */ { $readme [ $path ] = file_get_contents ( $path ) ; /* Get readme.txt file contents. */ $mb = function_exists ( "mb_convert_encoding" ) ? @ mb_convert_encoding ( $readme [ $path ] , "UTF-8" ,@ mb_detect_encoding ( $readme [ $path ] , "WINDOWS-1252, UTF-8" ) ) : $readme [ $path ] ; $readme [ $path ] = ( $mb ) ? $mb : $readme [ $path ] ; /* Double check this, just in case conversion fails on an unpredicted charset. */ } /**/ preg_match ( "/(^)(" . preg_quote ( $key , "/" ) . ")(\:)( )(.+?)($)/m" , $readme [ $path ] , $m ) ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme_value" , ( ( isset ( $m [ 5 ] ) && strlen ( $m [ 5 ] = trim ( $m [ 5 ] ) ) ) ? $m [ 5 ] : false ) , get_defined_vars ( ) ) ; } else /* Nope. */ return false ; } } } ? [ full view ]s2member\includes\classes\readmes.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — August 15th, 2011, 2:13 pm


]]>
2011-07-11T17:29:16-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=27714#p27714 <![CDATA[s2Member v110710 / Source Code: s2member\i...]]>
s2Member v110710
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: July 11, 2011, 6:29 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\readmes.inc.php ?php /** * Readme file parsing. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\Readmes * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_readmes" ) ) { /** * Readme file parsing. * * @package s2Member\Readmes * @since 3.5 */ class c_ws_plugin__s2member_readmes { /** * Handles readme parsing. * * @package s2Member\Readmes * @since 3.5 * * @param str $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself. * When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt. * @param str $specific_section Optional. The title of a specific section to parse, instead of the entire file. * @param bool $_blank_targets Optional. Defaults to true. If false, no target attribute is used. * @param bool $process_wp_syntax Optional. Defaults to false. * If true, and WP Syntax is installed; it will be used to parse code samples. * @return str Parsed readme file, or a parsed readme file section; based on parameter configuration. */ public static function parse_readme ( $specific_path = FALSE , $specific_section = FALSE , $_blank_targets = TRUE , $process_wp_syntax = FALSE ) { if ( ! ( $path = $specific_path ) ) /* Was a specific path passed in? */ { $path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme.txt" ; $dev_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme-dev.txt" ; $path = ( file_exists ( $dev_path ) ) ? $dev_path : $path ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_parse_readme" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( file_exists ( $path ) ) /* Give hooks a chance. */ { $o_pcre = @ ini_get ( "pcre.backtrack_limit" ) ; @ ini_set ( "pcre.backtrack_limit" , 10000000 ) ; /**/ if ( ! function_exists ( "NC_Markdown" ) ) include_once dirname ( dirname ( __FILE__ ) ) . "/_xtnls/markdown/nc-markdown.inc.php" ; /**/ $rm = file_get_contents ( $path ) ; /* Get readme.txt file contents. */ $mb = function_exists ( "mb_convert_encoding" ) ? @ mb_convert_encoding ( $rm , "UTF-8" ,@ mb_detect_encoding ( $rm , "WINDOWS-1252, UTF-8" ) ) : $rm ; $rm = ( $mb ) ? $mb : $rm ; /* Double check this, just in case conversion fails on an unpredicted charset. */ /**/ if ( $specific_section ) /* If we are ONLY parsing a specific section. This is a very useful way of pulling details out. */ { preg_match ( "/(\=\= )(" . preg_quote ( $specific_section , "/" ) . ")( \=\=)(.+?)([\r \n]+\=\= |$)/si" , $rm , $m ) ; /**/ if ( $rm = trim ( $m [ 4 ] ) ) /* Looking for a specific section, indicated by `$specific_section`. */ { $rm = preg_replace ( "/(\=\=\=)( )(.+?)( )(\=\=\=)/" , "h4 id=\"rm-specs\"Specifications/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Installation)( )(\=\=)/" , "h4 id=\"rm-installation\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Description)( )(\=\=)/" , "h4 id=\"rm-description\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Screenshots)( )(\=\=)/" , "h4 id=\"rm-screenshots\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Frequently Asked Questions)( )(\=\=)/" , "h4 id=\"rm-faqs\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Changelog)( )(\=\=)/" , "h4 id=\"rm-changelog\"$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(.+?)( )(\=\=)/" , "h4$3/h4" , $rm ) ; $rm = preg_replace ( "/(\=)( )(.+?)( )(\=)/" , "h6$3/h6" , $rm ) ; /**/ $y1 = "/\[youtube http\:\/\/www\.youtube\.com\/view_play_list\?p\=(.+?)[\s\/]*?\]/i" ; $y2 = "/\[youtube http\:\/\/www\.youtube\.com\/watch\?v\=(.+?)[\s\/]*?\]/i" ; /**/ $rm = preg_replace ( $y1 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/p/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; $rm = preg_replace ( $y2 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/v/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; /**/ $rm = NC_Markdown ( $rm ) ; /* Parse out the Markdown syntax. */ /**/ $r1 = "/(\a)( href)/i" ; /* Modify all links. Assume nofollow. */ /**/ if ( $_blank_targets ) /* Modify all links. Always nofollow. ( with _blank targets ? ). */ $rm = preg_replace ( $r1 , "$1" . ' target="_blank" rel="nofollow external"' . "$2" , $rm ) ; else /* Otherwise, we don't need to set _blank targets. So external is removed also. */ $rm = preg_replace ( $r1 , "$1" . ' rel="nofollow"' . "$2" , $rm ) ; /**/ if ( $process_wp_syntax ) /* If we're processing precode tags for WP-Syntax. */ if ( function_exists ( "wp_syntax_before_filter" ) && function_exists ( "wp_syntax_before_filter" ) ) { $rm = preg_replace ( "/\pre\\code\/i" , 'pre lang="php" escaped="true"' , $rm ) ; $rm = preg_replace ( "/\\/code\\\/pre\/i" , '/pre' , $rm ) ; $rm = wp_syntax_after_filter (wp_syntax_before_filter ( $rm ) ) ; } } /**/ @ ini_set ( "pcre.backtrack_limit" , $o_pcre ) ; /**/ $readme = 'div class="readme"' . "\n" ; $readme .= $rm . "\n" ; /* Content. */ $readme .= '/div' . "\n" ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme" , $readme , get_defined_vars ( ) ) ; } else /* Otherwise, we're going for the entire readme file. Here we have lots of work to do. */ { $rm = preg_replace ( "/(\=\=\=)( )(.+?)( )(\=\=\=)/" , "h2 id=\"rm-specs\"Specifications/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Installation)( )(\=\=)/" , "h2 id=\"rm-installation\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Description)( )(\=\=)/" , "h2 id=\"rm-description\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Screenshots)( )(\=\=)/" , "h2 id=\"rm-screenshots\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Frequently Asked Questions)( )(\=\=)/" , "h2 id=\"rm-faqs\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(Changelog)( )(\=\=)/" , "h2 id=\"rm-changelog\"$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=\=)( )(.+?)( )(\=\=)/" , "h2$3/h2" , $rm ) ; $rm = preg_replace ( "/(\=)( )(.+?)( )(\=)/" , "h3$3/h3" , $rm ) ; /**/ $y1 = "/\[youtube http\:\/\/www\.youtube\.com\/view_play_list\?p\=(.+?)[\s\/]*?\]/i" ; $y2 = "/\[youtube http\:\/\/www\.youtube\.com\/watch\?v\=(.+?)[\s\/]*?\]/i" ; /**/ $rm = preg_replace ( $y1 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/p/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; $rm = preg_replace ( $y2 , 'embed type="application/x-shockwave-flash" src="//www.youtube.com/v/$1?version=3&hd=1&fs=1&rel=0" style="width:320px; height:210px; float:right; margin:0 0 15px 15px;" allowscriptaccess="always" allowfullscreen="true"/embed' , $rm ) ; /**/ $rm = NC_Markdown ( $rm ) ; /* Parse out the Markdown syntax. */ /**/ $r1 = "/(\h2(.*?)\)(.+?)(\\/h2\)(.+?)(\h2(.*?)\|$)/si" ; $r2 = "/(\\/div\)(\h2(.*?)\)(.+?)(\\/h2\)(.+?)(\div class\=\"section\"\\h2(.*?)\|$)/si" ; $r3 = "/(\div class\=\"section\"\)(\h2 id\=\"rm-specs\"\)(Specifications)(\\/h2\)(\div class\=\"content\"\)(.+?)(\\/div\\\/div\)/sei" ; $r4 = "/(\div class\=\"section\"\)(\h2 id\=\"rm-screenshots\"\)(Screenshots)(\\/h2\)(\div class\=\"content\"\)(.+?)(\\/div\\\/div\)/sei" ; $r5 = "/(\a)( href)/i" ; /* Modify all links. Assume a nofollow relationship since destinations are unknown. */ /**/ $rm = preg_replace ( $r1 , 'div class="section"' . "$1 $3 $4" . 'div class="content"' . "$5" . '/div/div' . "$6" , $rm ) ; $rm = preg_replace ( $r2 , "$1" . 'div class="section"' . "$2 $4 $5" . 'div class="content"' . "$6" . '/div/div' . "$7" , $rm ) ; $rm = stripslashes ( preg_replace ( $r3 , "'$1 $2 $3 $4 $5'.c_ws_plugin__s2member_readmes::_parse_readme_specs('$6').'$7'" , $rm , 1 ) ) ; $rm = preg_replace ( $r4 , "" , $rm , 1 ) ; /* Here we just remove the screenshots completely. */ /**/ if ( $_blank_targets ) /* Modify all links. Always nofollow. ( with _blank targets ? ). */ $rm = preg_replace ( $r5 , "$1" . ' target="_blank" rel="nofollow external"' . "$2" , $rm ) ; else /* Otherwise, we don't need to set _blank targets. So external is removed also. */ $rm = preg_replace ( $r5 , "$1" . ' rel="nofollow"' . "$2" , $rm ) ; /**/ if ( $process_wp_syntax ) /* If we're processing precode tags for WP-Syntax. */ if ( function_exists ( "wp_syntax_before_filter" ) && function_exists ( "wp_syntax_before_filter" ) ) { $rm = preg_replace ( "/\pre\\code\/i" , 'pre lang="php" escaped="true"' , $rm ) ; $rm = preg_replace ( "/\\/code\\\/pre\/i" , '/pre' , $rm ) ; $rm = wp_syntax_after_filter (wp_syntax_before_filter ( $rm ) ) ; } /**/ @ ini_set ( "pcre.backtrack_limit" , $o_pcre ) ; /**/ $readme = 'div class="readme"' . "\n" ; $readme .= $rm . "\n" ; /* Content. */ $readme .= '/div' . "\n" ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme" , $readme , get_defined_vars ( ) ) ; } } else /* Just in case readme.txt was deleted by the site owner. */ { return "Unable to parse /readme.txt." ; } } /** * Callback parses specs in a readme file. * * @package s2Member\Readmes * @since 3.5 * * @param str $str A string *( i.e. the specs section )*. * @return str Parsed specs. With HTML markup for list item display. */ public static function _parse_readme_specs ( $str = FALSE ) { do_action ( "_ws_plugin__s2member_before_parse_readme_specs" , get_defined_vars ( ) ) ; /**/ $str = preg_replace ( "/(\p\|^)(.+?)(\:)( )(.+?)($|\\/p\)/mi" , "$1" . 'listrong' . "$2" . '/strong' . "$3" . '    code' . "$5" . '/code/li' . "$6" , $str ) ; $str = preg_replace ( "/\p\\li\/i" , 'ulli' , $str ) ; /* Open the list items. */ $str = preg_replace ( "/\\/li\\\/p\/i" , '/li/ulbr /' , $str ) ; /**/ return apply_filters ( "_ws_plugin__s2member_parse_readme_specs" , $str , get_defined_vars ( ) ) ; } /** * Parses readme specification keys. * * @package s2Member\Readmes * @since 3.5 * * @param str $key A key *( within the specs section )*. * @param str $specific_path Optional. Path to a specific readme file to parse. Defaults to that of the software itself. * When/if a readme-dev.txt file is available, that will be used instead of the default readme.txt. * @return str|bool The value of the key, else false if not found. */ public static function parse_readme_value ( $key = FALSE , $specific_path = FALSE ) { static $readme = array ( ) ; /* For repeated lookups. */ /**/ if ( ! ( $path = $specific_path ) ) /* Was a specific path passed in? */ { $path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme.txt" ; $dev_path = dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/readme-dev.txt" ; $path = ( file_exists ( $dev_path ) ) ? $dev_path : $path ; } /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_parse_readme_value" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ! empty ( $readme [ $path ] ) || file_exists ( $path ) ) { if ( empty ( $readme [ $path ] ) ) /* If not already opened. */ { $readme [ $path ] = file_get_contents ( $path ) ; /* Get readme.txt file contents. */ $mb = function_exists ( "mb_convert_encoding" ) ? @ mb_convert_encoding ( $readme [ $path ] , "UTF-8" ,@ mb_detect_encoding ( $readme [ $path ] , "WINDOWS-1252, UTF-8" ) ) : $readme [ $path ] ; $readme [ $path ] = ( $mb ) ? $mb : $readme [ $path ] ; /* Double check this, just in case conversion fails on an unpredicted charset. */ } /**/ preg_match ( "/(^)(" . preg_quote ( $key , "/" ) . ")(\:)( )(.+?)($)/m" , $readme [ $path ] , $m ) ; /**/ return apply_filters ( "ws_plugin__s2member_parse_readme_value" , ( ( isset ( $m [ 5 ] ) && strlen ( $m [ 5 ] = trim ( $m [ 5 ] ) ) ) ? $m [ 5 ] : false ) , get_defined_vars ( ) ) ; } else /* Nope. */ return false ; } } } ? [ full view ]s2member\includes\classes\readmes.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — July 11th, 2011, 5:29 pm


]]>
2011-07-09T06:09:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13051&p=25346#p25346 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\readmes.inc.php
Docs updated: December 20, 2011, 9:50 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — July 9th, 2011, 6:09 am


]]>