public function enqueue_scripts() { global $gadsense_globals, $pagenow, $post_type; $screen = get_current_screen(); $plugin = Advanced_Ads_Admin::get_instance(); if ('post-new.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type || 'post.php' == $pagenow && Advanced_Ads::POST_TYPE_SLUG == $post_type && isset($_GET['action']) && 'edit' == $_GET['action']) { $default_script = array('path' => GADSENSE_BASE_URL . 'admin/assets/js/new-ad.js', 'dep' => array('jquery'), 'version' => null); $scripts = array('gadsense-new-ad' => $default_script); // Allow modifications of script files to enqueue $scripts = apply_filters('advanced-ads-gadsense-ad-param-script', $scripts); foreach ($scripts as $handle => $value) { if (empty($handle)) { continue; } if (!empty($handle) && empty($value)) { // Allow inclusion of WordPress's built-in script like jQuery wp_enqueue_script($handle); } else { if (!isset($value['version'])) { $value['version'] = null; } wp_enqueue_script($handle, $value['path'], $value['dep'], $value['version']); } } $styles = array(); // Allow modifications of default style files to enqueue $styles = apply_filters('advanced-ads-gadsense-ad-param-style', $styles); foreach ($styles as $handle => $value) { if (!isset($value['path']) || !isset($value['dep']) || empty($handle)) { continue; } if (!isset($value['version'])) { $value['version'] = null; } wp_enqueue_style($handle, $value['path'], $value['dep'], $value['version']); } } }
?> </strong></p></div> <?php return; } do_action("{$taxonomy}_pre_edit_form", $tag, $taxonomy); ?> <div class="wrap"> <h1><?php echo $tax->labels->edit_item; ?> </h1> <div id="ajax-response"></div> <form name="editgroup" id="editgroup" method="post" action="<?php echo Advanced_Ads_Admin::group_page_url(); ?> " class="validate"<?php do_action($taxonomy . '_term_edit_form_tag'); ?> > <input type="hidden" name="action" value="editedgroup" /> <input type="hidden" name="group_id" value="<?php echo $group_id; ?> " /> <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?> " /> <?php
/** * Return an instance of this class. * * @since 1.0.0 * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
return; } // load basic path to the plugin define('ADVADS_BASE_PATH', plugin_dir_path(__FILE__)); define('ADVADS_BASE_URL', plugin_dir_url(__FILE__)); define('ADVADS_BASE_DIR', dirname(plugin_basename(__FILE__))); // directory of the plugin without any paths // general and global slug, e.g. to store options in WP, textdomain define('ADVADS_SLUG', 'advanced-ads'); define('ADVADS_URL', 'https://wpadvancedads.com/'); define('ADVADS_VERSION', '1.6.2.1'); /*----------------------------------------------------------------------------* * Autoloading, modules and functions *----------------------------------------------------------------------------*/ // load public functions (might be used by modules, other plugins or theme) require_once ADVADS_BASE_PATH . 'includes/functions.php'; require_once ADVADS_BASE_PATH . 'includes/load_modules.php'; Advanced_Ads_ModuleLoader::getLoader(); // enable autoloading /*----------------------------------------------------------------------------* * Public-Facing and Core Functionality *----------------------------------------------------------------------------*/ Advanced_Ads::get_instance(); Advanced_Ads_ModuleLoader::loadModules(ADVADS_BASE_PATH . 'modules/'); // enable modules, requires base class /*----------------------------------------------------------------------------* * Dashboard and Administrative Functionality *----------------------------------------------------------------------------*/ if (is_admin()) { Advanced_Ads_Admin::get_instance(); }
/** * * display notices * */ public function display_notices() { if (defined('DOING_AJAX')) { return; } if ($this->notices === array()) { return; } // load notices include ADVADS_BASE_PATH . '/admin/includes/notices.php'; // iterate through notices $count = 0; foreach ($this->notices as $_notice) { if (isset($advanced_ads_admin_notices[$_notice])) { $notice = $advanced_ads_admin_notices[$_notice]; $text = $advanced_ads_admin_notices[$_notice]['text']; $type = isset($advanced_ads_admin_notices[$_notice]['type']) ? $advanced_ads_admin_notices[$_notice]['type'] : ''; } else { continue; } switch ($type) { case 'info': include ADVADS_BASE_PATH . '/admin/views/notices/info.php'; break; case 'subscribe': include ADVADS_BASE_PATH . '/admin/views/notices/subscribe.php'; break; case 'plugin_error': // only display on plugin pages if (Advanced_Ads_Admin::screen_belongs_to_advanced_ads()) { include ADVADS_BASE_PATH . '/admin/views/notices/plugin_error.php'; } else { continue 2; // continue with next foreach loop } break; default: include ADVADS_BASE_PATH . '/admin/views/notices/error.php'; } if (++$count == self::MAX_NOTICES) { break; } } }
/** * deactivate license of an add-on * * @since 1.6.11 */ public function deactivate_license() { // check nonce check_ajax_referer('advads_ajax_license_nonce', 'security'); if (!isset($_POST['addon']) || $_POST['addon'] === '') { die; } echo Advanced_Ads_Admin::get_instance()->deactivate_license($_POST['addon'], $_POST['pluginname'], $_POST['optionslug']); die; }
if ( isset($_REQUEST['message']) && ( $msg = (int) $_REQUEST['message'] ) || isset($forced_message) ) { if ( isset($msg) && isset($messages[$taxonomy][$msg]) ){ $message = $messages[$taxonomy][$msg]; } elseif ( isset($messages[$taxonomy][$forced_message]) ) { $message = $messages[$taxonomy][$forced_message]; } }*/ ?> <div class="wrap nosubsub"> <h1><?php echo esc_html($title); if (!empty($_REQUEST['s'])) { printf('<span class="subtitle">' . __('Search results for “%s”', 'advanced-ads') . '</span>', esc_html(wp_unslash($_REQUEST['s']))); } else { echo ' <a href="' . Advanced_Ads_Admin::group_page_url(array('action' => 'edit')) . '" class="add-new-h2">' . $tax->labels->add_new_item . '</a>'; } ?> </h1> <p><?php _e('Ad Groups are a very flexible method to bundle ads. You can use them to display random ads in the frontend or run split tests, but also just for informational purposes. Not only can an Ad Groups have multiple ads, but an ad can belong to multiple ad groups.', 'advanced-ads'); ?> </p> <?php if (isset($message)) { ?> <div id="message" class="updated"><p><?php echo $message; ?> </p></div> <?php
/** * check if license keys are already expired * * @since 1.6.6 * @update 1.6.9 moved from Advanced_Ads_Plugin * @return true if there are expired licenses */ public static function licenses_expired() { $add_ons = apply_filters('advanced-ads-add-ons', array()); if ($add_ons === array()) { return false; } $now = time(); foreach ($add_ons as $_add_on_key => $_add_on) { // don’t display error for invalid licenses if (Advanced_Ads_Admin::get_instance()->get_license_status($_add_on['options_slug']) === 'invalid') { continue; } $expiry_date = Advanced_Ads_Admin::get_instance()->get_license_expires($_add_on['options_slug']); if ($expiry_date && strtotime($expiry_date) < $now) { return true; } } return false; }
/** * render ad group action links * * @param $obj $group group object */ public function render_action_links($group) { global $tax; $tax = get_taxonomy($this->taxonomy); $actions = array(); if (current_user_can($tax->cap->edit_terms)) { $actions['edit'] = '<a class="edit">' . __('Edit', 'advanced-ads') . '</a>'; $actions['usage'] = '<a class="usage">' . __('Usage', 'advanced-ads') . '</a>'; } if (current_user_can($tax->cap->delete_terms)) { $args = array('action' => 'delete', 'group_id' => $group->id); $delete_link = Advanced_Ads_Admin::group_page_url($args); $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url($delete_link, 'delete-tag_' . $group->id) . "'>" . __('Delete') . '</a>'; } if (!count($actions)) { return; } echo '<div class="row-actions">'; foreach ($actions as $action => $link) { echo "<span class='{$action}'>{$link}</span>"; } echo '</div>'; }
<?php $errortext = false; $expires = Advanced_Ads_Admin::get_instance()->get_license_expires($options_slug); $expired = false; if ($expires) { $expires_time = strtotime($expires); $days_left = ($expires_time - time()) / DAY_IN_SECONDS; if ($days_left <= 0) { $plugin_url = isset($plugin_url) ? $plugin_url : ADVADS_URL; $errortext = sprintf(__('Your license expired. Please visit <a href="%s" target="_blank">the plugin page</a> to renew it.', 'advanced-ads'), $plugin_url . '#utm_source=advanced-ads&utm_medium=link&utm_campaign=settings-licenses'); $expired = true; } } ?> <input type="text" class="regular-text" placeholder="<?php _e('License key', 'advanced-ads'); ?> " name="<?php echo ADVADS_SLUG . '-licenses'; ?> [<?php echo $index; ?> ]" value="<?php echo esc_attr_e($license_key); ?> " <?php