teraßyte Posted July 9, 2022 Posted July 9, 2022 (edited) In "\applications\core\modules\admin\members\members.php" on lines 1233-1237: if ( isset( $_SESSION['member_datalayer_changed'] ) ) { \IPS\Output::i()->inlineMessage = 'Saved'; unset( $_SESSION['member_datalayer_changed'] ); } Replace it with: \IPS\Output::i()->inlineMessage = \IPS\Member::loggedIn()->language()->addToStack('saved'); Edited July 9, 2022 by teraßyte SeNioR- 1
teraßyte Posted July 9, 2022 Author Posted July 9, 2022 (edited) Well, looks like data layer has a lot more hardcoded language strings also in "\applications\core\modules\admin\settings\dataLayer.php". Line 97: return "You should Upgrade!"; Line 139: if ( isset( $_SESSION['deleted_datalayer_property'] ) ) { \IPS\Output::i()->inlineMessage = 'Deleted Property'; unset( $_SESSION['deleted_datalayer_property'] ); } Line 178: $form->add( new \IPS\Helpers\Form\Node( 'core_datalayer_replace_with_sso', $default, false, array( 'class' => '\IPS\Login\Handler', 'zeroVal' => 'Use internal Member ID (default)', 'where' => array( ['login_enabled=?', 1], ['login_classname LIKE ?', '%Login_Handler%'], ['login_classname NOT LIKE ?', '%Login_Handler_Standard'] ), ) ) ); Lines 200 + 204: /* Check for invalid characters */ if ( preg_match( '/[^a-z,A-Z,0-9,\_]/', $_value ) ) { throw new \InvalidArgumentException( 'The variable name can only contain alphanumeric characters and underscores.' ); } elseif ( preg_match( '/[0-9]/', \mb_substr( $_value, 0, 1 ) ) ) { throw new \InvalidArgumentException( 'The variable name cannot start with a number.' ); } Line 220: if ( class_exists( 'IPS\cloud\DataLayer' ) AND \IPS\core\DataLayer::i() instanceof \IPS\cloud\DataLayer AND \count( \IPS\Db::i()->select( 'datalayer_key', \IPS\cloud\DataLayer\Handler::$databaseTable, $where, null, 1 ) ) ) { throw new \InvalidArgumentException( "$_value or window.$_value is in use by a custom handler." ); } Line 479: \IPS\Output::i()->title = 'Add property'; Lines 571 + 579: foreach ( array_keys( $events ) as $_eventKey ) { $events[$_eventKey]['description'] = 'Fires when ' . $events[$_eventKey]['description']; } /* Create our sidebar */ $eventSelector = \IPS\Theme::i()->getTemplate( 'settings', 'core', 'admin' )->dataLayerSelector( $events, 'events', 'event_key', 'Data Layer Events', $event_key, true, array( $this, '_truncate' ) ); Line 674: /* Render Content */ $event['description'] = "Fires when {$event['description']}"; Lines 700 + 705 + 718: if ( $group === 'properties' AND \strtolower( $value ) === 'event' ) { throw new \InvalidArgumentException( "You cannot name a property '$value' because that key is reserved" ); } if ( preg_match( '/[^a-z,A-Z,\_]/', $value ) ) { throw new \InvalidArgumentException( 'The name can only contain letters and underscores.' ); } $collection = ( $group === 'events' ) ? \IPS\core\DataLayer::i()->eventConfiguration : \IPS\core\DataLayer::i()->propertiesConfiguration; foreach ( $collection as $key => $data ) { if ( $key === $current ) { continue; } if ( isset( $data['formatted_name'] ) AND $data['formatted_name'] === $value ) { throw new \InvalidArgumentException( 'This Data Layer name is already in use' ); } } Line 733 + 745: public function _enabledDisabled( $val, $row=null ) { return $val ? 'Enabled' : 'Disabled'; } public function _yesNo( $val, $row=null ) { return $val ? 'Yes' : 'No'; } And one more thing I noticed is that some TEMPLATES are hardcoded in the file rather than using PHTML files like every other ACP area. Also, PHP variables are often used inline without wrapping them with curly brackets. Here's some examples below from the "\applications\core\modules\admin\settings\dataLayer.php" file: $output = $this->$tab(); $output = "<div id='dataLayerContent'>$output</div>" ; === return "<br>$form"; === return "<span class='ipsType_monospace ipsMargin:none'><a href='$url' data-ipstooltip title='$title'>$val</a></span>"; === return "<span class='ipsMargin:none ipsType_monospace'><a href='$url' data-ipstooltip title='$title'>$val</a></span>"; === return "<pre class='ipsMargin:none'><a href='$url' data-ipstooltip title='$title' >$val</a></pre>"; Edited July 9, 2022 by teraßyte SeNioR- 1
teraßyte Posted July 9, 2022 Author Posted July 9, 2022 Another file full of hardcoded language strings is \applications\core\sources\DataLayer\DataLayer.php. SeNioR- 1
Recommended Posts