Ejemplo n.º 1
0
 function menux_pageMetaAdd()
 {
     global $post;
     $value = '';
     if ($post->ID) {
         if (in_array($post->ID, $this->options['pages'])) {
             $flip = array_flip($this->options['pages']);
             $value = $flip[$post->ID];
         }
     }
     $menu = wp_get_nav_menu_object('MenuX');
     $items = wp_get_nav_menu_items($menu->term_id);
     foreach ((array) $items as $key => $menu_item) {
         $postArray[$menu_item->ID] = $menu_item->title;
     }
     require_once PHPX_DIR . 'phpx_form.php';
     $form = new phpx_form();
     $form->fieldsOnly = true;
     $form->dropDown('Menu Item', 'menux_menu_item', $value, $postArray, true);
     print $form->text;
 }
Ejemplo n.º 2
0
 function crowdx_run()
 {
     if ($_POST['submit']) {
         if (!wp_verify_nonce($_POST["_wpnonce"])) {
             die('Security check');
         }
         $omit = array('_wpnonce', 'submit');
         foreach (array_keys($_POST) as $p) {
             if (!in_array($p, $omit)) {
                 $this->options[$p] = $_POST[$p];
             }
         }
         update_option('crowdx_options', $this->options);
         $status = 'Options Updated';
     }
     $userRoleArray = array();
     $wp_roles = new WP_Roles();
     foreach ($wp_roles->role_names as $role => $name) {
         $userRoleArray[$role] = $name;
     }
     require_once PHPX_DIR . 'phpx_page.php';
     require_once PHPX_DIR . 'phpx_form.php';
     $page = new phpx_page();
     $form = new phpx_form();
     $form->startForm($this->baseURL, "crowdxForm");
     $form->hidden("_wpnonce", wp_create_nonce());
     $form->dropDown('Enabled', 'enable', $this->options['enable'], array('Off', 'On'));
     $form->dropDown('All Users (Internal and Crowd)', 'all_users', $this->options['all_users'], array('Off', 'On'));
     $form->dropDown('Auto Add New Users from Crowd', 'add_users', $this->options['add_users'], array('Off', 'On'));
     $form->dropDown('User Role for Added Users', 'default_user_role', $this->options['default_user_role'], $userRoleArray);
     $form->dropDown('Fallback to Internal Database', 'fallback', $this->options['fallback'], array('Off', 'On'));
     $form->textField('URL to Crowd Server', 'server', $this->options['server']);
     $form->textField('Application Name', 'app_name', $this->options['app_name'], true);
     $form->textField('Application Password', 'app_pass', $this->options['app_pass'], true);
     $form->endForm('Submit');
     $text = $page->startPage('CrowdX Configuration', $status) . $form->text . $page->endPage();
     print $text;
 }
Ejemplo n.º 3
0
 function adminPage()
 {
     if (current_user_can('publish_pages')) {
         if ($_POST['submit']) {
             $omit = array('submit', 'wp_nonce');
             if (!wp_verify_nonce($_POST['wp_nonce'], 'tabx')) {
                 die('Invalid Token');
             }
             foreach ($_POST as $k => $v) {
                 if (!in_array($k, $omit)) {
                     $this->options[$k] = $v;
                 }
             }
             if ($_FILES['image']['name'] != '') {
                 $file = wp_handle_upload($_FILES['image'], array('test_form' => false));
                 $this->options['image'] = $file['url'];
             }
             update_option('tabx_options', $this->options);
             $message = '<p>Options Saved</p>';
         }
         $envArray = array('Development', 'Production');
         require_once PHPX_DIR . 'phpx_form.php';
         $form = new phpx_form();
         $text = '<div class="wrap" id="phpxContainer"><h2>Slide Out Tab</h2>';
         if ($message || $_GET['message']) {
             $text .= $message;
         }
         $text .= $form->startForm('tools.php?page=tabx/tabx.php', 'tabxForm', 'post', true);
         $text .= $form->hidden('wp_nonce', wp_create_nonce('tabx'));
         $text .= $form->textField('Link Text', 'link_text', $this->options['link_text']);
         ob_start();
         wp_editor(stripslashes($this->options['content']), 'tabxcontent', array('textarea_name' => 'content'));
         $text .= $form->freeText(ob_get_contents());
         ob_end_clean();
         $locationArray = array('top' => 'top', 'bottom' => 'bottom', 'left' => 'left', 'right' => 'right');
         $actionArray = array('click' => 'click', 'hover' => 'hover');
         $fixedArray = array('true' => 'True', 'false' => 'False');
         $text .= $form->fileField('Image', 'image');
         $text .= $form->freeText('<strong>Current Image: </strong><br /><img src="' . $this->options['image'] . '" />');
         $text .= $form->textField('Image Height', 'height', $this->options['height']);
         $text .= $form->textField('Image Width', 'width', $this->options['width']);
         $text .= $form->dropDown('Location', 'location', $this->options['location'], $locationArray);
         $text .= $form->textField('Speed', 'speed', $this->options['speed']);
         $text .= $form->dropDown('Action', 'action', $this->options['action'], $actionArray);
         $text .= $form->textField('Top Position', 'top', $this->options['top']);
         $text .= $form->textField('Left Position', 'left', $this->options['left']);
         $text .= $form->dropDown('Fixed Position', 'fixed', $this->options['fixed'], $fixedArray);
         $text .= $form->endForm();
         $text .= '</div>';
         print $text;
     }
 }
Ejemplo n.º 4
0
 function fieldform()
 {
     require_once PHPX_DIR . 'phpx_form.php';
     $form1 = new phpx_form();
     $form1->labels = false;
     $form1->instantReturn = true;
     $text .= $form1->startForm($adminURL, 'loginxFieldForm', 'post', false, 'false');
     $id = 0;
     $reg = 0;
     $req = 0;
     if ($_GET['action'] == 'edit') {
         $row = $this->wpdb->get_row($this->wpdb->prepare('select * from ' . $this->wpdb->prefix . 'loginx_field where loginx_field_id = %d limit 1', $_GET['id']));
         $id = $row->loginx_field_id;
         $req = $row->loginx_field_req;
         $reg = $row->loginx_field_reg;
     }
     $addField = '<table class="inline"><tr><th>Name</th><th>Label</th><th>Type</th><th>Options</th></tr><tr>';
     $addField .= '<td>' . $form1->textField('Name', 'loginx_field_name', $row->loginx_field_name, true) . '</td>';
     $addField .= '<td>' . $form1->textField('Label', 'loginx_field_label', $row->loginx_field_label, true) . '</td>';
     $addField .= '<td>' . $form1->dropDown('Type', 'loginx_field_type', $row->loginx_field_type, $this->fieldTypes, false, true) . '</td>';
     $addField .= '<td>' . $form1->textArea('Options', 'loginx_field_options', $row->loginx_field_options) . '</td>';
     $addField .= '</tr></table>';
     $text .= '<a name="customFields"></a><fieldset><legend>Custom Fields</legend>';
     $text .= $form1->startFieldSet('Add Custom User Field');
     $text .= $form1->hidden('nonce', wp_create_nonce('loginx_manage_fields'));
     $text .= $form1->hidden('loginx_field_id', $id);
     $text .= $form1->freeText($addField);
     $text .= $form1->endForm();
     $text .= '</fieldset>';
     $text .= '<div id="customFieldsList">';
     $text .= '</div>';
     $text .= '</fieldset>';
     return $text;
 }