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


PHP FrmAppHelper::frm_capabilities方法代码示例

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


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

示例1: menu

 public static function menu()
 {
     global $frm_vars, $frm_settings;
     if (current_user_can('administrator') && !current_user_can('frm_view_forms')) {
         global $current_user;
         $frm_roles = FrmAppHelper::frm_capabilities();
         foreach ($frm_roles as $frm_role => $frm_role_description) {
             $current_user->add_cap($frm_role);
         }
         unset($frm_roles);
         unset($frm_role);
         unset($frm_role_description);
     }
     $count = count(get_post_types(array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true)));
     $pos = (int) $count > 0 ? '22.7' : '29.3';
     $pos = apply_filters('frm_menu_position', $pos);
     if (current_user_can('frm_view_forms')) {
         add_menu_page('Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', 'FrmFormsController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', $pos);
     } else {
         if (current_user_can('frm_view_entries') and $frm_vars['pro_is_installed']) {
             add_menu_page('Formidable', $frm_settings->menu, 'frm_view_entries', 'formidable', 'FrmProEntriesController::route', FrmAppHelper::plugin_url() . '/images/form_16.png', $pos);
         }
     }
     add_filter('admin_body_class', 'FrmAppController::wp_admin_body_class');
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:25,代码来源:FrmAppController.php

示例2: display_form

 public static function display_form($errors = array(), $message = '')
 {
     global $frm_settings, $frm_vars;
     $frm_roles = FrmAppHelper::frm_capabilities();
     $uploads = wp_upload_dir();
     $target_path = $uploads['basedir'] . '/formidable/css';
     $sections = apply_filters('frm_add_settings_section', array('styling' => array('name' => __('Form Styling', 'formidable'), 'class' => 'FrmSettingsController', 'function' => 'styling_tab')));
     $recaptcha_themes = array('red' => __('Red', 'formidable'), 'white' => __('White', 'formidable'), 'blackglass' => __('Black Glass', 'formidable'), 'clean' => __('Clean', 'formidable'));
     require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:10,代码来源:FrmSettingsController.php

示例3: display_form

 public static function display_form($errors = array(), $message = '')
 {
     global $frm_vars;
     $frm_settings = FrmAppHelper::get_settings();
     $frm_roles = FrmAppHelper::frm_capabilities();
     $uploads = wp_upload_dir();
     $target_path = $uploads['basedir'] . '/formidable/css';
     $sections = apply_filters('frm_add_settings_section', array());
     $captcha_lang = FrmAppHelper::locales('captcha');
     require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:11,代码来源:FrmSettingsController.php

示例4: process_form

 function process_form()
 {
     global $frm_settings, $frm_ajax_url, $frmpro_is_installed, $frm_update;
     //$errors = $frm_settings->validate($_POST,array());
     $errors = array();
     $frm_settings->update($_POST);
     if (empty($errors)) {
         $frm_settings->store();
         $message = __('Settings Saved', 'formidable');
     }
     $frm_roles = FrmAppHelper::frm_capabilities();
     $sections = apply_filters('frm_add_settings_section', array());
     require FRM_VIEWS_PATH . '/frm-settings/form.php';
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:14,代码来源:FrmSettingsController.php

示例5: display_form

 public static function display_form($errors = array(), $message = '')
 {
     global $frm_vars;
     $frm_settings = FrmAppHelper::get_settings();
     $frm_roles = FrmAppHelper::frm_capabilities();
     $uploads = wp_upload_dir();
     $target_path = $uploads['basedir'] . '/formidable/css';
     $sections = array();
     if (apply_filters('frm_include_addon_page', false)) {
         $sections['licenses'] = array('class' => 'FrmAddonsController', 'function' => 'license_settings', 'name' => __('Plugin Licenses', 'formidable'));
     }
     $sections = apply_filters('frm_add_settings_section', $sections);
     $captcha_lang = FrmAppHelper::locales('captcha');
     require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
 }
开发者ID:LeanderWesterhout,项目名称:leander,代码行数:15,代码来源:FrmSettingsController.php

示例6: menu

 function menu()
 {
     global $frm_settings;
     if (current_user_can('administrator') and !current_user_can('frm_view_entries')) {
         global $wp_roles;
         $frm_roles = FrmAppHelper::frm_capabilities();
         foreach ($frm_roles as $frm_role => $frm_role_description) {
             if (!in_array($frm_role, array('frm_view_forms', 'frm_edit_forms', 'frm_delete_forms', 'frm_change_settings'))) {
                 $wp_roles->add_cap('administrator', $frm_role);
             }
         }
     }
     add_submenu_page('formidable', $frm_settings->menu . ' | ' . __('Form Entries', 'formidable'), __('Form Entries', 'formidable'), 'frm_view_entries', 'formidable-entries', array(&$this, 'route'));
     if (class_exists('WP_List_Table') and (!isset($_GET['frm_action']) or !in_array($_GET['frm_action'], array('edit', 'show')))) {
         add_filter('manage_' . sanitize_title($frm_settings->menu) . '_page_formidable-entries_columns', array(&$this, 'manage_columns'));
         add_filter('manage_' . sanitize_title($frm_settings->menu) . '_page_formidable-entries_sortable_columns', array(&$this, 'sortable_columns'));
         add_filter('get_user_option_manage' . sanitize_title($frm_settings->menu) . '_page_formidable-entriescolumnshidden', array(&$this, 'hidden_columns'));
     }
     //add_filter( 'bulk_actions-' . sanitize_title($frm_settings->menu) .'_page_formidable-entries', array(&$this, 'bulk_action_options'));
     add_action('admin_head-' . sanitize_title($frm_settings->menu) . '_page_formidable-entries', array(&$this, 'head'));
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:21,代码来源:FrmProEntriesController.php

示例7: menu

 function menu()
 {
     global $frmpro_is_installed, $frm_settings;
     if (current_user_can('administrator') and !current_user_can('frm_view_forms')) {
         global $current_user;
         $frm_roles = FrmAppHelper::frm_capabilities();
         foreach ($frm_roles as $frm_role => $frm_role_description) {
             $current_user->add_cap($frm_role);
         }
         unset($frm_roles);
         unset($frm_role);
         unset($frm_role_description);
     }
     if (current_user_can('frm_view_forms')) {
         global $frm_forms_controller;
         add_object_page('Formidable', $frm_settings->menu, 'frm_view_forms', 'formidable', array($frm_forms_controller, 'route'), 'div');
     } elseif (current_user_can('frm_view_entries') and $frmpro_is_installed) {
         global $frmpro_entries_controller;
         add_object_page('Formidable', $frm_settings->menu, 'frm_view_entries', 'formidable', array($frmpro_entries_controller, 'route'), 'div');
     }
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:21,代码来源:FrmAppController.php

示例8: uninstall

 public function uninstall()
 {
     if (!current_user_can('administrator')) {
         $frm_settings = FrmAppHelper::get_settings();
         wp_die($frm_settings->admin_permission);
     }
     global $wpdb, $wp_roles;
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->fields);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->forms);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->entries);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->entry_metas);
     delete_option('frm_options');
     delete_option('frm_db_version');
     //delete roles
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         foreach ($roles as $role => $details) {
             $wp_roles->remove_cap($role, $frm_role);
             unset($role, $details);
         }
         unset($frm_role, $frm_role_description);
     }
     unset($roles, $frm_roles);
     // delete actions, views, and styles
     // prevent the post deletion from triggering entries to be deleted
     remove_action('before_delete_post', 'FrmProDisplaysController::before_delete_post');
     remove_action('deleted_post', 'FrmProEntriesController::delete_entry');
     $post_ids = $wpdb->get_col($wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_type in (%s, %s, %s)', FrmFormActionsController::$action_post_type, FrmStylesController::$post_type, 'frm_display'));
     foreach ($post_ids as $post_id) {
         // Delete's each post.
         wp_delete_post($post_id, true);
     }
     unset($post_ids);
     // delete transients
     delete_transient('frmpro_css');
     delete_transient('frm_options');
     delete_transient('frmpro_options');
     $wpdb->query($wpdb->prepare('DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_%', '_transient_frm_form_fields_%'));
     do_action('frm_after_uninstall');
     return true;
 }
开发者ID:hugocica,项目名称:locomotiva-2016,代码行数:42,代码来源:FrmDb.php

示例9: update

 function update($params)
 {
     global $wp_roles;
     $this->menu = $params['frm_menu'];
     $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
     if ($this->mu_menu) {
         update_site_option('frm_admin_menu_name', $this->menu);
     } else {
         if (FrmAppHelper::is_super_admin()) {
             update_site_option('frm_admin_menu_name', false);
         }
     }
     $this->preview_page_id = (int) $params[$this->preview_page_id_str];
     $this->lock_keys = isset($params['frm_lock_keys']) ? $params['frm_lock_keys'] : 0;
     $this->track = isset($params['frm_track']) ? $params['frm_track'] : 0;
     $this->pubkey = $params['frm_pubkey'];
     $this->privkey = $params['frm_privkey'];
     $this->re_theme = $params['frm_re_theme'];
     $this->re_lang = $params['frm_re_lang'];
     $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
     $this->load_style = $params['frm_load_style'];
     //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
     //$this->custom_stylesheet = isset($params['frm_custom_stylesheet']) ? $params['frm_custom_stylesheet'] : 0;
     $this->jquery_css = isset($params['frm_jquery_css']) ? $params['frm_jquery_css'] : 0;
     $this->accordion_js = isset($params['frm_accordion_js']) ? $params['frm_accordion_js'] : 0;
     $this->success_msg = $params['frm_success_msg'];
     $this->invalid_msg = $params['frm_invalid_msg'];
     $this->failed_msg = $params['frm_failed_msg'];
     $this->submit_value = $params['frm_submit_value'];
     $this->login_msg = $params['frm_login_msg'];
     //update roles
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         $this->{$frm_role} = isset($params[$frm_role]) ? $params[$frm_role] : 'administrator';
         foreach ($roles as $role => $details) {
             if ($this->{$frm_role} == $role or $this->{$frm_role} == 'editor' and $role == 'administrator' or $this->{$frm_role} == 'author' and in_array($role, array('administrator', 'editor')) or $this->{$frm_role} == 'contributor' and in_array($role, array('administrator', 'editor', 'author')) or $this->{$frm_role} == 'subscriber') {
                 $wp_roles->add_cap($role, $frm_role);
             } else {
                 $wp_roles->remove_cap($role, $frm_role);
             }
         }
     }
     do_action('frm_update_settings', $params);
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:45,代码来源:FrmSettings.php

示例10: update

 function update($params)
 {
     global $wp_roles;
     $this->mu_menu = isset($params['frm_mu_menu']) ? $params['frm_mu_menu'] : 0;
     if ($this->mu_menu) {
         update_site_option('frm_admin_menu_name', $this->menu);
     } else {
         if (current_user_can('administrator')) {
             update_site_option('frm_admin_menu_name', false);
         }
     }
     $this->pubkey = trim($params['frm_pubkey']);
     $this->privkey = $params['frm_privkey'];
     $this->re_theme = $params['frm_re_theme'];
     $this->re_lang = $params['frm_re_lang'];
     $settings = $this->default_options();
     foreach ($settings as $setting => $default) {
         if (isset($params['frm_' . $setting])) {
             $this->{$setting} = $params['frm_' . $setting];
         }
         unset($setting);
         unset($default);
     }
     $this->load_style = $params['frm_load_style'];
     $this->preview_page_id = (int) $params['frm-preview-page-id'];
     $this->lock_keys = isset($params['frm_lock_keys']) ? $params['frm_lock_keys'] : 0;
     $this->track = isset($params['frm_track']) ? $params['frm_track'] : 0;
     $this->use_html = isset($params['frm_use_html']) ? $params['frm_use_html'] : 0;
     //$this->custom_style = isset($params['frm_custom_style']) ? $params['frm_custom_style'] : 0;
     //$this->custom_stylesheet = isset($params['frm_custom_stylesheet']) ? $params['frm_custom_stylesheet'] : 0;
     $this->jquery_css = isset($params['frm_jquery_css']) ? $params['frm_jquery_css'] : 0;
     $this->accordion_js = isset($params['frm_accordion_js']) ? $params['frm_accordion_js'] : 0;
     //update roles
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         $this->{$frm_role} = isset($params[$frm_role]) ? $params[$frm_role] : 'administrator';
         foreach ($roles as $role => $details) {
             if ($this->{$frm_role} == $role or $this->{$frm_role} == 'editor' and $role == 'administrator' or $this->{$frm_role} == 'author' and in_array($role, array('administrator', 'editor')) or $this->{$frm_role} == 'contributor' and in_array($role, array('administrator', 'editor', 'author')) or $this->{$frm_role} == 'subscriber') {
                 $wp_roles->add_cap($role, $frm_role);
             } else {
                 $wp_roles->remove_cap($role, $frm_role);
             }
         }
     }
     do_action('frm_update_settings', $params);
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:47,代码来源:FrmSettings.php

示例11: uninstall

 function uninstall()
 {
     if (!current_user_can('administrator')) {
         global $frm_settings;
         wp_die($frm_settings->admin_permission);
     }
     global $frm_update, $wpdb;
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->fields);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->forms);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->entries);
     $wpdb->query('DROP TABLE IF EXISTS ' . $this->entry_metas);
     delete_option('frm_options');
     delete_option('frm_db_version');
     delete_option($frm_update->pro_last_checked_store);
     delete_option($frm_update->pro_auth_store);
     delete_option($frm_update->pro_cred_store);
     //delete roles
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         foreach ($roles as $role => $details) {
             $wp_roles->remove_cap($role, $frm_role);
             unset($role);
             unset($details);
         }
         unset($role);
         unset($details);
         unset($frm_role);
         unset($frm_role_description);
     }
     unset($roles);
     unset($frm_roles);
     do_action('frm_after_uninstall');
 }
开发者ID:moscarar,项目名称:cityhow,代码行数:34,代码来源:FrmDb.php

示例12: update_roles

 private function update_roles($params)
 {
     //update roles
     global $wp_roles;
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         $this->{$frm_role} = (array) (isset($params[$frm_role]) ? $params[$frm_role] : 'administrator');
         if (count($this->{$frm_role}) === 1) {
             $set_role = reset($this->{$frm_role});
             switch ($set_role) {
                 case 'subscriber':
                     array_push($this->{$frm_role}, 'contributor');
                 case 'contributor':
                     array_push($this->{$frm_role}, 'author');
                 case 'author':
                     array_push($this->{$frm_role}, 'editor');
                 case 'editor':
                     array_push($this->{$frm_role}, 'administrator');
             }
             unset($set_role);
         }
         foreach ($roles as $role => $details) {
             if (in_array($role, $this->{$frm_role})) {
                 $wp_roles->add_cap($role, $frm_role);
             } else {
                 $wp_roles->remove_cap($role, $frm_role);
             }
             unset($role, $details);
         }
     }
 }
开发者ID:mazykin46,项目名称:portfolio,代码行数:32,代码来源:FrmSettings.php

示例13: test_maybe_add_permissions

 /**
  * @covers FrmAppHelper::maybe_add_permissions
  */
 function test_maybe_add_permissions()
 {
     $this->set_as_user_role('subscriber');
     $this->assertFalse(current_user_can('frm_view_forms'), 'Subscriber can frm_view_forms');
     $this->assertFalse(current_user_can('frm_edit_forms'), 'Subscriber can frm_edit_forms');
     $this->set_as_user_role('administrator');
     $frm_roles = FrmAppHelper::frm_capabilities();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         $this->assertTrue(current_user_can($frm_role), 'Admin cannot ' . $frm_role);
     }
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:14,代码来源:test_FrmAppHelper.php

示例14: update_roles

 private function update_roles($params)
 {
     global $wp_roles;
     $frm_roles = FrmAppHelper::frm_capabilities();
     $roles = get_editable_roles();
     foreach ($frm_roles as $frm_role => $frm_role_description) {
         $this->{$frm_role} = (array) (isset($params[$frm_role]) ? $params[$frm_role] : 'administrator');
         // Make sure administrators always have permissions
         if (!in_array('administrator', $this->{$frm_role})) {
             array_push($this->{$frm_role}, 'administrator');
         }
         foreach ($roles as $role => $details) {
             if (in_array($role, $this->{$frm_role})) {
                 $wp_roles->add_cap($role, $frm_role);
             } else {
                 $wp_roles->remove_cap($role, $frm_role);
             }
         }
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:20,代码来源:FrmSettings.php


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