'aj_stock_chart', 'description' => 'AJ 주식 차트', ); parent::__construct('aj_stock_chart', 'AJ 주식 - 차트', $widget_ops); } public $args = array( 'before_widget' => "
" ); public function widget($args, $instance){ global $table_prefix, $post; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); $charttype = !empty($instance['charttype']) ? $instance['charttype'] : "1m"; $showprice = !empty($instance['showprice']) ? $instance['showprice'] : "Y"; $title = !empty($instance['title']) ? $instance['title'] : ""; $ajsi_opt_stockcode = get_option('ajsi_opt_stockcode', ""); $ajsi_opt_refresh = get_option('ajsi_opt_refresh', "10000"); $ajsi_opt_skin = get_option('ajsi_opt_reviewskin', "basic_1"); $ajsi_opt_chart_interval = get_option('ajsi_opt_chart_interval', "1m"); $ajsi_opt_chartvolume = get_option('ajsi_opt_chartvolume', "Y"); $ajsi_opt_showchartopt = get_option('ajsi_opt_showchartopt', "Y"); $ajsi_opt_chart_main_height = get_option('ajsi_opt_chart_main_height', "240"); $ajsi_opt_chart_vol_height = get_option('ajsi_opt_chart_vol_height', "100"); $ajsi_opt_chart_down_color = get_option('ajsi_opt_chart_down_color', "#0f9d58"); $ajsi_opt_chart_up_color = get_option('ajsi_opt_chart_up_color', "#a52714"); if(!$ajsi_opt_stockcode){ echo "NOT REGISTER CODE"; return; } $rndKey = rand(1000, 9999); wp_enqueue_script('googlechart', esc_url_raw('https://www.gstatic.com/charts/loader.js'), array(), null ); wp_enqueue_script('googlejsapi', esc_url_raw('https://www.google.com/jsapi'), array(), null ); wp_enqueue_script('ajsi_stockinfo_chart_js', AJSI_S3_AJ_VIEW_CHART_JS, array('jquery'), '1.0', true ); wp_localize_script('ajsi_stockinfo_chart_js', 'chartinfo', array( 'ajax_url' => admin_url('admin-ajax.php'), 'code' => $ajsi_opt_stockcode, 'rndkey' => $rndKey, 'interval' => $charttype, 'showprice' => $showprice, 'refresh_interval' => $ajsi_opt_refresh, 'iswidget' => "Y", 'usevolume' => "N", 'showopt' => $ajsi_opt_showchartopt, 'colorup' => $ajsi_opt_chart_up_color, 'colordown' => $ajsi_opt_chart_down_color, 'mh' => $ajsi_opt_chart_main_height, 'vh' => $ajsi_opt_chart_vol_height, )); include(AJSI_PLUGIN_PATH."views/skins/".$ajsi_opt_skin."/widget_html.php"); $charthtml = str_replace("[RND]", $rndKey, $charthtml); echo $args['before_widget']; if (!empty( $instance['title'])) { echo "