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


PHP WPFB_Core::UpdateOption方法代码示例

本文整理汇总了PHP中WPFB_Core::UpdateOption方法的典型用法代码示例。如果您正苦于以下问题:PHP WPFB_Core::UpdateOption方法的具体用法?PHP WPFB_Core::UpdateOption怎么用?PHP WPFB_Core::UpdateOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPFB_Core的用法示例。


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

示例1: AddTraffic

 static function AddTraffic($bytes)
 {
     $traffic = wpfb_call('Misc', 'GetTraffic');
     $traffic['month'] = $traffic['month'] + $bytes;
     $traffic['today'] = $traffic['today'] + $bytes;
     $traffic['time'] = time();
     WPFB_Core::UpdateOption('traffic_stats', $traffic);
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:8,代码来源:Download.php

示例2: OnActivateOrVerChange

 static function OnActivateOrVerChange($old_ver = null)
 {
     global $wpdb;
     // make sure that either wp-filebase or wp-filebase pro is enabled bot not both!
     if (!function_exists('is_plugin_active')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     if (is_plugin_active('wp-filebase-pro/wp-filebase.php')) {
         deactivate_plugins('wp-filebase/wp-filebase.php');
     }
     wpfb_loadclass('Admin', 'File', 'Category');
     self::SetupDBTables($old_ver);
     $old_options = get_option(WPFB_OPT_NAME);
     self::AddOptions();
     self::AddTpls($old_ver);
     $new_options = get_option(WPFB_OPT_NAME);
     WPFB_Admin::SettingsUpdated($old_options, $new_options);
     self::ProtectUploadPath();
     $sync_data_file = WPFB_Core::UploadDir() . '/._sync.data';
     is_file($sync_data_file) && unlink($sync_data_file);
     WPFB_Admin::WPCacheRejectUri(WPFB_Core::$settings->download_base . '/', $old_options['download_base'] . '/');
     // TODO, do this in background
     if (WPFB_Category::GetNumCats() < self::MANY_CATEGORIES && WPFB_File::GetNumFiles() < self::MANY_FILES) {
         // avoid long activation time
         wpfb_loadclass('Sync');
         WPFB_Sync::SyncCats();
         WPFB_Sync::UpdateItemsPath();
     }
     if (!wp_next_scheduled(WPFB . '_cron')) {
         wp_schedule_event(time() + 20, 'hourly', WPFB . '_cron');
     }
     if (!get_option('wpfb_install_time')) {
         add_option('wpfb_install_time', ($ft = (int) mysql2date('U', $wpdb->get_var("SELECT file_mtime FROM {$wpdb->wpfilebase_files} ORDER BY file_mtime ASC LIMIT 1"))) > 0 ? $ft : time(), null, 'no');
     }
     $wp_upload = wp_upload_dir();
     // move old css
     if (file_exists(WPFB_Core::GetOldCustomCssPath())) {
         $wp_upload_ok = empty($wp_upload['error']) && is_writable($wp_upload['basedir']);
         if ($wp_upload_ok && @rename(WPFB_Core::GetOldCustomCssPath(), $wp_upload['basedir'] . '/wp-filebase.css')) {
             update_option('wpfb_css', $wp_upload['baseurl'] . '/wp-filebase.css?t=' . time());
         }
     }
     // refresh css URL (in case upload_dir changed or upgrade from free to pro)
     update_option('wpfb_css', trailingslashit(file_exists($wp_upload['basedir'] . '/wp-filebase.css') ? $wp_upload['baseurl'] : WPFB_PLUGIN_URI) . 'wp-filebase.css?t=' . time());
     flush_rewrite_rules();
     // change mapping of file browser folder icons (2340897_sdf.svg => svg-.....svg!)
     $image_mappings = array('1449888880_folder.svg' => 'svg-folder.svg', '1449888883_folder.svg' => 'svg-folder-blue.svg', '1449888885_folder-blue.svg' => 'svg-folderblue.svg', '1449888886_folder-green.svg' => 'svg-folder-green.svg');
     $folder_icons_base = '/plugins/wp-filebase/images/folder-icons/';
     $folder_icon = substr(WPFB_Core::$settings->folder_icon, strlen($folder_icons_base));
     if (isset($image_mappings[$folder_icon])) {
         WPFB_Core::UpdateOption('folder_icon', $folder_icons_base . $image_mappings[$folder_icon]);
     }
     //delete_option('wpfilebase_dismiss_support_ending');
     // fixes files that where offline
     if ($old_ver === "3.4.2") {
         $wpdb->query("UPDATE `{$wpdb->wpfilebase_files}` SET file_offline = '0' WHERE 1");
         wpfb_loadclass('Sync');
         WPFB_Sync::list_files(WPFB_Core::UploadDir());
     }
 }
开发者ID:noxian,项目名称:WP-Filebase,代码行数:60,代码来源:Setup.php

示例3: GenTpl

 function GenTpl($parsed_tpl = null, $context = '')
 {
     if ($context != 'ajax') {
         WPFB_Core::$load_js = true;
     }
     if (empty($parsed_tpl)) {
         $tpo = $this->is_file ? 'template_file_parsed' : 'template_cat_parsed';
         $parsed_tpl = WPFB_Core::GetOpt($tpo);
         if (empty($parsed_tpl)) {
             $parsed_tpl = wpfb_call('TplLib', 'Parse', WPFB_Core::GetOpt($this->is_file ? 'template_file' : 'template_cat'));
             WPFB_Core::UpdateOption($tpo, $parsed_tpl);
         }
     }
     /*
     if($this->is_file) {
     	global $wpfb_file_paths;
     	if(empty($wpfb_file_paths)) $wpfb_file_paths = array();
     	$wpfb_file_paths[(int)$this->file_id] = $this->GetLocalPathRel();
     }
     */
     self::$tpl_uid++;
     $f =& $this;
     return eval("return ({$parsed_tpl});");
 }
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:24,代码来源:Item.php

示例4: array_merge

         $terms = array_merge($terms, get_pages());
     }
     foreach ($terms as $t) {
         $post_title = stripslashes(get_the_title($t->ID));
         if (empty($post_title)) {
             $post_title = $t->ID;
         }
         $items[] = array('id' => $t->ID, 'classes' => 'file', 'text' => '<a href="javascript:' . sprintf($onclick, $t->ID, str_replace('\'', '\\\'', $post_title)) . '">' . $post_title . '</a>');
     }
     wpfb_print_json($items);
     exit;
 case 'toggle-context-menu':
     if (!current_user_can('upload_files')) {
         die('-1');
     }
     WPFB_Core::UpdateOption('file_context_menu', empty(WPFB_Core::$settings->file_context_menu));
     die('1');
 case 'set-user-setting':
     if (!current_user_can('manage_categories') || empty($_REQUEST['name'])) {
         die('0');
     }
     echo update_user_option(get_current_user_id(), 'wpfb_set_' . $_REQUEST['name'], stripslashes($_REQUEST['value']), true);
     exit;
 case 'get-user-setting':
     if (!current_user_can('manage_categories') || empty($_REQUEST['name'])) {
         die('-1');
     }
     wpfb_print_json(get_user_option('wpfb_set_' . $_REQUEST['name']));
     exit;
 case 'attach-file':
     wpfb_loadclass('File');
开发者ID:parsonsc,项目名称:dofe,代码行数:31,代码来源:wpfb-ajax.php

示例5: Display

    static function Display()
    {
        global $wpdb;
        wpfb_loadclass('Admin', 'Output');
        WPFB_Core::PrintJS();
        // prints wpfbConf.ajurl
        wp_register_script('jquery-imagepicker', WPFB_PLUGIN_URI . 'extras/jquery/image-picker/image-picker.min.js', array('jquery'), WPFB_VERSION);
        wp_register_style('jquery-imagepicker', WPFB_PLUGIN_URI . 'extras/jquery/image-picker/image-picker.css', array(), WPFB_VERSION);
        if (!current_user_can('manage_options')) {
            wp_die(__('Cheatin&#8217; uh?') . '<!-- manage_options -->');
        }
        // nonce and referer check (security)
        if ((!empty($_POST['reset']) || !empty($_POST['submit'])) && !check_admin_referer('wpfb-update-settings', 'wpfb-nonce')) {
            wp_die(__('Cheatin&#8217; uh?'));
        }
        $post = stripslashes_deep($_POST);
        $action = !empty($post['action']) ? $post['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
        $messages = array();
        $errors = array();
        $options = get_option(WPFB_OPT_NAME);
        $option_fields = WPFB_Admin::SettingsSchema();
        if (isset($post['reset'])) {
            // keep templates
            $file_tpl = WPFB_Core::$settings->template_file;
            $cat_tpl = WPFB_Core::$settings->template_cat;
            wpfb_loadclass('Setup');
            WPFB_Setup::ResetOptions();
            WPFB_Core::UpdateOption('template_file', $file_tpl);
            WPFB_Core::UpdateOption('template_cat', $cat_tpl);
            $new_options = get_option(WPFB_OPT_NAME);
            $messages = array_merge($messages, WPFB_Admin::SettingsUpdated($options, $new_options));
            unset($new_options);
            $messages[] = __('Settings reseted.', WPFB);
            $options = get_option(WPFB_OPT_NAME);
        } elseif (isset($post['submit'])) {
            // cleanup
            foreach ($option_fields as $opt_tag => $opt_data) {
                if (isset($post[$opt_tag])) {
                    if (!is_array($post[$opt_tag])) {
                        $post[$opt_tag] = trim($post[$opt_tag]);
                    }
                    switch ($opt_data['type']) {
                        case 'number':
                            $post[$opt_tag] = intval($post[$opt_tag]);
                            break;
                        case 'select':
                            // check if value is in options array, if not set to default
                            if (!in_array($post[$opt_tag], array_keys($opt_data['options']))) {
                                $post[$opt_tag] = $opt_data['default'];
                            }
                            break;
                        case 'roles':
                            $post[$opt_tag] = array_values(array_filter($post[$opt_tag]));
                            // the following must not be removed! if the roles array is empty, permissions are assumed to be set for everyone!
                            // so make sure that the admin is explicitly set!
                            if (!empty($opt_data['not_everyone']) && !in_array('administrator', $post[$opt_tag])) {
                                if (!is_array($post[$opt_tag])) {
                                    $post[$opt_tag] = array();
                                }
                                array_unshift($post[$opt_tag], 'administrator');
                            }
                            break;
                        case 'cat':
                            $post[$opt_tag] = empty($post[$opt_tag]) || is_null($cat = WPFB_Category::GetCat($post[$opt_tag])) ? 0 : intval($post[$opt_tag]);
                            break;
                    }
                }
            }
            $post['upload_path'] = str_replace(ABSPATH, '', $post['upload_path']);
            $options['upload_path'] = str_replace(ABSPATH, '', $options['upload_path']);
            $post['download_base'] = trim($post['download_base'], '/');
            if (WPFB_Admin::WPCacheRejectUri($post['download_base'] . '/', $options['download_base'] . '/')) {
                $messages[] = sprintf(__('/%s/ added to rejected URIs list of WP Super Cache.', WPFB), $post['download_base']);
            }
            $tpl_file = $post['template_file'];
            $tpl_cat = $post['template_cat'];
            if (!empty($tpl_file) && (empty($options['template_file_parsed']) || $tpl_file != $options['template_file'])) {
                wpfb_loadclass('TplLib');
                $tpl_file = WPFB_TplLib::Parse($tpl_file);
                $result = WPFB_TplLib::Check($tpl_file);
                if (!$result['error']) {
                    $options['template_file_parsed'] = $tpl_file;
                    $messages[] = __('File template successfully parsed.', WPFB);
                } else {
                    $errors[] = sprintf(__('Could not parse template: error (%s) in line %s.', WPFB), $result['msg'], $result['line']);
                }
            }
            if (!empty($tpl_cat) && (empty($options['template_cat_parsed']) || $tpl_cat != $options['template_cat'])) {
                wpfb_loadclass('TplLib');
                $tpl_cat = WPFB_TplLib::Parse($tpl_cat);
                $result = WPFB_TplLib::Check($tpl_cat);
                if (!$result['error']) {
                    $options['template_cat_parsed'] = $tpl_cat;
                    $messages[] = __('Category template successfully parsed.', WPFB);
                } else {
                    $errors[] = sprintf(__('Could not parse template: error (%s) in line %s.', WPFB), $result['msg'], $result['line']);
                }
            }
            $fb_sub_pages = get_pages(array('child_of' => $options['file_browser_post_id']));
            if ($options['file_browser_post_id'] > 0 && count($fb_sub_pages)) {
//.........这里部分代码省略.........
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:101,代码来源:AdminGuiSettings.php

示例6: ParseTpls

 static function ParseTpls()
 {
     wpfb_loadclass('TplLib');
     // parse default
     WPFB_Core::UpdateOption('template_file_parsed', WPFB_TplLib::Parse(WPFB_Core::$settings->template_file));
     WPFB_Core::UpdateOption('template_cat_parsed', WPFB_TplLib::Parse(WPFB_Core::$settings->template_cat));
     // parse custom
     update_option(WPFB_OPT_NAME . '_ptpls_file', WPFB_TplLib::Parse(WPFB_Core::GetFileTpls()));
     update_option(WPFB_OPT_NAME . '_ptpls_cat', WPFB_TplLib::Parse(WPFB_Core::GetCatTpls()));
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:10,代码来源:Admin.php

示例7: Display

    static function Display()
    {
        global $wpdb, $user_ID, $user_identity;
        wpfb_loadclass('Admin', 'Output', 'TplLib', 'ListTpl');
        WPFB_Core::PrintJS();
        $_POST = stripslashes_deep($_POST);
        $_GET = stripslashes_deep($_GET);
        $action = !empty($_POST['action']) ? $_POST['action'] : (!empty($_GET['action']) ? $_GET['action'] : '');
        $clean_uri = remove_query_arg(array('message', 'action', 'file_id', 'cat_id', 'deltpl', 'hash_sync'));
        // keep search keyword
        // security	nonce
        if (!empty($action) && $action != 'edit' && !check_admin_referer($action . '-' . $_REQUEST['type'], 'wpfb-tpl-nonce')) {
            wp_die(__('Cheatin&#8217; uh?'));
        }
        if ($action == 'add' || $action == 'update') {
            if (empty($_POST['type'])) {
                wp_die(__('Type missing!', 'wp-filebase'));
            }
            if (empty($_POST['tpltag'])) {
                wp_die(__('Please enter a template tag.', 'wp-filebase'));
            }
            $type = $_POST['type'];
            $for_cat = $type == 'cat';
            $tpl_tag = preg_replace('/[^a-z0-9_-]/', '', str_replace(' ', '_', strtolower($_POST['tpltag'])));
            if (empty($tpl_tag)) {
                wp_die('Tag is invalid!');
            }
            if ($type == 'list') {
                $data = array('header' => $_POST['tpl-list-header'], 'footer' => $_POST['tpl-list-footer'], 'cat_tpl_tag' => $_POST['tpl-list-cat-tpl'], 'file_tpl_tag' => $_POST['tpl-list-file-tpl']);
                $tpl = new WPFB_ListTpl($tpl_tag, $data);
                $tpl->Save();
            } else {
                if (empty($_POST['tplcode'])) {
                    wp_die('Please enter some template code.');
                }
                if ($tpl_tag == 'default') {
                    // hanle default tpls a bit different
                    WPFB_Core::UpdateOption("template_{$type}", $_POST['tplcode']);
                } else {
                    $tpls = WPFB_Core::GetTpls($type);
                    $tpls[$tpl_tag] = $_POST['tplcode'];
                    if ($for_cat) {
                        WPFB_Core::SetCatTpls($tpls);
                    } else {
                        WPFB_Core::SetFileTpls($tpls);
                    }
                }
            }
            WPFB_Admin::ParseTpls();
            unset($_POST['type'], $_POST['tpltag'], $_POST['tplcode']);
        } elseif ($action == 'del') {
            if (!empty($_GET['type']) && !empty($_GET['tpl']) && !in_array($_GET['tpl'], self::$protected_tags)) {
                $type = $_GET['type'];
                if ($type == 'list') {
                    $tpl = WPFB_ListTpl::Get($_GET['tpl']);
                    if ($tpl) {
                        $tpl->Delete();
                    }
                }
                $for_cat = $type == 'cat';
                $tpls = WPFB_Core::GetTpls($type);
                unset($tpls['default']);
                if (!empty($tpls)) {
                    unset($tpls[$_GET['tpl']]);
                    if ($for_cat) {
                        WPFB_Core::SetCatTpls($tpls);
                    } else {
                        WPFB_Core::SetFileTpls($tpls);
                    }
                }
                unset($_POST['type'], $_POST['tpl']);
            }
            WPFB_Admin::ParseTpls();
        }
        if (!empty($_POST['reset-tpls'])) {
            wpfb_call('Setup', 'ResetTpls');
            // also reset default templates stored in settings
            wpfb_loadclass('Admin');
            $settings_schema = WPFB_Admin::SettingsSchema();
            WPFB_Core::UpdateOption('template_file', $settings_schema['template_file']['default']);
            WPFB_Core::UpdateOption('template_cat', $settings_schema['template_cat']['default']);
            WPFB_Admin::ParseTpls();
        }
        ?>
	
<script type="text/javascript">
function WPFB_GenSuccess(data, textStatus, request)
{
	this.html(data);
}

function WPFB_PreviewTpl(ta, ty)
{
	var tplc = (ty != 'list') ? jQuery(ta).val() : {
		header: jQuery('#tpl-list-header').val(),
		footer: jQuery('#tpl-list-footer').val(),
		file_tpl_tag: jQuery('#tpl-list-file-tpl').val(),
		cat_tpl_tag: jQuery('#tpl-list-cat-tpl').val()
	};
	
//.........这里部分代码省略.........
开发者ID:TishoTM,项目名称:WP-Filebase,代码行数:101,代码来源:AdminGuiTpls.php

示例8: ResetOptions

 static function ResetOptions()
 {
     $traffic = isset(WPFB_Core::$settings->traffic_stats) ? WPFB_Core::$settings->traffic_stats : null;
     // keep stats
     self::RemoveOptions();
     self::AddOptions();
     if (!is_null($traffic)) {
         WPFB_Core::UpdateOption('traffic_stats', $traffic);
     }
     WPFB_Admin::ParseTpls();
 }
开发者ID:parsonsc,项目名称:dofe,代码行数:11,代码来源:Setup.php

示例9: actionToggleContextMenu

 private static function actionToggleContextMenu($args)
 {
     //case 'toggle-context-menu':
     if (!current_user_can('upload_files')) {
         die('-1');
     }
     WPFB_Core::UpdateOption('file_context_menu', empty(WPFB_Core::$settings->file_context_menu));
     die('1');
 }
开发者ID:noxian,项目名称:WP-Filebase,代码行数:9,代码来源:Ajax.php

示例10: ResetOptions

 static function ResetOptions()
 {
     $traffic = WPFB_Core::$settings->traffic_stats;
     // keep stats
     self::RemoveOptions();
     self::AddOptions();
     WPFB_Core::UpdateOption('traffic_stats', $traffic);
     WPFB_Admin::ParseTpls();
 }
开发者ID:Seravo,项目名称:WP-Filebase,代码行数:9,代码来源:Setup.php


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