Plugin Directory

Changeset 1564977


Ignore:
Timestamp:
12/30/2016 01:22:16 PM (9 years ago)
Author:
rootabout
Message:

removed dependency on plugin, rewrote the main functionality, added script and style dependencies, plugin is standalone now

Location:
signature-one/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • signature-one/trunk/abExport.php

    r1450450 r1564977  
    11<?php
    2      $abError = false;
    3     include_once ABSPATH.'wp-admin/includes/plugin.php';
    4     if (!is_plugin_active('admin-builder/admin-builder.php')) {
    5       if(!function_exists('sample_admin_notice__success'))
    6            {
    7         function sample_admin_notice__success()
     2// Built with Admin Builder http://admin-builder.com
     3
     4  //dynamic textbox generate
     5  if(!function_exists('dtGenerate')){
     6    function dtGenerate($label, $name, $value, $index = null, $attr = null)
     7    {
     8        $arrName = $name;
     9        $origNameStr = 'origName="'.$name.'" ';
     10        if ($index !== null && !empty($attr) && !empty($attr)) {
     11            $arrName = $name.'['.$index.']['.$attr.']';
     12        }
     13
     14        $attrStr = '';
     15        if ($attr != null && !empty($attr)) {
     16            $attrStr = 'dtArrName="'.$attr.'" ';
     17        }
     18        $fieldHTML = '<div class="form-group">';
     19        $fieldHTML .= '<label for="'.$name.'">'.$label.'</label>';
     20        $fieldHTML .= '<input type="text" name="'.$arrName.'" '.$origNameStr.'  class="form-control" '.$attrStr.' placeholder="Please enter '.$label.'" value="'.$value.'">';
     21        $fieldHTML .= '</div>';
     22
     23        return $fieldHTML;
     24    }
     25  }
     26if(!function_exists('saveArrayFields')){
     27  function saveArrayFields($hidden_field_name, $hidden_field_value)
     28  {
     29      if (empty($_POST)) {
     30          return false;
     31      }
     32    // See if the user has posted us some information
     33    // If they did, this hidden field will be set to 'Y'
     34    if (isset($_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == $hidden_field_value) {
     35        $fullPostString = '';
     36    // Read their posted value
     37    if (isset($_POST['cPage'])) {
     38        $fullPostString = serialize($_POST['cPage']);
     39    }
     40
     41    // Save the posted value in the database
     42    update_option($hidden_field_name, $fullPostString);
     43
     44    // Put a "settings saved" message on the screen
     45
     46    ?>
     47    <div class="updated"><p><strong><?php _e('settings saved.', 'menu-test');
     48        ?></strong></p></div>
     49    <?php
     50
     51    }
     52  }
     53}
     54
     55
     56//bootstrap icons function
     57if(!function_exists('ab_admin_footer_function')){
     58  add_action('admin_footer', 'ab_admin_footer_function');
     59  function ab_admin_footer_function()
     60  {
     61      $bsIconsString = 'glyphicon-asterisk,glyphicon-plus,glyphicon-euro,glyphicon-eur,glyphicon-minus,glyphicon-cloud,glyphicon-envelope,glyphicon-pencil,glyphicon-glass,glyphicon-music,glyphicon-search,glyphicon-heart,glyphicon-star,glyphicon-star-empty,glyphicon-user,glyphicon-film,glyphicon-th-large,glyphicon-th,glyphicon-th-list,glyphicon-ok,glyphicon-remove,glyphicon-zoom-in,glyphicon-zoom-out,glyphicon-off,glyphicon-signal,glyphicon-cog,glyphicon-trash,glyphicon-home,glyphicon-file,glyphicon-time,glyphicon-road,glyphicon-download-alt,glyphicon-download,glyphicon-upload,glyphicon-inbox,glyphicon-play-circle,glyphicon-repeat,glyphicon-refresh,glyphicon-list-alt,glyphicon-lock,glyphicon-flag,glyphicon-headphones,glyphicon-volume-off,glyphicon-volume-down,glyphicon-volume-up,glyphicon-qrcode,glyphicon-barcode,glyphicon-tag,glyphicon-tags,glyphicon-book,glyphicon-bookmark,glyphicon-print,glyphicon-camera,glyphicon-font,glyphicon-bold,glyphicon-italic,glyphicon-text-height,glyphicon-text-width,glyphicon-align-left,glyphicon-align-center,glyphicon-align-right,glyphicon-align-justify,glyphicon-list,glyphicon-indent-left,glyphicon-indent-right,glyphicon-facetime-video,glyphicon-picture,glyphicon-map-marker,glyphicon-adjust,glyphicon-tint,glyphicon-edit,glyphicon-share,glyphicon-check,glyphicon-move,glyphicon-step-backward,glyphicon-fast-backward,glyphicon-backward,glyphicon-play,glyphicon-pause,glyphicon-stop,glyphicon-forward,glyphicon-fast-forward,glyphicon-step-forward,glyphicon-eject,glyphicon-chevron-left,glyphicon-chevron-right,glyphicon-plus-sign,glyphicon-minus-sign,glyphicon-remove-sign,glyphicon-ok-sign,glyphicon-question-sign,glyphicon-info-sign,glyphicon-screenshot,glyphicon-remove-circle,glyphicon-ok-circle,glyphicon-ban-circle,glyphicon-arrow-left,glyphicon-arrow-right,glyphicon-arrow-up,glyphicon-arrow-down,glyphicon-share-alt,glyphicon-resize-full,glyphicon-resize-small,glyphicon-exclamation-sign,glyphicon-gift,glyphicon-leaf,glyphicon-fire,glyphicon-eye-open,glyphicon-eye-close,glyphicon-warning-sign,glyphicon-plane,glyphicon-calendar,glyphicon-random,glyphicon-comment,glyphicon-magnet,glyphicon-chevron-up,glyphicon-chevron-down,glyphicon-retweet,glyphicon-shopping-cart,glyphicon-folder-close,glyphicon-folder-open,glyphicon-resize-vertical,glyphicon-resize-horizontal,glyphicon-hdd,glyphicon-bullhorn,glyphicon-bell,glyphicon-certificate,glyphicon-thumbs-up,glyphicon-thumbs-down,glyphicon-hand-right,glyphicon-hand-left,glyphicon-hand-up,glyphicon-hand-down,glyphicon-circle-arrow-right,glyphicon-circle-arrow-left,glyphicon-circle-arrow-up,glyphicon-circle-arrow-down,glyphicon-globe,glyphicon-wrench,glyphicon-tasks,glyphicon-filter,glyphicon-briefcase,glyphicon-fullscreen,glyphicon-dashboard,glyphicon-paperclip,glyphicon-heart-empty,glyphicon-link,glyphicon-phone,glyphicon-pushpin,glyphicon-usd,glyphicon-gbp,glyphicon-sort,glyphicon-sort-by-alphabet,glyphicon-sort-by-alphabet-alt,glyphicon-sort-by-order,glyphicon-sort-by-order-alt,glyphicon-sort-by-attributes,glyphicon-sort-by-attributes-alt,glyphicon-unchecked,glyphicon-expand,glyphicon-collapse-down,glyphicon-collapse-up,glyphicon-log-in,glyphicon-flash,glyphicon-log-out,glyphicon-new-window,glyphicon-record,glyphicon-save,glyphicon-open,glyphicon-saved,glyphicon-import,glyphicon-export,glyphicon-send,glyphicon-floppy-disk,glyphicon-floppy-saved,glyphicon-floppy-remove,glyphicon-floppy-save,glyphicon-floppy-open,glyphicon-credit-card,glyphicon-transfer,glyphicon-cutlery,glyphicon-header,glyphicon-compressed,glyphicon-earphone,glyphicon-phone-alt,glyphicon-tower,glyphicon-stats,glyphicon-sd-video,glyphicon-hd-video,glyphicon-subtitles,glyphicon-sound-stereo,glyphicon-sound-dolby,glyphicon-sound-5-1,glyphicon-sound-6-1,glyphicon-sound-7-1,glyphicon-copyright-mark,glyphicon-registration-mark,glyphicon-cloud-download,glyphicon-cloud-upload,glyphicon-tree-conifer,glyphicon-tree-deciduous,glyphicon-cd,glyphicon-save-file,glyphicon-open-file,glyphicon-level-up,glyphicon-copy,glyphicon-paste,glyphicon-alert,glyphicon-equalizer,glyphicon-king,glyphicon-queen,glyphicon-pawn,glyphicon-bishop,glyphicon-knight,glyphicon-baby-formula,glyphicon-tent,glyphicon-blackboard,glyphicon-bed,glyphicon-apple,glyphicon-erase,glyphicon-hourglass,glyphicon-lamp,glyphicon-duplicate,glyphicon-piggy-bank,glyphicon-scissors,glyphicon-bitcoin,glyphicon-btc,glyphicon-xbt,glyphicon-yen,glyphicon-jpy,glyphicon-ruble,glyphicon-rub,glyphicon-scale,glyphicon-ice-lolly,glyphicon-ice-lolly-tasted,glyphicon-education,glyphicon-option-horizontal,glyphicon-option-vertical,glyphicon-menu-hamburger,glyphicon-modal-window,glyphicon-oil,glyphicon-grain,glyphicon-sunglasses,glyphicon-text-size,glyphicon-text-color,glyphicon-text-background,glyphicon-object-align-top,glyphicon-object-align-bottom,glyphicon-object-align-horizontal,glyphicon-object-align-left,glyphicon-object-align-vertical,glyphicon-object-align-right,glyphicon-triangle-right,glyphicon-triangle-left,glyphicon-triangle-bottom,glyphicon-triangle-top,glyphicon-console,glyphicon-superscript,glyphicon-subscript,glyphicon-menu-left,glyphicon-menu-right,glyphicon-menu-down,glyphicon-menu-up';
     62      $bsIconsArr = explode(',', $bsIconsString);
     63
     64      ?>
     65      <div id="test-popup" class="open-popup-link white-popup mfp-hide">
     66      <?php
     67      foreach ($bsIconsArr as $key => $value) {
     68          ?>
     69        <button type="button"><i class="glyphicon <?php echo $value;
     70          ?>"></i></button>
     71        <?php
     72
     73      }
     74
     75                  ?>
     76      </div>
     77      <?php
     78  }
     79}
     80
     81
     82    if(!function_exists('abEnqueueAll')){
     83      //Admin scripts and styles
     84      add_action('admin_enqueue_scripts', 'abEnqueueAll');
     85      //Admin scripts and styles callback
     86      function abEnqueueAll()
     87      {
     88        //*
     89        // CSS
     90        //*
     91        abExists('bootstrapFontIcons', 'ab-src/css/bootstrap.min.css', 'style',array(),'plugin');
     92        abExists('jQueryUiCore', 'ab-src/css/jquery-ui.css', 'style',array(),'plugin');
     93        abExists('abIris', 'ab-src/css/iris.min.css', 'style',array(),'plugin');
     94        abExists('abMagnificPopup', 'ab-src/css/magnific-popup.css', 'style',array(),'plugin');
     95        abExists('abTimepicker', 'ab-src/css/jquery.timepicker.css', 'style',array(),'plugin');
     96        //--
     97        abExists('customAbStyle', 'ab-src/css/abStyle.css', 'style',array(),'plugin');
     98
     99          //*
     100          //  Custom JS
     101          //*
     102                wp_enqueue_media();
     103          wp_enqueue_script('jquery-ui-core');
     104          wp_enqueue_script('jquery-ui-widget', false, array('jquery-ui-core'));
     105          wp_enqueue_script('jquery-ui-mouse', false, array('jquery-ui-core'));
     106          wp_enqueue_script('jquery-ui-datepicker', false, array('jquery-ui-core'));
     107          wp_enqueue_script('jquery-ui-draggable', false, array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'));
     108          wp_enqueue_script('jquery-ui-slider', false, array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse'));
     109          //*
     110          //  Custom JS
     111          //*
     112          abExists('abColor', 'ab-src/js/color.js', 'script',array(),'plugin');
     113          abExists('abIris', 'ab-src/js/iris.js', 'script',array('jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-slider'),'plugin');
     114          abExists('abTimepicker', 'ab-src/js/jquery.timepicker.min.js', 'script',array('jquery-ui-core'),'plugin');
     115          abExists('abBootstrapJs', 'ab-src/js/bootstrap.min.js', 'script',array('jquery', 'jquery-ui-core'),'plugin');
     116          abExists('abMagnificPopup', 'ab-src/js/jquery.magnific-popup.min.js', 'script',array('jquery', 'jquery-ui-core'),'plugin');
     117          //--
     118          abExists('abCustomScript', 'ab-src/js/abScript.js', 'script',array(),'plugin');
     119        }
     120      }
     121      if(!function_exists('abExists')){
     122        function abExists($name, $path, $type,$dependencies = array(),$exportType)
    8123        {
    9           $pluginInstalled = false;
    10           if (!function_exists('get_plugins')) {
    11             require_once ABSPATH.'wp-admin/includes/plugin.php';
    12           }
    13           $allPlugins = get_plugins();
    14           foreach ($allPlugins as $key => $value) {
    15             if ($key === 'admin-builder/admin_builder.php') {
    16               $pluginInstalled = true;
     124          $fileExists = false;
     125
     126          if($exportType==='theme'){
     127            $file = get_template_directory_uri().'/'.$path;
     128          }else{
     129            $file = plugin_dir_url(__FILE__).$path;
     130          }
     131            $plugin_file_headers = @get_headers($file);
     132            if (!$plugin_file_headers || strpos($plugin_file_headers[0], '404') > 0) {
     133                //file does not exist
     134              $fileExists = false;
     135            } else {
     136                //file exists if a plugin path
     137              $fileExists = true;
    17138            }
    18            }
    19             if ($pluginInstalled){
    20               if (!is_plugin_active('admin-builder/admin_builder.php')) {
    21                 $abError = true;
    22                 $url = admin_url();
    23                 echo '<div class="notice notice-error is-dismissible">';
    24                 echo '<h3>Admin Builder Plugin is not ACTIVE!</h3>';
    25                 echo '<p>';
    26                 echo 'To get the full functionality , activate Admin Builder from the <a href="'.$url.'/plugins.php">plugins directory</a>.';
    27                 echo '</p>';
    28                 echo '</div>';
     139          //inside theme path file existance ?
     140          // Custom Script
     141          if ($fileExists) {
     142              if ($type === 'style') {
     143                  wp_register_style($name, $file);
     144                  wp_enqueue_style($name);
    29145              } else {
    30                 $theJson = '';
     146                  wp_register_script($name, $file, $dependencies);
     147                  wp_enqueue_script($name);
    31148              }
    32              } else {
    33               $abError = true;
    34               echo '<div class="notice notice-error is-dismissible">';
    35               echo '<h3>Admin Builder Plugin is not installed!</h3>';
    36               echo '<p>';
    37               echo 'To get the full functionality , install Admin Builder.';
    38               echo '</p>';
    39               echo '<p>';
    40               $plugin_name = 'admin-builder';
    41               $install_link = '<a href="'.esc_url(network_admin_url('plugin-install.php?tab=plugin-information&amp;plugin='.$plugin_name.'&amp;TB_iframe=true&amp;width=600&amp;height=550')).'" class="thickbox" title="More info about '.$plugin_name.'">Install '.$plugin_name.'</a>';
    42               echo $install_link;
    43               echo '</p>';
    44               echo '</div>';
    45              }
     149          }
     150        }
     151      }
     152      if(!function_exists('loadcPage')){
     153        function loadcPage($hidden_field_name)
     154        {
     155            $stringValues = get_option($hidden_field_name);
     156            return unserialize($stringValues);
     157        }
     158      }
     159
     160// Metabox hook for Signature One Settings
     161
     162  if(!function_exists('abAddMetaBox_soSettings')){add_action('add_meta_boxes', 'abAddMetaBox_soSettingspost');
     163add_action('save_post', 'abSavePost_soSettingspost');
     164function abSavePost_soSettingspost($post_id){
     165
     166  if (!isset($_POST['aB_nounce_soSettings']) || !wp_verify_nonce($_POST['aB_nounce_soSettings'], basename(__FILE__))) {
     167      return true;
     168  }
     169  $fields = array( 'abMB_postsoSettingstextbox1', 'abMB_postsoSettingsselect2', 'abMB_postsoSettingsselect1', 'abMB_postsoSettingsupload1', );
     170  foreach($fields as $key => $field) {
     171    //field name
     172    $fieldName = $field;
     173
     174    // set the new value to a variable
     175    $new_meta_value = (isset($_POST[$fieldName]) ? $_POST[$fieldName] : '0');
     176    // code...
     177    // Get the meta key.
     178    $meta_key = $fieldName;
     179    // Get the meta value of the custom field key.
     180    $meta_value = get_post_meta($post_id, $meta_key, true);
     181    if (is_array($meta_value)) {
     182      $tempNewMetaValue = array();
     183      foreach ($new_meta_value as $key => $value) {
     184        $tempNewMetaValue[] = $value;
     185      }
     186      $new_meta_value = $tempNewMetaValue;
     187    }
     188    /* If a new meta value was added and there was no previous value, add it. */
     189    if ($new_meta_value !== $meta_value) {
     190      update_post_meta($post_id, $meta_key, $new_meta_value);
     191    }  /* If there is no new meta value but an old value exists, delete it. */
     192    elseif ('' == $new_meta_value && $meta_value) {
     193      delete_post_meta($post_id, $meta_key, $meta_value);
     194    }
     195 }
     196}
     197function abAddMetaBox_soSettingspost($post){
     198  // Add the metabox
     199  add_meta_box( 'soSettings0', __( 'Signature One Settings', 'textdomain' ), 'abAddMetaBox_soSettings0post_display_callback', 'post','normal','default',array() );
     200}
     201function abAddMetaBox_soSettings0post_display_callback($post){
     202
     203 wp_nonce_field(basename(__FILE__), 'aB_nounce_soSettings'); ?>
     204<div class="container-fluid aBMB ab">
     205<?php
     206$fieldValue=""; ?>
     207 <?php if (isset($post->ID)) {
     208  $fieldName = 'abMB_postsoSettingstextbox1';
     209 $fieldValue = get_post_meta($post->ID, $fieldName, true);
     210 } ?>
     211
     212          <div class="row abList">
     213            <div class="col-sm-2">
     214              <label class="title">Text Signature</label></div>
     215           <div class="col-sm-10">
     216                 <input class="widefat" type="text" name="<?php echo $fieldName; ?>"  id="<?php echo $fieldName; ?>" value="<?php echo $fieldValue; ?>" size="30" />
     217
     218        <label class="description">Input text signature that you want to show</label>
     219      </div>
     220    </div><?php
     221$fieldValue=""; ?>
     222 <?php if (isset($post->ID)) {
     223  $fieldName = 'abMB_postsoSettingsselect2';
     224 $fieldValue = get_post_meta($post->ID, $fieldName, true);
     225 } ?>
     226
     227          <div class="row abList">
     228            <div class="col-sm-2">
     229              <label class="title">Alignment</label></div>
     230           <div class="col-sm-10">
     231                 <select name="<?php echo $fieldName; ?>" id="<?php echo $fieldName; ?>">
     232      <?php $selected = selected('0', $fieldValue, false) ? selected('0', $fieldValue, false) : '';
     233      //set the options ?>
     234      <option <?php echo $selected; ?> value="0" >Default</option>
     235      <?php $selected = selected('left', $fieldValue, false) ? selected('left', $fieldValue, false) : '';
     236      //set the options ?>
     237      <option <?php echo $selected; ?> value="left" >Left</option>
     238      <?php $selected = selected('center', $fieldValue, false) ? selected('center', $fieldValue, false) : '';
     239      //set the options ?>
     240      <option <?php echo $selected; ?> value="center" >Center</option>
     241      <?php $selected = selected('right', $fieldValue, false) ? selected('right', $fieldValue, false) : '';
     242      //set the options ?>
     243      <option <?php echo $selected; ?> value="right" >Right</option>
     244      </select>
     245        <label class="description">How the signature should be aligned</label>
     246      </div>
     247    </div><?php
     248$fieldValue=""; ?>
     249 <?php if (isset($post->ID)) {
     250  $fieldName = 'abMB_postsoSettingsselect1';
     251 $fieldValue = get_post_meta($post->ID, $fieldName, true);
     252 } ?>
     253
     254          <div class="row abList">
     255            <div class="col-sm-2">
     256              <label class="title">Font size</label></div>
     257           <div class="col-sm-10">
     258                 <select name="<?php echo $fieldName; ?>" id="<?php echo $fieldName; ?>">
     259      <?php $selected = selected('0', $fieldValue, false) ? selected('0', $fieldValue, false) : '';
     260      //set the options ?>
     261      <option <?php echo $selected; ?> value="0" >Default</option>
     262      <?php $selected = selected('12', $fieldValue, false) ? selected('12', $fieldValue, false) : '';
     263      //set the options ?>
     264      <option <?php echo $selected; ?> value="12" >Tiny</option>
     265      <?php $selected = selected('14', $fieldValue, false) ? selected('14', $fieldValue, false) : '';
     266      //set the options ?>
     267      <option <?php echo $selected; ?> value="14" >Small</option>
     268      <?php $selected = selected('16', $fieldValue, false) ? selected('16', $fieldValue, false) : '';
     269      //set the options ?>
     270      <option <?php echo $selected; ?> value="16" >Normal</option>
     271      <?php $selected = selected('24', $fieldValue, false) ? selected('24', $fieldValue, false) : '';
     272      //set the options ?>
     273      <option <?php echo $selected; ?> value="24" >Big</option>
     274      <?php $selected = selected('36', $fieldValue, false) ? selected('36', $fieldValue, false) : '';
     275      //set the options ?>
     276      <option <?php echo $selected; ?> value="36" >Huge</option>
     277      </select>
     278        <label class="description">Set a signature font size</label>
     279      </div>
     280    </div><?php
     281$fieldValue=""; ?>
     282 <?php if (isset($post->ID)) {
     283  $fieldName = 'abMB_postsoSettingsupload1';
     284 $fieldValue = get_post_meta($post->ID, $fieldName, true);
     285 } ?>
     286
     287          <div class="row abList">
     288            <div class="col-sm-2">
     289              <label class="title">Upload Image</label></div>
     290           <div class="col-sm-10">
     291           <p><img src="<?php echo $fieldValue; ?>" alt="" class="uploadImage"/></p><button class="aBUpload">Upload</button><br/><br/><input type="hidden" name="<?php echo $fieldName; ?>" value="<?php echo $fieldValue; ?>" />
     292        <label class="description">Upload a image that  will be the signature you want at the bottom of this post. ( if set, this overrides the text signature)</label>
     293      </div>
     294    </div>  </div>
     295<?php }
     296}
     297
     298
     299      add_action( 'admin_menu', 'admin_menu_callback_signature_one_settings' );
     300      function admin_menu_callback_signature_one_settings(){
     301        add_menu_page('signature_one_settings', 'Signature one', 'manage_options', 'abSlugsignature_one_settings', 'ab_callback_signature_one_settings', '', null);
     302      }
     303        //if the function exists
     304        if(!function_exists('ab_callback_signature_one_settings')){
     305            //menu Callback function
     306            function ab_callback_signature_one_settings(){
     307              ?>
     308              <div class="container-fluid ab">
     309              <form name="abForm" class="abForm" method="post" action="">
     310              <?php
     311              if ($_GET['page'] === 'abSlugsignature_one_settings') {
     312                ?>
     313                <h2>Signature One General Settings</h2>
     314                <p class="pageDescription">What you change here will be available for the entire site.</p>
     315                <?php
     316                if (!current_user_can('manage_options')) {
     317                    wp_die(__('You do not have sufficient permissions to access this page.'));
     318                }
     319                ?>
     320              <input type="hidden" name="abOption_cPage_signature_one_settings" value="cPage_signature_one_settingshfv#$1!" />
     321              <?php
     322              $allValues = loadcPage('abOption_cPage_signature_one_settings'); //Get all the Values for the fields of this page in one big array
     323                    ?>
     324                    <div class="container-fluid">
     325                    <div class="row">
     326                      <div class="col-sm-12">
     327                          <div class="tab-content">
     328
     329                      <div role="tab-panel" class="tab-pane  active " id="tab1">
     330
     331<div class="container-fluid aBMB ab">
     332<?php
     333$fieldValue=""; ?>
     334<?php  $fieldName = 'abOption_cPagetab1textbox1'; ?>
     335 <?php //Get Admin Page field Value
     336if(isset($_POST['abOption_cPage_signature_one_settings']) && $_POST['abOption_cPage_signature_one_settings']==='cPage_signature_one_settingshfv#$1!'){
     337 if(isset($_POST[$fieldName])){
     338    update_option($fieldName, $_POST[$fieldName]);
     339 }else{
     340                      delete_option($fieldName);
     341          }
     342}
     343  $fieldValue = get_option($fieldName, false); ?>
     344
     345          <div class="row abList">
     346            <div class="col-sm-2">
     347              <label class="title">Text Signature</label></div>
     348           <div class="col-sm-10">
     349                 <input class="widefat" type="text" name="<?php echo $fieldName; ?>"  id="<?php echo $fieldName; ?>" value="<?php echo $fieldValue; ?>" size="30" />
     350
     351        <label class="description">Input text signature that you want to show</label>
     352      </div>
     353    </div><?php
     354$fieldValue=""; ?>
     355<?php  $fieldName = 'abOption_cPagetab1select1'; ?>
     356 <?php //Get Admin Page field Value
     357if(isset($_POST['abOption_cPage_signature_one_settings']) && $_POST['abOption_cPage_signature_one_settings']==='cPage_signature_one_settingshfv#$1!'){
     358 if(isset($_POST[$fieldName])){
     359    update_option($fieldName, $_POST[$fieldName]);
     360 }else{
     361                      delete_option($fieldName);
     362          }
     363}
     364  $fieldValue = get_option($fieldName, false); ?>
     365
     366          <div class="row abList">
     367            <div class="col-sm-2">
     368              <label class="title">Alignment</label></div>
     369           <div class="col-sm-10">
     370                 <select name="<?php echo $fieldName; ?>" id="<?php echo $fieldName; ?>">
     371      <?php $selected = selected('left', $fieldValue, false) ? selected('left', $fieldValue, false) : '';
     372      //set the options ?>
     373      <option <?php echo $selected; ?> value="left" >Left</option>
     374      <?php $selected = selected('center', $fieldValue, false) ? selected('center', $fieldValue, false) : '';
     375      //set the options ?>
     376      <option <?php echo $selected; ?> value="center" >Center</option>
     377      <?php $selected = selected('right', $fieldValue, false) ? selected('right', $fieldValue, false) : '';
     378      //set the options ?>
     379      <option <?php echo $selected; ?> value="right" >Right</option>
     380      </select>
     381        <label class="description">Default Select Description text</label>
     382      </div>
     383    </div><?php
     384$fieldValue=""; ?>
     385<?php  $fieldName = 'abOption_cPagetab1select2'; ?>
     386 <?php //Get Admin Page field Value
     387if(isset($_POST['abOption_cPage_signature_one_settings']) && $_POST['abOption_cPage_signature_one_settings']==='cPage_signature_one_settingshfv#$1!'){
     388 if(isset($_POST[$fieldName])){
     389    update_option($fieldName, $_POST[$fieldName]);
     390 }else{
     391                      delete_option($fieldName);
     392          }
     393}
     394  $fieldValue = get_option($fieldName, false); ?>
     395
     396          <div class="row abList">
     397            <div class="col-sm-2">
     398              <label class="title">Font size</label></div>
     399           <div class="col-sm-10">
     400                 <select name="<?php echo $fieldName; ?>" id="<?php echo $fieldName; ?>">
     401      <?php $selected = selected('12', $fieldValue, false) ? selected('12', $fieldValue, false) : '';
     402      //set the options ?>
     403      <option <?php echo $selected; ?> value="12" >Tiny</option>
     404      <?php $selected = selected('14', $fieldValue, false) ? selected('14', $fieldValue, false) : '';
     405      //set the options ?>
     406      <option <?php echo $selected; ?> value="14" >Small</option>
     407      <?php $selected = selected('16', $fieldValue, false) ? selected('16', $fieldValue, false) : '';
     408      //set the options ?>
     409      <option <?php echo $selected; ?> value="16" >Normal</option>
     410      <?php $selected = selected('24', $fieldValue, false) ? selected('24', $fieldValue, false) : '';
     411      //set the options ?>
     412      <option <?php echo $selected; ?> value="24" >Big</option>
     413      <?php $selected = selected('36', $fieldValue, false) ? selected('36', $fieldValue, false) : '';
     414      //set the options ?>
     415      <option <?php echo $selected; ?> value="36" >Huge</option>
     416      </select>
     417        <label class="description">Set a signature font size</label>
     418      </div>
     419    </div><?php
     420$fieldValue=""; ?>
     421<?php  $fieldName = 'abOption_cPagetab1upload1'; ?>
     422 <?php //Get Admin Page field Value
     423if(isset($_POST['abOption_cPage_signature_one_settings']) && $_POST['abOption_cPage_signature_one_settings']==='cPage_signature_one_settingshfv#$1!'){
     424 if(isset($_POST[$fieldName])){
     425    update_option($fieldName, $_POST[$fieldName]);
     426 }else{
     427                      delete_option($fieldName);
     428          }
     429}
     430  $fieldValue = get_option($fieldName, false); ?>
     431
     432          <div class="row abList">
     433            <div class="col-sm-2">
     434              <label class="title">Upload Image</label></div>
     435           <div class="col-sm-10">
     436           <p><img src="<?php echo $fieldValue; ?>" alt="" class="uploadImage"/></p><button class="aBUpload">Upload</button><br/><br/><input type="hidden" name="<?php echo $fieldName; ?>" value="<?php echo $fieldValue; ?>" />
     437        <label class="description">Upload a image that  will be the signature you want at the bottom of this post. ( if set, this overrides the text signature)</label>
     438      </div>
     439    </div>  </div>
     440
     441                                    <div class="row">
     442                                      <div class="col-sm-12">
     443                                        <p class="submit">
     444                                          <input type="submit" name="Submit" class="button-primary" value="Save Changes" />
     445                                        </p>
     446                                      </div>
     447                                    </div>
     448                                    </div>
     449
     450            <?php }
     451              ?>
     452              </form>
     453            <?php
     454
    46455            }
    47             add_action('admin_notices', 'sample_admin_notice__success');
    48            }
    49            }
    50            if (!$abError) {
    51 
    52     $theJson = '{\"menus\":[{\"label\":\"Posts\",\"type\":\"post\",\"name\":\"posts\",\"unique\":true,\"children\":[{\"label\":\"Signature One Settings\",\"name\":\"metabox1\",\"context\":\"normal\",\"priority\":\"default\",\"fields\":[{\"name\":\"textbox1\",\"type\":\"textbox\",\"label\":\"Signature Text\",\"description\":\"Enter the text you want as a signature to Show for this specific Post. (Default Global Options will be applied if this is left empty)\",\"$$hashKey\":\"object:744\"},{\"name\":\"select1\",\"type\":\"select\",\"label\":\"Size\",\"description\":\"The size of the signature text\",\"selectType\":\"custom\",\"oArr\":[{\"label\":\"Global Default\",\"value\":\"0\",\"$$hashKey\":\"object:5201\"},{\"label\":\"Small (14 px)\",\"value\":\"14\",\"$$hashKey\":\"object:5212\"},{\"label\":\"Medium (18px)\",\"value\":\"18\",\"$$hashKey\":\"object:6064\"},{\"label\":\"Large (22 px)\",\"value\":\"22\",\"$$hashKey\":\"object:6073\"},{\"label\":\"Huge (32 px)\",\"value\":\"32\",\"$$hashKey\":\"object:6082\"},{\"label\":\"Giant (46 px)\",\"value\":\"46\",\"$$hashKey\":\"object:532\"}],\"$$hashKey\":\"object:5110\"},{\"name\":\"select2\",\"type\":\"select\",\"label\":\"Signature Position\",\"description\":\"The signature will display on the bottom of each post. What side, you decide.\",\"selectType\":\"custom\",\"oArr\":[{\"label\":\"Globally Default\",\"value\":\"0\",\"$$hashKey\":\"object:1010\"},{\"label\":\"Center\",\"value\":\"center\",\"$$hashKey\":\"object:1021\"},{\"label\":\"Left\",\"value\":\"left\",\"$$hashKey\":\"object:1030\"},{\"label\":\"Right\",\"value\":\"right\",\"$$hashKey\":\"object:491\"}],\"$$hashKey\":\"object:919\"},{\"name\":\"upload1\",\"type\":\"upload\",\"label\":\"Signature Image\",\"description\":\"Use an Image as your signature ( WARNING! Uploading an image will not use the text signature. Remove image to use text signature)\",\"tSizes\":[],\"$$hashKey\":\"object:1589\"}],\"$$hashKey\":\"object:668\"}],\"$$hashKey\":\"object:4\"},{\"label\":\"Pages\",\"type\":\"page\",\"name\":\"pages\",\"unique\":true,\"children\":[],\"$$hashKey\":\"object:5\"},{\"label\":\"Signature One\",\"type\":\"cPage\",\"name\":\"signature_one\",\"unique\":false,\"children\":[{\"label\":\"Single Page Content\",\"name\":\"tab1\",\"context\":\"normal\",\"priority\":\"default\",\"fields\":[{\"name\":\"select1\",\"type\":\"select\",\"label\":\"Size\",\"description\":\"Select asize for the signature from the available list of options above\",\"selectType\":\"custom\",\"oArr\":[{\"label\":\"Small (14 px)\",\"value\":\"14\",\"$$hashKey\":\"object:705\"},{\"label\":\"Medium (18px)\",\"value\":\"18\",\"$$hashKey\":\"object:716\"},{\"label\":\"Large (22 px)\",\"value\":\"22\",\"$$hashKey\":\"object:725\"},{\"label\":\"Huge (32 px)\",\"value\":\"32\",\"$$hashKey\":\"object:734\"},{\"label\":\"Giant (46 px)\",\"value\":\"46\",\"$$hashKey\":\"object:845\"}],\"$$hashKey\":\"object:614\"},{\"name\":\"textbox1\",\"type\":\"textbox\",\"label\":\"Signature Text\",\"description\":\"The default signature Text\",\"$$hashKey\":\"object:503\"},{\"name\":\"select2\",\"type\":\"select\",\"label\":\"Signature Position\",\"description\":\"The signature will display on the bottom of each post. What side, you decide.\",\"selectType\":\"custom\",\"oArr\":[{\"label\":\"Center (default)\",\"value\":\"center\",\"$$hashKey\":\"object:585\"},{\"label\":\"Left\",\"value\":\"left\",\"$$hashKey\":\"object:596\"},{\"label\":\"Right\",\"value\":\"right\",\"$$hashKey\":\"object:605\"}],\"$$hashKey\":\"object:491\"},{\"name\":\"upload1\",\"type\":\"upload\",\"label\":\"Signature Image\",\"description\":\"Use an Image as your signature ( WARNING! Uploading an image will not use the text signature. Remove image to use text signature)\",\"tSizes\":[],\"$$hashKey\":\"object:524\"}],\"$$hashKey\":\"object:35\"}],\"capability\":\"manage_options\",\"handler\":\"soHandler\",\"pageTitle\":\"Global Settings\",\"$$hashKey\":\"object:29\",\"pageDescription\":\"The settings that apply to all posts and pages , as defaults. You are able to customize everything\"}]}';
    53 if(class_exists('generalFunctionality')){
    54     $abGeneral = new generalFunctionality();
    55     $abGeneral->loadNew($theJson,$plugin_folder[$plugin_file]);
    56     }
    57    }
     456          }
     457
     458    saveArrayFields('abOption_cPage_signature_one_settings', 'cPage_signature_one_settingshfv#$1!');
     459   
  • signature-one/trunk/readme.txt

    r1450450 r1564977  
    11=== Signature One ===
    2 Contributors: rootabout
     2Contributors: rootabout, turcuciprian
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MU4RJNNF74QKY
    44Tags: Signature, post text
    55Requires at least: 4.0
    66Tested up to: 4.5.2
    7 Stable tag: 1.1.3
     7Stable tag: 1.1.4
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7070Plugin is now dependent on admin builder to function.
    7171
     72= 1.1.4 =
     73Changed contributors to the plugin.
     74
    7275== Arbitrary section ==
    7376
  • signature-one/trunk/signature-one.php

    r1450450 r1564977  
    44  Plugin URI: http://admin-builder.com
    55  Description: Create a signature for each post or page. Text or Image. Customize each post or page with it's own signature or create a global one.
    6   Version: 1.1.3
     6  Version: 1.1.4
    77  Author: rootabout
    88  Author URI: http://admin-builder.com
     
    2525     if (is_single()) {
    2626         //general values
    27          $GlobalSignature = $abGen->getField('abOption_cPage_signature_one', 'tab1', 'textbox1');
    28          $globalPosition = $abGen->getField('abOption_cPage_signature_one', 'tab1', 'select2');
    29          $globalSize = $abGen->getField('abOption_cPage_signature_one', 'tab1', 'select1');
    30          $globalImage = $abGen->getField('abOption_cPage_signature_one', 'tab1', 'upload1');
     27         $GlobalSignature = get_option('abOption_cPagetab1textbox1',false);
     28         $globalPosition = get_option('abOption_cPagetab1select1',false);
     29         $globalSize = get_option('abOption_cPagetab1select2',false);
     30         $globalImage = get_option('abOption_cPagetab1upload1',false);
    3131
    3232         //post specific values:
    33          $postSignature = get_post_meta(get_the_ID(), 'abMB_metabox1textbox1', true);
    34          $postPosition = get_post_meta(get_the_ID(), 'abMB_metabox1select2', true);
    35          $postSize = get_post_meta(get_the_ID(), 'abMB_metabox1select1', true);
    36          $postImage = get_post_meta(get_the_ID(), 'abMB_metabox1upload1', true);
     33         $postSignature = get_post_meta(get_the_ID(),"abMB_postsoSettingstextbox1",true);
     34         $postPosition = get_post_meta(get_the_ID(),"abMB_postsoSettingsselect2",true);
     35         $postSize = get_post_meta(get_the_ID(),"abMB_postsoSettingsselect1",true);
     36         $postImage = get_post_meta(get_the_ID(),"abMB_postsoSettingsupload1",true);
    3737
    3838         $fSignature = $GlobalSignature;
Note: See TracChangeset for help on using the changeset viewer.