Plugin Directory

Changeset 3056424


Ignore:
Timestamp:
03/21/2024 11:40:34 PM (2 years ago)
Author:
Tkama
Message:

Update to version 4.0.0 from GitHub

Location:
kama-clic-counter
Files:
160 added
18 deleted
14 edited
1 copied

Legend:

Unmodified
Added
Removed
  • kama-clic-counter/assets/icon-128x128.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/assets/icon-256x256.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/assets/screenshot-1.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/assets/screenshot-2.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/assets/screenshot-3.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/assets/screenshot-4.png

    • Property svn:mime-type changed from application/octet-stream to image/png
  • kama-clic-counter/tags/4.0.0/admin/admin-functions.php

    r2675422 r3056424  
    11<?php
    22
    3 // доступные шоткоды в шаблонах ссылок
    4 function kcc_tpl_available_tags(){
     3namespace KamaClickCounter;
    54
    6     $array = array(
     5/**
     6 * Available shotcodes in link templates.
     7 */
     8function tpl_available_tags(): string {
     9
     10    $array = [
    711        __( 'Shortcodes that can be used in template:', 'kama-clic-counter' ),
    812        __( '[icon_url] - URL to file icon', 'kama-clic-counter' ),
     
    1519        __( '[link_description]', 'kama-clic-counter' ),
    1620        __( '[edit_link] - URL to edit link in admin', 'kama-clic-counter' ),
    17     );
     21    ];
    1822
    1923    $out = '
    20         <div style="font-size:90%;">
    21             <div>'. implode('</div><div>', $array) .'</div>
    22         </div>';
     24    <div style="font-size:90%;">
     25        <div>' . implode( '</div><div>', $array ) . '</div>
     26    </div>
     27    ';
    2328
    24     return str_replace( array('[',']'), array('<code>[',']</code>'), $out );
     29    return str_replace( [ '[', ']' ], [ '<code>[', ']</code>' ], $out );
    2530}
     31
     32function get_clicks_per_day( $link ): float {
     33    static $cur_time;
     34    if( $cur_time === null ){
     35        $cur_time = time() + ( get_option( 'gmt_offset' ) * 3600 );
     36    }
     37
     38    return round( ( (int) $link->link_clicks / ( ( $cur_time - strtotime( $link->link_date ) ) / ( 3600 * 24 ) ) ), 1 );
     39}
  • kama-clic-counter/tags/4.0.0/kama_click_counter.php

    r2675422 r3056424  
    99 * Author: Kama
    1010 * Author URI: https://wp-kama.com
    11  * Plugin URI: https://wp-kama.com/?p=77
     11 * Plugin URI: https://wp-kama.com/77
    1212 *
    13  * Requires PHP: 5.4
     13 * Requires PHP: 7.0
     14 * Requires at least: 4.2
    1415 *
    15  * Version: 3.6.10
     16 * Version: 4.0.0
    1617 */
     18
     19namespace KamaClickCounter;
    1720
    1821defined( 'ABSPATH' ) || exit;
    1922
    20 define( 'KCC_VER', get_file_data( __FILE__, [ 'ver' => 'Version' ] )['ver'] );
    21 define( 'KCC_PATH', plugin_dir_path( __FILE__ ) );
    22 define( 'KCC_URL', plugin_dir_url( __FILE__ ) );
    23 define( 'KCC_NAME', basename( KCC_PATH ) );
     23require_once __DIR__ . '/autoload.php';
     24require_once __DIR__ . '/admin/admin-functions.php';
    2425
    25 require_once KCC_PATH . 'class-KCCounter.php';
    26 require_once KCC_PATH . 'class-KCCounter_Admin.php';
    27 require_once KCC_PATH . '_backward-compatibility.php';
     26register_activation_hook( __FILE__, [ plugin(), 'activation' ] );
    2827
     28add_action( 'plugins_loaded', [ plugin(), 'init' ] );
    2929
    30 // init
    31 add_action( 'plugins_loaded', 'KCCounter_init' );
     30function plugin(): Plugin {
     31    static $instance;
     32    $instance || $instance = new Plugin( __FILE__ );
    3233
    33 
    34 register_activation_hook( __FILE__, function(){
    35     KCCounter()->activation();
    36 } );
    37 
    38 /**
    39  * Init the KCC plugin.
    40  */
    41 function KCCounter_init(){
    42     load_plugin_textdomain( 'kama-clic-counter', false, KCC_NAME . '/languages' );
    43 
    44     KCCounter();
     34    return $instance;
    4535}
    4636
    4737
    48 /**
    49  * Get main class instance.
    50  *
    51  * @return KCCounter|KCCounter_Admin
    52  */
    53 function KCCounter(){
    54     return KCCounter::instance();
    55 }
    56 
    57 
  • kama-clic-counter/tags/4.0.0/readme.txt

    r2675422 r3056424  
     1
    12=== Plugin Name ===
    23Stable tag: trunk
    3 Tested up to: 5.3.2
     4Tested up to: 6.4.3
    45Contributors: Tkama
    5 Tags: analytics, statistics, count, count clicks, clicks, counter, download, downloads, link, kama
    6 Requires at least: 3.6
     6Tags: analytics, statistics, count clicks, counter
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Count clicks on any link all over the site. Creates beautiful file download block in post content. Has top downloads widget.
     10Count clicks on any link all over the site. Creates beautiful file download block in post content. Has top downloads' widget.
    1111
    1212
     
    4343
    4444
    45 
    46 ==== TODO ====
    47 
    48 * set filename in shortcode itself. Можно ли как то сделать чтобы в шорткод вставлялась и ссылка с именем файла, чтобы не на отдельной странице имя файла править
    49 
    50 * detail statistic on each day (PRO version)
    51 
    52 * tiny mce button click show url field and button to select file from media library
    53 
    54 * Когда пользователь нажимает на кнопку DW, появляющаяся адресная строка вводит любого пользователя в ступор, в итоге все пользуются стандартной кнопкой, а плагин неиспользуется вообще.. Диалог редактирования ссылки из настроек прикрутить бы к кнопке DW в редакторе.. И в самом диалоге прикрутить стандартный диалог прикрепления файла (в нем же можно и с локального компьютера и из медиатеки цеплять - пользователи же уже привыкли).. Страница статистики расположенная в Настройках - нелогичное решение, несмотря на то, что там и настройки тоже есть. Ее место либо вообще в главном меню (чего я сам не люблю), либо в Инструменты или Медиафайлы. И сама аббревиатура DW на кнопке неинтуитивная, иконку бы, могу поискать..
    55 
    56 hotlink protection
    57 <IfModule mod_rewrite.c>
    58 RewriteEngine on
    59 RewriteBase /
    60 RewriteCond %{HTTP_REFERER} !^$
    61 RewriteCond %{HTTP_REFERER} !^https?://.*wptest\.ru/ [NC]
    62 RewriteRule \.(zip|7z|exe)$ - [NC,F,L]
    63 </IfModule>
    64 
    65 
    66 
    67 
    68 
    6945== Changelog ==
     46
     47= 4.0.0 =
     48* Requires PHP >= 7.0.
     49* Backcompat removed.
     50* Code refactored.
     51* PHP class autoloader added.
     52* PHP namespaces added.
     53* Filter `kcc_admin_access` renamed to `kcc_manage_access`.
     54* Filter `parce_kcc_url` renamed to `click_counter__parse_kcc_url`.
     55* Filter `get_url_icon` renamed to `click_counter__get_icon_url`.
    7056
    7157= 3.6.10 =
  • kama-clic-counter/tags/4.0.0/uninstall.php

    r2675422 r3056424  
    44}
    55
    6 // проверка пройдена успешно. Начиная от сюда удаляем опции и все остальное.
    76global $wpdb;
    87
  • kama-clic-counter/trunk/admin/admin-functions.php

    r2675422 r3056424  
    11<?php
    22
    3 // доступные шоткоды в шаблонах ссылок
    4 function kcc_tpl_available_tags(){
     3namespace KamaClickCounter;
    54
    6     $array = array(
     5/**
     6 * Available shotcodes in link templates.
     7 */
     8function tpl_available_tags(): string {
     9
     10    $array = [
    711        __( 'Shortcodes that can be used in template:', 'kama-clic-counter' ),
    812        __( '[icon_url] - URL to file icon', 'kama-clic-counter' ),
     
    1519        __( '[link_description]', 'kama-clic-counter' ),
    1620        __( '[edit_link] - URL to edit link in admin', 'kama-clic-counter' ),
    17     );
     21    ];
    1822
    1923    $out = '
    20         <div style="font-size:90%;">
    21             <div>'. implode('</div><div>', $array) .'</div>
    22         </div>';
     24    <div style="font-size:90%;">
     25        <div>' . implode( '</div><div>', $array ) . '</div>
     26    </div>
     27    ';
    2328
    24     return str_replace( array('[',']'), array('<code>[',']</code>'), $out );
     29    return str_replace( [ '[', ']' ], [ '<code>[', ']</code>' ], $out );
    2530}
     31
     32function get_clicks_per_day( $link ): float {
     33    static $cur_time;
     34    if( $cur_time === null ){
     35        $cur_time = time() + ( get_option( 'gmt_offset' ) * 3600 );
     36    }
     37
     38    return round( ( (int) $link->link_clicks / ( ( $cur_time - strtotime( $link->link_date ) ) / ( 3600 * 24 ) ) ), 1 );
     39}
  • kama-clic-counter/trunk/kama_click_counter.php

    r2675422 r3056424  
    99 * Author: Kama
    1010 * Author URI: https://wp-kama.com
    11  * Plugin URI: https://wp-kama.com/?p=77
     11 * Plugin URI: https://wp-kama.com/77
    1212 *
    13  * Requires PHP: 5.4
     13 * Requires PHP: 7.0
     14 * Requires at least: 4.2
    1415 *
    15  * Version: 3.6.10
     16 * Version: 4.0.0
    1617 */
     18
     19namespace KamaClickCounter;
    1720
    1821defined( 'ABSPATH' ) || exit;
    1922
    20 define( 'KCC_VER', get_file_data( __FILE__, [ 'ver' => 'Version' ] )['ver'] );
    21 define( 'KCC_PATH', plugin_dir_path( __FILE__ ) );
    22 define( 'KCC_URL', plugin_dir_url( __FILE__ ) );
    23 define( 'KCC_NAME', basename( KCC_PATH ) );
     23require_once __DIR__ . '/autoload.php';
     24require_once __DIR__ . '/admin/admin-functions.php';
    2425
    25 require_once KCC_PATH . 'class-KCCounter.php';
    26 require_once KCC_PATH . 'class-KCCounter_Admin.php';
    27 require_once KCC_PATH . '_backward-compatibility.php';
     26register_activation_hook( __FILE__, [ plugin(), 'activation' ] );
    2827
     28add_action( 'plugins_loaded', [ plugin(), 'init' ] );
    2929
    30 // init
    31 add_action( 'plugins_loaded', 'KCCounter_init' );
     30function plugin(): Plugin {
     31    static $instance;
     32    $instance || $instance = new Plugin( __FILE__ );
    3233
    33 
    34 register_activation_hook( __FILE__, function(){
    35     KCCounter()->activation();
    36 } );
    37 
    38 /**
    39  * Init the KCC plugin.
    40  */
    41 function KCCounter_init(){
    42     load_plugin_textdomain( 'kama-clic-counter', false, KCC_NAME . '/languages' );
    43 
    44     KCCounter();
     34    return $instance;
    4535}
    4636
    4737
    48 /**
    49  * Get main class instance.
    50  *
    51  * @return KCCounter|KCCounter_Admin
    52  */
    53 function KCCounter(){
    54     return KCCounter::instance();
    55 }
    56 
    57 
  • kama-clic-counter/trunk/readme.txt

    r2675422 r3056424  
     1
    12=== Plugin Name ===
    23Stable tag: trunk
    3 Tested up to: 5.3.2
     4Tested up to: 6.4.3
    45Contributors: Tkama
    5 Tags: analytics, statistics, count, count clicks, clicks, counter, download, downloads, link, kama
    6 Requires at least: 3.6
     6Tags: analytics, statistics, count clicks, counter
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    99
    10 Count clicks on any link all over the site. Creates beautiful file download block in post content. Has top downloads widget.
     10Count clicks on any link all over the site. Creates beautiful file download block in post content. Has top downloads' widget.
    1111
    1212
     
    4343
    4444
    45 
    46 ==== TODO ====
    47 
    48 * set filename in shortcode itself. Можно ли как то сделать чтобы в шорткод вставлялась и ссылка с именем файла, чтобы не на отдельной странице имя файла править
    49 
    50 * detail statistic on each day (PRO version)
    51 
    52 * tiny mce button click show url field and button to select file from media library
    53 
    54 * Когда пользователь нажимает на кнопку DW, появляющаяся адресная строка вводит любого пользователя в ступор, в итоге все пользуются стандартной кнопкой, а плагин неиспользуется вообще.. Диалог редактирования ссылки из настроек прикрутить бы к кнопке DW в редакторе.. И в самом диалоге прикрутить стандартный диалог прикрепления файла (в нем же можно и с локального компьютера и из медиатеки цеплять - пользователи же уже привыкли).. Страница статистики расположенная в Настройках - нелогичное решение, несмотря на то, что там и настройки тоже есть. Ее место либо вообще в главном меню (чего я сам не люблю), либо в Инструменты или Медиафайлы. И сама аббревиатура DW на кнопке неинтуитивная, иконку бы, могу поискать..
    55 
    56 hotlink protection
    57 <IfModule mod_rewrite.c>
    58 RewriteEngine on
    59 RewriteBase /
    60 RewriteCond %{HTTP_REFERER} !^$
    61 RewriteCond %{HTTP_REFERER} !^https?://.*wptest\.ru/ [NC]
    62 RewriteRule \.(zip|7z|exe)$ - [NC,F,L]
    63 </IfModule>
    64 
    65 
    66 
    67 
    68 
    6945== Changelog ==
     46
     47= 4.0.0 =
     48* Requires PHP >= 7.0.
     49* Backcompat removed.
     50* Code refactored.
     51* PHP class autoloader added.
     52* PHP namespaces added.
     53* Filter `kcc_admin_access` renamed to `kcc_manage_access`.
     54* Filter `parce_kcc_url` renamed to `click_counter__parse_kcc_url`.
     55* Filter `get_url_icon` renamed to `click_counter__get_icon_url`.
    7056
    7157= 3.6.10 =
  • kama-clic-counter/trunk/uninstall.php

    r2675422 r3056424  
    44}
    55
    6 // проверка пройдена успешно. Начиная от сюда удаляем опции и все остальное.
    76global $wpdb;
    87
Note: See TracChangeset for help on using the changeset viewer.