Changeset 2364671
- Timestamp:
- 08/19/2020 08:27:13 AM (6 years ago)
- Location:
- audiate-me/trunk
- Files:
-
- 4 edited
-
audiate.php (modified) (1 diff)
-
includes/audiate-admin.php (modified) (4 diffs)
-
includes/audiate-widget.php (modified) (5 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
audiate-me/trunk/audiate.php
r2335625 r2364671 8 8 * Plugin URI: https://www.audiate.me 9 9 * Description: Transform your content into audio to reach a larger audience with our Text-to-Speech widget. 10 * Version: 1. 1.110 * Version: 1.2 11 11 * Author: Audiate.Me 12 12 * License: GPLv2 or later -
audiate-me/trunk/includes/audiate-admin.php
r2335625 r2364671 80 80 81 81 add_settings_field( 82 ' widget_id_0', // id83 'Widget id (Deprecated)', // title84 array( $this, ' widget_id_0_callback' ), // callback82 'position_4', // id 83 'Widget Placement', // title 84 array( $this, 'position_4_callback' ), // callback 85 85 'audiate-admin', // page 86 86 'audiate_setting_section' // section 87 87 ); 88 88 89 } 89 90 90 91 public function audiate_sanitize($input) { 91 92 $sanitary_values = array(); 92 if ( isset( $input['widget_id_0'] ) ) {93 $sanitary_values['widget_id_0'] = sanitize_text_field( $input['widget_id_0'] );94 }95 93 96 94 if ( isset( $input['show_on_all_posts_1'] ) ) { 97 $sanitary_values['show_on_all_posts_1'] = $input['show_on_all_posts_1'];95 $sanitary_values['show_on_all_posts_1'] = sanitize_text_field($input['show_on_all_posts_1']); 98 96 } 99 97 … … 104 102 105 103 if ( isset( $input['show_on_all_pages_3'] ) ) { 106 $sanitary_values['show_on_all_pages_3'] = $input['show_on_all_pages_3']; 104 $sanitary_values['show_on_all_pages_3'] = sanitize_text_field($input['show_on_all_pages_3']); 105 } 106 107 if ( isset( $input['position_4'] ) ) { 108 $sanitary_values['position_4'] = sanitize_text_field($input['position_4']); 107 109 } 108 110 … … 112 114 public function audiate_section_info() { 113 115 114 }115 116 public function widget_id_0_callback() {117 printf(118 '<input class="regular-text" type="text" name="audiate_option_name[widget_id_0]" id="widget_id_0" value="%s">',119 isset( $this->audiate_options['widget_id_0'] ) ? esc_attr( $this->audiate_options['widget_id_0']) : ''120 );121 116 } 122 117 … … 139 134 } 140 135 136 public function position_4_callback() { 137 ?> <select name="audiate_option_name[position_4]" id="position_4"> 138 <?php $selected = (isset( $this->audiate_options['position_4'] ) && $this->audiate_options['position_4'] === 'before_content') ? 'selected' : '' ; ?> 139 <option value="before_content" <?php echo $selected; ?>>Before Content</option> 140 <?php $selected = (isset( $this->audiate_options['position_4'] ) && $this->audiate_options['position_4'] === 'after_title') ? 'selected' : '' ; ?> 141 <option value="after_title" <?php echo $selected; ?>>After Title</option> 142 </select> <?php 143 } 144 141 145 public function widget_code_2_callback() { 142 146 printf( -
audiate-me/trunk/includes/audiate-widget.php
r2335603 r2364671 99 99 public function add_widget() 100 100 { 101 if(isset($this->options['widget_code_2']) || isset($this->options['widget_id_0'])) { 102 add_filter('the_content', array($this, 'add_code_to_post_title'), 0 ); 101 if(isset($this->options['widget_code_2'])) { 102 if(!isset($this->options['position_4']) || $this->options['position_4'] === 'before_content') { 103 add_filter('the_content', function( $content ) { 104 return $this->add_code_to_post_content( $content, false ); 105 }, 0 ); 106 } 107 else if ($this->options['position_4'] === 'after_title') { 108 add_filter('the_title', function( $content ) { 109 return $this->add_code_to_post_content( $content, true ); 110 }, 0 ); 111 } 112 113 103 114 add_shortcode('audiate-widget', 'getShortCode'); 104 115 } … … 108 119 if($this->options['widget_code_2']) { 109 120 $ret = '<div class="audiate-widget">' . $this->options['widget_code_2'] . '</div>'; 110 } else {111 $ret = '<div class="audiate-widget"><ins data-ea data-ea-id="'.$this->options['widget_id_0'].'"></ins>112 <script async src=\'https://cdn.audiate.me/audio/widgets/Loader.js\'></script></div>';113 121 } 114 122 return $ret; 115 123 } 116 124 125 117 126 /* 118 127 * Add the widget to posts before the post content 119 128 */ 120 public function add_code_to_post_ title($content) {129 public function add_code_to_post_content($content, $isAfterContent) { 121 130 122 131 $allowedPostTypes = array('post', 'page'); … … 131 140 132 141 ) { 133 return $widget . $content;142 return AudiateWidget::stitchWidget($content , $widget, $isAfterContent); 134 143 } 135 144 … … 139 148 140 149 if (isset($showOnPost) && $showOnPost === 'on') { 141 return $widget . $content;150 return AudiateWidget::stitchWidget($content , $widget, $isAfterContent); 142 151 } 143 152 … … 147 156 } 148 157 158 /** 159 * @param string $content 160 * @param boolean $isAfterContent 161 */ 162 static function stitchWidget( $content, $widget, $isAfterContent ) { 163 if($isAfterContent) { 164 return $content . $widget; 165 } else { 166 return $widget . $content; 167 } 168 } 169 149 170 } -
audiate-me/trunk/readme.txt
r2337868 r2364671 6 6 License URI: http://www.gnu.org/licenses/gpl-2.0.html 7 7 Tested up to: 5.4 8 Stable tag: 1. 1.18 Stable tag: 1.2 9 9 10 10 Elevate Your Content with Audio. Transform your content into audio to reach a larger audience with our Text-to-Speech widget. … … 23 23 HOW DOES IT WORK? 24 24 1. Create a free account at: https://audiate.me 25 2. Edit your user profile and add your site\'s URL.25 2. Edit your user profile and add your site\'s domain. 26 26 3. Create a new widget 27 27 … … 30 30 2. Go to https://Audiate.me website, login, navigate to 'Create Widgets' page and generate a widget code. 31 31 3. Copy the widget code and paste it in your WordPress in settings -> audiate 32 4. Choose whether to show the widget on all posts or only on selected ones. 32 4. Choose whether to show the widget on all posts/pages or only on selected ones. 33 5. Select the widget position, before the content or after the title 33 34 34 35 SHORT CODE 35 36 Another way to implement the widget in your posts and pages is to use Wordpress shortcode. 36 Simply paste [audiate-widget] in your text .37 Simply paste [audiate-widget] in your text or use it in your templates.
Note: See TracChangeset
for help on using the changeset viewer.