public function __construct() { $plugin = Lingotek::get_instance(); $this->plugin_slug = $plugin->get_plugin_slug(); $this->dashboard = new Lingotek_Dashboard($plugin); $this->pllm = $GLOBALS['polylang']->model; add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts')); // adds a 'settings' link in the plugins table add_filter('plugin_action_links_' . LINGOTEK_BASENAME, array(&$this, 'plugin_action_links')); // adds the link to the languages panel in the wordpress admin menu add_action('admin_menu', array(&$this, 'add_menus')); add_action('load-translation_page_wp-lingotek_manage', array(&$this, 'load_manage_page')); add_filter('set-screen-option', array($this, 'set_screen_option'), 10, 3); add_action('wp_ajax_' . $this->ajax_dashboard_language_endpoint, array(&$this->dashboard, 'ajax_language_dashboard')); add_action('wp_ajax_get_current_status', array($this, 'ajax_get_current_status')); //Network admin menu add_action('network_admin_menu', array($this, 'add_network_admin_menu')); }
} public static function log($data, $label = NULL) { if (self::$logging) { $log_string = ""; if (is_string($label)) { $log_string .= $label . "\n"; } if (is_string($data)) { $log_string .= $data; } else { $log_string .= print_r($data, TRUE); } error_log($log_string); } } /* * Creates a pointer to draw attention to the new Lingotek menu item upon plugin activation * code borrowed from Polylang * @since 1.0.1 */ public function lingotek_activation_pointer() { $content = __('You’ve just installed Lingotek Translation! Click below to activate your account and automatically translate your website for free!', 'wp-lingotek'); $buttons = array(array('label' => __('Close')), array('label' => __('Activate Account', 'wp-lingotek'), 'link' => admin_url('admin.php?page=' . $this->plugin_slug . '_settings&connect=new'))); $args = array('pointer' => 'wp-lingotek', 'id' => 'toplevel_page_wp-lingotek', 'position' => array('edge' => 'bottom', 'align' => 'left'), 'width' => 380, 'title' => __('Congratulations!', 'wp-lingotek'), 'content' => $content, 'buttons' => $buttons); new Lingotek_Pointer($args); } } $GLOBALS['wp_lingotek'] = Lingotek::get_instance();