⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gentlesource_module_cron.class.inc.php

📁 This is the script which used on 10minutemail.com for temporary email.
💻 PHP
字号:
<?php

/** 
 * GentleSource Comment Script
 * 
 * (C) Ralf Stadtaus http://www.gentlesource.com/
 * 
 * Version 1.1.0
 */




/**
 * Mail comments to admin
 */
class gentlesource_module_cron extends gentlesource_module_common
{


    /**
     * Text of language file
     */
    var $text = array();

// -----------------------------------------------------------------------------




    /**
     *  Setup
     * 
     * @access public
     */
    function gentlesource_module_cron()
    {
        $this->text = $this->load_language();
        
        // Configuration
        $this->add_property('name',         $this->text['txt_module_name']);
        $this->add_property('description',  $this->text['txt_module_description']);
        $this->add_property('trigger',  
                                array(  
                                        'core'
                                        )
                                );
        
        // Settings to be allowed to read from and write to database
        $this->add_property('setting_names',  
                                array(  
                                        'module_cron_active',
                                        'module_cron_url',
                                        'module_cron_time',
                                        'module_cron_last',
                                        )
                                );
        
        // Default values
        $this->add_property('module_cron_active',   'N');
        $this->add_property('module_cron_time',     60); // Seconds
        
        // Get settings from database
        $this->get_settings();
        
        // Set module status 
        $this->status('module_referrer_log_active', 'N');
    }

// -----------------------------------------------------------------------------




    /**
     *  Administration
     * 
     * @access public
     */
    function administration()
    {
        $form = array();
        
        $form['module_cron_active'] = array(
            'type'          => 'bool',
            'label'         => $this->text['txt_enable_module'],
            'description'   => $this->text['txt_enable_module_description'],
            'required'      => true
            );
        
        $form['module_cron_url'] = array(
            'type'          => 'string',
            'label'         => $this->text['txt_url'],
            'description'   => '',
            'required'      => true
            );
            
        $form['module_cron_time'] = array(
            'type'          => 'string',
            'label'         => $this->text['txt_cron_time'],
            'description'   => '',
            'required'      => true
            );

        return $form;
    }

// -----------------------------------------------------------------------------




    /**
     * Processing the content
     * 
     * @access public
     */
    function process($trigger, &$settings, &$data, &$additional)
    {
        if ($this->get_property('module_cron_active') != 'Y') {
            return false;
        }

        if ($trigger == 'core') {
            
            $time       = $this->get_property('module_cron_time');
            $last       = $this->get_property('module_cron_last');
            $current    = $this->current_timestamp();
            if ($current - $time < $last) {
                return false;
            }
            $this->set_setting('module_cron_last', $this->current_timestamp());
            $filename = $this->get_property('module_cron_url');
            $handle = fopen($filename, 'r');
            $contents = fread($handle, 4096);
            fclose($handle);
        }
    }

// -----------------------------------------------------------------------------




} // End of class








?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -