当前位置: 首页>>代码示例>>PHP>>正文


PHP wfu_decode_plugin_options函数代码示例

本文整理汇总了PHP中wfu_decode_plugin_options函数的典型用法代码示例。如果您正苦于以下问题:PHP wfu_decode_plugin_options函数的具体用法?PHP wfu_decode_plugin_options怎么用?PHP wfu_decode_plugin_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wfu_decode_plugin_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wfu_update_settings

function wfu_update_settings()
{
    if (!current_user_can('manage_options')) {
        return;
    }
    if (!check_admin_referer('wfu_edit_admin_settings')) {
        return;
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $new_plugin_options = array();
    //	$enabled = ( isset($_POST['wfu_enabled']) ? ( $_POST['wfu_enabled'] == "on" ? 1 : 0 ) : 0 );
    $hashfiles = isset($_POST['wfu_hashfiles']) ? $_POST['wfu_hashfiles'] == "on" ? 1 : 0 : 0;
    $relaxcss = isset($_POST['wfu_relaxcss']) ? $_POST['wfu_relaxcss'] == "on" ? 1 : 0 : 0;
    if (isset($_POST['wfu_basedir']) && isset($_POST['wfu_postmethod']) && isset($_POST['submitform'])) {
        if ($_POST['submitform'] == "Update") {
            $new_plugin_options['version'] = '1.0';
            $new_plugin_options['shortcode'] = $plugin_options['shortcode'];
            $new_plugin_options['hashfiles'] = $hashfiles;
            $new_plugin_options['basedir'] = $_POST['wfu_basedir'];
            $new_plugin_options['postmethod'] = $_POST['wfu_postmethod'];
            $new_plugin_options['relaxcss'] = $relaxcss;
            $encoded_options = wfu_encode_plugin_options($new_plugin_options);
            update_option("wordpress_file_upload_options", $encoded_options);
            if ($new_plugin_options['hashfiles'] == '1' && $plugin_options['hashfiles'] != '1') {
                wfu_reassign_hashes();
            }
        }
    }
    return true;
}
开发者ID:RA2WP,项目名称:RA2WP,代码行数:30,代码来源:wfu_admin_settings.php

示例2: wfu_enqueue_frontpage_scripts

function wfu_enqueue_frontpage_scripts()
{
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $relaxcss = false;
    if (isset($plugin_options['relaxcss'])) {
        $relaxcss = $plugin_options['relaxcss'] == '1';
    }
    if ($relaxcss) {
        wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_relaxed.css', false, '1.0', 'all');
        wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_safe_relaxed.css', false, '1.0', 'all');
    } else {
        wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style.css', false, '1.0', 'all');
        wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_safe.css', false, '1.0', 'all');
    }
    wp_enqueue_script('json_class', WPFILEUPLOAD_DIR . 'js/json2.js');
    wp_enqueue_script('wordpress_file_upload_script', WPFILEUPLOAD_DIR . 'js/wordpress_file_upload_functions.js');
}
开发者ID:epis2048,项目名称:wyyhome,代码行数:17,代码来源:wordpress_file_upload.php

示例3: wfu_browse_files

function wfu_browse_files($basedir_code)
{
    $siteurl = site_url();
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $user = wp_get_current_user();
    //store session variables for use from the downloader
    if (!current_user_can('manage_options')) {
        return;
    }
    //first decode basedir_code
    $basedir = wfu_get_filepath_from_safe($basedir_code);
    //clean session array holding dir and file paths if it is too big
    if (isset($_SESSION['wfu_filepath_safe_storage']) && count($_SESSION['wfu_filepath_safe_storage']) > WFU_PHP_ARRAY_MAXLEN) {
        $_SESSION['wfu_filepath_safe_storage'] = array();
    }
    //extract sort info from basedir
    $sort = "";
    if ($basedir !== false) {
        $ret = wfu_extract_sortdata_from_path($basedir);
        $basedir = $ret['path'];
        $sort = $ret['sort'];
    }
    if ($sort == "") {
        $sort = 'name';
    }
    if (substr($sort, 0, 1) == '-') {
        $order = SORT_DESC;
    } else {
        $order = SORT_ASC;
    }
    //adjust basedir to have a standard format
    if ($basedir !== false) {
        if (substr($basedir, -1) != '/') {
            $basedir .= '/';
        }
        if (substr($basedir, 0, 1) == '/') {
            $basedir = substr($basedir, 1);
        }
        //calculate the absolute path of basedir knowing that basedir is relative to website root
        $basedir = wfu_path_rel2abs($basedir);
        if (!file_exists($basedir)) {
            $basedir = false;
        }
    }
    //set basedit to default value if empty
    if ($basedir === false) {
        $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
        $basedir = isset($plugin_options['basedir']) ? $plugin_options['basedir'] : "";
        $temp_params = array('uploadpath' => $basedir, 'accessmethod' => 'normal', 'ftpinfo' => '', 'useftpdomain' => 'false');
        $basedir = wfu_upload_plugin_full_path($temp_params);
    }
    //find relative dir
    $reldir = str_replace(ABSPATH, "root/", $basedir);
    //save dir route to an array
    $parts = explode('/', $reldir);
    $route = array();
    $prev = "";
    foreach ($parts as $part) {
        $part = trim($part);
        if ($part != "") {
            //			if ( $part == 'root' && $prev == "" ) $prev = ABSPATH;
            if ($part == 'root' && $prev == "") {
                $prev = "";
            } else {
                $prev .= $part . '/';
            }
            array_push($route, array('item' => $part, 'path' => $prev));
        }
    }
    //calculate upper directory
    $updir = substr($basedir, 0, -1);
    $delim_pos = strrpos($updir, '/');
    if ($delim_pos !== false) {
        $updir = substr($updir, 0, $delim_pos + 1);
    }
    $echo_str = "\n" . '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "File Browser");
    $echo_str .= "\n\t" . '<div>';
    $echo_str .= "\n\t\t" . '<span><strong>Location:</strong> </span>';
    foreach ($route as $item) {
        // store dir path that we need to pass to other functions in session, instead of exposing it in the url
        $dir_code = wfu_safe_store_filepath($item['path']);
        $echo_str .= '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">' . $item['item'] . '</a>';
        $echo_str .= '<span>/</span>';
    }
    //file browser header
    $echo_str .= "\n\t" . '</div>';
    //	$dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir).'[['.$sort.']]');
    //	$echo_str .= "\n\t".'<a href="'.$siteurl.'/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=create_dir&dir='.$dir_code.'" class="button" title="create folder" style="margin-top:6px">Create folder</a>';
    $echo_str .= "\n\t" . '<div style="margin-top:10px;">';
    $echo_str .= "\n\t\t" . '<table class="wp-list-table widefat fixed striped">';
    $echo_str .= "\n\t\t\t" . '<thead>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
    $dir_code = wfu_safe_store_filepath(wfu_path_abs2rel($basedir) . '[[' . (substr($sort, -4) == 'name' ? $order == SORT_ASC ? '-name' : 'name' : 'name') . ']]');
    $echo_str .= "\n\t\t\t\t\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_browser&dir=' . $dir_code . '">Name' . (substr($sort, -4) == 'name' ? $order == SORT_ASC ? ' &uarr;' : ' &darr;' : '') . '</a>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:right;">';
//.........这里部分代码省略.........
开发者ID:RA2WP,项目名称:RA2WP,代码行数:101,代码来源:wfu_admin_browser.php

示例4: wfu_view_log

function wfu_view_log()
{
    global $wpdb;
    $siteurl = site_url();
    $table_name1 = $wpdb->prefix . "wfu_log";
    $table_name2 = $wpdb->prefix . "wfu_userdata";
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if (!current_user_can('manage_options')) {
        return;
    }
    $echo_str = "\n" . '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= "\n\t\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">History Log</h2>';
    $echo_str .= "\n\t" . '<div>';
    $echo_str .= "\n\t\t" . '<table class="widefat">';
    $echo_str .= "\n\t\t\t" . '<thead>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="5%" style="text-align:center;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>#</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:left;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Date</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:center;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Action</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>File</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:center;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>User</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="25%" style="text-align:left;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label>Remarks</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t" . '</thead>';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    $filerecs = $wpdb->get_results('SELECT * FROM ' . $table_name1 . ' ORDER BY date_from DESC');
    $userdatarecs = $wpdb->get_results('SELECT * FROM ' . $table_name2);
    $i = 0;
    foreach ($filerecs as $filerec) {
        $remarks = '';
        $filepath = ABSPATH;
        if (substr($filepath, -1) == '/') {
            $filepath = substr($filepath, 0, -1);
        }
        $filepath .= $filerec->filepath;
        $enc_file = wfu_plugin_encode_string($filepath . '[[name]]');
        if ($filerec->action == 'rename') {
            $prevfilepath = '';
            foreach ($filerecs as $key => $prevfilerec) {
                if ($prevfilerec->idlog == $filerec->linkedto) {
                    $prevfilepath = $prevfilerec->filepath;
                    break;
                }
            }
            if ($prevfilepath != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<label>Previous filepath: ' . $prevfilepath . '</label>';
            }
        } elseif ($filerec->action == 'upload' || $filerec->action == 'modify') {
            foreach ($userdatarecs as $userdata) {
                if ($userdata->uploadid == $filerec->uploadid && $userdata->date_from == $filerec->date_from) {
                    $remarks .= "\n\t\t\t\t\t\t\t" . '<option>' . $userdata->property . ': ' . $userdata->propvalue . '</option>';
                }
            }
            if ($remarks != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">' . $remarks;
                $remarks .= "\n\t\t\t\t\t\t" . '</select>';
            }
        } elseif ($filerec->action == 'other') {
            $info = $filerec->filepath;
            $filerec->filepath = '';
            $remarks = "\n\t\t\t\t\t\t" . '<textarea style="width:100%; resize:vertical; background:none;" readonly="readonly">' . $info . '</textarea>';
        }
        $i++;
        $otheraction = $filerec->action == 'other';
        $echo_str .= "\n\t\t\t\t" . '<tr>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . $i . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;">' . $filerec->date_from . '</td>';
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . $filerec->action . '</td>';
        if (!$otheraction) {
            $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;">';
            $echo_str .= "\n\t\t\t\t\t\t" . '<a class="row-title" href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&action=file_details&file=' . $enc_file . '" title="View and edit file details" style="font-weight:normal;">' . $filerec->filepath . '</a>';
            $echo_str .= "\n\t\t\t\t\t" . '</td>';
            $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:center;">' . wfu_get_username_by_id($filerec->userid) . '</td>';
        }
        $echo_str .= "\n\t\t\t\t\t" . '<td style="padding: 5px 5px 5px 10px; text-align:left;"' . ($otheraction ? ' colspan="3"' : '') . '>';
        $echo_str .= $remarks;
        $echo_str .= "\n\t\t\t\t\t" . '</td>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
    }
    $echo_str .= "\n\t\t\t" . '</tbody>';
    $echo_str .= "\n\t\t" . '</table>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n" . '</div>';
    return $echo_str;
//.........这里部分代码省略.........
开发者ID:epis2048,项目名称:wyyhome,代码行数:101,代码来源:wfu_admin_log.php

示例5: wfu_manage_mainmenu

function wfu_manage_mainmenu($message = '')
{
    if (!current_user_can('manage_options')) {
        return;
    }
    //get php version
    $php_version = preg_replace("/-.*/", "", phpversion());
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $echo_str = '<div class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    if ($message != '') {
        $echo_str .= "\n\t" . '<div class="updated">';
        $echo_str .= "\n\t\t" . '<p>' . $message . '</p>';
        $echo_str .= "\n\t" . '</div>';
    }
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "Main");
    $echo_str .= "\n\t\t" . '<h3 style="margin-bottom: 10px;">Status</h3>';
    $echo_str .= "\n\t\t" . '<table class="form-table">';
    $echo_str .= "\n\t\t\t" . '<tbody>';
    //plugin edition
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Edition</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px; vertical-align:top;">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">Free</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:bisque; padding:0 0 0 4px; border-left:3px solid lightcoral;">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">Consider </label><a href="' . WFU_PRO_VERSION_URL . '">Upgrading</a><label style="cursor:default;"> to the Professional Version. </label>';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<button onclick="if (this.innerText == \'See why >>\') {this.innerText = \'<< Close\'; document.getElementById(\'wfu_version_comparison\').style.display = \'inline-block\';} else {this.innerText = \'See why >>\'; document.getElementById(\'wfu_version_comparison\').style.display = \'none\';}">See why >></button>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    $echo_str .= "\n\t\t\t\t\t\t" . '<br /><div id="wfu_version_comparison" style="display:none; background-color:lightyellow; border:1px solid yellow; margin:10px 0; padding:10px;">';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<img src="' . WFU_IMAGE_VERSION_COMPARISON . '" style="display:block; margin-bottom:6px;" />';
    $echo_str .= "\n\t\t\t\t\t\t\t" . '<a class="button-primary" href="' . WFU_PRO_VERSION_URL . '">Go for the PRO version</a>';
    $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    //plugin version
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Version</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    $cur_version = wfu_get_plugin_version();
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">' . $cur_version . '</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $lat_version = wfu_get_latest_version();
    $ret = wfu_compare_versions($cur_version, $lat_version);
    if ($ret['status'] && $ret['result'] == 'lower') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:bisque; padding:0 0 0 4px; border-left:3px solid lightcoral;">';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">Version <strong>' . $lat_version . '</strong> of the plugin is available. Go to Plugins page of your Dashboard to update to the latest version.</label>';
        if ($ret['custom']) {
            $echo_str .= '<label style="cursor:default; color: purple;"> <em>Please note that you are using a custom version of the plugin. If you upgrade to the newest version, custom changes will be lost.</em></label>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    } elseif ($ret['status'] && $ret['result'] == 'equal') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<div style="display:inline-block; background-color:rgb(220,255,220); padding:0 0 0 4px; border-left:3px solid limegreen;">';
        $echo_str .= "\n\t\t\t\t\t\t\t" . '<label style="cursor:default;">You have the latest version.</label>';
        if ($ret['custom']) {
            $echo_str .= '<label style="cursor:default; color: purple;"> <em>(Please note that your version is custom)</em></label>';
        }
        $echo_str .= "\n\t\t\t\t\t\t" . '</div>';
    }
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    //server environment
    $php_env = wfu_get_server_environment();
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Server Environment</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    if ($php_env == '64bit') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">64bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server supports files up to 1 Exabyte, practically unlimited)</label>';
    }
    if ($php_env == '32bit') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">32bit</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(Your server does not support files larger than 2GB)</label>';
    }
    if ($php_env == '') {
        $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">Unknown</label></td><td><label style="font-weight:normal; font-style:italic; cursor:default;">(The maximum file size supported by the server cannot be determined)</label>';
    }
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">PHP Version</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</th>';
    $echo_str .= "\n\t\t\t\t\t" . '<td style="width:100px;">';
    $cur_version = wfu_get_plugin_version();
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="font-weight:bold; cursor:default;">' . $php_version . '</label>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t\t" . '<td>';
    $echo_str .= "\n\t\t\t\t\t" . '</td>';
    $echo_str .= "\n\t\t\t\t" . '</tr>';
    $echo_str .= "\n\t\t\t\t" . '<tr>';
    $echo_str .= "\n\t\t\t\t\t" . '<th scope="row">';
    $echo_str .= "\n\t\t\t\t\t\t" . '<label style="cursor:default;">Release Notes</label>';
//.........这里部分代码省略.........
开发者ID:Cgorton48,项目名称:ssn790,代码行数:101,代码来源:wfu_admin.php

示例6: wfu_shortcode_composer

function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upload')
{
    global $wpdb;
    global $wp_roles;
    $siteurl = site_url();
    $components = wfu_component_definitions();
    if ($shortcode_tag == 'wordpress_file_upload') {
        $plugin_title = "Uploader";
        $cats = wfu_category_definitions();
        $defs = wfu_attribute_definitions();
    } else {
        $plugin_title = "Browser";
        $cats = wfu_browser_category_definitions();
        $defs = wfu_browser_attribute_definitions();
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if ($data == "") {
        $shortcode = $plugin_options['shortcode'];
        $shortcode_full = '[' . $shortcode_tag . ' ' . $shortcode . ']';
        $postid = "";
        $postname = "";
        $posttype = "";
        $posthash = "";
        $shortcode_position = -1;
        $widgetid = "";
        $sidebar = "";
        $autosave = true;
    } else {
        $shortcode = trim(substr($data['shortcode'], strlen('[' . $shortcode_tag), -1));
        $shortcode_full = $data['shortcode'];
        $postid = $data['post_id'];
        $postname = get_the_title($postid);
        $posttype_obj = get_post_type_object(get_post_type($postid));
        $posttype = $posttype_obj ? $posttype_obj->labels->singular_name : "";
        $posthash = $data['post_hash'];
        $shortcode_position = $data['position'];
        $widgetid = isset($data['widgetid']) ? $data['widgetid'] : "";
        $sidebar = isset($data['sidebar']) ? $data['sidebar'] : "";
        $autosave = false;
    }
    // index $components
    $components_indexed = array();
    foreach ($components as $component) {
        $components_indexed[$component['id']] = $component;
    }
    // complete defs array and index dependencies
    $governors = array();
    $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
    $shortcode_id = '';
    foreach ($defs as $key => $def) {
        $attr = $def['attribute'];
        $defs[$key]['default'] = $def['value'];
        if (array_key_exists($attr, $shortcode_attrs)) {
            $defs[$key]['value'] = $shortcode_attrs[$attr];
        }
        $subblock_active = false;
        //detect if the dependencies of this attribute will be disabled or not
        if ($def['type'] == "onoff" && $defs[$key]['value'] == "true" || $def['type'] == "radio" && in_array("*" . $defs[$key]['value'], $def['listitems'])) {
            $subblock_active = true;
        }
        // assign dependencies if exist
        if ($def['dependencies'] != null) {
            foreach ($def['dependencies'] as $dependency) {
                if (substr($dependency, 0, 1) == "!") {
                    //invert state for this dependency if an exclamation mark is defined
                    $governors[substr($dependency, 1)] = array('attribute' => $attr, 'active' => !$subblock_active, 'inv' => '_inv');
                } else {
                    $governors[$dependency] = array('attribute' => $attr, 'active' => $subblock_active, 'inv' => '');
                }
            }
        }
        if ($attr == 'uploadid' || $attr == 'browserid') {
            $shortcode_id = $defs[$key]['value'];
        }
    }
    //check if attributes need to be generated more than once because their governor is a component field that appears more than once in placements attribute
    $key = 0;
    while ($key < count($defs)) {
        $defs[$key]['additional_values'] = array();
        $def = $defs[$key];
        $attr = $def['attribute'];
        //check if this attribute needs to be generated more than once
        if (array_key_exists($attr, $governors)) {
            $governor = $governors[$attr]['attribute'];
        } else {
            $governor = "";
        }
        if ($governor != "" && isset($components_indexed[$governor]) && $components_indexed[$governor]['multiplacements'] && isset($shortcode_attrs['placements'])) {
            //count how many occurrences of the governor attribute appear inside placements attribute
            $occurrences = 0;
            $sections = explode("/", $shortcode_attrs['placements']);
            foreach ($sections as $section) {
                $items_in_section = explode("+", trim($section));
                foreach ($items_in_section as $item) {
                    if (trim($item) == $governor) {
                        $occurrences++;
                    }
                }
            }
            //add indexed attributes if there is more than one occurrence
//.........这里部分代码省略.........
开发者ID:RA2WP,项目名称:RA2WP,代码行数:101,代码来源:wfu_admin_composer.php

示例7: wfu_process_files

function wfu_process_files($params, $method)
{
    $sid = $params["uploadid"];
    $sesid = session_id();
    $user = wp_get_current_user();
    if (0 == $user->ID) {
        $user_id = 0;
        $user_login = "guest";
        $user_email = "";
        $is_admin = false;
    } else {
        $user_id = $user->ID;
        $user_login = $user->user_login;
        $user_email = $user->user_email;
        $is_admin = current_user_can('manage_options');
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $unique_id = sanitize_text_field($_POST['uniqueuploadid_' . $sid]);
    // determine if this routine is only for checking the file
    $only_check = isset($_POST['only_check']) ? $_POST['only_check'] == "1" : false;
    $suppress_admin_messages = $params["adminmessages"] != "true" || !$is_admin;
    $success_count = 0;
    $warning_count = 0;
    $error_count = 0;
    $default_colors = wfu_prepare_message_colors(WFU_VAR("WFU_DEFAULTMESSAGECOLORS"));
    $notify_only_filename_list = "";
    $notify_target_path_list = "";
    $notify_attachment_list = "";
    $uploadedfile = 'uploadedfile_' . $sid;
    $hiddeninput = 'hiddeninput_' . $sid;
    $allowed_patterns = explode(",", $params["uploadpatterns"]);
    foreach ($allowed_patterns as $key => $allowed_pattern) {
        $allowed_patterns[$key] = trim($allowed_pattern);
    }
    $userdata_fields = $params["userdata_fields"];
    foreach ($userdata_fields as $userdata_key => $userdata_field) {
        $userdata_fields[$userdata_key]["value"] = isset($_POST[$hiddeninput . '_userdata_' . $userdata_key]) ? strip_tags($_POST[$hiddeninput . '_userdata_' . $userdata_key]) : "";
    }
    $params_output_array["version"] = "full";
    $params_output_array["general"]['shortcode_id'] = $sid;
    $params_output_array["general"]['unique_id'] = $unique_id;
    $params_output_array["general"]['state'] = 0;
    $params_output_array["general"]['files_count'] = 0;
    $params_output_array["general"]['update_wpfilebase'] = "";
    $params_output_array["general"]['redirect_link'] = $params["redirect"] == "true" ? $params["redirectlink"] : "";
    $params_output_array["general"]['upload_finish_time'] = 0;
    $params_output_array["general"]['message'] = "";
    $params_output_array["general"]['message_type'] = "";
    $params_output_array["general"]['admin_messages']['wpfilebase'] = "";
    $params_output_array["general"]['admin_messages']['notify'] = "";
    $params_output_array["general"]['admin_messages']['redirect'] = "";
    $params_output_array["general"]['admin_messages']['other'] = "";
    $params_output_array["general"]['errors']['wpfilebase'] = "";
    $params_output_array["general"]['errors']['notify'] = "";
    $params_output_array["general"]['errors']['redirect'] = "";
    $params_output_array["general"]['color'] = $default_colors['color'];
    $params_output_array["general"]['bgcolor'] = $default_colors['bgcolor'];
    $params_output_array["general"]['borcolor'] = $default_colors['borcolor'];
    $params_output_array["general"]['notify_only_filename_list'] = "";
    $params_output_array["general"]['notify_target_path_list'] = "";
    $params_output_array["general"]['notify_attachment_list'] = "";
    $params_output_array["general"]['fail_message'] = "";
    $params_output_array["general"]['fail_admin_message'] = "";
    /* safe_output is a minimized version of params_output_array, that is passed as text, in case JSON parse fails
    	   its data are separated by semicolon (;) and are the following:
    		upload state: the upload state number
    		default colors: the default color, bgcolor and borcolor values, separated by comma(,)
    		file_count: the number of files processed
    		filedata: message type, header, message and admin message of each file, encoded and separated by comma (,) */
    $params_output_array["general"]['safe_output'] = "";
    /* js_script is javascript code that is executed after each file upload and is defined in wfu_after_file_upload action */
    $params_output_array["general"]['js_script'] = "";
    /* adjust $uploadedfile variable (holding file data) if this is a redirection caused because the browser of the user could not handle AJAX upload */
    if (isset($_FILES[$uploadedfile . '_redirected'])) {
        $uploadedfile .= '_redirected';
    }
    /* notify admin if this is a redirection caused because the browser of the user could not handle AJAX upload */
    $params_output_array["general"]['admin_messages']['other'] = $params['adminerrors'];
    if (isset($_FILES[$uploadedfile]['error']) || $only_check) {
        $files_count = 1;
        // in case of checking of file, then the $_FILES variable has not been set because no file has been uploaded,
        // so we set it manually in order to allow the routine to continue
        if ($only_check) {
            $_FILES[$uploadedfile]['name'] = wfu_plugin_decode_string($_POST[$uploadedfile . '_name']);
            $_FILES[$uploadedfile]['type'] = 'any';
            $_FILES[$uploadedfile]['tmp_name'] = 'any';
            $_FILES[$uploadedfile]['error'] = '';
            $_FILES[$uploadedfile]['size'] = $_POST[$uploadedfile . '_size'];
        }
    } else {
        $files_count = 0;
    }
    $params_output_array["general"]['files_count'] = $files_count;
    // index of uploaded file in case of ajax uploads (in ajax uploads only one file is uploaded in every ajax call)
    // the index is used to store any file data in session variables, in case the file is uploaded in two or more passes
    // (like the case were in the first pass it is only checked)
    $single_file_index = isset($_POST[$uploadedfile . '_index']) ? $_POST[$uploadedfile . '_index'] : -1;
    /* append userdata fields to upload path */
    $search = array();
    $replace = array();
//.........这里部分代码省略.........
开发者ID:Cgorton48,项目名称:ssn790,代码行数:101,代码来源:wfu_processfiles.php

示例8: wfu_prepare_subfolders_block

function wfu_prepare_subfolders_block($params, $additional_params, $occurrence_index)
{
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $relaxcss = false;
    if (isset($plugin_options['relaxcss'])) {
        $relaxcss = $plugin_options['relaxcss'] == "1";
    }
    $sid = $params["uploadid"];
    $widths = $additional_params['widths'];
    $heights = $additional_params['heights'];
    $selectsubdir = 'selectsubdir_' . $sid;
    $editbox = 'selectsubdiredit_' . $sid;
    $defaultvalue = 'selectsubdirdefault_' . $sid;
    $hiddeninput = 'hiddeninput_' . $sid;
    $subfolders_item = null;
    $styles1 = "";
    $styles2 = "";
    if ($widths["uploadfolder_label"] != "") {
        $styles1 .= 'width: ' . $widths["uploadfolder_label"] . '; display:inline-block;';
    }
    if ($heights["uploadfolder_label"] != "") {
        $styles1 .= 'height: ' . $heights["uploadfolder_label"] . '; ';
    }
    if ($styles1 != "") {
        $styles1 = ' style="' . $styles1 . '"';
    }
    if ($widths["subfolders_label"] != "") {
        $styles2 .= 'width: ' . $widths["subfolders_label"] . '; display:inline-block;';
    }
    if ($heights["subfolders_label"] != "") {
        $styles2 .= 'height: ' . $heights["subfolders_label"] . '; ';
    }
    if ($styles2 != "") {
        $styles2 = ' style="' . $styles2 . '"';
    }
    $styles3 = "border: 1px solid; border-color: #BBBBBB;";
    $styles4 = "";
    if ($widths["subfolders_select"] != "") {
        $styles4 .= 'width: ' . $widths["subfolders_select"] . '; ';
    }
    if ($heights["subfolders_select"] != "") {
        $styles4 .= 'height: ' . $heights["subfolders_select"] . '; ';
    }
    $styles3 = ' style="' . ($relaxcss ? '' : $styles3) . $styles4 . '"';
    if ($styles4 != "") {
        $styles4 = ' style="' . $styles4 . '"';
    }
    $linebr = "";
    if ($params["showtargetfolder"] == "true" || $params["askforsubfolders"] == "true") {
        $linebr = '<br />';
        $subfolders_item["title"] = 'wordpress_file_upload_subfolders_' . $sid;
        $subfolders_item["hidden"] = false;
        $subfolders_item["width"] = "";
        if ($params["fitmode"] == "responsive") {
            $subfolders_item["width"] = $widths["subfolders"];
        }
    }
    $i = 1;
    if ($params["showtargetfolder"] == "true") {
        $upload_directory = wfu_upload_plugin_directory($params["uploadpath"]);
        $subfolders_item["line" . $i++] = '<span class="subfolder_dir"' . $styles1 . '>' . $params["targetfolderlabel"] . ': <strong>' . $upload_directory . '</strong></span>' . $linebr;
    }
    if ($params["askforsubfolders"] == "true") {
        $subfolders_item["line" . $i++] = '<span class="file_item_clean subfolder_label"' . $styles2 . '>' . $params["subfolderlabel"] . ' </span>';
        $subfolders_item["line" . $i++] = '<div class="file_item_clean subfolder_container"' . $styles4 . '>';
        $autoplus = substr($params["subfoldertree"], 0, 5) == "auto+";
        $subfolders_item["line" . $i++] = '<div class="file_item_clean_inner subfolder_autoplus_container"' . ($autoplus ? '' : ' style="display:none;"') . '>';
        $subfolders_item["line" . $i++] = '<input type="text" id="' . $editbox . '" class="file_item_clean_empty subfolder_autoplus_empty" value="' . WFU_SUBDIR_TYPEDIR . '"' . ($autoplus ? '' : ' style="display:none;"') . ' onchange="wfu_selectsubdiredit_change(' . $sid . ');" onfocus="wfu_selectsubdiredit_enter(' . $sid . ');" onblur="wfu_selectsubdiredit_exit(' . $sid . ');" />';
        $subfolders_item["line" . $i++] = '</div>';
        if ($autoplus) {
            $subfolders_item["line" . $i++] = '<div class="subfolder_autoplus_select_container">';
        }
        $subfolders_item["line" . $i++] = '<select class="' . ($autoplus ? 'subfolder_autoplus_dropdown' : 'file_item_clean subfolder_dropdown') . '"' . $styles3 . ' id="' . $selectsubdir . '" onchange="wfu_selectsubdir_check(' . $sid . ');">';
        if ($params["testmode"] == "true") {
            $subfolders_item["line" . $i++] = "\t" . '<option>' . WFU_NOTIFY_TESTMODE . '</option>';
        } else {
            $zeroind = $i;
            $subfolders_item["line" . $i++] = "\t" . '<option' . (substr($params["subfoldertree"], 0, 5) == "auto+" ? ' style="display:none;"' : '') . '>' . WFU_SUBDIR_SELECTDIR . '</option>';
            if (substr($params["subfoldertree"], 0, 4) == "auto") {
                $upload_directory = wfu_upload_plugin_full_path($params);
                $dirtree = wfu_getTree($upload_directory);
                foreach ($dirtree as &$dir) {
                    $dir = '*' . $dir;
                }
                $params["subfoldertree"] = implode(',', $dirtree);
            }
            $subfolders = wfu_parse_folderlist($params["subfoldertree"]);
            if (count($subfolders['path']) == 0) {
                array_push($subfolders['path'], "");
                array_push($subfolders['label'], wfu_upload_plugin_directory($params["uploadpath"]));
                array_push($subfolders['level'], 0);
                array_push($subfolders['default'], false);
            }
            $default = -1;
            foreach ($subfolders['path'] as $ind => $subfolder) {
                if ($subfolders['default'][$ind]) {
                    $default = intval($ind) + 1;
                }
                $subfolders_item["line" . $i++] = "\t" . '<option' . ($subfolders['default'][$ind] ? ' selected="selected"' : '') . '>' . str_repeat("&nbsp;&nbsp;&nbsp;", intval($subfolders['level'][$ind])) . $subfolders['label'][$ind] . '</option>';
            }
//.........这里部分代码省略.........
开发者ID:brettratner,项目名称:TCNJ-IMM-Showcase-2016,代码行数:101,代码来源:wfu_blocks.php

示例9: wfu_sync_database

function wfu_sync_database()
{
    global $wpdb;
    $table_name1 = $wpdb->prefix . "wfu_log";
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $filerecs = $wpdb->get_results('SELECT * FROM ' . $table_name1 . ' WHERE action <> \'other\' AND date_to = 0');
    $obsolete_count = 0;
    foreach ($filerecs as $filerec) {
        $obsolete = true;
        //calculate full file path
        $filepath = ABSPATH;
        if (substr($filepath, -1) == '/') {
            $filepath = substr($filepath, 0, -1);
        }
        $filepath .= $filerec->filepath;
        if (file_exists($filepath)) {
            if ($plugin_options['hashfiles'] == '1') {
                $filehash = md5_file($filepath);
                if ($filehash == $filerec->filehash) {
                    $obsolete = false;
                }
            } else {
                $filesize = filesize($filepath);
                if ($filesize == $filerec->filesize) {
                    $obsolete = false;
                }
            }
        }
        if ($obsolete) {
            $now_date = date('Y-m-d H:i:s');
            //make previous record obsolete
            $wpdb->update($table_name1, array('date_to' => $now_date), array('idlog' => $filerec->idlog), array('%s'), array('%d'));
            $obsolete_count++;
        }
    }
    return $obsolete_count;
}
开发者ID:jigen7,项目名称:redrocketdigital,代码行数:37,代码来源:wfu_functions.php

示例10: wfu_shortcode_composer

function wfu_shortcode_composer($data = '', $shortcode_tag = 'wordpress_file_upload')
{
    global $wpdb;
    global $wp_roles;
    $siteurl = site_url();
    $components = wfu_component_definitions();
    if ($shortcode_tag == 'wordpress_file_upload') {
        $cats = wfu_category_definitions();
        $defs = wfu_attribute_definitions();
    } else {
        $cats = wfu_browser_category_definitions();
        $defs = wfu_browser_attribute_definitions();
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if ($data == "") {
        $shortcode = $plugin_options['shortcode'];
        $shortcode_full = '[' . $shortcode_tag . ' ' . $shortcode . ']';
        $postid = "";
        $postname = "";
        $posttype = "";
        $posthash = "";
        $shortcode_position = -1;
        $autosave = true;
    } else {
        $shortcode = trim(substr($data['shortcode'], strlen('[' . $shortcode_tag), -1));
        $shortcode_full = $data['shortcode'];
        $postid = $data['post_id'];
        $postname = get_the_title($postid);
        $posttype = get_post_type($postid);
        $posthash = $data['post_hash'];
        $shortcode_position = $data['position'];
        $autosave = false;
    }
    $shortcode_attrs = wfu_shortcode_string_to_array($shortcode);
    $shortcode_id = '';
    foreach ($defs as $key => $def) {
        $defs[$key]['default'] = $def['value'];
        if (array_key_exists($def['attribute'], $shortcode_attrs)) {
            $defs[$key]['value'] = $shortcode_attrs[$def['attribute']];
        }
        if ($def['attribute'] == 'uploadid' || $def['attribute'] == 'browserid') {
            $shortcode_id = $defs[$key]['value'];
        }
    }
    // index $components
    $components_indexed = array();
    foreach ($components as $component) {
        $components_indexed[$component['id']] = $component;
    }
    // index dependiencies
    $governors = array();
    $echo_str = '<div id="wfu_wrapper" class="wrap">';
    $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
    $echo_str .= "\n\t" . '<div id="wfu_page_obsolete_message" class="error" style="display:none;">';
    $echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_PAGE_OBSOLETE . '</p>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<div id="wfu_update_rejected_message" class="error" style="display:none;">';
    $echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_REJECTED . '</p>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<div id="wfu_update_failed_message" class="error" style="display:none;">';
    $echo_str .= "\n\t\t" . '<p>' . WFU_DASHBOARD_UPDATE_SHORTCODE_FAILED . '</p>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    if (current_user_can('manage_options')) {
        $echo_str .= "\n\t" . '<a href="' . $siteurl . '/wp-admin/options-general.php?page=wordpress_file_upload&amp;action=manage_mainmenu" class="button" title="go back">Go to Main Menu</a>';
    }
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<h2 style="margin-bottom: 10px; margin-top: 20px;">Shortcode Composer for ' . ($data == "" ? 'Test' : $posttype . ' "' . $postname . '" (' . $postid . ') Position ' . $data['position']) . ' with ID ' . $shortcode_id . '</h2>';
    $echo_str .= "\n\t" . '<div style="margin-top:10px; display:inline-block;">';
    if ($data != "") {
        $echo_str .= "\n\t\t" . '<input id="wfu_update_shortcode" type="button" value="Update" class="button-primary" disabled="disabled" onclick="wfu_save_shortcode()" /><span id="wfu_update_shortcode_wait" class="spinner" style="float:right; display:none;"></span>';
    }
    $echo_str .= "\n\t\t" . '<input id="wfu_shortcode_original_enc" type="hidden" value="' . wfu_plugin_encode_string($shortcode_full) . '" />';
    $echo_str .= "\n\t\t" . '<input id="wfu_shortcode_tag" type="hidden" value="' . $shortcode_tag . '" />';
    $echo_str .= "\n\t\t" . '<input id="wfu_shortcode_postid" type="hidden" value="' . $postid . '" />';
    $echo_str .= "\n\t\t" . '<input id="wfu_shortcode_posthash" type="hidden" value="' . $posthash . '" />';
    $echo_str .= "\n\t\t" . '<input id="wfu_shortcode_position" type="hidden" value="' . $shortcode_position . '" />';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
    $echo_str .= "\n\t\t" . '<div class="wfu_shortcode_container">';
    $echo_str .= "\n\t\t\t" . '<span><strong>Generated Shortcode</strong></span>';
    $echo_str .= "\n\t\t\t" . '<span id="wfu_save_label" class="wfu_save_label">saved</span>';
    $echo_str .= "\n\t\t\t" . '<textarea id="wfu_shortcode" class="wfu_shortcode" rows="5">[' . $shortcode_tag . ']</textarea>';
    $echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_defaults" style="display:none;">';
    foreach ($defs as $def) {
        $echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_default_' . $def['attribute'] . '" type="hidden" value="' . $def['default'] . '" />';
    }
    $echo_str .= "\n\t\t\t" . '</div>';
    $echo_str .= "\n\t\t\t" . '<div id="wfu_attribute_values" style="display:none;">';
    foreach ($defs as $def) {
        $echo_str .= "\n\t\t\t\t" . '<input id="wfu_attribute_value_' . $def['attribute'] . '" type="hidden" value="' . $def['value'] . '" />';
    }
    $echo_str .= "\n\t\t\t" . '</div>';
    $echo_str .= "\n\t\t" . '</div>';
    $echo_str .= "\n\t" . '</div>';
    $echo_str .= "\n\t" . '<h3 id="wfu_tab_container" class="nav-tab-wrapper">';
    $is_first = true;
    foreach ($cats as $key => $cat) {
        $echo_str .= "\n\t\t" . '<a id="wfu_tab_' . $key . '" class="nav-tab' . ($is_first ? ' nav-tab-active' : '') . '" href="javascript: wfu_admin_activate_tab(\'' . $key . '\');">' . $cat . '</a>';
        $is_first = false;
//.........这里部分代码省略.........
开发者ID:epis2048,项目名称:wyyhome,代码行数:101,代码来源:wfu_admin_composer.php

示例11: wfu_media_editor_properties

function wfu_media_editor_properties()
{
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if ($plugin_options["mediacustom"] != "1") {
        return;
    }
    $post = get_post();
    $meta = wp_get_attachment_metadata($post->ID);
    $echo_str = "";
    if (isset($meta["WFU User Data"]) && is_array($meta["WFU User Data"])) {
        foreach ($meta["WFU User Data"] as $label => $value) {
            $echo_str .= '<div class="misc-pub-section misc-pub-userdata">' . $label . ': <strong>' . $value . '</strong></div>';
        }
    }
    echo $echo_str;
}
开发者ID:brettratner,项目名称:TCNJ-IMM-Showcase-2016,代码行数:16,代码来源:wfu_admin.php

示例12: wfu_include_file

function wfu_include_file($file_code)
{
    if (!current_user_can('manage_options')) {
        return;
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if ($plugin_options['includeotherfiles'] != "1") {
        return;
    }
    if (!is_array($file_code)) {
        $file_code = array($file_code);
    }
    $dec_files = array();
    foreach ($file_code as $index => $code) {
        $file_code[$index] = wfu_sanitize_code($code);
        $dec_file = wfu_get_filepath_from_safe($file_code[$index]);
        if ($dec_file !== false) {
            $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
            //include file if it does not have a forbidden extention and it not already included
            if (!wfu_file_extension_restricted(wfu_basename($dec_file)) && wfu_get_file_rec($dec_file, false) == null) {
                array_push($dec_files, $dec_file);
            }
        }
    }
    if (count($dec_files) == 0) {
        return;
    }
    $user = wp_get_current_user();
    if (isset($_POST['submit'])) {
        if ($_POST['submit'] == "Include") {
            foreach ($dec_files as $dec_file) {
                $fileid = wfu_log_action('include', $dec_file, $user->ID, '', '', get_current_blog_id(), '', null);
            }
        }
    }
    return true;
}
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:37,代码来源:wfu_admin_browser.php

示例13: wfu_ajax_action_include_file

function wfu_ajax_action_include_file()
{
    $file_code = isset($_POST['file']) ? $_POST['file'] : (isset($_GET['file']) ? $_GET['file'] : '');
    $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : (isset($_GET['nonce']) ? $_GET['nonce'] : '');
    if ($file_code == '' || $nonce == '') {
        die;
    }
    if (!current_user_can('manage_options')) {
        die;
    }
    //security check to avoid CSRF attacks
    if (!wp_verify_nonce($nonce, 'wfu_include_file')) {
        die;
    }
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if ($plugin_options['includeotherfiles'] != "1") {
        die;
    }
    $file_code = wfu_sanitize_code($file_code);
    $dec_file = wfu_get_filepath_from_safe($file_code);
    if ($dec_file === false) {
        die;
    }
    $user = wp_get_current_user();
    $dec_file = wfu_path_rel2abs(wfu_flatten_path($dec_file));
    $fileid = wfu_log_action('include', $dec_file, $user->ID, '', '', get_current_blog_id(), '', null);
    if ($fileid !== false) {
        die("wfu_include_file:success:" . $fileid);
    } else {
        die("wfu_include_file:fail:");
    }
}
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:32,代码来源:wfu_ajaxactions.php

示例14: wfu_view_log

function wfu_view_log($page = 1, $only_table_rows = false)
{
    global $wpdb;
    $siteurl = site_url();
    $table_name1 = $wpdb->prefix . "wfu_log";
    $table_name2 = $wpdb->prefix . "wfu_userdata";
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    if (!current_user_can('manage_options')) {
        return;
    }
    //get log data from database
    $files_total = $wpdb->get_var('SELECT COUNT(idlog) FROM ' . $table_name1);
    $filerecs = $wpdb->get_results('SELECT * FROM ' . $table_name1 . ' ORDER BY date_from DESC' . (WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") > 0 ? ' LIMIT ' . WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") . ' OFFSET ' . ($page - 1) * (int) WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") : ''));
    $echo_str = "";
    if (!$only_table_rows) {
        $echo_str .= "\n" . '<div class="wrap">';
        $echo_str .= "\n\t" . '<h2>Wordpress File Upload Control Panel</h2>';
        $echo_str .= "\n\t" . '<div style="margin-top:20px;">';
        $echo_str .= wfu_generate_dashboard_menu("\n\t\t", "View Log");
        $echo_str .= "\n\t" . '<div style="position:relative;">';
        $echo_str .= wfu_add_loading_overlay("\n\t\t", "historylog");
        $echo_str .= "\n\t\t" . '<div class="wfu_historylog_header" style="width: 100%;">';
        if (WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS") > 0) {
            $pages = ceil($files_total / WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS"));
            $echo_str .= wfu_add_pagination_header("\n\t\t\t", "historylog", 1, $pages);
        }
        $echo_str .= "\n\t\t" . '</div>';
        $echo_str .= "\n\t\t" . '<table id="wfu_historylog_table" class="wp-list-table widefat fixed striped">';
        $echo_str .= "\n\t\t\t" . '<thead>';
        $echo_str .= "\n\t\t\t\t" . '<tr>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="5%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>#</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Date</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="10%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Action</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="30%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>File</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="15%" style="text-align:center;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>User</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t\t" . '<th scope="col" width="25%" style="text-align:left;">';
        $echo_str .= "\n\t\t\t\t\t\t" . '<label>Remarks</label>';
        $echo_str .= "\n\t\t\t\t\t" . '</th>';
        $echo_str .= "\n\t\t\t\t" . '</tr>';
        $echo_str .= "\n\t\t\t" . '</thead>';
        $echo_str .= "\n\t\t\t" . '<tbody>';
    }
    $userdatarecs = $wpdb->get_results('SELECT * FROM ' . $table_name2);
    $deletedfiles = array();
    $filecodes = array();
    $time0 = strtotime("0000-00-00 00:00:00");
    $i = ($page - 1) * (int) WFU_VAR("WFU_HISTORYLOG_TABLE_MAXROWS");
    foreach ($filerecs as $filerec) {
        $remarks = '';
        $filepath = ABSPATH;
        if (substr($filepath, -1) == '/') {
            $filepath = substr($filepath, 0, -1);
        }
        $filepath .= $filerec->filepath;
        $enc_file = wfu_plugin_encode_string($filepath . '[[name]]');
        if ($filerec->action == 'delete') {
            array_push($deletedfiles, $filerec->linkedto);
        } elseif ($filerec->action == 'rename') {
            $prevfilepath = '';
            foreach ($filerecs as $key => $prevfilerec) {
                if ($prevfilerec->idlog == $filerec->linkedto) {
                    $prevfilepath = $prevfilerec->filepath;
                    break;
                }
            }
            if ($prevfilepath != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<label>Previous filepath: ' . $prevfilepath . '</label>';
            }
        } elseif ($filerec->action == 'upload' || $filerec->action == 'modify') {
            foreach ($userdatarecs as $userdata) {
                if ($userdata->uploadid == $filerec->uploadid) {
                    $userdata_datefrom = strtotime($userdata->date_from);
                    $userdata_dateto = strtotime($userdata->date_to);
                    $filerec_datefrom = strtotime($filerec->date_from);
                    if ($filerec_datefrom >= $userdata_datefrom && ($userdata_dateto == $time0 || $filerec_datefrom < $userdata_dateto)) {
                        $remarks .= "\n\t\t\t\t\t\t\t" . '<option>' . $userdata->property . ': ' . $userdata->propvalue . '</option>';
                    }
                }
            }
            if ($remarks != '') {
                $remarks = "\n\t\t\t\t\t\t" . '<select multiple="multiple" style="width:100%; height:40px; background:none; font-size:small;">' . $remarks;
                $remarks .= "\n\t\t\t\t\t\t" . '</select>';
            }
        } elseif ($filerec->action == 'other') {
            $info = $filerec->filepath;
            $filerec->filepath = '';
            $remarks = "\n\t\t\t\t\t\t" . '<textarea style="width:100%; resize:vertical; background:none;" readonly="readonly">' . $info . '</textarea>';
        }
        $i++;
        $otheraction = $filerec->action == 'other';
//.........这里部分代码省略.........
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:101,代码来源:wfu_admin_log.php

示例15: wfu_enqueue_frontpage_scripts

function wfu_enqueue_frontpage_scripts()
{
    $plugin_options = wfu_decode_plugin_options(get_option("wordpress_file_upload_options"));
    $relaxcss = false;
    if (isset($plugin_options['relaxcss'])) {
        $relaxcss = $plugin_options['relaxcss'] == '1';
    }
    //apply wfu_before_frontpage_scripts to get additional settings
    $changable_data = array();
    $ret_data = apply_filters('wfu_before_frontpage_scripts', $changable_data);
    if ($relaxcss) {
        wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_relaxed.css', false, '1.0', 'all');
        wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_safe_relaxed.css', false, '1.0', 'all');
    } else {
        wp_enqueue_style('wordpress-file-upload-style', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style.css', false, '1.0', 'all');
        wp_enqueue_style('wordpress-file-upload-style-safe', WPFILEUPLOAD_DIR . 'css/wordpress_file_upload_style_safe.css', false, '1.0', 'all');
    }
    if (!isset($ret_data["correct_NextGenGallery_incompatibility"]) || $ret_data["correct_NextGenGallery_incompatibility"] != "true") {
        wp_enqueue_style('jquery-ui-css', '//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
    }
    wp_enqueue_style('jquery-ui-timepicker-addon-css', WPFILEUPLOAD_DIR . 'vendor/datetimepicker/jquery-ui-timepicker-addon.min.css', false, '1.0', 'all');
    wp_enqueue_script('json_class', WPFILEUPLOAD_DIR . 'js/json2.js');
    wp_enqueue_script('wordpress_file_upload_script', WPFILEUPLOAD_DIR . 'js/wordpress_file_upload_functions.js');
    wp_enqueue_script('jquery-ui-slider', false, array(), false, true);
    wp_enqueue_script('jquery-ui-datepicker', false, array(), false, true);
    wp_enqueue_script('jquery-ui-timepicker-addon-js', WPFILEUPLOAD_DIR . 'vendor/datetimepicker/jquery-ui-timepicker-addon.min.js', array(), false, true);
}
开发者ID:bordy-strat,项目名称:kumikinang-computing-makina,代码行数:27,代码来源:wordpress_file_upload.php


注:本文中的wfu_decode_plugin_options函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。