public static function hookData() { return array_merge_recursive(array('profile' => array(0 => array('selector' => '#elProfileInfoColumn > div.ipsAreaBackground_light.ipsPad', 'type' => 'add_inside_end', 'content' => '{{ $memberMarker = FALSE; try { $memberMarker = \\IPS\\membermap\\Map::i()->getMarkerByMember( $member->member_id ); } catch( \\Exception $ex ){ } }} {{if $memberMarker AND $memberMarker !== false AND count( $memberMarker ) AND \\IPS\\Member::loggedIn()->canAccessModule( \\IPS\\Application\\Module::get( "membermap", "membermap" ) )}} {template="profileMap" group="map" app="membermap" params="$member"} {{endif}}'))), parent::hookData()); }
public function formatValue() { if (in_array($this->htmlId, array('marker_lat', 'marker_lon'))) { $value = $this->value; $value = floatval($value); $value = round($value, 6); /* Convert decimal point and thousand separators to a way PHP understand */ $value = str_replace(trim(\IPS\Member::loggedIn()->language()->locale['thousands_sep']), '', $value); $value = str_replace(trim(\IPS\Member::loggedIn()->language()->locale['decimal_point']), '.', $value); /* If it's not numeric, throw an exception */ if (!is_numeric($value) and $value !== '' and $this->required === FALSE or !is_numeric($value) and $this->required === TRUE) { throw new \InvalidArgumentException('form_number_bad'); } return $value; } else { return parent::formatValue(); } }
public static function hookData() { $last_check = intval(\IPS\Settings::i()->cleantalk_last_check); $last_status = intval(\IPS\Settings::i()->cleantalk_last_status); $api_key = \IPS\Settings::i()->access_key; $result = ''; $html = ''; if (time() - $last_check > 86400 && $api_key != 0 && $api_key != '') { $data = array(); $data['auth_key'] = $api_key; $data['method_name'] = 'notice_validate_key'; if (!function_exists('sendRawRequest')) { require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/../uploads/cleantalk.class.php"; require_once dirname($_SERVER['SCRIPT_FILENAME']) . "/../uploads/JSON.php"; } $result = sendRawRequest('https://api.cleantalk.org', $data); $result = json_decode(trim($result)); if (isset($result->valid)) { $new_status = intval($result->valid); \IPS\Settings::i()->cleantalk_last_status = $new_status; } else { $new_status = 0; } if ($new_status == 1 && $last_status == 0) { \IPS\Settings::i()->cleantalk_show_banner = 1; } \IPS\Settings::i()->cleantalk_last_check = time(); } if (isset($_COOKIE['cleantalk_close_banner'])) { \IPS\Settings::i()->cleantalk_show_banner = 0; } $show_banner = intval(\IPS\Settings::i()->cleantalk_show_banner); if ($show_banner == 1) { $html = "<div style='width:99%;background: #90EE90; padding:10px;border: 2px dashed green;margin:3px;font-size:16px;text-align:center;' id='cleantalk_banner'>Like antispam by CleanTalk? <a href='https://community.invisionpower.com/files/file/7706-anti-spam-ips4/' target='_blank'>Leave a review!</a><div style='float:right;margin-top:-5px;margin-right:-5px;'><a href=# style='text-decoration:none;font-size:14px;font-weight:600;' onclick='jQuery(\"#cleantalk_banner\").hide(\"slow\");document.cookie=\"cleantalk_close_banner = 1;\"'>X</a></div></div>"; } return array_merge_recursive(array('globalTemplate' => array(0 => array('selector' => '#acpPageHeader', 'type' => 'add_after', 'content' => $html))), parent::hookData()); }