Plugin Directory

Changeset 1846895


Ignore:
Timestamp:
03/26/2018 11:10:53 AM (8 years ago)
Author:
broobe_dev
Message:

version 2.8

Location:
social-articles/trunk
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • social-articles/trunk/assets/css/social-articles.css

    r1833370 r1846895  
    685685    position: absolute;
    686686    top: 0;
    687     margin-top: 100px;
     687   /* margin-top: 100px;*/
    688688    background: #fff;
    689689    z-index: 10;
  • social-articles/trunk/includes/admin/assets/css/sa-admin-settings.css

    r1833370 r1846895  
    632632    float:right;
    633633}
     634
     635#content-limit-switch .onoffswitch-inner:after {
     636    content: attr(data-no);
     637    padding-right: 10px;
     638    background-color: #00B5D1 !important;
     639    color: #FFFFFF !important;
     640    text-align: right;
     641}
     642
     643
     644.sa-troubleshooting-button:before{
     645    background: 0 0;
     646    color: #fff;
     647    content: "\f463";
     648    display: block;
     649    font: 400 16px/20px dashicons;
     650    speak: none;
     651    height: 29px;
     652    text-align: center;
     653    width: 16px;
     654    float: left;
     655    margin-top: 3px;
     656    margin-right: 4px;
     657}
  • social-articles/trunk/includes/admin/social-articles-options.php

    r1833370 r1846895  
    6060                        <a class="nav-tab" id="view-tab" href="#top#view"><?php _e( 'View', 'social-articles' );?></a>
    6161                        <a class="nav-tab" id="form-tab" href="#top#form"><?php _e( 'Form', 'social-articles' );?></a>
     62                        <a class="nav-tab" id="troubleshooting-tab" href="#top#troubleshooting"><?php _e( 'Troubleshooting', 'social-articles' );?></a>
    6263                        <a class="nav-tab" id="addons-tab" href="#top#addons"><?php _e( 'Add-ons', 'social-articles' );?></a>
    6364                        <span id="changes-detected-message"><span class="dashicons dashicons-warning" style="color: #ff4b4b;"></span><?php _e( 'There are unsaved changes', 'social-articles');?>
     
    7374                        <div id="form" class="sa-tab">
    7475                            <?php include(SA_BASE_PATH.'/includes/admin/tabs/social-articles-form-settings.php'); ?>
     76                        </div>
     77                        <div id="troubleshooting" class="sa-tab">
     78                            <?php include(SA_BASE_PATH.'/includes/admin/tabs/social-articles-troubleshooting.php'); ?>
    7579                        </div>
    7680                        <div id="addons" class="sa-tab">
     
    118122
    119123    <?php
    120 }
     124}
     125
     126
    121127?>
  • social-articles/trunk/includes/admin/social-articles-tools.php

    r1748129 r1846895  
    3232            foreach ($options as $val => $name) {
    3333                $checked = false;
    34                 foreach ( $opt[$id] as $index => $option ) {
    35                     if ($option == $val)
    36                         $checked = true;
     34                if(is_array($opt) && array_key_exists($id, $opt)&& is_array($opt[$id])) {
     35                    foreach ($opt[$id] as $index => $option) {
     36                        if ($option == $val)
     37                            $checked = true;
     38                    }
    3739                }
    3840                if ($name == '')
  • social-articles/trunk/includes/sa-form/fields/commons/uploader.php

    r1701311 r1846895  
    171171
    172172        if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){
     173            $this->image_fix_orientation($uploadDirectory . $filename . '.' . $ext);
    173174            return array('success'=>true);
    174175        } else {
    175176            return array('error'=>  __('Could not save uploaded file. The upload was cancelled, or server error encountered', "social-articles"));
    176177        }
    177 
    178     }
     178    }
     179
     180    private function image_fix_orientation($filename) {
     181        if(function_exists('exif_read_data') && function_exists('imagecreatefromjpeg')){
     182            $exif = exif_read_data($filename);
     183            if (!empty($exif['Orientation'])) {
     184                $image = imagecreatefromjpeg($filename);
     185                switch ($exif['Orientation']) {
     186                    case 3:
     187                        $image = imagerotate($image, 180, 0);
     188                        break;
     189                    case 6:
     190                        $image = imagerotate($image, -90, 0);
     191                        break;
     192                    case 8:
     193                        $image = imagerotate($image, 90, 0);
     194                        break;
     195                }
     196                imagejpeg($image, $filename, 90);
     197            }
     198        }
     199    }
     200
    179201}
  • social-articles/trunk/includes/sa-form/sa-form-settings-class.php

    r1701311 r1846895  
    6060            $this->available_fields = $this->all_fields;
    6161
    62             foreach ($this->selected_fields as $key=>$field_config){
    63                 $original_field = $this->all_fields[$key];
    64                 if(is_object($original_field)) {
    65                     $original_config =  $original_field->get_config();
    66                     if(is_array($original_config)){
    67                         $original_field_config = $original_config['field_config'];
    68                     }else{
    69                         $original_field_config = get_object_vars($field_config);
     62            foreach ($this->selected_fields as $key=>$field_config) {
     63
     64                if (array_key_exists($key, $this->all_fields)) {
     65                    $original_field = $this->all_fields[$key];
     66                    if (is_object($original_field)) {
     67                        $original_config = $original_field->get_config();
     68                        if (is_array($original_config)) {
     69                            $original_field_config = $original_config['field_config'];
     70                        } else {
     71                            $original_field_config = get_object_vars($field_config);
     72                        }
     73
     74                        if (empty($field_config)) {
     75                            $field_config = $original_field_config;
     76                        }
     77
     78                        $original_field->set_field_config(array_merge($original_field_config, get_object_vars($field_config)));
     79                        $this->selected_fields[$key] = $original_field;
     80                        unset($this->available_fields[$key]);
     81                    } else {
     82                        unset($this->selected_fields[$key]);
    7083                    }
    71 
    72                     if(empty($field_config)){
    73                         $field_config = $original_field_config;
    74                     }
    75 /*
    76                     var_dump($original_field_config);
    77                     echo "<br>";social
    78                     var_dump(get_object_vars($field_config));
    79                     echo "<br>";
    80                     echo "<br>";*/
    81 
    82                     //$original_field_config = $original_field->get_config()['field_config'];
    83                     $original_field->set_field_config(array_merge($original_field_config, get_object_vars($field_config)));
    84                     $this->selected_fields[$key] = $original_field;
    85                     unset($this->available_fields[$key]);
    86                 }else{
     84               }else{
    8785                    unset($this->selected_fields[$key]);
    88                 }
     86               }
    8987            }
    9088        }
  • social-articles/trunk/includes/sa-form/sa-helper-class.php

    r1701311 r1846895  
    6363        $taxonomies = get_object_taxonomies( $post_type, 'objects' );
    6464
    65         $field_tax_hierarchical_class = $registered_fields[SA_Helper::TAX_HIERARCHICAL_FIELD];
    66         if(class_exists($field_tax_hierarchical_class)) {
    67             if(!empty($taxonomies['category']))
    68                 $all_fields['category'] = new $field_tax_hierarchical_class($taxonomies['category']->name, $taxonomies['category']->labels->name);
    69         }
    70    
    71         $field_tax_normal_class = $registered_fields[SA_Helper::TAX_REGULAR_FIELD];
    72         if(class_exists($field_tax_normal_class)) {
    73             if(!empty($taxonomies['post_tag']))
    74                 $all_fields['post_tag'] = new $field_tax_normal_class($taxonomies['post_tag']->name, $taxonomies['post_tag']->labels->name);
     65        if(array_key_exists(SA_Helper::TAX_HIERARCHICAL_FIELD, $registered_fields )) {
     66            $field_tax_hierarchical_class = $registered_fields[SA_Helper::TAX_HIERARCHICAL_FIELD];
     67            if (class_exists($field_tax_hierarchical_class)) {
     68                if (!empty($taxonomies['category']))
     69                    $all_fields['category'] = new $field_tax_hierarchical_class($taxonomies['category']->name, $taxonomies['category']->labels->name);
     70            }
    7571        }
    7672
    77         //Generate Content Instance.
    78         $field_content_class = $registered_fields[SA_Helper::CONTENT_FIELD];
    79         if(class_exists($field_content_class)) {
    80             $all_fields[SA_Helper::CONTENT_FIELD] = new $field_content_class(SA_Helper::CONTENT_FIELD, __("Content", "social-articles"));
     73        if(array_key_exists(SA_Helper::TAX_REGULAR_FIELD, $registered_fields )) {
     74            $field_tax_normal_class = $registered_fields[SA_Helper::TAX_REGULAR_FIELD];
     75            if (class_exists($field_tax_normal_class)) {
     76                if (!empty($taxonomies['post_tag']))
     77                    $all_fields['post_tag'] = new $field_tax_normal_class($taxonomies['post_tag']->name, $taxonomies['post_tag']->labels->name);
     78            }
    8179        }
    82 
    83         //FEATURED_IMAGE_FIELD
    84         $field_image_class = $registered_fields[SA_Helper::FEATURED_IMAGE_FIELD];
    85         if(class_exists($field_image_class)) {
    86             $all_fields[SA_Helper::FEATURED_IMAGE_FIELD] = new $field_image_class(SA_Helper::FEATURED_IMAGE_FIELD, __("Featured image", "social-articles"));
     80        if(array_key_exists(SA_Helper::CONTENT_FIELD ,$registered_fields)) {
     81            //Generate Content Instance.
     82            $field_content_class = $registered_fields[SA_Helper::CONTENT_FIELD];
     83            if (class_exists($field_content_class)) {
     84                $all_fields[SA_Helper::CONTENT_FIELD] = new $field_content_class(SA_Helper::CONTENT_FIELD, __("Content", "social-articles"));
     85            }
     86        }
     87        if(array_key_exists(SA_Helper::FEATURED_IMAGE_FIELD ,$registered_fields)) {
     88            //FEATURED_IMAGE_FIELD
     89            $field_image_class = $registered_fields[SA_Helper::FEATURED_IMAGE_FIELD];
     90            if (class_exists($field_image_class)) {
     91                $all_fields[SA_Helper::FEATURED_IMAGE_FIELD] = new $field_image_class(SA_Helper::FEATURED_IMAGE_FIELD, __("Featured image", "social-articles"));
     92            }
    8793        }
    8894
  • social-articles/trunk/includes/social-articles-functions.php

    r1833370 r1846895  
    263263}
    264264
    265 
     265add_action('wp_ajax_reset_sa_options', 'reset_sa_options' );
     266function reset_sa_options(){
     267    delete_option('social_articles_options');
     268    delete_option('sa_registered_fields');
     269    delete_option('sa_selected_fields');
     270    $options = array();
     271    $options = set_default_options($options);
     272    update_option('social_articles_options',$options);
     273
     274    echo "ok";
     275    die();
     276}
    266277
    267278add_action( 'admin_notices', 'bp_social_articles_addons_notice');
  • social-articles/trunk/readme.txt

    r1833370 r1846895  
    66Tested up to: 4.9.4
    77Requires PHP: 5.6
    8 Stable tag: 2.7
     8Stable tag: 2.8
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7575
    7676== Changelog ==
     77
     78= 2.8 =
     79* New option to reset social articles options - Troubleshooting
     80* Bug Fixing: Image rotation fix when photos are uploaded with iphone
     81* Bug Fixing: Clean some debug errors and notices
    7782
    7883= 2.7 =
  • social-articles/trunk/social-articles.php

    r1833370 r1846895  
    33 Plugin Name: Social Articles
    44 Description: This is the first BuddyPress plugin that let you to create and manage posts from your profile. It supports all buddypres themes, so you don't need to be an expert to use it!
    5  Version: 2.7
     5 Version: 2.8
    66 Author: Broobe
    77 Author URI: http://www.broobe.com
     
    7878            spl_autoload_register('sa_fields_autoload');
    7979
    80             define('SA_PLUGIN_VERSION', '2.7');
     80            define('SA_PLUGIN_VERSION', '2.8');
    8181            define('SA_PLUGIN_DIR', dirname(__FILE__));
    8282            define('SA_SLUG', 'articles');
     
    111111            $options = get_option('social_articles_options');
    112112
    113             if (!isset($options['post_per_page']))
    114                 $options['post_per_page'] = '10';
    115 
    116             if (!isset($options['excerpt_length']))
    117                 $options['excerpt_length'] = '30';
    118 
    119             if (!isset($options['excerpt_length']))
    120                 $options['category_type'] = 'single';
    121 
    122             if (!isset($options['workflow']))
    123                 $options['workflow'] = 'approval';
    124 
    125             if (!isset($options['bp_notifications']))
    126                 $options['bp_notifications'] = 'true';
    127 
    128             if (!isset($options['allow_author_adition']))
    129                 $options['allow_author_adition'] = 'true';
    130 
    131             if (!isset($options['allow_author_deletion']))
    132                 $options['allow_author_deletion'] = 'true';
    133 
    134             if (!isset($options['published_post_counter']))
    135                 $options['published_post_counter'] = 'true';
    136 
    137             if (!isset($options['show_to_logged_out_users']))
    138                 $options['show_to_logged_out_users'] = 'true';
     113            $options = set_default_options($options);
    139114
    140115
     
    248223}
    249224
     225function set_default_options($options){
     226    if (!isset($options['post_per_page']))
     227        $options['post_per_page'] = '10';
     228
     229    if (!isset($options['excerpt_length']))
     230        $options['excerpt_length'] = '30';
     231
     232    if (!isset($options['excerpt_length']))
     233        $options['category_type'] = 'single';
     234
     235    if (!isset($options['workflow']))
     236        $options['workflow'] = 'approval';
     237
     238    if (!isset($options['bp_notifications']))
     239        $options['bp_notifications'] = 'false';
     240
     241    if (!isset($options['allow_author_adition']))
     242        $options['allow_author_adition'] = 'true';
     243
     244    if (!isset($options['allow_author_deletion']))
     245        $options['allow_author_deletion'] = 'true';
     246
     247    if (!isset($options['published_post_counter']))
     248        $options['published_post_counter'] = 'true';
     249
     250    if (!isset($options['show_to_logged_out_users']))
     251        $options['show_to_logged_out_users'] = 'true';
     252
     253    return $options;
     254}
     255
    250256function social_articles(){
    251257    global $socialArticles;
Note: See TracChangeset for help on using the changeset viewer.