Get() public static method

if is not specified a key is return a array with all the options of magic fields
public static Get ( string $key = null )
$key string is the name of the option.
Beispiel #1
0
 /**
  *  Filter all the posts in POST -> Edit  for doesn't display 
  *  the posts created using some write panel.
  */
 public static function ExcludeWritepanelsPosts($where)
 {
     global $wpdb, $parent_file;
     $types = array('edit.php', 'edit-pages.php', 'edit.php?post_type=page');
     if (!in_array($parent_file, $types)) {
         return $where;
     }
     require_once 'RCCWP_Options.php';
     $exclude = RCCWP_Options::Get('hide-non-standart-content');
     if ($exclude == false) {
         return $where;
     }
     if (empty($_GET['filter-posts'])) {
         $where = $where . " AND 0 = (SELECT count({$wpdb->postmeta}.meta_value) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.post_id = {$wpdb->posts}.ID and {$wpdb->postmeta}.meta_key = '_mf_write_panel_id')";
     }
     //is search
     if (isset($_GET['s']) && isset($_GET['filter-posts'])) {
         $remove = "/and wp_postmeta.meta_key = '_mf_write_panel_id' and wp_postmeta.meta_value = '(\\w)'/";
         $where = preg_replace($remove, "", $where);
         $sql = $wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value = '%s'", array("_mf_write_panel_id", $_GET['custom-write-panel-id']));
         $results = $wpdb->get_results($sql);
         if (count($results) == 0) {
             return $where;
         }
         $postIDs = array();
         foreach ($results as $result) {
             $postIDs[] = $result->post_id;
         }
         if (count($postIDs) == 1) {
             $postIDs[] = $postIDs[0];
         }
         $where .= sprintf(" AND {$wpdb->posts}.ID IN (%s)", implode(",", $postIDs));
     }
     return $where;
 }
 /**
  *  Filter all the posts in POST -> Edit  for doesn't display 
  *  the posts created using some write panel.
  */
 function ExcludeWritepanelsPosts($where)
 {
     global $wpdb, $parent_file;
     if ($parent_file != 'edit.php') {
         return $where;
     }
     require_once 'RCCWP_Options.php';
     $exclude = RCCWP_Options::Get('hide-non-standart-content');
     if ($exclude == false) {
         return $where;
     }
     if (empty($_GET['filter-posts'])) {
         $where = $where . " AND 0 = (SELECT count({$wpdb->postmeta}.meta_value) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.post_id = {$wpdb->posts}.ID and {$wpdb->postmeta}.meta_key = '_mf_write_panel_id')";
     }
     return $where;
 }
/**
 * Get the value of an input field.
 *
 * @param string $fieldName
 * @param integer $groupIndex
 * @param integer $fieldIndex
 * @param boolean $readyForEIP if true and the field type is textbox or
 * 				multiline textbox, the resulting value will be wrapped
 * 				in a div that is ready for EIP. The default value is true
 * @return a string or array based on field type
 */
function get($fieldName, $groupIndex = 1, $fieldIndex = 1, $readyForEIP = true, $post_id = NULL)
{
    require_once "RCCWP_CustomField.php";
    global $post, $FIELD_TYPES;
    if (!$post_id) {
        $post_id = $post->ID;
    }
    $field = RCCWP_CustomField::GetDataField($fieldName, $groupIndex, $fieldIndex, $post_id);
    if (!$field) {
        return FALSE;
    }
    $fieldType = $field['type'];
    $fieldID = $field['id'];
    $fieldObject = $field['properties'];
    $fieldValues = (array) $field['meta_value'];
    $fieldMetaID = $field['meta_id'];
    $results = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject);
    //filter for multine line
    if ($fieldType == $FIELD_TYPES['multiline_textbox']) {
        $results = apply_filters('the_content', $results);
    }
    if ($fieldType == $FIELD_TYPES['image']) {
        $results = split('&', $results);
        $results = $results[0];
    }
    // Prepare fields for EIP
    include_once 'RCCWP_Options.php';
    $enableEditnplace = RCCWP_Options::Get('enable-editnplace');
    if ($readyForEIP && $enableEditnplace == 1 && current_user_can('edit_posts', $post->ID)) {
        switch ($fieldType) {
            case $FIELD_TYPES["textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $results = "<div class='" . EIP_textbox($fieldMetaID) . "' >" . $results . "</div>";
                break;
            case $FIELD_TYPES["multiline_textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $results = "<div class='" . EIP_mulittextbox($fieldMetaID) . "' >" . $results . "</div>";
                break;
        }
    }
    return $results;
}
Beispiel #4
0
    /**
     *  This function is executed every time to something related with the Magic Fields happen
     *  this function update,delete,create a customfield,writepanel,group.
     */
    function Main()
    {
        require_once 'RC_Format.php';
        global $CUSTOM_WRITE_PANEL, $wp_version;
        if (isset($_POST['edit-with-no-custom-write-panel'])) {
            $type = RCCWP_Post::GetCustomWritePanel();
            if (is_object($type)) {
                $ptype = $type->type;
            } else {
                $ptype = strpos($_SERVER['REQUEST_URI'], 'page.php') !== FALSE ? 'page' : 'post';
            }
            wp_redirect($ptype . '.php?action=edit&post=' . $_POST['post-id'] . '&no-custom-write-panel');
        } else {
            if (isset($_POST['edit-with-custom-write-panel']) && isset($_POST['custom-write-panel-id']) && (int) $_POST['custom-write-panel-id'] > 0) {
                if (substr($wp_version, 0, 3) >= 3.0) {
                    $ptype = 'post';
                } else {
                    $type = RCCWP_Post::GetCustomWritePanel();
                    if (is_object($type)) {
                        $ptype = $type->type;
                    } else {
                        $ptype = strpos($_SERVER['REQUEST_URI'], 'page.php') !== FALSE ? 'page' : 'post';
                    }
                }
                wp_redirect($ptype . '.php?action=edit&post=' . $_POST['post-id'] . '&custom-write-panel-id=' . $_POST['custom-write-panel-id']);
            }
        }
        if (empty($_REQUEST['mf_action'])) {
            $currentAction = "";
        } else {
            $currentAction = $_REQUEST['mf_action'];
        }
        switch ($currentAction) {
            // ------------ Write Panels
            case 'finish-create-custom-write-panel':
                include_once 'RCCWP_CustomWritePanel.php';
                $default_theme_page = NULL;
                if ($_POST['radPostPage'] == 'page') {
                    $default_theme_page = $_POST['page_template'];
                    $default_parent_page = $_POST['parent_id'];
                }
                $customWritePanelId = RCCWP_CustomWritePanel::Create($_POST['custom-write-panel-name'], $_POST['custom-write-panel-description'], $_POST['custom-write-panel-standard-fields'], $_POST['custom-write-panel-categories'], $_POST['custom-write-panel-order'], FALSE, true, $_POST['single'], $default_theme_page, $default_parent_page, $_POST['custom-write-panel-expanded']);
                wp_redirect(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $customWritePanelId));
                break;
            case 'submit-edit-custom-write-panel':
                include_once 'RCCWP_CustomWritePanel.php';
                $default_theme_page = $default_parent_page = NULL;
                if ($_POST['radPostPage'] == 'page') {
                    $default_theme_page = $_POST['page_template'];
                    $default_parent_page = $_POST['parent_id'];
                }
                $default = array('custom-write-panel-id' => '', 'custom-write-panel-name' => '', 'custom-write-panel-standard-fields' => '', 'custom-write-panel-categories' => '', 'custom-write-panel-order' => '', 'single' => '', 'theme_page' => '', 'parent_page' => '', 'expanded' => '');
                $_POST['theme_page'] = $default_theme_page;
                $_POST['parent_page'] = $default_parent_page;
                $save = array_merge($default, $_POST);
                RCCWP_CustomWritePanel::Update($save['custom-write-panel-id'], $save['custom-write-panel-name'], NULL, $save['custom-write-panel-standard-fields'], $save['custom-write-panel-categories'], $save['custom-write-panel-order'], FALSE, true, $save['single'], $save['theme_page'], $save['parent_page'], $save['custom-write-panel-expanded']);
                RCCWP_CustomWritePanel::AssignToRole($_POST['custom-write-panel-id'], 'administrator');
                break;
            case 'export-custom-write-panel':
                require_once 'RCCWP_CustomWritePanel.php';
                $panelID = $_REQUEST['custom-write-panel-id'];
                $writePanel = RCCWP_CustomWritePanel::Get($panelID);
                // send file in header
                header('Content-type: binary');
                header('Content-Disposition: attachment; filename="' . $writePanel->name . '.pnl"');
                print RCCWP_CustomWritePanel::Export($panelID);
                exit;
                break;
            case 'delete-custom-write-panel':
                include_once 'RCCWP_CustomWritePanel.php';
                RCCWP_CustomWritePanel::Delete($_GET['custom-write-panel-id']);
                break;
                // ------------ Groups
            // ------------ Groups
            case 'finish-create-custom-group':
                include_once 'RCCWP_CustomGroup.php';
                $default = array('custom-write-panel-id' => '', 'custom-group-name' => '', 'custom-group-duplicate' => '', 'custom-group-expanded' => '');
                $values = array_merge($default, $_POST);
                $customGroupId = RCCWP_CustomGroup::Create($values['custom-write-panel-id'], $values['custom-group-name'], $values['custom-group-duplicate'], $values['custom-group-expanded'], NULL);
                break;
            case 'delete-custom-group':
                include_once 'RCCWP_CustomGroup.php';
                $customGroup = RCCWP_CustomGroup::Get((int) $_REQUEST['custom-group-id']);
                RCCWP_CustomGroup::Delete($_GET['custom-group-id']);
                break;
            case 'unlink-write-panel':
                global $wpdb;
                $postId = (int) preg_replace('/post-/', '', $_REQUEST['post-id']);
                $dashboard = $_REQUEST['dashboard'];
                if ($postId) {
                    //only delete images and postmeta fields with write panels
                    if (count(get_post_meta($postId, RC_CWP_POST_WRITE_PANEL_ID_META_KEY))) {
                        $query = sprintf('SELECT wp_pm.meta_value 
						FROM %s mf_pm, %s mf_cf, %s wp_pm
						WHERE mf_pm.field_name = mf_cf.name AND mf_cf.type = 9 AND mf_pm.post_id = %d AND wp_pm.meta_id = mf_pm.id', MF_TABLE_POST_META, MF_TABLE_GROUP_FIELDS, $wpdb->postmeta, $postId);
                        $images = $wpdb->get_results($query);
                        foreach ($images as $image) {
                            if ($image->meta_value != '') {
                                $tmp = sprintf('%s%s', MF_FILES_PATH, $image->meta_value);
                                @unlink($tmp);
                            }
                        }
                        //delete all data of postmeta (WP and MF)
                        $query = sprintf('DELETE a,b from %s a INNER JOIN %s b WHERE a.meta_id = b.id AND a.post_id = %d', $wpdb->postmeta, MF_TABLE_POST_META, $postId);
                        $wpdb->query($query);
                    }
                    delete_post_meta($postId, RC_CWP_POST_WRITE_PANEL_ID_META_KEY);
                    wp_redirect($dashboard);
                    exit;
                }
                break;
            case 'submit-edit-custom-group':
                include_once 'RCCWP_CustomGroup.php';
                $default = array('custom-write-panel-id' => '', 'custom-group-name' => '', 'custom-group-duplicate' => '', 'custom-group-expanded' => '');
                $all = $_POST;
                $all['custom-group-id'] = $_REQUEST['custom-group-id'];
                $values = array_merge($default, $all);
                RCCWP_CustomGroup::Update($values['custom-group-id'], $values['custom-group-name'], $values['custom-group-duplicate'], $values['custom-group-expanded'], NULL);
                break;
                // ------------ Fields
            // ------------ Fields
            case 'copy-custom-field':
                include_once 'RCCWP_CustomField.php';
                $fieldToCopy = RCCWP_CustomField::Get($_REQUEST['custom-field-id']);
                if (RCCWP_Processor::CheckFieldName($fieldToCopy->name, $_REQUEST['custom-write-panel-id'])) {
                    $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                    wp_redirect($newURL);
                    exit;
                }
                RCCWP_CustomField::Create($_REQUEST['custom-group-id'], $fieldToCopy->name, $fieldToCopy->description, $fieldToCopy->display_order, $fieldToCopy->required_field, $fieldToCopy->type_id, $fieldToCopy->options, $fieldToCopy->default_value, $fieldToCopy->properties, $fieldToCopy->duplicate, $fieldToCopy->helptext);
            case 'continue-create-custom-field':
                if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                    $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                    wp_redirect($newURL);
                    exit;
                }
                break;
            case 'finish-create-custom-field':
                include_once 'RCCWP_CustomField.php';
                if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                    $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                    wp_redirect($newURL);
                    exit;
                }
                $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']);
                if ($current_field->has_properties) {
                    $custom_field_properties = array();
                    if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                        $custom_field_properties['size'] = $_POST['custom-field-size'];
                        if (isset($_POST['strict-max-length'])) {
                            $custom_field_properties['strict-max-length'] = $_POST['strict-max-length'];
                            if (empty($custom_field_properties['size'])) {
                                $custom_field_properties['size'] = 10;
                            }
                        }
                    } else {
                        if (in_array($current_field->name, array('Multiline Textbox'))) {
                            $custom_field_properties['height'] = $_POST['custom-field-height'];
                            $custom_field_properties['width'] = $_POST['custom-field-width'];
                            if (isset($_POST['hide-visual-editor'])) {
                                $custom_field_properties['hide-visual-editor'] = 1;
                            }
                            if (isset($_POST['strict-max-length'])) {
                                $custom_field_properties['hide-visual-editor'] = 1;
                                $custom_field_properties['strict-max-length'] = $_POST['strict-max-length'];
                                if (empty($custom_field_properties['height'])) {
                                    $custom_field_properties['height'] = 4;
                                }
                                if (empty($custom_field_properties['width'])) {
                                    $custom_field_properties['width'] = 64;
                                }
                            }
                        } else {
                            if (in_array($current_field->name, array('Date'))) {
                                $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                            } else {
                                if (in_array($current_field->name, array('Image', 'Image (Upload Media)'))) {
                                    $params = '';
                                    if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                        $params .= '&h=' . $_POST['custom-field-photo-height'];
                                    }
                                    if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                        $params .= '&w=' . $_POST['custom-field-photo-width'];
                                    }
                                    if ($_POST['custom-field-custom-params'] != '') {
                                        $params .= '&' . $_POST['custom-field-custom-params'];
                                    }
                                    if ($params) {
                                        $custom_field_properties['params'] = $params;
                                    }
                                } else {
                                    if (in_array($current_field->name, array('Date'))) {
                                        $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                                    } else {
                                        if (in_array($current_field->name, array('Slider'))) {
                                            $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                            $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                            $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                        } else {
                                            if (in_array($current_field->name, array('Related Type'))) {
                                                $custom_field_properties['panel_id'] = $_POST['custom-field-related-type-panel-id'];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $default = array('custom-group-id' => '', 'custom-field-name' => '', 'custom-field-description' => '', 'custom-field-order' => '', 'custom-field-required' => '', 'custom-field-type' => '', 'custom-field-options' => '', 'custom-field-default-value' => '', 'prop' => '', 'custom-field-duplicate' => '', 'custom-field-helptext' => '');
                $_POST['prop'] = $custom_field_properties;
                $save = array_merge($default, $_POST);
                RCCWP_CustomField::Create($save['custom-group-id'], $save['custom-field-name'], $save['custom-field-description'], $save['custom-field-order'], $save['custom-field-required'], $save['custom-field-type'], $save['custom-field-options'], $save['custom-field-default-value'], $save['prop'], $save['custom-field-duplicate'], $save['custom-field-helptext']);
                break;
            case 'submit-edit-custom-field':
                include_once 'RCCWP_CustomField.php';
                $current_field_obj = RCCWP_CustomField::Get($_POST['custom-field-id']);
                if ($_POST['custom-field-name'] != $current_field_obj->name && RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                    $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field') . '&custom-field-id=' . $_POST['custom-field-id'] . '&err_msg=-1';
                    wp_redirect($newURL);
                    exit;
                }
                $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_POST['custom-field-type']);
                if ($current_field->has_properties) {
                    $custom_field_properties = array();
                    if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                        $custom_field_properties['size'] = $_POST['custom-field-size'];
                        if (isset($_POST['strict-max-length'])) {
                            $custom_field_properties['strict-max-length'] = $_POST['strict-max-length'];
                            if (empty($custom_field_properties['size'])) {
                                $custom_field_properties['size'] = 10;
                            }
                        }
                    } else {
                        if (in_array($current_field->name, array('Multiline Textbox'))) {
                            $custom_field_properties['height'] = $_POST['custom-field-height'];
                            $custom_field_properties['width'] = $_POST['custom-field-width'];
                            if (isset($_POST['hide-visual-editor'])) {
                                $custom_field_properties['hide-visual-editor'] = 1;
                            }
                            if (isset($_POST['strict-max-length'])) {
                                $custom_field_properties['hide-visual-editor'] = 1;
                                $custom_field_properties['strict-max-length'] = $_POST['strict-max-length'];
                                if (empty($custom_field_properties['height'])) {
                                    $custom_field_properties['height'] = 4;
                                }
                                if (empty($custom_field_properties['width'])) {
                                    $custom_field_properties['width'] = 64;
                                }
                            }
                        } else {
                            if (in_array($current_field->name, array('Image', 'Image (Upload Media)'))) {
                                $params = '';
                                if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                    $params = '&h=' . $_POST['custom-field-photo-height'];
                                }
                                if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                    $params .= '&w=' . $_POST['custom-field-photo-width'];
                                }
                                if ($_POST['custom-field-custom-params'] != '') {
                                    $params .= '&' . $_POST['custom-field-custom-params'];
                                }
                                if ($params) {
                                    $custom_field_properties['params'] = $params;
                                }
                            } else {
                                if (in_array($current_field->name, array('Date'))) {
                                    $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                                } else {
                                    if (in_array($current_field->name, array('Slider'))) {
                                        $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                        $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                        $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                    } else {
                                        if (in_array($current_field->name, array('Related Type'))) {
                                            $custom_field_properties['panel_id'] = $_POST['custom-field-related-type-panel-id'];
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                $default = array('custom-group-id' => '', 'custom-field-name' => '', 'custom-field-description' => '', 'custom-field-order' => '', 'custom-field-required' => '', 'custom-field-type' => '', 'custom-field-options' => '', 'custom-field-default-value' => '', 'prop' => '', 'custom-field-duplicate' => '', 'custom-field-helptext' => '');
                $_POST['prop'] = $custom_field_properties;
                $save = array_merge($default, $_POST);
                RCCWP_CustomField::Update($save['custom-field-id'], $save['custom-field-name'], $save['custom-field-description'], $save['custom-field-order'], $save['custom-field-required'], $save['custom-field-type'], $save['custom-field-options'], $save['custom-field-default-value'], $save['prop'], $save['custom-field-duplicate'], $save['custom-field-helptext']);
                break;
            case 'delete-custom-field':
                include_once 'RCCWP_CustomField.php';
                if (isset($_REQUEST['custom-field-id']) && !empty($_REQUEST['custom-field-id'])) {
                    RCCWP_CustomField::Delete($_REQUEST['custom-field-id']);
                }
                break;
            case 'save-fields-order':
                RCCWP_CustomWritePanelPage::save_order_fields();
            default:
                if (RCCWP_Application::InWritePostPanel()) {
                    include_once 'RCCWP_Menu.php';
                    include_once 'RCCWP_WritePostPage.php';
                    $CUSTOM_WRITE_PANEL = RCCWP_Post::GetCustomWritePanel();
                    if (isset($CUSTOM_WRITE_PANEL) && !empty($CUSTOM_WRITE_PANEL)) {
                        add_action('admin_head', array('RCCWP_WritePostPage', 'CustomFieldsCSS'));
                        //adding javascripts files for the custom fields
                        add_action('admin_print_scripts', array('RCCWP_WritePostPage', 'CustomFieldsJavascript'));
                        add_action('admin_print_scripts', array('RCCWP_WritePostPage', 'ApplyWritePanelAssignedCategoriesOrTemplate'));
                        add_action('admin_head', array('RCCWP_WritePostPage', 'ApplyCustomWritePanelHeader'));
                        add_action('admin_menu', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterface'));
                    } else {
                        if (!isset($_REQUEST['no-custom-write-panel']) && isset($_REQUEST['post'])) {
                            include_once 'RCCWP_Options.php';
                            $promptEditingPost = RCCWP_Options::Get('prompt-editing-post');
                            if ($promptEditingPost == 1) {
                                wp_redirect('?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&assign-custom-write-panel=' . (int) $_GET['post']);
                            }
                        }
                    }
                } else {
                    if (isset($_POST['update-custom-write-panel-options'])) {
                        if ($_POST['uninstall-custom-write-panel'] == 'uninstall') {
                            RCCWP_Application::Uninstall();
                            wp_redirect('options-general.php');
                        } else {
                            if (isset($_POST['clear-cache-image-mf'])) {
                                $dir = MF_CACHE_DIR;
                                if (is_dir($dir)) {
                                    if ($dh = opendir($dir)) {
                                        while (($file = readdir($dh)) !== false) {
                                            if (!is_dir($file)) {
                                                @unlink(MF_CACHE_DIR . $file);
                                            }
                                        }
                                        closedir($dh);
                                    }
                                }
                            }
                            include_once 'RCCWP_Options.php';
                            $default = array('condense-menu' => 0, 'hide-non-standart-content' => 0, 'hide-write-post' => 0, 'hide-write-page' => 0, 'hide-visual-editor' => 0, 'dont-remove-tmce' => 0, 'prompt-editing-post' => 0, 'assign-to-role' => 0, 'default-custom-write-panel' => 0);
                            $save_options = $_POST;
                            unset($save_options['uninstall-custom-write-panel']);
                            unset($save_options['update-custom-write-panel-options']);
                            $save = array_merge($default, $save_options);
                            RCCWP_Options::Update($save);
                        }
                    }
                }
                if (isset($_REQUEST['post'])) {
                    // traversal addition to change write panel
                    add_action('admin_menu', array('RCCWP_WritePostPage', 'CreateAttributesBox'));
                }
        }
    }
    function Main()
    {
        global $mf_domain;
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanelOptions = RCCWP_Options::Get();
        if (function_exists('is_site_admin') && !is_site_admin()) {
            update_option("Magic_Fields_notTopAdmin", true);
        } else {
            update_option("Magic_Fields_notTopAdmin", false);
        }
        ?>
	<div class="wrap">

	<h2><?php 
        _e('Magic Fields Options', $mf_domain);
        ?>
</h2>
	
	<form action="#" method="post" id="custom-write-panel-options-form">	
	
	<h3><?php 
        _e('Write Panel Options', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> 
	
	<tr valign="top">
		<th scope="row"><?php 
        _e('Condense Menu', $mf_domain);
        ?>
</th>
		<td>
			<label for="condense-menu">
				<input name="condense-menu" id="condense-menu" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['condense-menu']);
        ?>
 type="checkbox"> &nbsp; <?php 
        _e('This option removes the write panel from the main navigation and places them inside of the post and menu pages.');
        ?>
</label>
			</td>
	</tr>
	
	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide non-standart content in Post Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-non-standart-content" >
			<input name="hide-non-standart-content" id="hide-non-standart-content" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-non-standart-content']);
        ?>
 type="checkbox"> &nbsp; <?php 
        _e('Hide posts made with Write panels in the edit section in the Post panel');
        ?>
</label>
		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Post Panel', $mf_domain);
        ?>
</th>
			<td>
			<label for="hide-write-post"> 
			<input name="hide-write-post" id="hide-write-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-post']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Post panel', $mf_domain);
        ?>
</label> 
		</td>
		</tr>
 
	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Page Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-write-page"> 
			<input name="hide-write-page" id="hide-write-page" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-page']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Page panel', $mf_domain);
        ?>
</label> 
 		</td>
	</tr>
	
	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Visual Editor (multiline)', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-visual-editor"> 
			<input name="hide-visual-editor" id="hide-visual-editor" value="1"  <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-visual-editor']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Visual Editor (multiline)', $mf_domain);
        ?>
</label> 
 		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Editing Prompt', $mf_domain);
        ?>
</th>
		<td>
			<label for="prompt-editing-post"> 
			<input name="prompt-editing-post" id="prompt-editing-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['prompt-editing-post']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Prompt when editing a Post not created with Custom Write Panel.', $mf_domain);
        ?>
</label> 
		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Assign to Role', $mf_domain);
        ?>
</th>
			<td>
			<label for="assign-to-role"> 
			<input name="assign-to-role" id="assign-to-role" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['assign-to-role']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('This option will create a capability for each write panel such that the write panel is accessible by the Administrator only by default.
			 You can assign the write panel to other roles using ', $mf_domain);
        ?>
</label><a target="_blank" href="http://sourceforge.net/projects/role-manager">Role Manager Plugin</a>. 
		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Default Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="default-custom-write-panel">
			<select name="default-custom-write-panel" id="default-custom-write-panel">
				<option value=""><?php 
        _e('(None)', $mf_domain);
        ?>
</option>
			<?php 
        $defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
            ?>
				<option value="<?php 
            echo $panel->id;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $panel->name;
            ?>
</option>
			<?php 
        }
        ?>
			</select>
			</label>
		</td>
	</tr>

	</table>

	
	<h3><?php 
        _e('Other Options', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
	<tr valign="top">
		<th scope="row"><?php 
        _e('Edit-n-place', $mf_domain);
        ?>
</th>
		<td>
			<label for="enable-editnplace"> 
			<input name="enable-editnplace" id="enable-editnplace" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['enable-editnplace']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Edit posts instantly from the post page.', $mf_domain);
        ?>
</label> 
		</td>
		</tr>
	<script type='text/javascript' src='<?php 
        echo MF_URI;
        ?>
js/sevencolorpicker.js'></script>
	<script type="text/javascript">
		jQuery('document').ready(function(){
			jQuery('#eip-highlight-color').SevenColorPicker();
		});
	</script>
	<tr>
		<th scope="row"><?php 
        _e('EIP highlight color', $mf_domain);
        ?>
 </th>
		<td>
			<label for="eip-highlight-color">
			<input name="eip-highlight-color" id="eip-highlight-color" value="<?php 
        echo $customWritePanelOptions['eip-highlight-color'];
        ?>
"  >
			&nbsp; <?php 
        _e('Use color to highlight areas EIP', $mf_domain);
        ?>
</label>
		</td>
	</tr>
	
	</table>

	<br />	
	<h3><?php 
        _e('Uninstall Magic Fields', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> 
		<tr valign="top">
			<th scope="row"><?php 
        _e('Uninstall Magic Fields', $mf_domain);
        ?>
</th>
			<td>
				<input type="text" id="uninstall-custom-write-panel" name="uninstall-custom-write-panel" size="25" /><br />
				<label for="uninstall-custom-write-panel">
				&nbsp; <?php 
        _e('Type <strong>uninstall</strong> into the textbox, click <strong>Update Options</strong>, and all the tables created by this plugin will be deleted', $mf_domain);
        ?>
</label>
			</td>
		</tr>
	</table>

	<p class="submit" ><input name="update-custom-write-panel-options" type="submit" value="<?php 
        _e('Update Options', $mf_domain);
        ?>
" /></p>
	
	</form>

	</div>
	
	<?php 
    }
 /**
  *  Create The Edit In Place  CSS file
  * 
  *  @return  bool  true if the css file was successful created
  */
 function create_EditnPlace_css($create = FALSE)
 {
     include_once 'RCCWP_Options.php';
     $eip_highlight_color = RCCWP_Options::Get('eip-highlight-color');
     if (!$eip_highlight_color) {
         $eip_highlight_color = '#FFFFFF';
     }
     $MF_URI = MF_URI;
     $arrow_image_path = MF_URI . "images/arrow.gif";
     $editnplace_css = "\n#savingDiv{\n\tfont-size: medium;\n\tfont-weight: bold;\n}\n\n.EIP_title:hover, .EIP_content:hover,\n.EIP_textbox:hover, .EIP_mulittextbox:hover {\n\tbackground-color: {$eip_highlight_color}\n}\n\n.EIPSaveCancel{\n\tpadding: 5px;\n\tmargin-top: -1px;\n\tz-index: 1000;\n\tborder-color:#CCC;\n\tborder-width:1px;\n\tborder-style:solid;\n\tbackground-color:white;\n\tposition:fixed;\n\ttop:0px !important;\n\twidth:100% !important;\n\tleft: 0px  !important;\n\t/*position:absolute;\n\tpadding-top:2px;\n\tpadding-bottom:2px;\n\tz-index: 1000;*/\n}\n\n.EIPSaveStatus{\n\tposition:absolute;\n\tfont-size: 14px;\n\tz-index: 1000;\n}\n\n.EIPnicPanelDiv{\n\tposition: absolute;\n\tbackground-image: url({$arrow_image_path});\n\twidth:154px;\n\theight:38px;\n\tz-index: 1000;\n\tmargin-top: -23px;\n}\n\ndiv.nicEdit-panel{\n\tbackground-color: white !important;\n\twidth:140px  !important;\n}\n\ndiv.nicEdit-panelContain{\n\tbackground-color: white !important;\n\tborder-bottom: 0px\t!important;\n\tborder-left: 0px\t!important;\n\tborder-right: 0px\t!important;\n\twidth: 92%\t!important;\n\tmargin-left: 2px\t!important;\n\tmargin-top: 1px\t!important;\n}\n\n.nicEdit-selected{\n\t/*background-color: #FFFFCC  !important;*/\n\tborder: thin inset   !important;\n\tpadding: 10px;\n}\n.nicEdit-button {\n\tbackground-color: white !important;\n\tborder: 0px !important;\n}\n\n.FEIP_textbox {\n        background-color: #CCC;\n        height: 32px;\n        width: 100%;       \n}\n";
     $editnplace_css_file = MF_UPLOAD_FILES_DIR . 'editnplace.css';
     $css = explode("\n", $editnplace_css);
     if (!file_exists($editnplace_css_file)) {
         $css_file_created = RCCWP_Application::save_editnplace_file($editnplace_css_file, 'EditnPlace css', $css, TRUE);
     } else {
         $css_file_created = RCCWP_Application::save_editnplace_file($editnplace_css_file, 'EditnPlace css', $css, $create);
     }
     return $css_file_created;
 }
Beispiel #7
0
function mf_shortcodes($atts)
{
    global $post, $FIELD_TYPES;
    extract(shortcode_atts(array('field' => 'no field defined or field name is wrong', 'eip' => FALSE, 'filtered' => FALSE, 'imgtag' => FALSE, 'label' => "", 'loop' => FALSE, 'loopseparator' => "|", 'checked' => "yes", 'groupindex' => 1, 'fieldindex' => 1), $atts));
    if ($loop && RCCWP_CustomField::GetFieldDuplicates($post->ID, $field, $groupindex) > 1) {
        $fieldduplicatedata = get_field_duplicate($field);
    } else {
        $fielddata = RCCWP_CustomField::GetDataField($field, $groupindex, $fieldindex, $post->ID);
    }
    $fieldType = $fielddata['type'];
    $fieldID = $fielddata['id'];
    $fieldObject = $fielddata['properties'];
    $fieldValues = (array) $fielddata['meta_value'];
    $fieldMetaID = $fielddata['meta_id'];
    $fieldresults = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject);
    $shortcode_data = $fieldresults;
    if ($fielddata['type'] == $FIELD_TYPES['multiline_textbox'] && $filtered) {
        $shortcode_data = apply_filters('the_content', $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['image']) {
        $imgresults = split('&', $fieldresults);
        if ($imgtag) {
            $shortcode_data = "<img src=\"{$imgresults['0']}\"/>";
        } else {
            $shortcode_data = $imgresults[0];
        }
    }
    if ($fielddata['type'] == $FIELD_TYPES['listbox']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox_list']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox']) {
        if ($fieldresults) {
            $shortcode_data = $checked;
        }
    }
    // Prepare fields for EIP
    $enableEditnplace = RCCWP_Options::Get('enable-editnplace');
    if ($eip && $enableEditnplace == 1 && current_user_can('edit_posts', $post->ID)) {
        switch ($fielddata['type']) {
            case $FIELD_TYPES["textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $shortcode_data = "<div class='" . EIP_textbox($fieldMetaID) . "' >" . $fieldresults . "</div>";
                break;
            case $FIELD_TYPES["multiline_textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $shortcode_data = "<div class='" . EIP_mulittextbox($fieldMetaID) . "' >" . $shortcode_data . "</div>";
                break;
        }
    }
    if ($shortcode_data || $fieldduplicatedata) {
        if ($label) {
            $shortcode_data = $label . $shortcode_data;
        } else {
            $shortcode_data = get_label($field) . " : " . $shortcode_data;
        }
        /////
        if ($field == "duplicate") {
            if ($loop) {
                return implode($loopseparator, $fieldduplicatedata);
            } else {
                return $shortcode_data;
            }
        } else {
            return $shortcode_data;
        }
        /////
    } else {
        return "no data found, please check the field name";
    }
}
Beispiel #8
0
/**
 * Get the value of an input field.
 *
 * @param string $fieldName
 * @param integer $groupIndex
 * @param integer $fieldIndex
 * @param boolean $readyForEIP if true and the field type is textbox or
 * 				multiline textbox, the resulting value will be wrapped
 * 				in a div that is ready for EIP. The default value is true
 * @return a string or array based on field type
 */
function get($fieldName, $groupIndex = 1, $fieldIndex = 1, $readyForEIP = true, $post_id = NULL)
{
    require_once "RCCWP_CustomField.php";
    global $post, $FIELD_TYPES;
    if (!$post_id) {
        $post_id = $post->ID;
    }
    $cache_name = $post_id . '/' . $fieldName . '--' . $groupIndex . '--' . $fieldIndex . '.txt';
    $field = unserialize(MF_get_cached_data($cache_name, FALSE));
    // When field is set, but it's empty, it gets a NULL value, but still this value is cached
    // therefore: if !is_null condition
    if (!$field && !is_null($field)) {
        $field = RCCWP_CustomField::GetDataField($fieldName, $groupIndex, $fieldIndex, $post_id);
        MF_put_cached_data($cache_name, serialize($field));
    }
    if (!$field) {
        return FALSE;
    }
    $fieldType = $field['type'];
    $fieldID = $field['id'];
    $fieldObject = $field['properties'];
    $fieldValues = (array) $field['meta_value'];
    $fieldMetaID = $field['meta_id'];
    $results = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject);
    //filter for multine line
    if ($fieldType == $FIELD_TYPES['multiline_textbox']) {
        if (!RCCWP_Options::Get('dont-remove-tmce')) {
            $results = apply_filters('the_content', $results);
        }
    }
    if ($fieldType == $FIELD_TYPES['image']) {
        $results = preg_split("/&/", $results);
        $results = $results[0];
    }
    if ($fieldType == $FIELD_TYPES['file'] || $fieldType == $FIELD_TYPES['image']) {
        $results = apply_filters('mf_source_image', $results);
    }
    return $results;
}
    function MultilineTextboxInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        $customFieldId = '';
        if (isset($_REQUEST['post'])) {
            $customFieldId = $customField->id;
            $value = RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter);
            $value = apply_filters('the_editor_content', $value);
        } else {
            $value = "";
        }
        $inputHeight = (int) $customField->properties['height'];
        $inputWidth = (int) $customField->properties['width'];
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        $pre_text = '';
        $hide_visual_editor = RCCWP_Options::Get('hide-visual-editor');
        if ($hide_visual_editor == '' || $hide_visual_editor == 0) {
            $pre_text = "pre_editor";
            ?>
		<div class="mf_custom_field">
		<div class="tab_multi_mf">
			<a onclick="del_editor('<?php 
            echo $inputName;
            ?>
');" class="edButtonHTML_mf">HTML</a>		
			<a onclick="add_editor('<?php 
            echo $inputName;
            ?>
');" class="edButtonHTML_mf" >Visual</a>
		</div>
		<?php 
        }
        ?>
		<div class="mul_mf">
		<textarea  <?php 
        if ($customField->required_field) {
            echo 'validate="required:true"';
        }
        ?>
 class="<?php 
        echo $requiredClass;
        ?>
 mf_editor <?php 
        echo $pre_text;
        ?>
" tabindex="3"  id="<?php 
        echo $inputName;
        ?>
" name="<?php 
        echo $inputName;
        ?>
" rows="<?php 
        echo $inputHeight;
        ?>
" cols="<?php 
        echo $inputWidth;
        ?>
"><?php 
        echo $value;
        ?>
</textarea>
		</div></div>
		<?php 
        if ($customField->required_field) {
            ?>
			<div class="mf_message_error"><label for="<?php 
            echo $inputName;
            ?>
" class="error_magicfields error">This field is required.</label></div>
		<?php 
        }
        ?>
		
	<?php 
    }
function change_number_not_write_panel_manage($where)
{
    global $parent_file;
    if (isset($_SESSION['change_number_not_write_panel_manage'])) {
        return $where;
    }
    $types = array('edit.php', 'edit-pages.php', 'edit.php?post_type=page');
    if (!in_array($parent_file, $types)) {
        return $where;
    }
    if (isset($_GET['custom-write-panel-id'])) {
        return $where;
    }
    if (!RCCWP_Options::Get('hide-non-standart-content')) {
        return $where;
    }
    $type = 'post';
    if (is_wp30()) {
        if ($parent_file == 'edit.php?post_type=page') {
            $type = 'page';
        }
    } else {
        if ($parent_file == 'edit-pages.php') {
            $type = 'page';
        }
    }
    $num_posts_mf = RCCWP_CustomWritePanel::GetCountPostNotWritePanel($type);
    printf("\n    <script type=\"text/javascript\">\n    //<![CDATA[\n      jQuery().ready(function() {\n        change_number_manage_not_write_panel('(%s)','(%s)','(%s)','(%s)','(%s)','(%s)','(%s)');\n      });\n    //]]>\n    </script>", array_sum((array) $num_posts_mf) - $num_posts_mf->trash, $num_posts_mf->publish, $num_posts_mf->pending, $num_posts_mf->draft, $num_posts_mf->private, $num_posts_mf->trash, $num_posts_mf->future);
    $_SESSION['change_number_not_write_panel_manage'] = "1";
    return $where;
}
Beispiel #11
0
    public static function Main()
    {
        global $mf_domain;
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanelOptions = RCCWP_Options::Get();
        //check dont-remove p and br
        if (!isset($customWritePanelOptions['dont-remove-tmce'])) {
            $customWritePanelOptions['dont-remove-tmce'] = 0;
        }
        if (!isset($customWritePanelOptions['use-standard-uploader'])) {
            $customWritePanelOptions['use-standard-uploader'] = 0;
        }
        if (function_exists('is_site_admin') && !is_site_admin()) {
            update_option("Magic_Fields_notTopAdmin", true);
        } else {
            update_option("Magic_Fields_notTopAdmin", false);
        }
        ?>
	<div class="wrap">

	<h2><?php 
        _e('Magic Fields Options', $mf_domain);
        ?>
</h2>

	<form action="#" method="post" id="custom-write-panel-options-form">
	<?php 
        wp_nonce_field('update-custom-write-panel-options');
        ?>
 
	<h3><?php 
        _e('Write Panel Options', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">

	<tr valign="top">
		<th scope="row"><?php 
        _e('Condense Menu', $mf_domain);
        ?>
</th>
		<td>
			<label for="condense-menu">
				<input name="condense-menu" id="condense-menu" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['condense-menu']);
        ?>
 type="checkbox"> &nbsp; <?php 
        _e('This option removes the write panel from the main navigation and places them inside of the post and menu pages.');
        ?>
</label>
			</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide non-standart content in Post Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-non-standart-content" >
			<input name="hide-non-standart-content" id="hide-non-standart-content" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-non-standart-content']);
        ?>
 type="checkbox"> &nbsp; <?php 
        _e('Hide posts made with Write panels in the edit section in the Post panel');
        ?>
</label>
		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Post Panel', $mf_domain);
        ?>
</th>
			<td>
			<label for="hide-write-post">
			<input name="hide-write-post" id="hide-write-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-post']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Post panel', $mf_domain);
        ?>
</label>
		</td>
		</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Page Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-write-page">
			<input name="hide-write-page" id="hide-write-page" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-page']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Page panel', $mf_domain);
        ?>
</label>
 		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Visual Editor (multiline)', $mf_domain);
        ?>
</th>
		<td>
			<label for="hide-visual-editor">
			<input name="hide-visual-editor" id="hide-visual-editor" value="1"  <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-visual-editor']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Visual Editor (multiline)', $mf_domain);
        ?>
</label>
 		</td>
	</tr>

        <tr valign="top">
          <th scope="row"><?php 
        _e('Do not remove tags tmce. (multiline)', $mf_domain);
        ?>
</th>
          <td>
            <label for="dont-remove-tmce">
            <input name="dont-remove-tmce" id="dont-remove-tmce" value="1"  <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['dont-remove-tmce']);
        ?>
 type="checkbox">
            &nbsp; <?php 
        _e("Stop removing the &lt;p&gt; and &lt;br /&gt; tags when saving and show them in the HTML editor", $mf_domain);
        ?>
</label>
        </td>
</tr>


  <tr valign="top">
		<th scope="row"><?php 
        _e('Use Standard File Uploader (non-ajax)', $mf_domain);
        ?>
</th>
		<td>
			<label for="use-standard-uploader">
			<input name="use-standard-uploader" id="use-standard-uploader" value="1"  <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['use-standard-uploader']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Try using the standard file uploader if the AJAX loader fails to upload to your server', $mf_domain);
        ?>
</label>
 		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Editing Prompt', $mf_domain);
        ?>
</th>
		<td>
			<label for="prompt-editing-post">
			<input name="prompt-editing-post" id="prompt-editing-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['prompt-editing-post']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Prompt when editing a Post not created with Custom Write Panel.', $mf_domain);
        ?>
</label>
		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Assign to Role', $mf_domain);
        ?>
</th>
			<td>
			<label for="assign-to-role">
			<input name="assign-to-role" id="assign-to-role" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['assign-to-role']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('This option will create a capability for each write panel such that the write panel is accessible by the Administrator only by default.
			 You can assign the write panel to other roles using ', $mf_domain);
        ?>
</label><a target="_blank" href="http://sourceforge.net/projects/role-manager">Role Manager Plugin</a>.
		</td>
	</tr>

	<tr valign="top">
		<th scope="row"><?php 
        _e('Default Panel', $mf_domain);
        ?>
</th>
		<td>
			<label for="default-custom-write-panel">
			<select name="default-custom-write-panel" id="default-custom-write-panel">
				<option value=""><?php 
        _e('(None)', $mf_domain);
        ?>
</option>
			<?php 
        $defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
            ?>
				<option value="<?php 
            echo $panel->id;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $panel->name;
            ?>
</option>
			<?php 
        }
        ?>
			</select>
			</label>
		</td>
	</tr>

	</table>

	<h3><?php 
        _e('Extra', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tr valign="top">
			<th scope="row"><?php 
        _e('Clear cache', $mf_domain);
        ?>
</th>
			<td>
				<label for="clear-cache-image-mf">
				<input name="clear-cache-image-mf" id="clear-cache-image-mf" value="1" type="checkbox">
			&nbsp; <?php 
        _e('delete all image thumbs', $mf_domain);
        ?>
</label>
			</td>
		</tr>
	</table>


	<h3><?php 
        _e('Uninstall Magic Fields', $mf_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
		<tr valign="top">
			<th scope="row"><?php 
        _e('Uninstall Magic Fields', $mf_domain);
        ?>
</th>
			<td>
				<input type="text" id="uninstall-custom-write-panel" name="uninstall-custom-write-panel" size="25" /><br />
				<label for="uninstall-custom-write-panel">
				&nbsp; <?php 
        _e('Type <strong>uninstall</strong> into the textbox, click <strong>Update Options</strong>, and all the tables created by this plugin will be deleted', $mf_domain);
        ?>
</label>
			</td>
		</tr>
	</table>

	<p class="submit" ><input name="update-custom-write-panel-options" type="submit" value="<?php 
        _e('Update Options', $mf_domain);
        ?>
" /></p>

	</form>

	</div>

	<?php 
    }
    public static function attributesBoxContentPage($post)
    {
        global $wpdb;
        $single_panel = FALSE;
        $panel_id = get_post_meta($post->ID, "_mf_write_panel_id", TRUE);
        if ($panel_id) {
            $panel = RCCWP_CustomWritePanel::Get($panel_id);
        }
        ?>
    	<p><strong><?php 
        _e('Write Panel');
        ?>
</strong></p>
    	<label class="screen-reader-text" for="parent_id"><?php 
        _e('Write Panel1111');
        ?>
</label>
    	<?php 
        // get a list of the write panels
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $promptEditingPost = RCCWP_Options::Get('prompt-editing-post');
        $templates_by_filename = array();
        $templates = get_page_templates();
        // get the reverse map
        foreach ($templates as $name => $file) {
            $templates_by_filename[$file] = $name;
        }
        ?>
    	
    	<select name="rc-cwp-change-custom-write-panel-id" id="rc-cwp-change-custom-write-panel-id">
          <option value="-1"><?php 
        _e('(None)', $mf_domain);
        ?>
</option>
          
    		<?php 
        $items = array();
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $panel_id ? 'selected="selected"' : '';
            $panel_theme = RCCWP_CustomWritePanel::GetThemePage($panel->name);
            $parent_page = RCCWP_CustomWritePanel::GetParentPage($panel->name);
            if ($parent_page != '') {
                $pp = get_page($parent_page);
                if ($pp) {
                    $parent_page_title = $pp->post_title;
                }
            }
            $allow = $panel->type == "page";
            if ($panel->single && $panel->id != $panel_id) {
                // check to see if there are any posts with this panel already. If so, we can't allow it to be used.
                $sql = $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->postmeta} WHERE {$wpdb->postmeta}.meta_value = %d AND {$wpdb->postmeta}.meta_key = %s", array($panel->id, "_mf_write_panel_id"));
                $count = $wpdb->get_var($sql);
                $allow = $count == 0;
            }
            if ($allow) {
                // cannot change to "single" panels
                ?>
    				<option value="<?php 
                echo $panel->id;
                ?>
" <?php 
                echo $selected;
                ?>
><?php 
                echo $panel->name;
                ?>
</option>
    				<?php 
                $items[$panel->id] = "{ panel_theme: '" . $panel_theme . "', template_name: '" . addslashes($templates_by_filename[$panel_theme]) . "', parent_page: '" . $parent_page . "', parent_page_title: '" . addslashes($parent_page_title) . "' }";
            }
        }
        ?>
    		</select>

        <script type="text/javascript">
        var mf_panel_items = { "-1" : { panel_theme: '', template_name: '', parent_page: '', parent_page_title: '' } };
        
        <?php 
        foreach ($items as $key => $value) {
            ?>
 
        mf_panel_items[<?php 
            echo $key;
            ?>
] = <?php 
            echo $value;
            ?>
; 
        <?php 
        }
        ?>
        
        </script>


    <div id="rc-cwp-set-buttons">
      <p><?php 
        _e('Note: Custom fields and groups associated with the selected write panel will be only be displayed once you have saved this page or post.');
        ?>
</p>
      <p><?php 
        _e('Before saving you may also like to set the <strong>Template</strong> and/or <strong>Parent</strong> in the <strong>Page Attributes</strong> panel to match the defaults for the selected write panel (recommended)');
        ?>
</p>
      <div class="inside">
        <input class="button" type="button" id="rc-cwp-set-page-template" value="<?php 
        _e('Set Page Template');
        ?>
" />
        <input class="button" type="button" id="rc-cwp-set-page-parent" value="<?php 
        _e('Set Page Parent');
        ?>
" />
      </div>
      <div class="mf-panel-info">
      <h5 class="mf-hd-panel-info">Defaults for the selected write panel</h5>
      <p>
        Template: <span id="mf-page-template-display"></span><br />
        Parent: <span id="mf-page-parent-display"></span>
      </p>
    </div>
    
  </div>
    <?php 
    }
Beispiel #13
0
    function PhotoInterface($customField, $inputName, $groupCounter, $fieldCounter)
    {
        global $flutter_domain;
        $customFieldId = '';
        // <---- ¿?
        $filepath = $inputName . '_filepath';
        /// <---- ¿?
        $noimage = "";
        // <---- if no exists image?
        $freshPageFolderName = dirname(plugin_basename(__FILE__));
        if ($customField->required_field) {
            $requiredClass = "field_required";
        }
        //global $countImageThumbID;
        $imageThumbID = "";
        $imageThumbID = "img_thumb_" . $inputName;
        if (isset($_REQUEST['post'])) {
            $customFieldId = $customField->id;
            $value = RCCWP_CustomField::GetCustomFieldValues(true, $_REQUEST['post'], $customField->name, $groupCounter, $fieldCounter);
            $path = PHPTHUMB . "?src=" . FLUTTER_FILES_PATH;
            $valueRelative = $value;
            $value = $path . $value;
            if (!(strpos($value, 'http') === FALSE)) {
                $hidValue = str_replace('"', "'", $valueRelative);
            }
            $value = stripslashes(trim("\\<img src=\\'" . $value . "\\' class=\"freshout\" \\/\\>"));
        } else {
            if (!empty($customField->value)) {
                $path = PHPTHUMB . "?src=" . FLUTTER_FILES_PATH;
                $valueRelative = $customField->value;
                $value = $path . $customField->value;
                if (!(strpos($value, 'http') === FALSE)) {
                    $hidValue = str_replace('"', "'", $valueRelative);
                    $value = stripslashes(trim("\\<img src=\\'" . $value . "\\' class=\"freshout\" \\/\\>"));
                }
            } else {
                $noimage = "<img src='" . FLUTTER_URI . "images/noimage.jpg' id='" . $imageThumbID . "'/>";
            }
        }
        if ($valueRelative == '') {
            $noimage = "<img src='" . FLUTTER_URI . "images/noimage.jpg' id='" . $imageThumbID . "'/>";
        }
        include_once 'RCCWP_Options.php';
        $useSnipshot = RCCWP_Options::Get('use-snipshot');
        // If the field is at right, set a constant width to the text box
        $field_group = RCCWP_CustomGroup::Get($customField->group_id);
        $urlInputSize = false;
        $is_canvas = 0;
        if ($field_group->at_right) {
            $urlInputSize = 5;
            $is_canvas = 1;
        }
        ?>

		<p class="error_msg_txt" id="upload_progress_<?php 
        echo $inputName;
        ?>
" style="visibility:hidden;height:0px"></p>
		

        <!--- This Script is for remove the image -->
	    <script type="text/javascript">
             remove_photo2 = function(ide){
                if(confirm("<?php 
        _e('Are you sure?', $flutter_domain);
        ?>
")){
                        //get the  name to the image
                        //id = ide.split("-")[1];
                        id = ide;
                        image = jQuery('#'+id).val();
                        jQuery.get('<?php 
        echo FLUTTER_URI;
        ?>
RCCWP_removeFiles.php',{'action':'delete','file':image},
                                    function(message){
                                        if(message == "true"){
                                            photo = "img_thumb_" + id;
                                            jQuery("#"+photo).attr("src","<?php 
        echo FLUTTER_URI . "images/noimage.jpg";
        ?>
");
                                            jQuery("#photo_edit_link_"+id).empty();
                                            jQuery("#"+id).val("");

                                        }
                                    });
                    }
            }

            remove_photo = function(){
                if(confirm("<?php 
        _e('Are you sure?', $flutter_domain);
        ?>
")){
                        //get the  name to the image
                        id = jQuery(this).attr('id').split("-")[1];
                        image = jQuery('#'+id).val();
                        jQuery.get('<?php 
        echo FLUTTER_URI;
        ?>
RCCWP_removeFiles.php',{'action':'delete','file':image},
                                    function(message){
                                        if(message == "true"){
                                            photo = "img_thumb_" + id;
                                            jQuery("#"+photo).attr("src","<?php 
        echo FLUTTER_URI . "images/noimage.jpg";
        ?>
");
                                            jQuery("#photo_edit_link_"+id).empty();
                                            jQuery("#"+id).val("");

                                        }
                                    });
                    }
            }

            jQuery(document).ready(function(){
                jQuery(".remove").click(remove_photo);
            });
        </script>
        <!-- Here finish -->


		<div id="image_photo" style="width:150px;">
		
			<?php 
        if ($valueRelative != "") {
            if (!(strpos($value, '<img src') === FALSE)) {
                $valueLinkArr = explode("'", $value);
                $valueLink = $valueLinkArr[1];
                //$valueLink = $value;
                if (!(strpos($value, '&sw') === FALSE)) {
                    // Calculating Image Width/Height
                    $arrSize = explode("=", $value);
                    $arrSize1 = explode("&", $arrSize[3]);
                    $arrSize2 = explode("&", $arrSize[4]);
                    $imageWidth = $arrSize1[0];
                    $imageHeight = $arrSize2[0];
                    // END
                    $valueArr = explode("&sw", $value);
                    $valueArr = explode("'", $valueArr[1]);
                    $value = str_replace("&sw" . $valueArr[0] . "'", "&sw" . $valueArr[0] . "&w=150&h=120' align='center' id='" . $imageThumbID . "'", $value);
                } else {
                    if (!(strpos($value, '&w') === FALSE)) {
                        // Calculating Image Width/Height
                        $arrSize = explode("=", $value);
                        $arrSize1 = explode("&", $arrSize[3]);
                        $arrSize2 = explode("'", $arrSize[4]);
                        $imageWidth = $arrSize1[0];
                        $imageHeight = $arrSize2[0];
                        // END
                        $valueArr = explode("&", $value);
                        $valueArr = explode("'", $valueArr[2]);
                        $value = str_replace($valueArr[0], "&w=150&h=120' align='left' id='" . $imageThumbID . "'", $value);
                    } else {
                        // Calculating Image Width/Height
                        $arrSize = explode("&", $params);
                        $arrSize1 = explode("=", $arrSize[1]);
                        $arrSize2 = explode("=", $arrSize[2]);
                        $imageWidth = $arrSize1[1];
                        $imageHeight = $arrSize2[1];
                        // END
                        $valueArr = explode("'", $value);
                        $value = str_replace($valueArr[1], $valueArr[1] . "&w=150' id='" . $imageThumbID . "' align='", $value);
                    }
                }
                if (!empty($imageWidth)) {
                    ?>

						<?php 
                }
                echo '<a style="display: block;margin-left: auto;margin-right: auto " href="' . $valueLink . '" target="_blank">' . $value . '</a>';
            }
        }
        echo $noimage;
        $arrSize = explode("phpThumb.php?src=", $valueLink);
        $fileLink = $arrSize[1];
        $andPos = strpos($arrSize[1], "?");
        if ($andPos === FALSE) {
            $andPos = strpos($arrSize[1], "&");
        }
        // Remove & parameters from file path
        if ($andPos > 0) {
            $fileLink = substr($arrSize[1], 0, $andPos);
        }
        $ext = substr($fileLink, -3, 3);
        ?>
	
		
		<div id="photo_edit_link_<?php 
        echo $inputName;
        ?>
" class="photo_edit_link"> 
			
				<?php 
        if (isset($_REQUEST['post']) && $hidValue != '') {
            if (False) {
                echo "<a href='" . RCCWP_WritePostPage::snipshot_anchor($fileLink) . "' class='thickbox' tittle='Flutter'<strong onclick=prepareUpdatePhoto('{$inputName}')>" . __("Edit", $flutter_domain) . "</strong> </a>";
            } else {
                $cropperLink = FLUTTER_URI . "cropper.php?input_name=" . urlencode($inputName) . "&id=" . urlencode($hidValue) . "&url=" . urlencode($_SERVER['REQUEST_URI']) . "&imageThumbId={$imageThumbID}";
                ?>
						<a  rel="gb_page_fs[]" href="<?php 
                echo $cropperLink;
                ?>
" title="Flutter" class="greybox" id="lnkCropper"> <strong><?php 
                _e('Crop', $flutter_domain);
                ?>
</strong> </a>
				<?php 
            }
            echo "&nbsp;<strong><a href='#remove' class='remove' id='remove-{$inputName}'>" . __("Delete", $flutter_domain) . "</a></strong>";
        }
        ?>
			
		    </div>
		</div>
		<br />
		<div id="image_input">
					
			<input tabindex="3" 
				id="<?php 
        echo $inputName;
        ?>
" 
				name="<?php 
        echo $inputName;
        ?>
" 
				type="hidden" 
				class="<?php 
        echo $requiredClass;
        ?>
"
				size="46"
				value="<?php 
        echo $hidValue;
        ?>
"
				/>
			
			<?php 
        include_once "RCCWP_SWFUpload.php";
        RCCWP_SWFUpload::Body($inputName, 1, $is_canvas, $urlInputSize);
        ?>

		</div>
		
		<input type="hidden" name="rc_cwp_meta_photos[]" value="<?php 
        echo $inputName;
        ?>
" 	/>
		<input type="hidden" name="<?php 
        echo $inputName;
        ?>
_dorename" id="<?php 
        echo $inputName;
        ?>
_dorename" value="0" />
		

		<!-- Used to store name of URL Field -->
		<!--<input type="hidden" name="parent_text_<?php 
        echo $countImageThumbID;
        ?>
" id="parent_text_<?php 
        echo $countImageThumbID;
        ?>
" value="<?php 
        echo $filepath;
        ?>
"/>
		<input type="hidden" name="hidImgValue<?php 
        echo $countImageThumbID;
        ?>
" id="hidImgValue<?php 
        echo $countImageThumbID;
        ?>
" value="<?php 
        echo $inputName;
        ?>
_last" />-->

		<?php 
    }
Beispiel #14
0
        require_once 'RCCWP_Options.php';
        $dont_remove = RCCWP_Options::Get('dont-remove-tmce');
        if ($dont_remove) {
            add_action('admin_print_footer_scripts', 'tmce_not_remove_p_and_br', 50);
        }
    }
}
add_action('pre_get_posts', array('RCCWP_Query', 'FilterPrepare'));
add_filter('posts_where', array('RCCWP_Query', 'FilterCustomPostsWhere'));
add_filter('posts_where', array('RCCWP_Query', 'ExcludeWritepanelsPosts'));
add_filter('posts_orderby', array('RCCWP_Query', 'FilterCustomPostsOrderby'));
add_filter('posts_fields', array('RCCWP_Query', 'FilterCustomPostsFields'));
add_filter('posts_join_paged', array('RCCWP_Query', 'FilterCustomPostsJoin'));
//in search add conditions for look in postmeta
add_filter('posts_where_request', array('RCCWP_Query', 'AddConditionForSearchInPostmeta'));
$condense = RCCWP_Options::Get('condense-menu');
if ($condense) {
    //adding Column for posts
    add_filter('manage_posts_columns', array('RCCWP_Query', 'ColumnWritePanel'));
    add_action('manage_posts_custom_column', array('RCCWP_Query', 'ColumnWritePanelData'));
    //adding Column for pages
    add_filter('manage_pages_columns', array('RCCWP_Query', 'ColumnWritePanel'));
    add_action('manage_pages_custom_column', array('RCCWP_Query', 'ColumnWritePanelData'));
}
add_action('edit_page_form', 'cwp_add_pages_identifiers');
add_action('edit_form_advanced', 'cwp_add_type_identifier');
add_action('edit_form_advanced', 'mf_put_write_panel_id');
add_action('edit_page_form', 'mf_put_write_panel_id');
/**
 * put the id of the write panel as a hidden field in the 'create post/page' and 'edit post/page'
 */
Beispiel #15
0
 function Set($key, $val)
 {
     $options = RCCWP_Options::Get();
     $options[$key] = $val;
     RCCWP_Options::Update($options);
 }
Beispiel #16
0
 function Main()
 {
     require_once 'RC_Format.php';
     global $CUSTOM_WRITE_PANEL;
     wp_enqueue_script('jquery-ui-sortable');
     if (isset($_POST['edit-with-no-custom-write-panel'])) {
         wp_redirect('post.php?action=edit&post=' . $_POST['post-id'] . '&no-custom-write-panel=' . $_POST['custom-write-panel-id']);
     } else {
         if (isset($_POST['edit-with-custom-write-panel'])) {
             wp_redirect('post.php?action=edit&post=' . $_POST['post-id'] . '&custom-write-panel-id=' . $_POST['custom-write-panel-id']);
         }
     }
     if (empty($_REQUEST['flutter_action'])) {
         $currentAction = "";
     } else {
         $currentAction = $_REQUEST['flutter_action'];
     }
     switch ($currentAction) {
         // ------------ Write Panels
         case 'finish-create-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             $default_theme_page = NULL;
             if ($_POST['radPostPage'] == 'page') {
                 $default_theme_page = $_POST['page_template'];
             }
             $customWritePanelId = RCCWP_CustomWritePanel::Create($_POST['custom-write-panel-name'], $_POST['custom-write-panel-description'], $_POST['custom-write-panel-standard-fields'], $_POST['custom-write-panel-categories'], $_POST['custom-write-panel-order'], FALSE, true, $_POST['single'], $default_theme_page);
             wp_redirect(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $customWritePanelId));
             break;
         case 'submit-edit-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             $default_theme_page = NULL;
             if ($_POST['radPostPage'] == 'page') {
                 $default_theme_page = $_POST['page_template'];
             }
             RCCWP_CustomWritePanel::Update($_POST['custom-write-panel-id'], $_POST['custom-write-panel-name'], $_POST['custom-write-panel-description'], $_POST['custom-write-panel-standard-fields'], $_POST['custom-write-panel-categories'], $_POST['custom-write-panel-order'], FALSE, true, $_POST['single'], $default_theme_page);
             RCCWP_CustomWritePanel::AssignToRole($_POST['custom-write-panel-id'], 'administrator');
             break;
         case 'export-custom-write-panel':
             require_once 'RCCWP_CustomWritePanel.php';
             $panelID = $_REQUEST['custom-write-panel-id'];
             $writePanel = RCCWP_CustomWritePanel::Get($panelID);
             $exportedFilename = $tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $writePanel->name . '.pnl';
             RCCWP_CustomWritePanel::Export($panelID, $exportedFilename);
             // send file in header
             header('Content-type: binary');
             header('Content-Disposition: attachment; filename="' . $writePanel->name . '.pnl"');
             readfile($exportedFilename);
             unlink($exportedFilename);
             exit;
             break;
         case 'delete-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             RCCWP_CustomWritePanel::Delete($_GET['custom-write-panel-id']);
             //wp_redirect('?page=' . urlencode(FLUTTER_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php'));
             break;
             // ------------ Modules
             // ------------ Groups
         // ------------ Modules
         // ------------ Groups
         case 'finish-create-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             $customGroupId = RCCWP_CustomGroup::Create($_POST['custom-write-panel-id'], $_POST['custom-group-name'], $_POST['custom-group-duplicate'], $_POST['custom-group-at_right']);
             break;
         case 'delete-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             $customGroup = RCCWP_CustomGroup::Get((int) $_REQUEST['custom-group-id']);
             RCCWP_CustomGroup::Delete($_GET['custom-group-id']);
             break;
         case 'submit-edit-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             RCCWP_CustomGroup::Update($_REQUEST['custom-group-id'], $_POST['custom-group-name'], $_POST['custom-group-duplicate'], $_POST['custom-group-at_right']);
             break;
             // ------------ Fields
         // ------------ Fields
         case 'copy-custom-field':
             include_once 'RCCWP_CustomField.php';
             $fieldToCopy = RCCWP_CustomField::Get($_REQUEST['custom-field-id']);
             if (RCCWP_Processor::CheckFieldName($fieldToCopy->name, $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             RCCWP_CustomField::Create($_REQUEST['custom-group-id'], $fieldToCopy->name, $fieldToCopy->description, $fieldToCopy->display_order, $fieldToCopy->required_field, $fieldToCopy->type_id, $fieldToCopy->options, $fieldToCopy->default_value, $fieldToCopy->properties, $fieldToCopy->duplicate);
         case 'continue-create-custom-field':
             if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             break;
         case 'finish-create-custom-field':
             include_once 'RCCWP_CustomField.php';
             if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']);
             if ($current_field->has_properties) {
                 $custom_field_properties = array();
                 if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                     $custom_field_properties['size'] = $_POST['custom-field-size'];
                 } else {
                     if (in_array($current_field->name, array('Multiline Textbox'))) {
                         $custom_field_properties['height'] = $_POST['custom-field-height'];
                         $custom_field_properties['width'] = $_POST['custom-field-width'];
                     } else {
                         if (in_array($current_field->name, array('Date'))) {
                             $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                         } else {
                             if (in_array($current_field->name, array('Image'))) {
                                 $params = '';
                                 if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                     $params .= '&h=' . $_POST['custom-field-photo-height'];
                                 }
                                 if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                     $params .= '&w=' . $_POST['custom-field-photo-width'];
                                 }
                                 if ($_POST['custom-field-custom-params'] != '') {
                                     $params .= '&' . $_POST['custom-field-custom-params'];
                                 }
                                 if ($params) {
                                     $custom_field_properties['params'] = $params;
                                 }
                             } else {
                                 if (in_array($current_field->name, array('Date'))) {
                                     $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                                 } else {
                                     if (in_array($current_field->name, array('Slider'))) {
                                         $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                         $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                         $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             RCCWP_CustomField::Create($_POST['custom-group-id'], $_POST['custom-field-name'], $_POST['custom-field-description'], $_POST['custom-field-order'], $_POST['custom-field-required'], $_POST['custom-field-type'], $_POST['custom-field-options'], $_POST['custom-field-default-value'], $custom_field_properties, $_POST['custom-field-duplicate']);
             break;
         case 'submit-edit-custom-field':
             include_once 'RCCWP_CustomField.php';
             $current_field_obj = RCCWP_CustomField::Get($_POST['custom-field-id']);
             if ($_POST['custom-field-name'] != $current_field_obj->name && RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field') . '&custom-field-id=' . $_POST['custom-field-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_POST['custom-field-type']);
             if ($current_field->has_properties) {
                 $custom_field_properties = array();
                 if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                     $custom_field_properties['size'] = $_POST['custom-field-size'];
                 } else {
                     if (in_array($current_field->name, array('Multiline Textbox'))) {
                         $custom_field_properties['height'] = $_POST['custom-field-height'];
                         $custom_field_properties['width'] = $_POST['custom-field-width'];
                     } else {
                         if (in_array($current_field->name, array('Image'))) {
                             $params = '';
                             if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                 $params = '&h=' . $_POST['custom-field-photo-height'];
                             }
                             if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                 $params .= '&w=' . $_POST['custom-field-photo-width'];
                             }
                             if ($_POST['custom-field-custom-params'] != '') {
                                 $params .= '&' . $_POST['custom-field-custom-params'];
                             }
                             if ($params) {
                                 $custom_field_properties['params'] = $params;
                             }
                         } else {
                             if (in_array($current_field->name, array('Date'))) {
                                 $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                             } else {
                                 if (in_array($current_field->name, array('Slider'))) {
                                     $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                     $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                     $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                 }
                             }
                         }
                     }
                 }
             }
             RCCWP_CustomField::Update($_POST['custom-field-id'], $_POST['custom-field-name'], $_POST['custom-field-description'], $_POST['custom-field-order'], $_POST['custom-field-required'], $_POST['custom-field-type'], $_POST['custom-field-options'], $_POST['custom-field-default-value'], $custom_field_properties, $_POST['custom-field-duplicate']);
             break;
         case 'delete-custom-field':
             include_once 'RCCWP_CustomField.php';
             if (isset($_REQUEST['custom-group-id']) && !empty($_REQUEST['custom-group-id'])) {
                 $customGroupId = (int) $_REQUEST['custom-group-id'];
             }
             $customGroup = RCCWP_CustomGroup::Get($customGroupId);
             RCCWP_CustomField::Delete($_REQUEST['custom-field-id']);
             break;
         case 'delete-theme-settings':
             include_once 'RCCWP_ThemeSettingsPage.php';
             $settings = new RCCWP_ThemeSettingsPage();
             $settings->remove_layout_setting();
             break;
         case 'create-layout-setting':
             include_once 'RCCWP_ThemeSettingsPage.php';
             if (!empty($_POST['variable_name'])) {
                 RCCWP_ThemeSettingsPage::finish_create_layout_element();
                 break;
             }
         default:
             if (RCCWP_Application::InWritePostPanel()) {
                 include_once 'RCCWP_Menu.php';
                 include_once 'RCCWP_WritePostPage.php';
                 $CUSTOM_WRITE_PANEL = RCCWP_Post::GetCustomWritePanel();
                 if (isset($CUSTOM_WRITE_PANEL) && $CUSTOM_WRITE_PANEL > 0) {
                     ob_start(array('RCCWP_WritePostPage', 'ApplyCustomWritePanelAssignedCategories'));
                     add_action('admin_head', array('RCCWP_WritePostPage', 'ApplyCustomWritePanelHeader'));
                     // Allows fields to be added to right
                     //	commented to test		add_action('submitpost_box', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterfaceRight'), 5);
                     //						add_action('submitpage_box', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterfaceRight'), 5);
                     // commented to test
                     add_action('add_meta_box', 'post', 'side', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterfaceRight'));
                     // Allows fields to be added to the post edit body
                     add_action('simple_edit_form', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterface'), 5);
                     add_action('edit_form_advanced', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterface'), 5);
                     add_action('edit_page_form', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterface'), 5);
                 } else {
                     if (!isset($_REQUEST['no-custom-write-panel']) && isset($_REQUEST['post'])) {
                         include_once 'RCCWP_Options.php';
                         $promptEditingPost = RCCWP_Options::Get('prompt-editing-post');
                         if ($promptEditingPost == 1) {
                             wp_redirect('?page=' . urlencode(FLUTTER_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&assign-custom-write-panel=' . (int) $_GET['post']);
                         }
                     }
                 }
             } else {
                 if (isset($_POST['finish-create-custom-write-module'])) {
                     include_once 'RCCWP_CustomWriteModule.php';
                     $customWriteModuleId = RCCWP_CustomWriteModule::Create($_POST['custom-write-module-name'], $_POST['custom-write-module-description']);
                     //RCCWP_CustomWritePanel::AssignToRole($customWritePanelId, 'administrator');
                     if ($customWriteModuleId == -1) {
                         //$_POST['create-custom-write-module'] = 1;
                         $modulesURL = '?page=' . 'FlutterManageModules' . '&view-modules=1&create-custom-write-module=1&err_msg=-1';
                         wp_redirect($modulesURL);
                     } else {
                         wp_redirect(RCCWP_ManagementPage::GetCustomWriteModuleEditUrl($customWriteModuleId));
                     }
                 } else {
                     if (isset($_POST['submit-edit-custom-write-module'])) {
                         include_once 'RCCWP_CustomWriteModule.php';
                         $customWriteModuleId = RCCWP_CustomWriteModule::Update($_REQUEST['custom-write-module-id'], $_REQUEST['custom-write-module-name'], $_REQUEST['custom-write-module-description']);
                         if ($customWriteModuleId == -1) {
                             $customWriteModuleId = $_REQUEST['custom-write-module-id'];
                             $modulesURL = '?page=' . 'FlutterManageModules' . "&edit-custom-write-module=1&view-custom-write-module={$customWriteModuleId}&custom-write-module-id={$customWriteModuleId}&err_msg=-1";
                             wp_redirect($modulesURL);
                         }
                         //RCCWP_CustomWritePanel::AssignToRole($_POST['custom-write-panel-id'], 'administrator');
                     } else {
                         if (isset($_POST['update-custom-write-panel-options'])) {
                             if ($_POST['uninstall-custom-write-panel'] == 'uninstall') {
                                 RCCWP_Application::Uninstall();
                                 wp_redirect('options-general.php');
                             } else {
                                 include_once 'RCCWP_Options.php';
                                 $options['hide-write-post'] = $_POST['hide-write-post'];
                                 $options['hide-write-page'] = $_POST['hide-write-page'];
                                 $options['hide-visual-editor'] = $_POST['hide-visual-editor'];
                                 $options['prompt-editing-post'] = $_POST['prompt-editing-post'];
                                 $options['assign-to-role'] = $_POST['assign-to-role'];
                                 $options['use-snipshot'] = $_POST['use-snipshot'];
                                 $options['enable-editnplace'] = $_POST['enable-editnplace'];
                                 $options['eip-highlight-color'] = $_POST['eip-highlight-color'];
                                 $options['enable-swfupload'] = $_POST['enable-swfupload'];
                                 $options['enable-browserupload'] = $_POST['enable-browserupload'];
                                 $options['default-custom-write-panel'] = $_POST['default-custom-write-panel'];
                                 $options['enable-HTMLPurifier'] = $_POST['enable-HTMLPurifier'];
                                 $options['tidy-level'] = $_POST['tidy-level'];
                                 $options['canvas_show_instructions'] = $_POST['canvas_show_instructions'];
                                 $options['canvas_show_zone_name'] = $_POST['canvas_show_zone_name'];
                                 $options['canvas_show'] = $_POST['canvas_show'];
                                 $options['ink_show'] = $_POST['ink_show'];
                                 RCCWP_Options::Update($options);
                             }
                         } else {
                             if (isset($_REQUEST['create-module-duplicate'])) {
                                 include_once 'RCCWP_ModuleDuplicate.php';
                                 $moduleID = $_REQUEST['custom-write-module-id'];
                                 RCCWP_ModuleDuplicate::Create($moduleID);
                                 wp_redirect(RCCWP_ManagementPage::GetCustomWriteModuleEditUrl($moduleID));
                             } else {
                                 if (isset($_POST['submit-edit-module-duplicate'])) {
                                     include_once 'RCCWP_ModuleDuplicate.php';
                                     $moduleID = $_REQUEST['custom-write-module-id'];
                                     RCCWP_ModuleDuplicate::Update($_REQUEST['module-duplicate-id'], $_REQUEST['module-duplicate-name']);
                                     wp_redirect('?page=' . urlencode(FLUTTER_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&view-custom-write-module=' . $moduleID . '&custom-write-module-id=' . $moduleID);
                                 } else {
                                     if (isset($_REQUEST['delete-module-duplicate'])) {
                                         include_once 'RCCWP_ModuleDuplicate.php';
                                         $moduleID = $_REQUEST['custom-write-module-id'];
                                         RCCWP_ModuleDuplicate::Delete($_REQUEST['module-duplicate-id']);
                                         wp_redirect(RCCWP_ManagementPage::GetCustomWriteModuleEditUrl($moduleID));
                                     } else {
                                         if (isset($_POST['delete-custom-write-module'])) {
                                             include_once 'RCCWP_CustomWriteModule.php';
                                             $moduleID = $_REQUEST['custom-write-module-id'];
                                             RCCWP_CustomWriteModule::Delete($moduleID);
                                             wp_redirect('?page=' . urlencode(FLUTTER_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&view-modules=1');
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
     }
 }
Beispiel #17
0
/**
 * Get the value of an input field.
 *
 * @param string $fieldName
 * @param integer $groupIndex
 * @param integer $fieldIndex
 * @param boolean $readyForEIP if true and the field type is textbox or
 * 				multiline textbox, the resulting value will be wrapped
 * 				in a div that is ready for EIP. The default value is true
 * @return a string or array based on field type
 */
function get($fieldName, $groupIndex = 1, $fieldIndex = 1, $readyForEIP = true)
{
    require_once "RCCWP_CustomField.php";
    global $wpdb, $post, $FIELD_TYPES;
    $fieldID = RCCWP_CustomField::GetIDByName($fieldName);
    $fieldObject = GetFieldInfo($fieldID);
    $fieldType = $wpdb->get_var("SELECT type FROM " . RC_CWP_TABLE_GROUP_FIELDS . " WHERE id='" . $fieldID . "'");
    $single = true;
    switch ($fieldType) {
        case $FIELD_TYPES["checkbox_list"]:
        case $FIELD_TYPES["listbox"]:
            $single = false;
            break;
    }
    $fieldValues = (array) RCCWP_CustomField::GetCustomFieldValues($single, $post->ID, $fieldName, $groupIndex, $fieldIndex);
    $fieldMetaID = RCCWP_CustomField::GetMetaID($post->ID, $fieldName, $groupIndex, $fieldIndex);
    $results = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject->properties);
    //filter for multine line
    if ($fieldType == $FIELD_TYPES['multiline_textbox']) {
        $results = apply_filters('the_content', $results);
    }
    // Prepare fields for EIP
    include_once 'RCCWP_Options.php';
    $enableEditnplace = RCCWP_Options::Get('enable-editnplace');
    if ($readyForEIP && $enableEditnplace == 1 && current_user_can('edit_posts', $post->ID)) {
        switch ($fieldType) {
            case $FIELD_TYPES["textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $results = "<div class='" . EIP_textbox($fieldMetaID) . "' >" . $results . "</div>";
                break;
            case $FIELD_TYPES["multiline_textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $results = "<div class='" . EIP_mulittextbox($fieldMetaID) . "' >" . $results . "</div>";
                break;
        }
    }
    return $results;
}
Beispiel #18
0
    function Body($inputName, $fileType, $isCanvas = 0, $urlInputSize = false)
    {
        global $flutter_domain;
        include_once 'RCCWP_Options.php';
        if (!$urlInputSize) {
            $urlInputSize = 20;
        }
        if ($isCanvas == 0) {
            $iframeInputSize = $urlInputSize;
            $iframeWidth = 380;
            $iframeHeight = 40;
        } else {
            $isCanvas = 1;
            $iframeWidth = 150;
            $iframeHeight = 60;
            $iframeInputSize = 3;
            $inputSizeParam = "&inputSize={$iframeInputSize}";
        }
        $iframePath = FLUTTER_URI . "RCCWP_upload.php?input_name=" . urlencode($inputName) . "&type={$fileType}&imageThumbID=img_thumb_{$inputName}&canvas={$isCanvas}" . $inputSizeParam;
        $enableBrowser = RCCWP_Options::Get('enable-browserupload');
        if ($enableBrowser != 0 || $enableBrowser != '') {
            ?>
			<div id='upload_iframe_<?php 
            echo $inputName;
            ?>
'>
			<iframe id='upload_internal_iframe_<?php 
            echo $inputName;
            ?>
' src='<?php 
            echo $iframePath;
            ?>
' frameborder='' scrolling='no' style="border-width: 0px; height: <?php 
            echo $iframeHeight;
            ?>
px; width: <?php 
            echo $iframeWidth;
            ?>
px;vertical-align:top;"></iframe>
			</div>
		<?php 
        }
        ?>
		
			<table border="0" style="width:100%">

				<?php 
        if (!$enableBrowser) {
            ?>
					<tr  style="background:transparent" id="swfuploadRow_<?php 
            echo $inputName;
            ?>
">
						<td style="border-bottom-width: 0px;padding: 0px">
                           <label for="swfupload" ><?php 
            _e('Upload', $flutter_domain);
            ?>
:</label>
                        </td>
						<td style="border-bottom-width: 0px">
                            <span id="upload-<?php 
            echo $inputName;
            ?>
" class="upload_file" ></span>
                        </td>
					</tr>
				<?php 
        }
        ?>

				<tr style="background:transparent">
					<td style="border-bottom-width: 0px;padding: 0; padding-bottom:32px;"><label for="upload_url" ><?php 
        _e('Or URL', $flutter_domain);
        ?>
:</label></td>
					<td style="border-bottom-width: 0px">
						<input id="upload_url_<?php 
        echo $inputName;
        ?>
"
							name="upload_url_<?php 
        echo $inputName;
        ?>
"
							type="text"
							size="<?php 
        echo $urlInputSize;
        ?>
"
							/>
						<input type="button" onclick="uploadurl('<?php 
        echo $inputName;
        ?>
','<?php 
        echo $fileType;
        ?>
')" value="Upload" class="button" style="width:70px"/>
					</td>
				</tr>

			</table>
		                            <script type="text/javascript">
                                
                                element =  new SWFUpload({
                                        //button settings
	    		                        button_text: '<span class="button">Browse</span>',
                                        button_text_style: '.button { text-align: center; font-weight: bold; font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif; }',
			                            button_height: "24",
                            			button_width: "132",
                	    	        	button_image_url: wp_root+'/wp-includes/images/upload.png',
                		            	file_post_name: "async-upload",
                                        
                                        //requeriments settings
                                        upload_url  : flutter_path + "/RCCWP_GetFile.php",
           		                	    flash_url :  wp_root+"/wp-includes/js/swfupload/swfupload.swf",
                                        file_size_limit : "20 MB",
                                        button_placeholder_id : "upload-"+ "<?php 
        echo $inputName;
        ?>
",
                                        debug: false,
    
                                        //custom settings
                                        custom_settings :{
                                            'file_id' : "<?php 
        echo $inputName;
        ?>
"
                                        },
                                            
                                        //handlers
                                        file_queued_handler : adjust,
                                        upload_success_handler :  completed,
            
                                        post_params : {
		                                    auth_cookie : swf_authentication,
                                        	_wpnonce : swf_nonce
        		                    	}
                        	    	});
                            </script>
 
		<?php 
    }
    function AssignCustomWritePanel()
    {
        global $mf_domain;
        $postId = (int) $_GET['assign-custom-write-panel'];
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanelOptions = RCCWP_Options::Get();
        $message = 'The Post that you\'re about to edit is not associated with any Custom Write Panel.';
        ?>
		
		<div id="message" class="updated"><p><?php 
        _e($message);
        ?>
</p></div>
		
		<div class="wrap">
		<h2><?php 
        _e('Assign Custom Write Panel');
        ?>
</h2>
		
		<form action="" method="post" id="assign-custom-write-panel-form">
		
		<table class="optiontable">
		<tbody>
		<tr valign="top">
			<th scope="row"><?php 
        _e('Custom Write Panel', $mf_domain);
        ?>
:</th>
			<td>
				<select name="custom-write-panel-id" id="custom-write-panel-id">
					<option value=""><?php 
        _e('(None)', $mf_domain);
        ?>
</option>
				<?php 
        $defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
            ?>
					<option value="<?php 
            echo $panel->id;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $panel->name;
            ?>
</option>
				<?php 
        }
        ?>
				</select>
			</td>
		</tr>
		</tbody>
		</table>
		
		<input type="hidden" name="post-id" value="<?php 
        echo $postId;
        ?>
" />
		<p class="submit" >
			<input name="edit-with-no-custom-write-panel" type="submit" value="<?php 
        _e("Don't Assign Custom Write Panel", $mf_domain);
        ?>
" />
			<input name="edit-with-custom-write-panel" type="submit" value="<?php 
        _e('Edit with Custom Write Panel', $mf_domain);
        ?>
" />
		</p>
		
		</form>
		
		</div>
		
		<?php 
    }
Beispiel #20
0
    function EditnHeader()
    {
        global $post, $wp_version;
        // Is EIP enabled?
        include_once 'RCCWP_Options.php';
        $enableEditnplace = RCCWP_Options::Get('enable-editnplace');
        $eip_highlight_color = RCCWP_Options::Get('eip-highlight-color');
        if (0 == $enableEditnplace) {
            return;
        }
        $post_id = $post->ID;
        $FLUTTER_URI = FLUTTER_URI;
        $nicedit_path = FLUTTER_URI . "js/nicEdit.js";
        $prototype_path = FLUTTER_URI . "js/prototype.js";
        $editnplace_path = FLUTTER_URI . "js/editnplace.js";
        $arrow_image_path = FLUTTER_URI . "images/arrow.gif";
        if (is_user_logged_in() && current_user_can('edit_posts', $post_id)) {
            echo <<<EOD

\t\t\t<script language="JavaScript" type="text/javascript" > 
\t\t\t\tvar JS_FLUTTER_URI = '{$FLUTTER_URI}';
\t\t\t</script>
\t\t\t<script type="text/javascript" src="{$nicedit_path}"></script>
\t\t\t<script type="text/javascript" src="{$prototype_path}"></script>
\t\t\t<script type="text/javascript" src="{$editnplace_path}"></script>
\t\t\t
\t\t\t<style type="text/css">
\t\t\t\t
\t\t\t\t/*<![CDATA[*/
\t\t\t\t
\t\t\t\t#savingDiv{
\t\t\t\t\tfont-size: medium; 
\t\t\t\t\tfont-weight: bold;
\t\t\t\t}
\t\t\t\t
\t\t\t\t.EIP_title:hover, .EIP_content:hover, 
\t\t\t\t.EIP_textbox:hover, .EIP_mulittextbox:hover {
\t\t\t\t\tbackground-color: {$eip_highlight_color};
\t\t\t\t}
\t\t\t\t
\t\t\t\t.EIPSaveCancel{
\t\t\t\t\tpadding: 5px;
\t\t\t\t\tmargin-top: -1px;
\t\t\t\t\tz-index: 1000;
\t\t\t\t\tborder-color:#CCC;
\t\t\t\t\tborder-width:1px;
\t\t\t\t\tborder-style:solid;
\t\t\t\t\tbackground-color:white;
\t\t\t\t\tposition:fixed;
\t\t\t\t\ttop:0px !important;
\t\t\t\t\twidth:100% !important;
\t\t\t\t\tleft: 0px  !important;
\t\t\t\t\t/*position:absolute;
\t\t\t\t\tpadding-top:2px;
\t\t\t\t\tpadding-bottom:2px;
\t\t\t\t\tz-index: 1000;*/
\t\t\t\t}
\t\t\t\t
\t\t\t\t.EIPSaveStatus{
\t\t\t\t\tposition:absolute;
\t\t\t\t\tfont-size: 14px;
\t\t\t\t\tz-index: 1000;
\t\t\t\t}
\t\t\t\t
\t\t\t\t.EIPnicPanelDiv{
\t\t\t\t\tposition: absolute;
\t\t\t\t\tbackground-image: url({$arrow_image_path});
\t\t\t\t\twidth:154px;
\t\t\t\t\theight:38px;
\t\t\t\t\tz-index: 1000;
\t\t\t\t}
\t\t\t\t
\t\t\t\tdiv.nicEdit-panel{
\t\t\t\t\tbackground-color: white !important;
\t\t\t\t\twidth:140px  !important;
\t\t\t\t}
\t\t\t\t
\t\t\t\tdiv.nicEdit-panelContain{
\t\t\t\t\tbackground-color: white !important;
\t\t\t\t\tborder-bottom: 0px\t!important;
\t\t\t\t\tborder-left: 0px\t!important;
\t\t\t\t\tborder-right: 0px\t!important;
\t\t\t\t\twidth: 92%\t!important;
\t\t\t\t\tmargin-left: 2px\t!important;
\t\t\t\t\tmargin-top: 1px\t!important;
\t\t\t\t}
\t\t\t\t
\t\t\t\t.nicEdit-selected{
\t\t\t\t\t/*background-color: #FFFFCC  !important;*/
\t\t\t\t\tborder: thin inset   !important;
\t\t\t\t\tpadding: 10px;
\t\t\t\t}
\t\t\t\t.nicEdit-button {
\t\t\t\t\tbackground-color: white !important;
\t\t\t\t\tborder: 0px !important;
\t\t\t\t}

\t\t\t\t/*]]>*/
\t\t\t
\t\t\t</style>

EOD;
        }
    }
Beispiel #21
0
 function SetCurrentCustomWritePanelMenuItem()
 {
     global $submenu_file;
     global $menu;
     require_once 'RCCWP_Options.php';
     $options = RCCWP_Options::Get();
     if (!empty($options['default-custom-write-panel'])) {
         require_once 'RCCWP_CustomWritePanel.php';
         $customWritePanel = RCCWP_CustomWritePanel::Get((int) $options['default-custom-write-panel']);
         if ($customWritePanel->type == "post") {
             $menu[5][2] = 'post-new.php?custom-write-panel-id=' . (int) $options['default-custom-write-panel'];
         } else {
             $menu[5][2] = 'page-new.php?custom-write-panel-id=' . (int) $options['default-custom-write-panel'];
         }
     }
     if (empty($_REQUEST['custom-write-panel-id'])) {
         $_REQUEST['custom-write-panel-id'] = "";
     }
     if ($_REQUEST['custom-write-panel-id']) {
         $customWritePanel = RCCWP_CustomWritePanel::Get((int) $_REQUEST['custom-write-panel-id']);
         if (isset($_REQUEST['filter-posts'])) {
             if ($customWritePanel->type == "post") {
                 $submenu_file = 'edit.php?filter-posts=1&custom-write-panel-id=' . (int) $_REQUEST['custom-write-panel-id'];
             } else {
                 $submenu_file = 'edit-pages.php?filter-posts=1&custom-write-panel-id=' . (int) $_REQUEST['custom-write-panel-id'];
             }
         } else {
             if ($customWritePanel->type == "post") {
                 $submenu_file = 'post-new.php?custom-write-panel-id=' . (int) $_REQUEST['custom-write-panel-id'];
             } else {
                 $submenu_file = 'page-new.php?custom-write-panel-id=' . (int) $_REQUEST['custom-write-panel-id'];
             }
         }
     }
 }
Beispiel #22
0
    function Main()
    {
        global $flutter_domain;
        $customWritePanels = RCCWP_CustomWritePanel::GetCustomWritePanels();
        $customWritePanelOptions = RCCWP_Options::Get();
        if (function_exists('is_site_admin') && !is_site_admin()) {
            update_option("Flutter_notTopAdmin", true);
        } else {
            update_option("Flutter_notTopAdmin", false);
        }
        ?>
	
	<div class="wrap">

	<h2><?php 
        _e('Flutter Options', $flutter_domain);
        ?>
</h2>
	
	<form action="" method="post" id="custom-write-panel-options-form">	
	

	<h3><?php 
        _e('Write Panel Options', $flutter_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> 

	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Post Panel', $flutter_domain);
        ?>
</th>
        	<td>
			<label for="hide-write-post"> 
			<input name="hide-write-post" id="hide-write-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-post']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Post panel', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>
 
    	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Page Panel', $flutter_domain);
        ?>
</th>
		<td>
			<label for="hide-write-page"> 
			<input name="hide-write-page" id="hide-write-page" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-write-page']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Wordpress Page panel', $flutter_domain);
        ?>
</label> 
 		</td>
        </tr>
	
	<tr valign="top">
		<th scope="row"><?php 
        _e('Hide Visual Editor (multiline)', $flutter_domain);
        ?>
</th>
		<td>
			<label for="hide-visual-editor"> 
			<input name="hide-visual-editor" id="hide-visual-editor" value="1"  <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['hide-visual-editor']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Hide Visual Editor (multiline)', $flutter_domain);
        ?>
</label> 
 		</td>
        </tr>

    	<tr valign="top">
		<th scope="row"><?php 
        _e('Editing Prompt', $flutter_domain);
        ?>
</th>
		<td>
			<label for="prompt-editing-post"> 
			<input name="prompt-editing-post" id="prompt-editing-post" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['prompt-editing-post']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Prompt when editing a Post not created with Custom Write Panel.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>

    	<tr valign="top">
		<th scope="row"><?php 
        _e('Assign to Role', $flutter_domain);
        ?>
</th>
        	<td>
			<label for="assign-to-role"> 
			<input name="assign-to-role" id="assign-to-role" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['assign-to-role']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('This option will create a capability for each write panel such that the write panel is accessible by the Administrator only by default.
			 You can assign the write panel to other roles using ', $flutter_domain);
        ?>
</label><a target="_blank" href="http://sourceforge.net/projects/role-manager">&nbsp; Role Manager Plugin</a>. 
		</td>
        </tr>

    	<tr valign="top">
		<th scope="row"><?php 
        _e('Default Panel', $flutter_domain);
        ?>
</th>
		<td>
		
			<label for="default-custom-write-panel">
			<select name="default-custom-write-panel" id="default-custom-write-panel">
				<option value=""><?php 
        _e('(None)', $flutter_domain);
        ?>
</option>
			<?php 
        $defaultCustomWritePanel = $customWritePanelOptions['default-custom-write-panel'];
        foreach ($customWritePanels as $panel) {
            $selected = $panel->id == $defaultCustomWritePanel ? 'selected="selected"' : '';
            ?>
				<option value="<?php 
            echo $panel->id;
            ?>
" <?php 
            echo $selected;
            ?>
><?php 
            echo $panel->name;
            ?>
</option>
			<?php 
        }
        ?>
			</select>
			</label>
		
		</td>
        </tr>

	</table>


	<br />
	<h3><?php 
        _e('Layout Options', $flutter_domain);
        ?>
</h3>
	<p><?php 
        _e('Allows you to add modules to the blog.', $flutter_domain);
        ?>
</p>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> 

	<tr valign="top">
		<th scope="row"><?php 
        _e('Layout Tab', $flutter_domain);
        ?>
</th>
		<td>
			<label for="canvas_show"> 
			<input name="canvas_show" id="canvas_show" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['canvas_show']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Show Layout tab.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>


	<tr valign="top">
		<th scope="row"><?php 
        _e('Style Tab', $flutter_domain);
        ?>
</th>
		<td>
			<label for="ink_show"> 
			<input name="ink_show" id="ink_show" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['ink_show']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Show Style tab.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>


	<tr valign="top">
		<th scope="row"><?php 
        _e('Layout Instructions', $flutter_domain);
        ?>
</th>
		<td>
			<label for="canvas_show_instructions"> 
			<input name="canvas_show_instructions" id="canvas_show_instructions" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['canvas_show_instructions']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Display the instructions on the Layout page.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>


	<tr valign="top">
		<th scope="row"><?php 
        _e('Zones Names', $flutter_domain);
        ?>
</th>
		<td>
			<label for="canvas_show_zone_name"> 
			<input name="canvas_show_zone_name" id="canvas_show_zone_name" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['canvas_show_zone_name']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Show zones names on droppable zones.', $flutter_domain);
        ?>
	</label> 
		</td>
        </tr>

	</table>

	
	<h3><?php 
        _e('Other Options', $flutter_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">

    	<!-- <tr valign="top">
		<th scope="row"><?php 
        _e('Snipshot', $flutter_domain);
        ?>
</th>
		<td>
			<label for="use-snipshot"> 
			<input name="use-snipshot" id="use-snipshot" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['use-snipshot']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Use Snipshot services instead of cropper to edit photos.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr> -->

	<tr valign="top">
		<th scope="row"><?php 
        _e('Edit-n-place', $flutter_domain);
        ?>
</th>
		<td>
			<label for="enable-editnplace"> 
			<input name="enable-editnplace" id="enable-editnplace" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['enable-editnplace']);
        ?>
 type="checkbox"> 
			&nbsp; <?php 
        _e('Edit posts instantly from the post page.', $flutter_domain);
        ?>
</label> 
		</td>
        </tr>
	<script type='text/javascript' src='<?php 
        echo FLUTTER_URI;
        ?>
js/sevencolorpicker.js'></script>
	<script type="text/javascript">
		jQuery('document').ready(function(){
			jQuery('#eip-highlight-color').SevenColorPicker();
		});
	</script>
	<tr>
		<th scope="row"><?php 
        _e('EIP highlight color', $flutter_domain);
        ?>
 </th>
		<td>
			<label for="eip-highlight-color">
			<input name="eip-highlight-color" id="eip-highlight-color" value="<?php 
        echo $customWritePanelOptions['eip-highlight-color'];
        ?>
"  >
			&nbsp; <?php 
        _e('Use color to highlight areas EIP', $flutter_domain);
        ?>
</label>
		</td>
	</tr>

	<tr>
		<th scope="row"><?php 
        _e('Browser uploader', $flutter_domain);
        ?>
 </th>
		<td>
			<label for="enable-browserupload">
			<input name="enable-browserupload" id="enable-browserupload" value="1" <?php 
        echo RCCWP_OptionsPage::GetCheckboxState($customWritePanelOptions['enable-browserupload']);
        ?>
 type="checkbox">
			&nbsp; <?php 
        _e('Use Browser uploader instead Flash Uploader', $flutter_domain);
        ?>
</label>
		</td>
	</tr>

	</table>

	<br />	
	<h3><?php 
        _e('Uninstall Flutter', $flutter_domain);
        ?>
</h3>
	<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6"> 

    	<tr valign="top">
		<th scope="row"><?php 
        _e('Uninstall Flutter', $flutter_domain);
        ?>
</th>
		<td>
			<input type="text" id="uninstall-custom-write-panel" name="uninstall-custom-write-panel" size="25" /><br />
			<label for="uninstall-custom-write-panel">
			&nbsp; <?php 
        _e('Type <strong>uninstall</strong> into the textbox, click <strong>Update Options</strong>, and all the tables created by this plugin will be deleted', $flutter_domain);
        ?>
</label>
		
		</td>
        </tr>

	</table>

	<p class="submit" ><input name="update-custom-write-panel-options" type="submit" value="<?php 
        _e('Update Options', $flutter_domain);
        ?>
" /></p>
	
	</form>

	</div>
	
	<?php 
    }
        add_action('admin_head', array('RCCWP_Menu', 'HighlightCustomPanel'));
        add_action('admin_head', 'mf_admin_style');
        // -- Hook all functions related to saving posts in order to save custom fields values
        require_once 'RCCWP_Post.php';
        add_action('save_post', array('RCCWP_Post', 'SaveCustomFields'));
        add_action('delete_post', array('RCCWP_Post', 'DeletePostMetaData'));
        add_filter('wp_redirect', array('RCCWP_Processor', 'Redirect'));
        add_action('shutdown', array('RCCWP_Processor', 'FlushAllOutputBuffer'));
        add_action('admin_notices', array('RCCWP_Application', 'CheckInstallation'));
        add_action('admin_notices', array('RCCWP_WritePostPage', 'FormError'));
    }
}
require_once 'RCCWP_EditnPlace.php';
require_once 'RCCWP_Options.php';
// Adding javascript for the editnplace only if it is turned on
$customWritePanelOptions = RCCWP_Options::Get();
if ($customWritePanelOptions['enable-editnplace']) {
    add_action('wp_head', array('RCCWP_EditnPlace', 'EditnHeader'));
    add_action('template_redirect', array('RCCWP_EditnPlace', 'EditnPlaceJavascript'));
}
require_once 'RCCWP_Query.php';
add_action('pre_get_posts', array('RCCWP_Query', 'FilterPrepare'));
add_filter('posts_where', array('RCCWP_Query', 'FilterCustomPostsWhere'));
add_filter('posts_where', array('RCCWP_Query', 'ExcludeWritepanelsPosts'));
add_filter('posts_orderby', array('RCCWP_Query', 'FilterCustomPostsOrderby'));
add_filter('posts_fields', array('RCCWP_Query', 'FilterCustomPostsFields'));
add_filter('posts_join_paged', array('RCCWP_Query', 'FilterCustomPostsJoin'));
if ($customWritePanelOptions['condense-menu']) {
    //adding Column for posts
    add_filter('manage_posts_columns', array('RCCWP_Query', 'ColumnWritePanel'));
    add_action('manage_posts_custom_column', array('RCCWP_Query', 'ColumnWritePanelData'));
Beispiel #24
0
 /** 
  *
  *
  */
 function Install()
 {
     include_once 'RCCWP_Options.php';
     global $wpdb;
     // First time installation
     if (get_option(RC_CWP_OPTION_KEY) === false) {
         // Giving full rights to folders.
         @chmod(FLUTTER_UPLOAD_FILES_DIR, 777);
         @chmod(FLUTTER_IMAGES_CACHE_DIR, 777);
         @chmod(FLUTTER_MODULES_DIR, 777);
         //Initialize options
         $options['hide-write-post'] = 0;
         $options['hide-write-page'] = 0;
         $options['hide-visual-editor'] = 0;
         $options['prompt-editing-post'] = 0;
         $options['assign-to-role'] = 0;
         $options['use-snipshot'] = 0;
         $options['enable-editnplace'] = 1;
         $options['eip-highlight-color'] = "#FFFFCC";
         $options['enable-swfupload'] = 1;
         $options['default-custom-write-panel'] = "";
         if (version_compare(PHP_VERSION, '5.0.0') === 1) {
             $options['enable-HTMLPurifier'] = 0;
         } else {
             $options['enable-HTMLPurifier'] = 0;
         }
         $options['tidy-level'] = "medium";
         $options['canvas_show_instructions'] = 1;
         $options['canvas_show_zone_name'] = 0;
         $options['canvas_show'] = 1;
         $options['ink_show'] = 0;
         $options['enable-broserupload'] = 0;
         RCCWP_Options::Update($options);
     }
     //for  backward compatibility
     if ($options['enable-swfupload'] == 1) {
         $options['enable-browserupload'] = 0;
     } else {
         $options['enable-broserupload'] = 1;
     }
     RCCWP_Options::Update($options);
     //comment sniptshot  preference
     $checking_options = RCCWP_Options::Get();
     $checking_options['use-snipshot'] = 0;
     RCCWP_Options::Update($checking_options);
     // Check blog database
     if (get_option("RC_CWP_BLOG_DB_VERSION") == '') {
         update_option("RC_CWP_BLOG_DB_VERSION", 0);
     }
     if (get_option("RC_CWP_BLOG_DB_VERSION") < RC_CWP_DB_VERSION) {
         $BLOG_DBChanged = true;
     } else {
         $BLOG_DBChanged = false;
     }
     // Install blog tables
     if (!$wpdb->get_var("SHOW TABLES LIKE '" . RC_CWP_TABLE_POST_META . "'") == RC_CWP_TABLE_POST_META || $BLOG_DBChanged) {
         $blog_tables[] = "CREATE TABLE " . RC_CWP_TABLE_POST_META . " (\n\t\t\t\tid integer NOT NULL,\n\t\t\t\tgroup_count integer NOT NULL,\n\t\t\t\tfield_count integer NOT NULL,\n\t\t\t\tpost_id integer NOT NULL,\n\t\t\t\tfield_name text NOT NULL,\n                order_id integer NOT NULL,\n\t\t\t\tPRIMARY KEY (id) )";
         $blog_tables[] = "CREATE TABLE " . FLUTTER_TABLE_LAYOUT_MODULES . " (\n\t\t        block_id INT NOT NULL AUTO_INCREMENT,\n\t   \t\t\tmodule_id INT NOT NULL,\n\t\t\t\ttheme tinytext NOT NULL,\n\t\t\t\tpage text NOT NULL,\n\t\t\t\tposition tinytext NOT NULL,\n\t\t\t\ttemplate_name text NOT NULL,\n\t\t\t\ttemplate_size text NOT NULL,\n\t\t\t\tduplicate_id INT NOT NULL,\n\t\t\t\tPRIMARY KEY (block_id)\n\t\t\t\t);";
         $blog_tables[] = "CREATE TABLE " . FLUTTER_TABLE_LAYOUT_VARIABLES . " (\n\t   \t\t\tvariable_id INT NOT NULL AUTO_INCREMENT,\n\t   \t\t\tvariable_name text NOT NULL,\n\t   \t\t\tparent INT NOT NULL,\n\t   \t\t\ttype text NOT NULL,\n\t   \t\t\tvalue text NOT NULL,\n\t   \t\t\tdefault_value text NOT NULL,\n\t   \t\t\tdescription text NOT NULL,\n\t   \t\t\toptions text NOT NULL,\n\t   \t\t\tPRIMARY KEY (variable_id)\n\t\t\t\t);";
         $blog_tables[] = "CREATE TABLE " . FLUTTER_TABLE_LAYOUT_SETTINGS . " (\n\t\t        settings_id INT NOT NULL AUTO_INCREMENT,\n\t\t\t\ttheme tinytext NOT NULL,\n\t\t\t\tpage text NOT NULL,\n\t\t\t\tsettings text NOT NULL,\n\t\t\t\tPRIMARY KEY (settings_id)\n\t\t\t\t);";
         // try to get around
         // these includes like http://trac.mu.wordpress.org/ticket/384
         // and http://www.quirm.net/punbb/viewtopic.php?pid=832#p832
         if (file_exists(ABSPATH . 'wp-includes/pluggable.php')) {
             require_once ABSPATH . 'wp-includes/pluggable.php';
         } else {
             require_once ABSPATH . 'wp-includes/pluggable-functions.php';
         }
         require_once ABSPATH . 'wp-admin/upgrade-functions.php';
         foreach ($blog_tables as $blog_table) {
             dbDelta($blog_table);
         }
     }
     update_option('RC_CWP_BLOG_DB_VERSION', RC_CWP_DB_VERSION);
     //canvas_install($BLOG_DBChanged);
     // Upgrade Blog
     if ($BLOG_DBChanged) {
         RCCWP_Application::UpgradeBlog();
     }
     if (RCCWP_Application::IsWordpressMu()) {
         if (get_site_option("RC_CWP_DB_VERSION") == '') {
             update_site_option("RC_CWP_DB_VERSION", 0);
         }
         if (get_site_option("RC_CWP_DB_VERSION") < RC_CWP_DB_VERSION) {
             $DBChanged = true;
         } else {
             $DBChanged = false;
         }
     } else {
         if (get_option("RC_CWP_DB_VERSION") == '') {
             update_option("RC_CWP_DB_VERSION", 0);
         }
         if (get_option("RC_CWP_DB_VERSION") < RC_CWP_DB_VERSION) {
             $DBChanged = true;
         } else {
             $DBChanged = false;
         }
     }
     // -- Create Tables if they don't exist or the database changed
     if (!$wpdb->get_var("SHOW TABLES LIKE '" . RC_CWP_TABLE_PANELS . "'") == RC_CWP_TABLE_PANELS) {
         $not_installed = true;
     }
     if ($not_installed || $DBChanged) {
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_PANELS . " (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tname varchar(50) NOT NULL,\n                single tinyint(1) NOT NULL default 0,\n\t\t\t\tdescription varchar(255),\n\t\t\t\tdisplay_order tinyint,\n\t\t\t\tcapability_name varchar(50) NOT NULL,\n\t\t\t\ttype varchar(50) NOT NULL,\n\t\t\t\tPRIMARY KEY (id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " (\n\t\t\t\tid tinyint(11) NOT NULL auto_increment,\n\t\t\t\tname varchar(50) NOT NULL,\n\t\t\t\tdescription varchar(100),\n\t\t\t\thas_options enum('true', 'false') NOT NULL,\n\t\t\t\thas_properties enum('true', 'false') NOT NULL,\n\t\t\t\tallow_multiple_values enum('true', 'false') NOT NULL,\n\t\t\t\tPRIMARY KEY (id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_GROUP_FIELDS . " (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tgroup_id int(11) NOT NULL,\n\t\t\t\tname varchar(50) NOT NULL,\n\t\t\t\tdescription varchar(255),\n\t\t\t\tdisplay_order tinyint,\n\t\t\t\tdisplay_name enum('true', 'false') NOT NULL,\n\t\t\t\tdisplay_description enum('true', 'false') NOT NULL,\n\t\t\t\ttype tinyint NOT NULL,\n\t\t\t\tCSS varchar(100),\n\t\t\t\trequired_field tinyint,\n\t\t\t\tduplicate tinyint(1) NOT NULL,\n\t\t\t\tPRIMARY KEY (id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_CUSTOM_FIELD_OPTIONS . " (\n\t\t\t\tcustom_field_id int(11) NOT NULL,\n\t\t\t\toptions text,\n\t\t\t\tdefault_option text,\n\t\t\t\tPRIMARY KEY (custom_field_id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_PANEL_CATEGORY . " (\n\t\t\t\tpanel_id int(11) NOT NULL,\n\t\t\t\tcat_id int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (panel_id, cat_id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_PANEL_STANDARD_FIELD . " (\n\t\t\t\tpanel_id int(11) NOT NULL,\n\t\t\t\tstandard_field_id int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (panel_id, standard_field_id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_CUSTOM_FIELD_PROPERTIES . " (\n\t\t\t\tcustom_field_id int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\tproperties TEXT,\n\t\t\t\tPRIMARY KEY (custom_field_id)\n\t\t\t\t);";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_MODULES . " (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tname varchar(50) NOT NULL,\n\t\t\t\tdescription text,\n\t\t\t\tPRIMARY KEY (id) )";
         $qst_tables[] = "CREATE TABLE " . RC_CWP_TABLE_PANEL_GROUPS . " (\n\t\t\t\tid int(11) NOT NULL auto_increment,\n\t\t\t\tpanel_id int(11) NOT NULL,\n\t\t\t\tname varchar(50) NOT NULL,\n\t\t\t\tduplicate tinyint(1) NOT NULL,\n\t\t\t\tat_right tinyint(1) NOT NULL,\n\t\t\t\tPRIMARY KEY (id) )";
         $qst_tables[] = "CREATE TABLE " . FLUTTER_TABLE_MODULES_DUPLICATES . " (\n\t\t        duplicate_id INT NOT NULL AUTO_INCREMENT,\n\t   \t\t\tmodule_id INT NOT NULL,\n\t\t\t\tduplicate_name text NOT NULL,\n\t\t\t\tPRIMARY KEY(duplicate_id)\n\t\t\t\t);";
         // try to get around
         // these includes like http://trac.mu.wordpress.org/ticket/384
         // and http://www.quirm.net/punbb/viewtopic.php?pid=832#p832
         if (file_exists(ABSPATH . 'wp-includes/pluggable.php')) {
             require_once ABSPATH . 'wp-includes/pluggable.php';
         } else {
             require_once ABSPATH . 'wp-includes/pluggable-functions.php';
         }
         require_once ABSPATH . 'wp-admin/upgrade-functions.php';
         foreach ($qst_tables as $qst_table) {
             dbDelta($qst_table);
         }
         if (RCCWP_Application::IsWordpressMu()) {
             update_site_option('RC_CWP_DB_VERSION', RC_CWP_DB_VERSION);
         } else {
             update_option('RC_CWP_DB_VERSION', RC_CWP_DB_VERSION);
         }
     }
     // Insert standard fields definition
     if ($not_installed) {
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (1, 'Textbox', NULL, 'false', 'true', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (2, 'Multiline Textbox', NULL, 'false', 'true', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (3, 'Checkbox', NULL, 'false', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (4, 'Checkbox List', NULL, 'true', 'false', 'true')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (5, 'Radiobutton List', NULL, 'true', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (6, 'Dropdown List', NULL, 'true', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (7, 'Listbox', NULL, 'true', 'true', 'true')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (8, 'File', NULL, 'false', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (9, 'Image', NULL, 'false', 'true', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (10, 'Date', NULL, 'false', 'true', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (11, 'Audio', NULL, 'false', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (12, 'Color Picker', NULL, 'false', 'false', 'false')";
         $wpdb->query($sql6);
         $sql6 = "INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (13, 'Slider', NULL, 'false', 'true', 'false')";
         $wpdb->query($sql6);
     }
     // Upgrade Blog site
     if ($DBChanged) {
         RCCWP_Application::UpgradeBlogSite();
     }
     if (RC_CWP_DB_VERSION >= 36) {
         $wpdb->query("INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (12, 'Color Picker', NULL, 'false', 'false', 'false')");
     }
     if (RC_CWP_DB_VERSION >= 36) {
         $wpdb->query("INSERT IGNORE INTO " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " VALUES (13, 'Slider', NULL, 'false', 'true', 'false')");
     }
     if (RC_CWP_DB_VERSION >= 40) {
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_PANELS . " MODIFY name varchar(255) NOT NULL");
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_PANELS . " MODIFY capability_name varchar(255) NOT NULL");
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_CUSTOM_FIELD_TYPES . " MODIFY name varchar(255) NOT NULL");
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_GROUP_FIELDS . " MODIFY name varchar(255) NOT NULL");
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_MODULES . " MODIFY name varchar(255) NOT NULL");
         $wpdb->query("ALTER TABLE " . RC_CWP_TABLE_PANEL_GROUPS . " MODIFY name varchar(255) NOT NULL");
         //$wpdb->query('update '.RC_CWP_TABLE_POST_META.' ps, '.RC_CWP_TABLE_GROUP_FIELDS.' cf, '.RC_CWP_TABLE_PANEL_GROUPS.' mg set ps.order_id=-1 where mg.name="__default" and mg.id=cf.group_id AND cf.name=ps.field_name');
     }
     //Import Default modules
     if (RCCWP_Application::IsWordpressMu()) {
         if (get_site_option('FLUTTER_fist_time') == '') {
             RCCWP_Application::import_default_modules();
             update_site_option('FLUTTER_fist_time', '1');
         }
     } else {
         if (get_option('FLUTTER_fist_time') == '') {
             RCCWP_Application::import_default_modules();
             update_option('FLUTTER_fist_time', '1');
         }
     }
 }
Beispiel #25
0
 function Main()
 {
     require_once 'RC_Format.php';
     global $CUSTOM_WRITE_PANEL;
     wp_enqueue_script('jquery-ui-sortable');
     if (isset($_POST['edit-with-no-custom-write-panel'])) {
         $type = RCCWP_Post::GetCustomWritePanel();
         if (is_object($type)) {
             $ptype = $type->type;
         } else {
             $ptype = strpos($_SERVER['REQUEST_URI'], 'page.php') !== FALSE ? 'page' : 'post';
         }
         wp_redirect($ptype . '.php?action=edit&post=' . $_POST['post-id'] . '&no-custom-write-panel');
     } else {
         if (isset($_POST['edit-with-custom-write-panel']) && isset($_POST['custom-write-panel-id']) && (int) $_POST['custom-write-panel-id'] > 0) {
             $type = RCCWP_Post::GetCustomWritePanel();
             if (is_object($type)) {
                 $ptype = $type->type;
             } else {
                 $ptype = strpos($_SERVER['REQUEST_URI'], 'page.php') !== FALSE ? 'page' : 'post';
             }
             wp_redirect($type->type . '.php?action=edit&post=' . $_POST['post-id'] . '&custom-write-panel-id=' . $_POST['custom-write-panel-id']);
         }
     }
     if (empty($_REQUEST['mf_action'])) {
         $currentAction = "";
     } else {
         $currentAction = $_REQUEST['mf_action'];
     }
     switch ($currentAction) {
         // ------------ Write Panels
         case 'finish-create-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             $default_theme_page = NULL;
             if ($_POST['radPostPage'] == 'page') {
                 $default_theme_page = $_POST['page_template'];
             }
             $customWritePanelId = RCCWP_CustomWritePanel::Create($_POST['custom-write-panel-name'], $_POST['custom-write-panel-description'], $_POST['custom-write-panel-standard-fields'], $_POST['custom-write-panel-categories'], $_POST['custom-write-panel-order'], FALSE, true, $_POST['single'], $default_theme_page);
             wp_redirect(RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $customWritePanelId));
             break;
         case 'submit-edit-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             $default_theme_page = NULL;
             if ($_POST['radPostPage'] == 'page') {
                 $default_theme_page = $_POST['page_template'];
             }
             RCCWP_CustomWritePanel::Update($_POST['custom-write-panel-id'], $_POST['custom-write-panel-name'], $_POST['custom-write-panel-description'], $_POST['custom-write-panel-standard-fields'], $_POST['custom-write-panel-categories'], $_POST['custom-write-panel-order'], FALSE, true, $_POST['single'], $default_theme_page);
             RCCWP_CustomWritePanel::AssignToRole($_POST['custom-write-panel-id'], 'administrator');
             break;
         case 'export-custom-write-panel':
             require_once 'RCCWP_CustomWritePanel.php';
             $panelID = $_REQUEST['custom-write-panel-id'];
             $writePanel = RCCWP_CustomWritePanel::Get($panelID);
             $exportedFilename = $tmpPath = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $writePanel->name . '.pnl';
             RCCWP_CustomWritePanel::Export($panelID, $exportedFilename);
             // send file in header
             header('Content-type: binary');
             header('Content-Disposition: attachment; filename="' . $writePanel->name . '.pnl"');
             readfile($exportedFilename);
             unlink($exportedFilename);
             exit;
             break;
         case 'delete-custom-write-panel':
             include_once 'RCCWP_CustomWritePanel.php';
             RCCWP_CustomWritePanel::Delete($_GET['custom-write-panel-id']);
             break;
             // ------------ Groups
         // ------------ Groups
         case 'finish-create-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             $customGroupId = RCCWP_CustomGroup::Create($_POST['custom-write-panel-id'], $_POST['custom-group-name'], $_POST['custom-group-duplicate'], $_POST['custom-group-at_right']);
             break;
         case 'delete-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             $customGroup = RCCWP_CustomGroup::Get((int) $_REQUEST['custom-group-id']);
             RCCWP_CustomGroup::Delete($_GET['custom-group-id']);
             break;
         case 'submit-edit-custom-group':
             include_once 'RCCWP_CustomGroup.php';
             RCCWP_CustomGroup::Update($_REQUEST['custom-group-id'], $_POST['custom-group-name'], $_POST['custom-group-duplicate'], $_POST['custom-group-at_right']);
             break;
             // ------------ Fields
         // ------------ Fields
         case 'copy-custom-field':
             include_once 'RCCWP_CustomField.php';
             $fieldToCopy = RCCWP_CustomField::Get($_REQUEST['custom-field-id']);
             if (RCCWP_Processor::CheckFieldName($fieldToCopy->name, $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             RCCWP_CustomField::Create($_REQUEST['custom-group-id'], $fieldToCopy->name, $fieldToCopy->description, $fieldToCopy->display_order, $fieldToCopy->required_field, $fieldToCopy->type_id, $fieldToCopy->options, $fieldToCopy->default_value, $fieldToCopy->properties, $fieldToCopy->duplicate, $fieldToCopy->helptext);
         case 'continue-create-custom-field':
             if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             break;
         case 'finish-create-custom-field':
             include_once 'RCCWP_CustomField.php';
             if (RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('create-custom-field') . '&custom-group-id=' . $_REQUEST['custom-group-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_REQUEST['custom-field-type']);
             if ($current_field->has_properties) {
                 $custom_field_properties = array();
                 if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                     $custom_field_properties['size'] = $_POST['custom-field-size'];
                 } else {
                     if (in_array($current_field->name, array('Multiline Textbox'))) {
                         $custom_field_properties['height'] = $_POST['custom-field-height'];
                         $custom_field_properties['width'] = $_POST['custom-field-width'];
                     } else {
                         if (in_array($current_field->name, array('Date'))) {
                             $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                         } else {
                             if (in_array($current_field->name, array('Image'))) {
                                 $params = '';
                                 if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                     $params .= '&h=' . $_POST['custom-field-photo-height'];
                                 }
                                 if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                     $params .= '&w=' . $_POST['custom-field-photo-width'];
                                 }
                                 if ($_POST['custom-field-custom-params'] != '') {
                                     $params .= '&' . $_POST['custom-field-custom-params'];
                                 }
                                 if ($params) {
                                     $custom_field_properties['params'] = $params;
                                 }
                             } else {
                                 if (in_array($current_field->name, array('Date'))) {
                                     $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                                 } else {
                                     if (in_array($current_field->name, array('Slider'))) {
                                         $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                         $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                         $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                     } else {
                                         if (in_array($current_field->name, array('Related Type'))) {
                                             $custom_field_properties['panel_id'] = $_POST['custom-field-related-type-panel-id'];
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             RCCWP_CustomField::Create($_POST['custom-group-id'], $_POST['custom-field-name'], $_POST['custom-field-description'], $_POST['custom-field-order'], $_POST['custom-field-required'], $_POST['custom-field-type'], $_POST['custom-field-options'], $_POST['custom-field-default-value'], $custom_field_properties, $_POST['custom-field-duplicate'], $_POST['custom-field-helptext']);
             break;
         case 'submit-edit-custom-field':
             include_once 'RCCWP_CustomField.php';
             $current_field_obj = RCCWP_CustomField::Get($_POST['custom-field-id']);
             if ($_POST['custom-field-name'] != $current_field_obj->name && RCCWP_Processor::CheckFieldName($_POST['custom-field-name'], $_REQUEST['custom-write-panel-id'])) {
                 $newURL = RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('edit-custom-field') . '&custom-field-id=' . $_POST['custom-field-id'] . '&err_msg=-1';
                 wp_redirect($newURL);
                 exit;
             }
             $current_field = RCCWP_CustomField::GetCustomFieldTypes((int) $_POST['custom-field-type']);
             if ($current_field->has_properties) {
                 $custom_field_properties = array();
                 if (in_array($current_field->name, array('Textbox', 'Listbox'))) {
                     $custom_field_properties['size'] = $_POST['custom-field-size'];
                 } else {
                     if (in_array($current_field->name, array('Multiline Textbox'))) {
                         $custom_field_properties['height'] = $_POST['custom-field-height'];
                         $custom_field_properties['width'] = $_POST['custom-field-width'];
                     } else {
                         if (in_array($current_field->name, array('Image'))) {
                             $params = '';
                             if ($_POST['custom-field-photo-height'] != '' && is_numeric($_POST['custom-field-photo-height'])) {
                                 $params = '&h=' . $_POST['custom-field-photo-height'];
                             }
                             if ($_POST['custom-field-photo-width'] != '' && is_numeric($_POST['custom-field-photo-width'])) {
                                 $params .= '&w=' . $_POST['custom-field-photo-width'];
                             }
                             if ($_POST['custom-field-custom-params'] != '') {
                                 $params .= '&' . $_POST['custom-field-custom-params'];
                             }
                             if ($params) {
                                 $custom_field_properties['params'] = $params;
                             }
                         } else {
                             if (in_array($current_field->name, array('Date'))) {
                                 $custom_field_properties['format'] = $_POST['custom-field-date-format'];
                             } else {
                                 if (in_array($current_field->name, array('Slider'))) {
                                     $custom_field_properties['max'] = $_POST['custom-field-slider-max'];
                                     $custom_field_properties['min'] = $_POST['custom-field-slider-min'];
                                     $custom_field_properties['step'] = $_POST['custom-field-slider-step'];
                                 } else {
                                     if (in_array($current_field->name, array('Related Type'))) {
                                         $custom_field_properties['panel_id'] = $_POST['custom-field-related-type-panel-id'];
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             RCCWP_CustomField::Update($_POST['custom-field-id'], $_POST['custom-field-name'], $_POST['custom-field-description'], $_POST['custom-field-order'], $_POST['custom-field-required'], $_POST['custom-field-type'], $_POST['custom-field-options'], $_POST['custom-field-default-value'], $custom_field_properties, $_POST['custom-field-duplicate'], $_POST['custom-field-helptext']);
             break;
         case 'delete-custom-field':
             include_once 'RCCWP_CustomField.php';
             if (isset($_REQUEST['custom-group-id']) && !empty($_REQUEST['custom-group-id'])) {
                 $customGroupId = (int) $_REQUEST['custom-group-id'];
             }
             $customGroup = RCCWP_CustomGroup::Get($customGroupId);
             RCCWP_CustomField::Delete($_REQUEST['custom-field-id']);
             break;
         default:
             if (RCCWP_Application::InWritePostPanel()) {
                 include_once 'RCCWP_Menu.php';
                 include_once 'RCCWP_WritePostPage.php';
                 $CUSTOM_WRITE_PANEL = RCCWP_Post::GetCustomWritePanel();
                 if (isset($CUSTOM_WRITE_PANEL) && $CUSTOM_WRITE_PANEL > 0) {
                     ob_start(array('RCCWP_WritePostPage', 'ApplyCustomWritePanelAssignedCategories'));
                     add_action('admin_head', array('RCCWP_WritePostPage', 'CustomFieldsCSS'));
                     //adding javascripts files for the custom fields
                     add_action('admin_print_scripts', array('RCCWP_WritePostPage', 'CustomFieldsJavascript'));
                     add_action('admin_head', array('RCCWP_WritePostPage', 'ApplyCustomWritePanelHeader'));
                     add_action('admin_menu', array('RCCWP_WritePostPage', 'CustomFieldCollectionInterface'));
                 } else {
                     if (!isset($_REQUEST['no-custom-write-panel']) && isset($_REQUEST['post'])) {
                         include_once 'RCCWP_Options.php';
                         $promptEditingPost = RCCWP_Options::Get('prompt-editing-post');
                         if ($promptEditingPost == 1) {
                             wp_redirect('?page=' . urlencode(MF_PLUGIN_DIR . DIRECTORY_SEPARATOR . 'RCCWP_Menu.php') . '&assign-custom-write-panel=' . (int) $_GET['post']);
                         }
                     }
                 }
             } else {
                 if (isset($_POST['update-custom-write-panel-options'])) {
                     if ($_POST['uninstall-custom-write-panel'] == 'uninstall') {
                         RCCWP_Application::Uninstall();
                         wp_redirect('options-general.php');
                     } else {
                         include_once 'RCCWP_Options.php';
                         $options['hide-write-post'] = $_POST['hide-write-post'];
                         $options['hide-write-page'] = $_POST['hide-write-page'];
                         $options['hide-visual-editor'] = $_POST['hide-visual-editor'];
                         $options['prompt-editing-post'] = $_POST['prompt-editing-post'];
                         $options['assign-to-role'] = $_POST['assign-to-role'];
                         $options['use-snipshot'] = $_POST['use-snipshot'];
                         $options['enable-editnplace'] = $_POST['enable-editnplace'];
                         $options['eip-highlight-color'] = $_POST['eip-highlight-color'];
                         $options['enable-swfupload'] = $_POST['enable-swfupload'];
                         $options['enable-browserupload'] = $_POST['enable-browserupload'];
                         $options['default-custom-write-panel'] = $_POST['default-custom-write-panel'];
                         $options['enable-HTMLPurifier'] = $_POST['enable-HTMLPurifier'];
                         $options['tidy-level'] = $_POST['tidy-level'];
                         $options['canvas_show_instructions'] = $_POST['canvas_show_instructions'];
                         $options['canvas_show_zone_name'] = $_POST['canvas_show_zone_name'];
                         $options['canvas_show'] = $_POST['canvas_show'];
                         $options['ink_show'] = $_POST['ink_show'];
                         $options['hide-non-standart-content'] = $_POST['hide-non-standart-content'];
                         $options['condense-menu'] = $_POST['condense-menu'];
                         RCCWP_Options::Update($options);
                         $EnP = RCCWP_Application::create_EditnPlace_css(TRUE);
                     }
                 }
             }
     }
 }
Beispiel #26
0
    function Body($inputName, $fileType, $isCanvas = 0, $urlInputSize = false)
    {
        global $mf_domain;
        include_once 'RCCWP_Options.php';
        $idField = RCCWP_WritePostPage::changeNameInput($inputName);
        if (!$urlInputSize) {
            $urlInputSize = 20;
        }
        if ($isCanvas == 0) {
            $iframeInputSize = $urlInputSize;
            $iframeWidth = 380;
            $iframeHeight = 40;
            $inputSizeParam = '';
        } else {
            $isCanvas = 1;
            $iframeWidth = 150;
            $iframeHeight = 60;
            $iframeInputSize = 3;
            $inputSizeParam = "&inputSize={$iframeInputSize}";
        }
        $iframePath = MF_URI . "RCCWP_upload.php?input_name=" . urlencode($inputName) . "&type={$fileType}&imageThumbID=img_thumb_{$idField}&canvas={$isCanvas}" . $inputSizeParam;
        ?>
      <?php 
        if (RCCWP_Options::Get('use-standard-uploader')) {
            ?>
			<div id='upload_iframe_<?php 
            echo $idField;
            ?>
' class="iframeload { iframe: { id: 'upload_internal_iframe_<?php 
            echo $idField;
            ?>
', src: '<?php 
            echo $iframePath;
            ?>
', height: <?php 
            echo $iframeHeight;
            ?>
, width: <?php 
            echo $iframeWidth;
            ?>
 } }">
			</div>
      <?php 
        } else {
            ?>
			<div id='upload_ajax_<?php 
            echo $idField;
            ?>
' class="ajaxupload { lang: { upload_error: '<?php 
            echo __("Upload Failed", $mf_domain);
            ?>
', upload_success: '<?php 
            echo __("Successful Upload", $mf_domain);
            ?>
', upload: '<?php 
            echo __("Choose File...", $mf_domain);
            ?>
', replace: '<?php 
            echo __("Replace File...", $mf_domain);
            ?>
', drop: '<?php 
            echo __("drop file here to upload", $mf_domain);
            ?>
' }}">
      </div>
      <?php 
        }
        ?>
			<table border="0">
				<tr >
					<td style="border-bottom-width: 0px; padding: 0"><label for="upload_url"><?php 
        _e('Or URL', $mf_domain);
        ?>
:</label></td>
					<td style="border-bottom-width: 0px; padding-left: 4px;">
						<input id="upload_url_<?php 
        echo $idField;
        ?>
"
							name="upload_url_<?php 
        echo $inputName;
        ?>
"
							type="text"
							size="<?php 
        echo $urlInputSize;
        ?>
"
							class="mf-upload-url" />
                                                        <input type="button" onclick="uploadurl('<?php 
        echo $idField;
        ?>
','<?php 
        echo $fileType;
        ?>
','<?php 
        echo wp_create_nonce("nonce_url_file");
        ?>
')" value="Upload" class="button" style="width:70px"/>
					</td>
				</tr>
			</table>
		<?php 
    }