Completed
Branch master (163d15)
by
unknown
17:12 queued 08:49
created
development/utility/toc/AdminPageFramework_TableOfContents.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     
Please login to merge, or discard this patch.
development/utility/zip/AdminPageFramework_Zip.php 3 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
      * 
51 51
      * @since       3.6.0
52 52
      */
53
-    public $aOptions   = array(
54
-        'include_directory'             => false,   // (boolean) whether the contents should be put inside a root directory.
53
+    public $aOptions = array(
54
+        'include_directory'             => false, // (boolean) whether the contents should be put inside a root directory.
55 55
         'additional_source_directories' => array(),
56 56
         // 'ignoring_file_extensions'      => array(), // not implemented yet.
57 57
     );
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param       array|boolean       $abOptions
65 65
      * @param       callable            $aCallbacks
66 66
      */
67
-    public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) {
67
+    public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) {
68 68
         
69 69
         $this->sSource      = $sSource;
70 70
         $this->sDestination = $sDestination;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function compress() {
97 97
 
98 98
         // Check whether it is possible to perform the task.
99
-        if ( ! $this->isFeasible( $this->sSource ) ) {
99
+        if ( !$this->isFeasible( $this->sSource ) ) {
100 100
             return false;
101 101
         }
102 102
         
@@ -106,19 +106,19 @@  discard block
 block discarded – undo
106 106
         }
107 107
 
108 108
         $_oZip = new ZipArchive();
109
-        if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) {
109
+        if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) {
110 110
             return false;
111 111
         }
112 112
         
113 113
         $this->sSource = $this->_getSanitizedSourcePath( $this->sSource );
114 114
         // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) );
115 115
 
116
-        $_aMethods      = array(
116
+        $_aMethods = array(
117 117
             'unknown'   => '_replyToReturnFalse',
118 118
             'directory' => '_replyToCompressDirectory',
119 119
             'file'      => '_replyToCompressFile',
120 120
         );
121
-        $_sMethodName   = $_aMethods[ $this->_getSourceType( $this->sSource ) ];
121
+        $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ];
122 122
         return call_user_func_array(
123 123
             array( $this, $_sMethodName ),
124 124
             array(
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
          * @since       3.6.0       Changed the name from `_compressDirectory`. Changed the scope to public to allow overriding the method in an extended class.
145 145
          * @return      boolean     True on success, false otherwise.
146 146
          */
147
-        public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) {
147
+        public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) {
148 148
             
149 149
             $_sArchiveRootDirName = '';
150 150
            
@@ -174,11 +174,11 @@  discard block
 block discarded – undo
174 174
              * @since       3.6.0
175 175
              * @return      void
176 176
              */
177
-            private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) {
177
+            private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) {
178 178
                 
179
-                $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : '';
179
+                $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : '';
180 180
                 
181
-                foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) {
181
+                foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) {
182 182
                     
183 183
                     $_sSourceDirPath   = $this->_getSanitizedSourcePath( $_sSourceDirPath );
184 184
                     $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath )
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
                         : $_isIndexOrRelativeDirPath;
187 187
                         
188 188
                     // Add a directory inside the compressing directory.
189
-                    if( $_sInsideDirPrefix ) {
189
+                    if ( $_sInsideDirPrefix ) {
190 190
                         $this->_addRelativeDir(
191 191
                             $oZip,
192 192
                             $_sInsideDirPrefix,
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
                             $_sSourceDirPath,
205 205
                             $_sIterationItem, 
206 206
                             $aCallbacks,
207
-                            $sRootDirName . $_sInsideDirPrefix
207
+                            $sRootDirName.$_sInsideDirPrefix
208 208
                         );
209 209
                     }                                
210 210
                 }
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
                     $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath );
219 219
                     $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) );
220 220
                     $_aDirPath        = array();
221
-                    foreach( $_aPathPartsParse as $_sDirName ) {
222
-                        $_aDirPath[] = $_sDirName;
221
+                    foreach ( $_aPathPartsParse as $_sDirName ) {
222
+                        $_aDirPath[ ] = $_sDirName;
223 223
                         $this->_addEmptyDir( 
224 224
                             $oZip, 
225 225
                             implode( '/', $_aDirPath ),
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
                  * @param       string          $sInsidePathPrefix      The prefix to add to the inside archive directory structure. 
239 239
                  * @return      void
240 240
                  */
241
-                private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) {
241
+                private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) {
242 242
                     
243 243
                     $_sIterationItem   = str_replace( '\\', '/', $_sIterationItem );
244
-                    $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash
244
+                    $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash
245 245
                     
246 246
                     // Ignore "." and ".." folders
247 247
                     if ( 
@@ -259,18 +259,18 @@  discard block
 block discarded – undo
259 259
                     if ( true === is_dir( $_sIterationItem ) ) {
260 260
                         $this->_addEmptyDir( 
261 261
                             $oZip, 
262
-                            $sInsidePathPrefix . str_replace( 
263
-                                $sSource . '/', 
262
+                            $sInsidePathPrefix.str_replace( 
263
+                                $sSource.'/', 
264 264
                                 '', 
265
-                                $_sIterationItem . '/'
265
+                                $_sIterationItem.'/'
266 266
                             ), 
267 267
                             $aCallbacks[ 'directory_name' ]
268 268
                         );                    
269 269
                     } else if ( true === is_file( $_sIterationItem ) ) {
270 270
                         $this->_addFromString( 
271 271
                             $oZip, 
272
-                            $sInsidePathPrefix . str_replace(
273
-                                $sSource . '/', 
272
+                            $sInsidePathPrefix.str_replace(
273
+                                $sSource.'/', 
274 274
                                 '', 
275 275
                                 $_sIterationItem
276 276
                             ),
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
          * @since       3.6.0       Changed the name from `_compressFile`. Changed the scope from `private` to allow overriding in an extended class.
299 299
          * @return      boolean     True on success, false otherwise.
300 300
          */
301
-        public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) {
301
+        public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) {
302 302
             $this->_addFromString( 
303 303
                 $oZip, 
304 304
                 basename( $sSourceFilePath ), 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @return      boolean
330 330
      */
331 331
     private function isFeasible( $sSource ) {
332
-        if ( ! extension_loaded( 'zip' ) ) {
332
+        if ( !extension_loaded( 'zip' ) ) {
333 333
             return false;
334 334
         }
335 335
         return file_exists( $sSource );
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
      */
354 354
     private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) {
355 355
         $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable );
356
-        if ( ! strlen( $sInsidePath ) ) {
356
+        if ( !strlen( $sInsidePath ) ) {
357 357
             return;
358 358
         }
359 359
         $oZip->addEmptyDir( $sInsidePath );        
@@ -365,10 +365,10 @@  discard block
 block discarded – undo
365 365
      * @remark      If the path is empty, it will not process.
366 366
      * @return      void
367 367
      */
368
-    private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) {
368
+    private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) {
369 369
         
370 370
         $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] );
371
-        if ( ! strlen( $sInsidePath ) ) {
371
+        if ( !strlen( $sInsidePath ) ) {
372 372
             return;
373 373
         }
374 374
         $oZip->addFromString(
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
             
149 149
             $_sArchiveRootDirName = '';
150 150
            
151
-            if ( $bIncludeDir ) {                
151
+            if ( $bIncludeDir ) {
152 152
                 $_sArchiveRootDirName = $this->_getMainDirectoryName( $sSourceDirPath );
153 153
                 $this->_addEmptyDir( 
154 154
                     $oZip, 
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin Page Framework
4
- * 
5
- * http://en.michaeluno.jp/admin-page-framework/
6
- * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
- * 
8
- */
3
+     * Admin Page Framework
4
+     * 
5
+     * http://en.michaeluno.jp/admin-page-framework/
6
+     * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
+     * 
8
+     */
9 9
 
10 10
 /**
11 11
  * Compresses files into a zip file.
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                         in_array( 
249 249
                             substr( $_sIterationItem, strrpos( $_sIterationItem, '/' ) + 1 ), 
250 250
                             array( '.', '..' ) 
251
-                       )
251
+                        )
252 252
                     ) {
253 253
                         return;
254 254
                     }
Please login to merge, or discard this patch.
development/utility/class_tester/AdminPageFramework_ClassTester.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * Creates an object instance with dynamic parameters.
44 44
      */
45
-    static public function getInstance( $sClassName, array $aParameters=array() ) {
45
+    static public function getInstance( $sClassName, array $aParameters = array() ) {
46 46
         
47 47
         $_oReflection = new ReflectionClass( $sClassName );
48 48
         return $_oReflection->newInstanceArgs( $aParameters );               
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // For PHP 5.2.x or below
59 59
         if ( version_compare( phpversion(), '<', '5.3.0' ) ) {
60 60
             trigger_error(
61
-                'Program Name' . ': ' 
61
+                'Program Name'.': ' 
62 62
                     . sprintf( 
63 63
                         'The method cannot run with your PHP version: %1$s',
64 64
                         phpversion()
Please login to merge, or discard this patch.
development/admin-page-framework.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @package     AdminPageFramework
11 11
  */
12 12
 
13
-if ( ! class_exists( 'AdminPageFramework_Registry', false ) ) :
13
+if ( !class_exists( 'AdminPageFramework_Registry', false ) ) :
14 14
 /**
15 15
  * Facilitates WordPress plugin and theme development.
16 16
  *
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base {
57 57
 
58 58
     const TEXT_DOMAIN        = 'admin-page-framework';
59
-    const TEXT_DOMAIN_PATH   = '/language';  // not used at the moment
59
+    const TEXT_DOMAIN_PATH   = '/language'; // not used at the moment
60 60
 
61 61
     /**
62 62
      * Indicates whether the framework is loaded from the minified version or not.
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
      * Sets up static properties.
99 99
      * @return      void
100 100
      */
101
-    static public function setUp( $sFilePath=__FILE__ ) {
101
+    static public function setUp( $sFilePath = __FILE__ ) {
102 102
 
103 103
         self::$sFilePath                = $sFilePath;
104 104
         self::$sDirPath                 = dirname( self::$sFilePath );
105
-        self::$sIncludeClassListPath    = self::$sDirPath . '/admin-page-framework-include-class-list.php';
105
+        self::$sIncludeClassListPath    = self::$sDirPath.'/admin-page-framework-include-class-list.php';
106 106
         self::$aClassFiles              = self::_getClassFilePathList( self::$sIncludeClassListPath );
107 107
         self::$sAutoLoaderPath          = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] )
108 108
             ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ]
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
          * @return      array
118 118
          */
119 119
         static private function _getClassFilePathList( $sInclusionClassListPath ) {
120
-            $aClassFiles = array();    // this will be updated if the inclusion below is successful.
120
+            $aClassFiles = array(); // this will be updated if the inclusion below is successful.
121 121
             include( $sInclusionClassListPath );
122 122
             return $aClassFiles;
123 123
         }
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
      */
131 131
     static public function getVersion() {
132 132
 
133
-        if ( ! isset( self::$sAutoLoaderPath ) ) {
134
-            trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING );
133
+        if ( !isset( self::$sAutoLoaderPath ) ) {
134
+            trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING );
135 135
             return self::VERSION;
136 136
         }
137
-        $_aMinifiedVesionSuffix     = array(
137
+        $_aMinifiedVesionSuffix = array(
138 138
             0 => '',
139 139
             1 => '.min',
140 140
         );
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 }
164 164
 endif;
165 165
 
166
-if ( ! class_exists( 'AdminPageFramework_Bootstrap', false ) ) :
166
+if ( !class_exists( 'AdminPageFramework_Bootstrap', false ) ) :
167 167
 /**
168 168
  * Loads the Admin Page Framework library.
169 169
  *
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
      */
185 185
     public function __construct( $sLibraryPath ) {
186 186
 
187
-        if ( ! $this->_isLoadable() ) {
187
+        if ( !$this->_isLoadable() ) {
188 188
             return;
189 189
         }
190 190
 
Please login to merge, or discard this patch.
development/cli/AdminPageFramework_InclusionClassFilesHeader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'.
12 12
  */
13 13
 if ( php_sapi_name() === 'cli' ) {
14
-    $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php';
14
+    $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php';
15 15
     if ( file_exists( $_sFrameworkFilePath ) ) {
16 16
         include_once( $_sFrameworkFilePath );
17 17
     }
Please login to merge, or discard this patch.
development/cli/AdminPageFramework_BeautifiedVersionHeader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
  * If accessed from a console, include the registry class to laod 'AdminPageFramework_Registry_Base'.
12 12
  */
13 13
 if ( php_sapi_name() === 'cli' ) {
14
-    $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ) . '/admin-page-framework.php';
14
+    $_sFrameworkFilePath = dirname( dirname( __FILE__ ) ).'/admin-page-framework.php';
15 15
     if ( file_exists( $_sFrameworkFilePath ) ) {
16 16
         include_once( $_sFrameworkFilePath );
17 17
     }
Please login to merge, or discard this patch.
AdminPageFramework_Model__FormSubmission__Validator__ResetConfirm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) {
35 35
                                 
36
-        if ( ! $this->_shouldProceed( $oFactory, $aSubmits ) ) {
36
+        if ( !$this->_shouldProceed( $oFactory, $aSubmits ) ) {
37 37
             return;
38 38
         }
39 39
         
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         );            
47 47
         
48 48
         // Go to the catch clause.
49
-        $_oException = new Exception( 'aReturn' );  // the property name to return from the catch clasue.
49
+        $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue.
50 50
         $_oException->aReturn = $this->_confirmSubmitButtonAction( 
51 51
             $this->getElement( $aSubmitInformation, 'input_name' ), 
52 52
             $this->getElement( $aSubmitInformation, 'section_id' ), 
Please login to merge, or discard this patch.
_common/utility/admin_notice/AdminPageFramework_AdminNotice___Script.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin Page Framework
4
- * 
5
- * http://en.michaeluno.jp/admin-page-framework/
6
- * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
- * 
8
- */
3
+         * Admin Page Framework
4
+         * 
5
+         * http://en.michaeluno.jp/admin-page-framework/
6
+         * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
+         * 
8
+         */
9 9
 
10 10
 /**
11 11
  * Provides utility methods which can be accessed among different components of the framework.
Please login to merge, or discard this patch.
factory/_common/form/field_type/AdminPageFramework_FieldType_size.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -165,6 +165,7 @@  discard block
 block discarded – undo
165 165
              * Returns the HTML output of the number input part.
166 166
              * 
167 167
              * @since       3.5.3
168
+             * @param boolean $bMultiLabels
168 169
              * @return      string      The number input output.
169 170
              */
170 171
             private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) {
@@ -217,6 +218,7 @@  discard block
 block discarded – undo
217 218
              * Returns the HTML output of the unit select input part.
218 219
              * 
219 220
              * @since       3.5.3
221
+             * @param boolean $bMultiLabels
220 222
              * @return      string      The unit select input output.
221 223
              */
222 224
             private function _getUnitSelectInput( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * Defines the field type slugs used for this field type.
23 23
      */
24
-    public $aFieldTypeSlugs = array( 'size', );
24
+    public $aFieldTypeSlugs = array( 'size',);
25 25
     
26 26
     /**
27 27
      * Defines the default key-values of this field type. 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     protected $aDefaultKeys = array(
32 32
         'is_multiple'           => false, // indicates whether the select tag alloes multiple selections.
33
-        'units'                 => null,  // do not define units here since this will be merged with the user defined field array.
33
+        'units'                 => null, // do not define units here since this will be merged with the user defined field array.
34 34
         'attributes'            => array(
35 35
             'size'      => array(
36 36
                 'min'           => null,
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected $aDefaultUnits = array(
60 60
         'px'    => 'px', // pixel
61
-        '%'     => '%',  // percentage
61
+        '%'     => '%', // percentage
62 62
         'em'    => 'em', // font size
63 63
         'ex'    => 'ex', // font height
64 64
         'in'    => 'in', // inch
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
         );
116 116
 
117 117
         $_aOutput = array();
118
-        foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) {
119
-            $_aOutput[] = $this->_getFieldOutputByLabel( 
118
+        foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) {
119
+            $_aOutput[ ] = $this->_getFieldOutputByLabel( 
120 120
                 $_isKey, 
121 121
                 $_sLabel,
122 122
                 $aField
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 
139 139
             $_aBaseAttributes   = $_bMultiLabels
140 140
                 ? array(
141
-                        'name'  => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]",
142
-                        'id'    => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}",
141
+                        'name'  => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]",
142
+                        'id'    => $aField[ 'attributes' ][ 'id' ]."_{$isKey}",
143 143
                         'value' => $aField[ 'value' ],
144 144
                     ) 
145 145
                     + $aField[ 'attributes' ]
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
                      
152 152
             $_aOutput = array(
153 153
                 $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ),
154
-                    "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>",
155
-                        $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ),  // The size (number) part
156
-                        $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ),  // The unit (select) part
154
+                    "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>",
155
+                        $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The size (number) part
156
+                        $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, is_array( $aField[ 'label' ] ) ), // The unit (select) part
157 157
                     "</div>",
158 158
                 $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] )
159 159
             );
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) {
170 170
                 
171 171
                 // Size and Size Label
172
-                $_aSizeAttributes       = $this->_getSizeAttributes( 
172
+                $_aSizeAttributes = $this->_getSizeAttributes( 
173 173
                     $aField, 
174 174
                     $aBaseAttributes,
175 175
                     $bMultiLabels
@@ -177,32 +177,32 @@  discard block
 block discarded – undo
177 177
                         : ''
178 178
                 );
179 179
 
180
-                $_aSizeLabelAttributes  = array(
180
+                $_aSizeLabelAttributes = array(
181 181
                     'for'   => $_aSizeAttributes[ 'id' ],
182 182
                     'class' => $_aSizeAttributes[ 'disabled' ] 
183 183
                         ? 'disabled' 
184 184
                         : null,
185 185
                 );                  
186 186
                 
187
-                $_sLabel                = $this->getElementByLabel( 
187
+                $_sLabel = $this->getElementByLabel( 
188 188
                     $aField[ 'label' ], 
189 189
                     $isKey, 
190 190
                     $aField[ 'label' ]
191 191
                 );
192
-                return "<label " . $this->getAttributes( $_aSizeLabelAttributes ) . ">"
192
+                return "<label ".$this->getAttributes( $_aSizeLabelAttributes ).">"
193 193
                     . $this->getElement( 
194 194
                         $aField, 
195 195
                         $bMultiLabels
196 196
                             ? array( 'before_label', $isKey, 'size' ) 
197 197
                             : array( 'before_label', 'size' ) 
198 198
                     )
199
-                    . ( $aField['label'] && ! $aField[ 'repeatable' ]
200
-                        ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>" 
199
+                    . ( $aField[ 'label' ] && !$aField[ 'repeatable' ]
200
+                        ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" 
201 201
                                 . $_sLabel 
202 202
                             . "</span>"
203 203
                         : "" 
204 204
                     )
205
-                    . "<input " . $this->getAttributes( $_aSizeAttributes ) . " />" 
205
+                    . "<input ".$this->getAttributes( $_aSizeAttributes )." />" 
206 206
                     . $this->getElement( 
207 207
                         $aField, 
208 208
                         $bMultiLabels
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                     )
245 245
                     : $aField[ 'units' ];
246 246
                 
247
-                return "<label " . $this->getAttributes( 
247
+                return "<label ".$this->getAttributes( 
248 248
                         array(
249 249
                             'for'       => $_aUnitAttributes[ 'id' ],
250 250
                             'class'     => $_aUnitAttributes[ 'disabled' ] 
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
                  * @since       3.5.3    
276 276
                  * @return      array       an unit attribute array
277 277
                  */
278
-                private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey='' ) {
278
+                private function _getUnitAttributes( array $aField, array $aBaseAttributes, $isLabelKey = '' ) {
279 279
                     
280
-                    $_bIsMultiple    = $aField[ 'is_multiple' ] 
280
+                    $_bIsMultiple = $aField[ 'is_multiple' ] 
281 281
                         ? true 
282 282
                         : $this->getElement( 
283 283
                             $aField,
@@ -289,13 +289,13 @@  discard block
 block discarded – undo
289 289
               
290 290
                     $_aSelectAttributes = array(
291 291
                         'type'      => 'select',
292
-                        'id'        => $aField[ 'input_id' ] . ( '' === $isLabelKey ? '' : '_' . $isLabelKey ) . '_' . 'unit',
292
+                        'id'        => $aField[ 'input_id' ].( '' === $isLabelKey ? '' : '_'.$isLabelKey ).'_'.'unit',
293 293
                         'multiple'  => $_bIsMultiple 
294 294
                             ? 'multiple' 
295 295
                             : null,
296 296
                         'name'      => $_bIsMultiple 
297
-                            ? "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit][]" 
298
-                            : "{$aField['_input_name']}" . ( '' === $isLabelKey ? '' : '[' . $isLabelKey . ']' ) . "[unit]",
297
+                            ? "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit][]" 
298
+                            : "{$aField[ '_input_name' ]}".( '' === $isLabelKey ? '' : '['.$isLabelKey.']' )."[unit]",
299 299
                         'value'     => $this->getElement( 
300 300
                             $aField, 
301 301
                             array( 'value', 'unit' ),
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                         '' === $isLabelKey
308 308
                             ? array( 'attributes', 'unit' )
309 309
                             : array( 'attributes', $isLabelKey, 'unit' ),
310
-                        $this->aDefaultKeys['attributes']['unit'] 
310
+                        $this->aDefaultKeys[ 'attributes' ][ 'unit' ] 
311 311
                     )
312 312
                     + $aBaseAttributes;       
313 313
                     return $_aSelectAttributes;
@@ -320,15 +320,15 @@  discard block
 block discarded – undo
320 320
              * @since       3.5.3    
321 321
              * @return      array       an size attribute array
322 322
              */
323
-            private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey='' ) {
323
+            private function _getSizeAttributes( array $aField, array $aBaseAttributes, $sLabelKey = '' ) {
324 324
 
325 325
                 return array(
326 326
                         'type'  => 'number',
327
-                        'id'    => $aField['input_id'] . '_' . ( '' !== $sLabelKey ? $sLabelKey . '_' : '' ) . 'size',
328
-                        'name'  => $aField[ '_input_name' ] . ( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ) . '[size]',
327
+                        'id'    => $aField[ 'input_id' ].'_'.( '' !== $sLabelKey ? $sLabelKey.'_' : '' ).'size',
328
+                        'name'  => $aField[ '_input_name' ].( '' !== $sLabelKey ? "[{$sLabelKey}]" : '' ).'[size]',
329 329
                         'value' => $this->getElement(
330
-                            $aField,        // subject
331
-                            array( 'value', 'size' ),   // dimensional keys
330
+                            $aField, // subject
331
+                            array( 'value', 'size' ), // dimensional keys
332 332
                             ''  // default
333 333
                         ),
334 334
                     ) 
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Admin Page Framework
4
- * 
5
- * http://en.michaeluno.jp/admin-page-framework/
6
- * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
- * 
8
- */
3
+     * Admin Page Framework
4
+     * 
5
+     * http://en.michaeluno.jp/admin-page-framework/
6
+     * Copyright (c) 2013-2016 Michael Uno; Licensed MIT
7
+     * 
8
+     */
9 9
 
10 10
 /**
11 11
  * Provides an abstract base class to create meta boxes in generic admin pages created by the framework.
Please login to merge, or discard this patch.