@@ -69,7 +69,7 @@ |
||
69 | 69 | return "{$_aField['field_id']}{$_sKey}"; |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
72 | + /** |
|
73 | 73 | * Adds input fields |
74 | 74 | * |
75 | 75 | * @internal |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | '', |
36 | 36 | "[{$_sKey}]" |
37 | 37 | ); |
38 | - return $_aField['field_id'] . $_sKey; |
|
38 | + return $_aField[ 'field_id' ].$_sKey; |
|
39 | 39 | |
40 | 40 | } |
41 | 41 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | '', |
54 | 54 | "|{$_sKey}" |
55 | 55 | ); |
56 | - return "{$_aField['field_id']}{$_sKey}"; |
|
56 | + return "{$_aField[ 'field_id' ]}{$_sKey}"; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $_aOutput = array(); |
102 | 102 | |
103 | 103 | /* Set nonce. */ |
104 | - $_aOutput[] = wp_nonce_field( $this->oProp->sClassHash, $this->oProp->sClassHash, true, false ); |
|
104 | + $_aOutput[ ] = wp_nonce_field( $this->oProp->sClassHash, $this->oProp->sClassHash, true, false ); |
|
105 | 105 | |
106 | 106 | /* Set the option property array */ |
107 | 107 | // @todo Move _setOptionArray() to _replyToRegisterFormElements(). |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $this->_getFieldErrors(), |
114 | 114 | $this->oMsg |
115 | 115 | ); |
116 | - $_aOutput[] = $bRenderTableRow |
|
116 | + $_aOutput[ ] = $bRenderTableRow |
|
117 | 117 | ? $_oFieldsTable->getFieldsetRows( |
118 | 118 | $this->oForm->aConditionedFields[ '_default' ], |
119 | 119 | array( $this, '_replyToGetFieldOutput' ) |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | // @todo call the content() method. |
128 | 128 | $_sOutput = $this->oUtil->addAndApplyFilters( |
129 | 129 | $this, |
130 | - 'content_' . $this->oProp->sClassName, |
|
130 | + 'content_'.$this->oProp->sClassName, |
|
131 | 131 | implode( PHP_EOL, $_aOutput ) |
132 | 132 | ); |
133 | 133 | |
134 | 134 | /* Do action */ |
135 | 135 | $this->oUtil->addAndDoActions( |
136 | 136 | $this, |
137 | - 'do_' . $this->oProp->sClassName, |
|
137 | + 'do_'.$this->oProp->sClassName, |
|
138 | 138 | $this |
139 | 139 | ); |
140 | 140 | |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | public function _replyToPrintColumnCell( $vValue, $sColumnSlug, $sTermID ) { |
155 | 155 | |
156 | 156 | $_sCellHTML = ''; |
157 | - if ( isset( $_GET['taxonomy'] ) && $_GET['taxonomy'] ) { |
|
158 | - $_sCellHTML = $this->oUtil->addAndApplyFilter( $this, "cell_{$_GET['taxonomy']}", $vValue, $sColumnSlug, $sTermID ); |
|
157 | + if ( isset( $_GET[ 'taxonomy' ] ) && $_GET[ 'taxonomy' ] ) { |
|
158 | + $_sCellHTML = $this->oUtil->addAndApplyFilter( $this, "cell_{$_GET[ 'taxonomy' ]}", $vValue, $sColumnSlug, $sTermID ); |
|
159 | 159 | } |
160 | 160 | $_sCellHTML = $this->oUtil->addAndApplyFilter( $this, "cell_{$this->oProp->sClassName}", $_sCellHTML, $sColumnSlug, $sTermID ); |
161 | 161 | $_sCellHTML = $this->oUtil->addAndApplyFilter( $this, "cell_{$this->oProp->sClassName}_{$sColumnSlug}", $_sCellHTML, $sTermID ); // 3.0.2+ |
@@ -38,13 +38,13 @@ |
||
38 | 38 | * @since 3.5.0 |
39 | 39 | * @todo Examine the appropriate default capability level. |
40 | 40 | */ |
41 | - public function __construct( $sCapability='edit_user', $sTextDomain='admin-page-framework' ) { |
|
41 | + public function __construct( $sCapability = 'edit_user', $sTextDomain = 'admin-page-framework' ) { |
|
42 | 42 | |
43 | 43 | $this->oProp = new AdminPageFramework_Property_UserMeta( |
44 | - $this, // the caller object |
|
45 | - get_class( $this ), // the caller class name |
|
46 | - $sCapability, // the capability level |
|
47 | - $sTextDomain, // the text domain |
|
44 | + $this, // the caller object |
|
45 | + get_class( $this ), // the caller class name |
|
46 | + $sCapability, // the capability level |
|
47 | + $sTextDomain, // the text domain |
|
48 | 48 | self::$_sStructureType // the fields type |
49 | 49 | ); |
50 | 50 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @since 3.5.0 |
68 | 68 | */ |
69 | - public function enqueueStyles( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
69 | + public function enqueueStyles( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
70 | 70 | return $this->oResource->_enqueueStyles( $aSRCs, $aPostTypes, $aCustomArgs ); |
71 | 71 | } |
72 | 72 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @param array (optional) The argument array for more advanced parameters. |
90 | 90 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
91 | 91 | */ |
92 | - public function enqueueStyle( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
92 | + public function enqueueStyle( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
93 | 93 | return $this->oResource->_enqueueStyle( $sSRC, $aPostTypes, $aCustomArgs ); |
94 | 94 | } |
95 | 95 | /** |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @since 3.5.0 |
99 | 99 | */ |
100 | - public function enqueueScripts( $aSRCs, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
100 | + public function enqueueScripts( $aSRCs, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
101 | 101 | return $this->oResource->_enqueueScripts( $aSRCs, $aPostTypes, $aCustomArgs ); |
102 | 102 | } |
103 | 103 | /** |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @param array (optional) The argument array for more advanced parameters. |
133 | 133 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
134 | 134 | */ |
135 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
135 | + public function enqueueScript( $sSRC, $aPostTypes = array(), $aCustomArgs = array() ) { |
|
136 | 136 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
137 | 137 | } |
138 | 138 |
@@ -132,7 +132,7 @@ |
||
132 | 132 | * @param array (optional) The argument array for more advanced parameters. |
133 | 133 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
134 | 134 | */ |
135 | - public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
135 | + public function enqueueScript( $sSRC, $aPostTypes=array(), $aCustomArgs=array() ) { |
|
136 | 136 | return $this->oResource->_enqueueScript( $sSRC, $aPostTypes, $aCustomArgs ); |
137 | 137 | } |
138 | 138 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function _isInThePage() { |
47 | 47 | |
48 | - if ( ! $this->oProp->bIsAdmin ) { |
|
48 | + if ( !$this->oProp->bIsAdmin ) { |
|
49 | 49 | return false; |
50 | 50 | } |
51 | 51 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function _replyToDetermineToLoad( /* $oScreen */ ) { |
68 | 68 | |
69 | - if ( ! $this->_isInThePage() ) { |
|
69 | + if ( !$this->_isInThePage() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | $this->oUtil->addAndDoAction( $this, "set_up_{$this->oProp->sClassName}", $this ); |
77 | 77 | |
78 | 78 | // Hooks to display fields. |
79 | - add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
80 | - add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
81 | - add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
79 | + add_action( 'show_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
80 | + add_action( 'edit_user_profile', array( $this, '_replyToPrintFields' ) ); // profile.php |
|
81 | + add_action( 'user_new_form', array( $this, '_replyToPrintFields' ) ); // user-new.php |
|
82 | 82 | |
83 | 83 | // Hooks to save field values. |
84 | 84 | add_action( 'personal_options_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
85 | - add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
86 | - add_action('user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
85 | + add_action( 'edit_user_profile_update', array( $this, '_replyToSaveFieldValues' ) ); // profile.php |
|
86 | + add_action( 'user_register', array( $this, '_replyToSaveFieldValues' ) ); // user-new.php |
|
87 | 87 | |
88 | 88 | } |
89 | 89 |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | public function _replyToDetermineToLoad( /* $oScreen */ ) { |
68 | 68 | |
69 | - if ( ! $this->_isInThePage() ) { |
|
69 | + if ( ! $this->_isInThePage() ) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
|
45 | + public function __construct( $sWidgetTitle, $aWidgetArguments = array(), $sCapability = 'edit_theme_options', $sTextDomain = 'admin-page-framework' ) { |
|
46 | 46 | |
47 | 47 | if ( empty( $sWidgetTitle ) ) { |
48 | 48 | return; |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | // Properties |
52 | 52 | $this->oProp = new AdminPageFramework_Property_Widget( |
53 | - $this, // caller object |
|
54 | - null, // the caller script path |
|
55 | - get_class( $this ), // class name |
|
56 | - $sCapability, // capability |
|
57 | - $sTextDomain, // text domain |
|
53 | + $this, // caller object |
|
54 | + null, // the caller script path |
|
55 | + get_class( $this ), // class name |
|
56 | + $sCapability, // capability |
|
57 | + $sTextDomain, // text domain |
|
58 | 58 | self::$_sStructureType // fields type |
59 | 59 | ); |
60 | 60 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @package AdminPageFramework |
16 | 16 | * @subpackage Widget |
17 | 17 | */ |
18 | -abstract class AdminPageFramework_Widget extends AdminPageFramework_Widget_Controller { |
|
18 | +abstract class AdminPageFramework_Widget extends AdminPageFramework_Widget_Controller { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Defines the class object structure type. |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
46 | 46 | |
47 | - if ( empty( $sWidgetTitle ) ) { |
|
47 | + if ( empty( $sWidgetTitle ) ) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 |
@@ -25,19 +25,19 @@ |
||
25 | 25 | static protected $_sFieldsType = 'widget'; |
26 | 26 | |
27 | 27 | /** |
28 | - * The constructor of the class object. |
|
29 | - * |
|
30 | - * Registers necessary hooks and sets up internal properties. |
|
31 | - * |
|
32 | - * <h4>Example</h4> |
|
33 | - * <code> |
|
34 | - * new APF_Widget( __( 'Admin Page Framework', 'admin-page-framework-demo' ) ); // the widget title |
|
35 | - * new APF_Widget_CustomFieldTypes( __( 'APF - Advanced', 'admin-page-framework-demo' ) ); |
|
36 | - * new APF_Widget_Example( __( 'APF - GitHub Button', 'admin-page-framework-demo' ) ); |
|
37 | - * </code> |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
28 | + * The constructor of the class object. |
|
29 | + * |
|
30 | + * Registers necessary hooks and sets up internal properties. |
|
31 | + * |
|
32 | + * <h4>Example</h4> |
|
33 | + * <code> |
|
34 | + * new APF_Widget( __( 'Admin Page Framework', 'admin-page-framework-demo' ) ); // the widget title |
|
35 | + * new APF_Widget_CustomFieldTypes( __( 'APF - Advanced', 'admin-page-framework-demo' ) ); |
|
36 | + * new APF_Widget_Example( __( 'APF - GitHub Button', 'admin-page-framework-demo' ) ); |
|
37 | + * </code> |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | 41 | public function __construct( $sWidgetTitle, $aWidgetArguments=array(), $sCapability='edit_theme_options', $sTextDomain='admin-page-framework' ) { |
42 | 42 | |
43 | 43 | if ( empty( $sWidgetTitle ) ) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @subpackage Widget |
19 | 19 | * @internal |
20 | 20 | */ |
21 | -abstract class AdminPageFramework_Widget_Model extends AdminPageFramework_Widget_Router { |
|
21 | +abstract class AdminPageFramework_Widget_Model extends AdminPageFramework_Widget_Router { |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Sets up hooks and properties. |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | parent::__construct( $oProp ); |
32 | 32 | |
33 | - if ( did_action( 'widgets_init' ) ) { |
|
33 | + if ( did_action( 'widgets_init' ) ) { |
|
34 | 34 | add_action( "set_up_{$this->oProp->sClassName}", array( $this, '_replyToRegisterWidget' ), 20 ); |
35 | 35 | } else { |
36 | 36 | // set a lower priority to let the setUp method gets processed earlier. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return array |
55 | 55 | * @callback filter validation_{factory class name} |
56 | 56 | */ |
57 | - public function _replyToSortInputs( $aSubmittedFormData, $aStoredFormData, $oFactory ) { |
|
57 | + public function _replyToSortInputs( $aSubmittedFormData, $aStoredFormData, $oFactory ) { |
|
58 | 58 | // @todo examine whether stripslashes_deep() is necceary or not. |
59 | 59 | return $this->oForm->getSortedInputs( $aSubmittedFormData ); |
60 | 60 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | public function _replyToRegisterWidget() { |
112 | 112 | |
113 | 113 | global $wp_widget_factory; |
114 | - if ( ! is_object( $wp_widget_factory ) ) { |
|
114 | + if ( ! is_object( $wp_widget_factory ) ) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | |
40 | 40 | if ( $this->oProp->bIsAdmin ) { |
41 | 41 | add_filter( |
42 | - 'validation_' . $this->oProp->sClassName, |
|
42 | + 'validation_'.$this->oProp->sClassName, |
|
43 | 43 | array( $this, '_replyToSortInputs' ), |
44 | - 1, // set a high priority |
|
44 | + 1, // set a high priority |
|
45 | 45 | 3 // number of parameters |
46 | 46 | ); |
47 | 47 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | public function _replyToRegisterWidget() { |
94 | 94 | |
95 | 95 | global $wp_widget_factory; |
96 | - if ( ! is_object( $wp_widget_factory ) ) { |
|
96 | + if ( !is_object( $wp_widget_factory ) ) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function _registerFormElements( $aOptions ) { |
119 | 119 | |
120 | - $this->_loadFieldTypeDefinitions(); // defined in the framework factory class. |
|
120 | + $this->_loadFieldTypeDefinitions(); // defined in the framework factory class. |
|
121 | 121 | |
122 | 122 | // Set the internal options array. The framework refers this array when rendering the form. |
123 | 123 | $this->oProp->aOptions = $aOptions; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * @subpackage Widget |
17 | 17 | * @internal |
18 | 18 | */ |
19 | -abstract class AdminPageFramework_Widget_Router extends AdminPageFramework_Factory { |
|
19 | +abstract class AdminPageFramework_Widget_Router extends AdminPageFramework_Factory { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Determines whether the currently loaded page is of the post type page. |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * @package AdminPageFramework |
18 | 18 | * @subpackage Widget |
19 | 19 | */ |
20 | -abstract class AdminPageFramework_Widget_View extends AdminPageFramework_Widget_Model { |
|
20 | +abstract class AdminPageFramework_Widget_View extends AdminPageFramework_Widget_Model { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Filters the post type post content. |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @remark This class should be overridden in the extended class so that the user can display own contents. |
40 | 40 | * @since 3.2.0 |
41 | 41 | */ |
42 | - public function content( $sContent, $aArguments, $aFormData ) { |
|
42 | + public function content( $sContent, $aArguments, $aFormData ) { |
|
43 | 43 | return $sContent; |
44 | 44 | } |
45 | 45 |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | public function _printWidgetForm() { |
53 | 53 | |
54 | 54 | // Get the fields output. |
55 | - $_oFieldsTable = new AdminPageFramework_FormPart_Table( |
|
55 | + $_oFieldsTable = new AdminPageFramework_FormPart_Table( |
|
56 | 56 | $this->oProp->aFieldTypeDefinitions, |
57 | - $this->_getFieldErrors(), // defined in the factory model class. |
|
57 | + $this->_getFieldErrors(), // defined in the factory model class. |
|
58 | 58 | $this->oMsg |
59 | 59 | ); |
60 | 60 | |
61 | 61 | echo $_oFieldsTable->getFormTables( |
62 | 62 | $this->oForm->aConditionedSections, |
63 | 63 | $this->oForm->aConditionedFields, |
64 | - array( $this, '_replyToGetSectionHeaderOutput' ), // defined below |
|
64 | + array( $this, '_replyToGetSectionHeaderOutput' ), // defined below |
|
65 | 65 | array( $this, '_replyToGetFieldOutput' ) // defined in the factory view class. |
66 | 66 | ); |
67 | 67 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function _replyToGetSectionHeaderOutput( $sSectionDescription, $aSection ) { |
77 | 77 | return $this->oUtil->addAndApplyFilters( |
78 | 78 | $this, |
79 | - array( 'section_head_' . $this->oProp->sClassName . '_' . $aSection['section_id'] ), // section_ + {extended class name} + _ {section id} |
|
79 | + array( 'section_head_'.$this->oProp->sClassName.'_'.$aSection[ 'section_id' ] ), // section_ + {extended class name} + _ {section id} |
|
80 | 80 | $sSectionDescription |
81 | 81 | ); |
82 | 82 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Generates an HTML Table of Contents block. |
|
4 | - * |
|
5 | - * @package Admin Page Framework |
|
6 | - * @copyright Copyright (c) 2015, <Michael Uno> |
|
7 | - * @author Michael Uno |
|
8 | - * @authorurl http://michaeluno.jp |
|
9 | - */ |
|
3 | + * Generates an HTML Table of Contents block. |
|
4 | + * |
|
5 | + * @package Admin Page Framework |
|
6 | + * @copyright Copyright (c) 2015, <Michael Uno> |
|
7 | + * @author Michael Uno |
|
8 | + * @authorurl http://michaeluno.jp |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Generates an HTML Table of Contents block. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param integer $iDepth The header number to parse. |
32 | 32 | * @param string $sTitle The heading title which appears at the beginning of the output. |
33 | 33 | */ |
34 | - public function __construct( $sHTML, $iDepth=4, $sTitle='' ) { |
|
34 | + public function __construct( $sHTML, $iDepth = 4, $sTitle = '' ) { |
|
35 | 35 | |
36 | 36 | $this->sTitle = $sTitle; |
37 | 37 | $this->sHTML = $sHTML; |
@@ -64,26 +64,26 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function getTOC() { |
66 | 66 | |
67 | - $iDepth = $this->iDepth; |
|
67 | + $iDepth = $this->iDepth; |
|
68 | 68 | |
69 | 69 | // get the headings down to the specified depth |
70 | 70 | $this->sHTML = preg_replace_callback( |
71 | - '/<h[2-' . $iDepth . ']*[^>]*>.*?<\/h[2-' . $iDepth . ']>/i', |
|
71 | + '/<h[2-'.$iDepth.']*[^>]*>.*?<\/h[2-'.$iDepth.']>/i', |
|
72 | 72 | array( $this, '_replyToInsertNamedElement' ), |
73 | 73 | $this->sHTML |
74 | 74 | ); |
75 | 75 | |
76 | 76 | $_aOutput = array(); |
77 | - foreach( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
77 | + foreach ( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
78 | 78 | $_sMatch = strip_tags( $_sMatch, '<h1><h2><h3><h4><h5><h6><h7><h8>' ); |
79 | - $_sMatch = preg_replace( '/<h([1-' . $iDepth . '])>/', '<li class="toc$1"><a href="#toc_' . $_iIndex . '">', $_sMatch ); |
|
80 | - $_sMatch = preg_replace( '/<\/h[1-' . $iDepth . ']>/', '</a></li>', $_sMatch ); |
|
81 | - $_aOutput[] = $_sMatch; |
|
79 | + $_sMatch = preg_replace( '/<h([1-'.$iDepth.'])>/', '<li class="toc$1"><a href="#toc_'.$_iIndex.'">', $_sMatch ); |
|
80 | + $_sMatch = preg_replace( '/<\/h[1-'.$iDepth.']>/', '</a></li>', $_sMatch ); |
|
81 | + $_aOutput[ ] = $_sMatch; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // plug the results into appropriate HTML tags |
85 | 85 | $this->sTitle = $this->sTitle |
86 | - ? '<p class="toc-title">' . $this->sTitle . '</p>' |
|
86 | + ? '<p class="toc-title">'.$this->sTitle.'</p>' |
|
87 | 87 | : ''; |
88 | 88 | return '<div class="toc">' |
89 | 89 | . $this->sTitle |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | public function _replyToInsertNamedElement( $aMatches ) { |
98 | 98 | static $_icount = -1; |
99 | 99 | $_icount++; |
100 | - $this->_aMatches[] = $aMatches[ 0 ]; |
|
101 | - return "<span class='toc_header_link' id='toc_{$_icount}'></span>" . PHP_EOL |
|
100 | + $this->_aMatches[ ] = $aMatches[ 0 ]; |
|
101 | + return "<span class='toc_header_link' id='toc_{$_icount}'></span>".PHP_EOL |
|
102 | 102 | . $aMatches[ 0 ]; |
103 | 103 | } |
104 | 104 |