@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
| 18 | 18 | |
| 19 | - const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 20 | - const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
|
| 19 | + const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 20 | + const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
|
| 21 | 21 | const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
| 22 | - const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
|
| 23 | - const URI = 'http://en.michaeluno.jp/'; |
|
| 24 | - const AUTHOR = 'miunosoft (Michael Uno)'; |
|
| 25 | - const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
|
| 26 | - const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
|
| 27 | - const LICENSE = 'GPL v2 or later'; |
|
| 22 | + const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
|
| 23 | + const URI = 'http://en.michaeluno.jp/'; |
|
| 24 | + const AUTHOR = 'miunosoft (Michael Uno)'; |
|
| 25 | + const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
|
| 26 | + const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
|
| 27 | + const LICENSE = 'GPL v2 or later'; |
|
| 28 | 28 | const CONTRIBUTORS = ''; |
| 29 | 29 | |
| 30 | 30 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 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. |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * These will be accessed from the bootstrap script. |
| 72 | 72 | */ |
| 73 | - const TEXT_DOMAIN = 'admin-page-framework-loader'; |
|
| 74 | - const TEXT_DOMAIN_PATH = '/language'; |
|
| 73 | + const TEXT_DOMAIN = 'admin-page-framework-loader'; |
|
| 74 | + const TEXT_DOMAIN_PATH = '/language'; |
|
| 75 | 75 | |
| 76 | - // These properties will be defined in the setUp() method. |
|
| 77 | - static public $sFilePath = ''; |
|
| 78 | - static public $sDirPath = ''; |
|
| 76 | + // These properties will be defined in the setUp() method. |
|
| 77 | + static public $sFilePath = ''; |
|
| 78 | + static public $sDirPath = ''; |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Requirements. |
@@ -136,30 +136,30 @@ discard block |
||
| 136 | 136 | static public $aTaxonomies = array( |
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Sets up static properties. |
|
| 139 | + /** |
|
| 140 | + * Sets up static properties. |
|
| 141 | 141 | * @return void |
| 142 | - */ |
|
| 143 | - static public function setUp( $sPluginFilePath=null ) { |
|
| 142 | + */ |
|
| 143 | + static public function setUp( $sPluginFilePath=null ) { |
|
| 144 | 144 | |
| 145 | - self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
|
| 146 | - self::$sDirPath = dirname( self::$sFilePath ); |
|
| 145 | + self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
|
| 146 | + self::$sDirPath = dirname( self::$sFilePath ); |
|
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Returns the URL with the given relative path to the plugin path. |
|
| 152 | - * |
|
| 153 | - * <h3>Example</h3> |
|
| 150 | + /** |
|
| 151 | + * Returns the URL with the given relative path to the plugin path. |
|
| 152 | + * |
|
| 153 | + * <h3>Example</h3> |
|
| 154 | 154 | * <code> |
| 155 | 155 | * AdminPageFrameworkLoader_Registry::getPluginURL( 'asset/css/meta_box.css' ); |
| 156 | 156 | * </code> |
| 157 | 157 | * @since 3.5.0 |
| 158 | 158 | * @return string |
| 159 | - */ |
|
| 160 | - public static function getPluginURL( $sRelativePath='' ) { |
|
| 161 | - return plugins_url( $sRelativePath, self::$sFilePath ); |
|
| 162 | - } |
|
| 159 | + */ |
|
| 160 | + public static function getPluginURL( $sRelativePath='' ) { |
|
| 161 | + return plugins_url( $sRelativePath, self::$sFilePath ); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Returns the information of this class. |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
| 18 | 18 | |
| 19 | - const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 19 | + const VERSION = '3.7.0'; // <--- 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://en.michaeluno.jp/'; |
| 24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
| 25 | 25 | const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
| 26 | 26 | const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
| 27 | 27 | const LICENSE = 'GPL v2 or later'; |
| 28 | - const CONTRIBUTORS = ''; |
|
| 28 | + const CONTRIBUTORS = ''; |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | /** |
@@ -55,14 +55,14 @@ discard block |
||
| 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 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | static public $aAdminPages = array( |
| 119 | 119 | // key => 'page slug' |
| 120 | - 'about' => 'apfl_about', // the welcome page |
|
| 120 | + 'about' => 'apfl_about', // the welcome page |
|
| 121 | 121 | 'addon' => 'apfl_addons', |
| 122 | 122 | 'tool' => 'apfl_tools', |
| 123 | 123 | 'help' => 'apfl_contact', |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Sets up static properties. |
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | - static public function setUp( $sPluginFilePath=null ) { |
|
| 143 | + static public function setUp( $sPluginFilePath = null ) { |
|
| 144 | 144 | |
| 145 | 145 | self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
| 146 | 146 | self::$sDirPath = dirname( self::$sFilePath ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @since 3.5.0 |
| 158 | 158 | * @return string |
| 159 | 159 | */ |
| 160 | - public static function getPluginURL( $sRelativePath='' ) { |
|
| 160 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
| 161 | 161 | return plugins_url( $sRelativePath, self::$sFilePath ); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | * @since 3.5.0 |
| 185 | 185 | * @return void |
| 186 | 186 | */ |
| 187 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
| 188 | - if ( ! is_admin() ) { |
|
| 187 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
| 188 | + if ( !is_admin() ) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | - self::$_aAdminNotices[] = array( |
|
| 191 | + self::$_aAdminNotices[ ] = array( |
|
| 192 | 192 | 'message' => $sMessage, |
| 193 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
| 193 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
| 194 | 194 | ); |
| 195 | 195 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
| 196 | 196 | } |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | * @return void |
| 201 | 201 | */ |
| 202 | 202 | static public function _replyToSetAdminNotice() { |
| 203 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 204 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
| 203 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 204 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
| 205 | 205 | ."<p>" |
| 206 | 206 | . sprintf( |
| 207 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
| 208 | - self::NAME . ' ' . self::VERSION |
|
| 207 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
| 208 | + self::NAME.' '.self::VERSION |
|
| 209 | 209 | ) |
| 210 | 210 | . "</p>" |
| 211 | 211 | . "</div>"; |
@@ -217,24 +217,24 @@ discard block |
||
| 217 | 217 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
| 218 | 218 | |
| 219 | 219 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
| 220 | -if ( ! defined( 'ABSPATH' ) ) { return; } |
|
| 220 | +if ( !defined( 'ABSPATH' ) ) { return; } |
|
| 221 | 221 | if ( defined( 'DOING_UNINSTALL' ) ) { return; } |
| 222 | 222 | |
| 223 | 223 | // Include the library file |
| 224 | -if ( ! class_exists( 'AdminPageFramework' ) ) { |
|
| 224 | +if ( !class_exists( 'AdminPageFramework' ) ) { |
|
| 225 | 225 | // The development version is available in the repository cloned via GitHub. |
| 226 | - $_sDevelopmentVersionPath = dirname( __FILE__ ) . '/development/admin-page-framework.php'; |
|
| 226 | + $_sDevelopmentVersionPath = dirname( __FILE__ ).'/development/admin-page-framework.php'; |
|
| 227 | 227 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
| 228 | 228 | include( |
| 229 | 229 | $_bDebugMode && file_exists( $_sDevelopmentVersionPath ) |
| 230 | 230 | ? $_sDevelopmentVersionPath |
| 231 | - : dirname( __FILE__ ) . '/library/admin-page-framework/admin-page-framework.php' |
|
| 231 | + : dirname( __FILE__ ).'/library/admin-page-framework/admin-page-framework.php' |
|
| 232 | 232 | ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if ( |
| 236 | - ! class_exists( 'AdminPageFramework_Registry' ) |
|
| 237 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
| 236 | + !class_exists( 'AdminPageFramework_Registry' ) |
|
| 237 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
| 238 | 238 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
| 239 | 239 | ) { |
| 240 | 240 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Include the framework loader plugin components. |
| 252 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/boot/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
| 252 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/boot/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
| 253 | 253 | if ( class_exists( 'AdminPageFrameworkLoader_Bootstrap' ) ) { // for backward compatibility |
| 254 | 254 | new AdminPageFrameworkLoader_Bootstrap( |
| 255 | 255 | AdminPageFrameworkLoader_Registry::$sFilePath, |
@@ -98,14 +98,14 @@ discard block |
||
| 98 | 98 | * @param object $oMsg The framework message object. |
| 99 | 99 | * @param boolean $bAutoRegister Whether or not to register the field type(s). |
| 100 | 100 | */ |
| 101 | - function __construct( $asClassName='admin_page_framework', $asFieldTypeSlug=null, $oMsg=null, $bAutoRegister=true ) { |
|
| 101 | + function __construct( $asClassName = 'admin_page_framework', $asFieldTypeSlug = null, $oMsg = null, $bAutoRegister = true ) { |
|
| 102 | 102 | |
| 103 | 103 | $this->aFieldTypeSlugs = empty( $asFieldTypeSlug ) ? $this->aFieldTypeSlugs : ( array ) $asFieldTypeSlug; |
| 104 | 104 | $this->oMsg = $oMsg ? $oMsg : AdminPageFramework_Message::getInstance(); |
| 105 | 105 | |
| 106 | 106 | // This automatically registers the field type. The build-in ones will be registered manually so it will be skipped. |
| 107 | 107 | if ( $bAutoRegister ) { |
| 108 | - foreach( ( array ) $asClassName as $_sClassName ) { |
|
| 108 | + foreach ( ( array ) $asClassName as $_sClassName ) { |
|
| 109 | 109 | add_filter( "field_types_{$_sClassName}", array( $this, '_replyToRegisterInputFieldType' ) ); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | return is_array( $asLabel ) // if the user stes multiple items |
| 152 | 152 | ? $this->getElement( |
| 153 | - $asElement, // subject |
|
| 154 | - $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
| 153 | + $asElement, // subject |
|
| 154 | + $this->getAsArray( $asKey, true /* preserve empty */ ), // dimensional path |
|
| 155 | 155 | '' // default - if the elementi is not found, return an empty |
| 156 | 156 | ) |
| 157 | 157 | : $asElement; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | protected function geFieldOutput( array $aFieldset ) { |
| 168 | 168 | |
| 169 | - if ( ! is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
| 169 | + if ( !is_object( $aFieldset[ '_caller_object' ] ) ) { |
|
| 170 | 170 | return ''; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -174,14 +174,14 @@ discard block |
||
| 174 | 174 | $aFieldset[ '_parent_field_object' ] = $aFieldset[ '_field_object' ]; // 3.6.0+ |
| 175 | 175 | |
| 176 | 176 | // DEVVER+ The caller object is no longer a factory object but a form object. |
| 177 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
| 177 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
| 178 | 178 | |
| 179 | 179 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
| 180 | - $aFieldset, // the field definition array |
|
| 181 | - $_oCallerForm->aSavedData, // the stored form data |
|
| 182 | - $_oCallerForm->getFieldErrors(), // the field error array. |
|
| 183 | - $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
| 184 | - $_oCallerForm->oMsg, // the system message object |
|
| 180 | + $aFieldset, // the field definition array |
|
| 181 | + $_oCallerForm->aSavedData, // the stored form data |
|
| 182 | + $_oCallerForm->getFieldErrors(), // the field error array. |
|
| 183 | + $_oCallerForm->aFieldTypeDefinitions, // the field type definition array. |
|
| 184 | + $_oCallerForm->oMsg, // the system message object |
|
| 185 | 185 | $_oCallerForm->aCallbacks // field output element callables. |
| 186 | 186 | ); |
| 187 | 187 | return $_oFieldset->get(); |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | * @since 3.0.3 Tweaked it to have better execution speed. |
| 229 | 229 | * @internal |
| 230 | 230 | */ |
| 231 | - public function getDefinitionArray( $sFieldTypeSlug='' ) { |
|
| 231 | + public function getDefinitionArray( $sFieldTypeSlug = '' ) { |
|
| 232 | 232 | |
| 233 | 233 | // The uniteArrays() method resulted in somewhat being slow due to overhead on checking array keys for recursive array merges. |
| 234 | 234 | $_aDefaultKeys = $this->aDefaultKeys + self::$_aDefaultKeys; |
| 235 | - $_aDefaultKeys['attributes'] = isset( $this->aDefaultKeys['attributes'] ) && is_array( $this->aDefaultKeys['attributes'] ) |
|
| 236 | - ? $this->aDefaultKeys['attributes'] + self::$_aDefaultKeys['attributes'] |
|
| 237 | - : self::$_aDefaultKeys['attributes']; |
|
| 235 | + $_aDefaultKeys[ 'attributes' ] = isset( $this->aDefaultKeys[ 'attributes' ] ) && is_array( $this->aDefaultKeys[ 'attributes' ] ) |
|
| 236 | + ? $this->aDefaultKeys[ 'attributes' ] + self::$_aDefaultKeys[ 'attributes' ] |
|
| 237 | + : self::$_aDefaultKeys[ 'attributes' ]; |
|
| 238 | 238 | |
| 239 | 239 | return array( |
| 240 | 240 | 'sFieldTypeSlug' => $sFieldTypeSlug, |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @since 3.0.0 |
| 273 | 273 | * @internal |
| 274 | 274 | */ |
| 275 | - public function _replyToFieldTypeSetter( $sFieldSetType='' ) { |
|
| 275 | + public function _replyToFieldTypeSetter( $sFieldSetType = '' ) { |
|
| 276 | 276 | $this->_sFieldSetType = $sFieldSetType; |
| 277 | 277 | } |
| 278 | 278 | |
@@ -326,8 +326,8 @@ discard block |
||
| 326 | 326 | wp_enqueue_script( 'media-upload' ); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php', ) ) ) { |
|
| 330 | - add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ) , 1, 2 ); |
|
| 329 | + if ( in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php',) ) ) { |
|
| 330 | + add_filter( 'gettext', array( $this, '_replyToReplaceThickBoxText' ), 1, 2 ); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | public function _replyToReplaceThickBoxText( $sTranslated, $sText ) { |
| 343 | 343 | |
| 344 | 344 | // Replace the button label in the media thick box. |
| 345 | - if ( ! in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
| 345 | + if ( !in_array( $this->getPageNow(), array( 'media-upload.php', 'async-upload.php' ) ) ) { |
|
| 346 | 346 | return $sTranslated; |
| 347 | 347 | } |
| 348 | 348 | if ( $sText !== 'Insert into Post' ) { |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | return $sTranslated; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - if ( isset( $_GET['button_label'] ) ) { |
|
| 356 | - return $_GET['button_label']; |
|
| 355 | + if ( isset( $_GET[ 'button_label' ] ) ) { |
|
| 356 | + return $_GET[ 'button_label' ]; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | return $this->oProp->sThickBoxButtonUseThis |
@@ -372,12 +372,12 @@ discard block |
||
| 372 | 372 | */ |
| 373 | 373 | public function _replyToRemovingMediaLibraryTab( $aTabs ) { |
| 374 | 374 | |
| 375 | - if ( ! isset( $_REQUEST['enable_external_source'] ) ) { |
|
| 375 | + if ( !isset( $_REQUEST[ 'enable_external_source' ] ) ) { |
|
| 376 | 376 | return $aTabs; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( ! $_REQUEST['enable_external_source'] ) { |
|
| 380 | - unset( $aTabs['type_url'] ); // removes the 'From URL' tab in the thick box. |
|
| 379 | + if ( !$_REQUEST[ 'enable_external_source' ] ) { |
|
| 380 | + unset( $aTabs[ 'type_url' ] ); // removes the 'From URL' tab in the thick box. |
|
| 381 | 381 | } |
| 382 | 382 | return $aTabs; |
| 383 | 383 | |
@@ -21,7 +21,7 @@ discard block |
||
| 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 |
||
| 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 | 'size' => 10, |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected $aDefaultUnits = array( |
| 61 | 61 | 'px' => 'px', // pixel |
| 62 | - '%' => '%', // percentage |
|
| 62 | + '%' => '%', // percentage |
|
| 63 | 63 | 'em' => 'em', // font size |
| 64 | 64 | 'ex' => 'ex', // font height |
| 65 | 65 | 'in' => 'in', // inch |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | 118 | $_aOutput = array(); |
| 119 | - foreach( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
| 120 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
| 119 | + foreach ( ( array ) $aField[ 'label' ] as $_isKey => $_sLabel ) { |
|
| 120 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
| 121 | 121 | $_isKey, |
| 122 | 122 | $_sLabel, |
| 123 | 123 | $aField |
@@ -139,22 +139,22 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | $_aBaseAttributes = $_bMultiLabels |
| 141 | 141 | ? array( |
| 142 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$isKey}]", |
|
| 143 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$isKey}", |
|
| 142 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$isKey}]", |
|
| 143 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$isKey}", |
|
| 144 | 144 | 'value' => $aField[ 'value' ], |
| 145 | 145 | ) |
| 146 | 146 | + $aField[ 'attributes' ] |
| 147 | 147 | : $aField[ 'attributes' ]; |
| 148 | 148 | unset( |
| 149 | - $_aBaseAttributes['unit'], |
|
| 150 | - $_aBaseAttributes['size'] |
|
| 149 | + $_aBaseAttributes[ 'unit' ], |
|
| 150 | + $_aBaseAttributes[ 'size' ] |
|
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | 153 | $_aOutput = array( |
| 154 | 154 | $this->getElementByLabel( $aField[ 'before_label' ], $isKey, $aField[ 'label' ] ), |
| 155 | - "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: " . $this->sanitizeLength( $aField[ 'label_min_width' ] ) . ";'>", |
|
| 156 | - $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The size (number) part |
|
| 157 | - $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The unit (select) part |
|
| 155 | + "<div class='admin-page-framework-input-label-container admin-page-framework-select-label' style='min-width: ".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>", |
|
| 156 | + $this->_getNumberInputPart( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The size (number) part |
|
| 157 | + $this->_getUnitSelectInput( $aField, $_aBaseAttributes, $isKey, $aField[ 'label' ] ), // The unit (select) part |
|
| 158 | 158 | "</div>", |
| 159 | 159 | $this->getElementByLabel( $aField[ 'after_label' ], $isKey, $aField[ 'label' ] ) |
| 160 | 160 | ); |
@@ -170,39 +170,39 @@ discard block |
||
| 170 | 170 | private function _getNumberInputPart( array $aField, array $aBaseAttributes, $isKey, $bMultiLabels ) { |
| 171 | 171 | |
| 172 | 172 | // Size and Size Label |
| 173 | - $_aSizeAttributes = $this->_getSizeAttributes( |
|
| 173 | + $_aSizeAttributes = $this->_getSizeAttributes( |
|
| 174 | 174 | $aField, |
| 175 | 175 | $aBaseAttributes, |
| 176 | 176 | $bMultiLabels |
| 177 | 177 | ? $isKey |
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | ) |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | /** |
| 24 | 24 | * Defines the field type slugs used for this field type. |
| 25 | 25 | */ |
| 26 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
| 26 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Defines the default key-values of this field type. |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | protected function getField( $aField ) { |
| 66 | 66 | |
| 67 | 67 | $_aOutput = array(); |
| 68 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 69 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
| 68 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 69 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
| 70 | 70 | $_sKey, |
| 71 | 71 | $_sLabel, |
| 72 | 72 | $aField |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // the repeatable field buttons will be replaced with this element. |
| 77 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
| 77 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
| 78 | 78 | return implode( '', $_aOutput ); |
| 79 | 79 | |
| 80 | 80 | } |
@@ -93,23 +93,23 @@ discard block |
||
| 93 | 93 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $aField[ 'label' ] ); |
| 94 | 94 | $_aInputAttributes = $_bIsArray |
| 95 | 95 | ? array( |
| 96 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
| 97 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
| 96 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
| 97 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
| 98 | 98 | 'value' => $aField[ 'value' ], |
| 99 | 99 | ) |
| 100 | 100 | + $aField[ 'attributes' ] |
| 101 | 101 | : $aField[ 'attributes' ]; |
| 102 | - $_aOutput = array( |
|
| 102 | + $_aOutput = array( |
|
| 103 | 103 | $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
| 104 | 104 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
| 105 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
| 105 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
| 106 | 106 | $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
| 107 | 107 | $_sLabel |
| 108 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
| 108 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
| 109 | 109 | . $_sLabel |
| 110 | 110 | . "</span>" |
| 111 | 111 | : '', |
| 112 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
| 112 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
| 113 | 113 | $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
| 114 | 114 | "</label>", |
| 115 | 115 | "</div>", |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | protected function getField( $aField ) { |
| 434 | 434 | |
| 435 | 435 | $_aOutput = array(); |
| 436 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 437 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
| 436 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
| 437 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
| 438 | 438 | $_sKey, |
| 439 | 439 | $_sLabel, |
| 440 | 440 | $aField |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // the repeatable field buttons will be replaced with this element. |
| 445 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
| 445 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
| 446 | 446 | return implode( '', $_aOutput ); |
| 447 | 447 | |
| 448 | 448 | } |
@@ -461,27 +461,27 @@ discard block |
||
| 461 | 461 | $aField[ 'rich' ] = $this->getElementByLabel( $aField[ 'rich' ], $sKey, $aField[ 'label' ] ); |
| 462 | 462 | $aField[ 'attributes' ] = $_bIsArray |
| 463 | 463 | ? array( |
| 464 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
| 465 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
| 464 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
| 465 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
| 466 | 466 | 'value' => $aField[ 'value' ], |
| 467 | 467 | ) |
| 468 | 468 | + $aField[ 'attributes' ] |
| 469 | 469 | : $aField[ 'attributes' ]; |
| 470 | - $_aOutput = array( |
|
| 471 | - $this->getElementByLabel( $aField['before_label'], $sKey, $aField[ 'label' ] ), |
|
| 470 | + $_aOutput = array( |
|
| 471 | + $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $aField[ 'label' ] ), |
|
| 472 | 472 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
| 473 | - "<label for='" . $aField[ 'attributes' ][ 'id' ] . "'>", |
|
| 474 | - $this->getElementByLabel( $aField['before_input'], $sKey, $aField[ 'label' ] ), |
|
| 473 | + "<label for='".$aField[ 'attributes' ][ 'id' ]."'>", |
|
| 474 | + $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $aField[ 'label' ] ), |
|
| 475 | 475 | $_sLabel |
| 476 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
| 476 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
| 477 | 477 | . $_sLabel |
| 478 | 478 | . "</span>" |
| 479 | 479 | : '', |
| 480 | 480 | $this->_getEditor( $aField ), |
| 481 | - $this->getElementByLabel( $aField['after_input'], $sKey, $aField[ 'label' ] ), |
|
| 481 | + $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $aField[ 'label' ] ), |
|
| 482 | 482 | "</label>", |
| 483 | 483 | "</div>", |
| 484 | - $this->getElementByLabel( $aField['after_label'], $sKey, $aField[ 'label' ] ), |
|
| 484 | + $this->getElementByLabel( $aField[ 'after_label' ], $sKey, $aField[ 'label' ] ), |
|
| 485 | 485 | ); |
| 486 | 486 | return implode( '', $_aOutput ); |
| 487 | 487 | |
@@ -494,31 +494,31 @@ discard block |
||
| 494 | 494 | */ |
| 495 | 495 | private function _getEditor( $aField ) { |
| 496 | 496 | |
| 497 | - unset( $aField['attributes']['value'] ); |
|
| 497 | + unset( $aField[ 'attributes' ][ 'value' ] ); |
|
| 498 | 498 | |
| 499 | 499 | // For no TinyMCE |
| 500 | - if ( empty( $aField['rich'] ) || ! $this->isTinyMCESupported() ) { |
|
| 501 | - return "<textarea " . $this->getAttributes( $aField['attributes'] ) . " >" // this method is defined in the base class |
|
| 502 | - . esc_textarea( $aField['value'] ) |
|
| 500 | + if ( empty( $aField[ 'rich' ] ) || !$this->isTinyMCESupported() ) { |
|
| 501 | + return "<textarea ".$this->getAttributes( $aField[ 'attributes' ] )." >" // this method is defined in the base class |
|
| 502 | + . esc_textarea( $aField[ 'value' ] ) |
|
| 503 | 503 | . "</textarea>"; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | // Rich editor |
| 507 | 507 | ob_start(); |
| 508 | 508 | wp_editor( |
| 509 | - $aField['value'], |
|
| 510 | - $aField['attributes']['id'], |
|
| 509 | + $aField[ 'value' ], |
|
| 510 | + $aField[ 'attributes' ][ 'id' ], |
|
| 511 | 511 | $this->uniteArrays( |
| 512 | - ( array ) $aField['rich'], |
|
| 512 | + ( array ) $aField[ 'rich' ], |
|
| 513 | 513 | array( |
| 514 | 514 | 'wpautop' => true, // use wpautop? |
| 515 | 515 | 'media_buttons' => true, // show insert/upload button(s) |
| 516 | - 'textarea_name' => $aField['attributes']['name'], |
|
| 517 | - 'textarea_rows' => $aField['attributes']['rows'], |
|
| 516 | + 'textarea_name' => $aField[ 'attributes' ][ 'name' ], |
|
| 517 | + 'textarea_rows' => $aField[ 'attributes' ][ 'rows' ], |
|
| 518 | 518 | 'tabindex' => '', |
| 519 | 519 | 'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE |
| 520 | 520 | 'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped". |
| 521 | - 'editor_class' => $aField['attributes']['class'], // add extra class(es) to the editor textarea |
|
| 521 | + 'editor_class' => $aField[ 'attributes' ][ 'class' ], // add extra class(es) to the editor textarea |
|
| 522 | 522 | 'teeny' => false, // output the minimal editor config used in Press This |
| 523 | 523 | 'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css) |
| 524 | 524 | 'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | ob_end_clean(); |
| 531 | 531 | |
| 532 | 532 | return $_sContent |
| 533 | - . $this->_getScriptForRichEditor( $aField['attributes']['id'] ); |
|
| 533 | + . $this->_getScriptForRichEditor( $aField[ 'attributes' ][ 'id' ] ); |
|
| 534 | 534 | |
| 535 | 535 | } |
| 536 | 536 | |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * Sets up hooks and properties. |
| 24 | 24 | */ |
| 25 | - public function __construct( $oProp, $oMsg=null ) { |
|
| 25 | + public function __construct( $oProp, $oMsg = null ) { |
|
| 26 | 26 | |
| 27 | - if ( ! $this->_isLoadable( $oProp ) ) { |
|
| 27 | + if ( !$this->_isLoadable( $oProp ) ) { |
|
| 28 | 28 | return; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | add_action( 'in_admin_footer', array( $this, '_replyToSetFooterInfo' ) ); |
| 35 | 35 | |
| 36 | 36 | // Add an action link in the plugin listing page |
| 37 | - if ( 'plugins.php' === $this->oProp->sPageNow && 'plugin' === $this->oProp->aScriptInfo['sType'] ) { |
|
| 37 | + if ( 'plugins.php' === $this->oProp->sPageNow && 'plugin' === $this->oProp->aScriptInfo[ 'sType' ] ) { |
|
| 38 | 38 | add_filter( |
| 39 | - 'plugin_action_links_' . plugin_basename( $this->oProp->aScriptInfo['sPath'] ), |
|
| 39 | + 'plugin_action_links_'.plugin_basename( $this->oProp->aScriptInfo[ 'sPath' ] ), |
|
| 40 | 40 | array( $this, '_replyToAddSettingsLinkInPluginListingPage' ), |
| 41 | 41 | 20 // set a lower priority so that the link will be embedded at the beginning ( the most left hand side ). |
| 42 | 42 | ); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * @return boolean |
| 51 | 51 | */ |
| 52 | 52 | private function _isLoadable( $oProp ) { |
| 53 | - if ( ! $oProp->bIsAdmin ) { |
|
| 53 | + if ( !$oProp->bIsAdmin ) { |
|
| 54 | 54 | return false; |
| 55 | 55 | } |
| 56 | 56 | if ( $oProp->bIsAdminAjax ) { |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function _setDefaultFooterText() { |
| 82 | 82 | |
| 83 | - $this->oProp->aFooterInfo['sLeft'] = str_replace( |
|
| 83 | + $this->oProp->aFooterInfo[ 'sLeft' ] = str_replace( |
|
| 84 | 84 | '__SCRIPT_CREDIT__', |
| 85 | 85 | $this->_getFooterInfoLeft( $this->oProp->aScriptInfo ), |
| 86 | - $this->oProp->aFooterInfo['sLeft'] |
|
| 86 | + $this->oProp->aFooterInfo[ 'sLeft' ] |
|
| 87 | 87 | ); |
| 88 | - $this->oProp->aFooterInfo['sRight'] = str_replace( |
|
| 88 | + $this->oProp->aFooterInfo[ 'sRight' ] = str_replace( |
|
| 89 | 89 | '__FRAMEWORK_CREDIT__', |
| 90 | 90 | $this->_getFooterInfoRight( $this->oProp->_getLibraryData() ), |
| 91 | - $this->oProp->aFooterInfo['sRight'] |
|
| 91 | + $this->oProp->aFooterInfo[ 'sRight' ] |
|
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | 94 | } |
@@ -102,52 +102,52 @@ discard block |
||
| 102 | 102 | private function _getFooterInfoLeft( $aScriptInfo ) { |
| 103 | 103 | |
| 104 | 104 | $_sDescription = $this->getAOrB( |
| 105 | - empty( $aScriptInfo['sDescription'] ), |
|
| 105 | + empty( $aScriptInfo[ 'sDescription' ] ), |
|
| 106 | 106 | '', |
| 107 | - " {$aScriptInfo['sDescription']}" |
|
| 107 | + " {$aScriptInfo[ 'sDescription' ]}" |
|
| 108 | 108 | ); |
| 109 | 109 | $_sVersion = $this->getAOrB( |
| 110 | - empty( $aScriptInfo['sVersion'] ), |
|
| 110 | + empty( $aScriptInfo[ 'sVersion' ] ), |
|
| 111 | 111 | '', |
| 112 | - " {$aScriptInfo['sVersion']}" |
|
| 112 | + " {$aScriptInfo[ 'sVersion' ]}" |
|
| 113 | 113 | ); |
| 114 | 114 | $_sPluginInfo = $this->getAOrB( |
| 115 | - empty( $aScriptInfo['sURI'] ), |
|
| 116 | - $aScriptInfo['sName'], |
|
| 115 | + empty( $aScriptInfo[ 'sURI' ] ), |
|
| 116 | + $aScriptInfo[ 'sName' ], |
|
| 117 | 117 | $this->getHTMLTag( |
| 118 | 118 | 'a', |
| 119 | 119 | array( |
| 120 | - 'href' => $aScriptInfo['sURI'], |
|
| 120 | + 'href' => $aScriptInfo[ 'sURI' ], |
|
| 121 | 121 | 'target' => '_blank', |
| 122 | - 'title' => $aScriptInfo['sName'] . $_sVersion . $_sDescription |
|
| 122 | + 'title' => $aScriptInfo[ 'sName' ].$_sVersion.$_sDescription |
|
| 123 | 123 | ), |
| 124 | - $aScriptInfo['sName'] |
|
| 124 | + $aScriptInfo[ 'sName' ] |
|
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | 128 | $_sAuthorInfo = $this->getAOrB( |
| 129 | - empty( $aScriptInfo['sAuthorURI'] ), |
|
| 129 | + empty( $aScriptInfo[ 'sAuthorURI' ] ), |
|
| 130 | 130 | '', |
| 131 | 131 | $this->getHTMLTag( |
| 132 | 132 | 'a', |
| 133 | 133 | array( |
| 134 | - 'href' => $aScriptInfo['sAuthorURI'], |
|
| 134 | + 'href' => $aScriptInfo[ 'sAuthorURI' ], |
|
| 135 | 135 | 'target' => '_blank', |
| 136 | - 'title' => $aScriptInfo['sAuthor'], |
|
| 136 | + 'title' => $aScriptInfo[ 'sAuthor' ], |
|
| 137 | 137 | ), |
| 138 | - $aScriptInfo['sAuthor'] |
|
| 138 | + $aScriptInfo[ 'sAuthor' ] |
|
| 139 | 139 | ) |
| 140 | 140 | ); |
| 141 | 141 | $_sAuthorInfo = $this->getAOrB( |
| 142 | - empty( $aScriptInfo['sAuthor'] ), |
|
| 142 | + empty( $aScriptInfo[ 'sAuthor' ] ), |
|
| 143 | 143 | $_sAuthorInfo, |
| 144 | - ' by ' . $_sAuthorInfo |
|
| 144 | + ' by '.$_sAuthorInfo |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | 147 | // Enclosing the output in a span tag as the outer element is a '<p>' tag. So this cannot be div. |
| 148 | 148 | // 3.5.7+ Added the class attribute for acceptance testing |
| 149 | 149 | return "<span class='apf-script-info'>" |
| 150 | - . $_sPluginInfo . $_sAuthorInfo |
|
| 150 | + . $_sPluginInfo.$_sAuthorInfo |
|
| 151 | 151 | . "</span>"; |
| 152 | 152 | |
| 153 | 153 | } |
@@ -161,26 +161,26 @@ discard block |
||
| 161 | 161 | private function _getFooterInfoRight( $aScriptInfo ) { |
| 162 | 162 | |
| 163 | 163 | $_sDescription = $this->getAOrB( |
| 164 | - empty( $aScriptInfo['sDescription'] ), |
|
| 164 | + empty( $aScriptInfo[ 'sDescription' ] ), |
|
| 165 | 165 | '', |
| 166 | - " {$aScriptInfo['sDescription']}" |
|
| 166 | + " {$aScriptInfo[ 'sDescription' ]}" |
|
| 167 | 167 | ); |
| 168 | 168 | $_sVersion = $this->getAOrB( |
| 169 | - empty( $aScriptInfo['sVersion'] ), |
|
| 169 | + empty( $aScriptInfo[ 'sVersion' ] ), |
|
| 170 | 170 | '', |
| 171 | - " {$aScriptInfo['sVersion']}" |
|
| 171 | + " {$aScriptInfo[ 'sVersion' ]}" |
|
| 172 | 172 | ); |
| 173 | 173 | $_sLibraryInfo = $this->getAOrB( |
| 174 | - empty( $aScriptInfo['sURI'] ), |
|
| 175 | - $aScriptInfo['sName'], |
|
| 174 | + empty( $aScriptInfo[ 'sURI' ] ), |
|
| 175 | + $aScriptInfo[ 'sName' ], |
|
| 176 | 176 | $this->getHTMLTag( |
| 177 | 177 | 'a', |
| 178 | 178 | array( |
| 179 | - 'href' => $aScriptInfo['sURI'], |
|
| 179 | + 'href' => $aScriptInfo[ 'sURI' ], |
|
| 180 | 180 | 'target' => '_blank', |
| 181 | - 'title' => $aScriptInfo['sName'] . $_sVersion . $_sDescription, |
|
| 181 | + 'title' => $aScriptInfo[ 'sName' ].$_sVersion.$_sDescription, |
|
| 182 | 182 | ), |
| 183 | - $aScriptInfo['sName'] |
|
| 183 | + $aScriptInfo[ 'sName' ] |
|
| 184 | 184 | ) |
| 185 | 185 | ); |
| 186 | 186 | |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | // 3.5.7+ added the 'apf-credit' class attribute for acceptance testing |
| 189 | 189 | // DEVVER+ added the footer-thankyou id attribute. |
| 190 | 190 | return "<span class='apf-credit' id='footer-thankyou'>" |
| 191 | - . $this->oMsg->get( 'powered_by' ) . ' ' |
|
| 191 | + . $this->oMsg->get( 'powered_by' ).' ' |
|
| 192 | 192 | . $_sLibraryInfo |
| 193 | 193 | . ", " |
| 194 | - . $this->oMsg->get( 'and' ) . ' ' |
|
| 194 | + . $this->oMsg->get( 'and' ).' ' |
|
| 195 | 195 | . $this->getHTMLTag( |
| 196 | 196 | 'a', |
| 197 | 197 | array( |
| 198 | 198 | 'href' => 'https://wordpress.org', |
| 199 | 199 | 'target' => '_blank', |
| 200 | - 'title' => 'WordPress ' . $GLOBALS[ 'wp_version' ] |
|
| 200 | + 'title' => 'WordPress '.$GLOBALS[ 'wp_version' ] |
|
| 201 | 201 | ), |
| 202 | 202 | 'WordPress' |
| 203 | 203 | ) |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | protected function _setFooterHooks() { |
| 215 | 215 | |
| 216 | - add_filter( 'admin_footer_text' , array( $this, '_replyToAddInfoInFooterLeft' ) ); |
|
| 216 | + add_filter( 'admin_footer_text', array( $this, '_replyToAddInfoInFooterLeft' ) ); |
|
| 217 | 217 | add_filter( 'update_footer', array( $this, '_replyToAddInfoInFooterRight' ), 11 ); |
| 218 | 218 | |
| 219 | 219 | } |
@@ -225,15 +225,15 @@ discard block |
||
| 225 | 225 | * @callback filter admin_footer_text |
| 226 | 226 | * @internal |
| 227 | 227 | */ |
| 228 | - public function _replyToAddInfoInFooterLeft( $sLinkHTML='' ) { |
|
| 228 | + public function _replyToAddInfoInFooterLeft( $sLinkHTML = '' ) { |
|
| 229 | 229 | |
| 230 | - $sLinkHTML = empty( $this->oProp->aScriptInfo['sName'] ) |
|
| 230 | + $sLinkHTML = empty( $this->oProp->aScriptInfo[ 'sName' ] ) |
|
| 231 | 231 | ? $sLinkHTML |
| 232 | - : $this->oProp->aFooterInfo['sLeft']; |
|
| 232 | + : $this->oProp->aFooterInfo[ 'sLeft' ]; |
|
| 233 | 233 | |
| 234 | 234 | return $this->addAndApplyFilters( |
| 235 | 235 | $this->oProp->_getCallerObject(), |
| 236 | - 'footer_left_' . $this->oProp->sClassName, |
|
| 236 | + 'footer_left_'.$this->oProp->sClassName, |
|
| 237 | 237 | $sLinkHTML |
| 238 | 238 | ); |
| 239 | 239 | |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | * @callback filter admin_footer_text |
| 247 | 247 | * @internal |
| 248 | 248 | */ |
| 249 | - public function _replyToAddInfoInFooterRight( $sLinkHTML='' ) { |
|
| 249 | + public function _replyToAddInfoInFooterRight( $sLinkHTML = '' ) { |
|
| 250 | 250 | return $this->addAndApplyFilters( |
| 251 | 251 | $this->oProp->_getCallerObject(), |
| 252 | - 'footer_right_' . $this->oProp->sClassName, |
|
| 253 | - $this->oProp->aFooterInfo['sRight'] |
|
| 252 | + 'footer_right_'.$this->oProp->sClassName, |
|
| 253 | + $this->oProp->aFooterInfo[ 'sRight' ] |
|
| 254 | 254 | ); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @callback action try_validation_after_{class name} |
| 33 | 33 | */ |
| 34 | 34 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 35 | - if ( ! $this->_shouldProceed() ) { |
|
| 35 | + if ( !$this->_shouldProceed() ) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | $this->_doImportOptions( |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | // Check the uploaded file MIME type. |
| 103 | 103 | $_aMIMEType = $this->_getImportMIMEType( $_aArguments ); |
| 104 | 104 | $_sType = $_oImport->getType(); |
| 105 | - if ( ! in_array( $_sType, $_aMIMEType ) ) { |
|
| 105 | + if ( !in_array( $_sType, $_aMIMEType ) ) { |
|
| 106 | 106 | $this->oFactory->setSettingNotice( sprintf( $this->oFactory->oMsg->get( 'uploaded_file_type_not_supported' ), $_sType ) ); |
| 107 | - return $aStoredOptions; // do not change the framework's options. |
|
| 107 | + return $aStoredOptions; // do not change the framework's options. |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Retrieve the importing data. |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | array( |
| 170 | 170 | 'text/plain', |
| 171 | 171 | 'application/octet-stream', // .json file is dealt as a binary file. |
| 172 | - 'application/json', // DEVVER+ some servers cannot upload json files without this |
|
| 172 | + 'application/json', // DEVVER+ some servers cannot upload json files without this |
|
| 173 | 173 | ), |
| 174 | 174 | $aArguments |
| 175 | 175 | ); |
@@ -258,18 +258,18 @@ discard block |
||
| 258 | 258 | protected function _getPortFilterHookNames( $sPrefix, array $aArguments ) { |
| 259 | 259 | |
| 260 | 260 | return array( |
| 261 | - $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_input_id' ], |
|
| 261 | + $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_input_id' ], |
|
| 262 | 262 | $aArguments[ 'section_id' ] |
| 263 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] .'_' . $aArguments[ 'pressed_field_id' ] |
|
| 264 | - : $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'pressed_field_id' ], |
|
| 263 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ].'_'.$aArguments[ 'pressed_field_id' ] |
|
| 264 | + : $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'pressed_field_id' ], |
|
| 265 | 265 | $aArguments[ 'section_id' ] |
| 266 | - ? $sPrefix . $aArguments[ 'class_name' ] . '_' . $aArguments[ 'section_id' ] |
|
| 266 | + ? $sPrefix.$aArguments[ 'class_name' ].'_'.$aArguments[ 'section_id' ] |
|
| 267 | 267 | : null, |
| 268 | 268 | $aArguments[ 'tab_slug' ] |
| 269 | - ? $sPrefix . $aArguments[ 'page_slug' ] . '_' . $aArguments[ 'tab_slug' ] |
|
| 269 | + ? $sPrefix.$aArguments[ 'page_slug' ].'_'.$aArguments[ 'tab_slug' ] |
|
| 270 | 270 | : null, |
| 271 | - $sPrefix . $aArguments[ 'page_slug' ], |
|
| 272 | - $sPrefix . $aArguments[ 'class_name' ] |
|
| 271 | + $sPrefix.$aArguments[ 'page_slug' ], |
|
| 272 | + $sPrefix.$aArguments[ 'class_name' ] |
|
| 273 | 273 | ); |
| 274 | 274 | |
| 275 | 275 | } |