���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC = 8) { // PHP 8 require_once AD_INSERTER_PLUGIN_DIR.'includes/google-api-8/vendor/autoload.php'; require_once AD_INSERTER_PLUGIN_DIR.'includes/google-api-8/vendor/google/apiclient-services/src/Adsense.php'; } else { require_once AD_INSERTER_PLUGIN_DIR.'includes/google-api/vendor/autoload.php'; require_once AD_INSERTER_PLUGIN_DIR.'includes/google-api/vendor/google/apiclient-services/src/Adsense.php'; } class adsense_api { protected $apiClient; protected $adSenseService; protected $publisherID; protected $error; public function __construct () { $this->apiClient = new Google_Client (); $this->apiClient->setClientId (AI_ADSENSE_CLIENT_ID); $this->apiClient->setClientSecret (AI_ADSENSE_CLIENT_SECRET); $this->apiClient->setRedirectUri ('https://a.adinserter.pro/'); $this->apiClient->setScopes (array ('https://www.googleapis.com/auth/adsense.readonly')); $this->apiClient->setAccessType ('offline'); $adsense_api_state = array ( 'nonce' => base64_encode (wp_create_nonce ("adinserter_data")), 'return-url' => base64_encode (admin_url ('options-general.php?page=ad-inserter.php')), ); $this->apiClient->setState (base64_encode (serialize ($adsense_api_state))); $this->adSenseService = new Google_Service_AdSense ($this->apiClient); } public function getAuthUrl () { $this->apiClient->setApprovalPrompt ('force'); return ($this->apiClient->createAuthUrl ()); } public function authenticate () { $token = $this->getToken (); if (isset ($token)) { // We already have the token. $this->apiClient->setAccessToken ($token); } else { // Override the scope to use the readonly one $this->apiClient->setScopes (array("https://www.googleapis.com/auth/adsense.readonly")); // Go get the token $this->apiClient->authenticate (AI_ADSENSE_AUTHORIZATION_CODE); $this->saveToken ($this->apiClient->getAccessToken ()); } } public function getAdSenseService () { return $this->adSenseService; } public function getAdSensePublisherID () { return $this->publisherID; } public function getError () { return $this->error; } public function isTokenValid () { $token = $this->getToken (); return isset ($token); } public function refreshToken ($adunit_code_id = '') { if ($this->apiClient->getAccessToken () != null) { $this->saveToken ($this->apiClient->getAccessToken()); } } public function getAdUnits () { $adsense_data = array (); $this->error = ''; try { $this->authenticate (); if ($this->isTokenValid ()) { $adsense_service = $this->getAdSenseService (); $optParams ['pageSize'] = 20; $pageToken = null; $optParams ['pageToken'] = $pageToken; try { $accounts = $adsense_service->accounts->listAccounts ($optParams); if (!isset ($accounts) || empty ($accounts)) { throw (new Exception ('No valid AdSense account')); } $aiAccountId = $accounts->accounts [0]['name']; if (isset ($aiAccountId)) { $account_data = explode ('/', $aiAccountId); if (isset ($account_data [1])) { $this->publisherID = $account_data [1]; } } try { $adClients = $adsense_service->accounts_adclients->listAccountsAdclients ($aiAccountId, $optParams); if (!isset ($adClients) || empty ($adClients)) { throw (new Exception ('No valid AdSense ad client')); } $aiAdClient = null; foreach ($adClients as $adClient) { if ($adClient->productCode == 'AFC') { $aiAdClient = $adClient; break; } } if (!$aiAdClient) throw (new Exception ('No valid AdSense ad client for AFC product')); $aiAdClientId = $aiAdClient ['name']; try { $optParams ['pageSize'] = 50; $adsense_adunits = array (); $pageToken = null; do { $optParams['pageToken'] = $pageToken; $adsense_adunits_page = $adsense_service->accounts_adclients_adunits->listAccountsAdclientsAdunits ($aiAdClientId, $optParams); if (!empty ($adsense_adunits_page ['adUnits'])) { $adsense_adunits = array_merge ($adsense_adunits, $adsense_adunits_page ['adUnits']); if (isset($adsense_adunits_page ['nextPageToken'])) { $pageToken = $adsense_adunits_page ['nextPageToken']; } else $pageToken = null; } } while ($pageToken); foreach ($adsense_adunits as $adsense_adunit) { $name_elements = explode ('/', $adsense_adunit ['name']); $adsense_data [] = array ( 'id' => $adsense_adunit ['name'], 'name' => $adsense_adunit ['displayName'], 'code' => end ($name_elements), 'type' => $adsense_adunit->contentAdsSettings ['type'], 'size' => str_replace (array ('1x3'), array (''), $adsense_adunit->contentAdsSettings ['size']), 'active' => $adsense_adunit ['state'] == 'ACTIVE', ); } } catch (Google_Service_Exception $e ) { $adsense_err = $e->getErrors (); $this->error = 'List Ad Units Error: ' . strip_tags ($e->getMessage ()) . ' ' . $adsense_err [0]['message']; } } catch (Google_Service_Exception $e ) { $adsense_err = $e->getErrors (); $this->error = 'List Ad Clients Error: ' . strip_tags ($e->getMessage ()) . ' ' . $adsense_err [0]['message']; } } catch (Google_Service_Exception $e ) { $adsense_err = $e->getErrors (); $this->error = 'List Accounts Error: ' . strip_tags ($e->getMessage ()) . ' ' . $adsense_err [0]['message']; } catch (Exception $e ) { $this->error = 'Error: ' . strip_tags ($e->getMessage()); } } else { } } catch (Exception $e) { $this->error = 'AdSense authentication failed: ' . strip_tags ($e->getMessage ()); } if ($this->error != '') return array (); return $adsense_data; } public function getAdCode ($adunit_code_id = '') { $adsense_data = ''; $this->error = ''; try { $this->authenticate (); if ($this->isTokenValid ()) { $adsense_service = $this->getAdSenseService (); try { // Ad unit code $adsense_adunits_code = $adsense_service->accounts_adclients_adunits->getAdcode ($adunit_code_id); $adsense_data = $adsense_adunits_code ['adCode']; } catch (Google_Service_Exception $e ) { $adsense_err = $e->getErrors (); $this->error = 'List Ad Units Error: ' . $adsense_err [0]['message']; } catch (Exception $e ) { $this->error = 'Error: ' . strip_tags ($e->getMessage()); } } } catch (Exception $e) { $this->error = 'AdSense authentication failed: ' . strip_tags ($e->getMessage ()); } if ($this->error != '') return ''; return $adsense_data; } private function saveToken ($token) { if ($token != null) set_transient (AI_TRANSIENT_ADSENSE_TOKEN, $token); } private function getToken () { $token = get_transient (AI_TRANSIENT_ADSENSE_TOKEN); if ($token === false) return null; else return $token; } }