Completed
Branch dev (0dacc7)
by
unknown
04:36
created
admin-page-framework-loader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class AdminPageFrameworkLoader_Registry_Base {
18 18
 
19
-    const VERSION        = '3.8.6b02';    // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
19
+    const VERSION        = '3.8.6b02'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
20 20
     const NAME           = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing.
21
-    const SHORTNAME      = 'Admin Page Framework';  // used for a menu title etc.
21
+    const SHORTNAME      = 'Admin Page Framework'; // used for a menu title etc.
22 22
     const DESCRIPTION    = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.';
23 23
     const URI            = 'http://admin-page-framework.michaeluno.jp/';
24 24
     const AUTHOR         = 'miunosoft (Michael Uno)';
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
      * @remark      This is also accessed from `uninstall.php` so do not remove.
56 56
      * @remark      Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added.
57 57
      */
58
-    const TRANSIENT_PREFIX         = 'APFL_';
58
+    const TRANSIENT_PREFIX = 'APFL_';
59 59
 
60 60
     /**
61 61
      * The hook slug used for the prefix of action and filter hook names.
62 62
      * 
63 63
      * @remark      The ending underscore is not necessary.
64 64
      */
65
-    const HOOK_SLUG                = 'admin_page_framework_loader';
65
+    const HOOK_SLUG = 'admin_page_framework_loader';
66 66
 
67 67
     /**
68 68
      * The text domain slug and its path.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     static public $aAdminPages = array(
118 118
         // key => 'page slug'
119
-        'about'     => 'apfl_about',        // the welcome page
119
+        'about'     => 'apfl_about', // the welcome page
120 120
         'addon'     => 'apfl_addons',
121 121
         'tool'      => 'apfl_tools',
122 122
         'help'      => 'apfl_contact',
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
      * @since       3.5.0
155 155
      * @return      string
156 156
      */
157
-    public static function getPluginURL( $sRelativePath='' ) {
157
+    public static function getPluginURL( $sRelativePath = '' ) {
158 158
         if ( isset( self::$_sPluginURLCache ) ) {
159
-            return self::$_sPluginURLCache . $sRelativePath;
159
+            return self::$_sPluginURLCache.$sRelativePath;
160 160
         }
161 161
         self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) );
162
-        return self::$_sPluginURLCache . $sRelativePath;
162
+        return self::$_sPluginURLCache.$sRelativePath;
163 163
     }
164 164
         /**
165 165
          * @since       3.7.9
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
      * @since       3.5.0
190 190
      * @return      void
191 191
      */ 
192
-    static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) {
193
-        if ( ! is_admin() ) {  
192
+    static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) {
193
+        if ( !is_admin() ) {  
194 194
             return; 
195 195
         }
196
-        self::$_aAdminNotices[] = array(
196
+        self::$_aAdminNotices[ ] = array(
197 197
             'message'           => $sMessage,
198
-            'class_attribute'   => trim( $sClassAttribute ) . ' notice is-dismissible',
198
+            'class_attribute'   => trim( $sClassAttribute ).' notice is-dismissible',
199 199
         );
200 200
         add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) );
201 201
     }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
          * @return      void
206 206
          */
207 207
         static public function _replyToSetAdminNotice() {
208
-            foreach( self::$_aAdminNotices as $_aAdminNotice ) {
209
-                echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>"
208
+            foreach ( self::$_aAdminNotices as $_aAdminNotice ) {
209
+                echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>"
210 210
                         ."<p>"
211 211
                             . sprintf(
212
-                                '<strong>%1$s</strong>: ' . $_aAdminNotice['message'],
213
-                                self::NAME . ' ' . self::VERSION
212
+                                '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ],
213
+                                self::NAME.' '.self::VERSION
214 214
                             )
215 215
                         . "</p>"
216 216
                     . "</div>";
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 AdminPageFrameworkLoader_Registry::setUp( __FILE__ );
223 223
 
224 224
 // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file.
225
-if ( ! defined( 'ABSPATH' ) ) {
225
+if ( !defined( 'ABSPATH' ) ) {
226 226
     return;
227 227
 }
228 228
 if ( defined( 'DOING_UNINSTALL' ) ) {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 
235 235
     $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false );
236 236
     if (
237
-        ! $_bFrameworkLoaded
238
-        || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
237
+        !$_bFrameworkLoaded
238
+        || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
239 239
         || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' )
240 240
     ) {
241 241
         AdminPageFrameworkLoader_Registry::setAdminNotice(
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' );
254 254
 
255 255
 // Include the library file - the development version will be available if you cloned the GitHub repository.
256
-$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php';
256
+$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php';
257 257
 $_bDebugMode              = defined( 'WP_DEBUG' ) && WP_DEBUG;
258 258
 $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath );
259 259
 include(
260 260
     $_bLoadDevelopmentVersion
261 261
         ? $_sDevelopmentVersionPath
262
-        : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php'
262
+        : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php'
263 263
 );
264 264
 
265 265
 // Include the framework loader plugin components.
266 266
 include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] );
267
-include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
267
+include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
268 268
 new AdminPageFrameworkLoader_Bootstrap(
269 269
     AdminPageFrameworkLoader_Registry::$sFilePath,
270 270
     AdminPageFrameworkLoader_Registry::HOOK_SLUG    // hook prefix
Please login to merge, or discard this patch.
AdminPageFrameworkLoader_AdminPage_Tool_Generator_CustomFieldTypes.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                     'class_name'           => 'AceCustomFieldType',
89 89
                     'label'                => __( 'ACE', 'admin-page-framework-loader' ),
90 90
                     'description'          => __( 'provides code syntax highlighting in a text area field.', 'admin-page-framework-loader' ),
91
-                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath . '/example/library/ace-custom-field-type',
91
+                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath.'/example/library/ace-custom-field-type',
92 92
                     'archive_file_path'    => 'custom-field-types/ace-custom-field-type/AceCustomFieldType.php',
93 93
                     'archive_dir_path'     => 'custom-field-types/ace-custom-field-type',
94 94
                     'text_domain'          => 'admin-page-framework',
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                     'class_name'           => 'GitHubCustomFieldType',
98 98
                     'label'                => __( 'GitHub Buttons', 'admin-page-framework-loader' ),
99 99
                     'description'          => __( 'allows you to display GitHub buttons in a field.', 'admin-page-framework-loader' ),
100
-                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath . '/include/library/github-custom-field-type',
100
+                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath.'/include/library/github-custom-field-type',
101 101
                     'archive_file_path'    => 'custom-field-types/github-custom-field-type/GitHubCustomFieldType.php',
102 102
                     'archive_dir_path'     => 'custom-field-types/github-custom-field-type',
103 103
                     'text_domain'          => 'admin-page-framework',
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     'class_name'           => 'PathCustomFieldType',
107 107
                     'label'                => __( 'Path', 'admin-page-framework-loader' ),
108 108
                     'description'          => __( 'allows the user to select a file path on the server.', 'admin-page-framework-loader' ),
109
-                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath . '/example/library/path-custom-field-type',
109
+                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath.'/example/library/path-custom-field-type',
110 110
                     'archive_file_path'    => 'custom-field-types/path-custom-field-type/PathCustomFieldType.php',
111 111
                     'archive_dir_path'     => 'custom-field-types/path-custom-field-type',
112 112
                     'text_domain'          => 'admin-page-framework',
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                     'class_name'           => 'ToggleCustomFieldType',
116 116
                     'label'                => __( 'Toggle', 'admin-page-framework-loader' ),
117 117
                     'description'          => __( 'allows the user to switch a button.', 'admin-page-framework-loader' ),
118
-                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath . '/example/library/toggle-custom-field-type',
118
+                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath.'/example/library/toggle-custom-field-type',
119 119
                     'archive_file_path'    => 'custom-field-types/toggle-custom-field-type/ToggleCustomFieldType.php',
120 120
                     'archive_dir_path'     => 'custom-field-types/toggle-custom-field-type',
121 121
                     'text_domain'          => 'admin-page-framework',
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     'class_name'           => 'NoUISliderCustomFieldType',
125 125
                     'label'                => __( 'NoUISlider (Range Slider)', 'admin-page-framework-loader' ),
126 126
                     'description'          => __( 'allows the user to set values in ranges.', 'admin-page-framework-loader' ),
127
-                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath . '/example/library/nouislider-custom-field-type',
127
+                    'directory_path'       => AdminPageFrameworkLoader_Registry::$sDirPath.'/example/library/nouislider-custom-field-type',
128 128
                     'archive_file_path'    => 'custom-field-types/nouislider-custom-field-type/NoUISliderCustomFieldType.php',
129 129
                     'archive_dir_path'     => 'custom-field-types/nouislider-custom-field-type',
130 130
                     'text_domain'          => 'admin-page-framework',
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
                 
134 134
             // Let third-party scripts add custom field types.
135 135
             $this->aCustomFieldTypes = apply_filters(
136
-                AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_custom_field_types',
136
+                AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_custom_field_types',
137 137
                 $this->aCustomFieldTypes
138 138
             );                    
139 139
             
140
-            foreach( $this->aCustomFieldTypes as $_sKey => $_aCustomFieldType ) {
140
+            foreach ( $this->aCustomFieldTypes as $_sKey => $_aCustomFieldType ) {
141 141
                 $this->aCustomFieldTypeLabels[ $_sKey ] = $_aCustomFieldType[ 'label' ]
142
-                    . ' - <span class="description">' . $_aCustomFieldType[ 'description' ] . '</span>';
142
+                    . ' - <span class="description">'.$_aCustomFieldType[ 'description' ].'</span>';
143 143
             }
144 144
      
145 145
         }
@@ -155,10 +155,10 @@  discard block
 block discarded – undo
155 155
 
156 156
                 // Check the file extension.
157 157
                 $_aAllowedExtensions = apply_filters(
158
-                    AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_allowed_file_extensions',
158
+                    AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_allowed_file_extensions',
159 159
                     array( 'php', 'css', 'js' )
160 160
                 );                
161
-                if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) {
161
+                if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) {
162 162
                     return $sFileContents;
163 163
                 }            
164 164
                 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 private function _getModifiedInclusionList( $sFileContents ) {
189 189
                     return str_replace(
190 190
                         ');', // search
191
-                        $this->_getClassListOfCustomFieldTypes() . ');', // replace - @todo insert the selected class list here
191
+                        $this->_getClassListOfCustomFieldTypes().');', // replace - @todo insert the selected class list here
192 192
                         $sFileContents // subject
193 193
                     );
194 194
                 }
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
                             $_POST,
206 206
                             array( 
207 207
                                 $this->oFactory->oProp->sOptionKey, 
208
-                                'generator',    // section id
208
+                                'generator', // section id
209 209
                                 'class_prefix'  // field id
210 210
                             ),
211 211
                             ''
212 212
                         );
213 213
                         $_aOutput = array();
214
-                        foreach( $_aCheckedCustomFieldTypes as $_sClassName => $_aCustomFieldType ) {
215
-                            $_aOutput[] = '    "' . $_sClassPrefix . $_sClassName . '"'
214
+                        foreach ( $_aCheckedCustomFieldTypes as $_sClassName => $_aCustomFieldType ) {
215
+                            $_aOutput[ ] = '    "'.$_sClassPrefix.$_sClassName.'"'
216 216
                                 . ' => ' 
217
-                                . 'AdminPageFramework_Registry::$sDirPath . ' . '"/' . ltrim( $_aCustomFieldType[ 'archive_file_path' ], '/' ) . '",';
217
+                                . 'AdminPageFramework_Registry::$sDirPath . '.'"/'.ltrim( $_aCustomFieldType[ 'archive_file_path' ], '/' ).'",';
218 218
                         }
219
-                        return implode( PHP_EOL, $_aOutput ) . PHP_EOL;
219
+                        return implode( PHP_EOL, $_aOutput ).PHP_EOL;
220 220
                     
221 221
                     }
222 222
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                         $this->aCustomFieldTypes // ArchiveFilePaths
235 235
                     );
236 236
                     $_aArchiveFilePaths = array();
237
-                    foreach( $_aSelectedCustomFieldTypes as $_sClassName => $_aCustomFieldType ) {
237
+                    foreach ( $_aSelectedCustomFieldTypes as $_sClassName => $_aCustomFieldType ) {
238 238
                         $_aArchiveFilePaths[ $_sClassName ] = $this->oFactory->oUtil->getElement(
239 239
                             $_aCustomFieldType,
240 240
                             'archive_file_path',
@@ -286,17 +286,17 @@  discard block
 block discarded – undo
286 286
                         array( $sParsingClassName, 'text_domain' )
287 287
                     );
288 288
                     if ( $_sFieldTypeTextDomain ) {                        
289
-                        $_aSearches[] = $_sFieldTypeTextDomain;
290
-                        $_aReplaces[] = $_sUserTextDomain;
289
+                        $_aSearches[ ] = $_sFieldTypeTextDomain;
290
+                        $_aReplaces[ ] = $_sUserTextDomain;
291 291
                     }
292 292
                     
293
-                    $_aSearches[] = 'admin-page-framework';
294
-                    $_aReplaces[] = $_sUserTextDomain;
293
+                    $_aSearches[ ] = 'admin-page-framework';
294
+                    $_aReplaces[ ] = $_sUserTextDomain;
295 295
                     
296 296
                     // Return the converted string.
297 297
                     return str_replace(
298
-                        $_aSearches,    // search
299
-                        $_aReplaces,    // replace
298
+                        $_aSearches, // search
299
+                        $_aReplaces, // replace
300 300
                         $sFileContents  // subject
301 301
                     );
302 302
                     
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
                         );
315 315
                                                 
316 316
                         return preg_replace(
317
-                            $this->_getClassPrefixRegexPatterns( $_aSelectedFieldTypeClassNames ),    // search
318
-                            $this->_getClassPrefixRegexReplacements( $_aSelectedFieldTypeClassNames ),    // replace
317
+                            $this->_getClassPrefixRegexPatterns( $_aSelectedFieldTypeClassNames ), // search
318
+                            $this->_getClassPrefixRegexReplacements( $_aSelectedFieldTypeClassNames ), // replace
319 319
                             $sFileContents  // subject
320 320
                         );
321 321
                         
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
                         private function _getClassPrefixRegexPatterns( array $aSelectedFieldTypeClassNames ) {
329 329
 
330 330
                             $_aPregSearches = array();
331
-                            foreach( $aSelectedFieldTypeClassNames as $_sClassName ) {
332
-                                $_aPregSearches[] = '/(?<=[^a-zA-Z0-9])(' . $_sClassName . ')/';
331
+                            foreach ( $aSelectedFieldTypeClassNames as $_sClassName ) {
332
+                                $_aPregSearches[ ] = '/(?<=[^a-zA-Z0-9])('.$_sClassName.')/';
333 333
                             }
334 334
                             return $_aPregSearches;
335 335
                         
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
                          */
342 342
                         private function _getClassPrefixRegexReplacements( array $aSelectedFieldTypeClassNames ) {
343 343
 
344
-                            $_aPrefixedClassNames          = $aSelectedFieldTypeClassNames;
344
+                            $_aPrefixedClassNames = $aSelectedFieldTypeClassNames;
345 345
                             array_walk(
346
-                                $_aPrefixedClassNames,  // passed by reference
346
+                                $_aPrefixedClassNames, // passed by reference
347 347
                                 array( $this, '_replyToSetPrefix' ),
348 348
                                 $this->oFactory->oUtil->getElement(
349 349
                                     $_POST,
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
                              * @callback    function    array_walk
365 365
                              * @return      string
366 366
                              */
367
-                            public function _replyToSetPrefix( &$sClassName, $sKey, $sPrefix='' ) {
368
-                                $sClassName = $sPrefix . '$0';
367
+                            public function _replyToSetPrefix( &$sClassName, $sKey, $sPrefix = '' ) {
368
+                                $sClassName = $sPrefix.'$0';
369 369
                             }
370 370
                                     
371 371
  
@@ -386,12 +386,12 @@  discard block
 block discarded – undo
386 386
              */
387 387
             public function replyToSetAdditionalDirectoriesForGenerator( $aDirPaths ) {
388 388
                                 
389
-                $_aCheckedCustomFieldTypes        = $this->_getSelectedCustomFieldTypes(
389
+                $_aCheckedCustomFieldTypes = $this->_getSelectedCustomFieldTypes(
390 390
                     $this->aCustomFieldTypes
391 391
                 );
392 392
                 
393 393
                 $_aDirPathInfo = array();
394
-                foreach( $_aCheckedCustomFieldTypes as $_sKey => $_aCheckedCustomFieldType ) {
394
+                foreach ( $_aCheckedCustomFieldTypes as $_sKey => $_aCheckedCustomFieldType ) {
395 395
                     
396 396
                     $_sArchiveDirPath = $this->oFactory->oUtil->getElement( $_aCheckedCustomFieldType, 'archive_dir_path' );
397 397
                     $_sSourceDirPath  = $this->oFactory->oUtil->getElement( $_aCheckedCustomFieldType, 'directory_path' );
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
                  * @return      array       The array keys of the checked items.
408 408
                  * @since       3.6.0
409 409
                  */
410
-                private function _getSelectedCustomFieldTypes( array $aSubject=array() ) {
410
+                private function _getSelectedCustomFieldTypes( array $aSubject = array() ) {
411 411
                     
412 412
                     $_aCheckedCustomFieldTypes = $this->oFactory->oUtil->getElementAsArray(
413 413
                         $_POST,
Please login to merge, or discard this patch.