Changeset 2898060
- Timestamp:
- 04/12/2023 09:55:11 PM (3 years ago)
- Location:
- wp-tradingview/trunk
- Files:
-
- 8 edited
-
inc/admin_page.php (modified) (1 diff)
-
inc/class_chart.php (modified) (6 diffs)
-
inc/class_chat.php (modified) (1 diff)
-
inc/class_ideastream.php (modified) (1 diff)
-
inc/class_ideaview.php (modified) (1 diff)
-
inc/class_profile.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
tradingview.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-tradingview/trunk/inc/admin_page.php
r2532172 r2898060 1718 1718 } 1719 1719 1720 ?> -
wp-tradingview/trunk/inc/class_chart.php
r2532172 r2898060 1 1 <?php 2 2 3 4 3 5 class widget_TradingView_chart extends WP_Widget{ 4 6 7 8 5 9 public function __construct() { 10 6 11 $params = array( 12 7 13 'description' => 'Trading View chart - Display a chart from TradingView', 14 8 15 'name' => 'Trading View chart' 16 9 17 ); 10 18 19 20 11 21 parent::__construct('widget_TradingView_chart','',$params); 22 12 23 } 24 13 25 public function form($instance) { 26 14 27 extract($instance); 28 15 29 $chart_data = get_option('tv_chart_op_name'); 30 16 31 ?> 17 <p> 32 33 <p> 34 18 35 <label for="<?php echo $this->get_field_id('title');?>">Title: </label> 36 19 37 <input 38 20 39 class="widefat" 40 21 41 id="<?php echo $this->get_field_id('title');?>" 42 22 43 name="<?php echo $this->get_field_name('title');?>" 44 23 45 value="<?php echo !empty($title) ? $title : "Trading View chart widget"; ?>" /> 24 </p> 25 26 <p> 46 47 </p> 48 49 50 <p> 51 27 52 <label for="<?php echo $this->get_field_id('symbol');?>">Symbol: </label> 53 28 54 <input 55 29 56 class="widefat" 57 30 58 id="<?php echo $this->get_field_id('symbol');?>" 59 31 60 name="<?php echo $this->get_field_name('symbol');?>" 61 32 62 value="<?php echo !empty($symbol) ? $symbol : $chart_data['symbol']; ?>" /> 33 </p> 34 35 <p> 63 64 </p> 65 66 <p> 67 36 68 <label for="<?php echo $this->get_field_id( 'interval' ); ?>">Timeframe: </label> 69 37 70 <select id="<?php echo $this->get_field_id( 'interval' ); ?>" 71 38 72 name="<?php echo $this->get_field_name( 'interval' ); ?>" 73 39 74 class="widefat" style="width:100%;"> 75 40 76 <option value="1" <?php if ($interval == '1') echo 'selected="1"'; ?>>1m</option> 77 41 78 <option value="3" <?php if ($interval == '3') echo 'selected="3"'; ?>>3m</option> 79 42 80 <option value="5" <?php if ($interval == '5') echo 'selected="5"'; ?>>5m</option> 81 43 82 <option value="15" <?php if ($interval == '15') echo 'selected="15"'; ?>>15m</option> 83 44 84 <option value="30" <?php if ($interval == '30') echo 'selected="30"'; ?>>30m</option> 85 45 86 <option value="60" <?php if ($interval == '60') echo 'selected="60"'; ?>>1h</option> 87 46 88 <option value="120" <?php if ($interval == '120') echo 'selected="120"'; ?>>2h</option> 89 47 90 <option value="180" <?php if ($interval == '180') echo 'selected="180"'; ?>>3h</option> 91 48 92 <option value="240" <?php if ($interval == '240') echo 'selected="240"'; ?>>4h</option> 93 49 94 <option value="D" <?php if ($interval == 'D') echo 'selected="D"'; ?>>1d</option> 95 50 96 <option value="W" <?php if ($interval == 'W') echo 'selected="W"'; ?>>1w</option> 97 51 98 </select> 52 </p> 53 54 <p> 99 100 </p> 101 102 <p> 103 55 104 <label for="<?php echo $this->get_field_id( 'timezone' ); ?>">Time zone: </label> 105 56 106 <select id="<?php echo $this->get_field_id( 'timezone' ); ?>" 107 57 108 name="<?php echo $this->get_field_name( 'timezone' ); ?>" 109 58 110 class="widefat" style="width:100%;"> 59 111 <option value="exchange" <?php if ($timezone == 'exchange') echo 'selected="exchange"'; ?> >Exchange</option> 112 60 113 <option value="Pacific/Honolulu" <?php if ($timezone == 'Pacific/Honolulu') echo 'selected="Pacific/Honolulu"'; ?> >(UTC-10) Honolulu</option> 114 61 115 <option value="America/Vancouver" <?php if ($timezone == 'America/Vancouver') echo 'selected="America/Vancouver"'; ?> >(UTC-8) Vancouver</option> 116 62 117 <option value="America/Los_Angeles" <?php if ($timezone == 'America/Los_Angeles') echo 'selected="America/Los_Angeles"'; ?> >(UTC-8) Los Angeles</option> 118 63 119 <option value="America/Phoenix" <?php if ($timezone == 'America/Phoenix') echo 'selected="America/Phoenix"'; ?> >(UTC-7) Phoenix</option> 120 64 121 <option value="America/Chicago" <?php if ($timezone == 'America/Chicago') echo 'selected="America/Chicago"'; ?> >(UTC-6) Chicago</option> 122 65 123 <option value="America/San Salvador" <?php if ($timezone == 'America/San Salvador') echo 'selected="America/San Salvador"'; ?> >(UTC-6) San Salvador</option> 124 66 125 <option value="America/Toronto" <?php if ($timezone == 'America/Toronto') echo 'selected="America/Toronto"'; ?> >(UTC-5) Toronto</option> 126 67 127 <option value="America/New_York" <?php if ($timezone == 'America/New_York') echo 'selected="America/New_York"'; ?> >(UTC-5) New York</option> 128 68 129 <option value="Europe/London" <?php if ($timezone == 'Europe/London') echo 'selected="Europe/London"'; ?> >UTC London</option> 130 69 131 <option value="Europe/Madrid" <?php if ($timezone == 'Europe/Madrid') echo 'selected="Europe/Madrid"'; ?> >(UTC+1) Madrid</option> 132 70 133 <option value="Europe/Paris" <?php if ($timezone == 'Europe/Paris') echo 'selected="Europe/Paris"'; ?> >(UTC+1) Paris</option> 134 71 135 <option value="Europe/Berlin" <?php if ($timezone == 'Europe/Berlin') echo 'selected="Europe/Berlin"'; ?> >(UTC+1) Berlin</option> 136 72 137 <option value="Europe/Warsaw" <?php if ($timezone == 'Europe/Warsaw') echo 'selected="Europe/Warsaw"'; ?> >(UTC+1) Warsaw</option> 138 73 139 <option value="Europe/Athens" <?php if ($timezone == 'Europe/Athens') echo 'selected="Europe/Athens"'; ?> >(UTC+2) Athens</option> 140 74 141 <option value="Europe/Moscow" <?php if ($timezone == 'Europe/Moscow') echo 'selected="Europe/Moscow"'; ?> >(UTC+3) Moscow</option> 142 75 143 <option value="Asia/Tehran" <?php if ($timezone == 'Asia/Tehran') echo 'selected="Asia/Tehran"'; ?> >(UTC+3:30) Tehran</option> 144 76 145 <option value="Asia/Dubai" <?php if ($timezone == 'Asia/Dubai') echo 'selected="Asia/Dubai"'; ?> >(UTC+4) Dubai</option> 146 77 147 <option value="Asia/Ashkhabad" <?php if ($timezone == 'Asia/Ashkhabad') echo 'selected="Asia/Ashkhabad"'; ?> >(UTC+5) Ashkhabad</option> 148 78 149 <option value="Asia/Kolkata" <?php if ($timezone == 'Asia/Kolkata') echo 'selected="Asia/Kolkata"'; ?> >(UTC+5:30) Kolkata</option> 150 79 151 <option value="Asia/Almaty" <?php if ($timezone == 'Asia/Almaty') echo 'selected="Asia/Almaty"'; ?> >(UTC+6) Almaty</option> 152 80 153 <option value="Asia/Bangkok" <?php if ($timezone == 'Asia/Bangkok') echo 'selected="Asia/Bangkok"'; ?> >(UTC+7) Bangkok</option> 154 81 155 <option value="Asia/Taipei" <?php if ($timezone == 'Asia/Taipei') echo 'selected="Asia/Taipei"'; ?> >(UTC+8) Taipei</option> 156 82 157 <option value="Asia/Singapore" <?php if ($timezone == 'Asia/Singapore') echo 'selected="Asia/Singapore"'; ?> >(UTC+8) Singapore</option> 158 83 159 <option value="Asia/Shanghai" <?php if ($timezone == 'Asia/Shanghai') echo 'selected="Asia/Shanghai"'; ?> >(UTC+8) Shanghai</option> 160 84 161 <option value="Asia/Hong_Kong" <?php if ($timezone == 'Asia/Hong_Kong') echo 'selected="Asia/Hong_Kong"'; ?> >(UTC+8) Hong Kong</option> 162 85 163 <option value="Asia/Seoul" <?php if ($timezone == 'Asia/Seoul') echo 'selected="Asia/Seoul"'; ?> >(UTC+9) Seoul</option> 164 86 165 <option value="Asia/Tokyo" <?php if ($timezone == 'Asia/Tokyo') echo 'selected="Asia/Tokyo"'; ?> >(UTC+9) Tokyo</option> 166 87 167 <option value="Australia/Brisbane" <?php if ($timezone == 'Australia/Brisbane') echo 'selected="Australia/Brisbane"'; ?> >(UTC+10) Brisbane</option> 168 88 169 <option value="Australia/Adelaide" <?php if ($timezone == 'Australia/Adelaide') echo 'selected="Australia/Adelaide"'; ?> >(UTC+10:30) Adelaide</option> 170 89 171 <option value="Australia/Sydney" <?php if ($timezone == 'Australia/Sydney') echo 'selected="Australia/Sydney"'; ?> >(UTC+11) Sydney</option> 172 90 173 <option value="Pacific/New_Zealand" <?php if ($timezone == 'Pacific/New_Zealand') echo 'selected="Pacific/New_Zealand"'; ?> >(UTC+13) New Zealand</option> 174 91 175 <option value="Pacific/Tokelau" <?php if ($timezone == 'Pacific/Tokelau') echo 'selected="Pacific/Tokelau"'; ?> >(UTC+13) Tokelau</option> 176 92 177 <option value="Pacific/Chatham" <?php if ($timezone == 'Pacific/Chatham') echo 'selected="Pacific/Chatham"'; ?> >(UTC+13:45) Chatham Islands</option> 178 93 179 </select> 94 </p> 95 96 <p> 97 <input type="checkbox" class="checkbox" 180 181 </p> 182 183 184 <p> 185 186 <input type="checkbox" class="checkbox" 187 98 188 id="<?php echo $this->get_field_id('autosize');?>" 189 99 190 name="<?php echo $this->get_field_name('autosize');?>" 191 100 192 value="1" <?php echo ($autosize != '') ? checked (true,$autosize,false): checked (true,$chart_data['autosize'],false); ?>/> 193 101 194 <label for="<?php echo $this->get_field_id('autosize');?>">Autosize</label> 102 </p> 103 104 <p> 195 196 </p> 197 198 <p> 199 105 200 <label for="<?php echo $this->get_field_id('width');?>">Width: </label> 201 106 202 <input 203 107 204 class="widefat" 205 108 206 id="<?php echo $this->get_field_id('width');?>" 207 109 208 name="<?php echo $this->get_field_name('width');?>" 209 110 210 value="<?php echo !empty($width) ? $width : $chart_data['width']; ?>" 111 211 <?php echo ($autosize == '1') ? 'disabled' : ''; ?> 112 212 /> 113 213 114 </p> 115 <p> 214 215 216 </p> 217 <p> 218 116 219 <label for="<?php echo $this->get_field_id('height');?>">Height: </label> 220 117 221 <input 222 118 223 class="widefat" 224 119 225 id="<?php echo $this->get_field_id('height');?>" 226 120 227 name="<?php echo $this->get_field_name('height');?>" 228 121 229 value="<?php echo !empty($height) ? $height : $chart_data['height']; ?>" 122 230 <?php echo ($autosize == '1') ? 'disabled' : ''; ?> 123 231 /> 124 232 125 </p> 126 127 <p> 233 234 235 </p> 236 237 238 <p> 239 128 240 <label for="<?php echo $this->get_field_id( 'theme' ); ?>">Color theme: </label> 241 129 242 <select id="<?php echo $this->get_field_id( 'theme' ); ?>" 243 130 244 name="<?php echo $this->get_field_name( 'theme' ); ?>" 245 131 246 class="widefat" style="width:100%;"> 247 132 248 <option value="White" <?php if ($interval == 'White') echo 'selected="White"'; ?> >White</option> 249 133 250 <option value="Grey" <?php if ($interval == 'Grey') echo 'selected="Grey"'; ?> >Grey</option> 251 134 252 <option value="Blue" <?php if ($interval == 'Blue') echo 'selected="Blue"'; ?> >Blue</option> 253 135 254 <option value="Black" <?php if ($interval == 'Black') echo 'selected="Black"'; ?> >Black</option> 255 136 256 </select> 137 </p> 138 139 <p> 257 258 </p> 259 260 <p> 261 140 262 <label for="<?php echo $this->get_field_id( 'style' ); ?>">Bar style: </label> 263 141 264 <select id="<?php echo $this->get_field_id( 'style' ); ?>" 265 142 266 name="<?php echo $this->get_field_name( 'style' ); ?>" 267 143 268 class="widefat" style="width:100%;"> 269 144 270 <option value="0" <?php if ($interval == '0') echo 'selected="0"'; ?>>Bars</option> 271 145 272 <option value="1" <?php if ($interval == '1') echo 'selected="1"'; ?>>Candles</option> 273 146 274 <option value="9" <?php if ($interval == '9') echo 'selected="9"'; ?>>Hollow Candles</option> 275 147 276 <option value="8" <?php if ($interval == '8') echo 'selected="8"'; ?>>Heikin Ashi</option> 277 148 278 <option value="2" <?php if ($interval == '2') echo 'selected="2"'; ?>>Line</option> 279 149 280 <option value="3" <?php if ($interval == '3') echo 'selected="3"'; ?>>Area</option> 281 150 282 <option value="4" <?php if ($interval == '4') echo 'selected="4"'; ?>>Renko</option> 283 151 284 <option value="7" <?php if ($interval == '7') echo 'selected="7"'; ?>>Line Break</option> 285 152 286 <option value="5" <?php if ($interval == '5') echo 'selected="5"'; ?>>Kagi</option> 287 153 288 <option value="6" <?php if ($interval == '6') echo 'selected="6"'; ?>>Point and Figure</option> 289 154 290 </select> 155 </p> 156 157 <p> 291 292 </p> 293 294 295 <p> 296 158 297 <label for="<?php echo $this->get_field_id( 'locale' ); ?>">Language: </label> 298 159 299 <select id="<?php echo $this->get_field_id( 'locale' ); ?>" 300 160 301 name="<?php echo $this->get_field_name( 'locale' ); ?>" 302 161 303 class="widefat" style="width:100%;"> 304 162 305 <option value="en" <?php if ($locale == 'en') echo 'selected="en"'; ?> >English</option> 306 163 307 <option value="ru" <?php if ($locale == 'ru') echo 'selected="ru"'; ?> >Русский</option> 308 164 309 <option value="zh" <?php if ($locale == 'zh') echo 'selected="zh"'; ?> >简体中文</option> 310 165 311 <option value="tw" <?php if ($locale == 'tw') echo 'selected="tw"'; ?> >繁體中文</option> 312 166 313 <option value="ja" <?php if ($locale == 'ja') echo 'selected="ja"'; ?> >日本語</option> 314 167 315 <option value="de" <?php if ($locale == 'de') echo 'selected="de"'; ?> >Deutch</option> 316 168 317 <option value="pt" <?php if ($locale == 'pt') echo 'selected="pt"'; ?> >Português</option> 318 169 319 <option value="it" <?php if ($locale == 'it') echo 'selected="it"'; ?> >Italiano</option> 320 170 321 <option value="es" <?php if ($locale == 'es') echo 'selected="es"'; ?> >Español</option> 322 171 323 <option value="fr" <?php if ($locale == 'fr') echo 'selected="fr"'; ?> >French</option> 324 172 325 <option value="vi" <?php if ($locale == 'vi') echo 'selected="vi"'; ?> >Tiếng Việt</option> 326 173 327 <option value="he_IL" <?php if ($locale == 'he_IL') echo 'selected="he_IL"'; ?> >עברית</option> 328 174 329 <option value="fa" <?php if ($locale == 'fa') echo 'selected="fa"'; ?> >فارسی</option> 330 175 331 <option value="cs" <?php if ($locale == 'cs') echo 'selected="cs"'; ?> >Česky</option> 332 176 333 <option value="th" <?php if ($locale == 'th') echo 'selected="th"'; ?> >ภาษาไทย</option> 334 177 335 <option value="ko" <?php if ($locale == 'ko') echo 'selected="ko"'; ?> >한국어</option> 336 178 337 <option value="tr" <?php if ($locale == 'tr') echo 'selected="tr"'; ?> >Türkçe</option> 338 179 339 </select> 340 180 341 </p> 181 342 … … 183 344 <label>Top toolbar background color: </label> 184 345 <input type="text" 346 185 347 class="tv-color-field" 348 186 349 id="<?php echo $this->get_field_id('toolbar_bg');?>" 350 187 351 name="<?php echo $this->get_field_name('toolbar_bg');?>" 352 188 353 value="<?php echo !empty($toolbar_bg) ? $toolbar_bg : $chart_data['toolbar_bg']; ?>" data-default-color="#FFFFFF" /> 189 </p> 190 191 <p> 192 <input type="checkbox" class="checkbox" 354 355 </p> 356 357 <p> 358 359 <input type="checkbox" class="checkbox" 360 193 361 id="<?php echo $this->get_field_id('enable_publishing');?>" 194 362 name="<?php echo $this->get_field_name('enable_publishing');?>" 363 195 364 value="1" <?php echo ($enable_publishing != '') ? checked ('1',$enable_publishing,false): checked ('1',$chart_data['enable_publishing'],false); ?>/> 365 196 366 <label for="<?php echo $this->get_field_id('enable_publishing');?>">Allow idea publish</label> 197 </p> 198 199 200 201 <p> 202 <input type="checkbox" class="checkbox" 367 368 </p> 369 370 371 372 373 <p> 374 375 <input type="checkbox" class="checkbox" 376 203 377 id="<?php echo $this->get_field_id('allow_symbol_change');?>" 378 204 379 name="<?php echo $this->get_field_name('allow_symbol_change');?>" 380 205 381 value="1" <?php echo ($allow_symbol_change != '') ? checked ('1',$allow_symbol_change,false): checked ('1',$chart_data['allow_symbol_change'],false); ?>/> 382 206 383 <label for="<?php echo $this->get_field_id('allow_symbol_change');?>">Allow symbol change</label> 384 207 385 </p> 208 386 … … 231 409 </p> 232 410 233 <p> 234 <input type="checkbox" class="checkbox" 411 412 <p> 413 414 <input type="checkbox" class="checkbox" 415 235 416 id="<?php echo $this->get_field_id('save_image');?>" 417 236 418 name="<?php echo $this->get_field_name('save_image');?>" 419 237 420 value="1" <?php echo ($save_image != '') ? checked ('1',$save_image,false): checked ('1',$chart_data['save_image'],false); ?>/> 421 238 422 <label for="<?php echo $this->get_field_id('save_image');?>">Showsave image</label> 239 </p> 240 241 <p> 242 <input type="checkbox" class="checkbox" 423 424 </p> 425 426 <p> 427 428 <input type="checkbox" class="checkbox" 429 243 430 id="<?php echo $this->get_field_id('details');?>" 431 244 432 name="<?php echo $this->get_field_name('details');?>" 433 245 434 value="1" <?php echo ($details != '') ? checked ('1',$details,false): checked ('1',$chart_data['details'],false); ?>/> 435 246 436 <label for="<?php echo $this->get_field_id('details');?>">Show details</label> 247 </p> 248 249 <p> 250 <input type="checkbox" class="checkbox" 437 438 </p> 439 440 <p> 441 442 <input type="checkbox" class="checkbox" 443 251 444 id="<?php echo $this->get_field_id('stocktwits');?>" 445 252 446 name="<?php echo $this->get_field_name('stocktwits');?>" 447 253 448 value="1" <?php echo ($stocktwits != '') ? checked ('1',$stocktwits,false): checked ('1',$chart_data['stocktwits'],false); ?>/> 449 254 450 <label for="<?php echo $this->get_field_id('stocktwits');?>">Show stocktwits</label> 255 </p> 256 257 <p> 258 <input type="checkbox" class="checkbox" 451 452 </p> 453 454 <p> 455 456 <input type="checkbox" class="checkbox" 457 259 458 id="<?php echo $this->get_field_id('headlines');?>" 459 260 460 name="<?php echo $this->get_field_name('headlines');?>" 461 261 462 value="1" <?php echo ($headlines != '') ? checked ('1',$headlines,false): checked ('1',$chart_data['headlines'],false); ?>/> 463 262 464 <label for="<?php echo $this->get_field_id('headlines');?>">Show news headlines</label> 263 </p> 264 265 <p> 266 <input type="checkbox" class="checkbox" 465 466 </p> 467 468 <p> 469 470 <input type="checkbox" class="checkbox" 471 267 472 id="<?php echo $this->get_field_id('hotlist');?>" 473 268 474 name="<?php echo $this->get_field_name('hotlist');?>" 475 269 476 value="1" <?php echo ($hotlist != '') ? checked ('1',$hotlist,false): checked ('1',$chart_data['hotlist'],false); ?>/> 477 270 478 <label for="<?php echo $this->get_field_id('hotlist');?>">Hotlist button</label> 271 </p> 272 273 <p> 274 <input type="checkbox" class="checkbox" 479 480 </p> 481 482 <p> 483 484 <input type="checkbox" class="checkbox" 485 275 486 id="<?php echo $this->get_field_id('calendar');?>" 487 276 488 name="<?php echo $this->get_field_name('calendar');?>" 489 277 490 value="1" <?php echo ($calendar != '') ? checked ('1',$calendar,false): checked ('1',$chart_data['calendar'],false); ?>/> 491 278 492 <label for="<?php echo $this->get_field_id('calendar');?>">Calendar button</label> 493 279 494 </p> 280 495 … … 305 520 306 521 <?php 522 307 523 //if($room != ''): 524 308 525 if($widthpop==2) $width = $width.'%'; 526 309 527 if($heightpop==2) $height = $height.'%'; 310 528 529 530 311 531 ?> 532 312 533 <p><strong>Shortcode:</strong><br/> 534 313 535 <code> 536 314 537 <?php 538 315 539 $widthstr = 'width="'.$width.'" height="'.$height.'"'; 540 316 541 if($autosize=='1') $widthstr = 'autosize="true"'; 542 317 543 printf('[tv-chart symbol="%1$s" %2$s language="%3$s" interval="%4$s" timezone="%5$s" theme="%6$s" style="%7$s" toolbar_bg="%8$s" enable_publishing="%9$s" hide_top_toolbar="%10$s" withdateranges="%11$s" hide_side_toolbar="%12$s" allow_symbol_change="%13$s" save_image="%14$s" details="%15$s" hotlist="%16$s" calendar="%17$s" stocktwits="%18$s" headlines="%19$s" hideideas="%20$s" hideideasbutton="%21$s" referral_id="%22$s"]', 544 318 545 $symbol,$widthstr,$locale,$interval,$timezone,$theme,$style,$toolbar_bg,$enable_publishing,$hide_top_toolbar,$withdateranges,$hide_side_toolbar,$allow_symbol_change,$save_image,$details,$hotlist,$calendar,$stocktwits,$headlines,$hideideas,$hideideasbutton,$referral_id); 546 319 547 ?> 548 320 549 </code> 321 </p> 550 551 </p> 552 322 553 <!--?php 554 323 555 //endif; ?--> 556 324 557 <?php 558 325 559 } 560 326 561 public function widget($args, $instance) { 562 327 563 extract($args); 564 328 565 extract($instance); 566 329 567 $chart_data = get_option('tv_chart_op_name'); 568 330 569 $title = apply_filters('widget_title', $title); 331 570 332 571 333 572 573 334 574 if(empty($title)) $title = "TradingView member Profile"; 575 335 576 if(empty($symbol )) $symbol = $chart_data['symbol']; 336 577 if(empty($interval )) $interval = $chart_data['interval']; … … 338 579 if(empty($autosize )) $autosize = $chart_data['autosize']; 339 580 if(empty($width )) $width = $chart_data['width']; 581 340 582 if(empty($widthpop)) $widthpop = $chart_data['widthpop']; 583 341 584 if(empty($height )) $height = $chart_data['height']; 585 342 586 if(empty($heightpop)) $heightpop = $chart_data['heightpop']; 587 343 588 if(empty($theme )) $theme = $chart_data['theme']; 344 589 if(empty($style )) $style = $chart_data['style']; … … 359 604 if(empty($referral_id)) $referral_id = $chart_data['referral_id']; 360 605 606 361 607 $data = $this->display_TradingView($symbol,$interval,$timezone,$autosize,$width,$widthpop,$height,$heightpop,$theme,$style,$locale,$toolbar_bg,$enable_publishing,$allow_symbol_change,$withdateranges,$save_image,$details,$stocktwits,$headlines,$hotlist,$calendar,$hideideas,$hideideasbutton,$referral_id); 608 362 609 echo $before_widget; 610 363 611 echo $before_title . $title . $after_title; 612 364 613 echo $data; 614 365 615 echo $after_widget; 616 366 617 } 618 367 619 public static function display_TradingView($symbol,$interval,$timezone,$autosize,$width,$height,$theme,$style,$locale,$toolbar_bg,$enable_publishing,$allow_symbol_change,$hide_top_toolbar,$withdateranges,$hide_side_toolbar,$save_image,$details,$stocktwits,$headlines,$hotlist,$calendar,$hideideas,$hideideasbutton,$referral_id){ 620 368 621 $data = ""; 369 622 623 624 370 625 $data .= "<script type='text/javascript'> 626 371 627 new TradingView.widget({"; 628 372 629 if($autosize=='1') $data .= " 630 373 631 'autosize': true,"; 632 374 633 else{ 634 375 635 $data .= " 636 376 637 'width': ".$width.", 638 377 639 'height': ".$height.","; 640 378 641 } 642 379 643 $data .= " 644 380 645 'symbol': '".$symbol."', 646 381 647 'interval': '".$interval."', 648 382 649 'timezone': '".$timezone."', 650 383 651 'theme': '".$theme."', 652 384 653 'style': '".$style."', 654 385 655 'locale': '".$locale."', 656 386 657 'toolbar_bg': '".$toolbar_bg."',"; 658 387 659 if($enable_publishing=='1') $data .= " 660 388 661 'enable_publishing': true,"; 662 389 663 else $data .= " 664 390 665 'enable_publishing': false,"; 666 391 667 if($hide_top_toolbar!='0') $data .= " 668 392 669 'hide_top_toolbar': true,"; 670 393 671 if($withdateranges=='1') $data .= " 672 394 673 'withdateranges': true,"; 674 395 675 if($hide_side_toolbar!='0') $data .= " 676 396 677 'hide_side_toolbar': true,"; 678 397 679 if($allow_symbol_change=='1') $data .= " 680 398 681 'allow_symbol_change': true,"; 682 399 683 else $data .= " 684 400 685 'allow_symbol_change': false,"; 686 401 687 if($save_image=='1') $data .= " 688 402 689 'save_image': true,"; 690 403 691 if($details=='1') $data .= " 692 404 693 'details': false,"; 694 405 695 if($hotlist=='1') $data .= " 696 406 697 'hotlist': false,"; 698 407 699 if($calendar=='1') $data .= " 700 408 701 'calendar': false,"; 702 409 703 if($stocktwits!='' || $headlines!='') { 704 410 705 $data .= " 706 411 707 'news' : [ 708 412 709 "; 710 413 711 if($stocktwits) { 712 414 713 $data .= " 714 415 715 'stocktwits'"; 716 416 717 } 718 417 719 if($headlines) { 720 418 721 $data .= ", 722 419 723 'headlines'"; 724 420 725 } 726 421 727 $data .= " 728 422 729 ],"; 730 423 731 } 732 424 733 if($hideideas!='0'){ 734 425 735 $data .= " 736 426 737 'hideideas': true,"; 738 427 739 if($hideideasbutton!='0'){ 740 428 741 $data .= " 742 429 743 'hideideasbutton': true,"; 744 430 745 } 746 431 747 } 748 432 749 if($referral_id!=''){ 750 433 751 $data .= " 752 434 753 'referral_id': '".$referral_id."'"; 754 435 755 } else $data .= " 756 436 757 'no_referral_id': true"; 758 437 759 $data .= " 760 438 761 }); 762 439 763 </script>"; 764 440 765 return $data; 441 766 767 768 442 769 } 770 443 771 } 772 444 773 add_action('widgets_init', function(){return register_widget('widget_TradingView_chart');}); 445 ?> 774 -
wp-tradingview/trunk/inc/class_chat.php
r2532172 r2898060 1 1 <?php 2 2 3 4 3 5 class widget_TradingView_chat extends WP_Widget{ 4 6 7 8 5 9 public function __construct() { 10 6 11 $params = array( 12 7 13 'description' => 'Trading View chat - Display interactive chat widget from TradingView', 14 8 15 'name' => 'Trading View chat' 16 9 17 ); 10 18 19 20 11 21 parent::__construct('widget_TradingView_chat','',$params); 22 12 23 } 24 13 25 public function form($instance) { 26 14 27 extract($instance); 28 15 29 $chat_data = get_option('tv_chat_op_name'); 30 16 31 ?> 17 <p> 32 33 <p> 34 18 35 <label for="<?php echo $this->get_field_id('title');?>">Title: </label> 36 19 37 <input 38 20 39 class="widefat" 40 21 41 id="<?php echo $this->get_field_id('title');?>" 42 22 43 name="<?php echo $this->get_field_name('title');?>" 44 23 45 value="<?php echo !empty($title) ? $title : "Trading View chat widget"; ?>" /> 24 </p> 25 <p> 46 47 </p> 48 49 <p> 50 51 26 52 27 53 <label for="<?php echo $this->get_field_id( 'room' ); ?>">Chat room: </label> 54 28 55 <select id="<?php echo $this->get_field_id( 'room' ); ?>" 56 29 57 name="<?php echo $this->get_field_name( 'room' ); ?>" 58 30 59 class="widefat" style="width:100%;"> 31 60 61 62 32 63 <option value="general" <?php if ($room == 'general') echo 'selected="general"'; ?>>Forex</option> 64 33 65 <option value="stock" <?php if ($room == 'stock') echo 'selected="stock"'; ?>>Stocks & Indexes</option> 66 34 67 <option value="bitcoin" <?php if ($room == 'bitcoin') echo 'selected="bitcoin"'; ?>>Cryptocurrencies</option> 68 35 69 <option value="OChp2kucHixrW1Vt" <?php if ($room == 'OChp2kucHixrW1Vt') echo 'selected="OChp2kucHixrW1Vt"'; ?>>Agriculture</option> 70 36 71 <option value="Hek0gmnZRpR5tClu" <?php if ($room == 'Hek0gmnZRpR5tClu') echo 'selected="Hek0gmnZRpR5tClu"'; ?>>Andrews Pitchfork Traders</option> 72 37 73 <option value="dAkuSLzlBFz81SRK" <?php if ($room == 'dAkuSLzlBFz81SRK') echo 'selected="dAkuSLzlBFz81SRK"'; ?>>Apple AAPL</option> 74 38 75 <option value="z2Xw3omfT5YvLf4j" <?php if ($room == 'z2Xw3omfT5YvLf4j') echo 'selected="z2Xw3omfT5YvLf4j"'; ?>>Arabic</option> 76 39 77 <option value="jMDsUD5Dmbe0MsjM" <?php if ($room == 'jMDsUD5Dmbe0MsjM') echo 'selected="jMDsUD5Dmbe0MsjM"'; ?>>ASX200 XJO SPI traders</option> 78 40 79 <option value="mTHOu0EhmltBWThb" <?php if ($room == 'mTHOu0EhmltBWThb') echo 'selected="mTHOu0EhmltBWThb"'; ?>>BANK NIFTY</option> 80 41 81 <option value="TZ24b3jAY8pbkpe5" <?php if ($room == 'TZ24b3jAY8pbkpe5') echo 'selected="TZ24b3jAY8pbkpe5"'; ?>>BEST TRADING ADVISOR OR ADVISORY SERVICES</option> 82 42 83 <option value="farV5KTpCxT7xxaf" <?php if ($room == 'farV5KTpCxT7xxaf') echo 'selected="farV5KTpCxT7xxaf"'; ?>>Binary Option Trading</option> 84 43 85 <option value="1nO89eozE9k3lDUA" <?php if ($room == '1nO89eozE9k3lDUA') echo 'selected="1nO89eozE9k3lDUA"'; ?>>Bitcoin</option> 86 44 87 <option value="e4VCmafnLm22iigm" <?php if ($room == 'e4VCmafnLm22iigm') echo 'selected="e4VCmafnLm22iigm"'; ?>>Brazilian Traders</option> 88 45 89 <option value="kiPTCI4zDniacLot" <?php if ($room == 'kiPTCI4zDniacLot') echo 'selected="kiPTCI4zDniacLot"'; ?>>Canadian Traders</option> 90 46 91 <option value="EzwOLDsluV7xQCZm" <?php if ($room == 'EzwOLDsluV7xQCZm') echo 'selected="EzwOLDsluV7xQCZm"'; ?>>China Forex traders House</option> 92 47 93 <option value="WA0hqxSYhRibB4Qr" <?php if ($room == 'WA0hqxSYhRibB4Qr') echo 'selected="WA0hqxSYhRibB4Qr"'; ?>>Chinese Forex Commodity Index</option> 94 48 95 <option value="DjPnZNEzTJELAFiR" <?php if ($room == 'DjPnZNEzTJELAFiR') echo 'selected="DjPnZNEzTJELAFiR"'; ?>>Community Powered Technical Help & Discussion</option> 96 49 97 <option value="E4bnOJSWcO1zDjBG" <?php if ($room == 'E4bnOJSWcO1zDjBG') echo 'selected="E4bnOJSWcO1zDjBG"'; ?>>DanV Charting The Waves</option> 98 50 99 <option value="gFiIzuX6QFtUHTYi" <?php if ($room == 'gFiIzuX6QFtUHTYi') echo 'selected="gFiIzuX6QFtUHTYi"'; ?>>Dutch speaking traders</option> 100 51 101 <option value="6N3ooQ8L1g9B535D" <?php if ($room == '6N3ooQ8L1g9B535D') echo 'selected="6N3ooQ8L1g9B535D"'; ?>>Elliott Wave Charting</option> 102 52 103 <option value="yrgtWWVYUbIiCt6S" <?php if ($room == 'yrgtWWVYUbIiCt6S') echo 'selected="yrgtWWVYUbIiCt6S"'; ?>>Ethereum</option> 104 53 105 <option value="Sj9VbiDu7w7CAVnv" <?php if ($room == 'Sj9VbiDu7w7CAVnv') echo 'selected="Sj9VbiDu7w7CAVnv"'; ?>>EUR/USD Only</option> 106 54 107 <option value="RFMVMuTYY8uVulfn" <?php if ($room == 'RFMVMuTYY8uVulfn') echo 'selected="RFMVMuTYY8uVulfn"'; ?>>Forex...Fundamentals...Tech...</option> 108 55 109 <option value="Klz9GXbFc0Mmeo7R" <?php if ($room == 'Klz9GXbFc0Mmeo7R') echo 'selected="Klz9GXbFc0Mmeo7R"'; ?>>Free Signals !</option> 110 56 111 <option value="3CgAUFDnfudjvOzI" <?php if ($room == '3CgAUFDnfudjvOzI') echo 'selected="3CgAUFDnfudjvOzI"'; ?>>French Traders</option> 112 57 113 <option value="BGfqre4MY2F448Oc" <?php if ($room == 'BGfqre4MY2F448Oc') echo 'selected="BGfqre4MY2F448Oc"'; ?>>FX Day Week Month Charts only</option> 114 58 115 <option value="bSDXyFGHqlaKXKYN" <?php if ($room == 'bSDXyFGHqlaKXKYN') echo 'selected="bSDXyFGHqlaKXKYN"'; ?>>GBPUSD</option> 116 59 117 <option value="HQSb9LtO5bZY3Zha" <?php if ($room == 'HQSb9LtO5bZY3Zha') echo 'selected="HQSb9LtO5bZY3Zha"'; ?>>GER30 DAX</option> 118 60 119 <option value="4kFT3tuOvsqqLwnd" <?php if ($room == '4kFT3tuOvsqqLwnd') echo 'selected="4kFT3tuOvsqqLwnd"'; ?>>German Room</option> 120 61 121 <option value="spKNkcfKuFVnvOKV" <?php if ($room == 'spKNkcfKuFVnvOKV') echo 'selected="spKNkcfKuFVnvOKV"'; ?>>GOLD discussion</option> 122 62 123 <option value="emRgoeVgwVrK5QhB" <?php if ($room == 'emRgoeVgwVrK5QhB') echo 'selected="emRgoeVgwVrK5QhB"'; ?>>Greece Traders</option> 124 63 125 <option value="Q2TWs4mXQli3TjVW" <?php if ($room == 'Q2TWs4mXQli3TjVW') echo 'selected="Q2TWs4mXQli3TjVW"'; ?>>Investing</option> 126 64 127 <option value="2jxKKPwsyAwIccQs" <?php if ($room == '2jxKKPwsyAwIccQs') echo 'selected="2jxKKPwsyAwIccQs"'; ?>>Iranian Forex Trader - Independent Traders</option> 128 65 129 <option value="mIONnBv3Rq0qQ0Ys" <?php if ($room == 'mIONnBv3Rq0qQ0Ys') echo 'selected="mIONnBv3Rq0qQ0Ys"'; ?>>Italian Traders</option> 130 66 131 <option value="c8BzrhGRvXxGXWnJ" <?php if ($room == 'c8BzrhGRvXxGXWnJ') echo 'selected="c8BzrhGRvXxGXWnJ"'; ?>>Key Hidden Levels</option> 132 67 133 <option value="TInEb6P7UTGVrOux" <?php if ($room == 'TInEb6P7UTGVrOux') echo 'selected="TInEb6P7UTGVrOux"'; ?>>Korean Traders</option> 134 68 135 <option value="pIKDtULtVOwFfVVc" <?php if ($room == 'pIKDtULtVOwFfVVc') echo 'selected="pIKDtULtVOwFfVVc"'; ?>>Lazy Charts</option> 136 69 137 <option value="P2SE5eKzi1lSlYHE" <?php if ($room == 'P2SE5eKzi1lSlYHE') echo 'selected="P2SE5eKzi1lSlYHE"'; ?>>Lithuanian Traders</option> 138 70 139 <option value="OeIbaTBVx48InuU4" <?php if ($room == 'OeIbaTBVx48InuU4') echo 'selected="OeIbaTBVx48InuU4"'; ?>>NASDAQ/NYSE Signals</option> 140 71 141 <option value="UajYkAfATwDxwyFp" <?php if ($room == 'UajYkAfATwDxwyFp') echo 'selected="UajYkAfATwDxwyFp"'; ?>>NATGAS</option> 142 72 143 <option value="m46zyJGoGFgzClrx" <?php if ($room == 'm46zyJGoGFgzClrx') echo 'selected="m46zyJGoGFgzClrx"'; ?>>Nifty Lovers</option> 144 73 145 <option value="huufTEomwseDbwhZ" <?php if ($room == 'huufTEomwseDbwhZ') echo 'selected="huufTEomwseDbwhZ"'; ?>>nmike Divergence Trading Room</option> 146 74 147 <option value="q0Xt2Jzq4znU6Bov" <?php if ($room == 'q0Xt2Jzq4znU6Bov') echo 'selected="q0Xt2Jzq4znU6Bov"'; ?>>NSE - India</option> 148 75 149 <option value="DzFI3ZpheNLKdYid" <?php if ($room == 'DzFI3ZpheNLKdYid') echo 'selected="DzFI3ZpheNLKdYid"'; ?>>OIL/USDCAD</option> 150 76 151 <option value="ZaJvQy7PDvTR4irM" <?php if ($room == 'ZaJvQy7PDvTR4irM') echo 'selected="ZaJvQy7PDvTR4irM"'; ?>>OIL (WTI/Brent)</option> 152 77 153 <option value="TyuWQ41YMrnIl2Od" <?php if ($room == 'TyuWQ41YMrnIl2Od') echo 'selected="TyuWQ41YMrnIl2Od"'; ?>>PennyStocks</option> 154 78 155 <option value="RCeMLkOzxOPtXO5v" <?php if ($room == 'RCeMLkOzxOPtXO5v') echo 'selected="RCeMLkOzxOPtXO5v"'; ?>>Pharma & Biotechs with TheBanker</option> 156 79 157 <option value="BfmVowG1TZkKO235" <?php if ($room == 'BfmVowG1TZkKO235') echo 'selected="BfmVowG1TZkKO235"'; ?>>Pine Script Editor</option> 158 80 159 <option value="mf8Y2KmLnMUuFzzr" <?php if ($room == 'mf8Y2KmLnMUuFzzr') echo 'selected="mf8Y2KmLnMUuFzzr"'; ?>>Polish Trading Team</option> 160 81 161 <option value="ZKZDQ3r9NMCOzaVZ" <?php if ($room == 'ZKZDQ3r9NMCOzaVZ') echo 'selected="ZKZDQ3r9NMCOzaVZ"'; ?>>Price Action Trading Room</option> 162 82 163 <option value="JR3KTaW51mE9YmOd" <?php if ($room == 'JR3KTaW51mE9YmOd') echo 'selected="JR3KTaW51mE9YmOd"'; ?>>Quantitative trading</option> 164 83 165 <option value="Iiu0jvBE9ZnKwVvd" <?php if ($room == 'Iiu0jvBE9ZnKwVvd') echo 'selected="Iiu0jvBE9ZnKwVvd"'; ?>>Romanian Traders</option> 166 84 167 <option value="tEkrZBiZi0TaWw4S" <?php if ($room == 'tEkrZBiZi0TaWw4S') echo 'selected="tEkrZBiZi0TaWw4S"'; ?>>Silver discussion</option> 168 85 169 <option value="2CFD4YQeH8hMgXGE" <?php if ($room == '2CFD4YQeH8hMgXGE') echo 'selected="2CFD4YQeH8hMgXGE"'; ?>>Spanish Room</option> 170 86 171 <option value="Q8tWbgGWUxMgOT0K" <?php if ($room == 'Q8tWbgGWUxMgOT0K') echo 'selected="Q8tWbgGWUxMgOT0K"'; ?>>Strictly Trade Calls!</option> 172 87 173 <option value="GLTODfGzJGbU1YVv" <?php if ($room == 'GLTODfGzJGbU1YVv') echo 'selected="GLTODfGzJGbU1YVv"'; ?>>Supply and Demand Trading</option> 174 88 175 <option value="jHAiM1jq1ZE2EoZ0" <?php if ($room == 'jHAiM1jq1ZE2EoZ0') echo 'selected="jHAiM1jq1ZE2EoZ0"'; ?>>Svenska rummet</option> 176 89 177 <option value="3PPPFNQzjwtfVd7I" <?php if ($room == '3PPPFNQzjwtfVd7I') echo 'selected="3PPPFNQzjwtfVd7I"'; ?>>Swing Trading</option> 178 90 179 <option value="pfY7sNwno8Gi3eBK" <?php if ($room == 'pfY7sNwno8Gi3eBK') echo 'selected="pfY7sNwno8Gi3eBK"'; ?>>TastyTraders</option> 180 91 181 <option value="ZJEx3xzknG8FbuVS" <?php if ($room == 'ZJEx3xzknG8FbuVS') echo 'selected="ZJEx3xzknG8FbuVS"'; ?>>Trading Institutional Order Flow</option> 182 92 183 <option value="Wh1B2CL0d17yPuVq" <?php if ($room == 'Wh1B2CL0d17yPuVq') echo 'selected="Wh1B2CL0d17yPuVq"'; ?>>Trading with pivot points and pivot trends</option> 184 93 185 <option value="eMY3zrURaLRkGyiD" <?php if ($room == 'eMY3zrURaLRkGyiD') echo 'selected="eMY3zrURaLRkGyiD"'; ?>>Turkish Traders</option> 186 94 187 <option value="7HdQBrEUwYewrXlK" <?php if ($room == '7HdQBrEUwYewrXlK') echo 'selected="7HdQBrEUwYewrXlK"'; ?>>USDCAD</option> 188 95 189 <option value="mpYGMfzLCDP3ZiPa" <?php if ($room == 'mpYGMfzLCDP3ZiPa') echo 'selected="mpYGMfzLCDP3ZiPa"'; ?>>USDRUB (in Russian)</option> 190 96 191 <option value="8GYmyEi7PgD1pUPG" <?php if ($room == '8GYmyEi7PgD1pUPG') echo 'selected="8GYmyEi7PgD1pUPG"'; ?>>Vietnamese Gold & FX trading's group</option> 97 192 </select> 98 </p> 99 100 <p> 193 194 </p> 195 196 197 198 <p> 199 101 200 <input type="checkbox" class="checkbox" 201 102 202 id="<?php echo $this->get_field_id('autosize');?>" 203 103 204 name="<?php echo $this->get_field_name('autosize');?>" 205 104 206 value="1" <?php echo ($autosize != '') ? checked (true,$autosize,false): checked (true,$chart_data['autosize'],false); ?>/> 207 105 208 <label for="<?php echo $this->get_field_id('autosize');?>">Autosize</label> 106 </p> 107 108 <p> 209 210 </p> 211 212 213 214 <p> 215 109 216 <label for="<?php echo $this->get_field_id('width');?>">Width: </label> 217 110 218 <input 219 111 220 class="widefat" 221 112 222 id="<?php echo $this->get_field_id('width');?>" 223 113 224 name="<?php echo $this->get_field_name('width');?>" 225 114 226 value="<?php echo !empty($width) ? $width : $chat_data['width']; ?>" /> 115 227 116 </p> 117 <p> 228 229 230 </p> 231 232 <p> 233 118 234 <label for="<?php echo $this->get_field_id('height');?>">Height: </label> 235 119 236 <input 237 120 238 class="widefat" 239 121 240 id="<?php echo $this->get_field_id('height');?>" 241 122 242 name="<?php echo $this->get_field_name('height');?>" 243 123 244 value="<?php echo !empty($height) ? $height : $chat_data['height']; ?>" /> 124 245 125 </p> 126 127 <p> 246 247 248 </p> 249 250 251 252 <p> 253 128 254 <label for="<?php echo $this->get_field_id( 'locale' ); ?>">Language: </label> 255 129 256 <select id="<?php echo $this->get_field_id( 'locale' ); ?>" 257 130 258 name="<?php echo $this->get_field_name( 'locale' ); ?>" 259 131 260 class="widefat" style="width:100%;"> 261 132 262 <option value="en" <?php if ($locale == 'en') echo 'selected="en"'; ?> >English</option> 263 133 264 <option value="ru" <?php if ($locale == 'ru') echo 'selected="ru"'; ?> >Русский</option> 265 134 266 <option value="zh" <?php if ($locale == 'zh') echo 'selected="zh"'; ?> >简体中文</option> 267 135 268 <option value="tw" <?php if ($locale == 'tw') echo 'selected="tw"'; ?> >繁體中文</option> 269 136 270 <option value="ja" <?php if ($locale == 'ja') echo 'selected="ja"'; ?> >日本語</option> 271 137 272 <option value="de" <?php if ($locale == 'de') echo 'selected="de"'; ?> >Deutch</option> 273 138 274 <option value="pt" <?php if ($locale == 'pt') echo 'selected="pt"'; ?> >Português</option> 275 139 276 <option value="it" <?php if ($locale == 'it') echo 'selected="it"'; ?> >Italiano</option> 277 140 278 <option value="es" <?php if ($locale == 'es') echo 'selected="es"'; ?> >Español</option> 279 141 280 <option value="fr" <?php if ($locale == 'fr') echo 'selected="fr"'; ?> >French</option> 281 142 282 <option value="vi" <?php if ($locale == 'vi') echo 'selected="vi"'; ?> >Tiếng Việt</option> 283 143 284 <option value="he_IL" <?php if ($locale == 'he_IL') echo 'selected="he_IL"'; ?> >עברית</option> 285 144 286 <option value="fa" <?php if ($locale == 'fa') echo 'selected="fa"'; ?> >فارسی</option> 287 145 288 <option value="cs" <?php if ($locale == 'cs') echo 'selected="cs"'; ?> >Česky</option> 289 146 290 <option value="th" <?php if ($locale == 'th') echo 'selected="th"'; ?> >ภาษาไทย</option> 291 147 292 <option value="ko" <?php if ($locale == 'ko') echo 'selected="ko"'; ?> >한국어</option> 293 148 294 <option value="tr" <?php if ($locale == 'tr') echo 'selected="tr"'; ?> >Türkçe</option> 295 149 296 </select> 150 </p> 297 298 </p> 299 151 300 <?php 301 152 302 //if($room != ''): 303 153 304 //if($widthpop==2) $width = $width.'%'; 305 154 306 //if($heightpop==2) $height = $height.'%'; 155 307 308 309 156 310 ?> 311 157 312 <p><strong>Shortcode:</strong><br/> 313 158 314 <code> 315 159 316 <?php 317 160 318 $widthstr = 'width="'.$width.'" height="'.$height.'"'; 319 161 320 if($autosize=='1') $widthstr = 'autosize="1"'; 321 162 322 printf('[tv-chat room="%1$s" %2$s language="%3$s"]', 323 163 324 $room, $widthstr, $locale); 325 164 326 ?> 165 327 328 329 166 330 </code> 167 </p> 331 332 </p> 333 168 334 <!--?php 335 169 336 //endif; ?--> 337 170 338 <?php 339 171 340 } 341 172 342 public function widget($args, $instance) { 343 173 344 extract($args); 345 174 346 extract($instance); 347 175 348 $chat_data = get_option('tv_chat_op_name'); 349 176 350 $title = apply_filters('widget_title', $title); 351 177 352 if(empty($title)) $title = "TradingView member Profile"; 353 178 354 if(empty($room )) $room = $chat_data['room']; 355 179 356 if(empty($autosize )) $autosize = $chat_data['autosize']; 357 180 358 if(empty($width )) $width = $chat_data['width']; 359 181 360 //if(empty($widthpop)) $widthpop = $chat_data['widthpop']; 361 182 362 if(empty($height )) $height = $chat_data['height']; 363 183 364 //if(empty($heightpop)) $heightpop = $chat_data['heightpop']; 365 184 366 if(empty($locale)) $locale = $chat_data['locale']; 367 185 368 $data = $this->display_TradingView($room,$autosize,$width,$height,$locale); 369 186 370 echo $before_widget; 371 187 372 echo $before_title . $title . $after_title; 373 188 374 echo $data; 375 189 376 echo $after_widget; 377 190 378 } 379 191 380 public static function display_TradingView($room,$autosize,$width,$height,$locale){ 381 192 382 $data = ""; 383 193 384 $x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 385 194 386 //$rand = 'id="tv-ideas-stream-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5).'"'; 387 195 388 $rand = 'tv-chat-widget-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5); 389 196 390 //if($widthpop==2) $width = "'".$width."%'"; 391 197 392 //if($heightpop==2) $height = "'".$height."%'"; 393 198 394 if(empty($room)) $room = 'general'; 395 199 396 $data .= "<div id=".$rand."></div> 397 200 398 <script type='text/javascript'> 399 201 400 new TradingView.ChatWidgetEmbed({ 401 202 402 'container_id': '".$rand."', 403 203 404 'room': '".$room."',"; 405 204 406 if($autosize=='1') $data .= " 407 205 408 'autosize': 'true'"; 409 206 410 else $data .= " 411 207 412 'width': '".$width."', 413 208 414 'height': '".$height."',"; 415 209 416 $data .= " 417 210 418 'locale': '".$locale."' 419 211 420 }); 421 212 422 </script>"; 423 213 424 return $data; 425 214 426 } 427 215 428 } 429 216 430 add_action('widgets_init', function(){return register_widget('widget_TradingView_chat');}); 217 ?> 431 -
wp-tradingview/trunk/inc/class_ideastream.php
r2532172 r2898060 1 1 <?php 2 2 3 4 3 5 class widget_TradingView_ideastream extends WP_Widget{ 4 6 7 8 5 9 public function __construct() { 10 6 11 $params = array( 12 7 13 'description' => 'Trading View ideastream - Display ideastream of a username from TradingView as a widget', 14 8 15 'name' => 'Trading View ideastream' 16 9 17 ); 10 18 19 20 11 21 parent::__construct('widget_TradingView_ideastream','',$params); 22 12 23 } 24 13 25 public function form($instance) { 26 14 27 extract($instance); 28 15 29 $ideastream_data = get_option('tv_ideastream_op_name'); 30 16 31 ?> 32 17 33 <script type="text/javascript"> 34 18 35 jQuery(document).ready(function($){ 36 19 37 // Add Color Picker to all inputs that have 'color-field' class 38 20 39 $(function() { 40 21 41 $('.tv-color-field').wpColorPicker(); 42 22 43 }); 44 23 45 }); 46 24 47 </script> 48 25 49 <style> 50 26 51 .widget-content > .wp-picker-container > a {display: none;} 52 27 53 </style> 28 <p> 54 55 <p> 56 29 57 <label for="<?php echo $this->get_field_id('title');?>">Title: </label> 58 30 59 <input 60 31 61 class="widefat" 62 32 63 id="<?php echo $this->get_field_id('title');?>" 64 33 65 name="<?php echo $this->get_field_name('title');?>" 66 34 67 value="<?php echo !empty($title) ? $title : "TradingView idea stream"; ?>" /> 35 </p> 36 <p> 68 69 </p> 70 71 <p> 72 37 73 <label for="<?php echo $this->get_field_id('startingCount');?>">Starting count: </label> 74 38 75 <input type="number" 76 39 77 class="widefat" 78 40 79 id="<?php echo $this->get_field_id('startingCount');?>" 80 41 81 name="<?php echo $this->get_field_name('startingCount');?>" 82 42 83 value="<?php echo !empty($startingCount) ? $startingCount : $ideastream_data['startingCount']; ?>" /> 43 </p> 44 45 <p> 84 85 </p> 86 87 88 89 <p> 90 46 91 <label for="<?php echo $this->get_field_id('width');?>">Width: </label> 92 47 93 <input 94 48 95 class="widefat" 96 49 97 id="<?php echo $this->get_field_id('width');?>" 98 50 99 name="<?php echo $this->get_field_name('width');?>" 100 51 101 value="<?php echo !empty($width) ? $width : $ideastream_data['width']; ?>" /><input 102 52 103 type="radio" 104 53 105 class="widefat" 106 54 107 name="<?php echo $this->get_field_name('widthpop');?>" 108 55 109 value="1" <?php echo ($widthpop != 0) ? checked (1,$widthpop,false): checked (1,$ideastream_data['widthpop'],false); ?>/>px <input 110 56 111 type="radio" 112 57 113 class="widefat" 114 58 115 name="<?php echo $this->get_field_name('widthpop');?>" 116 59 117 value="2" <?php echo ($widthpop != 0) ? checked (2,$widthpop,false): checked (2,$ideastream_data['widthpop'],false); ?>/>% 60 118 61 </p> 62 <p> 119 120 121 </p> 122 123 <p> 124 63 125 <label for="<?php echo $this->get_field_id('height');?>">Height: </label> 126 64 127 <input 128 65 129 class="widefat" 130 66 131 id="<?php echo $this->get_field_id('height');?>" 132 67 133 name="<?php echo $this->get_field_name('height');?>" 134 68 135 value="<?php echo !empty($height) ? $height : $ideastream_data['height']; ?>" /><input 136 69 137 type="radio" 138 70 139 class="widefat" 140 71 141 name="<?php echo $this->get_field_name('heightpop');?>" 142 72 143 value="1" <?php echo ($heightpop != 0) ? checked (1,$heightpop,false): checked (1,$ideastream_data['heightpop'],false); ?>/>px <input 144 73 145 type="radio" 146 74 147 class="widefat" 148 75 149 name="<?php echo $this->get_field_name('heightpop');?>" 150 76 151 value="2" <?php echo ($heightpop != 0) ? checked (2,$heightpop,false): checked (2,$ideastream_data['heightpop'],false); ?>/>% 77 152 78 </p> 79 80 <p> 153 154 155 </p> 156 157 158 159 <p> 160 81 161 <label>Header color: </label> 82 162 <input type="text" 163 83 164 class="tv-color-field" 165 84 166 id="<?php echo $this->get_field_id('headerColor');?>" 167 85 168 name="<?php echo $this->get_field_name('headerColor');?>" 169 86 170 value="<?php echo !empty($headerColor) ? $headerColor : $ideastream_data['headerColor']; ?>" data-default-color="#FFFFFF" /> 87 </p> 171 172 </p> 173 88 174 89 175 <p> 90 176 <label>Background color: </label> 91 177 <input type="text" 178 92 179 class="tv-color-field" 180 93 181 id="<?php echo $this->get_field_id('bgColor');?>" 182 94 183 name="<?php echo $this->get_field_name('bgColor');?>" 184 95 185 value="<?php echo !empty($bgColor) ? $bgColor : $ideastream_data['bgColor']; ?>" data-default-color="#FFFFFF" /> 96 </p> 186 187 </p> 188 97 189 98 190 <p> 99 191 <label>Border color: </label> 100 192 <input type="text" 193 101 194 class="tv-color-field" 195 102 196 id="<?php echo $this->get_field_id('borderColor');?>" 197 103 198 name="<?php echo $this->get_field_name('borderColor');?>" 199 104 200 value="<?php echo !empty($borderColor) ? $borderColor : $ideastream_data['borderColor']; ?>" data-default-color="#FFFFFF" /> 105 201 106 </p> 107 108 <p> 202 203 </p> 204 205 206 <p> 207 109 208 <label for="<?php echo $this->get_field_id( 'locale' ); ?>">Language: </label> 209 110 210 <select id="<?php echo $this->get_field_id( 'locale' ); ?>" 211 111 212 name="<?php echo $this->get_field_name( 'locale' ); ?>" 213 112 214 class="widefat" style="width:100%;"> 215 113 216 <option value="en" <?php if ($locale == 'en') echo 'selected="en"'; ?> >English</option> 217 114 218 <option value="ru" <?php if ($locale == 'ru') echo 'selected="ru"'; ?> >Русский</option> 219 115 220 <option value="zh" <?php if ($locale == 'zh') echo 'selected="zh"'; ?> >简体中文</option> 221 116 222 <option value="tw" <?php if ($locale == 'tw') echo 'selected="tw"'; ?> >繁體中文</option> 223 117 224 <option value="ja" <?php if ($locale == 'ja') echo 'selected="ja"'; ?> >日本語</option> 225 118 226 <option value="de" <?php if ($locale == 'de') echo 'selected="de"'; ?> >Deutch</option> 227 119 228 <option value="pt" <?php if ($locale == 'pt') echo 'selected="pt"'; ?> >Português</option> 229 120 230 <option value="it" <?php if ($locale == 'it') echo 'selected="it"'; ?> >Italiano</option> 231 121 232 <option value="es" <?php if ($locale == 'es') echo 'selected="es"'; ?> >Español</option> 233 122 234 <option value="fr" <?php if ($locale == 'fr') echo 'selected="fr"'; ?> >French</option> 235 123 236 <option value="vi" <?php if ($locale == 'vi') echo 'selected="vi"'; ?> >Tiếng Việt</option> 237 124 238 <option value="he_IL" <?php if ($locale == 'he_IL') echo 'selected="he_IL"'; ?> >עברית</option> 239 125 240 <option value="fa" <?php if ($locale == 'fa') echo 'selected="fa"'; ?> >فارسی</option> 241 126 242 <option value="cs" <?php if ($locale == 'cs') echo 'selected="cs"'; ?> >Česky</option> 243 127 244 <option value="th" <?php if ($locale == 'th') echo 'selected="th"'; ?> >ภาษาไทย</option> 245 128 246 <option value="ko" <?php if ($locale == 'ko') echo 'selected="ko"'; ?> >한국어</option> 247 129 248 <option value="tr" <?php if ($locale == 'tr') echo 'selected="tr"'; ?> >Türkçe</option> 249 130 250 </select> 131 </p> 132 <p> 251 252 </p> 253 254 <p> 255 133 256 <label for="<?php echo $this->get_field_id( 'stream' ); ?>">Stream type: </label> 257 134 258 <select id="<?php echo $this->get_field_id( 'stream' ); ?>" 259 135 260 name="<?php echo $this->get_field_name( 'stream' ); ?>" 261 136 262 class="widefat" style="width:100%;"> 263 137 264 <option value="all" <?php if ($stream == 'all') echo 'selected="all"'; ?> >All markets</option> 265 138 266 <option value="stocks" <?php if ($stream == 'stocks') echo 'selected="stocks"'; ?> >Stocks</option> 267 139 268 <option value="stocks-us" <?php if ($stream == 'stocks-us') echo 'selected="stocks-us"'; ?> >US stocks</option> 269 140 270 <option value="stocks-uk" <?php if ($stream == 'stocks-uk') echo 'selected="stocks-uk"'; ?> >UK stocks</option> 271 141 272 <option value="stocks-india" <?php if ($stream == 'stocks-india') echo 'selected="stocks-india"'; ?> >Indian stocks</option> 273 142 274 <option value="stocks-es" <?php if ($stream == 'stocks-es') echo 'selected="stocks-es"'; ?> >Spain stocks</option> 275 143 276 <option value="stocks-japan" <?php if ($stream == 'stocks-japan') echo 'selected="stocks-japan"'; ?> >Japan stocks</option> 277 144 278 <option value="stocks-russia" <?php if ($stream == 'stocks-russia') echo 'selected="stocks-russia"'; ?> >Russian stocks</option> 279 145 280 <option value="indices" <?php if ($stream == 'indices') echo 'selected="indices"'; ?> >Indices</option> 281 146 282 <option value="commodities" <?php if ($stream == 'commodities') echo 'selected="commodities"'; ?> >Commodities</option> 283 147 284 <option value="currencies" <?php if ($stream == 'currencies') echo 'selected="currencies"'; ?> >Currencies</option> 285 148 286 <option value="bitcoin" <?php if ($stream == 'bitcoin') echo 'selected="bitcoin"'; ?> >Crypto currencies</option> 287 149 288 </select> 150 </p> 151 152 <p> 289 290 </p> 291 292 293 294 <p> 295 153 296 <label for="<?php echo $this->get_field_id( 'interval' ); ?>">Interval: </label> 297 154 298 <select id="<?php echo $this->get_field_id( 'interval' ); ?>" 299 155 300 name="<?php echo $this->get_field_name( 'interval' ); ?>" 301 156 302 class="widefat" style="width:100%;"> 303 157 304 <option value="day" <?php if ($interval == 'day') echo 'selected="day"'; ?> >Today</option> 305 158 306 <option value="week" <?php if ($interval == 'week') echo 'selected="week"'; ?> >This week</option> 307 159 308 <option value="month" <?php if ($interval == 'month') echo 'selected="month"'; ?> >This month</option> 309 160 310 <option value="all" <?php if ($interval == 'all') echo 'selected="all"'; ?> >All Intervals</option> 311 161 312 </select> 162 </p> 163 164 <p> 313 314 </p> 315 316 317 318 <p> 319 165 320 <label for="<?php echo $this->get_field_id( 'sort' ); ?>">Sort: </label> 321 166 322 <select id="<?php echo $this->get_field_id( 'sort' ); ?>" 323 167 324 name="<?php echo $this->get_field_name( 'sort' ); ?>" 325 168 326 class="widefat" style="width:100%;"> 327 169 328 <option value="trending" <?php if ($sort == 'trending') echo 'selected="trending"'; ?> >Trending</option> 329 170 330 <option value="discussed" <?php if ($sort == 'discussed') echo 'selected="discussed"'; ?> >Most discussed</option> 331 171 332 <option value="viewed" <?php if ($sort == 'viewed') echo 'selected="viewed"'; ?> >Most viewed</option> 333 172 334 <option value="agreed" <?php if ($sort == 'agreed') echo 'selected="agreed"'; ?> >Most agreed</option> 335 173 336 <option value="suggested" <?php if ($sort == 'suggested') echo 'selected="suggested"'; ?> >Most suggested</option> 337 174 338 <option value="recent" <?php if ($sort == 'recent') echo 'selected="recent"'; ?> >All ideas</option> 175 339 340 341 176 342 </select> 177 </p> 178 179 180 181 <p> 343 344 </p> 345 346 347 348 349 350 351 352 <p> 353 182 354 <label for="<?php echo $this->get_field_id( 'time' ); ?>">Time: </label> 355 183 356 <select id="<?php echo $this->get_field_id( 'time' ); ?>" 357 184 358 name="<?php echo $this->get_field_name( 'time' ); ?>" 359 185 360 class="widefat" style="width:100%;"> 361 186 362 <option value="day" <?php if ($time == 'day') echo 'selected="day"'; ?> >Today</option> 363 187 364 <option value="week" <?php if ($time == 'week') echo 'selected="week"'; ?> >This week</option> 365 188 366 <option value="month" <?php if ($time == 'month') echo 'selected="month"'; ?> >This month</option> 367 189 368 <option value="all" <?php if ($time == 'all') echo 'selected="all"'; ?> >All time</option> 369 190 370 </select> 191 </p> 192 193 <p> 371 372 </p> 373 374 375 376 <p> 377 194 378 <label for="<?php echo $this->get_field_id('symbol');?>">Symbol: </label> 379 195 380 <input 381 196 382 class="widefat" 383 197 384 id="<?php echo $this->get_field_id('symbol');?>" 385 198 386 name="<?php echo $this->get_field_name('symbol');?>" 387 199 388 value="<?php echo !empty($symbol) ? $symbol : $ideastream_data['symbol']; ?>" /> 200 </p> 201 202 203 <p> 389 390 </p> 391 392 393 394 395 396 <p> 397 204 398 <label for="<?php echo $this->get_field_id('username');?>">Username: </label> 399 205 400 <input 401 206 402 class="widefat" 403 207 404 id="<?php echo $this->get_field_id('username');?>" 405 208 406 name="<?php echo $this->get_field_name('username');?>" 407 209 408 value="<?php echo !empty($username) ? $username : $ideastream_data['username']; ?>" /> 210 </p> 409 410 </p> 411 412 211 413 212 414 <?php if($username != ''): 415 213 416 if($widthpop==2) $width = "'".$width."%'"; 417 214 418 if($heightpop==2) $height = "'".$height."%'"; 215 419 420 421 216 422 ?> 423 217 424 <p><strong>Shortcode:</strong><br/> 425 218 426 <code> 427 219 428 <?php 429 220 430 printf('[tv-ideastream symbol="%1$s" username="%2$s" width="%3$s" height="%4$s" startingCount="%5$s" sort="%6$s" time="%7$s" interval="%8$s" stream="%9$s" language="%10$s" bgColor="%11$s" headerColor="%12$s" borderColor="%13$s"]', 431 221 432 $symbol, $username, $width, $height, $startingCount, $sort, $time, $interval, $stream, $locale, $bgColor, $headerColor, $borderColor); 433 222 434 ?> 435 223 436 </code> 224 </p> 437 438 </p> 439 225 440 <?php endif; ?> 441 226 442 <?php 443 227 444 } 445 228 446 public function widget($args, $instance) { 447 229 448 extract($args); 449 230 450 extract($instance); 451 231 452 $ideastream_data = get_option('tv_ideastream_op_name'); 453 232 454 $title = apply_filters('widget_title', $title); 455 233 456 if(empty($title)) $title = "TradingView member Profile"; 457 234 458 if(empty($username )) $username = $ideastream_data['username']; 459 235 460 if(empty($width )) $width = $ideastream_data['width']; 461 236 462 if(empty($widthpop)) $widthpop = $ideastream_data['widthpop']; 463 237 464 if(empty($height )) $height = $ideastream_data['height']; 465 238 466 if(empty($heightpop)) $heightpop = $ideastream_data['heightpop']; 467 239 468 if(empty($locale)) $locale = $ideastream_data['locale']; 469 240 470 if(empty($bgColor)) $bgColor = $ideastream_data['bgColor']; 471 241 472 if(empty($headerColor)) $headerColor = $ideastream_data['headerColor']; 473 242 474 if(empty($borderColor)) $borderColor = $ideastream_data['borderColor']; 475 243 476 if(empty($sort)) $sort = $ideastream_data['sort']; 477 244 478 if(empty($time)) $time = $ideastream_data['time']; 479 245 480 if(empty($interval)) $interval = $ideastream_data['interval']; 481 246 482 if(empty($stream)) $stream = $ideastream_data['stream']; 483 247 484 if(empty($symbol)) $symbol = $ideastream_data['symbol']; 248 485 486 487 249 488 if($widthpop==2) $width = "'".$width."%'"; 489 250 490 if($heightpop==2) $height = "'".$height."%'"; 251 491 492 493 252 494 $data = $this->display_TradingView($startingCount,$width,$height,$bgColor,$headerColor,$borderColor,$locale,$sort,$time,$interval,$stream,$symbol,$username); 495 253 496 echo $before_widget; 497 254 498 echo $before_title . $title . $after_title; 499 255 500 echo $data; 501 256 502 echo $after_widget; 503 257 504 } 505 258 506 public static function display_TradingView($startingCount,$width,$height,$bgColor,$headerColor,$borderColor,$locale,$sort,$time,$interval,$stream,$symbol,$username){ 507 259 508 $data = ""; 509 260 510 $x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 511 261 512 //$rand = 'id="tv-ideas-stream-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5).'"'; 513 262 514 $rand = 'tv-ideastream-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5); 263 515 516 517 264 518 $data .= "<div id=".$rand."></div> 519 265 520 <script type='text/javascript'> 521 266 522 new TradingView.IdeasStreamWidget({ 523 267 524 'container_id': '".$rand."', 525 268 526 'startingCount': '".$startingCount."', 527 269 528 'width': '".$width."', 529 270 530 'height': '".$height."', 531 271 532 'mode': 'integrate', 533 272 534 'bgColor': '".$bgColor."', 535 273 536 'headerColor': '".$headerColor."', 537 274 538 'borderColor': '".$borderColor."', 539 275 540 'locale': '".$locale."', 541 276 542 'sort': '".$sort."', 543 277 544 'time': '".$time."', 545 278 546 'interval': '".$interval."', 547 279 548 'stream': '".$stream."', 549 280 550 'symbol': '".$symbol."', 551 281 552 'username': '".$username."' 553 282 554 }); 555 283 556 </script>"; 284 557 558 285 559 return $data; 560 286 561 } 562 287 563 } 288 564 565 566 289 567 add_action('widgets_init', function(){return register_widget('widget_TradingView_ideastream');}); 290 568 291 ?> 569 570 -
wp-tradingview/trunk/inc/class_ideaview.php
r2532172 r2898060 1 1 <?php 2 2 3 4 3 5 class widget_TradingView_ideaview extends WP_Widget{ 4 6 7 8 5 9 public function __construct() { 10 6 11 $params = array( 12 7 13 'description' => 'Trading View idea preview - Embed a specific idea from TradingView as a widget', 14 8 15 'name' => 'Trading View idea preview' 16 9 17 ); 10 18 19 20 11 21 parent::__construct('widget_TradingView_ideaview','',$params); 22 12 23 } 24 13 25 public function form($instance) { 26 14 27 extract($instance); 28 15 29 $ideaview_data = get_option('tv_ideaview_op_name'); 30 16 31 ?> 32 17 33 <script type="text/javascript"> 34 18 35 jQuery(document).ready(function($){ 36 19 37 // Add Color Picker to all inputs that have 'color-field' class 38 20 39 $(function() { 40 21 41 $('.tv-color-field').wpColorPicker(); 42 22 43 }); 44 23 45 }); 46 24 47 </script> 48 25 49 <style> 50 26 51 .widget-content > .wp-picker-container > a {display: none;} 52 27 53 </style> 28 <p> 54 55 <p> 56 29 57 <label for="<?php echo $this->get_field_id('title');?>">Title: </label> 58 30 59 <input 60 31 61 class="widefat" 62 32 63 id="<?php echo $this->get_field_id('title');?>" 64 33 65 name="<?php echo $this->get_field_name('title');?>" 66 34 67 value="<?php echo !empty($title) ? $title : "Trading View idea preview"; ?>" /> 35 </p> 36 <p> 68 69 </p> 70 71 <p> 72 37 73 <label for="<?php echo $this->get_field_id('idea');?>">Unique ID of idea: </label> 74 38 75 <input 76 39 77 class="widefat" 78 40 79 id="<?php echo $this->get_field_id('idea');?>" 80 41 81 name="<?php echo $this->get_field_name('idea');?>" 82 42 83 value="<?php echo !empty($idea) ? $idea : $ideaview_data['idea']; ?>" /> 43 </p> 44 45 <p> 84 85 </p> 86 87 88 89 <p> 90 46 91 <label for="<?php echo $this->get_field_id('width');?>">Width: </label> 92 47 93 <input 94 48 95 class="widefat" 96 49 97 id="<?php echo $this->get_field_id('width');?>" 98 50 99 name="<?php echo $this->get_field_name('width');?>" 100 51 101 value="<?php echo !empty($width) ? $width : $ideaview_data['width']; ?>" /><input 102 52 103 type="radio" 104 53 105 class="widefat" 106 54 107 name="<?php echo $this->get_field_name('widthpop');?>" 108 55 109 value="1" <?php echo ($widthpop != 0) ? checked (1,$widthpop,false): checked (1,$ideaview_data['widthpop'],false); ?>/>px <input 110 56 111 type="radio" 112 57 113 class="widefat" 114 58 115 name="<?php echo $this->get_field_name('widthpop');?>" 116 59 117 value="2" <?php echo ($widthpop != 0) ? checked (2,$widthpop,false): checked (2,$ideaview_data['widthpop'],false); ?>/>% 60 118 61 </p> 62 <p> 119 120 121 </p> 122 123 <p> 124 63 125 <label for="<?php echo $this->get_field_id('height');?>">Height: </label> 126 64 127 <input 128 65 129 class="widefat" 130 66 131 id="<?php echo $this->get_field_id('height');?>" 132 67 133 name="<?php echo $this->get_field_name('height');?>" 134 68 135 value="<?php echo !empty($height) ? $height : $ideaview_data['height']; ?>" /><input 136 69 137 type="radio" 138 70 139 class="widefat" 140 71 141 name="<?php echo $this->get_field_name('heightpop');?>" 142 72 143 value="1" <?php echo ($heightpop != 0) ? checked (1,$heightpop,false): checked (1,$ideaview_data['heightpop'],false); ?>/>px <input 144 73 145 type="radio" 146 74 147 class="widefat" 148 75 149 name="<?php echo $this->get_field_name('heightpop');?>" 150 76 151 value="2" <?php echo ($heightpop != 0) ? checked (2,$heightpop,false): checked (2,$ideaview_data['heightpop'],false); ?>/>% 77 152 78 </p> 79 80 <p> 153 154 155 </p> 156 157 158 159 <p> 160 81 161 <label for="<?php echo $this->get_field_id( 'locale' ); ?>">Language: </label> 162 82 163 <select id="<?php echo $this->get_field_id( 'locale' ); ?>" 164 83 165 name="<?php echo $this->get_field_name( 'locale' ); ?>" 166 84 167 class="widefat" style="width:100%;"> 168 85 169 <option value="en" <?php if ($locale == 'en') echo 'selected="en"'; ?> >English</option> 170 86 171 <option value="ru" <?php if ($locale == 'ru') echo 'selected="ru"'; ?> >Русский</option> 172 87 173 <option value="zh" <?php if ($locale == 'zh') echo 'selected="zh"'; ?> >简体中文</option> 174 88 175 <option value="tw" <?php if ($locale == 'tw') echo 'selected="tw"'; ?> >繁體中文</option> 176 89 177 <option value="ja" <?php if ($locale == 'ja') echo 'selected="ja"'; ?> >日本語</option> 178 90 179 <option value="de" <?php if ($locale == 'de') echo 'selected="de"'; ?> >Deutch</option> 180 91 181 <option value="pt" <?php if ($locale == 'pt') echo 'selected="pt"'; ?> >Português</option> 182 92 183 <option value="it" <?php if ($locale == 'it') echo 'selected="it"'; ?> >Italiano</option> 184 93 185 <option value="es" <?php if ($locale == 'es') echo 'selected="es"'; ?> >Español</option> 186 94 187 <option value="fr" <?php if ($locale == 'fr') echo 'selected="fr"'; ?> >French</option> 188 95 189 <option value="vi" <?php if ($locale == 'vi') echo 'selected="vi"'; ?> >Tiếng Việt</option> 190 96 191 <option value="he_IL" <?php if ($locale == 'he_IL') echo 'selected="he_IL"'; ?> >עברית</option> 192 97 193 <option value="fa" <?php if ($locale == 'fa') echo 'selected="fa"'; ?> >فارسی</option> 194 98 195 <option value="cs" <?php if ($locale == 'cs') echo 'selected="cs"'; ?> >Česky</option> 196 99 197 <option value="th" <?php if ($locale == 'th') echo 'selected="th"'; ?> >ภาษาไทย</option> 198 100 199 <option value="ko" <?php if ($locale == 'ko') echo 'selected="ko"'; ?> >한국어</option> 200 101 201 <option value="tr" <?php if ($locale == 'tr') echo 'selected="tr"'; ?> >Türkçe</option> 202 102 203 </select> 103 </p> 204 205 </p> 206 104 207 <?php if($idea != ''): 208 105 209 if($widthpop==2) $width = "'".$width."%'"; 210 106 211 if($heightpop==2) $height = "'".$height."%'"; 107 212 213 214 108 215 ?> 216 109 217 <p><strong>Shortcode:</strong><br/> 218 110 219 <code> 220 111 221 [tv-ideaview idea="<?php echo $idea; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" language="<?php echo $locale; ?>"] 222 112 223 </code> 113 </p> 224 225 </p> 226 114 227 <?php endif; ?> 228 115 229 <?php 230 116 231 } 232 117 233 public function widget($args, $instance) { 234 118 235 extract($args); 236 119 237 extract($instance); 238 120 239 $ideaview_data = get_option('tv_ideaview_op_name'); 240 121 241 $title = apply_filters('widget_title', $title); 242 122 243 if(empty($title)) $title = "Trading View idea preview"; 244 123 245 if(empty($username )) $idea = $ideaview_data['idea']; 246 124 247 if(empty($width )) $width = $ideaview_data['width']; 248 125 249 if(empty($widthpop)) $widthpop = $ideaview_data['widthpop']; 250 126 251 if(empty($height )) $height = $ideaview_data['height']; 252 127 253 if(empty($heightpop)) $heightpop = $ideaview_data['heightpop']; 254 128 255 if(empty($locale)) $locale = $ideaview_data['locale']; 256 129 257 if($widthpop==2) $width = "'".$width."%'"; 258 130 259 if($heightpop==2) $height = "'".$height."%'"; 260 131 261 $data = $this->display_TradingView($idea,$width,$height,$locale); 262 132 263 echo $before_widget; 264 133 265 echo $before_title . $title . $after_title; 266 134 267 echo $data; 268 135 269 echo $after_widget; 270 136 271 } 272 137 273 public static function display_TradingView($idea,$width,$height,$locale){ 274 138 275 $data = ""; 276 139 277 $x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 278 140 279 //$rand = 'id="tv-ideas-stream-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5).'"'; 280 141 281 $rand = 'tv-ideas-preview-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5); 282 142 283 $data .= "<div id=".$rand."></div> 284 143 285 <script type='text/javascript'> 286 144 287 new TradingView.IdeaWidget({ 288 145 289 'container_id': '".$rand."', 290 146 291 'width': '".$width."', 292 147 293 'height': '".$height."', 294 148 295 'idea': '".$idea."', 296 149 297 'locale': '".$locale."' 298 150 299 }); 300 151 301 </script>"; 302 152 303 return $data; 304 153 305 } 306 154 307 } 308 155 309 add_action('widgets_init', function(){return register_widget('widget_TradingView_ideaview');}); 156 ?> 310 -
wp-tradingview/trunk/inc/class_profile.php
r2532172 r2898060 1 1 <?php 2 2 3 4 3 5 class widget_TradingView_profile extends WP_Widget{ 4 6 7 8 5 9 public function __construct() { 10 6 11 $params = array( 12 7 13 'description' => 'Trading View profile - Display profile of a username from TradingView as a widget', 14 8 15 'name' => 'Trading View profile' 16 9 17 ); 10 18 19 20 11 21 parent::__construct('widget_TradingView_profile','',$params); 22 12 23 } 24 13 25 public function form($instance) { 26 14 27 extract($instance); 28 15 29 $profile_data = get_option('tv_profile_op_name'); 30 16 31 ?> 17 32 <script type="text/javascript"> 18 33 jQuery(document).ready(function($){ 34 19 35 // Add Color Picker to all inputs that have 'color-field' class 36 20 37 $(function() { 38 21 39 $('.tv-color-field').wpColorPicker(); 40 22 41 }); 42 23 43 }); 24 44 </script> … … 26 46 .widget-content > .wp-picker-container > a {display: none;} 27 47 </style> 28 <p> 48 49 <p> 50 29 51 <label for="<?php echo $this->get_field_id('title');?>">Title: </label> 52 30 53 <input 54 31 55 class="widefat" 56 32 57 id="<?php echo $this->get_field_id('title');?>" 58 33 59 name="<?php echo $this->get_field_name('title');?>" 60 34 61 value="<?php echo !empty($title) ? $title : "TradingView member Profile"; ?>" /> 35 </p> 36 <p> 62 63 </p> 64 65 <p> 66 37 67 <label for="<?php echo $this->get_field_id('username');?>">Username: </label> 68 38 69 <input 70 39 71 class="widefat" 72 40 73 id="<?php echo $this->get_field_id('username');?>" 74 41 75 name="<?php echo $this->get_field_name('username');?>" 76 42 77 value="<?php echo !empty($username) ? $username : $profile_data['username']; ?>" /> 43 </p> 44 45 <p> 78 79 </p> 80 81 82 83 <p> 84 46 85 <label for="<?php echo $this->get_field_id('width');?>">Width: </label> 86 47 87 <input 88 48 89 class="widefat" 90 49 91 id="<?php echo $this->get_field_id('width');?>" 92 50 93 name="<?php echo $this->get_field_name('width');?>" 94 51 95 value="<?php echo !empty($width) ? $width : $profile_data['width']; ?>" /><input 96 52 97 type="radio" 98 53 99 class="widefat" 100 54 101 name="<?php echo $this->get_field_name('widthpop');?>" 102 55 103 value="1" <?php echo ($widthpop != 0) ? checked (1,$widthpop,false): checked (1,$profile_data['widthpop'],false); ?>/>px <input 104 56 105 type="radio" 106 57 107 class="widefat" 108 58 109 name="<?php echo $this->get_field_name('widthpop');?>" 110 59 111 value="2" <?php echo ($widthpop != 0) ? checked (2,$widthpop,false): checked (2,$profile_data['widthpop'],false); ?>/>% 60 112 61 </p> 62 <p> 113 114 115 </p> 116 117 <p> 118 63 119 <label for="<?php echo $this->get_field_id('height');?>">Height: </label> 120 64 121 <input 122 65 123 class="widefat" 124 66 125 id="<?php echo $this->get_field_id('height');?>" 126 67 127 name="<?php echo $this->get_field_name('height');?>" 128 68 129 value="<?php echo !empty($height) ? $height : $profile_data['height']; ?>" /><input 130 69 131 type="radio" 132 70 133 class="widefat" 134 71 135 name="<?php echo $this->get_field_name('heightpop');?>" 136 72 137 value="1" <?php echo ($heightpop != 0) ? checked (1,$heightpop,false): checked (1,$profile_data['heightpop'],false); ?>/>px <input 138 73 139 type="radio" 140 74 141 class="widefat" 142 75 143 name="<?php echo $this->get_field_name('heightpop');?>" 144 76 145 value="2" <?php echo ($heightpop != 0) ? checked (2,$heightpop,false): checked (2,$profile_data['heightpop'],false); ?>/>% 77 146 78 </p> 79 80 <p> 147 148 149 </p> 150 151 152 153 <p> 154 81 155 <label for="<?php echo $this->get_field_id('headerColor');?>">Header color: </label> 156 82 157 <input 158 83 159 class="tv-color-field" 160 84 161 id="<?php echo $this->get_field_id('headerColor');?>" 162 85 163 name="<?php echo $this->get_field_name('headerColor');?>" 164 86 165 value="<?php echo !empty($headerColor) ? $headerColor : $profile_data['headerColor']; ?>" /> 87 </p> 88 89 <p> 166 167 </p> 168 169 170 171 <p> 172 90 173 <label for="<?php echo $this->get_field_id( 'locale' ); ?>">Language: </label> 174 91 175 <select id="<?php echo $this->get_field_id( 'locale' ); ?>" 176 92 177 name="<?php echo $this->get_field_name( 'locale' ); ?>" 178 93 179 class="widefat" style="width:100%;"> 180 94 181 <option value="en" <?php if ($locale == 'en') echo 'selected="en"'; ?> >English</option> 182 95 183 <option value="ru" <?php if ($locale == 'ru') echo 'selected="ru"'; ?> >Русский</option> 184 96 185 <option value="zh" <?php if ($locale == 'zh') echo 'selected="zh"'; ?> >简体中文</option> 186 97 187 <option value="tw" <?php if ($locale == 'tw') echo 'selected="tw"'; ?> >繁體中文</option> 188 98 189 <option value="ja" <?php if ($locale == 'ja') echo 'selected="ja"'; ?> >日本語</option> 190 99 191 <option value="de" <?php if ($locale == 'de') echo 'selected="de"'; ?> >Deutch</option> 192 100 193 <option value="pt" <?php if ($locale == 'pt') echo 'selected="pt"'; ?> >Português</option> 194 101 195 <option value="it" <?php if ($locale == 'it') echo 'selected="it"'; ?> >Italiano</option> 196 102 197 <option value="es" <?php if ($locale == 'es') echo 'selected="es"'; ?> >Español</option> 198 103 199 <option value="fr" <?php if ($locale == 'fr') echo 'selected="fr"'; ?> >French</option> 200 104 201 <option value="vi" <?php if ($locale == 'vi') echo 'selected="vi"'; ?> >Tiếng Việt</option> 202 105 203 <option value="he_IL" <?php if ($locale == 'he_IL') echo 'selected="he_IL"'; ?> >עברית</option> 204 106 205 <option value="fa" <?php if ($locale == 'fa') echo 'selected="fa"'; ?> >فارسی</option> 206 107 207 <option value="cs" <?php if ($locale == 'cs') echo 'selected="cs"'; ?> >Česky</option> 208 108 209 <option value="th" <?php if ($locale == 'th') echo 'selected="th"'; ?> >ภาษาไทย</option> 210 109 211 <option value="ko" <?php if ($locale == 'ko') echo 'selected="ko"'; ?> >한국어</option> 212 110 213 <option value="tr" <?php if ($locale == 'tr') echo 'selected="tr"'; ?> >Türkçe</option> 214 111 215 </select> 112 </p> 216 217 </p> 218 113 219 <?php if($username != ''): 220 114 221 if($widthpop==2) $width = "'".$width."%'"; 222 115 223 if($heightpop==2) $height = "'".$height."%'"; 116 224 225 226 117 227 ?> 228 118 229 <p><strong>Shortcode:</strong><br/> 230 119 231 <code> 232 120 233 [tv-profile username="<?php echo $username; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" language="<?php echo $locale; ?>"] 234 121 235 </code> 122 </p> 236 237 </p> 238 123 239 <?php endif; ?> 240 124 241 <?php 242 125 243 } 244 126 245 public function widget($args, $instance) { 246 127 247 extract($args); 248 128 249 extract($instance); 250 129 251 $profile_data = get_option('tv_profile_op_name'); 252 130 253 //extract($ideastream_data, EXTR_PREFIX_SAME, "d"); 131 254 255 256 132 257 $title = apply_filters('widget_title', $title); 133 258 259 260 134 261 /**foreach ($args as $key=>$val){ 262 135 263 if(empty($val)) $val = ${'d_'.$key}; 264 136 265 //$before_title .= $key .' => '.$val.'<br>'; 266 137 267 }**/ 138 268 269 270 139 271 if(empty($title)) $title = "TradingView member Profile"; 272 140 273 if(empty($username )) $username = $profile_data['username']; 274 141 275 if(empty($width )) $width = $profile_data['width']; 276 142 277 if(empty($widthpop)) $widthpop = $profile_data['widthpop']; 278 143 279 if(empty($height )) $height = $profile_data['height']; 280 144 281 if(empty($heightpop)) $heightpop = $profile_data['heightpop']; 282 145 283 if(empty($locale)) $locale = $profile_data['locale']; 146 284 285 286 147 287 if($widthpop==2) $width = "'".$width."%'"; 288 148 289 if($heightpop==2) $height = "'".$height."%'"; 149 290 291 292 150 293 $data = $this->display_TradingView($username,$width,$height,$locale); 294 151 295 echo $before_widget; 296 152 297 echo $before_title . $title . $after_title; 298 153 299 echo $data; 300 154 301 echo $after_widget; 302 155 303 } 304 156 305 public static function display_TradingView($username,$width,$height,$locale){ 157 306 307 308 158 309 $data = ""; 310 159 311 $x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; 312 160 313 //$rand = 'id="tv-ideas-stream-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5).'"'; 314 161 315 $rand = 'tv-user-info-'.substr(str_shuffle(str_repeat($x, ceil(5/strlen($x)) )),1,5); 162 316 317 318 163 319 $data .= "<div id=".$rand."></div> 320 164 321 <script type='text/javascript'> 322 165 323 new TradingView.UserInfoWidget({ 324 166 325 'container_id': '".$rand."', 326 167 327 'username': '".$username."', 328 168 329 'width': '".$width."', 330 169 331 'height': '".$height."', 332 170 333 'locale': '".$locale."' 334 171 335 }); 336 172 337 </script>"; 173 338 339 340 174 341 return $data; 342 175 343 } 344 176 345 } 177 346 347 348 178 349 add_action('widgets_init', function(){return register_widget('widget_TradingView_profile');}); 179 180 ?> -
wp-tradingview/trunk/readme.txt
r2532172 r2898060 1 1 === WP TradingView === 2 2 3 Contributors: tradepips 4 Tags: forex, stocks, finance, investment, trading, ideas, tradingview, tradepips, widget, shortcode, pips, lots, margin, tickers, charts, instruments, indicators, trade, yahoo finance, google finance, money, us dollar, eurusd, gbpusd, usdjpy, forex widgets, forex plugin, wordpress forex 5 Requires at least: 4.7 6 Tested up to: 5.7.2 7 Stable tag: 1.6 8 License: GPLv3 or later 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html 3 Contributors: Trade Pips 4 Donate link: https://tradepips.com/wp-tradingview-wordpress-plugin/ 5 License: GPLv3 6 License URI: http://www.gnu.org/licenses/gpl.html 7 Tags: forex, stocks, finance, investment, trading, ideas, tradingview, trade pips, tradepips, widget, shortcode, pips, lots, margin, tickers, charts, instruments, indicators, trade, yahoo finance, google finance, money, us dollar, eurusd, gbpusd, usdjpy, forex widgets, forex plugin, wordpress forex 8 Requires at least: 4.8 9 Tested up to: 6.2 10 Stable tag: 1.7 11 Requires PHP: 7.2.5 10 12 11 13 The WP TradingView plugin allows to add widgets and publishing tools from www.tradingview.com, directly within the wordpress dashboard. … … 13 15 == Description == 14 16 15 WP TradingView plugin developed by Trade Pips, is a neat solution to embed various TradingView widgets and publishing tools right within the wordpress dashboard. 17 Since 2012 Trade Pips has helped thousands of traders with **trading tools and educational resources**. WP TradingView is one such solution to help finance websites to easily embed TradingView widgets with shortcodes, mainly the Tradingview chart. 18 19 WP TradingView plugin developed by [Trade Pips](https://tradepips.com), is a neat solution to embed various TradingView widgets and publishing tools right within the wordpress dashboard. 20 21 See example shortcodes and more details about TradingView widgets on [WP TradingView Wordpress plugin](https://tradepips.com/wp-tradingview-wordpress-plugin/) page. 22 16 23 17 24 = Five different widgets = -
wp-tradingview/trunk/tradingview.php
r2532172 r2898060 1 1 <?php 2 2 /* 3 Plugin Name: WP Trading View4 Plugin URI: http ://tradepips.com5 Description: WP Trading View - Display TradingView Profile, TradingView ideas, chat widget or forex / stock charts.6 Version: 1. 63 Plugin Name: WP Tradingview 4 Plugin URI: https://tradepips.com/wp-tradingview-wordpress-plugin/ 5 Description: WP Tradingview - Display Tradingview Profile, Tradingview ideas, chat widget or forex / stock charts. 6 Version: 1.7 7 7 Author: Trade Pips 8 Author URI: http ://tradepips.com8 Author URI: https://tradepips.com 9 9 */ 10 10
Note: See TracChangeset
for help on using the changeset viewer.