Plugin Directory

Changeset 2251591


Ignore:
Timestamp:
02/27/2020 08:19:08 PM (6 years ago)
Author:
sebaxtian
Message:

v0.2.3

Location:
scss-library/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • scss-library/trunk/languages/scsslib-es_ES.po

    r2250232 r2251591  
    55"Project-Id-Version: scsslib\n"
    66"Report-Msgid-Bugs-To: \n"
    7 "POT-Creation-Date: 2020-02-25 17:28-0500\n"
    8 "PO-Revision-Date: 2020-02-25 17:29-0500\n"
     7"POT-Creation-Date: 2020-02-27 11:19-0500\n"
     8"PO-Revision-Date: 2020-02-27 11:19-0500\n"
    99"Last-Translator: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n"
    1010"Language-Team: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n"
     
    1616"X-Poedit-Basepath: .\n"
    1717"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    18 "X-Generator: Poedit 2.2.4\n"
     18"X-Generator: Poedit 2.3\n"
    1919"X-Poedit-SourceCharset: UTF-8\n"
    2020"X-Poedit-SearchPath-0: ..\n"
    2121
    22 #: ../src/ScssLibrary.php:146
     22#: ../src/ScssLibrary.php:153
    2323msgid "Source file not found."
    2424msgstr "Archivo fuente no encontrado."
    2525
    26 #: ../src/ScssLibrary.php:164
     26#: ../src/ScssLibrary.php:171
    2727msgid ""
    2828"File Permissions Error, unable to create cache directory. Please make sure "
     
    3232"Asegúrese de que el directorio <i>uploads</i> de Wordpress sea editable."
    3333
    34 #: ../src/ScssLibrary.php:177
     34#: ../src/ScssLibrary.php:184
    3535msgid ""
    3636"File Permissions Error, permission denied. Please make the cache directory "
     
    4040"permisos del directorio de caché para que sea editable."
    4141
    42 #: ../src/ScssLibrary.php:335
     42#: ../src/ScssLibrary.php:308
     43#, php-format
     44msgid ""
     45"The development mode from the <strong>SCSS-Library</strong> is active. "
     46"Remember to <a href='%s'>deactivate it</a> in case this is a production "
     47"environment."
     48msgstr ""
     49"El modo de desarrollo de <strong>SCSS-Library</strong> está activo. Recuerde "
     50"<a href='%s'>desactivarlo</a> en caso de que este sea un entorno de "
     51"producción."
     52
     53#: ../src/ScssLibrary.php:340
     54msgid "SCSS Library"
     55msgstr "SCSS Library"
     56
     57#: ../src/ScssLibrary.php:355
     58msgid "Recompile SCSS files"
     59msgstr "Recompilar archivos SCSS"
     60
     61#: ../src/ScssLibrary.php:364
     62msgid "Deactivate development mode"
     63msgstr "Desactivar modo de desarrollo"
     64
     65#: ../src/ScssLibrary.php:371
     66msgid "Activate development mode"
     67msgstr "Activar modo de desarrollo"
     68
     69#: ../src/ScssLibrary.php:433
    4370msgid "Sass Compiling Error"
    4471msgstr "Error de compilación Sass"
    4572
    4673#: ../src/Settings/ScssLibrary.php:29
    47 msgid "Scss Compiler"
    48 msgstr "Compilador Scss"
     74msgid "SCSS Compiler"
     75msgstr "Compilador SCSS"
    4976
    5077#: ../src/Settings/ScssLibrary.php:44
  • scss-library/trunk/languages/scsslib.pot

    r2250232 r2251591  
    66"Project-Id-Version: scsslib\n"
    77"Report-Msgid-Bugs-To: \n"
    8 "POT-Creation-Date: 2020-02-25 17:28-0500\n"
     8"POT-Creation-Date: 2020-02-27 11:19-0500\n"
    99"PO-Revision-Date: 2014-10-09 21:36-0500\n"
    1010"Last-Translator: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n"
     
    1717"X-Poedit-Basepath: .\n"
    1818"Plural-Forms: nplurals=2; plural=n != 1;\n"
    19 "X-Generator: Poedit 2.2.4\n"
     19"X-Generator: Poedit 2.3\n"
    2020"X-Poedit-SourceCharset: UTF-8\n"
    2121"X-Poedit-SearchPath-0: ..\n"
    2222
    23 #: ../src/ScssLibrary.php:146
     23#: ../src/ScssLibrary.php:153
    2424msgid "Source file not found."
    2525msgstr ""
    2626
    27 #: ../src/ScssLibrary.php:164
     27#: ../src/ScssLibrary.php:171
    2828msgid "File Permissions Error, unable to create cache directory. Please make sure the Wordpress Uploads directory is writable."
    2929msgstr ""
    3030
    31 #: ../src/ScssLibrary.php:177
     31#: ../src/ScssLibrary.php:184
    3232msgid "File Permissions Error, permission denied. Please make the cache directory writable."
    3333msgstr ""
    3434
    35 #: ../src/ScssLibrary.php:335
     35#: ../src/ScssLibrary.php:308
     36#, php-format
     37msgid "The development mode from the <strong>SCSS-Library</strong> is active. Remember to <a href='%s'>deactivate it</a> in case this is a production environment."
     38msgstr ""
     39
     40#: ../src/ScssLibrary.php:340
     41msgid "SCSS Library"
     42msgstr ""
     43
     44#: ../src/ScssLibrary.php:355
     45msgid "Recompile SCSS files"
     46msgstr ""
     47
     48#: ../src/ScssLibrary.php:364
     49msgid "Deactivate development mode"
     50msgstr ""
     51
     52#: ../src/ScssLibrary.php:371
     53msgid "Activate development mode"
     54msgstr ""
     55
     56#: ../src/ScssLibrary.php:433
    3657msgid "Sass Compiling Error"
    3758msgstr ""
    3859
    3960#: ../src/Settings/ScssLibrary.php:29
    40 msgid "Scss Compiler"
     61msgid "SCSS Compiler"
    4162msgstr ""
    4263
  • scss-library/trunk/scss-library.php

    r2250262 r2251591  
    44Description: Adds support for SCSS stylesheets to wp_enqueue_style.
    55Author: Juan Sebastián Echeverry
    6 Version: 0.2.0
     6Version: 0.2.3
    77Text Domain: scsslib
    88
  • scss-library/trunk/src/ScssLibrary.php

    r2250232 r2251591  
    5454        add_filter('style_loader_src', [$this, 'style_loader_src'], 10, 2);
    5555        add_action('wp_footer', array($this, 'wp_footer'));
     56        add_action('admin_notices', [$this, 'admin_notices']);
     57        add_action('admin_bar_menu', [$this, 'admin_bar_menu'], 100);
    5658
    5759        $this->modo_desarrollo = false;
     
    100102        }
    101103
    102         // ¿Ya sabesmos que estamos en modo de desarrollo?
     104        // ¿Ya sabemos si estamos en modo de desarrollo?
    103105        if(!$this->modo_desarrollo) {
    104106            // Determinar si hubo un cambio
    105107            $opciones = get_option('scsslibrary');
     108
     109            // El modo de desarrollo se presenta porque este la opción develop activa
     110            // en las opciones del plugin, porque esté definido WP_DEBUG o porque ne la url esté el atributo recompile_scss_files
    106111            $this->modo_desarrollo = (
    107112                (isset($opciones['develop']) && $opciones['develop']) ||
    108                 (defined('WP_DEBUG') && WP_DEBUG === true)
     113                (defined('WP_DEBUG') && WP_DEBUG === true) ||
     114                (isset($_GET['recompile_scss_files'])) ||
     115                (isset($_GET['activate_scss_library_devmode']))
    109116            ) ? true : false;
    110117        }
     
    276283        // venían en la URL del archivo fuente.
    277284        return empty($url['query']) ? $outputUrl : $outputUrl . '?' . $url['query'];
     285    }
     286
     287    /**
     288     * Los mensajes para ser desplegados en la parte duperior del dashboard.
     289     * De momento muestra una advertencia si estamos en modo de desarrollador
     290     */
     291    public function admin_notices() :void {
     292        // Leer de la sopciones si estamos en modo develop
     293        $opciones = get_option('scsslibrary');
     294
     295        //Si hay un parámetro por get para desactivar el modo de desarrollo, desactivarlo
     296        if(isset($_GET['deactivate_scss_library_development_mode'])) {
     297            $opciones['develop'] = false;
     298            update_option('scsslibrary', $opciones);
     299        }
     300
     301        if(isset($opciones['develop']) && $opciones['develop'] === true) {
     302            $url = parse_url($_SERVER['REQUEST_URI']);
     303            parse_str($url['query'], $query);
     304            $query['deactivate_scss_library_development_mode'] = true;
     305            $url['query'] = http_build_query($query);
     306            $url = $url['path'] . '?' . $url['query'];
     307
     308            $text = sprintf(__("The development mode from the <strong>SCSS-Library</strong> is active. Remember to <a href='%s'>deactivate it</a> in case this is a production environment.", 'scsslib'), $url);
     309            printf('<div class="error"><p>%s</p></div>', $text);
     310        }
     311    }
     312
     313    /**
     314     * Abregar items a la barra de administración para manejar scss-library
     315     * @param  Object $admin_bar Barra de administración
     316     */
     317    public function admin_bar_menu($admin_bar): void {
     318        // Solo los usuarios con permisos para editar temas pueden tener
     319        // acceso a estas acciones
     320        if(current_user_can('edit_theme_options')) {
     321
     322            // Items para habilitar o deshabilitar
     323            $opciones = get_option('scsslibrary');
     324
     325            // ¿Activar el modo de desarrollo?
     326            if(isset( $_GET['activate_scss_library_devmode'] )) {
     327                $opciones['develop'] = true;
     328                update_option('scsslibrary', $opciones);
     329            }
     330
     331            // ¿Desactivar el modo de desarrollo?
     332            if(isset( $_GET['deactivate_scss_library_devmode'] )) {
     333                $opciones['develop'] = false;
     334                update_option('scsslibrary', $opciones);
     335            }
     336
     337            // Item contenedor principal
     338            $admin_bar->add_menu( array(
     339                    'id'    => 'scss-library',
     340                    'title' => __('SCSS Library', 'scsslib'),
     341                    'href'  => '#',
     342                    'meta' => array(
     343                        'class' => $opciones['develop'] ? 'sl-alert' : '',
     344                        'html' => "<style>
     345                        #wpadminbar .menupop.sl-alert > a.ab-item { color: white; background: #9c3e3d; }
     346                        </style>"
     347                    )
     348            ));
     349
     350            // Elementos para la URL
     351            $url = parse_url($_SERVER['REQUEST_URI']);
     352            parse_str($url['query'], $query);
     353            $query1['recompile_scss_files'] = true;
     354            $query2['deactivate_scss_library_devmode'] = true;
     355            $query3['activate_scss_library_devmode'] = true;
     356
     357            // Sub item para recompilar
     358            $admin_bar->add_menu( array(
     359            'id'    => 'clear-scss',
     360            'parent' => 'scss-library',
     361            'title' => __('Recompile SCSS files', 'scsslib'),
     362            'href'  => $url['path'] . '?' . http_build_query($query1),
     363        ));
     364
     365            // Si no está activo el develop
     366            if (isset($opciones['develop']) && $opciones['develop'] ) {
     367                $admin_bar->add_menu( array(
     368                'id'    => 'deactivate-scss-devmode',
     369                'parent' => 'scss-library',
     370                'title' => __('Deactivate development mode', 'scsslib'),
     371                'href'  => $url['path'] . '?' . http_build_query($query2),
     372                        'meta' => array(
     373                            'class' => 'sl-active',
     374                            'html' => "<style>
     375                            #wpadminbar .ab-submenu .sl-active > a.ab-item { color: white; background: #9c3e3d; }
     376                            </style>"
     377                        )
     378            ));
     379            } else {
     380                $admin_bar->add_menu( array(
     381                'id'    => 'activate-scss-devmode',
     382                'parent' => 'scss-library',
     383                'title' => __('Activate development mode', 'scsslib'),
     384                'href'  => $url['path'] . '?' . http_build_query($query3)
     385            ));
     386            }
     387        }
    278388    }
    279389
  • scss-library/trunk/src/Settings/ScssLibrary.php

    r2250253 r2251591  
    2727            'scsslibrary',
    2828            array(
    29                 'title' => __('Scss Compiler', 'scsslib'),
     29                'title' => __('SCSS Compiler', 'scsslib'),
    3030            )
    3131        );
  • scss-library/trunk/vendor/autoload.php

    r2250246 r2251591  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitff69a621beb925ab247ba89a2b55463b::getLoader();
     7return ComposerAutoloaderInit96136f5df1573d3a05c847bf369c6432::getLoader();
Note: See TracChangeset for help on using the changeset viewer.