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


PHP FrmForm::duplicate方法代码示例

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


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

示例1: test_duplicate

 /**
  * @covers FrmForm::duplicate
  */
 function test_duplicate()
 {
     $form = $this->factory->form->get_object_by_id('contact');
     $id = FrmForm::duplicate($form->id);
     $this->assertTrue(is_numeric($id));
     $this->assertNotEmpty($id);
     // check the number of form actions
     $original_actions = FrmFormAction::get_action_for_form($form->id);
     $new_actions = FrmFormAction::get_action_for_form($id);
     $this->assertEquals(count($original_actions), count($new_actions));
 }
开发者ID:rbkhrlstn,项目名称:formidable-forms,代码行数:14,代码来源:test_FrmForm.php

示例2: test_duplicate

 /**
  * @covers FrmForm::duplicate
  */
 function test_duplicate()
 {
     $form = $this->factory->form->get_object_by_id($this->all_fields_form_key);
     $id = FrmForm::duplicate($form->id);
     $this->assertTrue(is_numeric($id));
     $this->assertNotEmpty($id);
     // check the number of form actions
     $original_actions = FrmFormAction::get_action_for_form($form->id);
     $new_actions = FrmFormAction::get_action_for_form($id);
     $this->assertEquals(count($original_actions), count($new_actions));
     // For repeating sections
     self::_check_if_child_forms_duplicate($form->id, $id);
     self::_check_if_form_select_updates($form->id, $id);
 }
开发者ID:knightzac19,项目名称:formidable-forms,代码行数:17,代码来源:test_FrmForm.php

示例3: duplicate

 public static function duplicate()
 {
     if (!current_user_can('frm_edit_forms')) {
         global $frm_settings;
         wp_die($frm_settings->admin_permission);
     }
     $frm_form = new FrmForm();
     $params = self::get_params();
     $form = $frm_form->duplicate($params['id'], $params['template'], true);
     $message = $params['template'] ? __('Form template was Successfully Created', 'formidable') : __('Form was Successfully Copied', 'formidable');
     if ($form) {
         return self::get_edit_vars($form, '', $message, true);
     } else {
         return self::display_forms_list($params, __('There was a problem creating new template.', 'formidable'));
     }
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:16,代码来源:FrmFormsController.php

示例4: duplicate

 public static function duplicate()
 {
     FrmAppHelper::permission_check('frm_edit_forms');
     $params = FrmForm::list_page_params();
     $form = FrmForm::duplicate($params['id'], $params['template'], true);
     $message = $params['template'] ? __('Form template was Successfully Created', 'formidable') : __('Form was Successfully Copied', 'formidable');
     if ($form) {
         return self::get_edit_vars($form, array(), $message, true);
     } else {
         return self::display_forms_list($params, __('There was a problem creating the new template.', 'formidable'));
     }
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:12,代码来源:FrmFormsController.php

示例5: copy_forms

 /**
  * Copy forms that are set to copy from one site to another
  */
 private static function copy_forms($force)
 {
     if (!$force) {
         //don't check on every page load
         $last_checked = get_option('frmpro_copies_checked');
         if (!$last_checked || time() - $last_checked >= 60 * 60) {
             //check every hour
             $force = true;
         }
     }
     if (!$force) {
         return;
     }
     global $wpdb, $blog_id;
     //get all forms to be copied from global table
     $query = $wpdb->prepare('SELECT c.*, p.post_name FROM ' . self::table_name() . ' c LEFT JOIN ' . $wpdb->prefix . 'frm_forms f ON (c.copy_key = f.form_key) LEFT JOIN ' . $wpdb->posts . ' p ON (c.copy_key = p.post_name) WHERE blog_id != %d AND ((type = %s AND f.form_key is NULL) OR (type = %s AND p.post_name is NULL)) ORDER BY type DESC', $blog_id, 'form', 'display');
     $templates = FrmAppHelper::check_cache('all_templates_' . $blog_id, 'frm_copy', $query, 'get_results');
     foreach ($templates as $temp) {
         if ($temp->type == 'form') {
             FrmForm::duplicate($temp->form_id, false, true, $temp->blog_id);
             continue;
         }
         $values = FrmProDisplay::getOne($temp->form_id, $temp->blog_id, true);
         if (!$values || 'trash' == $values->post_status) {
             continue;
         }
         // check if post with slug already exists
         $post_name = wp_unique_post_slug($values->post_name, 0, 'publish', 'frm_display', 0);
         if ($post_name != $values->post_name) {
             continue;
         }
         if ($values->post_name != $temp->copy_key) {
             $wpdb->update(self::table_name(), array('copy_key' => $values->post_name), array('id' => $temp->id));
         }
         FrmProDisplay::duplicate($temp->form_id, true, $temp->blog_id);
         //TODO: replace any ids with field keys in the display before duplicated
         unset($temp);
     }
     update_option('frmpro_copies_checked', time());
 }
开发者ID:swc-dng,项目名称:swcsandbox,代码行数:43,代码来源:FrmProCopy.php

示例6: install

 function install($force = false)
 {
     $db_version = 1.2;
     // this is the version of the database we're moving to
     $old_db_version = get_site_option('frmpro_copies_db_version');
     global $wpdb, $blog_id;
     if ($db_version != $old_db_version or $force) {
         $force = true;
         require_once ABSPATH . 'wp-admin/includes/upgrade.php';
         $charset_collate = '';
         if ($wpdb->has_cap('collation')) {
             if (!empty($wpdb->charset)) {
                 $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
             }
             if (!empty($wpdb->collate)) {
                 $charset_collate .= " COLLATE {$wpdb->collate}";
             }
         }
         /* Create/Upgrade Display Table */
         $sql = "CREATE TABLE {$this->table_name} (\n                    id int(11) NOT NULL auto_increment,\n                    type varchar(255) default NULL,\n                    copy_key varchar(255) default NULL,\n                    form_id int(11) default NULL,\n                    blog_id int(11) default NULL,\n                    created_at datetime NOT NULL,\n                    PRIMARY KEY id (id),\n                    KEY form_id (form_id),\n                    KEY blog_id (blog_id)\n            ) {$charset_collate};";
         dbDelta($sql);
         update_site_option('frmpro_copies_db_version', $db_version);
     }
     //copy forms
     if (!$force) {
         //don't check on every page load
         $last_checked = get_option('frmpro_copies_checked');
         if (!$last_checked or time() - $last_checked >= 60 * 60) {
             //check every hour
             $force = true;
         }
     }
     if ($force) {
         //get all forms to be copied from global table
         $templates = $wpdb->get_results($wpdb->prepare("SELECT c.*, p.post_name FROM {$this->table_name} c LEFT JOIN {$wpdb->prefix}frm_forms f ON (c.copy_key = f.form_key) LEFT JOIN {$wpdb->posts} p ON (c.copy_key = p.post_name) WHERE blog_id != %d AND ((type = %s AND f.form_key is NULL) OR (type = %s AND p.post_name is NULL)) ORDER BY type DESC", $blog_id, 'form', 'display'));
         foreach ($templates as $temp) {
             if ($temp->type == 'form') {
                 $frm_form = new FrmForm();
                 $frm_form->duplicate($temp->form_id, false, true, $temp->blog_id);
             } else {
                 global $frmpro_display;
                 $values = $frmpro_display->getOne($temp->form_id, $temp->blog_id, true);
                 if (!$values || 'trash' == $values->post_status) {
                     continue;
                 }
                 // check if post with slug already exists
                 $post_name = wp_unique_post_slug($values->post_name, 0, 'publish', 'frm_display', 0);
                 if ($post_name != $values->post_name) {
                     continue;
                 }
                 if ($values->post_name != $temp->copy_key) {
                     $wpdb->update($this->table_name, array('copy_key' => $values->post_name), array('id' => $temp->id));
                 }
                 $frmpro_display->duplicate($temp->form_id, true, $temp->blog_id);
                 //TODO: replace any ids with field keys in the display before duplicated
             }
             unset($temp);
         }
         update_option('frmpro_copies_checked', time());
     }
 }
开发者ID:amit0773,项目名称:manaslake,代码行数:61,代码来源:FrmProCopy.php


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