Plugin Directory

Changeset 515734


Ignore:
Timestamp:
03/07/2012 08:02:01 AM (14 years ago)
Author:
brainstormmedia
Message:

Update to 0.5.0. See changelog.

Location:
styles/trunk
Files:
11 added
15 edited

Legend:

Unmodified
Added
Removed
  • styles/trunk

    • Property svn:ignore set to
      deploy.sh
      README.md
      .git
      .gitignore
  • styles/trunk/classes/scaffold-bare/NestedSelectors.php

    r508741 r515734  
    1313class Scaffold_Extension_NestedSelectors extends Scaffold_Extension
    1414{   
     15    /**
     16     * Styles plugin version of $this->post_process
     17     **/
     18    public function styles_before_process( $styles ) {
     19        $filename = empty($styles->file_paths['path']) ? $styles->file_paths['uri'] : $styles->file_paths['path'];
     20        $xml = $this->to_xml($styles->css->contents, $filename );
     21        $styles->css->contents = html_entity_decode($this->_parse_children($xml->children()));
     22    }
     23   
    1524    /**
    1625     * @access public
  • styles/trunk/classes/scaffold-bare/Properties.php

    r508741 r515734  
    4242   
    4343    /**
     44     * Styles plugin version of post_process
     45     *
     46     * @access public
     47     * @param $source
     48     * @return string
     49     */
     50    public function styles_before_process( $styles )
     51    {
     52        // Go through each custom function
     53        foreach($this->properties as $name => $property)
     54        {
     55            $obj    = $property[0];
     56            $method = $property[1];
     57
     58            // Find them in the CSS
     59            foreach($styles->css->helper->find_properties($name,$styles->css->contents) as $found)
     60            {
     61                // Call the hook method for this function
     62                $result = call_user_func_array(array($obj,$method),array($found['value'], $styles->css, $found ));
     63               
     64                // Replace it in the CSS
     65                $styles->css->contents = str_replace($found['property'],$result,$styles->css->contents);
     66            }
     67        }
     68    }
     69   
     70    /**
    4471     * @access public
    4572     * @param $source
  • styles/trunk/css/admin.css

    r508741 r515734  
    1 .StormStyles {
    2   /* Gradient Picker */
    3   /* Background Picker */
    4   /* Image Picker */
    5   /* Color Picker */
    6   /* Font Picker */
    7   /* Slider */
    8   /* General */
    9   /* Yoast */
    10   /* END Yoast */ }
    11   .StormStyles .gradPicker {
    12     width: 327px;
    13     position: relative; }
    14     .StormStyles .gradPicker .presets {
    15       width: 500px;
    16       display: block;
    17       height: 32px;
    18       margin-bottom: 6px; }
    19       .StormStyles .gradPicker .presets li {
    20         display: block;
    21         width: 30px;
    22         height: 30px;
    23         float: left;
    24         margin: 0 1px 1px 0;
    25         border: 1px solid #ccc; }
    26   .StormStyles .stop-markers {
    27     position: relative;
    28     height: 30px; }
    29     .StormStyles .stop-markers .ui-slider {
    30       position: absolute;
    31       top: 10px;
    32       left: 0;
    33       height: 0px;
    34       border: none;
    35       background-image: url(); }
    36       .StormStyles .stop-markers .ui-slider a {
    37         background-image: url();
    38         border: 1px solid #999;
    39         border-radius: 0 0 2px 2px;
    40         width: 11px;
    41         height: 11px;
    42         margin-left: -0.39em;
    43         text-indent: -9999px; }
    44       .StormStyles .stop-markers .ui-slider a:before {
    45         /* Black arrow */
    46         content: "<div/>";
    47         width: 0;
    48         height: 0;
    49         position: absolute;
    50         top: -7px;
    51         left: 0px;
    52         border-left: 6px solid transparent;
    53         border-right: 6px solid transparent;
    54         border-bottom: 6px solid #999; }
    55       .StormStyles .stop-markers .ui-slider a:after {
    56         /* White arrow */
    57         content: "<div/>";
    58         width: 0;
    59         height: 0;
    60         position: absolute;
    61         top: -5px;
    62         left: 2px;
    63         border-left: 4px solid transparent;
    64         border-right: 4px solid transparent;
    65         border-bottom: 4px solid #fff; }
    66   .StormStyles .grad-preview {
    67     height: 30px;
    68     display: block;
    69     border: 1px solid #ccc; }
    70   .StormStyles .stop-markers, .StormStyles .grad-preview, .StormStyles .stop-markers .ui-slider {
    71     width: 100%; }
    72   .StormStyles .stop-markers {
    73     cursor: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ1JREFUeNq8VAEKwCAITOn%2FX3ZzTBCxUicTBsvsOO9EIKJhAwCe5H0H4xBvLQgOegV8yZ8AZwJHc8zKI4c53bk6IGNqMH3GCJuMlkeG4p4G1e5Lq1KXatmCM7AdrbLLq7FC0agycx7oXOmk8%2FY%2FPNjRR7s6ZFHFqY5AcasLFDPtpAC7WH7aNkxgO9gdLNv3oWdKiKXX7r8bu6rlJcAA9ZRfMt5oHoIAAAAASUVORK5CYII%3D") 5 0, pointer; }
    74   .StormStyles .macos .stop-markers {
    75     cursor: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy%2BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAelJREFUeNqMVDuPAVEYvbNEtYlniMRGiKg2NAoS2caj8Af8AL0foVdJVAqNBA2VxFYahQrR2ERCsokQCrG7xGu%2F%2Fe63TBgzEyc5zsx9nHvvd%2BZ6AgAmpdFoBMb4430f5xWcyI%2Bz%2FkM6OB6PwwVKplcwIX%2FOStAyCfr9PnsAfEdPyBfkF%2FIV%2BYn8vTPUaDSPGL4jn%2FlwpAVZRZ6Q33LHuTmyVqsldTqdEIvFzs20QxfyDTk7q4vapYY%2Bn080DAaD0Gw26TkQCIiLhMNhUKohmUQiETEAQRBo4ul0glwuJ5qn02nSUChEajabQTZlvhpHt9slU7fbDY9A8Qvw%2B%2F0wHo%2BlAwmdToe01WrB8XiEdrtN75PJRNmwWCyC1%2BuF9XpNg3e7HelyuQSTyUTtHo%2BH2iwWC%2BlgMFA25D%2BVSgUSicTNkWazGdXpcDjQ5Ol0Cna7nfqy2ay6IafNZqM6XrBYLOASkMPhgNVqBQaDQSxLrVZTNyyVSqDX66HX64mm%2BXyeNJVKkWYyGeAlUr3n1y%2FVahWsVisMh0PVdOv1uqKhILnsFFK5XGaFQoHpdDo2n8%2FZfr9no9GIYSgsGo3yiYLipZRbhdeTd8mRB6i0O9kdcjQaDdhut2yz2TC8y0RMnGFQLJlMCmr%2FGn8CDADjZb9gHU6eaQAAAABJRU5ErkJggg%3D%3D") 5 0, pointer; }
    76   .StormStyles .bgPicker .data {
    77     display: none; }
    78     .StormStyles .bgPicker .data label {
    79       display: block; }
    80   .StormStyles .bgPicker .types a {
    81     background: url(/wp-content/plugins/styles/css/bg-sprites.png) no-repeat 3px 4px;
    82     text-indent: -9999px;
    83     overflow: hidden;
    84     display: inline-block;
    85     width: 16px;
    86     height: 12px;
    87     padding: 3px;
    88     -moz-border-radius: 3px;
    89     -khtml-border-radius: 3px;
    90     -webkit-border-radius: 3px;
    91     border-radius: 3px; }
    92     .StormStyles .bgPicker .types a.active, .StormStyles .bgPicker .types a:hover {
    93       background-color: #C1E7FF; }
    94   .StormStyles .bgPicker .types a[data-type="gradient"] {
    95     background-position: -47px 4px; }
    96   .StormStyles .bgPicker .types a[data-type="color"] {
    97     background-position: -97px 4px; }
    98   .StormStyles .bgPicker .types a[data-type="transparent"] {
    99     background-position: -147px 4px; }
    100   .StormStyles .bgPicker .types a[data-type="hide"] {
    101     background-position: -197px 4px; }
    102   .StormStyles .pds_image .current {
    103     margin-bottom: 5px; }
    104     .StormStyles .pds_image .current img {
    105       height: 80px; }
    106   .StormStyles .pds_image .pds_image_input {
    107     width: 60%; }
    108   .StormStyles .imagePreview {
    109     max-height: 80px;
    110     display: block;
    111     margin: 10px; }
    112   .StormStyles .colorPicker {
    113     width: 20px;
    114     height: 20px;
    115     border: 4px solid #ccc;
    116     border-radius: 4px; }
    117   .StormStyles .pds_color input {
    118     width: 50px;
    119     font-size: 9px;
    120     text-transform: uppercase; }
    121   .StormStyles .colorpicker {
    122     z-index: 999; }
    123   .StormStyles .ui table.jPicker {
    124     background: transparent;
    125     border: 0px none transparent; }
    126   .StormStyles .pds_color_input {
    127     /* font color input field */
    128     width: 25px; }
    129   .StormStyles .pds_font_select option {
    130     text-indent: 10px; }
    131   .StormStyles .pds_font_select option.label {
    132     font-family: Helvetica, Arial, sans-serif;
    133     font-size: 11px;
    134     color: #666;
    135     font-style: normal;
    136     font-weight: normal;
    137     text-indent: 0;
    138     margin-top: 10px; }
    139   .StormStyles .pds_font_select option.first {
    140     margin-top: 0; }
    141   .StormStyles .value-toggle {
    142     background: transparent url(/wp-content/plugins/styles/css/font-sprites.png) no-repeat 6px 6px;
    143     width: 9px;
    144     height: 12px;
    145     padding: 6px;
    146     text-indent: -9999px;
    147     overflow: hidden;
    148     display: inline-block;
    149     -moz-border-radius: 3px;
    150     -khtml-border-radius: 3px;
    151     -webkit-border-radius: 3px;
    152     border-radius: 3px;
    153     position: relative;
    154     top: 9px; }
    155   .StormStyles .font-weight {
    156     width: 9px;
    157     height: 12px; }
    158   .StormStyles .font-style {
    159     background-position: -13px 6px; }
    160   .StormStyles .font-weight-bold,
    161   .StormStyles .font-style-italic {
    162     background-color: #C1E7FF; }
    163   .StormStyles .text-transform {
    164     background-position: -57px 6px; }
    165     .StormStyles .text-transform:hover {
    166       background-color: #C1E7FF; }
    167   .StormStyles .text-transform-uppercase {
    168     background-position: -77px 6px; }
    169   .StormStyles .text-transform-lowercase {
    170     background-position: -96px 6px; }
    171   .StormStyles .line-height {
    172     background-position: -114px 6px; }
    173   .StormStyles .line-height:hover {
    174     background-color: #C1E7FF; }
    175   .StormStyles .line-height-125 {
    176     background-position: -134px 6px; }
    177   .StormStyles .line-height-15 {
    178     background-position: -154px 6px; }
    179   .StormStyles .line-height-175 {
    180     background-position: -174px 6px; }
    181   .StormStyles .line-height-2 {
    182     background-position: -194px 6px; }
    183   .StormStyles .pds_slider_ui {
    184     width: 200px;
    185     display: none; }
    186   .StormStyles .notice {
    187     background-color: #ffebe8;
    188     border-color: #c00;
    189     border-width: 1px;
    190     border-style: solid;
    191     padding: 0 0.6em;
    192     margin: 5px 15px 2px;
    193     -moz-border-radius: 3px;
    194     -khtml-border-radius: 3px;
    195     -webkit-border-radius: 3px;
    196     border-radius: 3px;
    197     margin: 5px 0 15px; }
    198     .StormStyles .notice a {
    199       color: #c00; }
    200     .StormStyles .notice p {
    201       margin: 0.5em 0;
    202       line-height: 1;
    203       padding: 2px; }
    204   .StormStyles img.waiting {
    205     display: none; }
    206   .StormStyles small {
    207     font-weight: normal;
    208     color: #777; }
    209   .StormStyles .inside ul {
    210     margin-left: 20px; }
    211     .StormStyles .inside ul li {
    212       list-style: square;
    213       line-height: 16px; }
    214       .StormStyles .inside ul li.rss {
    215         list-style-image: url(/wp-includes/images/rss.png); }
    216       .StormStyles .inside ul li.email {
    217         list-style-image: url(http://cdn.yoast.com/email_sub.png); }
    218   .StormStyles .inside .text {
    219     width: 250px; }
     1.styles-admin { /* Gradient Picker */ /* Background Picker */ /* Image Picker */ /* Color Picker */ /* Font Picker */ /* Slider */ /* General */ /* Yoast */ /* END Yoast */ }
     2.styles-admin .primary { width: 70%; }
     3.styles-admin .secondary { width: 20%; }
     4.styles-admin .gradPicker { width: 327px; position: relative; }
     5.styles-admin .gradPicker .presets { width: 500px; display: block; height: 32px; margin-bottom: 6px; }
     6.styles-admin .gradPicker .presets li { display: block; width: 30px; height: 30px; float: left; margin: 0 1px 1px 0; border: 1px solid #ccc; }
     7.styles-admin .stop-markers { position: relative; height: 30px; }
     8.styles-admin .stop-markers .ui-slider { position: absolute; top: 10px; left: 0; height: 0px; border: none; background-image: url(); }
     9.styles-admin .stop-markers .ui-slider a { background-image: url(); border: 1px solid #999; border-radius: 0 0 2px 2px; width: 11px; height: 11px; margin-left: -0.39em; text-indent: -9999px; }
     10.styles-admin .stop-markers .ui-slider a:before { /* Black arrow */ content: "<div/>"; width: 0; height: 0; position: absolute; top: -7px; left: 0px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid #999; }
     11.styles-admin .stop-markers .ui-slider a:after { /* White arrow */ content: "<div/>"; width: 0; height: 0; position: absolute; top: -5px; left: 2px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 4px solid #fff; }
     12.styles-admin .grad-preview { height: 30px; display: block; border: 1px solid #ccc; }
     13.styles-admin .stop-markers, .styles-admin .grad-preview, .styles-admin .stop-markers .ui-slider { width: 100%; }
     14.styles-admin .stop-markers { cursor: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAWCAYAAADAQbwGAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ1JREFUeNq8VAEKwCAITOn%2FX3ZzTBCxUicTBsvsOO9EIKJhAwCe5H0H4xBvLQgOegV8yZ8AZwJHc8zKI4c53bk6IGNqMH3GCJuMlkeG4p4G1e5Lq1KXatmCM7AdrbLLq7FC0agycx7oXOmk8%2FY%2FPNjRR7s6ZFHFqY5AcasLFDPtpAC7WH7aNkxgO9gdLNv3oWdKiKXX7r8bu6rlJcAA9ZRfMt5oHoIAAAAASUVORK5CYII%3D") 5 0, pointer; }
     15.styles-admin .macos .stop-markers { cursor: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAARCAYAAADdRIy%2BAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAelJREFUeNqMVDuPAVEYvbNEtYlniMRGiKg2NAoS2caj8Af8AL0foVdJVAqNBA2VxFYahQrR2ERCsokQCrG7xGu%2F%2Fe63TBgzEyc5zsx9nHvvd%2BZ6AgAmpdFoBMb4430f5xWcyI%2Bz%2FkM6OB6PwwVKplcwIX%2FOStAyCfr9PnsAfEdPyBfkF%2FIV%2BYn8vTPUaDSPGL4jn%2FlwpAVZRZ6Q33LHuTmyVqsldTqdEIvFzs20QxfyDTk7q4vapYY%2Bn080DAaD0Gw26TkQCIiLhMNhUKohmUQiETEAQRBo4ul0glwuJ5qn02nSUChEajabQTZlvhpHt9slU7fbDY9A8Qvw%2B%2F0wHo%2BlAwmdToe01WrB8XiEdrtN75PJRNmwWCyC1%2BuF9XpNg3e7HelyuQSTyUTtHo%2BH2iwWC%2BlgMFA25D%2BVSgUSicTNkWazGdXpcDjQ5Ol0Cna7nfqy2ay6IafNZqM6XrBYLOASkMPhgNVqBQaDQSxLrVZTNyyVSqDX66HX64mm%2BXyeNJVKkWYyGeAlUr3n1y%2FVahWsVisMh0PVdOv1uqKhILnsFFK5XGaFQoHpdDo2n8%2FZfr9no9GIYSgsGo3yiYLipZRbhdeTd8mRB6i0O9kdcjQaDdhut2yz2TC8y0RMnGFQLJlMCmr%2FGn8CDADjZb9gHU6eaQAAAABJRU5ErkJggg%3D%3D") 5 0, pointer; }
     16.styles-admin .bgPicker .data { display: none; }
     17.styles-admin .bgPicker .data label { display: block; }
     18.styles-admin .bgPicker .types a { background: url(/wp-content/plugins/styles/css/bg-sprites.png) no-repeat 3px 4px; text-indent: -9999px; overflow: hidden; display: inline-block; width: 16px; height: 12px; padding: 3px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; }
     19.styles-admin .bgPicker .types a.active, .styles-admin .bgPicker .types a:hover { background-color: #C1E7FF; }
     20.styles-admin .bgPicker .types a[data-type="gradient"] { background-position: -47px 4px; }
     21.styles-admin .bgPicker .types a[data-type="bg_color"] { background-position: -97px 4px; }
     22.styles-admin .bgPicker .types a[data-type="transparent"] { background-position: -147px 4px; }
     23.styles-admin .bgPicker .types a[data-type="hide"] { background-position: -197px 4px; }
     24.styles-admin .bgPicker .types a[data-type="font"] { background-position: -247px 4px; }
     25.styles-admin .background-image { display: none; }
     26.styles-admin .pds_image .current { margin-bottom: 5px; }
     27.styles-admin .pds_image .current img { height: 80px; }
     28.styles-admin .pds_image .pds_image_input { width: 60%; }
     29.styles-admin .imagePreview { max-height: 80px; display: block; margin: 10px; }
     30.styles-admin .colorPicker { width: 20px; height: 20px; border: 4px solid #ccc; border-radius: 4px; }
     31.styles-admin .pds_color_input { width: 20px; font-size: 9px; text-transform: uppercase; }
     32.styles-admin .ui table.jPicker { background: transparent; border: 0px none transparent; }
     33.styles-admin .font { display: none; }
     34.styles-admin .pds_font_select option { text-indent: 10px; }
     35.styles-admin .pds_font_select option.label { font-family: Helvetica, Arial, sans-serif; font-size: 11px; color: #666; font-style: normal; font-weight: normal; text-indent: 0; margin-top: 10px; }
     36.styles-admin .pds_font_select option.first { margin-top: 0; }
     37.styles-admin .value-toggle { background: transparent url(/wp-content/plugins/styles/css/font-sprites.png) no-repeat 6px 6px; width: 9px; height: 12px; padding: 6px; text-indent: -9999px; overflow: hidden; display: inline-block; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; position: relative; top: 9px; }
     38.styles-admin .font-weight { width: 9px; height: 12px; }
     39.styles-admin .font-style { background-position: -13px 6px; }
     40.styles-admin .font-weight-bold, .styles-admin .font-style-italic { background-color: #C1E7FF; }
     41.styles-admin .text-transform { background-position: -57px 6px; }
     42.styles-admin .text-transform:hover { background-color: #C1E7FF; }
     43.styles-admin .text-transform-uppercase { background-position: -77px 6px; }
     44.styles-admin .text-transform-lowercase { background-position: -96px 6px; }
     45.styles-admin .line-height { background-position: -114px 6px; }
     46.styles-admin .line-height:hover { background-color: #C1E7FF; }
     47.styles-admin .line-height-125 { background-position: -134px 6px; }
     48.styles-admin .line-height-15 { background-position: -154px 6px; }
     49.styles-admin .line-height-175 { background-position: -174px 6px; }
     50.styles-admin .line-height-2 { background-position: -194px 6px; }
     51.styles-admin .pds_slider_ui { width: 200px; display: none; }
     52.styles-admin .notice { background-color: #ffebe8; border-color: #c00; border-width: 1px; border-style: solid; padding: 0 0.6em; margin: 5px 15px 2px; -moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; margin: 5px 0 15px; }
     53.styles-admin .notice a { color: #c00; }
     54.styles-admin .notice p { margin: 0.5em 0; line-height: 1; padding: 2px; }
     55.styles-admin img.waiting { display: none; }
     56.styles-admin small { font-weight: normal; color: #777; }
     57.styles-admin .inside ul { margin-left: 20px; }
     58.styles-admin .inside ul li { list-style: square; line-height: 16px; }
     59.styles-admin .inside ul li.rss { list-style-image: url(/wp-includes/images/rss.png); }
     60.styles-admin .inside ul li.email { list-style-image: url(http://cdn.yoast.com/email_sub.png); }
     61.styles-admin .inside .text { width: 250px; }
    22062
    22163/* END StormStyles */
    22264/* Color Picker */
    223 table.jPicker {
    224   line-height: 1;
    225   padding: 0;
    226   width: 290px; }
    227   table.jPicker input, table.jPicker textarea, table.jPicker select {
    228     padding: 0; }
    229   table.jPicker .Title {
    230     display: none; }
    231   table.jPicker .Map {
    232     margin-top: 22px; }
    233   table.jPicker td.Radio {
    234     width: 45px; }
    235   table.jPicker td.Text input {
    236     height: 21px;
    237     padding: 3px;
    238     width: 37px; }
    239   table.jPicker .AHex {
    240     display: none; }
    241   table.jPicker .Button hr {
    242     display: none; }
    243   table.jPicker .Grid {
    244     display: none; }
    245   table.jPicker div.Map {
    246     width: 128px;
    247     height: 128px; }
    248   table.jPicker div.Bar {
    249     width: 20px;
    250     height: 128px; }
    251   table.jPicker tr.Hue, table.jPicker tr.Saturation, table.jPicker tr.Value {
    252     display: none; }
    253   table.jPicker .Preview {
    254     text-align: left;
    255     padding-left: 20px; }
    256     table.jPicker .Preview div {
    257       width: 32px;
    258       height: 18px;
    259       margin: 0; }
    260       table.jPicker .Preview div span {
    261         width: 14px;
    262         height: 17px;
    263         float: left; }
    264   table.jPicker td.Radio {
    265     width: 14px; }
    266   table.jPicker input[type="radio"] {
    267     display: none; }
    268   table.jPicker input {
    269     font-family: Courier, monospace;
    270     font-size: 11px; }
    271   table.jPicker input.Hex {
    272     margin-left: 12px; }
     65table.jPicker { line-height: 1; padding: 0; width: 290px; }
     66table.jPicker input, table.jPicker textarea, table.jPicker select { padding: 0; }
     67table.jPicker .Title { display: none; }
     68table.jPicker .Map { margin-top: 22px; }
     69table.jPicker td.Radio { width: 45px; }
     70table.jPicker td.Text input { height: 21px; padding: 3px; width: 37px; }
     71table.jPicker .AHex { display: none; }
     72table.jPicker .Button hr { display: none; }
     73table.jPicker .Grid { display: none; }
     74table.jPicker div.Map { width: 128px; height: 128px; }
     75table.jPicker div.Bar { width: 20px; height: 128px; }
     76table.jPicker tr.Hue, table.jPicker tr.Saturation, table.jPicker tr.Value { display: none; }
     77table.jPicker .Preview { text-align: left; padding-left: 20px; }
     78table.jPicker .Preview div { width: 32px; height: 18px; margin: 0; }
     79table.jPicker .Preview div span { width: 14px; height: 17px; float: left; }
     80table.jPicker td.Radio { width: 14px; }
     81table.jPicker input[type="radio"] { display: none; }
     82table.jPicker input { font-family: Courier, monospace; font-size: 11px; }
     83table.jPicker input.Hex { margin-left: 12px; }
     84
     85@media only screen and (max-width:768px) { .styles-admin .primary { width: 100%; }
     86  .styles-admin .secondary { display: none; } }
  • styles/trunk/js/admin-media-upload.js

    r508741 r515734  
    11jQuery(function($) {
    22    $('#sidemenu a').each(function(){
    3         var href = $(this).attr('href')+'&StormStyles=1';
     3        var href = $(this).attr('href')+'&styles=1';
    44        $(this).attr('href', href );
    55    });
     6
     7    $('td.savesend input[value="Insert into Post"]').val('Select Image').addClass('button-primary');
    68});
  • styles/trunk/js/admin.js

    r509532 r515734  
    11jQuery(function($) {
    2     $('div.gradPicker', '#StormForm').gradientPicker();
    3     $('div.bgPicker', '#StormForm').bgPicker();
     2    $('div.gradPicker', '#styles-form').gradientPicker();
     3    $('div.bgPicker', '#styles-form').bgPicker();
    44
    55    // Color Picker
    6     $('input.pds_color_input', '#StormForm').change(function(){
     6    $('input.pds_color_input', '#styles-form').change(function(){
    77        if ( $(this).val().length < 3 ) {return;}
    88        $(this).css( 'color', '#'+$(this).val() );
     
    3434   
    3535    // Sliders for integer inputs
    36     $('input.slider', '#StormForm').each(function() {
     36    $('input.slider', '#styles-form').each(function() {
    3737        // Show/hide slider on input click
    3838        $(this).click(function( e ) {
     
    6767   
    6868    // Font buttons
    69     $('a.value-toggle', '#StormForm').click( fontToggles );
    70 
    71     $('select.pds_font_select', '#StormForm').change(function(){
     69    $('a.value-toggle', '#styles-form').click( fontToggles );
     70
     71    $('select.pds_font_select', '#styles-form').change(function(){
    7272        var src = $(this).val();
    7373        if ( src.indexOf("http://") != -1) {
     
    7878   
    7979    // AJAX Submit & Preview
    80     $('input.storm-submit', '#StormForm').click( saveStyles );
    81     $('input, select', '#StormForm').change( saveStyles );
     80    $('input.storm-submit', '#styles-form').click( saveStyles );
     81    $('input, select', '#styles-form').change( saveStyles );
    8282   
    8383    function saveStyles() {
     
    9292           
    9393            // Display waiting graphic
    94             var waiting = $('#StormForm img.waiting').show();
    95             window.response_wrapper = $('#StormForm span.response').html('');
     94            var waiting = $('#styles-form img.waiting').show();
     95            window.response_wrapper = $('#styles-form span.response').html('');
    9696
    9797            // Get form info
    98             var data = $('#StormForm').serialize();
     98            var data = $('#styles-form').serialize();
    9999            if ( preview ) { data = data + '&preview=1'; }
    100100
     
    184184            $image = $element.find('div.data input[name$="[image]"]'),
    185185            $stops = $element.find('div.data input[name$="[stops]"]'),
    186             $color = $element.find('div.data input[name$="[color]"]');
     186            $color = $element.find('div.data input[name$="[bg_color]"]');
    187187       
    188188        var colorPickerOpts = {
     
    296296           
    297297            switch ( type ) {
    298                 case 'color':       load_color();       break;
     298                case 'bg_color':       load_color();       break;
    299299                case 'transparent': load_transparent(); break;
    300300                case 'gradient':    load_gradient();    break;
    301301                case 'image':       load_image();       break;
    302302                case 'hide':        load_hide();       break;
    303             }
    304            
    305             $active.val( type );
     303                case 'font':        load_font();       break;
     304            }
     305           
     306            if ( type !== 'font' ) {
     307                $active.val( type );
     308            }
     309        }
     310       
     311        var load_font = function() {
     312            $ui.siblings('div.font').toggle();
     313            $ui.siblings('div.background-image').hide();
    306314        }
    307315       
    308316        var load_hide = function() {
    309317            $css.val('hide').change();
     318            $ui.siblings('div.background-image').hide();
    310319        }
    311320       
    312321        var load_transparent = function() {
    313322            $css.val('transparent').change();
     323            $ui.siblings('div.background-image').hide();
    314324        }
    315325       
     
    320330           
    321331            $css.val( $stops.val() ).change();
    322            
     332            $ui.siblings('div.background-image').hide();
    323333            $ui.append( gradientPicker );
    324334        }
     
    330340            $css.val( $image.val() ).change();
    331341           
     342            $ui.siblings('div.background-image').show();
    332343            $ui.append( imagePicker ).append( imagePreview );
    333344        }
     
    338349       
    339350        var load_color = function() {
     351            $ui.siblings('div.background-image').hide();
    340352           
    341353            var colorVal = $color.val().replace('#', '');
  • styles/trunk/js/jq.gradientpicker.js

    r508741 r515734  
    239239        var markerSlide = function(event, ui) {
    240240            var thisY = $(this).offset().top;
    241             var mouseY = event.pageY;
    242            
     241            var mouseY = event.originalEvent.pageY;
     242
    243243            if ( (mouseY - thisY) > 25 ) { // Mouse has moved more than X pixels below slider
    244244                if ( ! $(this).data('remove') ) { // Slider not yet flagged 'remove'
     
    278278                return;
    279279            }
     280           
     281            if ( e.layerX === undefined ) {
     282                var offset = $(this).offset();
     283                if ( offset != null ) { e.layerX = e.pageX - offset.left; }
     284            }
     285           
    280286            if ( value === undefined ) { value  = Math.round( e.layerX / $(this).width() * 100 ); }
    281287            if (   hex === undefined ) { hex = '000000'; }
     288           
     289            if ( isNaN(value) ) return;
    282290           
    283291            var marker = $('<div class="marker"/>');
  • styles/trunk/readme.txt

    r514441 r515734  
    44Author URI: http://brainstormmedia.com
    55Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FD4GKBGQFUZC8
    6 Tags: css, css3, scss, sass, scaffold, less, admin, gui, color picker, gradients, image upload, google fonts, user interface, twentyten, twentyeleven
     6Tags: css, stylesheet, scss, sass, scaffold, less, admin, gui, color picker, gradient, image upload, google fonts, user interface, twentyten, twentyeleven
    77Requires at least: 3.1
    88Tested up to: 3.3.1
    9 Stable tag: trunk
     9Stable tag: 0.5.0
    1010
    1111Change the appearance of supported themes using zero code. Creates appearance options for images, colors, gradients, and fonts.
     
    1313== Description ==
    1414
    15 TwentyTen/TwentyEleven support will always be free. We plan to release support for multiple themes in as a paid add-on to Styles. You can [vote for support](https://www.google.com/moderator/?authuser=2#16/e=1f6d0a) of specific themes on [this page](https://www.google.com/moderator/?authuser=2#16/e=1f6d0a).
     15Styles allows you to edit the appearance of themes that don't provide an interface in the WordPress admin for doing so. Themes supported by the free version include:
    1616
    17 Styles allows you to edit the appearance of themes that don't provide an interface in the WordPress admin for doing so. It provides:
     17* TwentyTen
     18* TwentyEleven
    1819
    19 * Background images
    20 * WordPress Media Uploader
     20Theme support is provided by a remote API, so the plugin will update as more themes are added. We plan to release support for more themes in as a paid add-on to Styles. Have a specific theme you'd like to see supported? [Vote on themes here](https://www.google.com/moderator/?authuser=2#16/e=1f6d0a).
     21
     22Styles provides:
     23
     24* Transfer of settings between themes
     25* Background images using WordPress Media Library
    2126* Photoshop-like Gradient Picker
    2227* Color Picker
    2328* Google Fonts
    2429* Font size, color, styling, and capitalization
    25 * Live preview
     30* Replace HTML elements with an image
     31* Live preview when site open in a second window
    2632
    27 The plugin includes full support for TwentyTen and TwentyEleven out of the box. Just enable the plugin, and you can start playing with your site's look under Appearance > Styles.
     33Enable the plugin to start playing with your site's look under `Appearance > Styles`.
    2834
    2935Here's a quick demo of how it works in TwentyEleven:
     
    3137[youtube http://www.youtube.com/watch?v=2gbRFFxx1GY]
    3238
    33 This plugin requires [PHP 5.2](https://codex.wordpress.org/Switching_to_PHP5), which is the minimum supported version as of WordPress 3.2.
     39This plugin requires [PHP 5.2](https://codex.wordpress.org/Switching_to_PHP5), the minimum supported version as of WordPress 3.2.
    3440
    3541== Installation ==
     
    37431. Upload the `styles` folder to the `/wp-content/plugins/` directory
    38441. Activate the plugin through the 'Plugins' menu in WordPress
    39 1. If using a supported theme, start using the plugin under Appearance > Styles
    40 1. If creating a GUI for a theme of your own, copy one of the example stylesheets in `styles/themes` to `wp-content/themes/your-theme/styles-admin.css` and start editing!
     451. Start using the plugin under `Appearance > Styles`
     461. Preview your changes by opening your site an a second window.
    4147
    4248== Screenshots ==
     
    4955== FAQ ==
    5056
     57= What features do you plan to charge for? =
     58
     59Support for WordPress default themes, such as TwentyTen and TwentyEleven, will always be free. We plan to charge in the future for additional features such as:
     60
     61* Additional themes
     62* Access to support forums
     63* Documentation on how to setup custom themes or additional elements
     64
    5165= Will this plugin slow down my site? =
    5266
    5367No! Styles is very careful about only loading what is absolutely required to get its job done. CSS settings are processed once when you click the "save" button. After that, all the work is done. A single compressed CSS file is all that's added to your site's front-end.
    54 
    55 = Can I integrate Styles with my theme? =
    56 
    57 Styles will work with any theme that uses CSS for its appearance, and that's 100% of the themes out there. If you'd like to create your own GUI for a theme that's not supported out of the box, copy one of the example stylesheets in `styles/themes` to `wp-content/themes/your-theme/styles-admin.css` and start editing!
    58 
    59 Adding theme settings from scratch can be a daunting task requiring hundreds of lines of code. Using styles, you can have a fully working GUI with 1 line of CSS.
    6068
    6169= Styles says it can't write to a file when I try to save =
     
    6775Styles uses portions of Anthony Short's [Scaffold](https://github.com/anthonyshort/scaffold), which is a CSS pre-processor similar to Less, SASS, or Compass. Basically, Scaffold understands CSS and is written in PHP. WordPress is also written in PHP, so Scaffold is able to communicate to WordPress about the structure and content of CSS files.
    6876
    69 = Can I use Styles as a replacement for Less, SASS, or Compass? =
     77= Can I use Styles as a replacement for Less, Sass, or Compass? =
    7078
    71 We used Styles + Scaffold as our main CSS Processor for a very long time, but the plugin as it exists today would not be appropriate for that purpose. We've pared the CSS processing libraries down to a bare minimum to keep things as simple and stable as possible to solve one problem: creating a theme UI. For general purpose CSS processing, you'll be much better off using one of the many desktop-based libraries.
     79For general purpose CSS processing, you'll be much better off using one of the many desktop-based libraries. We used Styles + Scaffold as our main CSS Processor for a very long time. However, the plugin as it exists today would not be appropriate for that purpose. We've pared the CSS processing libraries down to a bare minimum to keep things as simple and stable as possible. The plugin as it is today is meant only to create a theme user interface.
    7280
    7381== Changelog ==
     82
     83= 0.5.0 =
     84* Load themes from API: Allows for theme support to be added without plugin updates.
     85* New data structure: Allow settings to migrate from theme to theme
     86* Automatically rebuild CSS when theme is switched
     87* Wrap font settings into other options. This sets the stage to simplify the user interface in a future version.
     88* Add option to hide text and replace with image on any element
     89* Expand TwentyTen options
     90* Gradient Picker: Fix add marker, drag to remove marker
     91* Massive code clean-up: Removed 1,198 lines of code; modified 2,488
     92* Minor UI tweaks
    7493
    7594= 0.4.1 =
  • styles/trunk/styles.php

    r509532 r515734  
    44Plugin URI: http://stylesplugin.com
    55Description: Change the appearance of your theme using the WordPress admin. Creates WordPress theme options for images, colors, gradients, and fonts.
    6 Version: 0.4.1
     6Version: 0.5.0
    77Author: Brainstorm Media
    88Author URI: http://brainstormmedia.com
    9 Inspiration: sivil, gravity, CSS Scaffold, will norris, mingle
    10 Contributors: Anthony Short, sivil
     9*/
    1110
    12 ------------------------------------------------------------------------
    13 Copyright 2010  Paul Clark  (email : pdclark (at) brainstormmedia.com)
     11/**
     12 * This plugin is made possible in part by code reuse from the following authors:
     13 *
     14 *   Anthony Short, Scaffold: https://github.com/anthonyshort/Scaffold
     15 *   Matt Martz (Sivel), Shadowbox: http://profiles.wordpress.org/sivel/
     16 *   Joost de Valk (Yoast), WordPress SEO: http://wordpress.org/extend/plugins/wordpress-seo/
     17 *
     18 * Thank you for being generous with your knowledge.
     19 *
     20 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     21 *
     22 * Copyright 2010 Brainstorm Media
     23 *
     24 * This program is free software; you can redistribute it and/or modify
     25 * it under the terms of the GNU General Public License as published by
     26 * the Free Software Foundation; either version 2 of the License, or
     27 * (at your option) any later version.
     28 *
     29 * This program is distributed in the hope that it will be useful,
     30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     32 * GNU General Public License for more details.
     33 *
     34 * You should have received a copy of the GNU General Public License
     35 * along with this program; if not, write to the Free Software
     36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     37 */
    1438
    15     This program is free software; you can redistribute it and/or modify
    16     it under the terms of the GNU General Public License as published by
    17     the Free Software Foundation; either version 2 of the License, or
    18     (at your option) any later version.
     39/**
     40 * PHP version check based on WP SEO by Joost de Valk http://yoast.com/wordpress/seo/
     41 */
     42if ( version_compare(PHP_VERSION, '5.2', '<') ) {
     43    if ( is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX) ) {
     44        require_once ABSPATH.'/wp-admin/includes/plugin.php';
     45        deactivate_plugins( __FILE__ );
     46       wp_die( sprintf( __('Styles requires PHP 5.2 or higher, as does WordPress 3.2 and higher. The plugin has now disabled itself. For more info, %s$1see this post%s$2.', 'Styles'), '<a href="http://codex.wordpress.org/Switching_to_PHP5">', '</a>') );
     47    }
     48}
    1949
    20     This program is distributed in the hope that it will be useful,
    21     but WITHOUT ANY WARRANTY; without even the implied warranty of
    22     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    23     GNU General Public License for more details.
    24 
    25     You should have received a copy of the GNU General Public License
    26     along with this program; if not, write to the Free Software
    27     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    28 
    29 */ 
    30 
    31 include dirname ( __FILE__ ) . '/classes/stormFirePHP/stormFirePHP.php';
    32 include dirname ( __FILE__ ) . '/classes/scaffold-bare/Observable.php';
    33 include dirname ( __FILE__ ) . '/classes/scaffold-bare/Observer.php';
    34 include dirname ( __FILE__ ) . '/classes/StormStylesObserver.php';
    35 include dirname ( __FILE__ ) . '/classes/StormCSSParser.php';
    36 include dirname ( __FILE__ ) . '/classes/Variable.php';
    37 include dirname ( __FILE__ ) . '/classes/Group.php';
     50/**
     51 * Instantiate the $StormStyles object
     52 */
     53function storm_styles_init() {
     54   
     55    require dirname ( __FILE__ ) . '/classes/stormFirePHP/stormFirePHP.php';
     56    require dirname ( __FILE__ ) . '/classes/storm-styles.php';
     57    require dirname ( __FILE__ ) . '/classes/storm-wp-frontend.php';
     58   
     59    if ( is_admin() || DOING_AJAX ) {
     60        // Only load heavy files if we're in wp-admin or processing CSS over AJAX
     61        require dirname ( __FILE__ ) . '/classes/storm-css-processor.php';
     62        require dirname ( __FILE__ ) . '/classes/storm-wp-settings.php';
     63        require dirname ( __FILE__ ) . '/classes/storm-wp-admin.php';
     64    }
     65   
     66    $storm_styles = new Storm_Styles();
     67   
     68}
     69add_action('init', 'storm_styles_init');
    3870
    3971
    40 /**
    41  * Common actions between admin and front-end.
    42  *
    43  * This class contains all the shared functions required for StormStyless to work
    44  *
    45  * @package StormStyles
    46  * @author pdclark
    47  **/
    4872
    49 class StormStyles extends Scaffold_Extension_Observable {
    50    
    51     /**
    52      * Plugin Version
    53      *
    54      * Holds the current plugin version.
    55      *
    56      * @since 0.1
    57      * @var int
    58      **/
    59     var $version = '0.4.1';
    60    
    61     /**
    62      * Plugin DB version
    63      *
    64      * Holds the current plugin database version.
    65      * Not the same as the current plugin version.
    66      *
    67      * @var int
    68      **/
    69     var $db_version = '0.4';
    70    
    71     /**
    72      * Options array containing all options for this plugin
    73      *
    74      * @since 0.1
    75      * @var string
    76      **/
    77     var $options;
    78    
    79     /**
    80      * Full file system path to the main plugin file
    81      *
    82      * @since 0.1
    83      * @var string
    84      */
    85     var $plugin_file;
    8673
    87     /**
    88      * Path to the main plugin file relative to WP_CONTENT_DIR/plugins
    89      *
    90      * @since 0.1
    91      * @var string
    92      */
    93     var $plugin_basename;
    94    
    95     /**
    96      * Path to CSS file being manipulated
    97      *
    98      * @since 0.1
    99      * @var string
    100      **/
    101     var $file = false;
    102    
    103     /**
    104      * Setup shared functionality between admin and front-end
    105      *
    106      * @author Matt Martz <[email protected]>
    107      * @since 0.1
    108      * @return none
    109      **/
    110     function __construct() {
    111         $this->register_scripts();
    112         $this->load_extensions( $this->plugin_dir_path() . 'gui' );
    113 
    114         // ajax hooks so that we can access WordPress within Scaffold
    115         add_action('parse_request', array( &$this, 'parse_request') );
    116         add_filter('query_vars', array( &$this, 'query_vars') );
    117        
    118         // If we loaded CSS through @import, tell WordPress to dequeue
    119         add_action( 'wp_print_styles', array( &$this , 'dequeue_at_imports' ), 0);
    120        
    121         // search for and process enqueued SCSS files
    122         add_action( 'wp_print_styles', array( &$this , 'build' ), 9999);
    123         add_action( 'admin_print_styles', array( &$this , 'build' ), 0);
    124 
    125         // Frontend
    126         add_action ( 'template_redirect' , array( &$this , 'frontend_js' ) );
    127        
    128         // Admin Bar
    129         add_action( 'admin_bar_menu', array( &$this, 'admin_bar' ), 95 );
    130 
    131         // Full path and plugin basename of the main plugin file
    132         $this->plugin_file = __FILE__;
    133         $this->plugin_basename = plugin_basename ( $this->plugin_file );
    134 
    135     }
    136    
    137     function admin_bar() {
    138         global $wp_admin_bar;
    139         if ( current_user_can('manage_options') && is_admin_bar_showing() ) {
    140             $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'storm-styles', 'title' => __( 'Styles' ), 'href' => admin_url('themes.php?page=StormStyles'), ) );
    141         }
    142        
    143     }
    144    
    145     /**
    146      * @since 0.1
    147      * @return void
    148      **/
    149     function register_scripts() {
    150         wp_register_script('storm-colorpicker'    , $this->plugin_url().'/js/colorpicker/js/colorpicker.js',array('jquery'), $this->version, true);
    151         wp_register_script('storm-jq-ui-slider'   , $this->plugin_url().'/js/jquery.ui.slider.min.js'      ,array('jquery', 'jquery-ui-core' ), $this->version, true);
    152         wp_register_script('storm-gradient-picker', $this->plugin_url().'/js/jq.gradientpicker.js'         ,array('storm-jq-ui-slider', 'storm-colorpicker' ), $this->version, true);
    153         wp_register_script('jqcookie'             , $this->plugin_url().'/js/jquery.cookie.js'             ,array('jquery'), $this->version, true);
    154 
    155         wp_register_script('storm-admin-main'     , $this->plugin_url().'/js/admin.js'                ,array('jqcookie', 'storm-gradient-picker', 'storm-jq-ui-slider', 'storm-colorpicker', 'thickbox', 'media-upload' ), $this->version, true);
    156     }
    157    
    158     /**
    159      * Enqueue javascript required for the front-end editor
    160      *
    161      * @return none
    162      * @since 0.1
    163      */
    164     function frontend_js() {
    165        
    166         if ( !current_user_can ( 'manage_options' ) ) {
    167             return;
    168         }
    169 
    170         // Live Preview
    171         wp_enqueue_script('storm-frontend', $this->plugin_url().'/js/frontend-main.js', array('jqcookie', 'jquery', ), $this->version, true);
    172        
    173         wp_localize_script ( 'storm-frontend' , 'storm_frontend' , array(
    174             'ajaxurl'    => admin_url('admin-ajax.php') ,
    175         ) );
    176     }
    177    
    178     /**
    179      * Get specific option from the options table
    180      *
    181      * @author Matt Martz <[email protected]>
    182      * @param string $option Name of option option to be used as an array key for retreiving the specific value
    183      * @since 0.1
    184      * @return mixed
    185      **/
    186     function get_option($option) {
    187         if ( isset( $this->options[$option] ) ) {
    188             return $this->options[$option];
    189         }else {
    190             return false;
    191         }
    192     }
    193    
    194     /**
    195      * Get the full URL to the plugin
    196      *
    197      * @author Matt Martz <[email protected]>
    198      * @return string
    199      * @since 0.1
    200      */
    201     function plugin_url() {
    202         $plugin_url = plugins_url ( basename( dirname( __FILE__) ) );
    203         return $plugin_url;
    204     }
    205    
    206     /**
    207      * Get the full path to the plugin (with trailing slash)
    208      *
    209      * @since 0.1
    210      * @return string
    211      **/
    212     function plugin_dir_path() {
    213         return plugin_dir_path( __FILE__ );
    214     }
    215    
    216     /**
    217      * Strip ABSPATH from a path.
    218      *
    219      * @since 0.1
    220      * @return string
    221      **/
    222     function get_relative_path( $path ) {
    223         $path = str_replace( ABSPATH, '/', $path );
    224         return $path;
    225     }
    226    
    227     /**
    228      * Return an md5 based off of the current options of the plugin and the
    229      * current version of the plugin.
    230      *
    231      * This is used for creating unique cache files and for cache busting.
    232      *
    233      * @author Matt Martz <[email protected]>
    234      * @since 0.1
    235      * @return string
    236      */
    237     function md5() {
    238         return md5 ( serialize ( $this->options ) . $this->version );
    239     }
    240    
    241     /**
    242      * Deactivate this plugin and die
    243      *
    244      * Used to deactivate the plugin when files critical to it's operation can not be loaded
    245      *
    246      * @author Matt Martz <[email protected]>
    247      * @since 0.1
    248      * @return none
    249      */
    250     function deactivate_and_die( $file ) {
    251         load_plugin_textdomain ( 'StormStyles' , false , 'StormStyles/localization' );
    252         $message = sprintf ( __( "PD Styles has been automatically deactivated because the file <strong>%s</strong> is missing. Please reinstall the plugin and reactivate." ) , $file );
    253         if ( ! function_exists ( 'deactivate_plugins' ) ) {
    254             include ( ABSPATH . 'wp-admin/includes/plugin.php' );
    255         }
    256         deactivate_plugins ( __FILE__ );
    257         wp_die ( $message );
    258     }
    259    
    260     /**
    261      * Load and output a view file. Pass it some data somehow.
    262      *
    263      * @since 0.1
    264      * @return void
    265      **/
    266     function load_view($view) {
    267        
    268         $file = dirname ( __FILE__ ) . '/views/'.$view;
    269        
    270         if ( ! @include ( $file ) ) {
    271             _e ( sprintf ( '<div id="message" class="updated fade"><p>The file <strong>%s</strong> is missing.  Please reinstall the plugin.</p></div>' , $file ), 'StormStyles' );
    272         }
    273     }
    274    
    275     /**
    276      * Pass ?scaffold&file=file.css requests to CSS Scaffold
    277      *
    278      * @since 0.1
    279      * @return void
    280      **/
    281     function parse_request() {
    282         // only process requests with "?scaffold"
    283         if ( isset( $_GET['scaffold'] ) ) {
    284 
    285             $this->render();
    286 
    287             exit;
    288         }
    289     }
    290    
    291     function render( $file = '' ) {
    292        
    293         $this->load_extensions( $this->plugin_dir_path() . 'extensions' );
    294         $this->load_file();
    295        
    296         if ( isset( $_GET['scaffold'] ) ) {
    297             // Output to browser
    298             header('Content-type: text/css');
    299             echo $this->css->contents;
    300             exit;
    301         }else {
    302             return $this->css->contents;
    303         }
    304     }
    305    
    306     /**
    307      * Whitelist the scaffold query var for parse_request()
    308      *
    309      * @since 0.1
    310      * @return void
    311      **/
    312     function query_vars($vars) {
    313         $vars[] = 'scaffold';
    314         return $vars;
    315     }
    316    
    317     /**
    318      * Loads the extension files
    319      * @author your name
    320      * @param $param
    321      * @return return type
    322      */
    323     public function load_extensions( $path ) { 
    324         # Scaffold_Helper object
    325         // $helper = $this->getHelper();
    326        
    327         # The glob path
    328         $path = realpath($path) . DIRECTORY_SEPARATOR . '*';
    329 
    330         # Load each of the extensions
    331         foreach(glob($path) as $ext) {
    332             $config     = array();
    333             $name       = basename( pathinfo( $ext, PATHINFO_FILENAME ) );
    334             $class      = 'StormStyles_Extension_' . $name;
    335             $file       = $ext.DIRECTORY_SEPARATOR.$name.'.php';
    336             $include = true;
    337            
    338             if ( 'php' == pathinfo($ext, PATHINFO_EXTENSION) ) {
    339                 include $ext;
    340             }else if ( file_exists($file) && is_dir($ext)) {
    341                 require_once realpath( $file );
    342             }else {
    343                 $include = false;
    344             }
    345            
    346             if ($include) {
    347                 $object = new $class($config);
    348                 // $object->attach_helper($helper);
    349                 $this->attach($name,$object);
    350             }
    351         }
    352         // return $scaffold;
    353     }
    354    
    355     function file_path() {
    356         global $blog_id;
    357        
    358         $uri = $path = $cache_path = $cache_uri = false;
    359        
    360         if ( !empty($_GET['file']) ) {
    361             $search_paths = array(
    362                 $_GET['file'],
    363                 trailingslashit(ABSPATH).$_GET['file'],
    364             );
    365         }
    366 
    367         $search_paths[] = get_stylesheet_directory().'/css/styles-admin.css';
    368         $search_paths[] = get_stylesheet_directory().'/styles-admin.css';
    369         $search_paths[] = $this->plugin_dir_path().'themes/'.get_template().'.css';
    370        
    371        
    372         // Search for CSS file in order of priority and stop at the first one found
    373         foreach ($search_paths as $file ) {
    374             if ( file_exists($file) ) {
    375                 $path = $file;
    376                 break;
    377             }
    378         }
    379 
    380         if ( empty($path) ) {
    381             FB::error('Could not find CSS to load for Styles GUI in '.__FILE__.':'.__LINE__);
    382             return false;
    383         }
    384        
    385         // URI for enqueing
    386         $uri = str_replace( ABSPATH, '', $path );
    387 
    388         // Cache file
    389         $upload_dir = wp_upload_dir();
    390         if ( is_multisite() ) {
    391             $cache_file = "/styles/style-$blog_id.css";
    392         }else {
    393             $cache_file = "/styles/style.css";
    394         }
    395        
    396         $cache_dir = dirname($upload_dir['basedir'].$cache_file);
    397         if ( wp_mkdir_p( $cache_dir ) && is_writable( $cache_dir ) ) {
    398             $cache_path = $upload_dir['basedir'].$cache_file;
    399             $cache_uri = $upload_dir['baseurl'].$cache_file;
    400         }else {
    401             $cache_path = false;
    402         }
    403        
    404         $array = compact('uri', 'path', 'cache_path', 'cache_uri');
    405        
    406         return $array;
    407     }
    408    
    409     /**
    410      * Initialize files object based on WordPress style queue
    411      *
    412      * @since 0.1.3
    413      * @return void
    414      **/
    415     function load_file() {
    416         global $blog_id;
    417 
    418         // Find SCSS file
    419         $file = apply_filters( 'storm_styles_file_path', $this->file_path() );
    420         if ( !$file ) {
    421             return;
    422         }
    423 
    424         if ( is_admin() || isset($_GET['scaffold']) || 'admin-ajax.php' == basename($_SERVER['PHP_SELF']) ) {
    425             // Load up variables from SCSS if we're in Admin or running a cache save via AJAX
    426            
    427             if ( isset($_GET['preview']) ) {
    428                 $this->options = get_option( 'StormStyles-preview' );
    429             }else {
    430                 $this->options = get_option( 'StormStyles' );
    431             }
    432 
    433             $this->css = new StormCSSParser( $file['path'], $this );
    434 
    435             if ( !isset($_GET['scaffold']) ) {
    436                 // No need to init vars if we're just outputting
    437                 $this->file   = new StormStyles_Extension_Variable( $file, $this );
    438 
    439                 // Merge values from database into variable objects
    440                 if ( @is_object( $this->options['variables'] ) && is_object($this->file) ) {
    441                     $this->file->set( $this->options['variables']->get() );
    442                 }
    443             }
    444         }
    445        
    446         if ( false !== $this->file ) { return; }
    447 
    448         if ( BSM_DEVELOPMENT === true ){
    449            
    450             // Development: Force re-render on every CSS load
    451             wp_enqueue_style('storm-scaffold', '/?scaffold', array(), time() );
    452            
    453         }else if ( $file['cache_uri'] !== false) {
    454             // Enqueue cached output
    455             wp_enqueue_style('storm-scaffold', $file['cache_uri'] );
    456 
    457         }else {
    458             add_action( 'wp_head', array($this, wp_head_output), 999 );
    459         }
    460 
    461         // Merge values from database into variable objects
    462         if ( is_object( $this->options ) && is_object($this->file) ) {
    463             $this->file->set( $this->options->get() );
    464         }
    465     }
    466    
    467     /**
    468      * Load CSS variables, extensions, and scaffold objects
    469      *
    470      * @since 0.1
    471      * @return void
    472      **/
    473     function build() {
    474         $this->load_file();
    475     }
    476    
    477     function wp_head_output() {
    478         $css = get_option('StormStyles-cache');
    479         if (!empty($css)) {
    480             echo "<style id='storm-scaffold-css'>$css</style>";
    481         }
    482     }
    483    
    484     function dequeue_at_imports() {
    485         global $wp_styles;
    486        
    487         $options = get_option( 'StormStyles' );
    488         $loaded = $options['loaded_imports'];
    489        
    490         foreach( $wp_styles->queue as $handle ) {
    491             $src = $wp_styles->registered[$handle]->src;
    492            
    493             $src_rel = str_replace( $wp_styles->content_url, '', $src );
    494            
    495             foreach ( (array)$loaded as $abspath ) {
    496                 if ( false !== strpos( $abspath, $src_rel ) ) {
    497                     // This file was loaded via @import. Dequeue it.
    498                     wp_dequeue_style( $handle );
    499                 }
    500             }
    501         }
    502        
    503     }
    504    
    505    
    506 } // END StormStyles class
    507 
    508 /**
    509  * Instantiate the StormStylesFrontend or $StormStylesController Class
    510  *
    511  * Deactivate and die if files can not be included
    512  */
    513 function StormStylesInit() {
    514    
    515     if ( is_admin () ) {
    516    
    517         // Admin class
    518         $file = '/classes/StormStylesAdmin.php';
    519         if ( @include dirname ( __FILE__ ) . $file ) {
    520             global $StormStylesController;
    521             $StormStylesController = new StormStylesAdmin ();
    522            
    523         } else {
    524             StormStyles::deactivate_and_die ( dirname ( __FILE__ ) . $file );
    525         }
    526     } else {
    527         // Just the basics
    528         global $StormStylesController;
    529         $StormStylesController = new StormStyles ();
    530     }
    531 }
    532 add_action('init', 'StormStylesInit');
    533 
    534 ?>
  • styles/trunk/uninstall.php

    r508741 r515734  
    11<?php
    22/**
    3  * Uninstalls the StormStyles options when an uninstall has been requested
     3 * Uninstalls the Styles options when an uninstall has been requested
    44 * from the WordPress admin
    5  *
    6  * @package StormStyles
    7  * @subpackage uninstall
    8  * @since 0.1
    95 */
    106
    117// If uninstall/delete not called from WordPress then exit
    128if( ! defined ( 'ABSPATH' ) && ! defined ( 'WP_UNINSTALL_PLUGIN' ) )
    13     exit ();
     9    exit();
    1410
    1511// Delete shadowbox option from options table
    16 delete_option ( 'StormStyles' );
    17 delete_option ( 'StormStyles-preview' );
     12delete_option ( 'styles' );
     13delete_option ( 'styles-preview' );
     14delete_option ( 'styles-cache' );
     15delete_option ( 'styles-settings' );
    1816
    1917// Remove files
    20 #   $upload_dir = wp_upload_dir ();
    21 #   $shadowbox_dir = "{$upload_dir['basedir']}/shadowbox-js/";
    22 #   if ( is_dir ( $shadowbox_dir ) )
    23 #       @rmdir ( $shadowbox_dir );
     18$upload_dir = wp_upload_dir();
     19$styles_dir = "{$upload_dir['basedir']}/styles/";
     20if ( is_dir ( $styles_dir ) )
     21    @rmdir ( $styles_dir );
Note: See TracChangeset for help on using the changeset viewer.