Pz-LinkCard - Version 1.7.0

Version Description

  • Added: Added setting. In the case of domain names, to ignore the trailing-slash.
  • Added: Added border `Wheat'.

  • Thanks @toru1231

  • Thanks @fumieblog

Download this release

Release Info

Developer poporon
Plugin Icon 128x128 Pz-LinkCard
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.9 to 1.7.0

languages/pz-linkcard-ja.mo CHANGED
Binary file
languages/pz-linkcard-ja.po CHANGED
@@ -4,8 +4,8 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: Pz-LinkCard\n"
6
  "Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
7
- "POT-Creation-Date: 2016-07-12 21:54+0900\n"
8
- "PO-Revision-Date: 2016-07-12 22:20+0900\n"
9
  "Last-Translator: \n"
10
  "Language-Team: poporon\n"
11
  "Language: ja_JP\n"
@@ -112,17 +112,17 @@ msgid "URL key"
112
  msgstr "URLキー"
113
 
114
  #: ../pz-linkcard-cacheman.php:274 ../pz-linkcard-edit.php:21
115
- #: ../pz-linkcard-settings.php:461
116
  msgid "URL"
117
  msgstr "URL"
118
 
119
  #: ../pz-linkcard-cacheman.php:275 ../pz-linkcard-edit.php:33
120
- #: ../pz-linkcard-settings.php:434
121
  msgid "Title"
122
  msgstr "タイトル"
123
 
124
  #: ../pz-linkcard-cacheman.php:276 ../pz-linkcard-edit.php:37
125
- #: ../pz-linkcard-settings.php:486
126
  msgid "Excerpt"
127
  msgstr "抜粋文"
128
 
@@ -276,11 +276,11 @@ msgid "Special Format"
276
  msgstr "定型書式"
277
 
278
  #: ../pz-linkcard-settings.php:123 ../pz-linkcard-settings.php:295
279
- #: ../pz-linkcard-settings.php:329 ../pz-linkcard-settings.php:350
280
- #: ../pz-linkcard-settings.php:389 ../pz-linkcard-settings.php:554
281
- #: ../pz-linkcard-settings.php:565 ../pz-linkcard-settings.php:579
282
- #: ../pz-linkcard-settings.php:602 ../pz-linkcard-settings.php:613
283
- #: ../pz-linkcard-settings.php:627
284
  msgid "None"
285
  msgstr "なし"
286
 
@@ -366,7 +366,7 @@ msgstr ""
366
  #: ../pz-linkcard-settings.php:187 ../pz-linkcard-settings.php:201
367
  #: ../pz-linkcard-settings.php:213 ../pz-linkcard-settings.php:233
368
  #: ../pz-linkcard-settings.php:250 ../pz-linkcard-settings.php:267
369
- #: ../pz-linkcard-settings.php:519 ../pz-linkcard-settings.php:520
370
  msgid "4px"
371
  msgstr ""
372
 
@@ -381,7 +381,7 @@ msgstr ""
381
  #: ../pz-linkcard-settings.php:189 ../pz-linkcard-settings.php:203
382
  #: ../pz-linkcard-settings.php:215 ../pz-linkcard-settings.php:235
383
  #: ../pz-linkcard-settings.php:252 ../pz-linkcard-settings.php:269
384
- #: ../pz-linkcard-settings.php:441
385
  msgid "16px"
386
  msgstr ""
387
 
@@ -477,303 +477,307 @@ msgid "Hotpink"
477
  msgstr "ホット・ピンク(明るい赤)"
478
 
479
  #: ../pz-linkcard-settings.php:306
 
 
 
 
480
  msgid "Double"
481
  msgstr "二重線"
482
 
483
- #: ../pz-linkcard-settings.php:307
484
  msgid "Dotted"
485
  msgstr "点線"
486
 
487
- #: ../pz-linkcard-settings.php:313
488
  msgid "Layout"
489
  msgstr "外観設定"
490
 
491
- #: ../pz-linkcard-settings.php:316
492
  msgid "Radius"
493
  msgstr "角を丸める"
494
 
495
- #: ../pz-linkcard-settings.php:327 ../pz-linkcard-settings.php:572
496
- #: ../pz-linkcard-settings.php:620 ../pz-linkcard-settings.php:666
497
  msgid "Site information"
498
  msgstr "サイト情報"
499
 
500
- #: ../pz-linkcard-settings.php:330
501
  msgid "Top"
502
  msgstr "上側"
503
 
504
- #: ../pz-linkcard-settings.php:331
505
  msgid "Bottom"
506
  msgstr "下側"
507
 
508
- #: ../pz-linkcard-settings.php:333
509
  msgid "Use SiteName"
510
  msgstr "サイト名称を使用"
511
 
512
- #: ../pz-linkcard-settings.php:338
513
  msgid "Separator line"
514
  msgstr "区切り線"
515
 
516
- #: ../pz-linkcard-settings.php:345
517
  msgid "Display URL"
518
  msgstr "リンク先のURLを表示する"
519
 
520
- #: ../pz-linkcard-settings.php:348 ../pz-linkcard-settings.php:551
521
- #: ../pz-linkcard-settings.php:599 ../pz-linkcard-settings.php:658
522
  msgid "Thumbnail"
523
  msgstr "サムネイル"
524
 
525
- #: ../pz-linkcard-settings.php:351
526
  msgid "Right"
527
  msgstr "右側"
528
 
529
- #: ../pz-linkcard-settings.php:352
530
  msgid "Left"
531
  msgstr "左側"
532
 
533
- #: ../pz-linkcard-settings.php:355 ../pz-linkcard-settings.php:382
534
  msgid "Shadow"
535
  msgstr "影を付ける"
536
 
537
- #: ../pz-linkcard-settings.php:357
538
  msgid "Resize"
539
  msgstr "幅に合わせて縮小"
540
 
541
- #: ../pz-linkcard-settings.php:362
542
  msgid "Hollow content area"
543
  msgstr "記事の情報に枠を付ける"
544
 
545
- #: ../pz-linkcard-settings.php:367
546
  msgid "Display excerpt"
547
  msgstr "抜粋文を表示する"
548
 
549
- #: ../pz-linkcard-settings.php:372
550
  msgid "Hollow"
551
  msgstr "内側に影を付ける"
552
 
553
- #: ../pz-linkcard-settings.php:386
554
  msgid "Display SNS Count"
555
  msgstr "シェア数を表示する"
556
 
557
- #: ../pz-linkcard-settings.php:390
558
  msgid "After Title"
559
  msgstr "タイトルの後ろ"
560
 
561
- #: ../pz-linkcard-settings.php:391
562
  msgid "After site-name"
563
  msgstr "サイト情報の後ろ"
564
 
565
- #: ../pz-linkcard-settings.php:393
566
  msgid "Twitter"
567
  msgstr "ツイッター"
568
 
569
- #: ../pz-linkcard-settings.php:394
570
  msgid "Facebook"
571
  msgstr "フェイスブック(シェア数)"
572
 
573
- #: ../pz-linkcard-settings.php:395
574
  msgid "Hatena"
575
  msgstr "はてなブックマーク"
576
 
577
- #: ../pz-linkcard-settings.php:396
578
  msgid ""
579
  "There is a possibility that the screen display is slow If you enable this "
580
  "setting."
581
  msgstr "有効にする取得APIによっては表示が遅くなる場合があります。"
582
 
583
- #: ../pz-linkcard-settings.php:402
584
  msgid "Letters"
585
  msgstr "文字設定"
586
 
587
- #: ../pz-linkcard-settings.php:405
588
  msgid "Site-info."
589
  msgstr "サイト情報"
590
 
591
- #: ../pz-linkcard-settings.php:407 ../pz-linkcard-settings.php:430
592
- #: ../pz-linkcard-settings.php:436 ../pz-linkcard-settings.php:457
593
- #: ../pz-linkcard-settings.php:463 ../pz-linkcard-settings.php:482
594
- #: ../pz-linkcard-settings.php:488 ../pz-linkcard-settings.php:509
595
- #: ../pz-linkcard-settings.php:515
596
  msgid "Color"
597
  msgstr "色"
598
 
599
- #: ../pz-linkcard-settings.php:410 ../pz-linkcard-settings.php:439
600
- #: ../pz-linkcard-settings.php:466 ../pz-linkcard-settings.php:491
601
- #: ../pz-linkcard-settings.php:518
602
  msgid "Size"
603
  msgstr "大きさ"
604
 
605
- #: ../pz-linkcard-settings.php:411 ../pz-linkcard-settings.php:467
606
- #: ../pz-linkcard-settings.php:492 ../pz-linkcard-settings.php:521
607
  msgid "9px"
608
  msgstr ""
609
 
610
- #: ../pz-linkcard-settings.php:412 ../pz-linkcard-settings.php:493
611
  msgid "11px"
612
  msgstr ""
613
 
614
- #: ../pz-linkcard-settings.php:413 ../pz-linkcard-settings.php:468
615
- #: ../pz-linkcard-settings.php:494
616
  msgid "12px"
617
  msgstr ""
618
 
619
- #: ../pz-linkcard-settings.php:414
620
  msgid "13px"
621
  msgstr ""
622
 
623
- #: ../pz-linkcard-settings.php:415 ../pz-linkcard-settings.php:440
624
- #: ../pz-linkcard-settings.php:469 ../pz-linkcard-settings.php:495
625
  msgid "14px"
626
  msgstr ""
627
 
628
- #: ../pz-linkcard-settings.php:416 ../pz-linkcard-settings.php:522
629
  msgid "60%"
630
  msgstr ""
631
 
632
- #: ../pz-linkcard-settings.php:417 ../pz-linkcard-settings.php:470
633
- #: ../pz-linkcard-settings.php:496
634
- msgid "70%"
635
- msgstr ""
636
-
637
  #: ../pz-linkcard-settings.php:418 ../pz-linkcard-settings.php:471
638
  #: ../pz-linkcard-settings.php:497
639
- msgid "80%"
640
  msgstr ""
641
 
642
  #: ../pz-linkcard-settings.php:419 ../pz-linkcard-settings.php:472
643
  #: ../pz-linkcard-settings.php:498
 
 
 
 
 
644
  msgid "90%"
645
  msgstr ""
646
 
647
- #: ../pz-linkcard-settings.php:420 ../pz-linkcard-settings.php:445
648
- #: ../pz-linkcard-settings.php:473 ../pz-linkcard-settings.php:499
649
  msgid "100%"
650
  msgstr ""
651
 
652
- #: ../pz-linkcard-settings.php:424 ../pz-linkcard-settings.php:451
653
- #: ../pz-linkcard-settings.php:503
654
  msgid "Length"
655
  msgstr "桁数"
656
 
657
- #: ../pz-linkcard-settings.php:427 ../pz-linkcard-settings.php:454
658
- #: ../pz-linkcard-settings.php:479 ../pz-linkcard-settings.php:506
659
  msgid "Outline"
660
  msgstr "縁取り"
661
 
662
- #: ../pz-linkcard-settings.php:442
663
  msgid "18px"
664
  msgstr ""
665
 
666
- #: ../pz-linkcard-settings.php:443
667
  msgid "20px"
668
  msgstr ""
669
 
670
- #: ../pz-linkcard-settings.php:444
671
  msgid "24px"
672
  msgstr ""
673
 
674
- #: ../pz-linkcard-settings.php:446
675
  msgid "120%"
676
  msgstr ""
677
 
678
- #: ../pz-linkcard-settings.php:447
679
  msgid "140%"
680
  msgstr ""
681
 
682
- #: ../pz-linkcard-settings.php:513
683
  msgid "Plugin link"
684
  msgstr "プラグインのページ"
685
 
686
- #: ../pz-linkcard-settings.php:531
687
  msgid "Plugin-link"
688
  msgstr "プラグイン名"
689
 
690
- #: ../pz-linkcard-settings.php:539
691
  msgid "External link"
692
  msgstr "外部リンク"
693
 
694
- #: ../pz-linkcard-settings.php:543 ../pz-linkcard-settings.php:591
695
- #: ../pz-linkcard-settings.php:650
696
  msgid "Background Color"
697
  msgstr "背景色"
698
 
699
- #: ../pz-linkcard-settings.php:547
700
  msgid "Background image"
701
  msgstr "背景画像"
702
 
703
- #: ../pz-linkcard-settings.php:555 ../pz-linkcard-settings.php:566
704
- #: ../pz-linkcard-settings.php:603 ../pz-linkcard-settings.php:614
705
  msgid "Direct"
706
  msgstr "直接取得する"
707
 
708
- #: ../pz-linkcard-settings.php:556 ../pz-linkcard-settings.php:567
709
- #: ../pz-linkcard-settings.php:604 ../pz-linkcard-settings.php:615
710
  msgid "Use WebAPI"
711
  msgstr "WebAPIを利用する"
712
 
713
- #: ../pz-linkcard-settings.php:557 ../pz-linkcard-settings.php:605
714
  msgid "Use WebAPI ,If can not direct"
715
  msgstr "直接取得できない場合、WebAPIを利用する"
716
 
717
- #: ../pz-linkcard-settings.php:562 ../pz-linkcard-settings.php:610
718
- #: ../pz-linkcard-settings.php:662
719
  msgid "Favicon"
720
  msgstr "サイトアイコン"
721
 
722
- #: ../pz-linkcard-settings.php:576 ../pz-linkcard-settings.php:624
723
- #: ../pz-linkcard-settings.php:670
724
  msgid "Open new window/tab"
725
  msgstr "新しいウィンドウで開く"
726
 
727
- #: ../pz-linkcard-settings.php:580 ../pz-linkcard-settings.php:628
728
  msgid "All client"
729
  msgstr "すべての端末"
730
 
731
- #: ../pz-linkcard-settings.php:581 ../pz-linkcard-settings.php:629
732
  msgid "Other than mobile"
733
  msgstr "モバイル端末以外"
734
 
735
- #: ../pz-linkcard-settings.php:588
736
  msgid "Internal link"
737
  msgstr "内部リンク"
738
 
739
- #: ../pz-linkcard-settings.php:595 ../pz-linkcard-settings.php:654
740
  msgid "Background Image"
741
  msgstr "背景画像"
742
 
743
- #: ../pz-linkcard-settings.php:634
744
  msgid "Get contents"
745
  msgstr "記事取得方法"
746
 
747
- #: ../pz-linkcard-settings.php:638
748
  msgid "Always get the latest from the content"
749
  msgstr "常に最新の記事内容から抜粋文を作成する"
750
 
751
- #: ../pz-linkcard-settings.php:639
752
  msgid "Always get the latest from the excerpt"
753
  msgstr "抜粋文が設定されている投稿はそちらを優先する"
754
 
755
- #: ../pz-linkcard-settings.php:640
756
  msgid "Initially acquired only from the content"
757
  msgstr "カード管理画面に記録されている内容から表示する"
758
 
759
- #: ../pz-linkcard-settings.php:647
760
  msgid "Same-page link"
761
  msgstr "同ページへのリンク"
762
 
763
- #: ../pz-linkcard-settings.php:659 ../pz-linkcard-settings.php:663
764
- #: ../pz-linkcard-settings.php:671
765
  msgid "It is common with setting Internal-link"
766
  msgstr "内部リンク用の設定が使用されます"
767
 
768
- #: ../pz-linkcard-settings.php:676
769
  msgid "Web-API"
770
  msgstr "画像取得APIの指定"
771
 
772
- #: ../pz-linkcard-settings.php:679
773
  msgid "Favicon API"
774
  msgstr "ファビコンの取得API"
775
 
776
- #: ../pz-linkcard-settings.php:681
777
  msgid ""
778
  "%DOMAIN% replace to domain name (ex. poporon.poponet.jp )<br>%DOMAIN_URL% "
779
  "replace to domain URL (ex. http://poporon.poponet.jp )"
@@ -782,142 +786,150 @@ msgstr ""
782
  "%DOMAIN_URL% と記述するとドメインのURL(例.http://poporon.poponet.jp)に置き"
783
  "換わります。"
784
 
785
- #: ../pz-linkcard-settings.php:684
786
  msgid "Thumbnail API"
787
  msgstr "サムネイル画像の取得API"
788
 
789
- #: ../pz-linkcard-settings.php:686
790
  msgid "%URL% replace to URL"
791
  msgstr "%URL% と記述するとURLに置き換わります"
792
 
793
- #: ../pz-linkcard-settings.php:691
794
  msgid "Debug"
795
  msgstr "詳しい人用(Debug)"
796
 
797
- #: ../pz-linkcard-settings.php:694
 
 
 
 
 
 
 
 
798
  msgid "Use blockquote tag"
799
  msgstr "BLOCKQUOTEをタグを使用する"
800
 
801
- #: ../pz-linkcard-settings.php:695
802
  msgid "without using DIV tag, and use BLOCKQUOTE tag"
803
  msgstr "&lt;BLOCKQUOTE&gt;で囲んで引用扱いにします"
804
 
805
- #: ../pz-linkcard-settings.php:698
806
  msgid "Set nofollow"
807
  msgstr "nofollowを付与する"
808
 
809
- #: ../pz-linkcard-settings.php:699
810
  msgid "In the case of an external site, it puts the \"nofollow\""
811
  msgstr "外部リンクのリンクを nofollow にする"
812
 
813
- #: ../pz-linkcard-settings.php:703
814
  msgid "Reset img style"
815
  msgstr "CSSリセット(img)"
816
 
817
- #: ../pz-linkcard-settings.php:704
818
  msgid ""
819
  "When unnecessary frame is displayed on the image, you can improve it by case"
820
  msgstr "画像がずれて表示されるときに改善される可能性が有ります(推奨)"
821
 
822
- #: ../pz-linkcard-settings.php:708
823
  msgid "specified CSS"
824
  msgstr "指定したCSSを使用"
825
 
826
- #: ../pz-linkcard-settings.php:709
827
  msgid "Use specified CSS file"
828
  msgstr "指定したCSSファイルを使用する"
829
 
830
- #: ../pz-linkcard-settings.php:712 ../pz-linkcard-settings.php:716
831
  msgid "CSS file"
832
  msgstr "CSSファイル名"
833
 
834
- #: ../pz-linkcard-settings.php:713
835
  msgid "(ex. http://exsample.com/style.css )"
836
  msgstr "例.http://exsample.com/style.css"
837
 
838
- #: ../pz-linkcard-settings.php:720
839
  msgid "CSS URL"
840
  msgstr "CSSファイルのURL"
841
 
842
- #: ../pz-linkcard-settings.php:725
843
  msgid "Class ID to be added(for PC)"
844
  msgstr "PCのときに追加するクラス名"
845
 
846
- #: ../pz-linkcard-settings.php:729
847
  msgid "Class ID to be added(for Mobile)"
848
  msgstr "モバイルのときに追加するクラス名"
849
 
850
- #: ../pz-linkcard-settings.php:734
851
  msgid "Use HatenaBlogCard"
852
  msgstr "はてなブログカードを利用する"
853
 
854
- #: ../pz-linkcard-settings.php:735
855
  msgid "External links will use Always HatenaBlogCard."
856
  msgstr "外部リンクは「はてなブログカード」を利用する"
857
 
858
- #: ../pz-linkcard-settings.php:735 ../pz-linkcard-settings.php:740
859
  msgid "(Not recommended)"
860
  msgstr "(非推奨)"
861
 
862
- #: ../pz-linkcard-settings.php:739
863
  msgid "SSL verification disabled"
864
  msgstr "SSL検証を無効"
865
 
866
- #: ../pz-linkcard-settings.php:740
867
  msgid "Try setting if the contents of the SSL site can not be acquired."
868
  msgstr ""
869
  "SSLサイトのタイトルや記事内容が取得できない場合に設定することで取得できる可能"
870
  "性があります。"
871
 
872
- #: ../pz-linkcard-settings.php:744
873
  msgid "Broken link checker"
874
  msgstr "リンク切れチェック"
875
 
876
- #: ../pz-linkcard-settings.php:745
877
  msgid "Alive confirmation of the link destination."
878
  msgstr "リンク先がアクセスできるか定期的に確認します。"
879
 
880
- #: ../pz-linkcard-settings.php:749
881
  msgid "Display link to author page"
882
  msgstr "プラグイン名を表示する"
883
 
884
- #: ../pz-linkcard-settings.php:753
885
  msgid "Plugin URL"
886
  msgstr "プラグインページURL"
887
 
888
- #: ../pz-linkcard-settings.php:757
889
  msgid "Plugin name"
890
  msgstr "プラグイン名"
891
 
892
- #: ../pz-linkcard-settings.php:761
893
  msgid "Plugin version"
894
  msgstr "プラグインバージョン"
895
 
896
- #: ../pz-linkcard-settings.php:765
897
  msgid "Saved datetime"
898
  msgstr "保存した日時"
899
 
900
- #: ../pz-linkcard-settings.php:770
901
  msgid "Display elapsed time"
902
  msgstr "実行時間の表示"
903
 
904
- #: ../pz-linkcard-settings.php:771
905
  msgid "Output the elapsed time to HTML comment."
906
  msgstr "作成にかかった時間をコメントとしてHTMLへ出力する"
907
 
908
- #: ../pz-linkcard-settings.php:777
909
  msgid "Initialize"
910
  msgstr "初期化"
911
 
912
- #: ../pz-linkcard-settings.php:780
913
  msgid "Return to the initial setting"
914
  msgstr "設定を初期状態へ戻す"
915
 
916
- #: ../pz-linkcard-style.php:383
917
  msgid "Style sheet saved."
918
  msgstr "設定を元にスタイルシートを自動生成しました。"
919
 
920
- #: ../pz-linkcard-style.php:385
921
  msgid "Style sheet failed."
922
  msgstr "スタイルシートの自動生成に失敗しました。"
923
 
@@ -929,11 +941,11 @@ msgstr "Pz カード管理"
929
  msgid "Pz LinkCard"
930
  msgstr "Pz カード設定"
931
 
932
- #: ../pz-linkcard.php:1143
933
  msgid "Settings"
934
  msgstr "設定"
935
 
936
- #: ../pz-linkcard.php:1143
937
  msgid "Manage"
938
  msgstr "管理"
939
 
4
  msgstr ""
5
  "Project-Id-Version: Pz-LinkCard\n"
6
  "Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
7
+ "POT-Creation-Date: 2016-07-30 11:21+0900\n"
8
+ "PO-Revision-Date: 2016-07-30 11:22+0900\n"
9
  "Last-Translator: \n"
10
  "Language-Team: poporon\n"
11
  "Language: ja_JP\n"
112
  msgstr "URLキー"
113
 
114
  #: ../pz-linkcard-cacheman.php:274 ../pz-linkcard-edit.php:21
115
+ #: ../pz-linkcard-settings.php:462
116
  msgid "URL"
117
  msgstr "URL"
118
 
119
  #: ../pz-linkcard-cacheman.php:275 ../pz-linkcard-edit.php:33
120
+ #: ../pz-linkcard-settings.php:435
121
  msgid "Title"
122
  msgstr "タイトル"
123
 
124
  #: ../pz-linkcard-cacheman.php:276 ../pz-linkcard-edit.php:37
125
+ #: ../pz-linkcard-settings.php:487
126
  msgid "Excerpt"
127
  msgstr "抜粋文"
128
 
276
  msgstr "定型書式"
277
 
278
  #: ../pz-linkcard-settings.php:123 ../pz-linkcard-settings.php:295
279
+ #: ../pz-linkcard-settings.php:330 ../pz-linkcard-settings.php:351
280
+ #: ../pz-linkcard-settings.php:390 ../pz-linkcard-settings.php:555
281
+ #: ../pz-linkcard-settings.php:566 ../pz-linkcard-settings.php:580
282
+ #: ../pz-linkcard-settings.php:603 ../pz-linkcard-settings.php:614
283
+ #: ../pz-linkcard-settings.php:628
284
  msgid "None"
285
  msgstr "なし"
286
 
366
  #: ../pz-linkcard-settings.php:187 ../pz-linkcard-settings.php:201
367
  #: ../pz-linkcard-settings.php:213 ../pz-linkcard-settings.php:233
368
  #: ../pz-linkcard-settings.php:250 ../pz-linkcard-settings.php:267
369
+ #: ../pz-linkcard-settings.php:520 ../pz-linkcard-settings.php:521
370
  msgid "4px"
371
  msgstr ""
372
 
381
  #: ../pz-linkcard-settings.php:189 ../pz-linkcard-settings.php:203
382
  #: ../pz-linkcard-settings.php:215 ../pz-linkcard-settings.php:235
383
  #: ../pz-linkcard-settings.php:252 ../pz-linkcard-settings.php:269
384
+ #: ../pz-linkcard-settings.php:442
385
  msgid "16px"
386
  msgstr ""
387
 
477
  msgstr "ホット・ピンク(明るい赤)"
478
 
479
  #: ../pz-linkcard-settings.php:306
480
+ msgid "Wheat"
481
+ msgstr "小麦色(明るい茶色)"
482
+
483
+ #: ../pz-linkcard-settings.php:307
484
  msgid "Double"
485
  msgstr "二重線"
486
 
487
+ #: ../pz-linkcard-settings.php:308
488
  msgid "Dotted"
489
  msgstr "点線"
490
 
491
+ #: ../pz-linkcard-settings.php:314
492
  msgid "Layout"
493
  msgstr "外観設定"
494
 
495
+ #: ../pz-linkcard-settings.php:317
496
  msgid "Radius"
497
  msgstr "角を丸める"
498
 
499
+ #: ../pz-linkcard-settings.php:328 ../pz-linkcard-settings.php:573
500
+ #: ../pz-linkcard-settings.php:621 ../pz-linkcard-settings.php:667
501
  msgid "Site information"
502
  msgstr "サイト情報"
503
 
504
+ #: ../pz-linkcard-settings.php:331
505
  msgid "Top"
506
  msgstr "上側"
507
 
508
+ #: ../pz-linkcard-settings.php:332
509
  msgid "Bottom"
510
  msgstr "下側"
511
 
512
+ #: ../pz-linkcard-settings.php:334
513
  msgid "Use SiteName"
514
  msgstr "サイト名称を使用"
515
 
516
+ #: ../pz-linkcard-settings.php:339
517
  msgid "Separator line"
518
  msgstr "区切り線"
519
 
520
+ #: ../pz-linkcard-settings.php:346
521
  msgid "Display URL"
522
  msgstr "リンク先のURLを表示する"
523
 
524
+ #: ../pz-linkcard-settings.php:349 ../pz-linkcard-settings.php:552
525
+ #: ../pz-linkcard-settings.php:600 ../pz-linkcard-settings.php:659
526
  msgid "Thumbnail"
527
  msgstr "サムネイル"
528
 
529
+ #: ../pz-linkcard-settings.php:352
530
  msgid "Right"
531
  msgstr "右側"
532
 
533
+ #: ../pz-linkcard-settings.php:353
534
  msgid "Left"
535
  msgstr "左側"
536
 
537
+ #: ../pz-linkcard-settings.php:356 ../pz-linkcard-settings.php:383
538
  msgid "Shadow"
539
  msgstr "影を付ける"
540
 
541
+ #: ../pz-linkcard-settings.php:358
542
  msgid "Resize"
543
  msgstr "幅に合わせて縮小"
544
 
545
+ #: ../pz-linkcard-settings.php:363
546
  msgid "Hollow content area"
547
  msgstr "記事の情報に枠を付ける"
548
 
549
+ #: ../pz-linkcard-settings.php:368
550
  msgid "Display excerpt"
551
  msgstr "抜粋文を表示する"
552
 
553
+ #: ../pz-linkcard-settings.php:373
554
  msgid "Hollow"
555
  msgstr "内側に影を付ける"
556
 
557
+ #: ../pz-linkcard-settings.php:387
558
  msgid "Display SNS Count"
559
  msgstr "シェア数を表示する"
560
 
561
+ #: ../pz-linkcard-settings.php:391
562
  msgid "After Title"
563
  msgstr "タイトルの後ろ"
564
 
565
+ #: ../pz-linkcard-settings.php:392
566
  msgid "After site-name"
567
  msgstr "サイト情報の後ろ"
568
 
569
+ #: ../pz-linkcard-settings.php:394
570
  msgid "Twitter"
571
  msgstr "ツイッター"
572
 
573
+ #: ../pz-linkcard-settings.php:395
574
  msgid "Facebook"
575
  msgstr "フェイスブック(シェア数)"
576
 
577
+ #: ../pz-linkcard-settings.php:396
578
  msgid "Hatena"
579
  msgstr "はてなブックマーク"
580
 
581
+ #: ../pz-linkcard-settings.php:397
582
  msgid ""
583
  "There is a possibility that the screen display is slow If you enable this "
584
  "setting."
585
  msgstr "有効にする取得APIによっては表示が遅くなる場合があります。"
586
 
587
+ #: ../pz-linkcard-settings.php:403
588
  msgid "Letters"
589
  msgstr "文字設定"
590
 
591
+ #: ../pz-linkcard-settings.php:406
592
  msgid "Site-info."
593
  msgstr "サイト情報"
594
 
595
+ #: ../pz-linkcard-settings.php:408 ../pz-linkcard-settings.php:431
596
+ #: ../pz-linkcard-settings.php:437 ../pz-linkcard-settings.php:458
597
+ #: ../pz-linkcard-settings.php:464 ../pz-linkcard-settings.php:483
598
+ #: ../pz-linkcard-settings.php:489 ../pz-linkcard-settings.php:510
599
+ #: ../pz-linkcard-settings.php:516
600
  msgid "Color"
601
  msgstr "色"
602
 
603
+ #: ../pz-linkcard-settings.php:411 ../pz-linkcard-settings.php:440
604
+ #: ../pz-linkcard-settings.php:467 ../pz-linkcard-settings.php:492
605
+ #: ../pz-linkcard-settings.php:519
606
  msgid "Size"
607
  msgstr "大きさ"
608
 
609
+ #: ../pz-linkcard-settings.php:412 ../pz-linkcard-settings.php:468
610
+ #: ../pz-linkcard-settings.php:493 ../pz-linkcard-settings.php:522
611
  msgid "9px"
612
  msgstr ""
613
 
614
+ #: ../pz-linkcard-settings.php:413 ../pz-linkcard-settings.php:494
615
  msgid "11px"
616
  msgstr ""
617
 
618
+ #: ../pz-linkcard-settings.php:414 ../pz-linkcard-settings.php:469
619
+ #: ../pz-linkcard-settings.php:495
620
  msgid "12px"
621
  msgstr ""
622
 
623
+ #: ../pz-linkcard-settings.php:415
624
  msgid "13px"
625
  msgstr ""
626
 
627
+ #: ../pz-linkcard-settings.php:416 ../pz-linkcard-settings.php:441
628
+ #: ../pz-linkcard-settings.php:470 ../pz-linkcard-settings.php:496
629
  msgid "14px"
630
  msgstr ""
631
 
632
+ #: ../pz-linkcard-settings.php:417 ../pz-linkcard-settings.php:523
633
  msgid "60%"
634
  msgstr ""
635
 
 
 
 
 
 
636
  #: ../pz-linkcard-settings.php:418 ../pz-linkcard-settings.php:471
637
  #: ../pz-linkcard-settings.php:497
638
+ msgid "70%"
639
  msgstr ""
640
 
641
  #: ../pz-linkcard-settings.php:419 ../pz-linkcard-settings.php:472
642
  #: ../pz-linkcard-settings.php:498
643
+ msgid "80%"
644
+ msgstr ""
645
+
646
+ #: ../pz-linkcard-settings.php:420 ../pz-linkcard-settings.php:473
647
+ #: ../pz-linkcard-settings.php:499
648
  msgid "90%"
649
  msgstr ""
650
 
651
+ #: ../pz-linkcard-settings.php:421 ../pz-linkcard-settings.php:446
652
+ #: ../pz-linkcard-settings.php:474 ../pz-linkcard-settings.php:500
653
  msgid "100%"
654
  msgstr ""
655
 
656
+ #: ../pz-linkcard-settings.php:425 ../pz-linkcard-settings.php:452
657
+ #: ../pz-linkcard-settings.php:504
658
  msgid "Length"
659
  msgstr "桁数"
660
 
661
+ #: ../pz-linkcard-settings.php:428 ../pz-linkcard-settings.php:455
662
+ #: ../pz-linkcard-settings.php:480 ../pz-linkcard-settings.php:507
663
  msgid "Outline"
664
  msgstr "縁取り"
665
 
666
+ #: ../pz-linkcard-settings.php:443
667
  msgid "18px"
668
  msgstr ""
669
 
670
+ #: ../pz-linkcard-settings.php:444
671
  msgid "20px"
672
  msgstr ""
673
 
674
+ #: ../pz-linkcard-settings.php:445
675
  msgid "24px"
676
  msgstr ""
677
 
678
+ #: ../pz-linkcard-settings.php:447
679
  msgid "120%"
680
  msgstr ""
681
 
682
+ #: ../pz-linkcard-settings.php:448
683
  msgid "140%"
684
  msgstr ""
685
 
686
+ #: ../pz-linkcard-settings.php:514
687
  msgid "Plugin link"
688
  msgstr "プラグインのページ"
689
 
690
+ #: ../pz-linkcard-settings.php:532
691
  msgid "Plugin-link"
692
  msgstr "プラグイン名"
693
 
694
+ #: ../pz-linkcard-settings.php:540
695
  msgid "External link"
696
  msgstr "外部リンク"
697
 
698
+ #: ../pz-linkcard-settings.php:544 ../pz-linkcard-settings.php:592
699
+ #: ../pz-linkcard-settings.php:651
700
  msgid "Background Color"
701
  msgstr "背景色"
702
 
703
+ #: ../pz-linkcard-settings.php:548
704
  msgid "Background image"
705
  msgstr "背景画像"
706
 
707
+ #: ../pz-linkcard-settings.php:556 ../pz-linkcard-settings.php:567
708
+ #: ../pz-linkcard-settings.php:604 ../pz-linkcard-settings.php:615
709
  msgid "Direct"
710
  msgstr "直接取得する"
711
 
712
+ #: ../pz-linkcard-settings.php:557 ../pz-linkcard-settings.php:568
713
+ #: ../pz-linkcard-settings.php:605 ../pz-linkcard-settings.php:616
714
  msgid "Use WebAPI"
715
  msgstr "WebAPIを利用する"
716
 
717
+ #: ../pz-linkcard-settings.php:558 ../pz-linkcard-settings.php:606
718
  msgid "Use WebAPI ,If can not direct"
719
  msgstr "直接取得できない場合、WebAPIを利用する"
720
 
721
+ #: ../pz-linkcard-settings.php:563 ../pz-linkcard-settings.php:611
722
+ #: ../pz-linkcard-settings.php:663
723
  msgid "Favicon"
724
  msgstr "サイトアイコン"
725
 
726
+ #: ../pz-linkcard-settings.php:577 ../pz-linkcard-settings.php:625
727
+ #: ../pz-linkcard-settings.php:671
728
  msgid "Open new window/tab"
729
  msgstr "新しいウィンドウで開く"
730
 
731
+ #: ../pz-linkcard-settings.php:581 ../pz-linkcard-settings.php:629
732
  msgid "All client"
733
  msgstr "すべての端末"
734
 
735
+ #: ../pz-linkcard-settings.php:582 ../pz-linkcard-settings.php:630
736
  msgid "Other than mobile"
737
  msgstr "モバイル端末以外"
738
 
739
+ #: ../pz-linkcard-settings.php:589
740
  msgid "Internal link"
741
  msgstr "内部リンク"
742
 
743
+ #: ../pz-linkcard-settings.php:596 ../pz-linkcard-settings.php:655
744
  msgid "Background Image"
745
  msgstr "背景画像"
746
 
747
+ #: ../pz-linkcard-settings.php:635
748
  msgid "Get contents"
749
  msgstr "記事取得方法"
750
 
751
+ #: ../pz-linkcard-settings.php:639
752
  msgid "Always get the latest from the content"
753
  msgstr "常に最新の記事内容から抜粋文を作成する"
754
 
755
+ #: ../pz-linkcard-settings.php:640
756
  msgid "Always get the latest from the excerpt"
757
  msgstr "抜粋文が設定されている投稿はそちらを優先する"
758
 
759
+ #: ../pz-linkcard-settings.php:641
760
  msgid "Initially acquired only from the content"
761
  msgstr "カード管理画面に記録されている内容から表示する"
762
 
763
+ #: ../pz-linkcard-settings.php:648
764
  msgid "Same-page link"
765
  msgstr "同ページへのリンク"
766
 
767
+ #: ../pz-linkcard-settings.php:660 ../pz-linkcard-settings.php:664
768
+ #: ../pz-linkcard-settings.php:672
769
  msgid "It is common with setting Internal-link"
770
  msgstr "内部リンク用の設定が使用されます"
771
 
772
+ #: ../pz-linkcard-settings.php:677
773
  msgid "Web-API"
774
  msgstr "画像取得APIの指定"
775
 
776
+ #: ../pz-linkcard-settings.php:680
777
  msgid "Favicon API"
778
  msgstr "ファビコンの取得API"
779
 
780
+ #: ../pz-linkcard-settings.php:682
781
  msgid ""
782
  "%DOMAIN% replace to domain name (ex. poporon.poponet.jp )<br>%DOMAIN_URL% "
783
  "replace to domain URL (ex. http://poporon.poponet.jp )"
786
  "%DOMAIN_URL% と記述するとドメインのURL(例.http://poporon.poponet.jp)に置き"
787
  "換わります。"
788
 
789
+ #: ../pz-linkcard-settings.php:685
790
  msgid "Thumbnail API"
791
  msgstr "サムネイル画像の取得API"
792
 
793
+ #: ../pz-linkcard-settings.php:687
794
  msgid "%URL% replace to URL"
795
  msgstr "%URL% と記述するとURLに置き換わります"
796
 
797
+ #: ../pz-linkcard-settings.php:692
798
  msgid "Debug"
799
  msgstr "詳しい人用(Debug)"
800
 
801
+ #: ../pz-linkcard-settings.php:695
802
+ msgid "Trailing slash"
803
+ msgstr "末尾のスラッシュ"
804
+
805
+ #: ../pz-linkcard-settings.php:696
806
+ msgid "In the case of domain names, to ignore the trailing-slash."
807
+ msgstr "ドメイン名のみのときに最後のスラッシュを除外する"
808
+
809
+ #: ../pz-linkcard-settings.php:699
810
  msgid "Use blockquote tag"
811
  msgstr "BLOCKQUOTEをタグを使用する"
812
 
813
+ #: ../pz-linkcard-settings.php:700
814
  msgid "without using DIV tag, and use BLOCKQUOTE tag"
815
  msgstr "&lt;BLOCKQUOTE&gt;で囲んで引用扱いにします"
816
 
817
+ #: ../pz-linkcard-settings.php:703
818
  msgid "Set nofollow"
819
  msgstr "nofollowを付与する"
820
 
821
+ #: ../pz-linkcard-settings.php:704
822
  msgid "In the case of an external site, it puts the \"nofollow\""
823
  msgstr "外部リンクのリンクを nofollow にする"
824
 
825
+ #: ../pz-linkcard-settings.php:708
826
  msgid "Reset img style"
827
  msgstr "CSSリセット(img)"
828
 
829
+ #: ../pz-linkcard-settings.php:709
830
  msgid ""
831
  "When unnecessary frame is displayed on the image, you can improve it by case"
832
  msgstr "画像がずれて表示されるときに改善される可能性が有ります(推奨)"
833
 
834
+ #: ../pz-linkcard-settings.php:713
835
  msgid "specified CSS"
836
  msgstr "指定したCSSを使用"
837
 
838
+ #: ../pz-linkcard-settings.php:714
839
  msgid "Use specified CSS file"
840
  msgstr "指定したCSSファイルを使用する"
841
 
842
+ #: ../pz-linkcard-settings.php:717 ../pz-linkcard-settings.php:721
843
  msgid "CSS file"
844
  msgstr "CSSファイル名"
845
 
846
+ #: ../pz-linkcard-settings.php:718
847
  msgid "(ex. http://exsample.com/style.css )"
848
  msgstr "例.http://exsample.com/style.css"
849
 
850
+ #: ../pz-linkcard-settings.php:725
851
  msgid "CSS URL"
852
  msgstr "CSSファイルのURL"
853
 
854
+ #: ../pz-linkcard-settings.php:730
855
  msgid "Class ID to be added(for PC)"
856
  msgstr "PCのときに追加するクラス名"
857
 
858
+ #: ../pz-linkcard-settings.php:734
859
  msgid "Class ID to be added(for Mobile)"
860
  msgstr "モバイルのときに追加するクラス名"
861
 
862
+ #: ../pz-linkcard-settings.php:739
863
  msgid "Use HatenaBlogCard"
864
  msgstr "はてなブログカードを利用する"
865
 
866
+ #: ../pz-linkcard-settings.php:740
867
  msgid "External links will use Always HatenaBlogCard."
868
  msgstr "外部リンクは「はてなブログカード」を利用する"
869
 
870
+ #: ../pz-linkcard-settings.php:740 ../pz-linkcard-settings.php:745
871
  msgid "(Not recommended)"
872
  msgstr "(非推奨)"
873
 
874
+ #: ../pz-linkcard-settings.php:744
875
  msgid "SSL verification disabled"
876
  msgstr "SSL検証を無効"
877
 
878
+ #: ../pz-linkcard-settings.php:745
879
  msgid "Try setting if the contents of the SSL site can not be acquired."
880
  msgstr ""
881
  "SSLサイトのタイトルや記事内容が取得できない場合に設定することで取得できる可能"
882
  "性があります。"
883
 
884
+ #: ../pz-linkcard-settings.php:749
885
  msgid "Broken link checker"
886
  msgstr "リンク切れチェック"
887
 
888
+ #: ../pz-linkcard-settings.php:750
889
  msgid "Alive confirmation of the link destination."
890
  msgstr "リンク先がアクセスできるか定期的に確認します。"
891
 
892
+ #: ../pz-linkcard-settings.php:754
893
  msgid "Display link to author page"
894
  msgstr "プラグイン名を表示する"
895
 
896
+ #: ../pz-linkcard-settings.php:758
897
  msgid "Plugin URL"
898
  msgstr "プラグインページURL"
899
 
900
+ #: ../pz-linkcard-settings.php:762
901
  msgid "Plugin name"
902
  msgstr "プラグイン名"
903
 
904
+ #: ../pz-linkcard-settings.php:766
905
  msgid "Plugin version"
906
  msgstr "プラグインバージョン"
907
 
908
+ #: ../pz-linkcard-settings.php:770
909
  msgid "Saved datetime"
910
  msgstr "保存した日時"
911
 
912
+ #: ../pz-linkcard-settings.php:775
913
  msgid "Display elapsed time"
914
  msgstr "実行時間の表示"
915
 
916
+ #: ../pz-linkcard-settings.php:776
917
  msgid "Output the elapsed time to HTML comment."
918
  msgstr "作成にかかった時間をコメントとしてHTMLへ出力する"
919
 
920
+ #: ../pz-linkcard-settings.php:782
921
  msgid "Initialize"
922
  msgstr "初期化"
923
 
924
+ #: ../pz-linkcard-settings.php:785
925
  msgid "Return to the initial setting"
926
  msgstr "設定を初期状態へ戻す"
927
 
928
+ #: ../pz-linkcard-style.php:386
929
  msgid "Style sheet saved."
930
  msgstr "設定を元にスタイルシートを自動生成しました。"
931
 
932
+ #: ../pz-linkcard-style.php:388
933
  msgid "Style sheet failed."
934
  msgstr "スタイルシートの自動生成に失敗しました。"
935
 
941
  msgid "Pz LinkCard"
942
  msgstr "Pz カード設定"
943
 
944
+ #: ../pz-linkcard.php:1153
945
  msgid "Settings"
946
  msgstr "設定"
947
 
948
+ #: ../pz-linkcard.php:1153
949
  msgid "Manage"
950
  msgstr "管理"
951
 
pz-linkcard-cacheman.php CHANGED
@@ -1,382 +1,382 @@
1
- <?php
2
- if (!function_exists('get_option')) die;
3
- if (!is_user_logged_in()) die;
4
-
5
- echo '<div class="wrap">';
6
- echo '<h1>'.__('LinkCard cache manager', $this->text_domain).'</h1>';
7
-
8
- // echo '<pre>';
9
- // print_r($_REQUEST);
10
- // echo '</pre>';
11
-
12
- $update = isset($_REQUEST['update'] ) ? $_REQUEST['update'] : null;
13
- $cancel = isset($_REQUEST['cancel'] ) ? $_REQUEST['cancel'] : null;
14
- $data = null;
15
- if ($update || $cancel) {
16
- if ($update) {
17
- $action = 'update';
18
- if (isset($_REQUEST['data']) && is_array($_REQUEST['data'])) {
19
- $data = $_REQUEST['data'];
20
- }
21
- } else {
22
- $action = null;
23
- }
24
- // $refine = null;
25
- $bulk_id = null;
26
- } else {
27
- $action = isset($_REQUEST['action'] ) ? $_REQUEST['action'] : null;
28
- // $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
29
- $bulk_id = isset($_REQUEST['id'] ) ? $_REQUEST['id'] : null;
30
- }
31
- $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
32
- $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
33
- $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
34
- $orderby_now = isset($_REQUEST['orderby_now'] ) ? $_REQUEST['orderby_now'] : null;
35
- $order_now = isset($_REQUEST['order_now'] ) ? $_REQUEST['order_now'] : null;
36
- $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
37
- $cache_id = isset($_REQUEST['cache_id'] ) ? $_REQUEST['cache_id'] : null;
38
- $confirm = isset($_REQUEST['confirm'] ) ? $_REQUEST['confirm'] : null;
39
- $result_code = isset($_REQUEST['result_code'] ) ? $_REQUEST['result_code'] : null;
40
- $paged = (isset($_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1) - 0;
41
-
42
-
43
- global $wpdb;
44
-
45
- if (isset($action)) {
46
- check_admin_referer('pz_cacheman');
47
-
48
- switch ($action) {
49
- case 'edit':
50
- if (isset($bulk_id) && is_array($bulk_id)) {
51
- $data = $this->pz_GetCache(array('id' => $bulk_id[0]));
52
- if (isset($data) && is_array($data)) {
53
- require_once ('pz-linkcard-edit.php');
54
- }
55
- }
56
- break;
57
- case 'update':
58
- if (isset($data) && is_array($data) && isset($data['id'])) {
59
- $data['title'] = stripslashes($data['title']);
60
- $data['excerpt'] = stripslashes($data['excerpt']);
61
- $data['site_name'] = stripslashes($data['site_name']);
62
- $data = $this->pz_SetCache($data);
63
- if (isset($data) && is_array($data) && isset($data['id'])) {
64
- echo '<div class="updated fade"><p><strong>'.__('Updated cache', $this->text_domain).'</strong></p></div>';
65
- } else {
66
- echo '<div class="error fade"><p><strong>'.__('Update failed', $this->text_domain).'</strong></p></div>';
67
- }
68
- } else {
69
- echo '<div class="error fade"><p><strong>'.__('Update failed', $this->text_domain).'</strong></p></div>';
70
- }
71
- break;
72
- case 'renew_sns':
73
- if (isset($bulk_id) && is_array($bulk_id)) {
74
- echo '<div class="updated fade"><p><strong>'.__('Social count renew', $this->text_domain).'...';
75
- foreach ($bulk_id as $data_id) {
76
- $data = $this->pz_GetCache(array('id' => $data_id));
77
- if (isset($data) && is_array($data)) {
78
- $data['nexttime'] = 0;
79
- $data = $this->pz_SetCache($data);
80
- $data = $this->pz_RenewSNSCount($data);
81
- }
82
- echo '..';
83
- }
84
- echo __('completed', $this->text_domain).'</strong></p></div>';
85
- }
86
- break;
87
- case 'renew':
88
- if (isset($bulk_id) && is_array($bulk_id)) {
89
- echo '<div class="updated fade"><p><strong>'.__('Cache renew', $this->text_domain).'...';
90
- foreach ($bulk_id as $data_id) {
91
- $data = $this->pz_GetCache(array('id' => $data_id));
92
- if (isset($data) && is_array($data)) {
93
- $this->pz_getHTML(array('url' => $data['url'], 'force' => true));
94
- }
95
- echo '..';
96
- }
97
- echo __('completed', $this->text_domain).'</strong></p></div>';
98
- }
99
- break;
100
- case 'delete':
101
- if (isset($bulk_id) && is_array($bulk_id)) {
102
- foreach ($bulk_id as $data_id) {
103
- $this->pz_DelCache(array('id' => $data_id) );
104
- }
105
- echo '<div class="updated fade"><p><strong>'.__('Cache deleted', $this->text_domain).'</strong></p></div>';
106
- }
107
- break;
108
- }
109
- }
110
-
111
- $orderby = strtolower($orderby); // 気持ち程度のインジェクション対策
112
- switch ($orderby) {
113
- case 'id':
114
- case 'url':
115
- case 'url_key':
116
- case 'link_type':
117
- case 'site_name':
118
- case 'domain':
119
- case 'charset':
120
- case 'title':
121
- case 'excerpt':
122
- case 'result_code':
123
- case 'post_id':
124
- case 'sns_twitter':
125
- case 'sns_facebook':
126
- case 'sns_hatena':
127
- case 'regist':
128
- case 'nexttime':
129
- break;
130
- default:
131
- $orderby = 'regist';
132
- $order = 'DESC';
133
- }
134
-
135
- $order = strtoupper($order);
136
- if ($order != 'ASC' && $orderby == $orderby_now) {
137
- $order = 'DESC';
138
- }
139
-
140
- // 抽出条件
141
- $where = null;
142
- $link_type = strtolower($link_type);
143
- switch ($link_type) {
144
- case 'internal':
145
- $where = 'link_type<>0';
146
- break;
147
- case 'external':
148
- $where = 'link_type=0';
149
- break;
150
- default:
151
- $link_type = 'all';
152
- }
153
- if (isset($refine) && $refine) {
154
- if ($where) {
155
- $where .= " AND domain='$refine'";
156
- } else {
157
- $where .= " domain='$refine'";
158
- }
159
- }
160
-
161
- // 検索SQL作成
162
- $sql = "SELECT * FROM $this->db_name";
163
- if (isset($where) && $where) {
164
- $sql .= " WHERE $where";
165
- }
166
- if (isset($orderby) && $orderby) {
167
- $sql .= " ORDER BY $orderby $order";
168
- }
169
- if (strpos($sql, '--') || strpos($sql, 'UPDATE') || strpos($sql, 'UNION') ) { // 気持ち程度のインジェクション対策
170
- die;
171
- }
172
- $data_all = $wpdb->get_results($sql); // テーブルデータ
173
- $count_now = count($data_all);
174
-
175
- // ページ数
176
- $page_min = ($count_now > 0) ? 1 : 0;
177
- $page_max = ceil($count_now / 10);
178
- $page_now = ($paged < $page_min) ? $page_min : (($paged > $page_max) ? $page_max : $paged);
179
- $page_prev = ($page_now > 1) ? $page_now - 1 : null;
180
- $page_next = ($page_now < $page_max) ? $page_now + 1 : null;
181
-
182
- $page_top = ($page_now < 1) ? 0 : (($page_now - 1) * 10); // 0 origin
183
- $page_limit = isset($page_limit) ? intval($page_limit) : 10 ;
184
-
185
- // 表示用データ
186
- if (isset($page_limit)) {
187
- $page_top = intval($page_top);
188
- $page_limit = intval($page_limit);
189
- $sql .= ' LIMIT '.$page_top.' , '.$page_limit;
190
- }
191
- $data_all = $wpdb->get_results($sql); // テーブルデータ
192
-
193
- // ドメイン一覧作成
194
- $sql = "SELECT domain, site_name, count(*) as count FROM $this->db_name GROUP BY domain ASC";
195
- if (strpos($sql, '--') || strpos($sql, 'UPDATE') || strpos($sql, 'UNION') ) { // 気持ち程度のインジェクション対策
196
- die;
197
- }
198
- $domain_list = $wpdb->get_results($sql); // テーブルデータ
199
-
200
- // SUB(CASE WHEN ... END) で一気に取れないぽい?
201
- $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name");
202
- $count_all = $result->count;
203
- $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name WHERE link_type<>0");
204
- $count_internal = $result->count;
205
- $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name WHERE link_type=0");
206
- $count_external = $result->count;
207
-
208
- ?>
209
-
210
- <ul class='subsubsub'>
211
- <li class="all"><a href="?page=pz-linkcard-cache&link_type=all&orderby=regist&order=desc" <?php if ($link_type == 'all') echo 'class="current"'; ?>><?php _e('All', $this->text_domain); ?> <span class="count">(<?php echo $count_all; ?>)</span></a> |</li>
212
- <li class="all"><a href="?page=pz-linkcard-cache&link_type=internal&orderby=regist&order=desc" <?php if ($link_type == 'internal') echo 'class="current"'; ?>><?php _e('Internal', $this->text_domain); ?> <span class="count">(<?php echo $count_internal; ?>)</span></a> |</li>
213
- <li class="all"><a href="?page=pz-linkcard-cache&link_type=external&orderby=regist&order=desc" <?php if ($link_type == 'external') echo 'class="current"'; ?>><?php _e('External', $this->text_domain); ?> <span class="count">(<?php echo $count_external; ?>)</span></a></li>
214
- </ul>
215
-
216
- <form id="posts-filter" action="" method="post">
217
- <?php wp_nonce_field('pz_cacheman'); ?>
218
- <input type="hidden" name="page" value="pz-linkcard-cache">
219
- <input type="hidden" name="paged" value="<?php echo $page_now; ?>">
220
-
221
- <div class="tablenav top">
222
- <div class="alignleft actions bulkactions">
223
- <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select batch', $this->text_domain); ?></label>
224
- <select name="action" id="bulk-action-selector-top">
225
- <option value="-1" selected="selected"><?php _e('Select', $this->text_domain); ?></option>
226
- <option value="renew"><?php _e('Renew cache', $this->text_domain); ?></option>
227
- <option value="renew_sns"><?php _e('Renew SNS count', $this->text_domain); ?></option>
228
- <option value="delete"><?php _e('Delete from cache', $this->text_domain); ?></option>
229
- </select>
230
- <input type="submit" id="doaction" class="button action" value="<?php _e('Submit', $this->text_domain); ?>" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');" />
231
- </div>
232
-
233
- <div class="alignleft actions bulkactions">
234
- <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select domain', $this->text_domain); ?></label>
235
- <select name="refine" id="bulk-action-selector-top">
236
- <option value="" selected="selected"><?php _e('All domain', $this->text_domain); ?></option>
237
- <?php
238
- $i = 0;
239
- foreach ($domain_list as $rec) {
240
- $i++;
241
- echo '<option value="'.$rec->domain.'"';
242
- if ($rec->domain == $refine) {
243
- echo 'selected="selecter"';
244
- }
245
- echo '>'.$rec->domain.' ('.$rec->count.')</option>';
246
- }
247
- ?>
248
- </select>
249
- <input type="submit" id="doaction" class="button action" value="<?php _e('Refine search', $this->text_domain); ?>" />
250
- </div>
251
-
252
- <?php // ページング
253
- echo '<div class="tablenav-pages">';
254
- echo ' <span class="displaying-num">'.$count_all.__('items').'</span>';
255
- echo ' <span class="pagination-links">';
256
- echo_PageButton($page_min, $paged, '&laquo;', 'first-page');
257
- echo_PageButton($page_prev, $paged, '&lsaquo;', 'prev-page');
258
- echo ' <span class="paging-input"><label for="current-page-selector" class="screen-reader-text"></label><input class="current-page" id="current-page-selector" type="text" name="paged" value="'.$page_now.'" size="2" aria-describedby="table-paging" /> / <span class="total-pages">'.$page_max.'</span></span>';
259
- echo_PageButton($page_next, $paged, '&rsaquo;', 'first-page');
260
- echo_PageButton($page_max, $paged, '&raquo;', 'last-page');
261
- echo ' </span>';
262
- echo '</div>';
263
- ?>
264
- <br class="clear">
265
- </div>
266
-
267
- <div id="settings" style="clear:both;">
268
- <table name="cachelist" class="wp-list-table widefat fixed striped posts">
269
- <thead>
270
- <tr>
271
- <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select all', $this->text_domain); ?></label><input id="cb-select-all-1" type="checkbox" /></td>
272
- <th class="id" style="width: 3em;"><?php echo_THC('id', __('ID', $this->text_domain) ); ?></th>
273
- <th class="url_key" style="width: 9em; display: none;"><?php echo_THC('url_key', __('URL key', $this->text_domain) ); ?></th>
274
- <th class="url" style="min-width: 10em;"><?php echo_THC('url', __('URL', $this->text_domain) ); ?></th>
275
- <th class="title" style="min-width: 10em;"><?php echo_THC('title', __('Title', $this->text_domain) ); ?></th>
276
- <th class="excerpt" style="min-width: 20em;"><?php echo_THC('excerpt', __('Excerpt', $this->text_domain) ); ?></th>
277
- <th class="charset" style="width: 4em;"><?php echo_THC('charset', __('Charset', $this->text_domain) ); ?></th>
278
- <th class="domain" style="min-width: 6em;"><?php echo_THC('domain', __('Domain', $this->text_domain) ); ?></th>
279
- <th class="tw" style="width: 2em;"><?php echo_THC('sns_twitter', __('Tw', $this->text_domain) ); ?></th>
280
- <th class="fb" style="width: 2em;"><?php echo_THC('sns_facebook', __('fb', $this->text_domain) ); ?></th>
281
- <th class="hb" style="width: 2em;"><?php echo_THC('sns_hatena', __('B!', $this->text_domain) ); ?></th>
282
- <th class="regist" style="width: 5em;"><?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
283
- <th class="postid" style="width: 3em;"><?php echo_THC('post_id', __('Post ID', $this->text_domain) ); ?></th>
284
- <th class="result" style="width: 2em;"><?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?></th>
285
- </tr>
286
- </thead>
287
- <tbody>
288
- <?php
289
- foreach ($data_all as $data) {
290
- echo '<tr>';
291
- // echo '<td colspan=12">'.Pz_LinkCard::pz_getHTML(array('url' => $data->url)).'</td>';
292
-
293
- $data_id = $data->id;
294
- echo ' <th scope="row" class="check-column">';
295
- echo ' <label class="screen-reader-text" for="cb-select-'.$data_id.'">'.__('Select', $this->text_domain).'</label>';
296
- echo ' <input id="cb-select-'.$data_id.'" type="checkbox" name="id[]" value="'.$data_id.'" />';
297
- echo ' <div class="locked-indicator"></div>';
298
- echo ' </th>';
299
-
300
- echo ' <td>'.$data_id.'</td>';
301
- echo ' <td style="display: none;">'.bin2hex($data->url_key).'</td>';
302
-
303
- $url = esc_url($data->url);
304
- $title = htmlentities($data->title);
305
- echo ' <td colspan="2">';
306
- echo ' <div style="word-break: break-all; font-size: 60%;">';
307
- if ($data->link_type) {
308
- echo '<a href="'.$url.'">'.$url.'</a>';
309
- } else {
310
- echo $url;
311
- }
312
- echo '</div><div>'.$title.'</div>';
313
- echo ' <div id="inline_'.$data_id.'"style="font-size: 90%;">';
314
- echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=edit&id[0]='.$data_id, 'pz_cacheman').'">'.__('edit',$this->text_domain).'</a> | ';
315
- echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=renew&id[0]='.$data_id, 'pz_cacheman').'" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');">'.__('renew',$this->text_domain).'</a> | ';
316
- echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=delete&id[0]='.$data_id, 'pz_cacheman').'" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');">'.__('delete',$this->text_domain).'</a>';
317
- echo '</div>';
318
- echo ' </td>';
319
-
320
- $excerpt= htmlentities(mb_strimwidth(html_entity_decode($data->excerpt), 0, 100, '...'));
321
- echo ' <td>'.$excerpt.'</td>';
322
- echo ' <td>'.$data->charset.'</td>';
323
-
324
- echo ' <td><div title="'.$data->domain.'">'.$data->domain.'</div><div><span style="background-color: #888; color: #fff; font-size: 9px;">'.$data->site_name.'</span></div></td>';
325
- // echo ' <td><img src="'.$data->thumbnail.'" style="max-height: 100px; max-width: 100px;"></td>';
326
- // echo ' <td style="word-break: break-all;">'.$data->thumbnail.'</td>';
327
- // echo ' <td></td>';
328
- // echo ' <td><img src="'.$data->favicon.'" style="max-height: 100px; max-width: 100px;"></td>';
329
- // echo ' <td style="word-break: break-all;">'.$data->favicon.'</td>';
330
- // echo ' <td></td>';
331
- $sns_count = $data->sns_twitter;
332
- echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
333
- $sns_count = $data->sns_facebook;
334
- echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
335
- $sns_count = $data->sns_hatena;
336
- echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
337
-
338
- echo ' <td>'.$data->regist.'</td>';
339
- echo ' <td style="word-break: break-all;"><a href="'.get_permalink($data->post_id).'" target="_blank" title="'.get_the_title($data->post_id).'">'.$data->post_id.'</td>';
340
- echo ' <td>'.$data->result_code.'</td>';
341
- echo '</tr>';
342
- }
343
-
344
- ?>
345
- </tbody>
346
- </table>
347
- </div>
348
- </div>
349
-
350
- <?php
351
- function echo_PageButton($page_link, $page_now, $text, $class_name) {
352
- $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
353
- $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
354
- $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
355
-
356
- if ($page_link != $page_now && !is_null($page_link)) {
357
- echo '<a class="'.$class_name.'" href="?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_link.'">'.$text.'</a>';
358
- } else {
359
- echo '<span class="tablenav-pages-navspan">'.$text.'</span>';
360
- }
361
- }
362
-
363
- function echo_THC($item, $text) {
364
- $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
365
- $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
366
- $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
367
- $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
368
-
369
- if ($item == $orderby) {
370
- if ($order == 'DESC') {
371
- $mark = '▼';
372
- $order = 'ASC';
373
- } else {
374
- $mark = '▲';
375
- $order = 'DESC';
376
- }
377
- } else {
378
- $mark = '';
379
- $order = 'DESC';
380
- }
381
- echo '<a href="?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$item.'&order='.$order.'&refine='.$refine.'">'.$text.$mark.'</a>';
382
- }
1
+ <?php
2
+ if (!function_exists('get_option')) die;
3
+ if (!is_user_logged_in()) die;
4
+
5
+ echo '<div class="wrap">';
6
+ echo '<h1>'.__('LinkCard cache manager', $this->text_domain).'</h1>';
7
+
8
+ // echo '<pre>';
9
+ // print_r($_REQUEST);
10
+ // echo '</pre>';
11
+
12
+ $update = isset($_REQUEST['update'] ) ? $_REQUEST['update'] : null;
13
+ $cancel = isset($_REQUEST['cancel'] ) ? $_REQUEST['cancel'] : null;
14
+ $data = null;
15
+ if ($update || $cancel) {
16
+ if ($update) {
17
+ $action = 'update';
18
+ if (isset($_REQUEST['data']) && is_array($_REQUEST['data'])) {
19
+ $data = $_REQUEST['data'];
20
+ }
21
+ } else {
22
+ $action = null;
23
+ }
24
+ // $refine = null;
25
+ $bulk_id = null;
26
+ } else {
27
+ $action = isset($_REQUEST['action'] ) ? $_REQUEST['action'] : null;
28
+ // $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
29
+ $bulk_id = isset($_REQUEST['id'] ) ? $_REQUEST['id'] : null;
30
+ }
31
+ $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
32
+ $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
33
+ $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
34
+ $orderby_now = isset($_REQUEST['orderby_now'] ) ? $_REQUEST['orderby_now'] : null;
35
+ $order_now = isset($_REQUEST['order_now'] ) ? $_REQUEST['order_now'] : null;
36
+ $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
37
+ $cache_id = isset($_REQUEST['cache_id'] ) ? $_REQUEST['cache_id'] : null;
38
+ $confirm = isset($_REQUEST['confirm'] ) ? $_REQUEST['confirm'] : null;
39
+ $result_code = isset($_REQUEST['result_code'] ) ? $_REQUEST['result_code'] : null;
40
+ $paged = (isset($_REQUEST['paged'] ) ? $_REQUEST['paged'] : 1) - 0;
41
+
42
+
43
+ global $wpdb;
44
+
45
+ if (isset($action)) {
46
+ check_admin_referer('pz_cacheman');
47
+
48
+ switch ($action) {
49
+ case 'edit':
50
+ if (isset($bulk_id) && is_array($bulk_id)) {
51
+ $data = $this->pz_GetCache(array('id' => $bulk_id[0]));
52
+ if (isset($data) && is_array($data)) {
53
+ require_once ('pz-linkcard-edit.php');
54
+ }
55
+ }
56
+ break;
57
+ case 'update':
58
+ if (isset($data) && is_array($data) && isset($data['id'])) {
59
+ $data['title'] = stripslashes($data['title']);
60
+ $data['excerpt'] = stripslashes($data['excerpt']);
61
+ $data['site_name'] = stripslashes($data['site_name']);
62
+ $data = $this->pz_SetCache($data);
63
+ if (isset($data) && is_array($data) && isset($data['id'])) {
64
+ echo '<div class="updated fade"><p><strong>'.__('Updated cache', $this->text_domain).'</strong></p></div>';
65
+ } else {
66
+ echo '<div class="error fade"><p><strong>'.__('Update failed', $this->text_domain).'</strong></p></div>';
67
+ }
68
+ } else {
69
+ echo '<div class="error fade"><p><strong>'.__('Update failed', $this->text_domain).'</strong></p></div>';
70
+ }
71
+ break;
72
+ case 'renew_sns':
73
+ if (isset($bulk_id) && is_array($bulk_id)) {
74
+ echo '<div class="updated fade"><p><strong>'.__('Social count renew', $this->text_domain).'...';
75
+ foreach ($bulk_id as $data_id) {
76
+ $data = $this->pz_GetCache(array('id' => $data_id));
77
+ if (isset($data) && is_array($data)) {
78
+ $data['nexttime'] = 0;
79
+ $data = $this->pz_SetCache($data);
80
+ $data = $this->pz_RenewSNSCount($data);
81
+ }
82
+ echo '..';
83
+ }
84
+ echo __('completed', $this->text_domain).'</strong></p></div>';
85
+ }
86
+ break;
87
+ case 'renew':
88
+ if (isset($bulk_id) && is_array($bulk_id)) {
89
+ echo '<div class="updated fade"><p><strong>'.__('Cache renew', $this->text_domain).'...';
90
+ foreach ($bulk_id as $data_id) {
91
+ $data = $this->pz_GetCache(array('id' => $data_id));
92
+ if (isset($data) && is_array($data)) {
93
+ $this->pz_getHTML(array('url' => $data['url'], 'force' => true));
94
+ }
95
+ echo '..';
96
+ }
97
+ echo __('completed', $this->text_domain).'</strong></p></div>';
98
+ }
99
+ break;
100
+ case 'delete':
101
+ if (isset($bulk_id) && is_array($bulk_id)) {
102
+ foreach ($bulk_id as $data_id) {
103
+ $this->pz_DelCache(array('id' => $data_id) );
104
+ }
105
+ echo '<div class="updated fade"><p><strong>'.__('Cache deleted', $this->text_domain).'</strong></p></div>';
106
+ }
107
+ break;
108
+ }
109
+ }
110
+
111
+ $orderby = strtolower($orderby); // 気持ち程度のインジェクション対策
112
+ switch ($orderby) {
113
+ case 'id':
114
+ case 'url':
115
+ case 'url_key':
116
+ case 'link_type':
117
+ case 'site_name':
118
+ case 'domain':
119
+ case 'charset':
120
+ case 'title':
121
+ case 'excerpt':
122
+ case 'result_code':
123
+ case 'post_id':
124
+ case 'sns_twitter':
125
+ case 'sns_facebook':
126
+ case 'sns_hatena':
127
+ case 'regist':
128
+ case 'nexttime':
129
+ break;
130
+ default:
131
+ $orderby = 'regist';
132
+ $order = 'DESC';
133
+ }
134
+
135
+ $order = strtoupper($order);
136
+ if ($order != 'ASC' && $orderby == $orderby_now) {
137
+ $order = 'DESC';
138
+ }
139
+
140
+ // 抽出条件
141
+ $where = null;
142
+ $link_type = strtolower($link_type);
143
+ switch ($link_type) {
144
+ case 'internal':
145
+ $where = 'link_type<>0';
146
+ break;
147
+ case 'external':
148
+ $where = 'link_type=0';
149
+ break;
150
+ default:
151
+ $link_type = 'all';
152
+ }
153
+ if (isset($refine) && $refine) {
154
+ if ($where) {
155
+ $where .= " AND domain='$refine'";
156
+ } else {
157
+ $where .= " domain='$refine'";
158
+ }
159
+ }
160
+
161
+ // 検索SQL作成
162
+ $sql = "SELECT * FROM $this->db_name";
163
+ if (isset($where) && $where) {
164
+ $sql .= " WHERE $where";
165
+ }
166
+ if (isset($orderby) && $orderby) {
167
+ $sql .= " ORDER BY $orderby $order";
168
+ }
169
+ if (strpos($sql, '--') || strpos($sql, 'UPDATE') || strpos($sql, 'UNION') ) { // 気持ち程度のインジェクション対策
170
+ die;
171
+ }
172
+ $data_all = $wpdb->get_results($sql); // テーブルデータ
173
+ $count_now = count($data_all);
174
+
175
+ // ページ数
176
+ $page_min = ($count_now > 0) ? 1 : 0;
177
+ $page_max = ceil($count_now / 10);
178
+ $page_now = ($paged < $page_min) ? $page_min : (($paged > $page_max) ? $page_max : $paged);
179
+ $page_prev = ($page_now > 1) ? $page_now - 1 : null;
180
+ $page_next = ($page_now < $page_max) ? $page_now + 1 : null;
181
+
182
+ $page_top = ($page_now < 1) ? 0 : (($page_now - 1) * 10); // 0 origin
183
+ $page_limit = isset($page_limit) ? intval($page_limit) : 10 ;
184
+
185
+ // 表示用データ
186
+ if (isset($page_limit)) {
187
+ $page_top = intval($page_top);
188
+ $page_limit = intval($page_limit);
189
+ $sql .= ' LIMIT '.$page_top.' , '.$page_limit;
190
+ }
191
+ $data_all = $wpdb->get_results($sql); // テーブルデータ
192
+
193
+ // ドメイン一覧作成
194
+ $sql = "SELECT domain, site_name, count(*) as count FROM $this->db_name GROUP BY domain ASC";
195
+ if (strpos($sql, '--') || strpos($sql, 'UPDATE') || strpos($sql, 'UNION') ) { // 気持ち程度のインジェクション対策
196
+ die;
197
+ }
198
+ $domain_list = $wpdb->get_results($sql); // テーブルデータ
199
+
200
+ // SUB(CASE WHEN ... END) で一気に取れないぽい?
201
+ $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name");
202
+ $count_all = $result->count;
203
+ $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name WHERE link_type<>0");
204
+ $count_internal = $result->count;
205
+ $result = $wpdb->get_row("SELECT COUNT(*) AS count FROM $this->db_name WHERE link_type=0");
206
+ $count_external = $result->count;
207
+
208
+ ?>
209
+
210
+ <ul class='subsubsub'>
211
+ <li class="all"><a href="?page=pz-linkcard-cache&link_type=all&orderby=regist&order=desc" <?php if ($link_type == 'all') echo 'class="current"'; ?>><?php _e('All', $this->text_domain); ?> <span class="count">(<?php echo $count_all; ?>)</span></a> |</li>
212
+ <li class="all"><a href="?page=pz-linkcard-cache&link_type=internal&orderby=regist&order=desc" <?php if ($link_type == 'internal') echo 'class="current"'; ?>><?php _e('Internal', $this->text_domain); ?> <span class="count">(<?php echo $count_internal; ?>)</span></a> |</li>
213
+ <li class="all"><a href="?page=pz-linkcard-cache&link_type=external&orderby=regist&order=desc" <?php if ($link_type == 'external') echo 'class="current"'; ?>><?php _e('External', $this->text_domain); ?> <span class="count">(<?php echo $count_external; ?>)</span></a></li>
214
+ </ul>
215
+
216
+ <form id="posts-filter" action="" method="post">
217
+ <?php wp_nonce_field('pz_cacheman'); ?>
218
+ <input type="hidden" name="page" value="pz-linkcard-cache">
219
+ <input type="hidden" name="paged" value="<?php echo $page_now; ?>">
220
+
221
+ <div class="tablenav top">
222
+ <div class="alignleft actions bulkactions">
223
+ <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select batch', $this->text_domain); ?></label>
224
+ <select name="action" id="bulk-action-selector-top">
225
+ <option value="-1" selected="selected"><?php _e('Select', $this->text_domain); ?></option>
226
+ <option value="renew"><?php _e('Renew cache', $this->text_domain); ?></option>
227
+ <option value="renew_sns"><?php _e('Renew SNS count', $this->text_domain); ?></option>
228
+ <option value="delete"><?php _e('Delete from cache', $this->text_domain); ?></option>
229
+ </select>
230
+ <input type="submit" id="doaction" class="button action" value="<?php _e('Submit', $this->text_domain); ?>" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');" />
231
+ </div>
232
+
233
+ <div class="alignleft actions bulkactions">
234
+ <label for="bulk-action-selector-top" class="screen-reader-text"><?php _e('Select domain', $this->text_domain); ?></label>
235
+ <select name="refine" id="bulk-action-selector-top">
236
+ <option value="" selected="selected"><?php _e('All domain', $this->text_domain); ?></option>
237
+ <?php
238
+ $i = 0;
239
+ foreach ($domain_list as $rec) {
240
+ $i++;
241
+ echo '<option value="'.$rec->domain.'"';
242
+ if ($rec->domain == $refine) {
243
+ echo 'selected="selecter"';
244
+ }
245
+ echo '>'.$rec->domain.' ('.$rec->count.')</option>';
246
+ }
247
+ ?>
248
+ </select>
249
+ <input type="submit" id="doaction" class="button action" value="<?php _e('Refine search', $this->text_domain); ?>" />
250
+ </div>
251
+
252
+ <?php // ページング
253
+ echo '<div class="tablenav-pages">';
254
+ echo ' <span class="displaying-num">'.$count_all.__('items').'</span>';
255
+ echo ' <span class="pagination-links">';
256
+ echo_PageButton($page_min, $paged, '&laquo;', 'first-page');
257
+ echo_PageButton($page_prev, $paged, '&lsaquo;', 'prev-page');
258
+ echo ' <span class="paging-input"><label for="current-page-selector" class="screen-reader-text"></label><input class="current-page" id="current-page-selector" type="text" name="paged" value="'.$page_now.'" size="2" aria-describedby="table-paging" /> / <span class="total-pages">'.$page_max.'</span></span>';
259
+ echo_PageButton($page_next, $paged, '&rsaquo;', 'first-page');
260
+ echo_PageButton($page_max, $paged, '&raquo;', 'last-page');
261
+ echo ' </span>';
262
+ echo '</div>';
263
+ ?>
264
+ <br class="clear">
265
+ </div>
266
+
267
+ <div id="settings" style="clear:both;">
268
+ <table name="cachelist" class="wp-list-table widefat fixed striped posts">
269
+ <thead>
270
+ <tr>
271
+ <td id="cb" class="manage-column column-cb check-column"><label class="screen-reader-text" for="cb-select-all-1"><?php _e('Select all', $this->text_domain); ?></label><input id="cb-select-all-1" type="checkbox" /></td>
272
+ <th class="id" style="width: 3em;"><?php echo_THC('id', __('ID', $this->text_domain) ); ?></th>
273
+ <th class="url_key" style="width: 9em; display: none;"><?php echo_THC('url_key', __('URL key', $this->text_domain) ); ?></th>
274
+ <th class="url" style="min-width: 10em;"><?php echo_THC('url', __('URL', $this->text_domain) ); ?></th>
275
+ <th class="title" style="min-width: 10em;"><?php echo_THC('title', __('Title', $this->text_domain) ); ?></th>
276
+ <th class="excerpt" style="min-width: 20em;"><?php echo_THC('excerpt', __('Excerpt', $this->text_domain) ); ?></th>
277
+ <th class="charset" style="width: 4em;"><?php echo_THC('charset', __('Charset', $this->text_domain) ); ?></th>
278
+ <th class="domain" style="min-width: 6em;"><?php echo_THC('domain', __('Domain', $this->text_domain) ); ?></th>
279
+ <th class="tw" style="width: 2em;"><?php echo_THC('sns_twitter', __('Tw', $this->text_domain) ); ?></th>
280
+ <th class="fb" style="width: 2em;"><?php echo_THC('sns_facebook', __('fb', $this->text_domain) ); ?></th>
281
+ <th class="hb" style="width: 2em;"><?php echo_THC('sns_hatena', __('B!', $this->text_domain) ); ?></th>
282
+ <th class="regist" style="width: 5em;"><?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
283
+ <th class="postid" style="width: 3em;"><?php echo_THC('post_id', __('Post ID', $this->text_domain) ); ?></th>
284
+ <th class="result" style="width: 2em;"><?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?></th>
285
+ </tr>
286
+ </thead>
287
+ <tbody>
288
+ <?php
289
+ foreach ($data_all as $data) {
290
+ echo '<tr>';
291
+ // echo '<td colspan=12">'.Pz_LinkCard::pz_getHTML(array('url' => $data->url)).'</td>';
292
+
293
+ $data_id = $data->id;
294
+ echo ' <th scope="row" class="check-column">';
295
+ echo ' <label class="screen-reader-text" for="cb-select-'.$data_id.'">'.__('Select', $this->text_domain).'</label>';
296
+ echo ' <input id="cb-select-'.$data_id.'" type="checkbox" name="id[]" value="'.$data_id.'" />';
297
+ echo ' <div class="locked-indicator"></div>';
298
+ echo ' </th>';
299
+
300
+ echo ' <td>'.$data_id.'</td>';
301
+ echo ' <td style="display: none;">'.bin2hex($data->url_key).'</td>';
302
+
303
+ $url = esc_url($data->url);
304
+ $title = htmlentities($data->title);
305
+ echo ' <td colspan="2">';
306
+ echo ' <div style="word-break: break-all; font-size: 60%;">';
307
+ if ($data->link_type) {
308
+ echo '<a href="'.$url.'">'.$url.'</a>';
309
+ } else {
310
+ echo $url;
311
+ }
312
+ echo '</div><div>'.$title.'</div>';
313
+ echo ' <div id="inline_'.$data_id.'"style="font-size: 90%;">';
314
+ echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=edit&id[0]='.$data_id, 'pz_cacheman').'">'.__('edit',$this->text_domain).'</a> | ';
315
+ echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=renew&id[0]='.$data_id, 'pz_cacheman').'" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');">'.__('renew',$this->text_domain).'</a> | ';
316
+ echo '<a href="'.wp_nonce_url('?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_now.'&refine='.$refine.'&action=delete&id[0]='.$data_id, 'pz_cacheman').'" onclick="return confirm(\''.__('Are you sure?', $this->text_domain).'\');">'.__('delete',$this->text_domain).'</a>';
317
+ echo '</div>';
318
+ echo ' </td>';
319
+
320
+ $excerpt= htmlentities(mb_strimwidth(html_entity_decode($data->excerpt), 0, 100, '...'));
321
+ echo ' <td>'.$excerpt.'</td>';
322
+ echo ' <td>'.$data->charset.'</td>';
323
+
324
+ echo ' <td><div title="'.$data->domain.'">'.$data->domain.'</div><div><span style="background-color: #888; color: #fff; font-size: 9px;">'.$data->site_name.'</span></div></td>';
325
+ // echo ' <td><img src="'.$data->thumbnail.'" style="max-height: 100px; max-width: 100px;"></td>';
326
+ // echo ' <td style="word-break: break-all;">'.$data->thumbnail.'</td>';
327
+ // echo ' <td></td>';
328
+ // echo ' <td><img src="'.$data->favicon.'" style="max-height: 100px; max-width: 100px;"></td>';
329
+ // echo ' <td style="word-break: break-all;">'.$data->favicon.'</td>';
330
+ // echo ' <td></td>';
331
+ $sns_count = $data->sns_twitter;
332
+ echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
333
+ $sns_count = $data->sns_facebook;
334
+ echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
335
+ $sns_count = $data->sns_hatena;
336
+ echo ' <td style="font-size: 60%;">'.(($sns_count >= 0) ? $sns_count : '-').'</td>';
337
+
338
+ echo ' <td>'.$data->regist.'</td>';
339
+ echo ' <td style="word-break: break-all;"><a href="'.get_permalink($data->post_id).'" target="_blank" title="'.get_the_title($data->post_id).'">'.$data->post_id.'</td>';
340
+ echo ' <td>'.$data->result_code.'</td>';
341
+ echo '</tr>';
342
+ }
343
+
344
+ ?>
345
+ </tbody>
346
+ </table>
347
+ </div>
348
+ </div>
349
+
350
+ <?php
351
+ function echo_PageButton($page_link, $page_now, $text, $class_name) {
352
+ $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
353
+ $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
354
+ $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
355
+
356
+ if ($page_link != $page_now && !is_null($page_link)) {
357
+ echo '<a class="'.$class_name.'" href="?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$orderby.'&order='.$order.'&paged='.$page_link.'">'.$text.'</a>';
358
+ } else {
359
+ echo '<span class="tablenav-pages-navspan">'.$text.'</span>';
360
+ }
361
+ }
362
+
363
+ function echo_THC($item, $text) {
364
+ $orderby = isset($_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : null;
365
+ $order = isset($_REQUEST['order'] ) ? $_REQUEST['order'] : null;
366
+ $refine = isset($_REQUEST['refine'] ) ? $_REQUEST['refine'] : null;
367
+ $link_type = isset($_REQUEST['link_type'] ) ? $_REQUEST['link_type'] : null;
368
+
369
+ if ($item == $orderby) {
370
+ if ($order == 'DESC') {
371
+ $mark = '▼';
372
+ $order = 'ASC';
373
+ } else {
374
+ $mark = '▲';
375
+ $order = 'DESC';
376
+ }
377
+ } else {
378
+ $mark = '';
379
+ $order = 'DESC';
380
+ }
381
+ echo '<a href="?page=pz-linkcard-cache&link_type='.$link_type.'&orderby='.$item.'&order='.$order.'&refine='.$refine.'">'.$text.$mark.'</a>';
382
+ }
pz-linkcard-settings.php CHANGED
@@ -303,6 +303,7 @@
303
  <option value="blu" <?php if($this->options['border'] == 'blu') echo 'selected="selected"'; ?>><?php _e('Dodgerblue', $this->text_domain); ?></option>
304
  <option value="gre" <?php if($this->options['border'] == 'gre') echo 'selected="selected"'; ?>><?php _e('Mediumaquamarine', $this->text_domain); ?></option>
305
  <option value="red" <?php if($this->options['border'] == 'red') echo 'selected="selected"'; ?>><?php _e('Hotpink', $this->text_domain); ?></option>
 
306
  <option value="dbl" <?php if($this->options['border'] == 'dbl') echo 'selected="selected"'; ?>><?php _e('Double', $this->text_domain); ?></option>
307
  <option value="dot" <?php if($this->options['border'] == 'dot') echo 'selected="selected"'; ?>><?php _e('Dotted', $this->text_domain); ?></option>
308
  </select>
@@ -690,6 +691,10 @@
690
 
691
  <h3><?php _e('Debug', $this->text_domain); ?></h3>
692
  <table class="form-table">
 
 
 
 
693
  <tr valign="top">
694
  <th scope="row"><?php _e('Use blockquote tag', $this->text_domain); ?></th>
695
  <td><label><input name="properties[blockquote]" type="checkbox" id="check" value="1" <?php checked(isset($this->options['blockquote']) ? $this->options['blockquote'] : null, 1); ?> /><?php _e('without using DIV tag, and use BLOCKQUOTE tag', $this->text_domain); ?></label></td>
303
  <option value="blu" <?php if($this->options['border'] == 'blu') echo 'selected="selected"'; ?>><?php _e('Dodgerblue', $this->text_domain); ?></option>
304
  <option value="gre" <?php if($this->options['border'] == 'gre') echo 'selected="selected"'; ?>><?php _e('Mediumaquamarine', $this->text_domain); ?></option>
305
  <option value="red" <?php if($this->options['border'] == 'red') echo 'selected="selected"'; ?>><?php _e('Hotpink', $this->text_domain); ?></option>
306
+ <option value="wht" <?php if($this->options['border'] == 'wht') echo 'selected="selected"'; ?>><?php _e('Wheat', $this->text_domain); ?></option>
307
  <option value="dbl" <?php if($this->options['border'] == 'dbl') echo 'selected="selected"'; ?>><?php _e('Double', $this->text_domain); ?></option>
308
  <option value="dot" <?php if($this->options['border'] == 'dot') echo 'selected="selected"'; ?>><?php _e('Dotted', $this->text_domain); ?></option>
309
  </select>
691
 
692
  <h3><?php _e('Debug', $this->text_domain); ?></h3>
693
  <table class="form-table">
694
+ <tr valign="top">
695
+ <th scope="row"><?php _e('Trailing slash', $this->text_domain); ?></th>
696
+ <td><label><input name="properties[trail-slash]" type="checkbox" id="check" value="1" <?php checked(isset($this->options['trail-slash']) ? $this->options['trail-slash'] : null, 1); ?> /><?php _e('In the case of domain names, to ignore the trailing-slash.', $this->text_domain); ?></label></td>
697
+ </tr>
698
  <tr valign="top">
699
  <th scope="row"><?php _e('Use blockquote tag', $this->text_domain); ?></th>
700
  <td><label><input name="properties[blockquote]" type="checkbox" id="check" value="1" <?php checked(isset($this->options['blockquote']) ? $this->options['blockquote'] : null, 1); ?> /><?php _e('without using DIV tag, and use BLOCKQUOTE tag', $this->text_domain); ?></label></td>
pz-linkcard-style.php CHANGED
@@ -341,6 +341,9 @@
341
  case 'red':
342
  $file_text = str_replace('/*BORDER*/', 'border: 4px solid #ff69b4;',$file_text );
343
  break;
 
 
 
344
  case 'dbl':
345
  $file_text = str_replace('/*BORDER*/', 'border: 4px double #444;',$file_text );
346
  break;
341
  case 'red':
342
  $file_text = str_replace('/*BORDER*/', 'border: 4px solid #ff69b4;',$file_text );
343
  break;
344
+ case 'wht': // Wheat
345
+ $file_text = str_replace('/*BORDER*/', 'border: 4px solid #f5deb3;',$file_text );
346
+ break;
347
  case 'dbl':
348
  $file_text = str_replace('/*BORDER*/', 'border: 4px double #444;',$file_text );
349
  break;
pz-linkcard.php CHANGED
@@ -1,1147 +1,1157 @@
1
- <?php
2
- /*
3
- Plugin Name: Pz-LinkCard
4
- Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
- Description: リンクをカード形式で表示します。
6
- Version: 1.6.9
7
- Author: poporon
8
- Author URI: http://poporon.poponet.jp
9
- License: GPLv2 or later
10
- */
11
-
12
- defined('ABSPATH') || die;
13
-
14
- class Pz_LinkCard {
15
- public $slug; // slug
16
- public $text_domain; // as slug
17
-
18
- public $charset;
19
-
20
- public $plugin_basename;
21
- public $plugin_dir_path;
22
- public $plugin_dir_url;
23
- public $plugin_link; // link to plugin page
24
- private $db_name;
25
-
26
- public $options;
27
- protected $defaults = array(
28
- 'code1' => 'blogcard',
29
- 'code2' => null,
30
- 'code3' => null,
31
- 'code4' => null,
32
- 'border' => '1bk',
33
- 'width' => '500px',
34
- 'content-height' => '108px',
35
- 'margin-top' => '4px',
36
- 'margin-right' => '16px',
37
- 'margin-bottom' => '16px',
38
- 'margin-left' => '4px',
39
- 'card-top' => null,
40
- 'card-right' => null,
41
- 'card-bottom' => null,
42
- 'card-left' => null,
43
- 'centering' => null,
44
- 'radius' => null,
45
- 'shadow' => '1',
46
- 'shadow-inset' => null,
47
- 'special-format' => 'LkC',
48
- 'use-inline' => null,
49
- 'use-sitename' => '1',
50
- 'use-hatena' => null,
51
- 'display-url' => '1',
52
- 'display-excerpt' => '1',
53
- 'trim-title' => 200,
54
- 'trim-count' => 250,
55
- 'trim-sitename' => 50,
56
- 'info-position' => '1',
57
- 'separator' => null,
58
- 'size-title' => '16px',
59
- 'size-url' => '9px',
60
- 'size-excerpt' => '11px',
61
- 'size-info' => '12px',
62
- 'size-plugin' => '9px',
63
- 'color-title' => '#111111',
64
- 'color-url' => '#4466ff',
65
- 'color-excerpt' => '#333333',
66
- 'color-info' => '#222222',
67
- 'color-plugin' => '#888888',
68
- 'outline-color-title' => '#ffffff',
69
- 'outline-color-url' => '#ffffff',
70
- 'outline-color-excerpt' => '#ffffff',
71
- 'outline-color-info' => '#ffffff',
72
- 'outline-color-plugin' => '#ffffff',
73
- 'ex-bgcolor' => '#fff',
74
- 'in-bgcolor' => '#fff',
75
- 'th-bgcolor' => '#eee',
76
- 'in-get' => null,
77
- 'ex-image' => '',
78
- 'in-image' => '',
79
- 'th-image' => '',
80
- 'ex-info' => null,
81
- 'in-info' => null,
82
- 'th-info' => null,
83
- 'in-target' => null,
84
- 'ex-target' => '2',
85
- 'ex-thumbnail' => '0',
86
- 'in-thumbnail' => '1',
87
- 'ex-favicon' => '3',
88
- 'in-favicon' => '1',
89
- 'favicon-api' => 'http://www.google.com/s2/favicons?domain=%DOMAIN%',
90
- 'thumbnail-api' => 'http://s.wordpress.com/mshots/v1/%URL%?w=100',
91
- 'thumbnail-position'=> '2',
92
- 'thumbnail-shadow' => '1',
93
- 'thumbnail-resize' => '1',
94
- 'cache-time' => 31536000,
95
- 'flg-alive' => null,
96
- 'flg-ssl' => null,
97
- 'style-reset-img' => '1',
98
- 'style' => null,
99
- 'css-file' => null,
100
- 'css-path' => null,
101
- 'css-url' => null,
102
- 'class-pc' => null,
103
- 'class-mobile' => null,
104
- 'sns-position' => '2',
105
- 'sns-tw' => '1',
106
- 'sns-fb' => '1',
107
- 'sns-hb' => '1',
108
- 'link-all' => '1',
109
- 'blockquote' => null,
110
- 'nofollow' => null,
111
- 'presence' => null,
112
- 'plugin-link' => null,
113
- 'plugin-name' => 'Pz-LinkCard',
114
- 'plugin-version' => '1.6.9',
115
- 'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
116
- 'pz-hbc-options' => null,
117
- 'debug-time' => null
118
- );
119
-
120
- public function __construct() {
121
- $this->slug = basename(dirname(__FILE__));
122
- $this->text_domain = $this->slug;
123
-
124
- $this->charset = get_bloginfo('charset');
125
-
126
- $this->plugin_basename = plugin_basename(__FILE__);
127
- $this->plugin_dir_path = plugin_dir_path(__FILE__);
128
- $this->plugin_dir_url = plugin_dir_url (__FILE__);
129
-
130
- $this->options = get_option('Pz_LinkCard_options', $this->defaults );
131
-
132
- // DB
133
- global $wpdb;
134
- $this->db_name = $wpdb->prefix.'pz_linkcard';
135
-
136
- // バージョンが上がっていたら、オプションを更新する
137
- if ($this->options['plugin-version'] < $this->defaults['plugin-version']) {
138
- $this->activation();
139
- }
140
-
141
- // CSS URLが空だったら生成
142
- if (isset($this->options['style']) && isset($this->options['style']) == '1' && !isset($this->options['css-url'])) {
143
- require_once ('pz-linkcard-style.php');
144
- }
145
-
146
- // ショートコードの設定
147
- if ($this->options['code1'] <> '') {
148
- add_shortcode($this->options['code1'], array($this, 'shortcode'));
149
- }
150
- if ($this->options['code2'] <> '') {
151
- add_shortcode($this->options['code2'], array($this, 'shortcode'));
152
- }
153
- if ($this->options['code3'] <> '') {
154
- add_shortcode($this->options['code3'], array($this, 'shortcode'));
155
- }
156
- if ($this->options['code4'] <> '') {
157
- add_shortcode($this->options['code4'], array($this, 'shortcode'));
158
- }
159
-
160
- // 管理画面のとき
161
- if (is_admin()) {
162
- load_plugin_textdomain ($this->text_domain, false, $this->slug.'/languages'); // 管理画面のみ日本語化
163
- register_activation_hook (__FILE__, array($this, 'activation')); // 有効化したときの処理
164
- register_deactivation_hook (__FILE__, array($this, 'deactivation')); // 無効化したときの処理
165
- add_action ('admin_menu', array($this, 'add_menu')); // 設定メニュー
166
- add_action ('admin_enqueue_scripts', array($this, 'enqueue_admin')); // 設定メニュー用スクリプト
167
- add_filter ('plugin_action_links_'.$this->plugin_basename, array($this, 'action_links')); // プラグイン画面
168
-
169
- if ((isset($this->options['style']) ? $this->options['style'] : '') == '') {
170
- if (is_null($this->options['css-path']) || !file_exists($this->options['css-path'])) {
171
- require_once ('pz-linkcard-style.php');
172
- }
173
- }
174
- } else {
175
- if (!isset($this->options['style'])) {
176
- if (!isset($this->options['css-url'])) {
177
- require_once ('pz-linkcard-style.php');
178
- }
179
- }
180
- add_action('wp_enqueue_scripts', array($this, 'enqueue'));
181
- }
182
-
183
- // if (!wp_next_scheduled('pz_linkcard_check')) {
184
- // wp_schedule_event( time(), 'hourly', 'pz_linkcard_check');
185
- // wp_schedule_single_event( time() + 10, 'pz_linkcard_check');
186
- // }
187
- add_action('pz_linkcard_check', array($this, 'schedule_hook_sns'));
188
- // add_action('pz_linkcard_check', array($this, 'schedule_hook_alive'));
189
- }
190
-
191
- public function shortcode($atts, $content = null, $shortcode) {
192
- // URL
193
- $url = isset($atts['url']) ? $this->pz_TrimURL($atts['url']) : null;
194
- // 密かに記述ミス対応
195
- if (is_null($url)) {
196
- $url = isset($atts['ur1']) ? $this->pz_TrimURL($atts['ur1']) : null;
197
- if (is_null($url)) {
198
- $url = isset($atts['uri']) ? $this->pz_TrimURL($atts['uri']) : null;
199
- }
200
- }
201
-
202
- // パラメータ
203
- $s_title = isset($atts['title']) ? $atts['title'] : null;
204
- if (isset($atts['content'])) {
205
- $s_excerpt = $atts['content'];
206
- } elseif (isset($atts['contents'])) {
207
- $s_excerpt = $atts['contents'];
208
- } elseif (isset($atts['description'])) {
209
- $s_excerpt = $atts['description'];
210
- } else {
211
- $s_excerpt = null;
212
- }
213
-
214
- // 囲まれ文字(ショートコード1のみ有効)
215
- if ($shortcode == $this->options['code1']) {
216
- switch (isset($this->options['use-inline']) ? $this->options['use-inline'] : null) {
217
- case '1':
218
- $s_excerpt = isset($content) ? $content : '';
219
- break;
220
- case '2':
221
- $s_title = isset($content) ? $content : '';
222
- break;
223
- }
224
- }
225
-
226
- $tag = $this->pz_GetHTML(array('url' => $url, 'title' => $s_title, 'content' => $s_excerpt));
227
- return $tag;
228
- }
229
-
230
- // URL
231
- function pz_TrimURL($url = null) {
232
- if (!isset($url) || $url == '') {
233
- $url = null;
234
- return $url;
235
- }
236
-
237
- if (isset($url) && $url <> '') {
238
- $url = html_entity_decode($url);
239
- $url = preg_replace('/^[\s \'\"‘’“”″]*(.*?)[\s \'\"‘’“”″]*$/u', '\1', $url);
240
- $url = strip_tags($url);
241
- $url = htmlentities($url);
242
- $url = esc_url($url); // プロトコル除外など
243
- }
244
- return $url;
245
- }
246
-
247
- function pz_GetHTML($atts,$content = null) {
248
- global $wpdb;
249
-
250
- $update = false;
251
- $error = false;
252
- $data = null;
253
-
254
- // リンク先URL
255
- $url = isset($atts['url']) ? $this->pz_TrimURL($atts['url']) : null;
256
-
257
- // 時間計測
258
- if (is_user_logged_in()) {
259
- $start_time = microtime(true);
260
- }
261
-
262
- // URLエンコード
263
- $url_esc = urlencode($url);
264
-
265
- // リンク先URLからドメイン名を抽出
266
- if (preg_match('{https?://(.+?)/}i', $url.'/',$m)) {
267
- $domain_url = $m[0];
268
- $domain = $m[1];
269
- } else {
270
- $domain_url = null;
271
- $domain = null;
272
- $error = true;
273
- }
274
-
275
- // モバイルチェック
276
- if (function_exists('wp_is_mobile') && wp_is_mobile()) {
277
- $is_mobile = true;
278
- } else {
279
- $is_mobile = false;
280
- }
281
-
282
- // 自サイトチェック
283
- if (preg_match('{'.home_url().'\/.*?}', $url.'/')) {
284
- if (get_permalink() == $url) {
285
- $link_type = 1; // 自ページ
286
- } else {
287
- $link_type = 2; // 自サイト内
288
- }
289
- $target = ''; // 同ページに開く
290
- if (isset($this->options['in-target'])) {
291
- if ($this->options['in-target'] == '1' || ($this->options['in-target'] == '2' && !$is_mobile)) {
292
- $target = ' target="_blank"'; // 新しいページで開く
293
- }
294
- }
295
- $nofollow = '';
296
- } else {
297
- $link_type = 0; // 外部サイト
298
- $target = ''; // 同ページに開く
299
- if (isset($this->options['ex-target'])) {
300
- if ($this->options['ex-target'] == '1' || ($this->options['ex-target'] == '2' && !$is_mobile)) {
301
- $target = ' target="_blank"'; // 新しいページで開く
302
- }
303
- }
304
- $nofollow = isset($this->options['nofollow']) ? ' rel="nofollow"' : '';
305
- }
306
-
307
- // クラス名追加
308
- $class_id = 'linkcard';
309
- if ($is_mobile && isset($this->options['class-mobile']) && $this->options['class-mobile'] <> '') {
310
- $class_id .= ' '.$this->options['class-mobile'];
311
- } elseif (isset($this->options['class-pc']) && $this->options['class-pc'] <> '') {
312
- $class_id .= ' '.$this->options['class-pc'];
313
- }
314
-
315
- // URLをキーにしてDBからキャッシュ取得
316
- $data['id'] = null;
317
- $data['url_key'] = null;
318
- $data['site_name'] = null;
319
- $data['title'] = null;
320
- $data['excerpt'] = null;
321
- $data['charset'] = null;
322
- $data['thumbnail'] = null;
323
- $data['favicon'] = null;
324
- $data['result_code'] = null;
325
- $data['post_id'] = get_the_ID();
326
- $data['sns_twitter'] = -1;
327
- $data['sns_facebook'] = -1;
328
- $data['sns_hatena'] = -1;
329
- $data['uptime'] = null;
330
- $data['nexttime'] = 0;
331
- // $data['psc_code'] = 0;
332
- // $data['psc_last'] = 0;
333
- if (isset($url) && $url) {
334
- $data['url'] = $url;
335
- $result = $this->pz_GetCache($data);
336
- if (isset($result) && is_array($result) && isset($result['url'])) {
337
- $data = $result;
338
- }
339
- }
340
- $data_id = $data['id'];
341
- $url_key = $data['url_key'];
342
- $site_name = $data['site_name'];
343
- $title = $data['title'];
344
- $excerpt = $data['excerpt'];
345
- $charset = $data['charset'];
346
- $thumbnail_url = $data['thumbnail'];
347
- $favicon_url = $data['favicon'];
348
- $result_code = $data['result_code'];
349
- $post_id = $data['post_id'];
350
- $sns_tw = $data['sns_twitter'];
351
- $sns_fb = $data['sns_facebook'];
352
- $sns_hb = $data['sns_hatena'];
353
- $uptime = $data['uptime'];
354
- $nexttime = $data['nexttime'];
355
- // $psc_code = $data['psc_code'];
356
- // $psc_last = $data['psc_last'];
357
-
358
- $thumbnail = null;
359
- $favicon = null;
360
-
361
- if ($link_type) { // 自サイト内はキャッシュがあっても常に取得する
362
- if (is_null($data_id)) {
363
- $update = true;
364
- }
365
-
366
- if ($link_type == '1') {
367
- $info = isset($this->options['th-info']) ? $this->options['th-info'] : '' ;
368
- $wrap_op = '<div class="lkc-this-wrap">';
369
- $wrap_cl = '</div>';
370
- } else {
371
- $info = isset($this->options['in-info']) ? $this->options['in-info'] : '' ;
372
- $wrap_op = '<div class="lkc-internal-wrap">';
373
- $wrap_cl = '</div>';
374
- }
375
- $site_name = get_bloginfo('name'); // サイト名
376
- $id = url_to_postid($url); // 記事ID
377
- if ($id) {
378
- $post = get_post($id); // 記事情報
379
- } else {
380
- $post = null;
381
- }
382
-
383
- // タイトル取得
384
- if ($id) {
385
- switch (isset($this->options['in-get']) ? $this->options['in-get'] : null) {
386
- case null:
387
- $title = $post->post_title; // 記事タイトル
388
- $excerpt = $post->post_content; // 記事内容から抜粋
389
- break;
390
- case '1':
391
- $title = $post->post_title; // 記事タイトル
392
- $excerpt = $post->post_excerpt; // 抜粋文優先
393
- if ($excerpt == '') {
394
- $excerpt = $post->post_content; // 抜粋文が無かったら記事
395
- }
396
- break;
397
- default:
398
- // カード管理優先
399
- break;
400
- }
401
- // if (!$title) {
402
- // $title = $post->post_title; // 記事タイトル
403
- // if (!$excerpt) {
404
- // $excerpt = $post->post_content; // 記事内容
405
- // }
406
- // }
407
- } else {
408
- $result_code = -1;
409
- if (!$title) {
410
- $title = get_bloginfo('name'); // サイト名
411
- if (!$excerpt) {
412
- $excerpt = get_bloginfo('description'); // サイト概要
413
- }
414
- }
415
- }
416
-
417
- $sw_thumbnail = isset($this->options['in-thumbnail']) ? $this->options['in-thumbnail'] : '0' ;
418
- if ($sw_thumbnail == '1' || $sw_thumbnail == '13') {
419
- $thumbnail = get_the_post_thumbnail($id, 'thumbnail' , array('class' => 'lkc-thumbnail-img'));
420
- if ($sw_thumbnail == '13' && $thumbnail == '') {
421
- $sw_thumbnail = '3';
422
- }
423
- }
424
- $sw_favicon = isset($this->options['in-favicon']) ? $this->options['in-favicon'] : '0' ;
425
- if ($sw_favicon == '1') {
426
- if (function_exists('has_site_icon') && has_site_icon()) {
427
- $favicon = '<img class="lkc-favicon" src="'.get_site_icon_url(16, '', 0).'" alt="" />';
428
- } else {
429
- $sw_favicon = isset($this->options['ex-favicon']) ? $this->options['ex-favicon'] : '0' ;
430
- }
431
- }
432
-
433
- } else { // 外部サイト
434
- $wrap_op = '<div class="lkc-external-wrap">'; // ラッピング
435
- $wrap_cl = '</div>';
436
- $info = isset($this->options['ex-info']) ? $this->options['ex-info'] : '' ;
437
- $sw_thumbnail = isset($this->options['ex-thumbnail']) ? $this->options['ex-thumbnail'] : '0' ;
438
- $sw_favicon = isset($this->options['ex-favicon']) ? $this->options['ex-favicon'] : '0' ;
439
-
440
- if (isset($this->options['use-hatena']) && !is_null($this->options['use-hatena'])) {
441
- // 「はてなブログカード」をそのまま利用する
442
- $tag = '<div class="lkc-iframe-wrap"><iframe src="http://hatenablog.com/embed?url='.$url.'" class="lkc-iframe" scrolling="no" frameborder="0"></iframe></div>';
443
- if (isset($this->options['blockquote']) ? $this->options['blockquote'] : null == '1') {
444
- $tag = '<div class="'.$class_id.'"><blockquote class="lkc-quote">'.$tag.'</blockquote></div>';
445
- } else {
446
- $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
447
- }
448
- return $tag;
449
-
450
- } elseif (is_null($data_id) || (isset($atts['force']) && $atts['force'] == true)) { // キャッシュ無、または前回エラー
451
- // リンク先サイト取得
452
- $html = null;
453
- $error = true;
454
-
455
- if (function_exists('curl_init')) {
456
- $ch = curl_init($url);
457
- // curl_setopt($ch, CURLOPT_TIMEOUT, 8);
458
- curl_setopt($ch, CURLOPT_USERAGENT, esc_html($_SERVER['HTTP_USER_AGENT']));
459
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
460
- curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
461
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
462
- if (isset($this->options['flg-ssl']) ? $this->options['flg-ssl'] : null) {
463
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // SSL検証なし
464
- } else {
465
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // SSL検証あり
466
- }
467
- $html = curl_exec($ch);
468
- if (curl_errno($ch)) {
469
- $html = '';
470
- $result_code = 0 - intval(curl_errno($ch));
471
- } else {
472
- $header = curl_getinfo($ch);
473
- $result_code = $header['http_code'];
474
- }
475
- curl_close($ch);
476
- } else {
477
- $result = wp_remote_get($url);
478
- if (!is_wp_error($result)) {
479
- $html = $result['body'];
480
- $result_code = $result['response']['code'];
481
- } else {
482
- $html = '';
483
- $result_code = -1;
484
- }
485
- }
486
- $charset = null;
487
- if ($html <> '') {
488
- if (preg_match('/charset\s*=\s*([^>\/\s]*).*<\/head/si', $html, $m)) {
489
- $m[1] = trim(trim($m[1]), '\'\"');
490
- $charset = $m[1];
491
- } else {
492
- foreach(array('UTF-8','SJIS','EUC-JP','eucJP-win','ASCII','JIS','SJIS-win') as $c_charset) {
493
- if (mb_convert_encoding($html, $this->charset, $c_charset) == $html) {
494
- $charset = $c_charset;
495
- break;
496
- }
497
- }
498
- }
499
- if (is_null($charset)) {
500
- $charset = 'auto';
501
- $html = mb_convert_encoding($html, $this->charset, 'ASCII,JIS,UTF-7,EUC-JP,SJIS,UTF-8');
502
- } elseif ($this->charset <> $charset) {
503
- $html = mb_convert_encoding($html, $this->charset, $charset);
504
- }
505
- }
506
-
507
- if ($result_code < 0) {
508
- $error = false;
509
- $update = true;
510
- } else {
511
- $error = false;
512
- $update = true;
513
-
514
- $tags = null;
515
- // HEADタグ
516
- $head = null;
517
- $tags = null;
518
- if (preg_match('/<\s*head\s*[^>]*>(.*)<\s*\/head\s*>/si', $html, $m)) {
519
- $head = $m[1];
520
- $tags = $this->pz_GetMeta($head);
521
- }
522
-
523
- // タイトル
524
- if (isset( $tags['og:title'] ) && $tags['og:title'] ) {
525
- $title = $tags['og:title'] ;
526
- } elseif (isset( $tags['title'] ) && $tags['title'] ) {
527
- $title = $tags['title'] ;
528
- }
529
-
530
- // 抜粋文・概要文
531
- if (isset( $tags['og:description'] ) && $tags['og:description'] ) {
532
- $excerpt = $tags['og:description'] ;
533
- } elseif (isset( $tags['description'] ) && $tags['description'] ) {
534
- $excerpt = $tags['description'] ;
535
- }
536
-
537
- // // OGPから画像URL取得
538
- // if ($sw_thumbnail == '1' && isset($tags['og:image'])) {
539
- // $thumbnail_url = $tags['og:image'];
540
- // $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
541
- // }
542
-
543
- // サイト名
544
- if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
545
- $site_name = $tags['og:site_name'] ;
546
- }
547
-
548
- if ($result_code <> 200) {
549
- $title = null;
550
- }
551
- }
552
- }
553
- }
554
-
555
- // タイトル整形
556
- if (isset($title)) {
557
- $str = $title;
558
- $str = strip_tags($str); // タグの除去
559
- $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
560
- $str = esc_html($str); // 念のためエスケープ
561
- $str = mb_strimwidth($str, 0, 200, '...'); // 保管用のタイトルは200文字で切る
562
- $title = $str;
563
- }
564
- // 抜粋文整形
565
- if (isset($excerpt)) {
566
- $str = $excerpt;
567
- $str = strip_tags($str); // タグの除去
568
- $str = preg_replace('/<!--more-->.+/is', '', $str); // moreタグ以降削除
569
- $str = preg_replace('/\[[^]]*\]/', '', $str); // ショートコードすべて除去
570
- $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
571
- $str = esc_html($str); // 念のためエスケープ
572
- $str = mb_strimwidth($str, 0, 500, '...'); // 保管用の記事内容は500文字で切る
573
- $excerpt = $str;
574
- }
575
-
576
- // 取得エラーなし・取得または更新あり
577
- if (!$error && $update && $url) {
578
- if (isset($data_id) && !is_null($data_id)) {
579
- $data['id'] = $data_id;
580
- }
581
- if (isset($url_key) && !is_null($url_key)) {
582
- $data['url_key'] = $url_key;
583
- }
584
- $data['url'] = $url;
585
- $data['link_type'] = $link_type;
586
- $data['site_name'] = $site_name;
587
- $data['domain'] = $domain;
588
- $data['title'] = $title;
589
- $data['excerpt'] = $excerpt;
590
- $data['charset'] = $charset;
591
- $data['thumbnail'] = $thumbnail_url;
592
- $data['favicon'] = $favicon_url;
593
- $data['result_code'] = $result_code;
594
- $data['sns_twitter'] = $sns_tw;
595
- $data['sns_facebook'] = $sns_fb;
596
- $data['sns_hatena'] = $sns_hb;
597
- $data['uptime'] = $uptime;
598
- $data['nexttime'] = $nexttime;
599
- // $data['psc_code'] = $result_code;
600
- // $data['psc_last'] = $uptime;
601
- if (isset($atts['force']) && $atts['force'] == true) {
602
- $data['regist'] = current_time('mysql'); // 登録日
603
- }
604
-
605
- $data = $this->pz_SetCache($data);
606
- wp_schedule_single_event(time() + 10, 'pz_linkcard_check');
607
-
608
- if (isset($data['id'])) {
609
- $update = false;
610
- }
611
- }
612
-
613
- // サムネイル取得
614
- if (!$this->options['thumbnail-position'] || $error) {
615
- $thumbnail = null;
616
- } else {
617
- if ($sw_thumbnail == '3') {
618
- // 画像取得
619
- if (isset($this->options['thumbnail-api'])) {
620
- $thumbnail = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['thumbnail-api'] );
621
- $thumbnail = preg_replace('/%DOMAIN%/', $domain, $thumbnail);
622
- $thumbnail = preg_replace('/%URL%/', rawurlencode($url), $thumbnail);
623
- $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail.'" alt="" />';
624
- }
625
- }
626
- }
627
-
628
- // ファビコン取得
629
- if (!isset($this->options['info-position'])) {
630
- $favicon = null;
631
- } else{
632
- if ($sw_favicon == '3') {
633
- // サイトアイコン取得
634
- if (isset($this->options['favicon-api'])) {
635
- $favicon = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['favicon-api'] );
636
- $favicon = preg_replace('/%DOMAIN%/', $domain, $favicon);
637
- $favicon = preg_replace('/%URL%/', rawurlencode($url), $favicon);
638
- $favicon = '<img class="lkc-favicon" src="'.$favicon.'" alt="" />';
639
- }
640
- }
641
- }
642
-
643
- // データベースへの保存が終わったので、表示用の編集
644
-
645
- // タイトル
646
- if (!isset($title) || $title == '') {
647
- $title = esc_html($url); // タイトル取得できていなかったらURLをセットする
648
- }
649
-
650
- // パラメータ取得(タイトル・抜粋文)
651
- if (isset($atts['title'])) { // titleパラメータ
652
- $title = $atts['title'];
653
- $excerpt = '';
654
- }
655
- if ($excerpt == '') {
656
- if (isset($atts['content'])) { // contrentパラメータ
657
- $excerpt = $atts['content'];
658
- } elseif (isset($atts['contents'])) { // contentsパラメータ
659
- $excerpt = $atts['contents'];
660
- } elseif (isset($atts['description'])) { // descriptionパラメータ
661
- $excerpt = $atts['description'];
662
- }
663
- }
664
-
665
- // タイトル整形
666
- if (isset($title)) {
667
- $str = $title;
668
- $str = strip_tags($str); // タグの除去
669
- $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
670
- $str = esc_html($str); // 念のためエスケープ
671
- $str = mb_strimwidth($str, 0, (isset($this->options['trim-title']) ? $this->options['trim-title'] : $this->defaults['trim-title'] ) , '...');
672
- $title = $str;
673
- }
674
-
675
- // 抜粋文整形
676
- // 抜粋文非表示の場合、空欄にする
677
- if (!isset($this->options['display-excerpt']) || is_null($this->options['display-excerpt'])) {
678
- $excerpt = '';
679
- } else {
680
- if (isset($excerpt)) {
681
- $str = $excerpt;
682
- $str = strip_tags($str); // タグの除去
683
- $str = preg_replace('/<!--more-->.+/is', '', $str); // moreタグ以降削除
684
- $str = preg_replace('/\[[^]]*\]/', '', $str); // ショートコードすべて除去
685
- $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
686
- $str = esc_html($str); // 念のためエスケープ
687
- $str = mb_strimwidth($str, 0, (isset($this->options['trim-count']) ? $this->options['trim-count'] : $this->defaults['trim-count'] ) , '...');
688
- $excerpt = $str;
689
- }
690
- }
691
-
692
- // サイト名称を使わない場合、ドメイン名で上書き
693
- $site_title = '';
694
- if ((isset($this->options['use-sitename']) ? $this->options['use-sitename'] : null) && $site_name) {
695
- $c_site_name = $site_name;
696
- $site_name = mb_strimwidth($site_name, 0, (isset($this->options['trim-sitename']) ? $this->options['trim-sitename'] : $this->defaults['trim-sitename'] ) , '...');
697
- if ($site_name <> $c_site_name) {
698
- $site_title = ' title="'.$c_site_name.'"';
699
- }
700
- } else {
701
- $site_name = $domain;
702
- }
703
-
704
- // リンク先URL
705
- $a_op = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
706
- $a_cl = '</a>';
707
- if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
708
- $a_op_all = $a_op;
709
- $a_cl_all = $a_cl;
710
- $a_op = '';
711
- $a_cl = '';
712
- } else {
713
- $a_op_all = '';
714
- $a_cl_all = '';
715
- }
716
-
717
- // ソーシャルカウント(class="no_icon"は他プラグインの対応)
718
- $sns = null;
719
- $sns_info = null;
720
- $sns_title = null;
721
- if (!$error && (isset($this->options['sns-position']) ? $this->options['sns-position'] : null)) {
722
- $sns = '<span class="lkc-share">';
723
- if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
724
- if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
725
- $sns .= ' <span class="lkc-sns-tw no_icon">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</span>';
726
- }
727
- if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
728
- $sns .= ' <span class="lkc-sns-fb no_icon">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</span>';
729
- }
730
- if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
731
- $sns .= ' <span class="lkc-sns-hb no_icon">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</span>';
732
- }
733
- } else {
734
- if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
735
- $sns .= ' <a class="lkc-sns-tw no_icon" href="https://twitter.com/intent/tweet?url=' .rawurlencode($url).'&text='.esc_html($title).'" target="_blank">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</a>';
736
- }
737
- if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
738
- $sns .= ' <a class="lkc-sns-fb no_icon" href="https://www.facebook.com/sharer/sharer.php?u=' .rawurlencode($url).'" target="_blank">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</a>';
739
- }
740
- if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
741
- $sns .= ' <a class="lkc-sns-hb no_icon" href="http://b.hatena.ne.jp/entry/' .rawurlencode($url).'" target="_blank">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</a>';
742
- }
743
- }
744
- $sns .= '</span>';
745
-
746
- if ($this->options['sns-position'] == '1') {
747
- $sns_title = $sns;
748
- } else {
749
- $sns_info = $sns;
750
- }
751
- }
752
-
753
- // サムネイル
754
- if ($thumbnail) {
755
- $thumbnail = '<span class="lkc-thumbnail">'.$thumbnail.'</span>';
756
- }
757
- // サイト情報
758
- $domain_info = '<div class="lkc-info">'.$a_op.'<span class="lkc-domain"'.$site_title.'>'.$favicon.'&nbsp;'.$site_name.$info.'</span>'.$a_cl.'&nbsp;'.$sns_info.$this->plugin_link.'</div>';
759
-
760
- // 記事内容
761
- $content = '<div class="lkc-content">'.$a_op.$thumbnail.'<span class="lkc-title">'.$title.'</span>'.$a_cl.$sns_title.'<div class="lkc-url"><cite>'.$a_op.$url.$a_cl.'</cite></div><div class="lkc-excerpt">'.$excerpt.'</div></div>';
762
-
763
- // HTMLタグ作成
764
- switch (isset($this->options['info-position']) ? $this->options['info-position'] : null) {
765
- case '1':
766
- $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$domain_info.$content.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
767
- break;
768
- case '2':
769
- $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$content.$domain_info.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
770
- break;
771
- default:
772
- $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$content.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
773
- }
774
-
775
- // 引用文扱い
776
- if (isset($this->options['blockquote']) ? $this->options['blockquote'] : null == '1') {
777
- $tag = '<div class="'.$class_id.'"><blockquote class="lkc-quote">'.$tag.'</blockquote></div>';
778
- } else {
779
- $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
780
- }
781
-
782
- // 実行時間
783
- if (is_user_logged_in()) {
784
- if (isset($this->options['debug-time'])) {
785
- $end_time = microtime(true);
786
- $elasped_time = number_format($end_time - $start_time, 8, '.', ',');
787
- $tag = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$tag.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
788
- }
789
- }
790
- return $tag;
791
- }
792
-
793
- public function pz_RenewSNSCount($data) {
794
- if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
795
- return null;
796
- }
797
- if (!isset($data) || !is_array($data)) {
798
- return null;
799
- }
800
-
801
- $data = $this->pz_GetCache($data);
802
- if (!isset($data) || !is_array($data)) {
803
- return null;
804
- }
805
-
806
- // ソーシャルカウント
807
- $sns_renew = false;
808
- $update_cnt = false;
809
-
810
- // タイムオーバー
811
- $opt = array( 'timeout' => 30 );
812
-
813
- // 保存期間満了でソーシャルカウントをリセット
814
- $now = current_time('timestamp');
815
- if ($now > $data['nexttime'] && $data['result_code'] <= 200 ) {
816
- $sns_renew = true;
817
- }
818
-
819
- // Twitter count.json 2015/11/21 非公式サービス終了に伴い停止→代替APIへ変更
820
- if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw'])) {
821
- $count_before = isset($data['sns_twitter']) ? $data['sns_twitter'] : -1;
822
- if ($sns_renew || $count_before < 0) {
823
- // $result = wp_remote_get( 'http://urls.api.twitter.com/1/urls/count.json?url=' .rawurlencode($data['url']), $opt );
824
- $result = wp_remote_get( 'http://jsoon.digitiminimi.com/twitter/count.json?url=' .rawurlencode($data['url']), $opt );
825
- if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
826
- $count = intval(json_decode($result['body'])->count);
827
- // if ($count <> $count_before) {
828
- if ($count > $count_before) {
829
- $data['sns_twitter'] = $count;
830
- $update_cnt = true;
831
- }
832
- }
833
- }
834
- }
835
-
836
- if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb'])) {
837
- $count_before = intval(isset($data['sns_facebook']) ? $data['sns_facebook'] : -1);
838
- if ($sns_renew || $count_before < 0) {
839
- $result = wp_remote_get( 'http://graph.facebook.com/?id=' .rawurlencode($data['url']), $opt );
840
- if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
841
- $json = json_decode($result['body']);
842
- $count = intval(isset($json->shares) ? $json->shares : 0);
843
- if ($count <> $count_before) {
844
- $data['sns_facebook'] = $count;
845
- $update_cnt = true;
846
- }
847
- }
848
- }
849
- }
850
-
851
- if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb'])) {
852
- $count_before = isset($data['sns_hatena']) ? $data['sns_hatena'] : -1;
853
- if ($sns_renew || $count_before < 0) {
854
- $result = wp_remote_get( 'http://api.b.st-hatena.com/entry.count?url=' .rawurlencode($data['url']), $opt );
855
- if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
856
- $count = intval($result['body']);
857
- if ($count <> $count_before) {
858
- $data['sns_hatena'] = $count;
859
- $update_cnt = true;
860
- }
861
- }
862
- }
863
- }
864
-
865
- if ($update_cnt || ($now - strtotime($data['regist']) < WEEK_IN_SECONDS)) {
866
- $nexttime = $now + DAY_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 1day + 0-24h
867
- } else {
868
- $nexttime = $now + WEEK_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 7days + 0-24h
869
- }
870
- // MINUTE_IN_SECONDS = 60
871
- // HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS = 3600
872
- // DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS = 86400
873
- // WEEK_IN_SECONDS = 7 * DAY_IN_SECONDS = 604800
874
- // YEAR_IN_SECONDS = 365 * DAY_IN_SECONDS
875
-
876
- global $wpdb;
877
- $wpdb->update(
878
- $this->db_name,
879
- array(
880
- 'sns_twitter' => $data['sns_twitter'],
881
- 'sns_facebook' => $data['sns_facebook'],
882
- 'sns_hatena' => $data['sns_hatena'],
883
- 'uptime' => $now,
884
- 'nexttime' => $nexttime
885
- ),
886
- array(
887
- 'url_key' => $data['url_key']
888
- )
889
- );
890
- return $data;
891
- }
892
-
893
- // キャッシュデータを取得
894
- public function pz_GetCache($data) {
895
- if (!isset($data) || !is_array($data)) {
896
- return null;
897
- }
898
- global $wpdb;
899
- if (isset($data['url']) && !is_null($data['url'])) {
900
- $url = $this->pz_TrimURL($data['url']);
901
- $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->db_name WHERE url=%s", $url));
902
- } elseif (isset($data['id']) && !is_null($data['id'])) {
903
- $id = intval($data['id']);
904
- $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->db_name WHERE id=%d", $id));
905
- } else {
906
- return null;
907
- }
908
- if (is_wp_error($data)) {
909
- return null;
910
- }
911
- return (array) $data; // Arrayに直して戻す
912
- }
913
-
914
- // キャッシュデータを保存
915
- public function pz_SetCache($data) {
916
- global $wpdb;
917
- if (!isset($data) || !is_array($data)) {
918
- return null;
919
- }
920
- if (!isset($data['url']) || is_null($data['url'])) {
921
- return null;
922
- }
923
- $url = $this->pz_TrimURL($data['url']);
924
- $data['url'] = $url;
925
-
926
- if (!isset($data['url_key']) || is_null($data['url_key']) || $data['url_key'] == '' ) {
927
- $data['url_key'] = hash('sha256', esc_url($url), true);
928
- }
929
-
930
- $data['uptime'] = current_time('timestamp');
931
- // 更新してみる
932
- if (isset($data['id']) && !is_null(isset($data['id']))) {
933
- $result = $wpdb->update(
934
- $this->db_name,
935
- $data,
936
- array(
937
- 'id' => $data['id']
938
- )
939
- );
940
- } else {
941
- $result = $wpdb->update(
942
- $this->db_name,
943
- $data,
944
- array(
945
- 'url_key' => $data['url_key']
946
- )
947
- );
948
- }
949
- if (!$result) {
950
- $data['regist'] = current_time('mysql'); // 登録日
951
- // 更新できなかったら挿入
952
- unset($data['id']);
953
- $result = $wpdb->insert(
954
- $this->db_name,
955
- $data
956
- );
957
- // 挿入できなかったらエラー終了
958
- if (!$result) {
959
- return null;
960
- }
961
- }
962
- return $this->pz_GetCache($data);
963
- }
964
-
965
- // キャッシュデータを削除
966
- public function pz_DelCache($data) {
967
- global $wpdb;
968
- if (!isset($data) || !is_array($data)) {
969
- return null;
970
- }
971
- if (isset($data['url']) && !is_null($data['url'])) {
972
- $url = $this->pz_TrimURL($data['url']);
973
- $result = $wpdb->delete($this->db_name, array('url' => $url), array('%s') );
974
- return $result;
975
- } elseif (isset($data['id']) && !is_null($data['id'])) {
976
- $data_id = intval($data['id']);
977
- $result = $wpdb->delete($this->db_name, array('id' => $data_id), array('%d') );
978
- return $result;
979
- }
980
- return null;
981
- }
982
-
983
- // TITLEとMETAタグを分解
984
- function pz_GetMeta($html, $tags = null, $clear = false) {
985
- if ($clear == true || !isset($tags)) {
986
- $tags = null;
987
- $tags = array('none' => 'none');
988
- }
989
-
990
- // TITLEタグ
991
- if (preg_match('/<\s*title\s*[^>]*>\s*(.*)\s*<\s*\/title\s*[^>]*>/si', $html, $m)) {
992
- $tags['title'] = esc_html($m[1]);
993
- }
994
-
995
- // metaタグ パース
996
- $match = null;
997
- preg_match_all('/<\s*meta\s(?=[^>]*?\b(?:name|property)\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=)))[^>]*?\bcontent\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=))[^>]*>/is', $html, $match);
998
- if (isset($match) && is_array($match) && count($match) == 3 && count($match[1]) > 0) {
999
- $tags += array_combine($match[1], $match[2]);
1000
- }
1001
-
1002
- return $tags;
1003
- }
1004
-
1005
- // 管理画面時のスタイルシート、スクリプト設定
1006
- public function enqueue_admin($hook) {
1007
- wp_enqueue_style ('wp-color-picker');
1008
- wp_enqueue_script ('colorpicker-script', plugins_url('color-picker.js', __FILE__), array('wp-color-picker'), false, true);
1009
- }
1010
-
1011
- // 通常時のスタイルシート
1012
- public function enqueue($hook) {
1013
- if (!isset($this->options['style'])) {
1014
- wp_enqueue_style ('pz-linkcard', $this->options['css-url']);
1015
- } else {
1016
- if (isset($this->options['css-file'])) {
1017
- wp_enqueue_style('pz-linkcard', $this->options['css-file']);
1018
- }
1019
- }
1020
- }
1021
-
1022
- // 管理画面のサブメニュー追加
1023
- public function add_menu() {
1024
- add_management_page (__('LinkCard cache manager', $this->text_domain),__('Pz LkC Cache', $this->text_domain),'manage_options', 'pz-linkcard-cache', array($this, 'page_cacheman') );
1025
- add_options_page (__('LinkCard Settings', $this->text_domain),__('Pz LinkCard', $this->text_domain),'manage_options', 'pz-linkcard-settings', array($this, 'page_settings') );
1026
- }
1027
-
1028
- // WP-CRONスケジュール(SNSカウント取得)
1029
- public function schedule_hook_sns() {
1030
- if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
1031
- return null;
1032
- }
1033
-
1034
- global $wpdb;
1035
- $now = current_time('timestamp');
1036
- $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,nexttime FROM $this->db_name WHERE nexttime<%d ORDER BY nexttime ASC", $now));
1037
- $i = 0;
1038
- if (isset($result) && is_array($result) && count($result) > 0) {
1039
- foreach($result as $data) {
1040
- $i++;
1041
- if ($i > 10) {
1042
- // wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1043
- break;
1044
- }
1045
- if (isset($data) && isset($data->url)) {
1046
- $data = $this->pz_RenewSNSCount(array('url' => $data->url) );
1047
- }
1048
- }
1049
- }
1050
- }
1051
-
1052
- // WP-CRONスケジュール(存在チェック)
1053
- public function schedule_hook_alive() {
1054
- if (!isset($this->options['flg-alive']) || $this->options['flg-alive'] == '') {
1055
- return null;
1056
- }
1057
-
1058
- // (まだ作ってない)
1059
- global $wpdb;
1060
- $now = current_time('timestamp');
1061
- $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,nexttime FROM $this->db_name WHERE nexttime<%d ORDER BY nexttime ASC", $now));
1062
- $i = 0;
1063
- if (isset($result) && is_array($result) && count($result) > 0) {
1064
- foreach($result as $data) {
1065
- $i++;
1066
- if ($i > 10) {
1067
- // wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1068
- break;
1069
- }
1070
- if (isset($data) && isset($data->url)) {
1071
- $data = $this->pz_RenewSNSCount(array('url' => $data->url) );
1072
- }
1073
- }
1074
- }
1075
- }
1076
-
1077
- public function page_cacheman() {
1078
- require_once ('pz-linkcard-cacheman.php');
1079
- }
1080
-
1081
- public function page_settings() {
1082
- require_once ('pz-linkcard-settings.php');
1083
- }
1084
-
1085
- public function activation() {
1086
- $this->options = get_option('Pz_LinkCard_options', $this->defaults);
1087
- if ($this->options['plugin-version'] < '1.0.2') {
1088
- $this->options['sns-tw'] =$this->options['sns-twitter'];
1089
- $this->options['sns-fb'] =$this->options['sns-facebook'];
1090
- $this->options['sns-hb'] =$this->options['sns-hatena'];
1091
- }
1092
- // $this->options += $this->defaults;
1093
-
1094
- foreach ($this->defaults as $key => $value) {
1095
- if (!isset($this->options[$key])) {
1096
- $this->options[$key] = null;
1097
- }
1098
- }
1099
-
1100
- $this->options['plugin-version'] = $this->defaults['plugin-version'];
1101
- update_option('Pz_LinkCard_options', $this->options);
1102
-
1103
- require_once ('pz-linkcard-style.php');
1104
-
1105
- global $wpdb;
1106
- $wpdb->hide_errors();
1107
- $this->db_name = $wpdb->prefix.'pz_linkcard';
1108
- $sql = "CREATE TABLE ".$this->db_name." (
1109
- id INT UNSIGNED NOT NULL AUTO_INCREMENT,
1110
- url_key VARBINARY(255) NOT NULL,
1111
- url VARCHAR(2048) NOT NULL DEFAULT '',
1112
- link_type INT UNSIGNED,
1113
- site_name VARCHAR(100) ,
1114
- domain VARCHAR(253) ,
1115
- title VARCHAR(200) ,
1116
- excerpt VARCHAR(500) ,
1117
- charset VARCHAR(32) ,
1118
- thumbnail VARCHAR(2048) ,
1119
- favicon VARCHAR(2048) ,
1120
- result_code INT ,
1121
- post_id INT UNSIGNED,
1122
- sns_twitter INT ,
1123
- sns_facebook INT ,
1124
- sns_hatena INT ,
1125
- uptime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1126
- nexttime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1127
- regist DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1128
- PRIMARY KEY ( id ),
1129
- UNIQUE KEY ( url_key )
1130
- ) ".$wpdb->get_charset_collate()." ;";
1131
- require_once (ABSPATH.'wp-admin/includes/upgrade.php');
1132
- dbDelta($sql);
1133
-
1134
- wp_clear_scheduled_hook('pz_linkcard_check');
1135
- wp_schedule_event(time() + 30, 'hourly', 'pz_linkcard_check');
1136
- }
1137
-
1138
- public function deactivation() {
1139
- wp_clear_scheduled_hook('pz_linkcard_check');
1140
- }
1141
-
1142
- public function action_links($links) {
1143
- $links = array('<a href="options-general.php?page=pz-linkcard-settings">'.__('Settings', $this->text_domain).'</a>' , '<a href="tools.php?page=pz-linkcard-cache">'.__('Manage', $this->text_domain).'</a>' ) + $links;
1144
- return $links;
1145
- }
1146
- }
 
 
 
 
 
 
 
 
 
 
1147
  $Pz_LinkCard = new Pz_LinkCard;
1
+ <?php
2
+ /*
3
+ Plugin Name: Pz-LinkCard
4
+ Plugin URI: http://poporon.poponet.jp/pz-linkcard
5
+ Description: リンクをカード形式で表示します。
6
+ Version: 1.7.0
7
+ Author: poporon
8
+ Author URI: http://poporon.poponet.jp
9
+ License: GPLv2 or later
10
+ */
11
+
12
+ defined('ABSPATH') || die;
13
+
14
+ class Pz_LinkCard {
15
+ public $slug; // slug
16
+ public $text_domain; // as slug
17
+
18
+ public $charset;
19
+
20
+ public $plugin_basename;
21
+ public $plugin_dir_path;
22
+ public $plugin_dir_url;
23
+ public $plugin_link; // link to plugin page
24
+ private $db_name;
25
+
26
+ public $options;
27
+ protected $defaults = array(
28
+ 'code1' => 'blogcard',
29
+ 'code2' => null,
30
+ 'code3' => null,
31
+ 'code4' => null,
32
+ 'trail-slash' => '1',
33
+ 'border' => '1bk',
34
+ 'width' => '500px',
35
+ 'content-height' => '108px',
36
+ 'margin-top' => '4px',
37
+ 'margin-right' => '16px',
38
+ 'margin-bottom' => '16px',
39
+ 'margin-left' => '4px',
40
+ 'card-top' => null,
41
+ 'card-right' => null,
42
+ 'card-bottom' => null,
43
+ 'card-left' => null,
44
+ 'centering' => null,
45
+ 'radius' => null,
46
+ 'shadow' => '1',
47
+ 'shadow-inset' => null,
48
+ 'special-format' => 'LkC',
49
+ 'use-inline' => null,
50
+ 'use-sitename' => '1',
51
+ 'use-hatena' => null,
52
+ 'display-url' => '1',
53
+ 'display-excerpt' => '1',
54
+ 'trim-title' => 200,
55
+ 'trim-count' => 250,
56
+ 'trim-sitename' => 50,
57
+ 'info-position' => '1',
58
+ 'separator' => null,
59
+ 'size-title' => '16px',
60
+ 'size-url' => '9px',
61
+ 'size-excerpt' => '11px',
62
+ 'size-info' => '12px',
63
+ 'size-plugin' => '9px',
64
+ 'color-title' => '#111111',
65
+ 'color-url' => '#4466ff',
66
+ 'color-excerpt' => '#333333',
67
+ 'color-info' => '#222222',
68
+ 'color-plugin' => '#888888',
69
+ 'outline-color-title' => '#ffffff',
70
+ 'outline-color-url' => '#ffffff',
71
+ 'outline-color-excerpt' => '#ffffff',
72
+ 'outline-color-info' => '#ffffff',
73
+ 'outline-color-plugin' => '#ffffff',
74
+ 'ex-bgcolor' => '#fff',
75
+ 'in-bgcolor' => '#fff',
76
+ 'th-bgcolor' => '#eee',
77
+ 'in-get' => null,
78
+ 'ex-image' => '',
79
+ 'in-image' => '',
80
+ 'th-image' => '',
81
+ 'ex-info' => null,
82
+ 'in-info' => null,
83
+ 'th-info' => null,
84
+ 'in-target' => null,
85
+ 'ex-target' => '2',
86
+ 'ex-thumbnail' => '0',
87
+ 'in-thumbnail' => '1',
88
+ 'ex-favicon' => '3',
89
+ 'in-favicon' => '1',
90
+ 'favicon-api' => 'http://www.google.com/s2/favicons?domain=%DOMAIN%',
91
+ 'thumbnail-api' => 'http://s.wordpress.com/mshots/v1/%URL%?w=100',
92
+ 'thumbnail-position'=> '2',
93
+ 'thumbnail-shadow' => '1',
94
+ 'thumbnail-resize' => '1',
95
+ 'cache-time' => 31536000,
96
+ 'flg-alive' => null,
97
+ 'flg-ssl' => null,
98
+ 'style-reset-img' => '1',
99
+ 'style' => null,
100
+ 'css-file' => null,
101
+ 'css-path' => null,
102
+ 'css-url' => null,
103
+ 'class-pc' => null,
104
+ 'class-mobile' => null,
105
+ 'sns-position' => '2',
106
+ 'sns-tw' => '1',
107
+ 'sns-fb' => '1',
108
+ 'sns-hb' => '1',
109
+ 'link-all' => '1',
110
+ 'blockquote' => null,
111
+ 'nofollow' => null,
112
+ 'presence' => null,
113
+ 'plugin-link' => null,
114
+ 'plugin-name' => 'Pz-LinkCard',
115
+ 'plugin-version' => '1.7.0',
116
+ 'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
117
+ 'pz-hbc-options' => null,
118
+ 'debug-time' => null
119
+ );
120
+
121
+ public function __construct() {
122
+ $this->slug = basename(dirname(__FILE__));
123
+ $this->text_domain = $this->slug;
124
+
125
+ $this->charset = get_bloginfo('charset');
126
+
127
+ $this->plugin_basename = plugin_basename(__FILE__);
128
+ $this->plugin_dir_path = plugin_dir_path(__FILE__);
129
+ $this->plugin_dir_url = plugin_dir_url (__FILE__);
130
+
131
+ $this->options = get_option('Pz_LinkCard_options', $this->defaults );
132
+
133
+ // DB
134
+ global $wpdb;
135
+ $this->db_name = $wpdb->prefix.'pz_linkcard';
136
+
137
+ // バージョンが上がっていたら、オプションを更新する
138
+ if ($this->options['plugin-version'] < $this->defaults['plugin-version']) {
139
+ $this->activation();
140
+ }
141
+
142
+ // CSS URLが空だったら生成
143
+ if (isset($this->options['style']) && isset($this->options['style']) == '1' && !isset($this->options['css-url'])) {
144
+ require_once ('pz-linkcard-style.php');
145
+ }
146
+
147
+ // ショートコードの設定
148
+ if ($this->options['code1'] <> '') {
149
+ add_shortcode($this->options['code1'], array($this, 'shortcode'));
150
+ }
151
+ if ($this->options['code2'] <> '') {
152
+ add_shortcode($this->options['code2'], array($this, 'shortcode'));
153
+ }
154
+ if ($this->options['code3'] <> '') {
155
+ add_shortcode($this->options['code3'], array($this, 'shortcode'));
156
+ }
157
+ if ($this->options['code4'] <> '') {
158
+ add_shortcode($this->options['code4'], array($this, 'shortcode'));
159
+ }
160
+
161
+ // 管理画面のとき
162
+ if (is_admin()) {
163
+ load_plugin_textdomain ($this->text_domain, false, $this->slug.'/languages'); // 管理画面のみ日本語化
164
+ register_activation_hook (__FILE__, array($this, 'activation')); // 有効化したときの処理
165
+ register_deactivation_hook (__FILE__, array($this, 'deactivation')); // 無効化したときの処理
166
+ add_action ('admin_menu', array($this, 'add_menu')); // 設定メニュー
167
+ add_action ('admin_enqueue_scripts', array($this, 'enqueue_admin')); // 設定メニュー用スクリプト
168
+ add_filter ('plugin_action_links_'.$this->plugin_basename, array($this, 'action_links')); // プラグイン画面
169
+
170
+ if ((isset($this->options['style']) ? $this->options['style'] : '') == '') {
171
+ if (is_null($this->options['css-path']) || !file_exists($this->options['css-path'])) {
172
+ require_once ('pz-linkcard-style.php');
173
+ }
174
+ }
175
+ } else {
176
+ if (!isset($this->options['style'])) {
177
+ if (!isset($this->options['css-url'])) {
178
+ require_once ('pz-linkcard-style.php');
179
+ }
180
+ }
181
+ add_action('wp_enqueue_scripts', array($this, 'enqueue'));
182
+ }
183
+
184
+ // if (!wp_next_scheduled('pz_linkcard_check')) {
185
+ // wp_schedule_event( time(), 'hourly', 'pz_linkcard_check');
186
+ // wp_schedule_single_event( time() + 10, 'pz_linkcard_check');
187
+ // }
188
+ add_action('pz_linkcard_check', array($this, 'schedule_hook_sns'));
189
+ // add_action('pz_linkcard_check', array($this, 'schedule_hook_alive'));
190
+ }
191
+
192
+ public function shortcode($atts, $content = null, $shortcode) {
193
+ // URL
194
+ $url = isset($atts['url']) ? $this->pz_TrimURL($atts['url']) : null;
195
+ // 密かに記述ミス対応(URIでもUR1でもURLとして判定する)
196
+ if (is_null($url)) {
197
+ $url = isset($atts['ur1']) ? $this->pz_TrimURL($atts['ur1']) : null;
198
+ if (is_null($url)) {
199
+ $url = isset($atts['uri']) ? $this->pz_TrimURL($atts['uri']) : null;
200
+ }
201
+ }
202
+
203
+ // パラメータ
204
+ $s_title = isset($atts['title']) ? $atts['title'] : null;
205
+ if (isset($atts['content'])) {
206
+ $s_excerpt = $atts['content'];
207
+ } elseif (isset($atts['contents'])) {
208
+ $s_excerpt = $atts['contents'];
209
+ } elseif (isset($atts['description'])) {
210
+ $s_excerpt = $atts['description'];
211
+ } else {
212
+ $s_excerpt = null;
213
+ }
214
+
215
+ // 囲まれ文字(ショートコード1のみ有効)
216
+ if ($shortcode == $this->options['code1']) {
217
+ switch (isset($this->options['use-inline']) ? $this->options['use-inline'] : null) {
218
+ case '1':
219
+ $s_excerpt = isset($content) ? $content : '';
220
+ break;
221
+ case '2':
222
+ $s_title = isset($content) ? $content : '';
223
+ break;
224
+ }
225
+ }
226
+
227
+ $tag = $this->pz_GetHTML(array('url' => $url, 'title' => $s_title, 'content' => $s_excerpt));
228
+ return $tag;
229
+ }
230
+
231
+ // URL
232
+ function pz_TrimURL($url = null) {
233
+ if (!isset($url) || $url == '') {
234
+ $url = null;
235
+ return $url;
236
+ }
237
+
238
+ if (isset($url) && $url <> '') {
239
+ $url = html_entity_decode($url);
240
+ $url = preg_replace('/^[\s \'\"‘’“”″]*(.*?)[\s \'\"‘’“”″]*$/u', '\1', $url);
241
+ $url = strip_tags($url);
242
+ $url = htmlentities($url);
243
+ $url = esc_url($url); // プロトコル除外など
244
+ $array_url = parse_url($url);
245
+ if ((isset($this->options['trail-slash']) ? $this->options['trail-slash'] : null) && (!isset($array_url['path']) || $array_url['path'] == '/')) {
246
+ // URLがドメイン名だけの場合、最後のスラッシュを除外する
247
+ $url = preg_replace('/\/$/u', '', $url);
248
+ }
249
+ }
250
+ return $url;
251
+ }
252
+
253
+ function pz_GetHTML($atts,$content = null) {
254
+ global $wpdb;
255
+
256
+ $update = false;
257
+ $error = false;
258
+ $data = null;
259
+
260
+ // リンク先URL
261
+ $url = isset($atts['url']) ? $this->pz_TrimURL($atts['url']) : null;
262
+
263
+ // 時間計測
264
+ if (is_user_logged_in()) {
265
+ $start_time = microtime(true);
266
+ }
267
+
268
+ // URLエンコード
269
+ $url_esc = urlencode($url);
270
+
271
+ // リンク先URLからドメイン名を抽出
272
+ if (preg_match('{https?://(.+?)/}i', $url.'/',$m)) {
273
+ $domain_url = $m[0];
274
+ $domain = $m[1];
275
+ } else {
276
+ $domain_url = null;
277
+ $domain = null;
278
+ $error = true;
279
+ }
280
+
281
+ // モバイルチェック
282
+ if (function_exists('wp_is_mobile') && wp_is_mobile()) {
283
+ $is_mobile = true;
284
+ } else {
285
+ $is_mobile = false;
286
+ }
287
+
288
+ // 自サイトチェック
289
+ if (preg_match('{'.home_url().'\/.*?}', $url.'/')) {
290
+ if (get_permalink() == $url) {
291
+ $link_type = 1; // 自ページ
292
+ } else {
293
+ $link_type = 2; // 自サイト内
294
+ }
295
+ $target = ''; // 同ページに開く
296
+ if (isset($this->options['in-target'])) {
297
+ if ($this->options['in-target'] == '1' || ($this->options['in-target'] == '2' && !$is_mobile)) {
298
+ $target = ' target="_blank"'; // 新しいページで開く
299
+ }
300
+ }
301
+ $nofollow = '';
302
+ } else {
303
+ $link_type = 0; // 外部サイト
304
+ $target = ''; // 同ページに開く
305
+ if (isset($this->options['ex-target'])) {
306
+ if ($this->options['ex-target'] == '1' || ($this->options['ex-target'] == '2' && !$is_mobile)) {
307
+ $target = ' target="_blank"'; // 新しいページで開く
308
+ }
309
+ }
310
+ $nofollow = isset($this->options['nofollow']) ? ' rel="nofollow"' : '';
311
+ }
312
+
313
+ // クラス名追加
314
+ $class_id = 'linkcard';
315
+ if ($is_mobile && isset($this->options['class-mobile']) && $this->options['class-mobile'] <> '') {
316
+ $class_id .= ' '.$this->options['class-mobile'];
317
+ } elseif (isset($this->options['class-pc']) && $this->options['class-pc'] <> '') {
318
+ $class_id .= ' '.$this->options['class-pc'];
319
+ }
320
+
321
+ // URLをキーにしてDBからキャッシュ取得
322
+ $data['id'] = null;
323
+ $data['url_key'] = null;
324
+ $data['site_name'] = null;
325
+ $data['title'] = null;
326
+ $data['excerpt'] = null;
327
+ $data['charset'] = null;
328
+ $data['thumbnail'] = null;
329
+ $data['favicon'] = null;
330
+ $data['result_code'] = null;
331
+ $data['post_id'] = get_the_ID();
332
+ $data['sns_twitter'] = -1;
333
+ $data['sns_facebook'] = -1;
334
+ $data['sns_hatena'] = -1;
335
+ $data['uptime'] = null;
336
+ $data['nexttime'] = 0;
337
+ // $data['psc_code'] = 0;
338
+ // $data['psc_last'] = 0;
339
+ if (isset($url) && $url) {
340
+ $data['url'] = $url;
341
+ $result = $this->pz_GetCache($data);
342
+ if (isset($result) && is_array($result) && isset($result['url'])) {
343
+ $data = $result;
344
+ }
345
+ }
346
+ $data_id = $data['id'];
347
+ $url_key = $data['url_key'];
348
+ $site_name = $data['site_name'];
349
+ $title = $data['title'];
350
+ $excerpt = $data['excerpt'];
351
+ $charset = $data['charset'];
352
+ $thumbnail_url = $data['thumbnail'];
353
+ $favicon_url = $data['favicon'];
354
+ $result_code = $data['result_code'];
355
+ $post_id = $data['post_id'];
356
+ $sns_tw = $data['sns_twitter'];
357
+ $sns_fb = $data['sns_facebook'];
358
+ $sns_hb = $data['sns_hatena'];
359
+ $uptime = $data['uptime'];
360
+ $nexttime = $data['nexttime'];
361
+ // $psc_code = $data['psc_code'];
362
+ // $psc_last = $data['psc_last'];
363
+
364
+ $thumbnail = null;
365
+ $favicon = null;
366
+
367
+ if ($link_type) { // 自サイト内はキャッシュがあっても常に取得する
368
+ if (is_null($data_id)) {
369
+ $update = true;
370
+ }
371
+
372
+ if ($link_type == '1') {
373
+ $info = isset($this->options['th-info']) ? $this->options['th-info'] : '' ;
374
+ $wrap_op = '<div class="lkc-this-wrap">';
375
+ $wrap_cl = '</div>';
376
+ } else {
377
+ $info = isset($this->options['in-info']) ? $this->options['in-info'] : '' ;
378
+ $wrap_op = '<div class="lkc-internal-wrap">';
379
+ $wrap_cl = '</div>';
380
+ }
381
+ $site_name = get_bloginfo('name'); // サイト名
382
+ $id = url_to_postid($url); // 記事ID
383
+ if ($id) {
384
+ $post = get_post($id); // 記事情報
385
+ } else {
386
+ $post = null;
387
+ }
388
+
389
+ // タイトル取得
390
+ if ($id) {
391
+ switch (isset($this->options['in-get']) ? $this->options['in-get'] : null) {
392
+ case null:
393
+ $title = $post->post_title; // 記事タイトル
394
+ $excerpt = $post->post_content; // 記事内容から抜粋
395
+ break;
396
+ case '1':
397
+ $title = $post->post_title; // 記事タイトル
398
+ $excerpt = $post->post_excerpt; // 抜粋文優先
399
+ if ($excerpt == '') {
400
+ $excerpt = $post->post_content; // 抜粋文が無かったら記事
401
+ }
402
+ break;
403
+ default:
404
+ // カード管理優先
405
+ break;
406
+ }
407
+ } else {
408
+ $result_code = -1;
409
+ if (!$title) {
410
+ $title = get_bloginfo('name'); // サイト名
411
+ if (!$excerpt) {
412
+ $excerpt = get_bloginfo('description'); // サイト概要
413
+ }
414
+ }
415
+ }
416
+
417
+ $sw_thumbnail = isset($this->options['in-thumbnail']) ? $this->options['in-thumbnail'] : '0' ;
418
+ if ($sw_thumbnail == '1' || $sw_thumbnail == '13') {
419
+ $thumbnail = get_the_post_thumbnail($id, 'thumbnail' , array('class' => 'lkc-thumbnail-img'));
420
+ if ($sw_thumbnail == '13' && $thumbnail == '') {
421
+ $sw_thumbnail = '3';
422
+ }
423
+ }
424
+ $sw_favicon = isset($this->options['in-favicon']) ? $this->options['in-favicon'] : '0' ;
425
+ if ($sw_favicon == '1') {
426
+ if (function_exists('has_site_icon') && has_site_icon()) {
427
+ $favicon = '<img class="lkc-favicon" src="'.get_site_icon_url(16, '', 0).'" alt="" />';
428
+ } else {
429
+ $sw_favicon = isset($this->options['ex-favicon']) ? $this->options['ex-favicon'] : '0' ;
430
+ }
431
+ }
432
+
433
+ } else { // 外部サイト
434
+ $wrap_op = '<div class="lkc-external-wrap">'; // ラッピング
435
+ $wrap_cl = '</div>';
436
+ $info = isset($this->options['ex-info']) ? $this->options['ex-info'] : '' ;
437
+ $sw_thumbnail = isset($this->options['ex-thumbnail']) ? $this->options['ex-thumbnail'] : '0' ;
438
+ $sw_favicon = isset($this->options['ex-favicon']) ? $this->options['ex-favicon'] : '0' ;
439
+
440
+ if (isset($this->options['use-hatena']) && !is_null($this->options['use-hatena'])) {
441
+ // 「はてなブログカード」をそのまま利用する
442
+ $tag = '<div class="lkc-iframe-wrap"><iframe src="http://hatenablog.com/embed?url='.$url.'" class="lkc-iframe" scrolling="no" frameborder="0"></iframe></div>';
443
+ if (isset($this->options['blockquote']) ? $this->options['blockquote'] : null == '1') {
444
+ $tag = '<div class="'.$class_id.'"><blockquote class="lkc-quote">'.$tag.'</blockquote></div>';
445
+ } else {
446
+ $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
447
+ }
448
+ return $tag;
449
+
450
+ } elseif (is_null($data_id) || (isset($atts['force']) && $atts['force'] == true)) { // キャッシュ無、または前回エラー
451
+ // リンク先サイト取得
452
+ $html = null;
453
+ $error = true;
454
+
455
+ if (function_exists('curl_init')) {
456
+ $ch = curl_init($url);
457
+ // curl_setopt($ch, CURLOPT_TIMEOUT, 8);
458
+ curl_setopt($ch, CURLOPT_USERAGENT, esc_html($_SERVER['HTTP_USER_AGENT']));
459
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
460
+ curl_setopt($ch, CURLOPT_MAXREDIRS, 3);
461
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
462
+ if (isset($this->options['flg-ssl']) ? $this->options['flg-ssl'] : null) {
463
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // SSL検証なし
464
+ } else {
465
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); // SSL検証あり
466
+ }
467
+ $html = curl_exec($ch);
468
+ if (curl_errno($ch)) {
469
+ $html = '';
470
+ $result_code = 0 - intval(curl_errno($ch));
471
+ } else {
472
+ $header = curl_getinfo($ch);
473
+ $result_code = $header['http_code'];
474
+ }
475
+ curl_close($ch);
476
+ } else {
477
+ $result = wp_remote_get($url);
478
+ if (!is_wp_error($result)) {
479
+ $html = $result['body'];
480
+ $result_code = $result['response']['code'];
481
+ } else {
482
+ $html = '';
483
+ $result_code = -1;
484
+ }
485
+ }
486
+ $charset = null;
487
+ if ($html <> '') {
488
+ if (preg_match('/charset\s*=\s*([^>\/\s]*).*<\/head/si', $html, $m)) {
489
+ $m[1] = trim(trim($m[1]), '\'\"');
490
+ $charset = $m[1];
491
+ } else {
492
+ foreach(array('UTF-8','SJIS','EUC-JP','eucJP-win','ASCII','JIS','SJIS-win') as $c_charset) {
493
+ if (mb_convert_encoding($html, $this->charset, $c_charset) == $html) {
494
+ $charset = $c_charset;
495
+ break;
496
+ }
497
+ }
498
+ }
499
+ if (is_null($charset)) {
500
+ $charset = 'auto';
501
+ $html = mb_convert_encoding($html, $this->charset, 'ASCII,JIS,UTF-7,EUC-JP,SJIS,UTF-8');
502
+ } elseif ($this->charset <> $charset) {
503
+ $html = mb_convert_encoding($html, $this->charset, $charset);
504
+ }
505
+ }
506
+
507
+ if ($result_code < 0) {
508
+ $error = false;
509
+ $update = true;
510
+ } else {
511
+ $error = false;
512
+ $update = true;
513
+
514
+ $tags = null;
515
+ // HEADタグ
516
+ $head = null;
517
+ $tags = null;
518
+ if (preg_match('/<\s*head\s*[^>]*>(.*)<\s*\/head\s*>/si', $html, $m)) {
519
+ $head = $m[1];
520
+ $tags = $this->pz_GetMeta($head);
521
+ }
522
+
523
+ // タイトル
524
+ if (isset( $tags['og:title'] ) && $tags['og:title'] ) {
525
+ $title = $tags['og:title'] ;
526
+ } elseif (isset( $tags['title'] ) && $tags['title'] ) {
527
+ $title = $tags['title'] ;
528
+ }
529
+
530
+ // 抜粋文・概要文
531
+ if (isset( $tags['og:description'] ) && $tags['og:description'] ) {
532
+ $excerpt = $tags['og:description'] ;
533
+ } elseif (isset( $tags['description'] ) && $tags['description'] ) {
534
+ $excerpt = $tags['description'] ;
535
+ }
536
+
537
+ // // OGPから画像URL取得
538
+ // if ($sw_thumbnail == '1' && isset($tags['og:image'])) {
539
+ // $thumbnail_url = $tags['og:image'];
540
+ // $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
541
+ // }
542
+
543
+ // サイト名
544
+ if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
545
+ $site_name = $tags['og:site_name'] ;
546
+ }
547
+
548
+ if ($result_code <> 200) {
549
+ $title = null;
550
+ }
551
+ }
552
+ }
553
+ }
554
+
555
+ // タイトル整形
556
+ if (isset($title)) {
557
+ $str = $title;
558
+ $str = strip_tags($str); // タグの除去
559
+ $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
560
+ $str = esc_html($str); // 念のためエスケープ
561
+ $str = mb_strimwidth($str, 0, 200, '...'); // 保管用のタイトルは200文字で切る
562
+ $title = $str;
563
+ }
564
+ // 抜粋文整形
565
+ if (isset($excerpt)) {
566
+ $str = $excerpt;
567
+ $str = strip_tags($str); // タグの除去
568
+ $str = preg_replace('/<!--more-->.+/is', '', $str); // moreタグ以降削除
569
+ $str = preg_replace('/\[[^]]*\]/', '', $str); // ショートコードすべて除去
570
+ $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
571
+ $str = esc_html($str); // 念のためエスケープ
572
+ $str = mb_strimwidth($str, 0, 500, '...'); // 保管用の記事内容は500文字で切る
573
+ $excerpt = $str;
574
+ }
575
+
576
+ // 取得エラーなし・取得または更新あり
577
+ if (!$error && $update && $url) {
578
+ if (isset($data_id) && !is_null($data_id)) {
579
+ $data['id'] = $data_id;
580
+ }
581
+ if (isset($url_key) && !is_null($url_key)) {
582
+ $data['url_key'] = $url_key;
583
+ }
584
+ $data['url'] = $url;
585
+ $data['link_type'] = $link_type;
586
+ $data['site_name'] = $site_name;
587
+ $data['domain'] = $domain;
588
+ $data['title'] = $title;
589
+ $data['excerpt'] = $excerpt;
590
+ $data['charset'] = $charset;
591
+ $data['thumbnail'] = $thumbnail_url;
592
+ $data['favicon'] = $favicon_url;
593
+ $data['result_code'] = $result_code;
594
+ $data['sns_twitter'] = $sns_tw;
595
+ $data['sns_facebook'] = $sns_fb;
596
+ $data['sns_hatena'] = $sns_hb;
597
+ $data['uptime'] = $uptime;
598
+ $data['nexttime'] = $nexttime;
599
+ // $data['psc_code'] = $result_code;
600
+ // $data['psc_last'] = $uptime;
601
+ if (isset($atts['force']) && $atts['force'] == true) {
602
+ $data['regist'] = current_time('mysql'); // 登録日
603
+ }
604
+
605
+ $data = $this->pz_SetCache($data);
606
+ wp_schedule_single_event(time() + 10, 'pz_linkcard_check');
607
+
608
+ if (isset($data['id'])) {
609
+ $update = false;
610
+ }
611
+ }
612
+
613
+ // サムネイル取得
614
+ if (!$this->options['thumbnail-position'] || $error) {
615
+ $thumbnail = null;
616
+ } else {
617
+ if ($sw_thumbnail == '3') {
618
+ // 画像取得
619
+ if (isset($this->options['thumbnail-api'])) {
620
+ $thumbnail = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['thumbnail-api'] );
621
+ $thumbnail = preg_replace('/%DOMAIN%/', $domain, $thumbnail);
622
+ $thumbnail = preg_replace('/%URL%/', rawurlencode($url), $thumbnail);
623
+ $thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail.'" alt="" />';
624
+ }
625
+ }
626
+ }
627
+
628
+ // ファビコン取得
629
+ if (!isset($this->options['info-position'])) {
630
+ $favicon = null;
631
+ } else{
632
+ if ($sw_favicon == '3') {
633
+ // サイトアイコン取得
634
+ if (isset($this->options['favicon-api'])) {
635
+ $favicon = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['favicon-api'] );
636
+ $favicon = preg_replace('/%DOMAIN%/', $domain, $favicon);
637
+ $favicon = preg_replace('/%URL%/', rawurlencode($url), $favicon);
638
+ $favicon = '<img class="lkc-favicon" src="'.$favicon.'" alt="" />';
639
+ }
640
+ }
641
+ }
642
+
643
+ // データベースへの保存が終わったので、表示用の編集
644
+
645
+ // タイトル
646
+ if (!isset($title) || $title == '') {
647
+ $title = esc_html($url); // タイトル取得できていなかったらURLをセットする
648
+ }
649
+
650
+ // パラメータ取得(タイトル・抜粋文)
651
+ if (isset($atts['title'])) { // titleパラメータ
652
+ $title = $atts['title'];
653
+ $excerpt = '';
654
+ }
655
+ if ($excerpt == '') {
656
+ if (isset($atts['content'])) { // contrentパラメータ
657
+ $excerpt = $atts['content'];
658
+ } elseif (isset($atts['contents'])) { // contentsパラメータ
659
+ $excerpt = $atts['contents'];
660
+ } elseif (isset($atts['description'])) { // descriptionパラメータ
661
+ $excerpt = $atts['description'];
662
+ }
663
+ }
664
+
665
+ // タイトル整形
666
+ if (isset($title)) {
667
+ $str = $title;
668
+ $str = strip_tags($str); // タグの除去
669
+ $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
670
+ $str = esc_html($str); // 念のためエスケープ
671
+ $str = mb_strimwidth($str, 0, (isset($this->options['trim-title']) ? $this->options['trim-title'] : $this->defaults['trim-title'] ) , '...');
672
+ $title = $str;
673
+ }
674
+
675
+ // 抜粋文整形
676
+ // 抜粋文非表示の場合、空欄にする
677
+ if (!isset($this->options['display-excerpt']) || is_null($this->options['display-excerpt'])) {
678
+ $excerpt = '';
679
+ } else {
680
+ if (isset($excerpt)) {
681
+ $str = $excerpt;
682
+ $str = strip_tags($str); // タグの除去
683
+ $str = preg_replace('/<!--more-->.+/is', '', $str); // moreタグ以降削除
684
+ $str = preg_replace('/\[[^]]*\]/', '', $str); // ショートコードすべて除去
685
+ $str = str_replace(array("\r", "\n"), '', $str); // 改行削除
686
+ $str = esc_html($str); // 念のためエスケープ
687
+ $str = mb_strimwidth($str, 0, (isset($this->options['trim-count']) ? $this->options['trim-count'] : $this->defaults['trim-count'] ) , '...');
688
+ $excerpt = $str;
689
+ }
690
+ }
691
+
692
+ // サイト名称を使わない場合、ドメイン名で上書き
693
+ $site_title = '';
694
+ if ((isset($this->options['use-sitename']) ? $this->options['use-sitename'] : null) && $site_name) {
695
+ $c_site_name = $site_name;
696
+ $site_name = mb_strimwidth($site_name, 0, (isset($this->options['trim-sitename']) ? $this->options['trim-sitename'] : $this->defaults['trim-sitename'] ) , '...');
697
+ if ($site_name <> $c_site_name) {
698
+ $site_title = ' title="'.$c_site_name.'"';
699
+ }
700
+ } else {
701
+ $site_name = $domain;
702
+ }
703
+
704
+ // リンク先URL
705
+ $a_op = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
706
+ $a_cl = '</a>';
707
+ if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
708
+ $a_op_all = $a_op;
709
+ $a_cl_all = $a_cl;
710
+ $a_op = '';
711
+ $a_cl = '';
712
+ } else {
713
+ $a_op_all = '';
714
+ $a_cl_all = '';
715
+ }
716
+
717
+ // ソーシャルカウント(class="no_icon"は他プラグインの対応)
718
+ $sns = null;
719
+ $sns_info = null;
720
+ $sns_title = null;
721
+ if (!$error && (isset($this->options['sns-position']) ? $this->options['sns-position'] : null)) {
722
+ $sns = '<span class="lkc-share">';
723
+ if ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
724
+ if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
725
+ $sns .= ' <span class="lkc-sns-tw no_icon">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</span>';
726
+ }
727
+ if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
728
+ $sns .= ' <span class="lkc-sns-fb no_icon">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</span>';
729
+ }
730
+ if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
731
+ $sns .= ' <span class="lkc-sns-hb no_icon">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</span>';
732
+ }
733
+ } else {
734
+ if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw']) && $sns_tw > 0) {
735
+ $sns .= ' <a class="lkc-sns-tw no_icon" href="https://twitter.com/intent/tweet?url=' .rawurlencode($url).'&text='.esc_html($title).'" target="_blank">'.$sns_tw.'&nbsp;tweet'.(($sns_tw > 1) ? 's' : '').'</a>';
736
+ }
737
+ if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb']) && $sns_fb > 0) {
738
+ $sns .= ' <a class="lkc-sns-fb no_icon" href="https://www.facebook.com/sharer/sharer.php?u=' .rawurlencode($url).'" target="_blank">'.$sns_fb.'&nbsp;share'.(($sns_fb > 1) ? 's' : '').'</a>';
739
+ }
740
+ if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb']) && $sns_hb > 0) {
741
+ $sns .= ' <a class="lkc-sns-hb no_icon" href="http://b.hatena.ne.jp/entry/' .rawurlencode($url).'" target="_blank">'.$sns_hb.'&nbsp;user'.(($sns_hb > 1) ? 's' : '').'</a>';
742
+ }
743
+ }
744
+ $sns .= '</span>';
745
+
746
+ if ($this->options['sns-position'] == '1') {
747
+ $sns_title = $sns;
748
+ } else {
749
+ $sns_info = $sns;
750
+ }
751
+ }
752
+
753
+ // サムネイル
754
+ if ($thumbnail) {
755
+ $thumbnail = '<span class="lkc-thumbnail">'.$thumbnail.'</span>';
756
+ }
757
+ // サイト情報
758
+ $domain_info = '<div class="lkc-info">'.$a_op.'<span class="lkc-domain"'.$site_title.'>'.$favicon.'&nbsp;'.$site_name.$info.'</span>'.$a_cl.'&nbsp;'.$sns_info.$this->plugin_link.'</div>';
759
+
760
+ // 記事内容
761
+ $content = '<div class="lkc-content">'.$a_op.$thumbnail.'<span class="lkc-title">'.$title.'</span>'.$a_cl.$sns_title.'<div class="lkc-url"><cite>'.$a_op.$url.$a_cl.'</cite></div><div class="lkc-excerpt">'.$excerpt.'</div></div>';
762
+
763
+ // HTMLタグ作成
764
+ switch (isset($this->options['info-position']) ? $this->options['info-position'] : null) {
765
+ case '1':
766
+ $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$domain_info.$content.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
767
+ break;
768
+ case '2':
769
+ $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$content.$domain_info.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
770
+ break;
771
+ default:
772
+ $tag = $a_op_all.$wrap_op.'<div class="lkc-card">'.$content.'<div class="clear"></div></div>'.$wrap_cl.$a_cl_all;
773
+ }
774
+
775
+ // 引用文扱い
776
+ if (isset($this->options['blockquote']) ? $this->options['blockquote'] : null == '1') {
777
+ $tag = '<div class="'.$class_id.'"><blockquote class="lkc-quote">'.$tag.'</blockquote></div>';
778
+ } else {
779
+ $tag = '<div class="'.$class_id.'">'.$tag.'</div>';
780
+ }
781
+
782
+ // 実行時間
783
+ if (is_user_logged_in()) {
784
+ if (isset($this->options['debug-time'])) {
785
+ $end_time = microtime(true);
786
+ $elasped_time = number_format($end_time - $start_time, 8, '.', ',');
787
+ $tag = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$tag.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
788
+ }
789
+ }
790
+ return $tag;
791
+ }
792
+
793
+ public function pz_RenewSNSCount($data) {
794
+ if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
795
+ return null;
796
+ }
797
+ if (!isset($data) || !is_array($data)) {
798
+ return null;
799
+ }
800
+
801
+ $data = $this->pz_GetCache($data);
802
+ if (!isset($data) || !is_array($data)) {
803
+ return null;
804
+ }
805
+
806
+ // ソーシャルカウント
807
+ $sns_renew = false;
808
+ $update_cnt = false;
809
+
810
+ // タイムオーバー
811
+ $opt = array( 'timeout' => 30 );
812
+
813
+ // 保存期間満了でソーシャルカウントをリセット
814
+ $now = current_time('timestamp');
815
+ if ($now > $data['nexttime'] && $data['result_code'] <= 200 ) {
816
+ $sns_renew = true;
817
+ }
818
+
819
+ // Twitter count.json 2015/11/21 非公式サービス終了に伴い停止→代替APIへ変更
820
+ if (isset($this->options['sns-tw']) && !is_null($this->options['sns-tw'])) {
821
+ $count_before = isset($data['sns_twitter']) ? $data['sns_twitter'] : -1;
822
+ if ($sns_renew || $count_before < 0) {
823
+ // $result = wp_remote_get( 'http://urls.api.twitter.com/1/urls/count.json?url=' .rawurlencode($data['url']), $opt );
824
+ $result = wp_remote_get( 'http://jsoon.digitiminimi.com/twitter/count.json?url=' .rawurlencode($data['url']), $opt );
825
+ if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
826
+ $count = intval(json_decode($result['body'])->count);
827
+ // if ($count <> $count_before) {
828
+ if ($count > $count_before) {
829
+ $data['sns_twitter'] = $count;
830
+ $update_cnt = true;
831
+ }
832
+ }
833
+ }
834
+ }
835
+
836
+ if (isset($this->options['sns-fb']) && !is_null($this->options['sns-fb'])) {
837
+ $count_before = intval(isset($data['sns_facebook']) ? $data['sns_facebook'] : -1);
838
+ if ($sns_renew || $count_before < 0) {
839
+ $result = wp_remote_get( 'http://graph.facebook.com/?id=' .rawurlencode($data['url']), $opt );
840
+ if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
841
+ $json = json_decode($result['body']);
842
+ $count = intval(isset($json->shares) ? $json->shares : 0);
843
+ if ($count <> $count_before) {
844
+ $data['sns_facebook'] = $count;
845
+ $update_cnt = true;
846
+ }
847
+ }
848
+ }
849
+ }
850
+
851
+ if (isset($this->options['sns-hb']) && !is_null($this->options['sns-hb'])) {
852
+ $count_before = isset($data['sns_hatena']) ? $data['sns_hatena'] : -1;
853
+ if ($sns_renew || $count_before < 0) {
854
+ $result = wp_remote_get( 'http://api.b.st-hatena.com/entry.count?url=' .rawurlencode($data['url']), $opt );
855
+ if (isset($result) && !is_wp_error($result) && $result['response']['code'] == 200) {
856
+ $count = intval($result['body']);
857
+ if ($count <> $count_before) {
858
+ $data['sns_hatena'] = $count;
859
+ $update_cnt = true;
860
+ }
861
+ }
862
+ }
863
+ }
864
+
865
+ if ($update_cnt || ($now - strtotime($data['regist']) < WEEK_IN_SECONDS)) {
866
+ $nexttime = $now + DAY_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 1day + 0-24h
867
+ } else {
868
+ $nexttime = $now + WEEK_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 7days + 0-24h
869
+ }
870
+ // MINUTE_IN_SECONDS = 60
871
+ // HOUR_IN_SECONDS = 60 * MINUTE_IN_SECONDS = 3600
872
+ // DAY_IN_SECONDS = 24 * HOUR_IN_SECONDS = 86400
873
+ // WEEK_IN_SECONDS = 7 * DAY_IN_SECONDS = 604800
874
+ // YEAR_IN_SECONDS = 365 * DAY_IN_SECONDS
875
+
876
+ global $wpdb;
877
+ $wpdb->update(
878
+ $this->db_name,
879
+ array(
880
+ 'sns_twitter' => $data['sns_twitter'],
881
+ 'sns_facebook' => $data['sns_facebook'],
882
+ 'sns_hatena' => $data['sns_hatena'],
883
+ 'uptime' => $now,
884
+ 'nexttime' => $nexttime
885
+ ),
886
+ array(
887
+ 'url_key' => $data['url_key']
888
+ )
889
+ );
890
+ return $data;
891
+ }
892
+
893
+ // キャッシュデータを取得
894
+ public function pz_GetCache($data) {
895
+ if (!isset($data) || !is_array($data)) {
896
+ return null;
897
+ }
898
+ global $wpdb;
899
+ if (isset($data['url']) && !is_null($data['url'])) {
900
+ $url = $this->pz_TrimURL($data['url']);
901
+ $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->db_name WHERE url=%s", $url));
902
+ } elseif (isset($data['id']) && !is_null($data['id'])) {
903
+ $id = intval($data['id']);
904
+ $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->db_name WHERE id=%d", $id));
905
+ } else {
906
+ return null;
907
+ }
908
+ if (is_wp_error($data)) {
909
+ return null;
910
+ }
911
+ return (array) $data; // Arrayに直して戻す
912
+ }
913
+
914
+ // キャッシュデータを保存
915
+ public function pz_SetCache($data) {
916
+ global $wpdb;
917
+ if (!isset($data) || !is_array($data)) {
918
+ return null;
919
+ }
920
+ if (!isset($data['url']) || is_null($data['url'])) {
921
+ return null;
922
+ }
923
+ $url = $this->pz_TrimURL($data['url']);
924
+ $data['url'] = $url;
925
+
926
+ if (!isset($data['url_key']) || is_null($data['url_key']) || $data['url_key'] == '' ) {
927
+ $data['url_key'] = hash('sha256', esc_url($url), true);
928
+ }
929
+
930
+ $data['uptime'] = current_time('timestamp');
931
+ // 更新してみる
932
+ if (isset($data['id']) && !is_null(isset($data['id']))) {
933
+ $result = $wpdb->update(
934
+ $this->db_name,
935
+ $data,
936
+ array(
937
+ 'id' => $data['id']
938
+ )
939
+ );
940
+ } else {
941
+ $result = $wpdb->update(
942
+ $this->db_name,
943
+ $data,
944
+ array(
945
+ 'url_key' => $data['url_key']
946
+ )
947
+ );
948
+ }
949
+ if (!$result) {
950
+ $data['regist'] = current_time('mysql'); // 登録日
951
+ // 更新できなかったら挿入
952
+ unset($data['id']);
953
+ $result = $wpdb->insert(
954
+ $this->db_name,
955
+ $data
956
+ );
957
+ // 挿入できなかったらエラー終了
958
+ if (!$result) {
959
+ return null;
960
+ }
961
+ }
962
+ return $this->pz_GetCache($data);
963
+ }
964
+
965
+ // キャッシュデータを削除
966
+ public function pz_DelCache($data) {
967
+ global $wpdb;
968
+ if (!isset($data) || !is_array($data)) {
969
+ return null;
970
+ }
971
+ if (isset($data['url']) && !is_null($data['url'])) {
972
+ $url = $this->pz_TrimURL($data['url']);
973
+ $result = $wpdb->delete($this->db_name, array('url' => $url), array('%s') );
974
+ return $result;
975
+ } elseif (isset($data['id']) && !is_null($data['id'])) {
976
+ $data_id = intval($data['id']);
977
+ $result = $wpdb->delete($this->db_name, array('id' => $data_id), array('%d') );
978
+ return $result;
979
+ }
980
+ return null;
981
+ }
982
+
983
+ // TITLEとMETAタグを分解
984
+ function pz_GetMeta($html, $tags = null, $clear = false) {
985
+ if ($clear == true || !isset($tags)) {
986
+ $tags = null;
987
+ $tags = array('none' => 'none');
988
+ }
989
+
990
+ // TITLEタグ
991
+ if (preg_match('/<\s*title\s*[^>]*>\s*(.*)\s*<\s*\/title\s*[^>]*>/si', $html, $m)) {
992
+ $tags['title'] = esc_html($m[1]);
993
+ }
994
+
995
+ // metaタグ パース
996
+ $match = null;
997
+ preg_match_all('/<\s*meta\s(?=[^>]*?\b(?:name|property)\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=)))[^>]*?\bcontent\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=))[^>]*>/is', $html, $match);
998
+ if (isset($match) && is_array($match) && count($match) == 3 && count($match[1]) > 0) {
999
+ $tags += array_combine($match[1], $match[2]);
1000
+ }
1001
+
1002
+ return $tags;
1003
+ }
1004
+
1005
+ // 管理画面時のスタイルシート、スクリプト設定
1006
+ public function enqueue_admin($hook) {
1007
+ wp_enqueue_style ('wp-color-picker');
1008
+ wp_enqueue_script ('colorpicker-script', plugins_url('color-picker.js', __FILE__), array('wp-color-picker'), false, true);
1009
+ }
1010
+
1011
+ // 通常時のスタイルシート
1012
+ public function enqueue($hook) {
1013
+ if (!isset($this->options['style'])) {
1014
+ wp_enqueue_style ('pz-linkcard', $this->options['css-url']);
1015
+ } else {
1016
+ if (isset($this->options['css-file'])) {
1017
+ wp_enqueue_style('pz-linkcard', $this->options['css-file']);
1018
+ }
1019
+ }
1020
+ }
1021
+
1022
+ // 管理画面のサブメニュー追加
1023
+ public function add_menu() {
1024
+ add_management_page (__('LinkCard cache manager', $this->text_domain),__('Pz LkC Cache', $this->text_domain),'manage_options', 'pz-linkcard-cache', array($this, 'page_cacheman') );
1025
+ add_options_page (__('LinkCard Settings', $this->text_domain),__('Pz LinkCard', $this->text_domain),'manage_options', 'pz-linkcard-settings', array($this, 'page_settings') );
1026
+ }
1027
+
1028
+ // WP-CRONスケジュール(SNSカウント取得)
1029
+ public function schedule_hook_sns() {
1030
+ if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
1031
+ return null;
1032
+ }
1033
+
1034
+ global $wpdb;
1035
+ $now = current_time('timestamp');
1036
+ $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,nexttime FROM $this->db_name WHERE nexttime<%d ORDER BY nexttime ASC", $now));
1037
+ $i = 0;
1038
+ if (isset($result) && is_array($result) && count($result) > 0) {
1039
+ foreach($result as $data) {
1040
+ $i++;
1041
+ if ($i > 10) {
1042
+ // wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1043
+ break;
1044
+ }
1045
+ if (isset($data) && isset($data->url)) {
1046
+ $data = $this->pz_RenewSNSCount(array('url' => $data->url) );
1047
+ }
1048
+ }
1049
+ }
1050
+ }
1051
+
1052
+
1053
+ // WP-CRONスケジュール(存在チェック)
1054
+ public function schedule_hook_alive() {
1055
+ if (!isset($this->options['flg-alive']) || $this->options['flg-alive'] == '') {
1056
+ return null;
1057
+ }
1058
+
1059
+ // result_code
1060
+ // new_code
1061
+
1062
+ // (まだ作ってない)
1063
+ global $wpdb;
1064
+ $now = current_time('timestamp');
1065
+
1066
+
1067
+ $result = (array) $wpdb->get_results($wpdb->prepare("SELECT url,nexttime FROM $this->db_name WHERE nexttime<%d ORDER BY nexttime ASC", $now));
1068
+
1069
+
1070
+ $i = 0;
1071
+ if (isset($result) && is_array($result) && count($result) > 0) {
1072
+ foreach($result as $data) {
1073
+ $i++;
1074
+ if ($i > 10) {
1075
+ // wp_schedule_single_event(time() + 30, 'pz_linkcard_check');
1076
+ break;
1077
+ }
1078
+ if (isset($data) && isset($data->url)) {
1079
+ $data = $this->pz_RenewSNSCount(array('url' => $data->url) );
1080
+ }
1081
+ }
1082
+ }
1083
+ }
1084
+
1085
+ // Pz カード管理 キャッシュ・マネージャ
1086
+ public function page_cacheman() {
1087
+ require_once ('pz-linkcard-cacheman.php');
1088
+ }
1089
+
1090
+ public function page_settings() {
1091
+ require_once ('pz-linkcard-settings.php');
1092
+ }
1093
+
1094
+ public function activation() {
1095
+ $this->options = get_option('Pz_LinkCard_options', $this->defaults);
1096
+ if ($this->options['plugin-version'] < '1.0.2') {
1097
+ $this->options['sns-tw'] =$this->options['sns-twitter'];
1098
+ $this->options['sns-fb'] =$this->options['sns-facebook'];
1099
+ $this->options['sns-hb'] =$this->options['sns-hatena'];
1100
+ }
1101
+ // $this->options += $this->defaults;
1102
+
1103
+ foreach ($this->defaults as $key => $value) {
1104
+ if (!isset($this->options[$key])) {
1105
+ $this->options[$key] = null;
1106
+ }
1107
+ }
1108
+
1109
+ $this->options['plugin-version'] = $this->defaults['plugin-version'];
1110
+ update_option('Pz_LinkCard_options', $this->options);
1111
+
1112
+ require_once ('pz-linkcard-style.php');
1113
+
1114
+ global $wpdb;
1115
+ $wpdb->hide_errors();
1116
+ $this->db_name = $wpdb->prefix.'pz_linkcard';
1117
+ $sql = "CREATE TABLE ".$this->db_name." (
1118
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT,
1119
+ url_key VARBINARY(255) NOT NULL,
1120
+ url VARCHAR(2048) NOT NULL DEFAULT '',
1121
+ link_type INT UNSIGNED,
1122
+ site_name VARCHAR(100) ,
1123
+ domain VARCHAR(253) ,
1124
+ title VARCHAR(200) ,
1125
+ excerpt VARCHAR(500) ,
1126
+ charset VARCHAR(32) ,
1127
+ thumbnail VARCHAR(2048) ,
1128
+ favicon VARCHAR(2048) ,
1129
+ result_code INT ,
1130
+ new_code INT ,
1131
+ post_id INT UNSIGNED,
1132
+ sns_twitter INT ,
1133
+ sns_facebook INT ,
1134
+ sns_hatena INT ,
1135
+ uptime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1136
+ nexttime BIGINT UNSIGNED NOT NULL DEFAULT 0,
1137
+ regist DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
1138
+ PRIMARY KEY ( id ),
1139
+ UNIQUE KEY ( url_key )
1140
+ ) ".$wpdb->get_charset_collate()." ;";
1141
+ require_once (ABSPATH.'wp-admin/includes/upgrade.php');
1142
+ dbDelta($sql);
1143
+
1144
+ wp_clear_scheduled_hook('pz_linkcard_check');
1145
+ wp_schedule_event(time() + 30, 'hourly', 'pz_linkcard_check');
1146
+ }
1147
+
1148
+ public function deactivation() {
1149
+ wp_clear_scheduled_hook('pz_linkcard_check');
1150
+ }
1151
+
1152
+ public function action_links($links) {
1153
+ $links = array('<a href="options-general.php?page=pz-linkcard-settings">'.__('Settings', $this->text_domain).'</a>' , '<a href="tools.php?page=pz-linkcard-cache">'.__('Manage', $this->text_domain).'</a>' ) + $links;
1154
+ return $links;
1155
+ }
1156
+ }
1157
  $Pz_LinkCard = new Pz_LinkCard;
readme.txt CHANGED
@@ -171,6 +171,13 @@ A5.
171
 
172
  == Changelog ==
173
 
 
 
 
 
 
 
 
174
  = 1.6.9 =
175
  * Compatible with WordPress 4.5.3.
176
  * Modefied: Scaled down to fit the screen size in setting. Default change `disabled` to `enabled`.
@@ -183,7 +190,7 @@ A5.
183
  * 表示幅によってサムネイルを調整する「幅に合わせて縮小」を初期選択するように変更。
184
  * Twitter代替API count.jsoon を使用するように変更。
185
  * 内部リンクのときでWordPress標準のサイトアイコンが設定されていない場合、内部取得を選べないように修正。(Thanks @meiko2285)
186
- * 内部リンクのときでサムネイル(アイキャッチ)が設定されていない場合、WebAPIを利用する設定を追加。(Thanks @fumiegl
187
  * SSL証明書の検証を無効にする機能を設定に追加。
188
 
189
  * リンク切れチェック(準備中)(Thanks @misoji_13)
171
 
172
  == Changelog ==
173
 
174
+ = 1.7.0 =
175
+ * Added: Added setting. `In the case of domain names, to ignore the trailing-slash`.
176
+ * Added: Added border `Wheat'.
177
+
178
+ * ドメイン名のみのときに最後のスラッシュを削除する機能を追加。(Thanks @toru1231)
179
+ * 定型書式に「小麦色」を追加。(Thanks @fumieblog)
180
+
181
  = 1.6.9 =
182
  * Compatible with WordPress 4.5.3.
183
  * Modefied: Scaled down to fit the screen size in setting. Default change `disabled` to `enabled`.
190
  * 表示幅によってサムネイルを調整する「幅に合わせて縮小」を初期選択するように変更。
191
  * Twitter代替API count.jsoon を使用するように変更。
192
  * 内部リンクのときでWordPress標準のサイトアイコンが設定されていない場合、内部取得を選べないように修正。(Thanks @meiko2285)
193
+ * 内部リンクのときでサムネイル(アイキャッチ)が設定されていない場合、WebAPIを利用する設定を追加。(Thanks @fumieblog
194
  * SSL証明書の検証を無効にする機能を設定に追加。
195
 
196
  * リンク切れチェック(準備中)(Thanks @misoji_13)