array( $this, 'validate_credentials' ) ) ); } function validate_credentials( $timestamp ) { // clear the cache to get the new values wp_cache_delete( 'alloptions', 'options' ); // check credentials if ( AffilinetWidgetsApi::logon() === false ) { add_settings_error( 'affilinet_product_widgets_publisher_webservice_password', '1', __( 'errors.invalidCredentials', 'affilinet-product-widgets' ) ); update_option( 'affilinet_product_widgets_webservice_login_is_correct', 'false', true ); wp_cache_delete( 'alloptions', 'options' ); return $timestamp; } return $timestamp; } function admin_notice() { if ( get_option( 'affilinet_product_widgets_webservice_login_is_correct', 'false' ) === 'false' ) { ?>
' . __( 'admin.linkSettings', 'affilinet-product-widgets' ) . ''; array_push( $links, $settings_link ); return $links; } /** * Shortcode * * @param array $params * * @return string */ public function affilinet_product_widgets_shortcode( $params = array() ) { // default $widget_id parameter /** * @var String $size */ extract( shortcode_atts( array( 'id' => 'notset', ), $params ) ); return AffilinetWidgetsWidget::getAdCode( $params['id'] ); } /** * TRANSLATION */ public function load_textdomain() { load_plugin_textdomain( 'affilinet-product-widgets', false, dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages' ); } /** * TinyMCE Editor Button */ public function register_tiny_mce_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 add_tiny_mce_variables() { $img = plugin_dir_url( plugin_basename( dirname( __FILE__ ) ) ) . 'images/'; $widgets = AffilinetWidgetsApi::getMyWidgets(); $widgetsForTinyMce = []; foreach ( $widgets as $widget ) { $widgetsForTinyMce[] = [ 'value' => $widget['id'], 'id' => $widget['id'], 'text' => $widget['widgetName'], ]; } ?>