__( 'Simple Widget to ad AdSauce services to your wordpress site', 'adsauce_widget_domain' ), )); } public $bearerToken = ''; // WIDGET public function widget( $args, $instance ) { //Grab Variables if(isset($instance['adSizeTypeName'])) $adSizeTypeName = $instance['adSizeTypeName']; else $adSizeTypeName = ''; if (isset($instance['websiteLocationId'])) $websiteLocationId = $instance['websiteLocationId']; else $websiteLocationId = ''; if(isset($instance['width'])) $width = $instance['width']; else $width = 0; if(isset($instance['height'])) $height = $instance['height']; else $height = 0; $dimensions = ''; if($adSizeTypeName != '') { //Draw Widget echo $args['before_widget']; ?>
div>
admin_url( 'admin-ajax.php'))); $password = ''; //Grab stored values if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; } else { $title = __( 'New title', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'username' ] ) ) { $username = $instance[ 'username' ]; } else { $username = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'websiteLocationNameType' ] ) ) { $websiteLocationNameType = $instance[ 'websiteLocationNameType' ]; } else { $websiteLocationNameType = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'websiteName' ] ) ) { $websiteName = $instance[ 'websiteName' ]; } else { $websiteName = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'websiteLocationId' ] ) ) { $websiteLocationId = $instance[ 'websiteLocationId' ]; } else { $websiteLocationId = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'adSizeTypeName' ] ) ) { $adSizeTypeName = $instance[ 'adSizeTypeName' ]; } else { $adSizeTypeName = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'width' ] ) ) { $width = $instance[ 'width' ]; } else { $width = __( '', 'adsauce_widget_domain' ); } if ( isset( $instance[ 'height' ] ) ) { $height = $instance[ 'height' ]; } else { $height = __( '', 'adsauce_widget_domain' ); } // Widget admin form ?>






"password", "username" => $username, "password" => $password); $curl = curl_init($url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData)); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded')); curl_setopt($curl, CURLOPT_TIMEOUT, 5); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $auth = curl_exec($curl); $secret = json_decode($auth, true); if(isset($secret["access_token"])) { $result = $secret["access_token"]; } else { $result = 'error: Username or password incorrect!'; } return $result; } //-------------------END API CALLS FOR WIDGET //-------------------------------------- //Iframe functionality //-------------------------------------- function adSauce_embed_iFrame_shortcode( $atts ) { $defaults = array( 'src' => 'http://www.youtube.com/embed/4qsGTXLnmKs', 'width' => '100%', 'height' => '500', 'scrolling' => 'yes', 'class' => 'iframe-class', 'frameborder' => '0' ); foreach ( $defaults as $default => $value ) { // add defaults if ( ! @array_key_exists( $default, $atts ) ) { // mute warning with "@" when no params at all $atts[$default] = $value; } } $html = "\n".''."\n"; $html .= ' $value ) { if ( strtolower($attr) != 'same_height_as' AND strtolower($attr) != 'onload' AND strtolower($attr) != 'onpageshow' AND strtolower($attr) != 'onclick') { // remove some attributes if ( $value != '' ) { // adding all attributes $html .= ' ' . esc_attr( $attr ) . '="' . esc_attr( $value ) . '"'; } else { // adding empty attributes $html .= ' ' . esc_attr( $attr ); } } } $html .= '>'."\n"; if ( isset( $atts["same_height_as"] ) ) { $html .= ' '; } return $html; } add_shortcode( 'iframe', 'adSauce_embed_iFrame_shortcode' ); function adSauce_embed_iFrame_plugin_meta( $links, $file ) { // add 'Plugin page' and 'Donate' links to plugin meta row if ( strpos( $file, 'iframe/iframe.php' ) !== false ) { $links = array_merge( $links, array( 'Iframe' ) ); $links = array_merge( $links, array( 'Donate' ) ); $links = array_merge( $links, array( 'Advanced iFrame Pro' ) ); } return $links; } add_filter( 'plugin_row_meta', 'adSauce_embed_iFrame_plugin_meta', 10, 2 ); //------------------END IFRAME FUNCTIONALITY /* AdSauce TinyMCE Button */ add_action( 'admin_init', 'adSauce_tinymce_button' ); function adSauce_tinymce_button() { if ( current_user_can( 'edit_posts' ) && current_user_can( 'edit_pages' ) ) { add_filter( 'mce_buttons', 'my_register_tinymce_button' ); add_filter( 'mce_external_plugins', 'adSauce_add_tinymce_button' ); } } function my_register_tinymce_button( $buttons ) { array_push( $buttons, "adSauce_toolBar_button", "button_green" ); return $buttons; } function adSauce_add_tinymce_button( $plugin_array ) { $plugin_array['adSauce_button_script'] = plugins_url( '/adSauceWordpressbutton.js', __FILE__ ) ; return $plugin_array; } add_action( 'wp_ajax_adSauce_plugin_slug_insert_dialog', 'adSauce_plugin_slug_insert_dialog' ); function adSauce_plugin_slug_insert_dialog() { echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '

'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo ''; echo ''; echo ''; echo ''; echo '
'; echo ''; die(); } ?>