updateAdsTxtOnDemand(); } function admin_notice() { if (get_option('affilinet_webservice_login_is_correct') === 'false') { ?>

affilinet Performance Ads:
Please make sure you have entered the correct PublisherID and Webservice password.', 'affilinet-performance-module' ); ?>

adsTxtExistsAndIsUpToDate()) { ?>

affilinet Performance Ads:
Missing ads.txt file. Please see instructions on settings page ', 'affilinet-performance-module' ); ?>

' . __( 'Settings', 'affilinet-performance-module' ) . ''; array_push( $links, $settings_link ); return $links; } /** * Register the widget */ public function register_widget() { register_widget('Affilinet_Widget'); } /** * Load Admin scripts * @param $hook string */ public function admin_enqueue_scripts($hook) { // on post page add the editor button for affilinet plugin if ($hook === 'post.php' || $hook == 'post-new.php') { add_action('admin_head', array($this, 'editor_add_buttons')); add_action( "admin_head-$hook",array($this, 'affilinet_adminScript') ); } // on reporting page add jquery.flot if ($hook === 'affilinet_page_affilinet_reporting') { wp_register_script('flot', plugin_dir_url( plugin_basename( dirname(__FILE__) ) ).'js/jquery-flot/jquery.flot.js', array('jquery')); wp_register_script('flot.time', plugin_dir_url( plugin_basename( dirname(__FILE__) ) ).'js/jquery-flot/jquery.flot.time.js', array('jquery', 'flot')); wp_enqueue_script('flot'); wp_enqueue_script('flot.time'); } } public function enqueue_bidding_script() { switch ($platformId = get_option('affilinet_platform')) { case 7: // AT $country = 'at'; break; case 6: // CH $country = 'ch'; break; case 1: // DE $country = 'de'; break; case 3: // FR $country = 'fr'; break; case 2: // UK (prebidding not implemented) case 4: // NL (prebidding not implemented) default : return; } $publisherId = get_option('affilinet_publisher_id'); if ($publisherId == null) return; echo ''; $link = array( 'de' => 'https://html-links.com/banners/9192/js/affnetpbjs_de.min.js', 'at' => 'https://html-links.com/banners/12376/js/affnetpbjs_at.min.js', 'ch' => 'https://html-links.com/banners/12252/js/affnetpbjs_ch.min.js', 'fr' => 'https://html-links.com/banners/12751/js/affnetpbjs_fr.min.js', ); echo ''; } /** * Shortcode */ public function performance_ad_shortcode($params = array()) { // default size parameter /** * @var String $size */ extract(shortcode_atts(array( 'size' => '728x90', ), $params)); return Affilinet_PerformanceAds::getAdCode($size); } /** * TRANSLATION */ public function load_textdomain() { load_plugin_textdomain( 'affilinet-performance-module', false, dirname(dirname( plugin_basename( __FILE__ ) )) . '/languages' ); } /** * TinyMCE Editor Button */ public function editor_add_buttons() { // check user permissions if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) { return; } // check if WYSIWYG is enabled if (get_user_option('rich_editing') == 'true') { add_filter('mce_external_plugins', array($this, 'add_buttons')); add_filter('mce_buttons', array($this, 'register_buttons')); } } /** * Load TinyMCE Variables */ public function affilinet_adminScript() { $img = plugin_dir_url( plugin_basename( dirname(__FILE__) ) ). 'images/'; ?> adsTxtExistsAndIsUpToDate()) { $this->writeAdsTxt($filePath, $this->getAdsTxtContent()); } } public static function getAdsTxtContent() { return '# affilinet-performance-module-start' . PHP_EOL . '# Do not modify the following lines' . PHP_EOL . '# Ver. 1.9.1' . PHP_EOL . 'appnexus.com, 8332, RESELLER, f5ab79cb980f11d1' . PHP_EOL . 'appnexus.com, 8327, RESELLER, f5ab79cb980f11d1' . PHP_EOL . 'appnexus.com, 8334, RESELLER, f5ab79cb980f11d1' . PHP_EOL . 'appnexus.com, 8333, RESELLER, f5ab79cb980f11d1'. PHP_EOL . '# affilinet-performance-module-end' . PHP_EOL; } private function writeAdsTxt($filePath, $content) { try { $fp = @fopen($filePath, "a+"); if ( !$fp ) { throw new Exception('File open failed.'); } @fwrite($fp, $content); @fclose($fp); } catch ( Exception $e ) { // no output intended } } }